()
| 62 | void boot(); |
| 63 | |
| 64 | async function boot(): Promise<void> { |
| 65 | render(); |
| 66 | |
| 67 | app = new App( |
| 68 | { name: "devspace-tool-cards", version: "0.4.0" }, |
| 69 | {}, |
| 70 | ); |
| 71 | |
| 72 | app.ontoolresult = (result) => { |
| 73 | const structuredContent = getStructuredContent<Partial<ToolResultCard>>(result); |
| 74 | const metaCard = cardFromMeta(result); |
| 75 | const structured = metaCard |
| 76 | ? { ...structuredContent, ...metaCard } |
| 77 | : structuredContent; |
| 78 | const tool = toolNameFromMeta(result); |
| 79 | |
| 80 | if (!tool || !isToolResultCard(structured)) { |
| 81 | card = null; |
| 82 | expanded = false; |
| 83 | reviewFilesExpanded = false; |
| 84 | errorMessage = "No result card is available for this tool result."; |
| 85 | render(); |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | card = { ...structured, tool }; |
| 90 | expanded = false; |
| 91 | reviewFilesExpanded = false; |
| 92 | errorMessage = null; |
| 93 | render(); |
| 94 | }; |
| 95 | |
| 96 | app.onhostcontextchanged = (ctx) => { |
| 97 | hostContext = { |
| 98 | ...hostContext, |
| 99 | ...ctx, |
| 100 | }; |
| 101 | applyHostContext(); |
| 102 | renderPayloadIfNeeded(); |
| 103 | }; |
| 104 | |
| 105 | app.onteardown = async () => { |
| 106 | unmountPayload(); |
| 107 | return {}; |
| 108 | }; |
| 109 | |
| 110 | try { |
| 111 | await app.connect(); |
| 112 | const initialContext = app.getHostContext(); |
| 113 | if (initialContext) hostContext = initialContext; |
| 114 | applyHostContext(); |
| 115 | connected = true; |
| 116 | } catch (connectError) { |
| 117 | connectionError = connectError instanceof Error |
| 118 | ? connectError.message |
| 119 | : String(connectError); |
| 120 | } |
| 121 |
no test coverage detected