diff --git a/dist/ui-parser.js b/dist/ui-parser.js index 1c334df..1c88a93 100644 --- a/dist/ui-parser.js +++ b/dist/ui-parser.js @@ -1,152 +1,148 @@ -/** - * Self-contained stdout parser for Claude stream-json output. - * Zero external imports — required by the Paperclip adapter plugin UI parser contract. - */ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/ui-parser.ts +var ui_parser_exports = {}; +__export(ui_parser_exports, { + parseStdoutLine: () => parseStdoutLine +}); +module.exports = __toCommonJS(ui_parser_exports); function asRecord(value) { - if (typeof value !== "object" || value === null || Array.isArray(value)) - return null; - return value; + if (typeof value !== "object" || value === null || Array.isArray(value)) return null; + return value; } function asNumber(value) { - return typeof value === "number" && Number.isFinite(value) ? value : 0; + return typeof value === "number" && Number.isFinite(value) ? value : 0; } function errorText(value) { - if (typeof value === "string") - return value; - const rec = asRecord(value); - if (!rec) - return ""; - const msg = (typeof rec.message === "string" && rec.message) || - (typeof rec.error === "string" && rec.error) || - (typeof rec.code === "string" && rec.code) || - ""; - if (msg) - return msg; - try { - return JSON.stringify(rec); - } - catch { - return ""; - } + if (typeof value === "string") return value; + const rec = asRecord(value); + if (!rec) return ""; + const msg = typeof rec.message === "string" && rec.message || typeof rec.error === "string" && rec.error || typeof rec.code === "string" && rec.code || ""; + if (msg) return msg; + try { + return JSON.stringify(rec); + } catch { + return ""; + } } function safeJsonParse(text) { - try { - return JSON.parse(text); - } - catch { - return null; - } + try { + return JSON.parse(text); + } catch { + return null; + } } -export function parseStdoutLine(line, ts) { - const parsed = asRecord(safeJsonParse(line)); - if (!parsed) { - return [{ kind: "stdout", ts, text: line }]; - } - const type = typeof parsed.type === "string" ? parsed.type : ""; - if (type === "system" && parsed.subtype === "init") { - return [ - { - kind: "init", - ts, - model: typeof parsed.model === "string" ? parsed.model : "unknown", - sessionId: typeof parsed.session_id === "string" ? parsed.session_id : "", - }, - ]; - } - if (type === "assistant") { - const message = asRecord(parsed.message) ?? {}; - const content = Array.isArray(message.content) ? message.content : []; - const entries = []; - for (const blockRaw of content) { - const block = asRecord(blockRaw); - if (!block) - continue; - const blockType = typeof block.type === "string" ? block.type : ""; - if (blockType === "text") { - const text = typeof block.text === "string" ? block.text : ""; - if (text) - entries.push({ kind: "assistant", ts, text }); - } - else if (blockType === "thinking") { - const text = typeof block.thinking === "string" ? block.thinking : ""; - if (text) - entries.push({ kind: "thinking", ts, text }); - } - else if (blockType === "tool_use") { - entries.push({ - kind: "tool_call", - ts, - name: typeof block.name === "string" ? block.name : "unknown", - toolUseId: typeof block.id === "string" - ? block.id - : typeof block.tool_use_id === "string" - ? block.tool_use_id - : undefined, - input: block.input ?? {}, - }); - } - } - return entries.length > 0 ? entries : [{ kind: "stdout", ts, text: line }]; - } - if (type === "user") { - const message = asRecord(parsed.message) ?? {}; - const content = Array.isArray(message.content) ? message.content : []; - const entries = []; - for (const blockRaw of content) { - const block = asRecord(blockRaw); - if (!block) - continue; - const blockType = typeof block.type === "string" ? block.type : ""; - if (blockType === "text") { - const text = typeof block.text === "string" ? block.text : ""; - if (text) - entries.push({ kind: "user", ts, text }); - } - else if (blockType === "tool_result") { - const toolUseId = typeof block.tool_use_id === "string" ? block.tool_use_id : ""; - const isError = block.is_error === true; - let text = ""; - if (typeof block.content === "string") { - text = block.content; - } - else if (Array.isArray(block.content)) { - const parts = []; - for (const part of block.content) { - const p = asRecord(part); - if (p && typeof p.text === "string") - parts.push(p.text); - } - text = parts.join("\n"); - } - entries.push({ kind: "tool_result", ts, toolUseId, content: text, isError }); - } - } - if (entries.length > 0) - return entries; - } - if (type === "result") { - const usage = asRecord(parsed.usage) ?? {}; - const inputTokens = asNumber(usage.input_tokens); - const outputTokens = asNumber(usage.output_tokens); - const cachedTokens = asNumber(usage.cache_read_input_tokens); - const costUsd = asNumber(parsed.total_cost_usd); - const subtype = typeof parsed.subtype === "string" ? parsed.subtype : ""; - const isError = parsed.is_error === true; - const errors = Array.isArray(parsed.errors) ? parsed.errors.map(errorText).filter(Boolean) : []; - const text = typeof parsed.result === "string" ? parsed.result : ""; - return [{ - kind: "result", - ts, - text, - inputTokens, - outputTokens, - cachedTokens, - costUsd, - subtype, - isError, - errors, - }]; - } +function parseStdoutLine(line, ts) { + const parsed = asRecord(safeJsonParse(line)); + if (!parsed) { return [{ kind: "stdout", ts, text: line }]; + } + const type = typeof parsed.type === "string" ? parsed.type : ""; + if (type === "system" && parsed.subtype === "init") { + return [ + { + kind: "init", + ts, + model: typeof parsed.model === "string" ? parsed.model : "unknown", + sessionId: typeof parsed.session_id === "string" ? parsed.session_id : "" + } + ]; + } + if (type === "assistant") { + const message = asRecord(parsed.message) ?? {}; + const content = Array.isArray(message.content) ? message.content : []; + const entries = []; + for (const blockRaw of content) { + const block = asRecord(blockRaw); + if (!block) continue; + const blockType = typeof block.type === "string" ? block.type : ""; + if (blockType === "text") { + const text = typeof block.text === "string" ? block.text : ""; + if (text) entries.push({ kind: "assistant", ts, text }); + } else if (blockType === "thinking") { + const text = typeof block.thinking === "string" ? block.thinking : ""; + if (text) entries.push({ kind: "thinking", ts, text }); + } else if (blockType === "tool_use") { + entries.push({ + kind: "tool_call", + ts, + name: typeof block.name === "string" ? block.name : "unknown", + toolUseId: typeof block.id === "string" ? block.id : typeof block.tool_use_id === "string" ? block.tool_use_id : void 0, + input: block.input ?? {} + }); + } + } + return entries.length > 0 ? entries : [{ kind: "stdout", ts, text: line }]; + } + if (type === "user") { + const message = asRecord(parsed.message) ?? {}; + const content = Array.isArray(message.content) ? message.content : []; + const entries = []; + for (const blockRaw of content) { + const block = asRecord(blockRaw); + if (!block) continue; + const blockType = typeof block.type === "string" ? block.type : ""; + if (blockType === "text") { + const text = typeof block.text === "string" ? block.text : ""; + if (text) entries.push({ kind: "user", ts, text }); + } else if (blockType === "tool_result") { + const toolUseId = typeof block.tool_use_id === "string" ? block.tool_use_id : ""; + const isError = block.is_error === true; + let text = ""; + if (typeof block.content === "string") { + text = block.content; + } else if (Array.isArray(block.content)) { + const parts = []; + for (const part of block.content) { + const p = asRecord(part); + if (p && typeof p.text === "string") parts.push(p.text); + } + text = parts.join("\n"); + } + entries.push({ kind: "tool_result", ts, toolUseId, content: text, isError }); + } + } + if (entries.length > 0) return entries; + } + if (type === "result") { + const usage = asRecord(parsed.usage) ?? {}; + const inputTokens = asNumber(usage.input_tokens); + const outputTokens = asNumber(usage.output_tokens); + const cachedTokens = asNumber(usage.cache_read_input_tokens); + const costUsd = asNumber(parsed.total_cost_usd); + const subtype = typeof parsed.subtype === "string" ? parsed.subtype : ""; + const isError = parsed.is_error === true; + const errors = Array.isArray(parsed.errors) ? parsed.errors.map(errorText).filter(Boolean) : []; + const text = typeof parsed.result === "string" ? parsed.result : ""; + return [{ + kind: "result", + ts, + text, + inputTokens, + outputTokens, + cachedTokens, + costUsd, + subtype, + isError, + errors + }]; + } + return [{ kind: "stdout", ts, text: line }]; } -//# sourceMappingURL=ui-parser.js.map \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index dcd4a30..b454f30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@paperclipai/adapter-utils": "2026.415.0-canary.7", "@types/node": "^24.6.0", "@vitest/coverage-v8": "^4.1.4", + "esbuild": "^0.24.0", "typescript": "^5.7.3", "vitest": "^4.1.4" }, @@ -117,6 +118,431 @@ "tslib": "^2.4.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", + "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", + "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", + "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", + "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", + "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", + "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", + "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", + "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", + "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", + "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", + "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", + "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", + "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", + "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", + "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", + "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", + "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", + "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", + "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", + "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", + "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", + "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", + "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", + "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", + "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", @@ -1033,6 +1459,47 @@ "node": ">= 0.4" } }, + "node_modules/esbuild": { + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", + "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.24.2", + "@esbuild/android-arm": "0.24.2", + "@esbuild/android-arm64": "0.24.2", + "@esbuild/android-x64": "0.24.2", + "@esbuild/darwin-arm64": "0.24.2", + "@esbuild/darwin-x64": "0.24.2", + "@esbuild/freebsd-arm64": "0.24.2", + "@esbuild/freebsd-x64": "0.24.2", + "@esbuild/linux-arm": "0.24.2", + "@esbuild/linux-arm64": "0.24.2", + "@esbuild/linux-ia32": "0.24.2", + "@esbuild/linux-loong64": "0.24.2", + "@esbuild/linux-mips64el": "0.24.2", + "@esbuild/linux-ppc64": "0.24.2", + "@esbuild/linux-riscv64": "0.24.2", + "@esbuild/linux-s390x": "0.24.2", + "@esbuild/linux-x64": "0.24.2", + "@esbuild/netbsd-arm64": "0.24.2", + "@esbuild/netbsd-x64": "0.24.2", + "@esbuild/openbsd-arm64": "0.24.2", + "@esbuild/openbsd-x64": "0.24.2", + "@esbuild/sunos-x64": "0.24.2", + "@esbuild/win32-arm64": "0.24.2", + "@esbuild/win32-ia32": "0.24.2", + "@esbuild/win32-x64": "0.24.2" + } + }, "node_modules/estree-walker": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", diff --git a/package.json b/package.json index b0faac0..2b4c1ca 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "dist" ], "scripts": { - "build": "tsc", + "build": "tsc && npm run build:ui-parser", + "build:ui-parser": "esbuild src/ui-parser.ts --bundle --format=cjs --target=es2020 --outfile=dist/ui-parser.js --log-level=warning", "clean": "rm -rf dist", "typecheck": "tsc --noEmit", "test": "vitest run", @@ -43,6 +44,7 @@ "@paperclipai/adapter-utils": "2026.415.0-canary.7", "@types/node": "^24.6.0", "@vitest/coverage-v8": "^4.1.4", + "esbuild": "^0.24.0", "typescript": "^5.7.3", "vitest": "^4.1.4" }