fe6a8687c1
Add HS256 JWT-based authentication for local adapters (claude_local, codex_local) so agents authenticate automatically without manual API key configuration. The server mints short-lived JWTs per heartbeat run and injects them as PAPERCLIP_API_KEY. The auth middleware verifies JWTs alongside existing static API keys. Includes: CLI onboard/doctor JWT secret management, env command for deployment, config path resolution from ancestor directories, dotenv loading on server startup, event payload secret redaction, multi-status issue filtering, and adapter transcript parsing for thinking/user message kinds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import type { ServerAdapterModule } from "./types.js";
|
|
import { execute as claudeExecute } from "@paperclip/adapter-claude-local/server";
|
|
import { models as claudeModels } from "@paperclip/adapter-claude-local";
|
|
import { execute as codexExecute } from "@paperclip/adapter-codex-local/server";
|
|
import { models as codexModels } from "@paperclip/adapter-codex-local";
|
|
import { processAdapter } from "./process/index.js";
|
|
import { httpAdapter } from "./http/index.js";
|
|
|
|
const claudeLocalAdapter: ServerAdapterModule = {
|
|
type: "claude_local",
|
|
execute: claudeExecute,
|
|
models: claudeModels,
|
|
supportsLocalAgentJwt: true,
|
|
};
|
|
|
|
const codexLocalAdapter: ServerAdapterModule = {
|
|
type: "codex_local",
|
|
execute: codexExecute,
|
|
models: codexModels,
|
|
supportsLocalAgentJwt: true,
|
|
};
|
|
|
|
const adaptersByType = new Map<string, ServerAdapterModule>(
|
|
[claudeLocalAdapter, codexLocalAdapter, processAdapter, httpAdapter].map((a) => [a.type, a]),
|
|
);
|
|
|
|
export function getServerAdapter(type: string): ServerAdapterModule {
|
|
const adapter = adaptersByType.get(type);
|
|
if (!adapter) {
|
|
// Fall back to process adapter for unknown types
|
|
return processAdapter;
|
|
}
|
|
return adapter;
|
|
}
|
|
|
|
export function listAdapterModels(type: string): { id: string; label: string }[] {
|
|
return adaptersByType.get(type)?.models ?? [];
|
|
}
|