mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-06 23:20:53 +01:00
Record stop-time ACP turn diagnostics (last-event age, oldest pending tool age, pending tool kinds) so wall-clock timeout events show whether the turn was stalled. Diagnostics only. Co-Authored-By: Paperclip <Paperclip-Paperclip@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.4 KiB
TypeScript
51 lines
2.4 KiB
TypeScript
export const DEFAULT_ACP_ENGINE_AGENT = "claude";
|
|
export const DEFAULT_ACP_ENGINE_MODE = "persistent";
|
|
export const DEFAULT_ACP_ENGINE_PERMISSION_MODE = "approve-all";
|
|
export const DEFAULT_ACP_ENGINE_NON_INTERACTIVE_PERMISSIONS = "deny";
|
|
export const DEFAULT_ACP_ENGINE_TIMEOUT_SEC = 0;
|
|
export const DEFAULT_ACP_ENGINE_WARM_HANDLE_IDLE_MS = 0;
|
|
|
|
// The bound on the ACP startup handshake (`runtime.ensureSession()`). This
|
|
// deadline is separate from, and much smaller than, the whole-adapter
|
|
// execution timeout: it bounds only the handshake, not the agent turn. A real
|
|
// handshake completes in a few seconds; this value gives it generous room
|
|
// before the host gives up and reports a closed timeout code.
|
|
export const ACPX_HANDSHAKE_TIMEOUT_MS = 60_000;
|
|
|
|
// How often the host polls the duplex control-channel disposition while the
|
|
// handshake is in flight. The read is a cheap, non-mutating getter, so a
|
|
// short interval costs nothing while giving the host near-immediate notice
|
|
// of a channel loss.
|
|
export const ACPX_HANDSHAKE_TRANSPORT_POLL_MS = 250;
|
|
|
|
// The bound on how long the host waits, after a latched terminal sandbox
|
|
// duplex-channel loss, for the agent to answer the `turn.cancel()` request.
|
|
// `cancel()` only asks the agent to end the turn; it does not end the turn by
|
|
// itself. An agent that stopped answering never honors it, so this deadline
|
|
// is the host-side bound that ends the run without the agent's help. It is
|
|
// much smaller than the whole-adapter execution timeout.
|
|
export const ACPX_DUPLEX_LOSS_CANCEL_DEADLINE_MS = 30_000;
|
|
|
|
// The closed ACP `ToolKind` enum. Run diagnostics may report these labels for
|
|
// pending tool calls; tool titles, names, and inputs never leave the run.
|
|
// Any other reported kind is collapsed to "unknown".
|
|
export const ACP_TOOL_KINDS = [
|
|
"read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "other",
|
|
] as const;
|
|
|
|
export const ACPX_ADAPTER_AGENT_IDS = {
|
|
claude_local: "claude",
|
|
codex_local: "codex",
|
|
gemini_local: "gemini",
|
|
kimi_local: "kimi",
|
|
custom_acp: "custom",
|
|
} as const;
|
|
|
|
export type AcpxAdapterType = keyof typeof ACPX_ADAPTER_AGENT_IDS;
|
|
export type AcpxAgentId = (typeof ACPX_ADAPTER_AGENT_IDS)[AcpxAdapterType];
|
|
|
|
export function acpxAgentIdForAdapterType(adapterType: string | null | undefined): AcpxAgentId | null {
|
|
if (!adapterType) return null;
|
|
return ACPX_ADAPTER_AGENT_IDS[adapterType as AcpxAdapterType] ?? null;
|
|
}
|