mirror of
https://github.com/khoaliber/paperclip.git
synced 2026-04-19 17:14:40 +00:00
Agent management: hire endpoint with permission gates and pending_approval status, config revision tracking with rollback, agent duplicate route, permission CRUD. Block pending_approval agents from auth, heartbeat, and assignments. Approvals: revision request/resubmit flow, approval comments CRUD, issue-approval linking, auto-wake agents on approval decisions with context snapshot. Costs: per-agent breakdown, period filtering (month/week/day/all), cost by agent list endpoint. Adapters: agentConfigurationDoc on all adapters, /llms/agent-configuration.txt reflection routes. Inject PAPERCLIP_APPROVAL_ID, PAPERCLIP_APPROVAL_STATUS, PAPERCLIP_LINKED_ISSUE_IDS into adapter environments. Sidebar badges endpoint for pending approval/inbox counts. Dashboard and company settings extensions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import type { ServerAdapterModule } from "./types.js";
|
|
import { execute as claudeExecute } from "@paperclip/adapter-claude-local/server";
|
|
import { agentConfigurationDoc as claudeAgentConfigurationDoc, models as claudeModels } from "@paperclip/adapter-claude-local";
|
|
import { execute as codexExecute } from "@paperclip/adapter-codex-local/server";
|
|
import { agentConfigurationDoc as codexAgentConfigurationDoc, 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,
|
|
agentConfigurationDoc: claudeAgentConfigurationDoc,
|
|
};
|
|
|
|
const codexLocalAdapter: ServerAdapterModule = {
|
|
type: "codex_local",
|
|
execute: codexExecute,
|
|
models: codexModels,
|
|
supportsLocalAgentJwt: true,
|
|
agentConfigurationDoc: codexAgentConfigurationDoc,
|
|
};
|
|
|
|
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 ?? [];
|
|
}
|
|
|
|
export function listServerAdapters(): ServerAdapterModule[] {
|
|
return Array.from(adaptersByType.values());
|
|
}
|