Ship Paseo-equivalent provider snapshot, AgentComposerBar, ACP dispatch rewrite with streaming/persist, permission prompts, and agent commands. Follow-up: pane-scoped chat resolution, CoderMessageList tool timeline, WS user-delta replace, and inference orphan tool_call stripping. Archive openspec v2-2; update CHANGELOG and CURRENT. Co-authored-by: Cursor <cursoragent@cursor.com>
109 lines
3.7 KiB
TypeScript
109 lines
3.7 KiB
TypeScript
/**
|
|
* Static provider mode metadata — lifted from Paseo provider-manifest.ts patterns.
|
|
*/
|
|
import type { ProviderMode } from './provider-types.js';
|
|
|
|
export interface ProviderManifestEntry {
|
|
defaultModeId: string | null;
|
|
modes: ProviderMode[];
|
|
/** Claude effort levels exposed as thinking options on models. */
|
|
thinkingOptions?: Array<{ id: string; label: string }>;
|
|
}
|
|
|
|
const CLAUDE_MODES: ProviderMode[] = [
|
|
{ id: 'default', label: 'Always Ask', description: 'Prompts for permission the first time a tool is used' },
|
|
{ id: 'auto', label: 'Auto mode', description: 'Model classifier reviews permission prompts automatically' },
|
|
{ id: 'acceptEdits', label: 'Accept File Edits', description: 'Automatically approves edit-focused tools' },
|
|
{ id: 'plan', label: 'Plan Mode', description: 'Analyze without executing tools or edits' },
|
|
{ id: 'bypassPermissions', label: 'Bypass', description: 'Skip all permission prompts', isUnattended: true },
|
|
];
|
|
|
|
const OPENCODE_MODES: ProviderMode[] = [
|
|
{ id: 'build', label: 'Build', description: 'Allows edits and tool execution' },
|
|
{ id: 'plan', label: 'Plan', description: 'Read-only planning mode' },
|
|
{ id: 'full-access', label: 'Full Access', description: 'Auto-approves all tool prompts', isUnattended: true },
|
|
];
|
|
|
|
const COPILOT_MODES: ProviderMode[] = [
|
|
{
|
|
id: 'https://agentclientprotocol.com/protocol/session-modes#agent',
|
|
label: 'Agent',
|
|
description: 'Default agent mode',
|
|
},
|
|
{
|
|
id: 'https://agentclientprotocol.com/protocol/session-modes#plan',
|
|
label: 'Plan',
|
|
description: 'Plan mode for multi-step work',
|
|
},
|
|
{
|
|
id: 'allow-all',
|
|
label: 'Allow All',
|
|
description: 'Automatically approves all tool, path, and URL requests',
|
|
isUnattended: true,
|
|
},
|
|
];
|
|
|
|
const CURSOR_CLI_MODES: ProviderMode[] = [
|
|
{ id: 'agent', label: 'Agent', description: 'Full agent capabilities with tool access' },
|
|
{ id: 'plan', label: 'Plan', description: 'Read-only planning mode' },
|
|
{ id: 'ask', label: 'Ask', description: 'Q&A read-only mode' },
|
|
];
|
|
|
|
const QWEN_PTY_MODES: ProviderMode[] = [
|
|
{ id: 'default', label: 'Default', description: 'Prompt for approval' },
|
|
{ id: 'plan', label: 'Plan', description: 'Plan only — no edits' },
|
|
{ id: 'auto-edit', label: 'Auto Edit', description: 'Auto-approve edit tools' },
|
|
{ id: 'auto', label: 'Auto', description: 'LLM classifier auto-approves safe actions' },
|
|
{ id: 'yolo', label: 'YOLO', description: 'Auto-approve all tools', isUnattended: true },
|
|
];
|
|
|
|
const CLAUDE_THINKING = [
|
|
{ id: 'low', label: 'Low' },
|
|
{ id: 'medium', label: 'Medium' },
|
|
{ id: 'high', label: 'High' },
|
|
{ id: 'xhigh', label: 'Extra High' },
|
|
{ id: 'max', label: 'Max' },
|
|
];
|
|
|
|
export const PROVIDER_MANIFEST: Record<string, ProviderManifestEntry> = {
|
|
claude: {
|
|
defaultModeId: 'default',
|
|
modes: CLAUDE_MODES,
|
|
thinkingOptions: CLAUDE_THINKING,
|
|
},
|
|
opencode: {
|
|
defaultModeId: 'build',
|
|
modes: OPENCODE_MODES,
|
|
},
|
|
copilot: {
|
|
defaultModeId: 'https://agentclientprotocol.com/protocol/session-modes#agent',
|
|
modes: COPILOT_MODES,
|
|
},
|
|
cursor: {
|
|
defaultModeId: 'agent',
|
|
modes: CURSOR_CLI_MODES,
|
|
},
|
|
goose: {
|
|
defaultModeId: null,
|
|
modes: [],
|
|
},
|
|
qwen: {
|
|
defaultModeId: 'default',
|
|
modes: QWEN_PTY_MODES,
|
|
},
|
|
};
|
|
|
|
export function getManifestModes(provider: string): ProviderMode[] {
|
|
return PROVIDER_MANIFEST[provider]?.modes ?? [];
|
|
}
|
|
|
|
export function getManifestDefaultModeId(provider: string): string | null {
|
|
return PROVIDER_MANIFEST[provider]?.defaultModeId ?? null;
|
|
}
|
|
|
|
export function isUnattendedMode(provider: string, modeId: string | undefined): boolean {
|
|
if (!modeId) return false;
|
|
const modes = getManifestModes(provider);
|
|
return modes.some((m) => m.id === modeId && m.isUnattended);
|
|
}
|