mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Replace the split built-in command name list and switch with one typed registry, so a registered command without a handler is a compile error. Remove the broken themes/share/unshare/editor entries and the hardcoded init; server and custom commands now win on a name clash and built-ins dispatch by registry identity. Add /copy, /btw, /rename, /fork (message picker), /timeline, /model, /agent, /variants, /mcp, /skills, /settings and /connect. Open the model picker through state so /model and the select-model shortcut work while a response is running, load full session history in the fork picker, and keep attachments when a built-in command is submitted. Extract shared clipboard and primary-agent helpers, reuse CopyButton in the manager token settings, and update the Quick Start and chat docs.
26 lines
831 B
TypeScript
26 lines
831 B
TypeScript
export function getPrimaryAgents<T extends { mode?: string; hidden?: boolean }>(
|
|
agents: readonly T[] | undefined,
|
|
): T[] {
|
|
return agents?.filter(
|
|
(agent) => (agent.mode === 'primary' || agent.mode === 'all') && !agent.hidden,
|
|
) ?? []
|
|
}
|
|
|
|
export function getNextPrimaryAgentId<T extends { id: string; mode?: string; hidden?: boolean }>(
|
|
agents: readonly T[] | undefined,
|
|
currentAgentId: string,
|
|
): string | undefined {
|
|
const primaryAgents = getPrimaryAgents(agents)
|
|
|
|
if (primaryAgents.length === 0) return undefined
|
|
|
|
const normalizedAgentId = currentAgentId.toLowerCase()
|
|
const currentIndex = primaryAgents.findIndex(
|
|
(agent) => agent.id.toLowerCase() === normalizedAgentId,
|
|
)
|
|
|
|
if (currentIndex === -1) return primaryAgents[0].id
|
|
|
|
return primaryAgents[(currentIndex + 1) % primaryAgents.length].id
|
|
}
|