Compare commits

...

1 Commits

Author SHA1 Message Date
Chris Farhood 1d894f104f fix(models): expose static models list so UI renders entries before listModels resolves
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 07:42:44 -04:00
4 changed files with 26 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "paperclip-adapter-claude-k8s", "name": "paperclip-adapter-claude-k8s",
"version": "0.1.54", "version": "0.1.55",
"description": "Paperclip adapter plugin that runs Claude Code agents as Kubernetes Jobs", "description": "Paperclip adapter plugin that runs Claude Code agents as Kubernetes Jobs",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
+2 -1
View File
@@ -1,7 +1,8 @@
export const type = "claude_k8s"; export const type = "claude_k8s";
export const label = "Claude (Kubernetes)"; export const label = "Claude (Kubernetes)";
export const models: undefined = undefined; import { DIRECT_MODELS, BEDROCK_MODELS, isBedrockEnv } from "./server/models.js";
export const models = isBedrockEnv() ? BEDROCK_MODELS : DIRECT_MODELS;
export const agentConfigurationDoc = `# claude_k8s agent configuration export const agentConfigurationDoc = `# claude_k8s agent configuration
+20 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest"; import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { listK8sModels } from "./models.js"; import { listK8sModels, DIRECT_MODELS, BEDROCK_MODELS } from "./models.js";
describe("listK8sModels", () => { describe("listK8sModels", () => {
const savedEnv: Record<string, string | undefined> = {}; const savedEnv: Record<string, string | undefined> = {};
@@ -50,3 +50,22 @@ describe("listK8sModels", () => {
expect(models.some((m) => m.id === "claude-opus-4-7")).toBe(true); expect(models.some((m) => m.id === "claude-opus-4-7")).toBe(true);
}); });
}); });
describe("static model lists", () => {
it("DIRECT_MODELS is non-empty and has valid ids", () => {
expect(DIRECT_MODELS.length).toBeGreaterThan(0);
for (const m of DIRECT_MODELS) {
expect(typeof m.id).toBe("string");
expect(m.id.length).toBeGreaterThan(0);
expect(typeof m.label).toBe("string");
}
});
it("BEDROCK_MODELS is non-empty and all ids contain 'anthropic.'", () => {
expect(BEDROCK_MODELS.length).toBeGreaterThan(0);
for (const m of BEDROCK_MODELS) {
expect(m.id).toContain("anthropic.");
expect(typeof m.label).toBe("string");
}
});
});
+3 -3
View File
@@ -1,6 +1,6 @@
import type { AdapterModel } from "@paperclipai/adapter-utils"; import type { AdapterModel } from "@paperclipai/adapter-utils";
const DIRECT_MODELS: AdapterModel[] = [ export const DIRECT_MODELS: AdapterModel[] = [
{ id: "claude-opus-4-7", label: "Claude Opus 4.7" }, { id: "claude-opus-4-7", label: "Claude Opus 4.7" },
{ id: "claude-opus-4-6", label: "Claude Opus 4.6" }, { id: "claude-opus-4-6", label: "Claude Opus 4.6" },
{ id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" }, { id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" },
@@ -9,7 +9,7 @@ const DIRECT_MODELS: AdapterModel[] = [
{ id: "claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" }, { id: "claude-haiku-4-5-20251001", label: "Claude Haiku 4.5" },
]; ];
const BEDROCK_MODELS: AdapterModel[] = [ export const BEDROCK_MODELS: AdapterModel[] = [
{ id: "us.anthropic.claude-opus-4-7", label: "Bedrock Opus 4.7" }, { id: "us.anthropic.claude-opus-4-7", label: "Bedrock Opus 4.7" },
{ id: "us.anthropic.claude-opus-4-6-v1", label: "Bedrock Opus 4.6" }, { id: "us.anthropic.claude-opus-4-6-v1", label: "Bedrock Opus 4.6" },
{ id: "us.anthropic.claude-sonnet-4-6", label: "Bedrock Sonnet 4.6" }, { id: "us.anthropic.claude-sonnet-4-6", label: "Bedrock Sonnet 4.6" },
@@ -17,7 +17,7 @@ const BEDROCK_MODELS: AdapterModel[] = [
{ id: "us.anthropic.claude-haiku-4-5-20251001-v1:0", label: "Bedrock Haiku 4.5" }, { id: "us.anthropic.claude-haiku-4-5-20251001-v1:0", label: "Bedrock Haiku 4.5" },
]; ];
function isBedrockEnv(): boolean { export function isBedrockEnv(): boolean {
return ( return (
process.env.CLAUDE_CODE_USE_BEDROCK === "1" || process.env.CLAUDE_CODE_USE_BEDROCK === "1" ||
process.env.CLAUDE_CODE_USE_BEDROCK === "true" || process.env.CLAUDE_CODE_USE_BEDROCK === "true" ||