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:
2026-04-14 11:13:18 +00:00
parent 10a5004c02
commit 389bbb6f99
7 changed files with 395 additions and 19 deletions
+19 -2
View File
@@ -1,9 +1,22 @@
import type { ServerAdapterModule } from "@paperclipai/adapter-utils";
import type { ServerAdapterModule, AdapterSessionManagement } from "@paperclipai/adapter-utils";
import { type, models, agentConfigurationDoc } from "../index.js";
import { execute } from "./execute.js";
import { testEnvironment } from "./test.js";
import { sessionCodec } from "./session.js";
import { getConfigSchema } from "./config-schema.js";
import { listK8sSkills, syncK8sSkills } from "./skills.js";
import { listK8sModels } from "./models.js";
const sessionManagement: AdapterSessionManagement = {
supportsSessionResume: true,
nativeContextManagement: "confirmed",
defaultSessionCompaction: {
enabled: true,
maxSessionRuns: 0,
maxRawInputTokens: 0,
maxSessionAgeHours: 0,
},
};
export function createServerAdapter(): ServerAdapterModule {
return {
@@ -11,11 +24,15 @@ export function createServerAdapter(): ServerAdapterModule {
execute,
testEnvironment,
sessionCodec,
sessionManagement,
models,
listModels: listK8sModels,
listSkills: listK8sSkills,
syncSkills: syncK8sSkills,
supportsLocalAgentJwt: true,
agentConfigurationDoc,
getConfigSchema,
} as ServerAdapterModule;
};
}
export { execute, testEnvironment, sessionCodec };