- Add SkillsMixin with _enumerate_claude_skills and _enumerate_codex_skills - Claude: reads ~/.claude/skills/, parses YAML frontmatter for descriptions - Codex: reads curated cache + ~/.codex/skills/ user directory - Add /api/skills?agent= endpoint to HttpMixin - Add fetchSkills() API helper in dashboard - Wire autocomplete config through Modal -> SessionCard -> SimpleInput - Add getTriggerInfo() for detecting trigger at valid positions Closes: bd-3q1, bd-sv1, bd-3eu, bd-g9t, bd-30p, bd-1ba, bd-2n7, bd-3s3 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
// API Constants
|
|
export const API_STATE = '/api/state';
|
|
export const API_STREAM = '/api/stream';
|
|
export const API_DISMISS = '/api/dismiss/';
|
|
export const API_DISMISS_DEAD = '/api/dismiss-dead';
|
|
export const API_RESPOND = '/api/respond/';
|
|
export const API_CONVERSATION = '/api/conversation/';
|
|
export const API_SKILLS = '/api/skills';
|
|
export const POLL_MS = 3000;
|
|
export const API_TIMEOUT_MS = 10000;
|
|
|
|
// Fetch with timeout to prevent hanging requests
|
|
export async function fetchWithTimeout(url, options = {}, timeoutMs = API_TIMEOUT_MS) {
|
|
const controller = new AbortController();
|
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
try {
|
|
const response = await fetch(url, { ...options, signal: controller.signal });
|
|
return response;
|
|
} finally {
|
|
clearTimeout(timeoutId);
|
|
}
|
|
}
|
|
|
|
// Fetch autocomplete skills config for an agent type
|
|
export async function fetchSkills(agent) {
|
|
const url = `${API_SKILLS}?agent=${encodeURIComponent(agent)}`;
|
|
try {
|
|
const response = await fetch(url);
|
|
if (!response.ok) return null;
|
|
return response.json();
|
|
} catch {
|
|
// Network error or other failure - graceful degradation
|
|
return null;
|
|
}
|
|
}
|