(agentId: string)
| 225 | |
| 226 | // Get agent configuration (for internal use) |
| 227 | async function getAgentConfig(agentId: string): Promise<{ |
| 228 | model_name: string; |
| 229 | system_prompt: string; |
| 230 | loop_interval_seconds: number; |
| 231 | only_on_significant_change?: boolean; |
| 232 | } | null> { |
| 233 | const db = await openDB(); |
| 234 | |
| 235 | return new Promise((resolve, reject) => { |
| 236 | const tx = db.transaction(CONFIG_STORE, 'readonly'); |
| 237 | const store = tx.objectStore(CONFIG_STORE); |
| 238 | const request = store.get(agentId); |
| 239 | |
| 240 | request.onsuccess = () => { |
| 241 | const result = request.result; |
| 242 | if (result) { |
| 243 | // Remove id from the result to get just the config |
| 244 | const { id, ...configWithoutId } = result; |
| 245 | resolve(configWithoutId); |
| 246 | } else { |
| 247 | resolve(null); |
| 248 | } |
| 249 | }; |
| 250 | request.onerror = () => reject(request.error); |
| 251 | }); |
| 252 | } |
| 253 | |
| 254 | // Get agent code |
| 255 | export async function getAgentCode(agentId: string): Promise<string | null> { |
no test coverage detected