()
| 386 | * Should be called once before ChatPanel first uses tool definitions. |
| 387 | */ |
| 388 | export async function loadActionsFromMeta(): Promise<void> { |
| 389 | if (_loaded) return; |
| 390 | |
| 391 | const loaded: AppDef[] = []; |
| 392 | |
| 393 | for (const app of APP_STATIC_REGISTRY) { |
| 394 | if (app.appName === 'os') { |
| 395 | loaded.push({ ...app, actions: OS_ACTIONS }); |
| 396 | continue; |
| 397 | } |
| 398 | |
| 399 | const metaPath = `apps/${app.appName}/meta.yaml`; |
| 400 | try { |
| 401 | const content = await idb.getFile(metaPath); |
| 402 | if (content && typeof content === 'string') { |
| 403 | const actions = parseMetaYamlActions(content); |
| 404 | loaded.push({ ...app, actions }); |
| 405 | } else { |
| 406 | loaded.push({ ...app, actions: [] }); |
| 407 | } |
| 408 | } catch { |
| 409 | loaded.push({ ...app, actions: [] }); |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | APP_REGISTRY = loaded; |
| 414 | _loaded = true; |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * Reset loading state, forcing a reload on next call to loadActionsFromMeta |
no test coverage detected