c71d0e5eec
- Replaced streamPodLogs / streamPodLogsOnce / readPodLogs / waitForPodTermination with tailPodLogFile() that polls a shared PVC file path with adaptive cadence (250ms active, 1000ms idle after 5 consecutive empty polls) - Added buildPodLogPath() export and podLogPath to JobBuildResult - Added assertSafePathComponent with [a-zA-Z0-9-:] allowance for UUIDs - Updated Job manifest to tee stdout to /paperclip/instances/default/run-logs/<companyId>/<agentId>/<runId>.pod.ndjson - Added hasOutOfProcessLiveness: true to createServerAdapter (cast required) - Deleted log-dedup.ts and log-dedup.test.ts entirely - Removed all LogLineDedupFilter, Writable, and LOG_STREAM_* constants - Removed completionResult.status workaround (completionWithGrace returns directly) - Test infrastructure: mocked node:fs/promises to prevent unmocked fs.stat hangs Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import type { ServerAdapterModule } from "@paperclipai/adapter-utils";
|
|
import { getAdapterSessionManagement } from "@paperclipai/adapter-utils";
|
|
import { type, agentConfigurationDoc } from "../index.js";
|
|
import { listK8sModels, STATIC_MODELS } from "./models.js";
|
|
import { execute } from "./execute.js";
|
|
import { testEnvironment } from "./test.js";
|
|
import { sessionCodec } from "./session.js";
|
|
import { getConfigSchema } from "./config-schema.js";
|
|
import { listOpenCodeSkills, syncOpenCodeSkills } from "./skills.js";
|
|
|
|
export function createServerAdapter(): ServerAdapterModule {
|
|
return {
|
|
type,
|
|
execute,
|
|
testEnvironment,
|
|
sessionCodec,
|
|
models: STATIC_MODELS,
|
|
listModels: listK8sModels,
|
|
listSkills: listOpenCodeSkills,
|
|
syncSkills: syncOpenCodeSkills,
|
|
supportsLocalAgentJwt: true,
|
|
agentConfigurationDoc,
|
|
getConfigSchema,
|
|
supportsInstructionsBundle: true,
|
|
instructionsPathKey: "instructionsFilePath",
|
|
requiresMaterializedRuntimeSkills: false,
|
|
sessionManagement: getAdapterSessionManagement("opencode_local") ?? {
|
|
supportsSessionResume: true,
|
|
nativeContextManagement: "unknown",
|
|
defaultSessionCompaction: {
|
|
enabled: true,
|
|
maxSessionRuns: 20,
|
|
maxRawInputTokens: 500_000,
|
|
maxSessionAgeHours: 24,
|
|
},
|
|
},
|
|
// Tells the reaper to skip local PID checks and use the staleness-based
|
|
// liveness window instead (adapter spawns K8s Jobs in separate pods).
|
|
// Cast required: adapter-utils ServerAdapterModule type predates this field.
|
|
hasOutOfProcessLiveness: true,
|
|
} as ServerAdapterModule;
|
|
}
|
|
|
|
export { execute, testEnvironment, sessionCodec };
|