Add ServerAdapterModule capabilities from fork's adapter-utils 0.3.1
Bring the K8s adapter up to parity with the fork's ServerAdapterModule contract by adding sessionManagement, listSkills/syncSkills, listModels with Bedrock detection, and promptBundleKey support in the session codec. - Declare sessionManagement with nativeContextManagement: "confirmed" so Paperclip skips threshold-based session compaction (Claude manages its own context) - Add ephemeral skill management (listSkills/syncSkills) mirroring claude_local — reports skill state without runtime persistence since skills are injected via prompt bundle into ephemeral Job pods - Add listModels() with Bedrock environment detection, returning region-qualified model IDs when CLAUDE_CODE_USE_BEDROCK or ANTHROPIC_BEDROCK_BASE_URL are set - Extend session codec to round-trip promptBundleKey field - Remove the `as ServerAdapterModule` cast — the return type now satisfies the full interface Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { AdapterModel } from "@paperclipai/adapter-utils";
|
||||
import { models as DIRECT_MODELS } from "../index.js";
|
||||
|
||||
const BEDROCK_MODELS: AdapterModel[] = [
|
||||
{ id: "us.anthropic.claude-opus-4-6-v1", label: "Bedrock Opus 4.6" },
|
||||
{ id: "us.anthropic.claude-sonnet-4-5-20250929-v2:0", label: "Bedrock Sonnet 4.5" },
|
||||
{ id: "us.anthropic.claude-haiku-4-5-20251001-v1:0", label: "Bedrock Haiku 4.5" },
|
||||
];
|
||||
|
||||
function isBedrockEnv(): boolean {
|
||||
return (
|
||||
process.env.CLAUDE_CODE_USE_BEDROCK === "1" ||
|
||||
process.env.CLAUDE_CODE_USE_BEDROCK === "true" ||
|
||||
(typeof process.env.ANTHROPIC_BEDROCK_BASE_URL === "string" &&
|
||||
process.env.ANTHROPIC_BEDROCK_BASE_URL.trim().length > 0)
|
||||
);
|
||||
}
|
||||
|
||||
export async function listK8sModels(): Promise<AdapterModel[]> {
|
||||
return isBedrockEnv() ? BEDROCK_MODELS : DIRECT_MODELS;
|
||||
}
|
||||
Reference in New Issue
Block a user