2026-06-26 19:27:53 +03:00
|
|
|
const SKILL_LINK_PREFIX = '#openchamber-skill:';
|
|
|
|
|
const AGENT_LINK_PREFIX = '#openchamber-agent:';
|
2026-06-11 00:46:34 +03:00
|
|
|
|
|
|
|
|
export const buildAgentMentionUrl = (name: string): string => {
|
|
|
|
|
const encoded = encodeURIComponent(name);
|
|
|
|
|
return `https://opencode.ai/docs/agents/#${encoded}`;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const buildSkillHref = (name: string): string => `${SKILL_LINK_PREFIX}${encodeURIComponent(name)}`;
|
|
|
|
|
|
|
|
|
|
export const buildAgentHref = (name: string): string => `${AGENT_LINK_PREFIX}${encodeURIComponent(name)}`;
|
|
|
|
|
|
|
|
|
|
export const parseSkillHref = (href: string | null | undefined): string | null => {
|
|
|
|
|
if (!href?.startsWith(SKILL_LINK_PREFIX)) return null;
|
|
|
|
|
try {
|
|
|
|
|
return decodeURIComponent(href.slice(SKILL_LINK_PREFIX.length));
|
|
|
|
|
} catch {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const parseAgentHref = (href: string | null | undefined): string | null => {
|
|
|
|
|
if (!href?.startsWith(AGENT_LINK_PREFIX)) return null;
|
|
|
|
|
try {
|
|
|
|
|
return decodeURIComponent(href.slice(AGENT_LINK_PREFIX.length));
|
|
|
|
|
} catch {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|