feat(web-shell): add read-only Excel artifact previews (#13664)

* feat(web-shell): add read-only Excel artifact previews

* fix(vscode): refresh notices for Excel preview dependencies

* fix(web-shell): bound Excel merge loading and preserve preview content

* fix(web-shell): bound Excel preview work and preserve recovery

* fix(web-shell): harden Excel preview values and recovery

* fix(web-shell): include bundled ExcelJS dependency licenses

* fix(web-shell): guard column expansion and complete ExcelJS notices

* fix(web-shell): complete Excel color fallback and review guards

* test(web-shell): follow artifact filename labels in Excel previews

---------

Co-authored-by: 钉萁 <dingqi.jww@alibaba-inc.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
This commit is contained in:
ytahdn 2026-10-13 02:43:10 +00:00 • committed by GitHub
parent 21b78c55d5
commit ef38ad7753
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 8353 additions and 78 deletions

View file

@ -0,0 +1,127 @@
# Web Shell Excel preview
[English](web-shell-excel-preview.md) | [简体中文](web-shell-excel-preview.zh-CN.md)
## Problem and scope
Workspace artifacts, @file references, and incoming/uploaded XLSX files currently
reach download-only or unsupported states. Add the same read-only right-panel
preview to all three paths. Support `.xlsx` and its standard MIME type; legacy
`.xls`, macro workbooks, and other Office formats retain their existing behavior.
No editing, formula calculation, external links, charts, or backend conversion.
## Design
Reuse the existing workspace-owner-bound byte reader and attachment Blob paths.
Keep ownership checks, cancellation, freshness keys, and download behavior.
Identify spreadsheets before binary/source fallbacks, including source cards and
attachment previews. Missing artifacts must not trigger reads.
A lazily imported spreadsheet component owns loading, errors, sheet selection,
virtual scrolling and download. An inline Vite worker loads ExcelJS only when this
component is opened; its code must stay outside initial app/library entry chunks.
The inline worker avoids a separate worker asset contract for embedded hosts.
Terminate it on close, input changes, or a 30-second parsing timeout. Hosts must
permit blob workers; failure shows a download fallback. The first-party VS Code
webview explicitly grants `worker-src blob:` without widening `script-src`.
The worker initially returns only worksheet names. Selecting a sheet requests its preview projection; the page retains only
the selected sheet and ignores outdated responses. Keep the parsed workbook in
the worker until the preview closes or the input changes, with a 30-second
timeout for each request. ExcelJS still parses the whole XLSX on initial load:
on-demand sheet projection avoids transferring every sheet to the main thread,
but does not provide streaming parsing or bound the worker's workbook memory.
Worksheet selection uses horizontal Excel-style tabs at the top, built from
the shared Tabs primitive, with rounded top corners and muted inactive tabs.
The active tab uses blue text and a background matching the panel, with its bottom
border hidden to join a narrow panel-colored gap above the grid. Allow horizontal
overflow and keyboard arrow navigation, and reset scrolling when switching sheets.
Mount at most 50 tabs at a time, with previous/next group buttons; retain every
worksheet and its original index. Arrow keys cross groups and Home/End reach the
first/last worksheet. Group navigation scrolls the active tab into view without
moving keyboard focus. Disable worksheet controls after a preview failure until
retry. Download failures have a separate status and do not discard
a successful preview; a new download attempt clears the previous download error.
The row-number gutter defaults to a 56 px minimum and grows
with the row-number digits in the current font, using tabular numerals.
ExcelJS reads workbook data. Use the small SSF formatter for Excel number formats
instead of implementing a custom number-format parser. Preserve formula cached
results (including zero/false), errors, rich text as plain text, and formulas
without results as explicitly uncalculated. Format typed hyperlink labels through
the same value formatter and display them only as plain text. Do not execute formulas or hyperlinks.
Use a white cell canvas so document colors remain readable in dark mode.
Show basic explicit RGB colors, bold/italic text, alignment, and merges; complex
styles/themes and embedded objects are outside this preview's fidelity guarantee.
If an explicit fill lacks a representable foreground, or the fill cannot be
represented, fall back both colors to black on white together. Uncalculated annotations inherit the cell text color.
Limit preview input to 10 MiB and each selected sheet to 100,000 grid cells,
including empty positions inside the content/merge extent. Ignore peripheral
formatting-only cells when finding this extent; keep original coordinates and
merged placeholders. Iterate ExcelJS 4.4.0 sparse row/cell storage directly and
read normalized merge bounds without serializing the entire worksheet model;
revalidate these private structures when upgrading ExcelJS. Replace independent worksheet-count, row-count and
column-count caps with this budget: retain all columns and as many complete rows
as fit within floor(100,000 / column count). Empty sheets have no preview rows.
Show the truncation notice only when the selected sheet exceeds that budget.
The 100,000-cell default balances content and response time: synthetic mixed-cell
production measurements showed about 88 ms to switch sheets on the test machine,
and 260 ms under page CPU 4× throttling, versus 419 ms for 200,000 cells. These
measurements are not a universal responsiveness or memory guarantee. Use the existing
TanStack virtualizer for continuous vertical scrolling, rendering visible rows
with a small overscan and measuring wrapped row heights. Native table spacer
rows preserve the scroll extent and sticky headers; stable column widths prevent
horizontal layout changes as rows mount. Clip merges at the rendered window,
retaining the original master value and row/column coordinates. Remount the table
on sheet changes to reset scroll position and row measurements. Remove pagination
controls. The cell budget bounds projection size, while row virtualization reduces
mounted rows; neither limits ZIP expansion; the worker is cancellable but is not
a hard memory sandbox. Before ExcelJS expands merges, reject workbooks with more
than 100,000 merged cells in total or 10,000 merged ranges across all worksheets.
These separate load-time budgets include off-screen sheets and prevent compact
merge declarations from allocating unbounded cells or doing unbounded pairwise
intersection checks. Before column materialization, reject non-integer, reversed,
or out-of-grid column definitions (valid columns are 1–16,384). A worker-local
hook wraps ExcelJS 4.4.0's worksheet `model` setter, validates columns and merges
before calling the original setter, applies only to registered preview workbooks, and retains
separate budgets for concurrent loads. Keep the exact ExcelJS version pinned and
revalidate this hook on upgrades. Invalid merge addresses fail closed. Rejection
keeps the original downloadable. These guards do not bound general ZIP expansion
or general workbook memory. Download retains the existing separate file-size policy.
ExcelJS's prebuilt browser bundle includes packages outside its runtime dependency graph. Record original license texts for all 72 embedded dependency paths (68 package names), with source fingerprints and matching published versions, including nested copies and the original upstream saxes license omitted from its tarball. Source-identical releases cannot be distinguished from the bundle alone. Keep the ordinary dependency walk for nested distributions such as JSZip, but omit ExcelJS's Node-only archiver, unzipper, and tmp branches because the only production importer uses its browser entry. Other consumers of those packages remain included. For pako 1.0.11, supplement its top-level MIT license with the original Zlib copyright and terms from its lib/zlib/inflate.js source header. Notice generation checks the browser entry, bundle hash and version so an upgrade requires reviewing this inventory; tests verify each source path and complete license body.
## Affected areas
- ArtifactPanel routing, artifact type detection and shared preview components.
- Client translations, dependencies/lockfile, lazy worker build and package checks.
- Collocated parser/component tests and browser E2E coverage.
## Validation and acceptance
Check the global CLI baseline before implementation, then run focused unit tests,
root build/typecheck/bundle and browser E2E. Use real XLSX bytes with a mock daemon
for deterministic UI checks and label screenshots accordingly. Verify artifact,
@file, pending upload, persisted attachment and incoming Blob paths; sheet switching,
formats/formulas/errors, merges, malformed/oversized inputs, downloads and ownership
changes. Verify bounded mounted rows, scrolling to the last retained row and
back, wrapped text, and merges crossing the virtual window. Verify worksheets
beyond the twentieth, rows beyond 2,000, columns beyond 50, and exact/over-budget
truncation including empty cells. Compare large-sheet
rendering with the paginated and full-render baselines. Inspect actual screenshots.
Check built app and library chunks to ensure
ExcelJS is absent from initial entries and its lazy worker is published correctly.
Check huge merged ranges, exact/over-limit area and count, accumulation across
sheets, concurrent load isolation, and peripheral empty formatting. Verify the
first-party webview CSP permits blob workers while restrictive third-party hosts
still receive the download fallback. Verify bounded tabs with thousands of
worksheets, navigation across groups, six-digit row numbers in a wide font,
independent download failures, and sparse distant formatting without hole scans.
Reject zero, reversed, and out-of-grid column definitions before allocation, including a compact 4,294,967,295-column declaration; accept the valid 16,384-column boundary. Verify error, download, and reopening in the built browser. Compare every browser sourcemap dependency path and fingerprint with its versioned notice and complete original license body. Reject a changed ExcelJS version, browser entry, or bundle until its inventory is refreshed. Verify the logged notice count matches the emitted entries.
## Open questions
None for this scope. Full Excel layout fidelity and additional formats are deferred.

View file

@ -0,0 +1,96 @@
# Web Shell Excel 预览
[English](web-shell-excel-preview.md) | [简体中文](web-shell-excel-preview.zh-CN.md)
## 问题与范围
工作区 artifact、@文件引用和传入/上传的 XLSX 文件目前进入仅下载或不支持预览状态。
为三类入口增加统一的只读右侧预览。支持 `.xlsx` 及其标准 MIME 类型;旧版 `.xls`、
宏工作簿和其他 Office 格式保持现有行为。不提供编辑、公式计算、外链、图表或后端转换。
## 设计
复用绑定工作区归属的二进制读取和附件 Blob 路径,保留归属检查、取消、内容更新标识
和下载行为。在二进制/源码回退之前识别表格,包括来源卡片和附件预览。
缺失 artifact 不应触发文件读取。
按需导入的表格组件负责加载、错误、工作表选择、虚拟滚动和下载。通过 Vite 内联 Worker
在打开组件时加载 ExcelJS;其代码不得进入应用或组件库的初始入口块。
内联 Worker 避免为嵌入式宿主引入独立 Worker 资源路径约定。
关闭、输入变化或解析超过 30 秒时终止 Worker。宿主需允许 blob Worker;失败时提供下载回退。
第一方 VS Code webview 明确允许 `worker-src blob:`,不放宽 `script-src`。
Worker 首次只返回工作表名称。选中工作表后再请求该表的预览数据;
页面只保留当前表并忽略过时响应。解析后的工作簿保留在 Worker 内,直到关闭预览
或输入变化;每次请求均有 30 秒超时。ExcelJS 首次仍会解析整个 XLSX:
按需生成工作表预览可避免把所有表传至主线程,但不提供流式解析,也不限制
Worker 内工作簿的内存占用。
工作表切换使用顶部横向标签,外观参考 Excel 工作表标签,并复用共享 Tabs 组件。
标签顶部圆角,未选中时使用浅色背景;选中标签使用蓝色文字和面板背景色,隐藏底边以衔接表格上方的窄留白。
标签溢出时可横向滚动,支持键盘方向键切换;切换后滚动位置归零。
每次最多挂载 50 个标签,通过上一组/下一组按钮切换,保留全部工作表及其原始索引。
方向键可跨组切换,Home/End 到达首个/末个工作表。分组切换时将当前标签滚入视野,
不移动键盘焦点。预览失败后禁用工作表操作,直到重试。下载失败独立显示状态,
不会丢弃已成功加载的预览;再次下载时清除上次的下载错误。
序号栏默认最小宽度为 56 px,随当前字体的行号数字位数
自动撑开,并使用等宽数字。
ExcelJS 读取工作簿,使用小型 SSF 格式化库处理 Excel 数字格式,避免自写格式解析器。
保留公式缓存结果(包括零和 false)、错误值、转为纯文本的富文本;没有结果的公式
明确标记为未计算。带类型的超链接标签复用相同的值格式化逻辑,仅作为纯文本展示。
不执行公式或超链接。单元格使用白色底色,保证深色主题下文档颜色可读。
展示基本显式 RGB 颜色、粗体/斜体、对齐和合并;
复杂样式/主题及嵌入对象不在预览保真保证范围内。
若显式填充缺少可表示的文字颜色,或填充无法表示,则两者一起回退为白底黑字;未计算提示继承单元格文字颜色。
预览文件上限 10 MiB,每个选中工作表最多预览 100,000 个网格单元格,包含内容/合并范围内的空位置。
计算范围时忽略外围仅有格式的空白单元格,保留原始坐标和合并占位。
直接遍历 ExcelJS 4.4.0 的稀疏行/单元格存储,并读取已规范化的合并边界,
避免扫描数组空洞或序列化整表模型;升级 ExcelJS 时重新验证这些私有结构。
以这一总量预算替换独立的工作表数量、行数和列数上限:保留全部列,最多保留
floor(100,000 / 列数) 个完整行。空工作表不生成预览行。
仅当前工作表超过预算时显示截断提示。100,000 格兼顾内容量与响应:合成混合数据的
生产构建测试中,切表约 88 ms,页面 CPU 降速 4 倍约 260 ms,而 200,000 格约需
419 ms。这些测量结果不是通用的响应或内存保证。复用已有 TanStack 虚拟滚动库,连续纵向滚动时仅渲染可见行及
少量缓冲行,并测量换行后的实际行高。原生表格占位行维持滚动范围和固定表头;
稳定列宽避免滚动挂载新行时横向布局变化。在渲染窗口边界裁剪合并范围,保留原始
主单元格内容及行列坐标。切换工作表时重新挂载表格,重置滚动位置与行高测量。
移除分页控件。
单元格预算限制预览数据量,行虚拟滚动减少挂载行数;二者都不是 ZIP 解压内存硬限制;Worker 可终止但不是内存沙箱。
在 ExcelJS 展开合并区域前,拒绝所有工作表合计超过 100,000 个合并单元格或
10,000 个合并区域的工作簿。这两个独立的加载预算包含未打开的工作表,防止紧凑的
合并声明分配无界数量的单元格或执行无界的两两相交检查。在创建列对象前,拒绝非整数、
反向或超出网格的列定义(合法列为 1–16,384)。Worker 内的钩子包装
ExcelJS 4.4.0 工作表 `model` setter,在调用原 setter 前校验列和合并范围,仅检查已登记的预览工作簿,
并发加载时各自保留独立预算。保持 ExcelJS 精确版本锁定,升级时重新验证此钩子。
非法合并地址直接拒绝。拒绝后仍可下载原文件。这些保护不限制一般 ZIP 解压或
一般工作簿内存。下载保留已有的独立文件大小策略。
ExcelJS 预先打包的浏览器文件包含运行时依赖图之外的包。扩展许可清单记录全部 72 个内嵌依赖路径(68 个包名)的原始许可正文、源码指纹和匹配的发布版本,包括嵌套副本及 tarball 遗漏的 saxes 上游原始许可。仅凭 bundle 无法区分源码相同的发布版本。保留普通依赖遍历,以覆盖 JSZip 等嵌套分发;仅跳过 ExcelJS 的 Node 专用 archiver、unzipper、tmp 分支,因为唯一的生产导入点使用浏览器入口。这些包的其他消费者仍会被收录。对 pako 1.0.11,在顶层 MIT 许可之外补充其 lib/zlib/inflate.js 源文件头中的原始 Zlib 版权和条款。生成时校验浏览器入口、bundle 哈希及版本,升级后必须重新核对清单;测试逐一校验源码路径和完整许可正文。
## 影响范围
- ArtifactPanel 路由、artifact 类型识别及共享预览组件。
- 客户端翻译、依赖/锁文件、按需 Worker 构建和发布检查。
- 同目录解析/组件测试及浏览器 E2E 覆盖。
## 验证与验收
实现前验证全局 CLI 基线,然后执行针对性单测、根目录构建/类型检查/打包及浏览器 E2E。
使用真实 XLSX 字节和模拟 daemon 做确定性 UI 检查,并在截图说明中标注。
验证 artifact、@文件、待发送上传、持久化附件和传入 Blob 路径;工作表切换、格式/公式/错误、
合并、损坏/超大文件、下载及归属切换。验证挂载行数有界、滚至最后保留行并返回、
文本换行及跨虚拟窗口的合并。验证第 20 个之后的工作表、超过 2,000 行及 50 列的内容,
以及恰好达到预算和超过预算的截断行为(包含空单元格)。与分页和全量渲染基线对比大表性能。目视检查实际截图。
检查应用和组件库构建块,确保 ExcelJS 不进入初始入口且按需 Worker 可正确发布。
检查超大合并区域、面积/数量恰好达到和超过阈值、跨工作表累计、并发加载预算隔离,
以及外围空白格式。验证第一方 webview CSP 允许 blob Worker,而限制更严的第三方
宿主仍提供下载回退。验证上千工作表时标签挂载有界、跨组导航、较宽字体下六位行号、
独立的下载失败,以及远端稀疏格式不会触发空洞扫描。
在分配前拒绝零、反向和越界列定义,包括紧凑的 4,294,967,295 列声明;接受合法的 16,384 列边界。在构建后的浏览器中验证报错、下载和重新打开。逐一核对 sourcemap 依赖路径及指纹与对应版本的许可条目和完整原始正文。ExcelJS 版本、浏览器入口或 bundle 改变后应拒绝生成,直到重新核对清单。验证日志许可计数与实际输出条目一致。
## 开放问题
本次范围无待决问题。完整 Excel 排版还原及更多格式留待后续。

View file

@ -120,6 +120,8 @@
"pre-commit": "node scripts/pre-commit.js"
},
"overrides": {
"brace-expansion@1": "1.1.21",
"brace-expansion@2": "2.1.7",
"ansi-regex": "6.2.2",
"cliui": {
"wrap-ansi": "7.0.0"

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { createHash } from 'node:crypto';
const projectRoot = path.resolve(
path.join(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..'),
@ -95,6 +96,17 @@ async function getDependencyLicense(depName, depVersion, packageDir) {
// and an Apache-style NOTICE file (required by Apache-2.0 §4(d)).
// Append both so the notices they accompany are actually shipped.
const extraSections = [];
// pako 1.0.11's top-level LICENSE omits its lib/zlib/inflate.js header.
// Original: https://registry.npmjs.org/pako/-/pako-1.0.11.tgz
if (depName === 'pako' && depVersion === '1.0.11') {
const zlibLicense = await fs.readFile(
new URL('./licenses/pako-1.0.11-zlib.txt', import.meta.url),
'utf-8',
);
extraSections.push(
`--- lib/zlib/inflate.js (Zlib) ---\n\n${zlibLicense.trim()}`,
);
}
for (const supplementaryFile of await findSupplementaryLicenseFiles(
packageDir,
)) {
@ -178,6 +190,7 @@ export async function findLicenseFile(packageDir, licenseFileHint) {
licenseFileHint,
'LICENSE',
'LICENSE.md',
'LICENSE.markdown',
'LICENSE.txt',
'LICENSE-MIT.txt',
'LICENSE-MIT',
@ -304,8 +317,8 @@ export function normalizeRepositoryUrl(repository) {
/**
* Produce fallback license text for packages that declare a known SPDX
* license but ship no license file. Currently only MIT is covered, as it is
* the only such declaration in the dependency graph.
* license but ship no license file. Only exact MIT declarations use this
* fallback; bundled packages with other licenses retain their original texts.
*
* @param {unknown} license - The `license` field from package.json
* @param {unknown} author - The `author` field from package.json
@ -403,10 +416,42 @@ export async function collectDependencies(
}
for (const depName of Object.keys(manifest.dependencies ?? {})) {
// Web Shell uses ExcelJS's prebuilt browser entry. These Node-only branches
// are not in that bundle; its actual embedded packages are inventoried below.
if (
packageName === 'exceljs' &&
['archiver', 'unzipper', 'tmp'].includes(depName)
)
continue;
await collectDependencies(depName, dir, dependenciesMap, visitedDirs);
}
}
// ExcelJS ships a prebuilt browser bundle whose embedded dependencies are not
// discoverable by walking its runtime package.json dependencies.
export async function getExceljsBrowserNotices(packageDir) {
const inventory = JSON.parse(
await fs.readFile(
new URL('./licenses/exceljs-browser.json', import.meta.url),
'utf-8',
),
);
const manifest = JSON.parse(
await fs.readFile(path.join(packageDir, 'package.json'), 'utf-8'),
);
const bundle = await fs.readFile(path.join(packageDir, inventory.browser));
if (
manifest.version !== inventory.exceljsVersion ||
manifest.browser !== inventory.browser ||
createHash('sha256').update(bundle).digest('hex') !== inventory.bundleSha256
) {
throw new Error(
'ExcelJS browser bundle changed; refresh its bundled license inventory.',
);
}
return inventory.packages;
}
async function main() {
try {
const packageJsonPath = path.join(packagePath, 'package.json');
@ -430,11 +475,27 @@ async function main() {
const dependencyEntries = Array.from(allDependencies.values());
const licensePromises = dependencyEntries.map(({ name, version, dir }) =>
getDependencyLicense(name, version, dir),
const exceljs = dependencyEntries.find(({ name }) => name === 'exceljs');
const browserLicenses = exceljs
? await getExceljsBrowserNotices(exceljs.dir)
: [];
const bundledLicenses = new Map(
browserLicenses.map((license) => [
`${license.name}@${license.version}`,
license,
]),
);
const dependencyLicenses = await Promise.all(licensePromises);
const licensePromises = dependencyEntries.map(
({ name, version, dir }) =>
bundledLicenses.get(`${name}@${version}`) ??
getDependencyLicense(name, version, dir),
);
const dependencyLicenses = [
...(await Promise.all(licensePromises)),
...browserLicenses.filter(
({ name, version }) => !allDependencies.has(`${name}@${version}`),
),
];
let noticeText =
'This file contains third-party software notices and license terms.\n\n';
@ -454,7 +515,7 @@ async function main() {
await fs.writeFile(noticeFilePath, noticeText);
console.log(`NOTICES.txt generated at ${noticeFilePath}`);
console.log(`Total dependencies: ${dependencyEntries.length}`);
console.log(`Total dependencies: ${dependencyLicenses.length}`);
} catch (error) {
console.error('Error generating NOTICES.txt:', error);
process.exit(1);

View file

@ -8,16 +8,176 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { createRequire } from 'node:module';
import { createHash } from 'node:crypto';
import {
collectDependencies,
findLicenseFile,
findNoticeFile,
findSupplementaryLicenseFiles,
getFallbackLicenseText,
getExceljsBrowserNotices,
normalizeRepositoryUrl,
runNoticeGeneration,
} from './generate-notices.js';
describe('ExcelJS browser bundle notices', () => {
const require = createRequire(
new URL('../../web-shell/package.json', import.meta.url),
);
const exceljsDir = path.dirname(require.resolve('exceljs/package.json'));
it('ships original licenses for each embedded source path and version', async () => {
const write = vi.spyOn(fs, 'writeFile').mockImplementation(async () => {});
const log = vi.spyOn(console, 'log').mockImplementation(() => {});
try {
await runNoticeGeneration({});
expect(write).toHaveBeenCalledTimes(1);
const notices = String(write.mock.calls[0][1]);
const sourceMap = JSON.parse(
await fs.readFile(
path.join(exceljsDir, 'dist/exceljs.min.js.map'),
'utf-8',
),
);
const sourcesByPackage = new Map();
for (const [index, source] of sourceMap.sources.entries()) {
if (!source.includes('node_modules/')) continue;
const tail = source.split('node_modules/').at(-1);
const name = tail
.split('/')
.slice(0, tail.startsWith('@') ? 2 : 1)
.join('/');
const prefix = source.slice(0, source.length - tail.length) + name;
const files = sourcesByPackage.get(prefix) ?? [];
files.push([source, sourceMap.sourcesContent[index]]);
sourcesByPackage.set(prefix, files);
}
const inventory = JSON.parse(
await fs.readFile(
new URL('./licenses/exceljs-browser.json', import.meta.url),
'utf-8',
),
);
const mapBytes = await fs.readFile(
path.join(exceljsDir, 'dist/exceljs.min.js.map'),
);
expect(createHash('sha256').update(mapBytes).digest('hex')).toBe(
inventory.sourceMapSha256,
);
expect(inventory.packages).toHaveLength(72);
expect(
new Set(inventory.packages.map(({ sourcePrefix }) => sourcePrefix)),
).toEqual(new Set(sourcesByPackage.keys()));
for (const dep of inventory.packages) {
const hash = createHash('sha256');
for (const [source, content] of sourcesByPackage
.get(dep.sourcePrefix)
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {
hash.update(source).update('\0').update(content).update('\0');
}
expect(hash.digest('hex')).toBe(dep.sourceSha256);
expect(() => new URL(dep.repository)).not.toThrow();
expect(notices).toContain(
`${dep.name}@${dep.version}\n(${dep.repository})\n\n${dep.license}`,
);
expect(dep.license).toMatch(/Copyright|copyright/);
expect(dep.license).not.toContain('License text not found.');
}
const pakoNotice = notices
.split('\npako@1.0.11\n')[1]
.split(
'============================================================\n',
)[0];
expect(pakoNotice).toContain(
(
await fs.readFile(
new URL('./licenses/pako-1.0.11-zlib.txt', import.meta.url),
'utf-8',
)
).trim(),
);
expect(pakoNotice).toContain("This software is provided 'as-is'");
expect(pakoNotice).toContain('1995-2013 Jean-loup Gailly and Mark Adler');
expect(pakoNotice).toContain(
'2014-2017 Vitaly Puzrin and Andrey Tupitsin',
);
expect(pakoNotice).toContain(
'3. This notice may not be removed or altered from any source distribution.',
);
expect(notices).not.toContain('License text not found.');
const noticeCount = [
...notices.matchAll(/^={60}\n(?=[^\n]+@[^\n]+\n\()/gm),
].length;
expect(log).toHaveBeenCalledWith(`Total dependencies: ${noticeCount}`);
for (const key of [
'saxes@5.0.1',
'safer-buffer@2.1.2',
'jszip@3.10.1',
'buffer@5.2.1',
'inherits@2.0.3',
]) {
expect(notices).toContain(`\n${key}\n`);
}
expect(
inventory.packages.find(({ name }) => name === 'browserify-rsa')
.repository,
).toBe('https://github.com/crypto-browserify/browserify-rsa');
expect(
inventory.packages
.filter(({ name }) => name === 'bn.js')
.map(({ version }) => version),
).toEqual(['4.12.0', '5.2.1']);
} finally {
write.mockRestore();
log.mockRestore();
}
});
it('rejects an unreviewed bundle or ExcelJS version', async () => {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'exceljs-notices-'));
try {
await fs.mkdir(path.join(dir, 'dist'));
const manifest = JSON.parse(
await fs.readFile(path.join(exceljsDir, 'package.json'), 'utf-8'),
);
await fs.writeFile(
path.join(dir, 'package.json'),
JSON.stringify(manifest),
);
const bundle = await fs.readFile(
path.join(exceljsDir, 'dist/exceljs.min.js'),
);
await fs.writeFile(path.join(dir, 'dist/exceljs.min.js'), bundle);
expect(await getExceljsBrowserNotices(dir)).toHaveLength(72);
await fs.appendFile(
path.join(dir, 'dist/exceljs.min.js'),
'\n// changed',
);
await expect(getExceljsBrowserNotices(dir)).rejects.toThrow(
'refresh its bundled license inventory',
);
await fs.writeFile(path.join(dir, 'dist/exceljs.min.js'), bundle);
await fs.writeFile(
path.join(dir, 'package.json'),
JSON.stringify({ ...manifest, browser: './dist/exceljs.js' }),
);
await expect(getExceljsBrowserNotices(dir)).rejects.toThrow(
'refresh its bundled license inventory',
);
await fs.writeFile(
path.join(dir, 'package.json'),
JSON.stringify({ ...manifest, version: '4.5.0' }),
);
await expect(getExceljsBrowserNotices(dir)).rejects.toThrow(
'refresh its bundled license inventory',
);
} finally {
await fs.rm(dir, { recursive: true, force: true });
}
});
});
describe('runNoticeGeneration', () => {
it('skips generation during dependency-only worktree setup', async () => {
const log = vi.spyOn(console, 'log').mockImplementation(() => {});
@ -94,6 +254,16 @@ describe('findLicenseFile', () => {
expect(resolved).toBe(path.join(packageDir, 'License'));
});
it('finds JSZip’s LICENSE.markdown attribution', async () => {
await fs.writeFile(
path.join(packageDir, 'LICENSE.markdown'),
'JSZip license',
);
expect(await findLicenseFile(packageDir)).toBe(
path.join(packageDir, 'LICENSE.markdown'),
);
});
it('prefers LICENSE over other variants', async () => {
await fs.writeFile(path.join(packageDir, 'LICENSE'), 'Apache-2.0');
await fs.writeFile(path.join(packageDir, 'LICENSE.md'), 'MIT');
@ -180,6 +350,25 @@ describe('collectDependencies', () => {
]);
});
it('excludes only ExcelJS Node-only branches while retaining other consumers', async () => {
await writePackage(path.join(root, 'node_modules', 'exceljs'), {
name: 'exceljs',
version: '4.4.0',
dependencies: { archiver: '*', unzipper: '*', tmp: '*', jszip: '*' },
});
for (const name of ['archiver', 'unzipper', 'tmp', 'jszip']) {
await writePackage(path.join(root, 'node_modules', name), {
name,
version: '1.0.0',
});
}
const dependencies = new Map();
await collectDependencies('exceljs', root, dependencies, new Set());
expect([...dependencies.keys()]).toEqual(['exceljs@4.4.0', 'jszip@1.0.0']);
await collectDependencies('archiver', root, dependencies, new Set());
expect(dependencies.has('archiver@1.0.0')).toBe(true);
});
it('resolves each dependency from the nearest node_modules above it', async () => {
const companion = path.join(root, 'packages', 'companion');
await writePackage(companion, { name: 'companion' });

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,18 @@
(C) 1995-2013 Jean-loup Gailly and Mark Adler
(C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

View file

@ -99,6 +99,16 @@ describe('WebViewContent', () => {
expect(html).toContain("script-src https://csp.source 'wasm-unsafe-eval';");
});
it('allows only blob workers without broadening script execution', () => {
const html = WebViewContent.generate(
createMockWebview() as never,
fakeExtensionUri,
);
expect(html).toContain('worker-src blob:;');
expect(html).toContain("script-src https://csp.source 'wasm-unsafe-eval';");
expect(html).toContain("default-src 'none';");
});
it('allows the WebShell transcript to use its inlined fonts', () => {
const webview = createMockWebview();
const html = WebViewContent.generate(webview as never, fakeExtensionUri);

View file

@ -62,7 +62,8 @@ export class WebViewContent {
// The WebShell transcript bundles Shiki, whose Oniguruma engine compiles
// WASM at runtime, and self-contained KaTeX fonts as data URLs, so the CSP
// grants both wasm-unsafe-eval and data: fonts.
const csp = `default-src 'none'; connect-src ${connectSrc}; img-src ${webview.cspSource} data:; font-src data:; script-src ${webview.cspSource} 'wasm-unsafe-eval'; style-src ${webview.cspSource} 'unsafe-inline';`;
// Excel previews run the bundled parser in a blob worker.
const csp = `default-src 'none'; worker-src blob:; connect-src ${connectSrc}; img-src ${webview.cspSource} data:; font-src data:; script-src ${webview.cspSource} 'wasm-unsafe-eval'; style-src ${webview.cspSource} 'unsafe-inline';`;
return `<!DOCTYPE html>
<html lang="${language}">

View file

@ -43,6 +43,63 @@ function enclosingLayer(rule: Rule): string | undefined {
}
describe('build artifact — package boundary', () => {
it.each(['.', 'assets'])(
'ships the spreadsheet worker in a lazy chunk in dist/%s',
(directory) => {
const chunkDir = resolve(DIST_DIR, directory);
const files = readdirSync(chunkDir).filter((name) =>
name.endsWith('.js'),
);
const previewName = files.find((name) =>
/^SpreadsheetPreview-.*\.js$/.test(name),
);
expect(previewName).toBeDefined();
const preview = readFileSync(resolve(chunkDir, previewName!), 'utf8');
expect(preview).toContain('data-web-shell-excel-preview');
expect(preview).toContain('new Worker(');
expect(preview).toContain('createObjectURL');
const otherChunks = files
.filter((name) => name !== previewName)
.map((name) => readFileSync(resolve(chunkDir, name), 'utf8'))
.join('\n');
expect(otherChunks.includes(`import("./${previewName}")`)).toBe(true);
expect(
/(?:from|import)\s*["']\.\/SpreadsheetPreview-[^"']+\.js["']/.test(
otherChunks,
),
).toBe(false);
expect(otherChunks.includes('data-web-shell-excel-preview')).toBe(false);
const workerCode = preview.match(/["']([A-Za-z0-9+/=]{1000,})["']/)?.[1];
expect(workerCode).toBeDefined();
const decodedWorker = Buffer.from(workerCode!, 'base64').toString();
// Parser code must stay inside the worker, even if the UI remains lazy.
for (const marker of [
'Worksheet index is outside the preview range.',
'Cannot merge already merged cells',
]) {
expect(
decodedWorker.includes(marker),
`Worker contains ${marker}`,
).toBe(true);
expect(
preview.includes(marker),
`Parser leaked into preview: ${marker}`,
).toBe(false);
expect(
otherChunks.includes(marker),
`Parser leaked outside worker: ${marker}`,
).toBe(false);
}
expect(otherChunks.includes(workerCode!)).toBe(false);
// Embedded hosts must not resolve external ExcelJS/SSF packages themselves.
expect(
/(?:from|import)\s*["'](?:exceljs|ssf)["']/.test(
`${preview}\n${otherChunks}\n${decodedWorker}`,
),
).toBe(false);
},
);
it('does not depend on @qwen-code/webui', () => {
const bundle = readPackageJavascript();
expect(bundle).not.toContain('@qwen-code/webui');
@ -415,14 +472,20 @@ describe('build artifact — transcript entry (#11031)', () => {
// the 1,325,251 measurement was taken, so the entry was already past the
// 1,326,500 ceiling at that re-measure's own merge commit (#13964); the
// Managed task panel's copy (#13936) stays stubbed out of this entry.
// At 008c0de7 the remainder measures 1,327,531. The ceiling leaves a
// small margin around that intentional UI; re-measure and lower it if
// the entry gets leaner.
// At 008c0de7 the remainder measures 1,327,531. The read-only Excel
// preview puts its ten excel.* strings into that same shared table in
// both locales; its parser, worker and markup stay inside the lazily
// imported SpreadsheetPreview chunk, so only the copy enters this graph.
// That is the +2,000 this branch carried over the 1,325,000 budget, so
// the merged ceiling is the two budgets added — 1,331,500 — rather than a
// fresh measurement of a merged build. The ceiling leaves a small margin
// around that intentional UI; re-measure and lower it if the entry gets
// leaner.
const js = readTranscriptBundle().replace(
/^const __qwenWebShellCss=[^\n]*\n/,
'',
);
expect(js.length).toBeLessThan(1_329_500);
expect(js.length).toBeLessThan(1_331_500);
});
it('keeps selection copying and its converter out of the transcript entry', () => {

View file

@ -1092,19 +1092,18 @@ describe('ArtifactPanel code review artifacts', () => {
artifacts={[]}
tabs={[
{
id: 'attachment:report.xlsx',
id: 'attachment:report.xls',
kind: 'file',
title: 'report.xlsx',
workspacePath: 'report.xlsx',
title: 'report.xls',
workspacePath: 'report.xls',
previewData: new Blob(['PK'], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
type: 'application/vnd.ms-excel',
}),
previewMimeType:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
previewMimeType: 'application/vnd.ms-excel',
previewOnly: true,
},
]}
activeTabId="attachment:report.xlsx"
activeTabId="attachment:report.xls"
reviewChanges={[]}
selectedReviewPath={null}
onSelectTab={() => {}}
@ -1146,20 +1145,19 @@ describe('ArtifactPanel code review artifacts', () => {
artifacts={[]}
tabs={[
{
id: 'attachment:report.xlsx',
id: 'attachment:report.xls',
kind: 'file',
title: 'report.xlsx',
workspacePath: 'report.xlsx',
title: 'report.xls',
workspacePath: 'report.xls',
previewData: new Blob(['PK'], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
type: 'application/vnd.ms-excel',
}),
previewMimeType:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
previewMimeType: 'application/vnd.ms-excel',
previewOnly: true,
sourcePreview: true,
},
]}
activeTabId="attachment:report.xlsx"
activeTabId="attachment:report.xls"
reviewChanges={[]}
selectedReviewPath={null}
onSelectTab={() => {}}
@ -1178,7 +1176,7 @@ describe('ArtifactPanel code review artifacts', () => {
expect(container.querySelector('.cm-content')).toBeNull();
expect(mockWorkspaceActions.readWorkspaceFile).not.toHaveBeenCalled();
const download = container.querySelector<HTMLAnchorElement>(
'a[download="report.xlsx"]',
'a[download="report.xls"]',
);
expect(download?.href).toBe('blob:source-binary');
act(() => root.render(null));
@ -3839,7 +3837,7 @@ describe('ArtifactPanel workspace artifact previews', () => {
source: 'tool',
status: 'available',
title: 'Q3 workbook',
workspacePath: 'reports/q3.xlsx',
workspacePath: 'reports/q3.xls',
retention: 'ephemeral',
clientRetained: false,
createdAt: '2026-08-18T00:00:00.000Z',
@ -3885,6 +3883,9 @@ describe('ArtifactPanel workspace artifact previews', () => {
);
expect(download).toBeTruthy();
expect(download).toHaveProperty('disabled', true);
expect(mockWorkspaceActions.stat).not.toHaveBeenCalled();
expect(mockWorkspaceActions.readFileBytes).not.toHaveBeenCalled();
expect(mockWorkspaceActions.readWorkspaceFile).not.toHaveBeenCalled();
});
it('does not read workspace bytes when stat says the path is a directory', async () => {

View file

@ -39,6 +39,8 @@ import {
import { Skeleton } from '../ui/skeleton';
import { Button } from '../ui/button';
import {
lazy,
Suspense,
useCallback,
useEffect,
useLayoutEffect,
@ -58,6 +60,7 @@ import { formatRelativeTime } from '../../utils/formatRelativeTime';
import { normalizeTextMediaType } from '../../utils/imageIngestion';
import { DialogShell } from '../dialogs/DialogShell';
import { FileTypeIcon } from '../FileTypeIcon';
import { ErrorBoundary } from '../ErrorBoundary';
import { isSafeHref, Markdown } from '../messages/Markdown';
import {
DropdownMenu,
@ -84,6 +87,7 @@ import {
getImageMimeTypeFromPath,
getReviewDownloadMimeType,
isDownloadOnlyWorkspaceArtifact,
isExcelFile,
normalizeArtifactMimeType,
normalizePath,
readWorkspaceFileAsBlob,
@ -128,6 +132,8 @@ import {
ShellTaskDetail,
} from '../messages/TasksStatusMessage';
const SpreadsheetPreview = lazy(() => import('./SpreadsheetPreview'));
const MAX_REVIEW_SIDE_BY_SIDE_WIDTH = 700;
const FREQUENCIES: Frequency[] = [
'daily',
@ -1221,6 +1227,10 @@ export function ArtifactPanel({
</div>
) : activeTab.sourcePreview &&
activeTab.previewData &&
!isExcelFile(
activeTab.workspacePath,
activeTab.previewMimeType || activeTab.previewData.type,
) &&
normalizeArtifactMimeType(
activeTab.previewMimeType || activeTab.previewData.type,
) !== 'application/pdf' &&
@ -2961,7 +2971,12 @@ function ArtifactDetail({
}
if (canPreviewWorkspaceFile && artifact.workspacePath) {
if (isDownloadOnlyWorkspaceArtifact(artifact)) {
if (
isDownloadOnlyWorkspaceArtifact(artifact) ||
(isExcelFile(artifact.workspacePath, artifact.mimeType) &&
artifact.status !== 'available' &&
artifact.status !== 'changed')
) {
return (
<DownloadableWorkspaceArtifact
artifact={artifact}
@ -2976,6 +2991,7 @@ function ArtifactDetail({
workspaceActions={workspaceActions}
previewContent={previewContent}
previewSizeBytes={artifact.sizeBytes}
previewMimeType={artifact.mimeType}
imageMimeType={imageMimeType}
previewKind={
isHtmlArtifact(artifact)
@ -3113,14 +3129,17 @@ function DownloadableWorkspaceArtifact({
artifact,
workspaceActions,
}: {
artifact: DaemonSessionArtifact;
artifact: Pick<
DaemonSessionArtifact,
'kind' | 'workspacePath' | 'mimeType' | 'sizeBytes' | 'status'
>;
workspaceActions: ArtifactWorkspaceActions;
}) {
const { t } = useI18n();
const [error, setError] = useState<string | null>(null);
const [downloading, setDownloading] = useState(false);
const mountedRef = useRef(true);
const location = getArtifactLocation(artifact);
const location = artifact.workspacePath;
useEffect(() => {
mountedRef.current = true;
@ -3350,6 +3369,7 @@ function SourceDetail({
{t('common.loading')}
</div>
) : data &&
!isExcelFile(path, data.type) &&
data.type !== 'application/pdf' &&
!normalizeTextMediaType(data.type, path) ? (
<SourceBlobPreview
@ -3450,6 +3470,59 @@ function WorkspaceFilePreview({
previewOnly?: boolean;
onLoadError?: (error: string) => void;
}) {
const { t } = useI18n();
if (isExcelFile(workspacePath, previewMimeType || previewData?.type)) {
return (
<ErrorBoundary
resetKeys={[
workspacePath,
workspaceActions,
previewData,
artifactVersion,
]}
fallback={
<div>
<div role="alert" className={styles.previewError}>
{t('excel.invalid')}
</div>
{previewData ? (
<SourceBlobPreview
data={previewData}
title={workspacePath.split(/[/\\]/).pop()!}
image={false}
/>
) : workspaceActions ? (
<DownloadableWorkspaceArtifact
key={workspacePath}
artifact={{
workspacePath,
kind: 'document',
mimeType: previewMimeType,
status: 'available',
}}
workspaceActions={workspaceActions}
/>
) : null}
</div>
}
>
<Suspense
fallback={
<div className={styles.empty} role="status">
{t('common.loading')}
</div>
}
>
<SpreadsheetPreview
workspacePath={workspacePath}
workspaceActions={workspaceActions}
data={previewData}
artifactVersion={artifactVersion}
/>
</Suspense>
</ErrorBoundary>
);
}
if (previewData) {
return (
<AttachmentBlobPreview

View file

@ -0,0 +1,569 @@
// @vitest-environment jsdom
import { Blob as NodeBlob } from 'node:buffer';
import { act } from 'react';
import { createRoot, type Root } from 'react-dom/client';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { I18nProvider } from '../../i18n';
import SpreadsheetPreview from './SpreadsheetPreview';
import type {
ExcelPreviewResult,
ExcelPreviewSheet,
} from './excel-preview-types';
const { workers, constructWorker } = vi.hoisted(() => ({
constructWorker: vi.fn(),
workers: [] as Array<{
onmessage?: (event: { data: ExcelPreviewResult }) => void;
onerror?: () => void;
terminate: ReturnType<typeof vi.fn>;
postMessage: ReturnType<typeof vi.fn>;
}>,
}));
vi.mock('./excel-preview.worker?worker&inline', () => ({
default: class {
terminate = vi.fn();
postMessage = vi.fn();
constructor() {
constructWorker();
workers.push(this);
}
},
}));
let root: Root;
let container: HTMLDivElement;
const blob = () => new NodeBlob(['xlsx bytes']) as unknown as Blob;
const revoke = vi.fn();
async function render(data: Blob, path = 'report.xlsx') {
await act(async () => {
root.render(
<I18nProvider language="en">
<SpreadsheetPreview data={data} workspacePath={path} />
</I18nProvider>,
);
});
}
describe('SpreadsheetPreview', () => {
beforeEach(() => {
vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(
function (this: HTMLElement) {
return this.tagName === 'TR' ? 29 : 600;
},
);
vi.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(800);
workers.length = 0;
constructWorker.mockReset();
revoke.mockClear();
Object.defineProperty(URL, 'createObjectURL', {
configurable: true,
value: vi.fn(() => `blob:excel-${workers.length}`),
});
Object.defineProperty(URL, 'revokeObjectURL', {
configurable: true,
value: revoke,
});
container = document.createElement('div');
document.body.append(container);
root = createRoot(container);
});
afterEach(() => {
act(() => root.unmount());
container.remove();
vi.useRealTimers();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
it('bounds mounted tabs while every worksheet remains keyboard reachable', async () => {
const scrollIntoView = vi.spyOn(Element.prototype, 'scrollIntoView');
await render(blob());
const worker = workers[0]!;
act(() =>
worker.onmessage?.({
data: {
type: 'loaded',
workbook: {
sheetNames: Array.from({ length: 5000 }, (_, i) => `Sheet ${i}`),
},
},
}),
);
expect(container.querySelectorAll('[role="tab"]')).toHaveLength(50);
const next = container.querySelector<HTMLButtonElement>(
'[aria-label="Next worksheets"]',
)!;
const tabList = container.querySelector<HTMLElement>('[role="tablist"]')!;
tabList.scrollLeft = 3200;
act(() => next.click());
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 50,
});
const active = container.querySelector('[role="tab"][data-state="active"]');
expect(scrollIntoView.mock.contexts).toContain(active);
const previous = container.querySelector<HTMLButtonElement>(
'[aria-label="Previous worksheets"]',
)!;
act(() => previous.click());
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 49,
});
act(() => next.click());
const key = (value: string) =>
act(() => {
container
.querySelector('[role="tab"][data-state="active"]')!
.dispatchEvent(
new KeyboardEvent('keydown', {
key: value,
bubbles: true,
cancelable: true,
}),
);
});
key('ArrowLeft');
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 49,
});
expect(document.activeElement?.textContent).toBe('Sheet 49');
key('End');
expect(container.querySelectorAll('[role="tab"]')).toHaveLength(50);
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 4999,
});
expect(document.activeElement?.textContent).toBe('Sheet 4999');
key('Home');
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 0,
});
expect(document.activeElement?.textContent).toBe('Sheet 0');
expect(previous.disabled).toBe(true);
const requests = worker.postMessage.mock.calls.length;
act(() => previous.click());
expect(worker.postMessage).toHaveBeenCalledTimes(requests);
});
it('keeps a loaded preview usable when an overlapping download fails', async () => {
vi.stubGlobal('Blob', NodeBlob);
type Bytes = {
path: string;
offset: number;
sizeBytes: number;
returnedBytes: number;
contentBase64: string;
};
const pending: Array<{
resolve: (bytes: Bytes) => void;
reject: (reason: Error) => void;
}> = [];
const actions = {
stat: vi
.fn()
.mockResolvedValue({ type: 'file', sizeBytes: 4, modifiedMs: 1 }),
readFileBytes: vi.fn(
() =>
new Promise<Bytes>((resolve, reject) =>
pending.push({ resolve, reject }),
),
),
readWorkspaceFile: vi.fn(),
listScheduledTasks: vi.fn(),
updateScheduledTask: vi.fn(),
deleteScheduledTask: vi.fn(),
};
await act(async () =>
root.render(
<I18nProvider language="en">
<SpreadsheetPreview
workspacePath="report.xlsx"
workspaceActions={actions}
/>
</I18nProvider>,
),
);
expect(pending).toHaveLength(1);
await act(async () => container.querySelector('button')!.click());
expect(pending).toHaveLength(2);
await act(async () => {
pending[0]!.resolve({
path: 'report.xlsx',
offset: 0,
sizeBytes: 4,
returnedBytes: 4,
contentBase64: 'eGxzeA==',
});
await new Promise((resolve) => setTimeout(resolve, 0));
});
const worker = workers[0]!;
act(() =>
worker.onmessage?.({
data: { type: 'loaded', workbook: { sheetNames: ['One', 'Two'] } },
}),
);
act(() =>
worker.onmessage?.({
data: {
type: 'sheet',
index: 0,
sheet: {
name: 'One',
columns: 1,
truncated: false,
merges: [],
rows: [[{ text: 'Revenue', style: {} }]],
},
},
}),
);
await act(async () => pending[1]!.reject(new Error('Download failed')));
expect(container.querySelector('table')?.textContent).toContain('Revenue');
expect(container.querySelector('[role="alert"]')).toBeNull();
expect(container.querySelector('[role="status"]')?.textContent).toContain(
'Download failed',
);
const download = container.querySelector<HTMLAnchorElement>('a[download]')!;
download.addEventListener('click', (event) => event.preventDefault());
await act(async () => download.click());
expect(container.querySelector('[role="status"]')).toBeNull();
expect(container.querySelector('table')?.textContent).toContain('Revenue');
act(() =>
container.querySelectorAll<HTMLButtonElement>('[role="tab"]')[1]!.focus(),
);
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 1,
});
});
it.each(['construction', 'async error'])(
'keeps the original downloadable when worker %s fails',
async (failure) => {
if (failure === 'construction') {
constructWorker.mockImplementationOnce(() => {
throw new DOMException('Worker blocked by policy', 'SecurityError');
});
}
const original = blob();
await render(original);
if (failure === 'async error') {
act(() => workers[0]!.onerror?.());
expect(workers[0]!.terminate).toHaveBeenCalled();
} else {
expect(workers).toHaveLength(0);
}
expect(container.querySelector('[role="alert"]')?.textContent).toMatch(
failure === 'construction' ? /blocked by policy/ : /Unable to preview/,
);
const download = container.querySelector('a');
expect(download?.href).toBe('blob:excel-0');
expect(download?.download).toBe('report.xlsx');
expect(URL.createObjectURL).toHaveBeenCalledWith(original);
expect(revoke).not.toHaveBeenCalled();
act(() => root.render(null));
expect(revoke).toHaveBeenCalledWith('blob:excel-0');
},
);
it.each(['attachment', 'workspace'])(
'accepts an exactly 10 MiB %s for parsing',
async (source) => {
const size = 10 * 1024 * 1024;
if (source === 'attachment') {
await render(new NodeBlob([new Uint8Array(size)]) as unknown as Blob);
} else {
vi.stubGlobal('Blob', NodeBlob);
const actions = {
stat: vi.fn().mockResolvedValue({
type: 'file',
sizeBytes: size,
modifiedMs: 1,
}),
readFileBytes: vi.fn(
async (
path: string,
options: { offset?: number; maxBytes?: number } = {},
) => {
const offset = options.offset ?? 0;
const length = Math.min(options.maxBytes ?? size, size - offset);
return {
path,
offset,
sizeBytes: size,
returnedBytes: length,
contentBase64: Buffer.alloc(length).toString('base64'),
};
},
),
readWorkspaceFile: vi.fn(),
listScheduledTasks: vi.fn(),
updateScheduledTask: vi.fn(),
deleteScheduledTask: vi.fn(),
};
await act(async () =>
root.render(
<I18nProvider language="en">
<SpreadsheetPreview
workspacePath="report.xlsx"
workspaceActions={actions}
/>
</I18nProvider>,
),
);
await act(async () => {
await vi.waitFor(() => expect(workers).toHaveLength(1));
});
expect(actions.readFileBytes).toHaveBeenCalled();
expect(actions.readWorkspaceFile).not.toHaveBeenCalled();
}
expect(workers).toHaveLength(1);
const request = workers[0]!.postMessage.mock.calls[0]![0];
expect(request.type).toBe('load');
expect(request.data.byteLength).toBe(size);
expect(container.querySelector('[role="alert"]')).toBeNull();
expect(container.querySelector('a')?.download).toBe('report.xlsx');
},
);
it('terminates replaced work and ignores stale results, retaining the original download', async () => {
await render(blob());
const first = workers[0]!;
expect(first.postMessage).toHaveBeenCalledOnce();
await render(blob(), 'second.xlsx');
expect(first.terminate).toHaveBeenCalled();
expect(revoke).toHaveBeenCalledWith('blob:excel-0');
act(() => first.onmessage?.({ data: { type: 'error' } }));
expect(container.querySelector('[role="alert"]')).toBeNull();
act(() =>
workers[1]!.onmessage?.({
data: {
type: 'loaded',
workbook: { sheetNames: ['Current'] },
},
}),
);
act(() =>
workers[1]!.onmessage?.({
data: {
type: 'sheet',
index: 0,
sheet: {
name: 'Current',
columns: 1,
truncated: false,
merges: [],
rows: [[{ text: '<script>safe</script>', style: {} }]],
},
},
}),
);
expect(container.querySelector('table')?.textContent).toContain(
'<script>safe</script>',
);
expect(container.querySelector('script')).toBeNull();
expect(container.querySelector('a')?.download).toBe('second.xlsx');
expect(workers[1]!.terminate).not.toHaveBeenCalled();
act(() => root.unmount());
expect(workers[1]!.terminate).toHaveBeenCalled();
expect(revoke).toHaveBeenCalledWith('blob:excel-1');
root = createRoot(container);
});
it('requests only the selected sheet, ignores stale results and mounts only visible rows', async () => {
await render(blob());
const worker = workers[0]!;
expect(worker.postMessage.mock.calls[0]![0].type).toBe('load');
act(() =>
worker.onmessage?.({
data: {
type: 'loaded',
workbook: { sheetNames: ['Large', 'Small'] },
},
}),
);
expect(worker.postMessage.mock.calls.slice(1)).toEqual([
[{ type: 'sheet', index: 0 }],
]);
const sheet: ExcelPreviewSheet = {
name: 'Large',
columns: 1,
merges: [],
truncated: false,
rows: Array.from({ length: 2000 }, (_, i) => [
{ text: `Row ${i + 1}`, style: {} },
]),
};
act(() => worker.onmessage?.({ data: { type: 'sheet', index: 0, sheet } }));
expect(
container.querySelectorAll('tbody tr[data-index]').length,
).toBeGreaterThan(0);
expect(
container.querySelectorAll('tbody tr[data-index]').length,
).toBeLessThan(50);
expect(
container.querySelector('table')?.getAttribute('aria-rowcount'),
).toBe('2001');
expect(container.querySelector('table')?.textContent).toContain('Row 1');
expect(container.querySelector('table')?.textContent).not.toContain(
'Row 2000',
);
const second =
container.querySelectorAll<HTMLButtonElement>('[role="tab"]')[1]!;
act(() => second.focus());
expect(worker.postMessage).toHaveBeenLastCalledWith({
type: 'sheet',
index: 1,
});
expect(container.querySelector('table')).toBeNull();
act(() => worker.onmessage?.({ data: { type: 'sheet', index: 0, sheet } }));
expect(container.querySelector('table')).toBeNull();
act(() =>
worker.onmessage?.({
data: {
type: 'sheet',
index: 1,
sheet: {
...sheet,
name: 'Small',
rows: [
[{ text: 'Selected sheet', style: {} }],
[{ text: '', formula: '1+1', uncalculated: true, style: {} }],
],
},
},
}),
);
expect(container.querySelector('table')?.textContent).toContain(
'Selected sheet',
);
const annotation = container.querySelector('td span')!;
expect(annotation.textContent).toContain('Not calculated');
expect(annotation.classList.contains('text-muted-foreground')).toBe(false);
expect(worker.terminate).not.toHaveBeenCalled();
});
it('shows a timeout with a downloadable original and ignores late worker messages', async () => {
vi.useFakeTimers();
await render(blob(), 'slow.xlsx');
act(() => vi.advanceTimersByTime(30000));
expect(container.querySelector('[role="alert"]')?.textContent).toContain(
'took too long',
);
expect(container.querySelector('a')?.download).toBe('slow.xlsx');
const last = workers.at(-1)!;
expect(last.terminate).toHaveBeenCalled();
act(() =>
last.onmessage?.({
data: {
type: 'loaded',
workbook: { sheetNames: [] },
},
}),
);
expect(container.querySelector('[role="alert"]')?.textContent).toContain(
'took too long',
);
});
it('gives the selected sheet its own timeout and ignores a result after it expires', async () => {
vi.useFakeTimers();
await render(blob(), 'slow-sheet.xlsx');
const worker = workers.at(-1)!;
act(() => vi.advanceTimersByTime(29000));
act(() =>
worker.onmessage?.({
data: {
type: 'loaded',
workbook: {
sheetNames: Array.from({ length: 60 }, (_, i) => `Slow ${i}`),
},
},
}),
);
act(() => vi.advanceTimersByTime(2000));
expect(container.querySelector('[role="alert"]')).toBeNull();
expect(worker.terminate).not.toHaveBeenCalled();
act(() => vi.advanceTimersByTime(28000));
expect(worker.terminate).toHaveBeenCalled();
expect(container.querySelector('[role="alert"]')?.textContent).toContain(
'took too long',
);
const requests = worker.postMessage.mock.calls.length;
for (const button of container.querySelectorAll<HTMLButtonElement>(
'[role="tab"], [aria-label="Next worksheets"], [aria-label="Previous worksheets"]',
)) {
expect(button.disabled).toBe(true);
act(() => button.click());
}
expect(worker.postMessage).toHaveBeenCalledTimes(requests);
expect(container.querySelector('a')?.download).toBe('slow-sheet.xlsx');
act(() =>
worker.onmessage?.({
data: {
type: 'sheet',
index: 0,
sheet: {
name: 'Slow',
columns: 1,
rows: [[{ text: 'Late', style: {} }]],
merges: [],
truncated: false,
},
},
}),
);
expect(container.querySelector('table')).toBeNull();
});
it('does not read oversized workspace files and offers a separate download', async () => {
const actions = {
stat: vi.fn().mockResolvedValue({
type: 'file',
sizeBytes: 11 * 1024 * 1024,
modifiedMs: 1,
}),
readFileBytes: vi.fn(),
readWorkspaceFile: vi.fn(),
listScheduledTasks: vi.fn(),
updateScheduledTask: vi.fn(),
deleteScheduledTask: vi.fn(),
};
await act(async () =>
root.render(
<I18nProvider language="en">
<SpreadsheetPreview
workspacePath="large.xlsx"
workspaceActions={actions}
/>
</I18nProvider>,
),
);
expect(actions.stat).toHaveBeenCalledWith('large.xlsx');
expect(actions.readFileBytes).not.toHaveBeenCalled();
expect(workers).toHaveLength(0);
expect(container.querySelector('[role="alert"]')?.textContent).toContain(
'10 MiB',
);
expect(
[...container.querySelectorAll('button')].some(
(button) =>
button.textContent?.includes('Download') && !button.disabled,
),
).toBe(true);
});
it('rejects oversized attachments before starting a parser and keeps download available', async () => {
await render(
new NodeBlob([new Uint8Array(10 * 1024 * 1024 + 1)]) as unknown as Blob,
);
expect(workers).toHaveLength(0);
expect(container.querySelector('[role="alert"]')?.textContent).toContain(
'10 MiB',
);
expect(container.querySelector('a')?.download).toBe('report.xlsx');
});
});

View file

@ -0,0 +1,489 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useVirtualizer } from '@tanstack/react-virtual';
import { ChevronLeftIcon, ChevronRightIcon, DownloadIcon } from 'lucide-react';
import { useI18n } from '../../i18n';
import { Button } from '../ui/button';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';
import { extractErrorDetail } from '../../utils/errorDetail';
import {
downloadWorkspaceFile,
readWorkspaceFileAsBlob,
} from './artifactUtils';
import type { ArtifactWorkspaceActions } from './useArtifactWorkspaceTarget';
import ExcelWorker from './excel-preview.worker?worker&inline';
import {
excelColumnLabel,
MAX_EXCEL_PREVIEW_BYTES,
MAX_EXCEL_PREVIEW_CELLS,
type ExcelPreviewCell,
type ExcelPreviewResult,
type ExcelPreviewWorkbookInfo,
type ExcelPreviewSheet,
} from './excel-preview-types';
const MAX_VISIBLE_SHEET_TABS = 50;
export default function SpreadsheetPreview({
workspacePath,
workspaceActions,
data,
artifactVersion,
}: {
workspacePath: string;
workspaceActions?: ArtifactWorkspaceActions;
data?: Blob;
artifactVersion?: string;
}) {
const { t } = useI18n();
const [workbook, setWorkbook] = useState<ExcelPreviewWorkbookInfo>();
const [selectedSheet, setSelectedSheet] = useState<{
index: number;
sheet: ExcelPreviewSheet;
}>();
const [error, setError] = useState<string>();
const [downloadUrl, setDownloadUrl] = useState<string>();
const [downloading, setDownloading] = useState(false);
const [downloadError, setDownloadError] = useState<string>();
const [attempt, setAttempt] = useState(0);
const [sheetIndex, setSheetIndex] = useState(0);
const workerRef = useRef<Worker | undefined>(undefined);
const requestedSheetRef = useRef<number | undefined>(undefined);
const sheetTimeoutRef = useRef<ReturnType<typeof setTimeout> | undefined>(
undefined,
);
const ownerRef = useRef<object | undefined>(undefined);
const sheetTabsRef = useRef<HTMLDivElement>(null);
const focusSheetTabRef = useRef(false);
useEffect(() => {
const active = sheetTabsRef.current?.querySelector<HTMLButtonElement>(
'[data-state="active"]',
);
active?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
if (focusSheetTabRef.current) {
focusSheetTabRef.current = false;
active?.focus();
}
}, [sheetIndex]);
useEffect(() => {
const owner = {};
ownerRef.current = owner;
let cancelled = false;
let failed = false;
let worker: Worker | undefined;
let loadTimeout: ReturnType<typeof setTimeout> | undefined;
let url: string | undefined;
setWorkbook(undefined);
setError(undefined);
setDownloadUrl(undefined);
setDownloading(false);
setDownloadError(undefined);
setSheetIndex(0);
setSelectedSheet(undefined);
requestedSheetRef.current = undefined;
const fail = (message: string) => {
if (cancelled || failed) return;
failed = true;
worker?.terminate();
clearTimeout(loadTimeout);
setError(message);
};
const load = async () => {
const blob =
data ??
(await readWorkspaceFileAsBlob(
workspaceActions!.readFileBytes,
workspacePath,
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
{
statFile: async (path) => {
const stat = await workspaceActions!.stat(path);
if (stat.sizeBytes > MAX_EXCEL_PREVIEW_BYTES)
throw new Error(t('excel.tooLarge'));
return stat;
},
isCancelled: () => cancelled,
maxBytes: MAX_EXCEL_PREVIEW_BYTES,
},
));
if (cancelled) return;
url = URL.createObjectURL(blob);
setDownloadUrl(url);
if (blob.size > MAX_EXCEL_PREVIEW_BYTES) {
fail(t('excel.tooLarge'));
return;
}
const bytes = await blob.arrayBuffer();
if (cancelled) return;
worker = new ExcelWorker();
workerRef.current = worker;
worker.onmessage = (event: MessageEvent<ExcelPreviewResult>) => {
if (cancelled || failed) return;
const result = event.data;
if (result.type === 'error') {
fail(t('excel.invalid'));
} else if (result.type === 'loaded') {
clearTimeout(loadTimeout);
setWorkbook(result.workbook);
} else if (result.index === requestedSheetRef.current) {
clearTimeout(sheetTimeoutRef.current);
setSelectedSheet({ index: result.index, sheet: result.sheet });
}
};
worker.onerror = () => fail(t('excel.invalid'));
loadTimeout = setTimeout(() => fail(t('excel.timeout')), 30000);
worker.postMessage({ type: 'load', data: bytes }, [bytes]);
};
void load().catch((reason: unknown) => fail(extractErrorDetail(reason)));
return () => {
cancelled = true;
ownerRef.current = undefined;
worker?.terminate();
clearTimeout(loadTimeout);
if (workerRef.current === worker) workerRef.current = undefined;
if (url) URL.revokeObjectURL(url);
};
}, [data, workspacePath, workspaceActions, artifactVersion, attempt, t]);
useEffect(() => {
const worker = workerRef.current;
if (!workbook?.sheetNames.length || !worker || error) return;
requestedSheetRef.current = sheetIndex;
setSelectedSheet(undefined);
const timeout = setTimeout(() => {
requestedSheetRef.current = undefined;
worker.terminate();
setError(t('excel.timeout'));
}, 30000);
sheetTimeoutRef.current = timeout;
worker.postMessage({ type: 'sheet', index: sheetIndex });
return () => clearTimeout(timeout);
}, [workbook, sheetIndex, error, t]);
const sheet =
selectedSheet?.index === sheetIndex ? selectedSheet.sheet : undefined;
const sheetTabStart =
Math.floor(sheetIndex / MAX_VISIBLE_SHEET_TABS) * MAX_VISIBLE_SHEET_TABS;
const sheetTabEnd = Math.min(
sheetTabStart + MAX_VISIBLE_SHEET_TABS,
workbook?.sheetNames.length ?? 0,
);
return (
<Tabs
value={String(sheetIndex)}
onValueChange={(value) => setSheetIndex(Number(value))}
data-web-shell-excel-preview
className="h-full min-h-0 min-w-0 flex-1 gap-0 bg-background text-foreground"
>
<div className="flex min-w-0 items-end gap-2 border-b border-border">
{workbook && workbook.sheetNames.length > MAX_VISIBLE_SHEET_TABS && (
<Button
variant="ghost"
size="icon"
className="h-6 w-6 shrink-0"
aria-label={t('excel.previousWorksheets')}
disabled={!!error || sheetTabStart === 0}
onClick={() => setSheetIndex(sheetTabStart - 1)}
>
<ChevronLeftIcon />
</Button>
)}
{workbook && workbook.sheetNames.length > 0 ? (
<TabsList
ref={sheetTabsRef}
variant="line"
aria-label={t('excel.worksheet')}
className="-mb-px min-w-0 flex-1 justify-start gap-1 overflow-x-auto p-0 group-data-horizontal/tabs:h-6"
onKeyDownCapture={(event) => {
if (error) return;
const next =
event.key === 'ArrowRight'
? Math.min(sheetIndex + 1, workbook.sheetNames.length - 1)
: event.key === 'ArrowLeft'
? Math.max(sheetIndex - 1, 0)
: event.key === 'Home'
? 0
: event.key === 'End'
? workbook.sheetNames.length - 1
: undefined;
if (next !== undefined) {
event.preventDefault();
if (next !== sheetIndex) {
focusSheetTabRef.current = true;
setSheetIndex(next);
}
}
}}
>
{workbook.sheetNames
.slice(sheetTabStart, sheetTabEnd)
.map((name, offset) => (
<TabsTrigger
key={sheetTabStart + offset}
value={String(sheetTabStart + offset)}
title={name}
disabled={!!error}
className="h-6 max-w-48 flex-none rounded-none rounded-t-lg border-border bg-muted/40 px-4 py-0 text-xs font-normal text-foreground after:hidden data-[state=active]:border-b-background data-[state=active]:bg-background data-[state=active]:text-[var(--agent-blue-400)] dark:data-[state=active]:text-[var(--agent-blue-400)]"
>
<span className="truncate">{name}</span>
</TabsTrigger>
))}
</TabsList>
) : (
<span className="flex-1" />
)}
{workbook && workbook.sheetNames.length > MAX_VISIBLE_SHEET_TABS && (
<Button
variant="ghost"
size="icon"
className="h-6 w-6 shrink-0"
aria-label={t('excel.nextWorksheets')}
disabled={!!error || sheetTabEnd === workbook.sheetNames.length}
onClick={() => setSheetIndex(sheetTabEnd)}
>
<ChevronRightIcon />
</Button>
)}
{downloadUrl ? (
<Button variant="ghost" size="sm" asChild>
<a
href={downloadUrl}
download={workspacePath.split(/[/\\]/).pop()}
onClick={(event) => {
event.stopPropagation();
setDownloadError(undefined);
}}
>
<DownloadIcon />
{t('common.download')}
</a>
</Button>
) : (
workspaceActions && (
<Button
variant="ghost"
size="sm"
disabled={downloading}
onClick={() => {
const owner = ownerRef.current;
setDownloading(true);
setDownloadError(undefined);
void downloadWorkspaceFile(
workspaceActions,
workspacePath,
undefined,
() => ownerRef.current !== owner,
)
.catch((reason: unknown) => {
if (ownerRef.current === owner)
setDownloadError(extractErrorDetail(reason));
})
.finally(() => {
if (ownerRef.current === owner) setDownloading(false);
});
}}
>
<DownloadIcon />
{t('common.download')}
</Button>
)
)}
</div>
{downloadError && (
<p role="status" className="px-3 py-2 text-xs text-destructive">
{downloadError}
</p>
)}
<TabsContent
value={String(sheetIndex)}
className="flex min-h-0 flex-1 flex-col pt-2"
>
{!error && sheet?.truncated && (
<p
role="status"
className="border-b border-border px-3 py-2 text-xs text-muted-foreground"
>
{t('excel.truncated', {
cells: MAX_EXCEL_PREVIEW_CELLS.toLocaleString(),
})}
</p>
)}
{error ? (
<div role="alert" className="space-y-3 p-4 text-sm">
<p>{error}</p>
<Button
variant="outline"
size="sm"
onClick={() => setAttempt((value) => value + 1)}
>
{t('common.retry')}
</Button>
</div>
) : !workbook || (workbook.sheetNames.length > 0 && !sheet) ? (
<div role="status" className="p-4 text-sm text-muted-foreground">
{t('common.loading')}
</div>
) : !sheet?.rows.length || !sheet.columns ? (
<div className="p-4 text-sm text-muted-foreground">
{t('excel.empty')}
</div>
) : (
<SpreadsheetTable key={sheetIndex} sheet={sheet} />
)}
</TabsContent>
</Tabs>
);
}
function SpreadsheetTable({ sheet }: { sheet: ExcelPreviewSheet }) {
const { t } = useI18n();
const gutterWidth = `max(56px, calc(${String(sheet.rows.length).length}ch + 0.5rem + 1px))`;
const scrollRef = useRef<HTMLDivElement>(null);
const virtualizer = useVirtualizer({
count: sheet.rows.length,
getScrollElement: () => scrollRef.current,
estimateSize: () => 29,
paddingStart: 29,
overscan: 5,
});
const rows = virtualizer.getVirtualItems();
const start = rows[0]?.index ?? 0;
const end = (rows.at(-1)?.index ?? -1) + 1;
const merged = useMemo(() => {
const cells = new Map<
string,
{ rowSpan: number; colSpan: number; cell: ExcelPreviewCell | null } | null
>();
// Keep merged content visible when its original master is outside the mounted rows.
for (const merge of sheet.merges) {
const top = Math.max(start, merge.top);
const bottom = Math.min(end - 1, merge.bottom);
const right = Math.min(sheet.columns - 1, merge.right);
for (let r = top; r <= bottom; r++) {
for (let c = merge.left; c <= right; c++) cells.set(`${r}:${c}`, null);
}
if (top <= bottom)
cells.set(`${top}:${merge.left}`, {
rowSpan: bottom - top + 1,
colSpan: right - merge.left + 1,
cell: sheet.rows[merge.top]?.[merge.left] ?? null,
});
}
return cells;
}, [sheet, start, end]);
return (
<div
ref={scrollRef}
data-web-shell-excel-scroll
className="min-h-0 flex-1 overflow-auto border-t border-border [overflow-anchor:none]"
tabIndex={0}
role="region"
aria-label={sheet.name}
>
<table
aria-label={sheet.name}
aria-rowcount={sheet.rows.length + 1}
className="min-w-full table-fixed border-separate border-spacing-0 text-sm tabular-nums"
style={{ width: `calc(${gutterWidth} + ${sheet.columns * 160}px)` }}
>
<colgroup>
<col style={{ width: gutterWidth }} />
{Array.from({ length: sheet.columns }, (_, c) => (
<col key={c} />
))}
</colgroup>
<thead className="sticky top-0 z-20 bg-muted">
<tr aria-rowindex={1}>
<th
className="sticky left-0 z-10 border-b border-r border-border bg-muted px-2 py-1"
aria-label={t('excel.row')}
/>
{Array.from({ length: sheet.columns }, (_, c) => (
<th
key={c}
scope="col"
className="border-b border-r border-border px-2 py-1 font-normal"
>
{excelColumnLabel(c)}
</th>
))}
</tr>
</thead>
<tbody>
<tr aria-hidden="true">
<td
colSpan={sheet.columns + 1}
style={{
height: Math.max(0, (rows[0]?.start ?? 29) - 29),
padding: 0,
border: 0,
}}
/>
</tr>
{rows.map((virtualRow) => {
const r = virtualRow.index;
return (
<tr
key={virtualRow.key}
data-index={r}
ref={virtualizer.measureElement}
aria-rowindex={r + 2}
>
<th
scope="row"
className="sticky left-0 z-10 border-b border-r border-border bg-muted whitespace-nowrap px-1 py-1 text-right font-normal text-muted-foreground"
>
{r + 1}
</th>
{sheet.rows[r]!.map((value, c) => {
const merge = merged.get(`${r}:${c}`);
if (merge === null) return null;
const cell = merge?.cell ?? value;
return (
<td
key={c}
rowSpan={merge?.rowSpan}
colSpan={merge?.colSpan}
title={cell?.formula ? `=${cell.formula}` : cell?.text}
style={{
...cell?.style,
// Workbook colors need a white canvas, independent of the shell theme.
color: cell?.style.color ?? '#000000',
backgroundColor:
cell?.style.backgroundColor ?? '#ffffff',
}}
className="border-b border-r border-border px-2 py-1 align-top whitespace-pre-wrap break-words"
>
{cell?.uncalculated ? (
<span>
={cell.formula} ({t('excel.notCalculated')})
</span>
) : (
cell?.text
)}
</td>
);
})}
</tr>
);
})}
<tr aria-hidden="true">
<td
colSpan={sheet.columns + 1}
style={{
height: Math.max(
0,
virtualizer.getTotalSize() - (rows.at(-1)?.end ?? 29),
),
padding: 0,
border: 0,
}}
/>
</tr>
</tbody>
</table>
</div>
);
}

View file

@ -14,6 +14,7 @@ import {
getReviewDownloadMimeType,
isDownloadOnlyWorkspaceArtifact,
isOfficeDocumentPath,
isExcelFile,
normalizePath,
readWorkspaceFileAsBlob,
} from './artifactUtils';
@ -76,7 +77,7 @@ describe('artifactUtils', () => {
kind: 'file',
workspacePath: 'a.xlsx',
}),
).toBe(true);
).toBe(false);
expect(
isDownloadOnlyWorkspaceArtifact({
kind: 'pdf',
@ -97,6 +98,21 @@ describe('artifactUtils', () => {
).toBe(false);
});
it('recognizes xlsx paths and extensionless Excel attachments', () => {
const mime =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
expect(isExcelFile('reports/Q3.XLSX', 'application/octet-stream')).toBe(
true,
);
expect(isExcelFile('attachment-id', mime)).toBe(true);
expect(isExcelFile(undefined, `${mime}; charset=utf-8`)).toBe(true);
expect(isExcelFile('legacy.xls', mime)).toBe(false);
expect(isExcelFile('notes.txt', mime)).toBe(false);
expect(isExcelFile('attachment-id', 'application/octet-stream')).toBe(
false,
);
});
it('prefers recognized file types before the artifact kind', () => {
expect(artifactKindLabel('file', 'todolist.md')).toBe('Markdown');
expect(artifactKindLabel('file', 'preview.html')).toBe('HTML');
@ -144,7 +160,7 @@ describe('artifactUtils', () => {
it.each([
['report.docx', 'text/html'],
['report.xlsx', 'image/png'],
['report.xls', 'image/png'],
['report.pdf', 'text/markdown'],
['clip.mp4', 'image/png'],
])(

View file

@ -105,11 +105,23 @@ export function isOfficeDocumentPath(workspacePath?: string): boolean {
return OFFICE_DOCUMENT_EXTENSIONS.has(pathExtension(workspacePath));
}
export function isExcelFile(
workspacePath?: string,
mimeType?: string,
): boolean {
const extension = pathExtension(workspacePath);
return extension
? extension === '.xlsx'
: normalizeArtifactMimeType(mimeType) ===
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
}
export function isDownloadOnlyWorkspaceArtifact(artifact: {
kind?: string;
workspacePath?: string;
mimeType?: string;
}): boolean {
if (isExcelFile(artifact.workspacePath, artifact.mimeType)) return false;
const extension = pathExtension(artifact.workspacePath);
const mimeType = normalizeArtifactMimeType(artifact.mimeType);
if (

View file

@ -0,0 +1,514 @@
import ExcelJS from 'exceljs';
import JSZip from 'jszip';
import { describe, expect, it, vi } from 'vitest';
import {
getExcelWorkbookInfo,
loadExcelWorkbook,
projectExcelSheet,
} from './excel-preview-parser';
async function preview(workbook: ExcelJS.Workbook) {
return loadExcelWorkbook(await workbook.xlsx.writeBuffer());
}
async function mergedWorkbook(rangesBySheet: string[][]) {
const workbook = new ExcelJS.Workbook();
rangesBySheet.forEach((_ranges, index) => {
workbook.addWorksheet(`Sheet ${index}`).getCell('A1').value = 'Master';
});
const zip = await JSZip.loadAsync(await workbook.xlsx.writeBuffer());
for (const [index, ranges] of rangesBySheet.entries()) {
const path = `xl/worksheets/sheet${index + 1}.xml`;
const xml = await zip.file(path)!.async('string');
zip.file(
path,
xml.replace(
'</worksheet>',
`<mergeCells>${ranges.map((ref) => `<mergeCell ref="${ref}"/>`).join('')}</mergeCells></worksheet>`,
),
);
}
return zip.generateAsync({ type: 'arraybuffer', compression: 'DEFLATE' });
}
async function columnWorkbook(min: number, max: number) {
const workbook = new ExcelJS.Workbook();
workbook.addWorksheet('Columns').getCell('A1').value = 'Content';
const zip = await JSZip.loadAsync(await workbook.xlsx.writeBuffer());
const path = 'xl/worksheets/sheet1.xml';
const xml = await zip.file(path)!.async('string');
zip.file(
path,
xml.replace(
'<sheetData>',
`<cols><col min="${min}" max="${max}" width="10"/></cols><sheetData>`,
),
);
return zip.generateAsync({ type: 'arraybuffer', compression: 'DEFLATE' });
}
describe('Excel preview column loading limits', () => {
it.each([
[1, 16385],
[1, 4294967295],
[4294967295, 4294967295],
[0, 1],
[2, 1],
[1, 0],
])('rejects column range %i:%i before materialization', async (min, max) => {
const bytes = await columnWorkbook(min, max);
const Column = new ExcelJS.Workbook().addWorksheet('Probe').getColumn(1)
.constructor as { fromModel: () => unknown };
// Keep malicious fixtures safe even if the load guard regresses.
const expand = vi.spyOn(Column, 'fromModel').mockImplementation(() => {
throw new Error('Column materialization reached');
});
try {
await expect(loadExcelWorkbook(bytes)).rejects.toThrow(
'Column definitions are outside the worksheet',
);
expect(expand).not.toHaveBeenCalled();
} finally {
expand.mockRestore();
}
});
it('accepts all 16,384 legal columns and preserves merges', async () => {
const workbook = await loadExcelWorkbook(await columnWorkbook(1, 16384));
const sheet = workbook.worksheets[0]!;
expect(sheet.getColumn(16384).width).toBe(10);
expect(projectExcelSheet(workbook, 0)).toMatchObject({
columns: 1,
rows: [[{ text: 'Content' }]],
});
const merged = await loadExcelWorkbook(await mergedWorkbook([['A1:B2']]));
expect(merged.worksheets[0]!.getCell('B2').master.address).toBe('A1');
});
});
describe('Excel preview merge loading limits', () => {
it.each<[string, string[][], string]>([
['one huge range', [['A1:XFD1048576']], 'Merged ranges are too large'],
[
'area just over the budget',
[['A1:A100001']],
'Merged ranges are too large',
],
[
'total area across worksheets',
[['A1:J6000'], ['A1:J6000']],
'Merged ranges are too large',
],
[
'too many ranges',
[Array.from({ length: 10001 }, (_, i) => `A${i + 1}:B${i + 1}`)],
'Too many merged ranges',
],
[
'total count across worksheets',
[
Array.from({ length: 6000 }, (_, i) => `A${i + 1}:B${i + 1}`),
Array.from({ length: 6000 }, (_, i) => `A${i + 1}:B${i + 1}`),
],
'Too many merged ranges',
],
['invalid address', [['A0:B2']], 'Invalid merged cell address'],
])('rejects %s before expansion', async (_name, ranges, message) => {
const bytes = await mergedWorkbook(ranges);
const prototype = Object.getPrototypeOf(
new ExcelJS.Workbook().addWorksheet('Probe'),
) as ExcelJS.Worksheet;
// Never allow an intentionally malicious fixture to allocate cells, even if
// the guard regresses. The expected limit error must precede expansion.
const expand = vi
.spyOn(prototype, 'mergeCellsWithoutStyle')
.mockImplementation(() => {});
try {
const error = await loadExcelWorkbook(bytes).then(
() => '',
(reason: Error) => reason.message,
);
expect(error).toContain(message);
expect(expand).toHaveBeenCalledTimes(
ranges.length > 1 ? ranges[0]!.length : 0,
);
} finally {
expand.mockRestore();
}
});
it('accepts the exact area budget and isolates concurrent workbook budgets', async () => {
const bytes = await mergedWorkbook([['$A$1:$J$10000']]);
const books = await Promise.all([
loadExcelWorkbook(bytes),
loadExcelWorkbook(bytes),
]);
for (const book of books) {
expect(book.worksheets[0]!.getCell('J10000').master.address).toBe('A1');
expect(projectExcelSheet(book, 0)).toMatchObject({
columns: 10,
truncated: false,
});
}
});
it('accepts the exact range count without doing quadratic merge work in the test', async () => {
const bytes = await mergedWorkbook([
Array.from({ length: 10000 }, (_, i) => `A${i + 1}:B${i + 1}`),
]);
const prototype = Object.getPrototypeOf(
new ExcelJS.Workbook().addWorksheet('Probe'),
) as ExcelJS.Worksheet;
const expand = vi
.spyOn(prototype, 'mergeCellsWithoutStyle')
.mockImplementation(() => {});
try {
await loadExcelWorkbook(bytes);
expect(expand).toHaveBeenCalledTimes(10000);
} finally {
expand.mockRestore();
}
});
});
describe('Excel preview projection', () => {
it.each([false, true])(
'preserves display values with date1904=%s',
async (date1904) => {
const book = new ExcelJS.Workbook();
book.properties.date1904 = date1904;
const sheet = book.addWorksheet('Report');
sheet.addRow([1234.5, 0.125, 7, new Date('2026-10-08T00:00:00Z'), false]);
sheet.getCell('A1').numFmt = '#,##0.00';
sheet.getCell('B1').numFmt = '0.0%';
sheet.getCell('C1').numFmt = '00000';
sheet.getCell('D1').numFmt = 'yyyy-mm-dd';
sheet.addRow([
{ formula: '1-1', result: 0 },
{ formula: '1=2', result: false },
{ formula: 'SUM(A1:A2)' },
{ error: '#DIV/0!' },
{ richText: [{ text: 'Hello ' }, { text: 'world' }] },
]);
sheet.getCell('A3').value = {
text: '<script>alert(1)</script>',
hyperlink: 'javascript:alert(1)',
};
const parsed = projectExcelSheet(await preview(book), 0);
expect(parsed.rows[0]!.map((cell) => cell?.text)).toEqual([
'1,234.50',
'12.5%',
'00007',
'2026-10-08',
'FALSE',
]);
expect(parsed.rows[1]!.map((cell) => cell?.text)).toEqual([
'0',
'FALSE',
'',
'#DIV/0!',
'Hello world',
]);
expect(parsed.rows[1]![0]).toMatchObject({
formula: '1-1',
uncalculated: false,
});
expect(parsed.rows[1]![2]).toMatchObject({
formula: 'SUM(A1:A2)',
uncalculated: true,
});
expect(parsed.rows[2]![0]).toEqual({
text: '<script>alert(1)</script>',
style: {},
});
},
);
it('formats typed hyperlink values as plain strings after loading', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Links');
sheet.addRow([
{ richText: [{ text: 'Link ' }, { text: 'here' }] },
new Date('2026-10-08T00:00:00Z'),
1234.5,
true,
{ formula: 'HYPERLINK("https://example.test",1234.5)', result: 1234.5 },
]);
sheet.getCell('B1').numFmt = 'yyyy-mm-dd';
sheet.getCell('C1').numFmt = '#,##0.00';
sheet.getCell('E1').numFmt = '#,##0.00';
// OOXML hyperlink relationships preserve the underlying typed cell values.
const zip = await JSZip.loadAsync(await book.xlsx.writeBuffer());
const xmlPath = 'xl/worksheets/sheet1.xml';
const xml = await zip.file(xmlPath)!.async('string');
zip.file(
xmlPath,
xml.replace(
'</sheetData>',
'</sheetData><hyperlinks>' +
['A1', 'B1', 'C1', 'D1']
.map((ref) => `<hyperlink ref="${ref}" r:id="rId1"/>`)
.join('') +
'</hyperlinks>',
),
);
zip.file(
'xl/worksheets/_rels/sheet1.xml.rels',
'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' +
'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="https://example.test" TargetMode="External"/>' +
'</Relationships>',
);
const loaded = await loadExcelWorkbook(
await zip.generateAsync({ type: 'arraybuffer' }),
);
expect(loaded.worksheets[0]!.getCell('A1').hyperlink).toBe(
'https://example.test',
);
expect(
projectExcelSheet(loaded, 0).rows[0]!.map((cell) => cell?.text),
).toEqual(['Link here', '2026-10-08', '1,234.50', 'TRUE', '1,234.50']);
});
it('falls back both colors when an explicit color or fill is unsupported', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Colors');
sheet.addRow([
'Theme fill',
'Gradient',
'Pattern',
'Theme font',
'Indexed font',
]);
for (const column of ['A', 'B', 'C'])
sheet.getCell(`${column}1`).font = { color: { argb: 'FFFFFFFF' } };
sheet.getCell('A1').fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { theme: 4 },
};
sheet.getCell('B1').fill = {
type: 'gradient',
gradient: 'angle',
degree: 0,
stops: [
{ position: 0, color: { argb: 'FF000000' } },
{ position: 1, color: { argb: 'FF1F4E79' } },
],
};
sheet.getCell('C1').fill = {
type: 'pattern',
pattern: 'lightGrid',
fgColor: { argb: 'FF1F4E79' },
};
for (const column of ['D', 'E']) {
sheet.getCell(`${column}1`).font = {
color: column === 'D' ? { theme: 0 } : { indexed: 2 },
};
sheet.getCell(`${column}1`).fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FF1F4E79' },
};
}
const projected = projectExcelSheet(await preview(book), 0);
for (const cell of projected.rows[0]!) {
expect(cell?.style.color).toBeUndefined();
expect(cell?.style.backgroundColor).toBeUndefined();
}
});
it.each(['FF000000', 'FF000080'])(
'falls back an absent font color with solid fill %s',
async (argb) => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Missing foreground');
const cell = sheet.getCell('A1');
cell.value = 'Readable header';
cell.font = { bold: true };
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb } };
const loaded = await preview(book);
expect(loaded.worksheets[0]!.getCell('A1').font).toEqual({ bold: true });
const projected = projectExcelSheet(loaded, 0).rows[0]![0]!;
expect(projected.text).toBe('Readable header');
expect(projected.style.fontWeight).toBe('bold');
expect(projected.style.color).toBeUndefined();
expect(projected.style.backgroundColor).toBeUndefined();
},
);
it('keeps merged masters and basic styles without duplicating their values', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Merged');
sheet.mergeCells('B2:C3');
const cell = sheet.getCell('B2');
cell.value = 'Merged value';
cell.font = { bold: true, italic: true, color: { argb: 'FFFF0000' } };
cell.fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FF00FF00' },
};
cell.alignment = { horizontal: 'center' };
book.addWorksheet('Empty');
const loaded = await preview(book);
const parsed = projectExcelSheet(loaded, 0);
expect(parsed.merges).toEqual([{ top: 1, left: 1, bottom: 2, right: 2 }]);
expect(parsed.rows[1]?.[1]).toMatchObject({
text: 'Merged value',
style: {
fontWeight: 'bold',
fontStyle: 'italic',
color: '#FF0000',
backgroundColor: '#00FF00',
textAlign: 'center',
},
});
expect(parsed.rows[2]?.[2]).toBeNull();
expect(projectExcelSheet(loaded, 1)).toMatchObject({
rows: [],
columns: 0,
truncated: false,
});
});
it('ignores peripheral empty formatting while preserving coordinates and merges', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Data');
for (let row = 1; row <= 2000; row++)
sheet.addRow([`Row ${row}`, row, row * 2]);
sheet.getCell('XFD1').font = { bold: true };
sheet.getCell('C5000').font = { bold: true };
const empty = book.addWorksheet('Only formatting');
empty.getCell('XFD1').fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FFFF0000' },
};
const merged = book.addWorksheet('Merged extent');
merged.mergeCells('B2:E4');
merged.getCell('B2').value = 'Master';
const loaded = await preview(book);
expect(loaded.worksheets[0]!.columnCount).toBe(16384);
expect(loaded.worksheets[0]!.rowCount).toBe(5000);
const projected = projectExcelSheet(loaded, 0);
expect(projected).toMatchObject({ columns: 3, truncated: false });
expect(projected.rows).toHaveLength(2000);
expect(projected.rows.at(-1)?.[0]?.text).toBe('Row 2000');
expect(projectExcelSheet(loaded, 1)).toMatchObject({
columns: 0,
rows: [],
truncated: false,
});
const mergedProjection = projectExcelSheet(loaded, 2);
expect(mergedProjection.columns).toBe(5);
expect(mergedProjection.rows).toHaveLength(4);
expect(mergedProjection.rows[0]).toEqual([null, null, null, null, null]);
expect(mergedProjection.rows[1]?.[1]?.text).toBe('Master');
expect(mergedProjection.merges).toEqual([
{ top: 1, left: 1, bottom: 3, right: 4 },
]);
});
it('bounds work for a styled empty far column in every row without serializing the sheet', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Sparse');
for (let row = 1; row <= 200; row++) {
sheet.addRow([`Row ${row}`, row, row * 2]);
sheet.getCell(row, 16384).font = { bold: true };
}
const loaded = await preview(book);
const sparse = loaded.worksheets[0]!;
expect(sparse.columnCount).toBe(16384);
let cellAccesses = 0;
for (const row of sparse.getRows(1, 200)!) {
const internal = row as ExcelJS.Row & { _cells: ExcelJS.Cell[] };
internal._cells = new Proxy(internal._cells, {
has(target, property) {
cellAccesses++;
return Reflect.has(target, property);
},
get(target, property, receiver) {
if (typeof property === 'string' && /^\d+$/.test(property))
cellAccesses++;
return Reflect.get(target, property, receiver);
},
});
}
const model = vi.spyOn(sparse, 'model', 'get');
for (let attempt = 0; attempt < 2; attempt++) {
const result = projectExcelSheet(loaded, 0);
expect(result.rows).toHaveLength(200);
expect(result).toMatchObject({
columns: 3,
truncated: false,
merges: [],
});
}
expect(model).not.toHaveBeenCalled();
expect(cellAccesses).toBeLessThan(5000);
});
it('budgets all grid cells without independent sheet or column limits', async () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Large');
sheet.getCell('AY2001').value = 'outside preview';
for (let i = 1; i < 21; i++) book.addWorksheet(`Sheet ${i}`);
const loaded = await preview(book);
const metadata = getExcelWorkbookInfo(loaded);
expect(metadata.sheetNames).toHaveLength(21);
expect(projectExcelSheet(loaded, 20).name).toBe('Sheet 20');
const parsed = projectExcelSheet(loaded, 0);
expect(parsed.rows).toHaveLength(Math.floor(100_000 / 51));
expect(parsed).toMatchObject({ columns: 51, truncated: true });
expect(parsed.rows.at(-1)).toHaveLength(51);
expect(parsed.rows.length * parsed.columns).toBeLessThanOrEqual(100_000);
});
it('allows more than 2,000 rows, includes the exact budget and excludes the next row', () => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Narrow');
sheet.getCell('J10000').value = 'last included';
const exact = projectExcelSheet(book, 0);
expect(exact.rows).toHaveLength(10000);
expect(exact.rows.at(-1)?.[9]?.text).toBe('last included');
expect(exact.truncated).toBe(false);
sheet.getCell('A10001').value = 'excluded';
const over = projectExcelSheet(book, 0);
expect(over.rows).toHaveLength(10000);
expect(over.rows.length * over.columns).toBe(100_000);
expect(over.truncated).toBe(true);
});
it('does not project unrequested worksheets when loading metadata or another sheet', async () => {
const book = new ExcelJS.Workbook();
book.addWorksheet('First').getCell('A1').value = 'first value';
book.addWorksheet('Second').getCell('A1').value = 'second value';
const loaded = await preview(book);
const firstRead = vi.spyOn(loaded.worksheets[0]!, 'findRow');
const secondRead = vi.spyOn(loaded.worksheets[1]!, 'findRow');
expect(getExcelWorkbookInfo(loaded)).toEqual({
sheetNames: ['First', 'Second'],
});
expect(firstRead).not.toHaveBeenCalled();
expect(secondRead).not.toHaveBeenCalled();
expect(projectExcelSheet(loaded, 1).rows[0]?.[0]?.text).toBe(
'second value',
);
expect(secondRead).toHaveBeenCalled();
expect(firstRead).not.toHaveBeenCalled();
expect(projectExcelSheet(loaded, 0).rows[0]?.[0]?.text).toBe('first value');
});
it.each([-1, 1.5, 21, NaN])(
'rejects unavailable worksheet index %s',
(index) => {
const book = new ExcelJS.Workbook();
for (let i = 0; i < 21; i++) book.addWorksheet(`Sheet ${i}`);
expect(() => projectExcelSheet(book, index)).toThrow(RangeError);
},
);
it('rejects malformed files', async () => {
await expect(loadExcelWorkbook(new ArrayBuffer(10))).rejects.toThrow();
});
});

View file

@ -0,0 +1,239 @@
import ExcelJS from 'exceljs';
import { format } from 'ssf';
import type { Cell, CellValue, Row, Worksheet } from 'exceljs';
import {
MAX_EXCEL_PREVIEW_CELLS,
MAX_EXCEL_PREVIEW_MERGED_CELLS,
MAX_EXCEL_PREVIEW_MERGES,
} from './excel-preview-types';
import type {
ExcelPreviewCell,
ExcelPreviewSheet,
ExcelPreviewWorkbookInfo,
} from './excel-preview-types';
function rgb(argb: string | undefined): string | undefined {
return argb && /^(?:[\da-f]{2})?[\da-f]{6}$/i.test(argb)
? `#${argb.slice(-6)}`
: undefined;
}
function displayValue(
value: CellValue,
numberFormat: string,
date1904: boolean,
): string {
if (value === null || value === undefined) return '';
if (typeof value === 'object' && 'error' in value) return value.error;
if (typeof value === 'object' && 'richText' in value)
return value.richText.map((part) => part.text).join('');
if (typeof value === 'object' && 'hyperlink' in value)
return displayValue(value.text, numberFormat, date1904);
if (typeof value === 'boolean') return value ? 'TRUE' : 'FALSE';
if (typeof value === 'number' || value instanceof Date) {
const numeric =
value instanceof Date
? 25569 + value.getTime() / 86400000 - (date1904 ? 1462 : 0)
: value;
try {
return format(
numberFormat || (value instanceof Date ? 'yyyy-mm-dd' : 'General'),
numeric,
{ date1904 },
);
} catch {
return value instanceof Date ? value.toISOString() : String(value);
}
}
return typeof value === 'string' ? value : '';
}
function previewCell(cell: Cell, date1904: boolean): ExcelPreviewCell {
const formula = cell.formula;
// ExcelJS's value getter drops falsy formula results, including 0 and false.
const value =
cell.type === ExcelJS.ValueType.Formula ? cell.result : cell.value;
const alignment = cell.alignment?.horizontal;
const fill = cell.fill;
const color = rgb(cell.font?.color?.argb);
const backgroundColor =
fill?.type === 'pattern' && fill.pattern === 'solid'
? rgb(fill.fgColor?.argb)
: undefined;
// A retained fill needs an explicit foreground; fall back together otherwise.
const unsupportedColors =
(!color && !!backgroundColor) ||
(fill &&
!(fill.type === 'pattern' && fill.pattern === 'none') &&
!backgroundColor);
return {
text: displayValue(value, cell.numFmt, date1904),
...(formula
? { formula, uncalculated: value === undefined || value === null }
: {}),
style: {
fontWeight: cell.font?.bold ? 'bold' : undefined,
fontStyle: cell.font?.italic ? 'italic' : undefined,
color: unsupportedColors ? undefined : color,
backgroundColor: unsupportedColors ? undefined : backgroundColor,
textAlign:
alignment === 'left' ||
alignment === 'center' ||
alignment === 'right' ||
alignment === 'justify'
? alignment
: undefined,
},
};
}
function address(value: string): { row: number; column: number } {
const match = /^\$?([A-Z]+)\$?([1-9]\d*)$/i.exec(value);
if (!match) throw new Error('Invalid merged cell address.');
let column = 0;
for (const character of match[1]!.toUpperCase())
column = column * 26 + character.charCodeAt(0) - 64;
const row = Number(match[2]);
if (row > 1_048_576 || column > 16_384)
throw new Error('Merged cell address is outside the worksheet.');
return { row: row - 1, column: column - 1 };
}
const mergeBudgets = new WeakMap<
ExcelJS.Workbook,
{ cells: number; count: number }
>();
let loadGuardInstalled = false;
function installLoadGuard() {
if (loadGuardInstalled) return;
// ExcelJS 4.4.0 expands columns before merges in this setter. Validate both
// before allocation, only for preview workbooks; recheck the hook on upgrades.
const prototype = Object.getPrototypeOf(
new ExcelJS.Workbook().addWorksheet('guard'),
);
const descriptor = Object.getOwnPropertyDescriptor(prototype, 'model')!;
const setModel = descriptor.set!;
Object.defineProperty(prototype, 'model', {
...descriptor,
set(
this: Worksheet,
model: { cols?: { min: number; max: number }[]; mergeCells?: string[] },
) {
const budget = mergeBudgets.get(this.workbook);
if (budget) {
for (const column of model.cols ?? []) {
if (
!Number.isInteger(column.min) ||
!Number.isInteger(column.max) ||
column.min < 1 ||
column.max < column.min ||
column.max > 16_384
)
throw new RangeError(
'Column definitions are outside the worksheet.',
);
}
const ranges = model.mergeCells ?? [];
budget.count += ranges.length;
if (budget.count > MAX_EXCEL_PREVIEW_MERGES)
throw new RangeError('Too many merged ranges to preview.');
for (const range of ranges) {
const parts = range.split(':');
if (parts.length > 2) throw new Error('Invalid merged range.');
const a = address(parts[0]!);
const b = address(parts[1] ?? parts[0]!);
budget.cells +=
(Math.abs(b.row - a.row) + 1) * (Math.abs(b.column - a.column) + 1);
if (budget.cells > MAX_EXCEL_PREVIEW_MERGED_CELLS)
throw new RangeError('Merged ranges are too large to preview.');
}
}
setModel.call(this, model);
},
});
loadGuardInstalled = true;
}
export async function loadExcelWorkbook(
data: ArrayBuffer,
): Promise<ExcelJS.Workbook> {
installLoadGuard();
const workbook = new ExcelJS.Workbook();
mergeBudgets.set(workbook, { cells: 0, count: 0 });
try {
return await workbook.xlsx.load(data);
} finally {
mergeBudgets.delete(workbook);
}
}
export function getExcelWorkbookInfo(
workbook: ExcelJS.Workbook,
): ExcelPreviewWorkbookInfo {
return {
sheetNames: workbook.worksheets.map((sheet) => sheet.name),
};
}
// ExcelJS 4.4.0 stores sparse arrays: its public iterators and model getter
// scan every hole up to XFD. Enumerate present entries for preview work instead.
type SparseWorksheet = Worksheet & {
_rows: (Row & { _cells: (Cell | undefined)[] })[];
_merges: Record<
string,
{ top: number; left: number; bottom: number; right: number }
>;
};
export function projectExcelSheet(
workbook: ExcelJS.Workbook,
index: number,
): ExcelPreviewSheet {
if (
!Number.isInteger(index) ||
index < 0 ||
index >= workbook.worksheets.length
) {
throw new RangeError('Worksheet index is outside the preview range.');
}
const sheet = workbook.worksheets[index]! as SparseWorksheet;
// Ignore peripheral formatting-only cells, preserving merged placeholders.
let columns = 0;
let lastRow = 0;
for (const row of Object.values(sheet._rows)) {
if (!row) continue;
for (const cell of Object.values(row._cells)) {
if (!cell || cell.type === ExcelJS.ValueType.Null) continue;
lastRow = Math.max(lastRow, row.number);
columns = Math.max(columns, Number(cell.col));
}
}
const rowCount =
columns === 0
? 0
: Math.min(lastRow, Math.floor(MAX_EXCEL_PREVIEW_CELLS / columns));
return {
name: sheet.name,
columns,
truncated: columns > 0 && lastRow > rowCount,
rows: Array.from({ length: rowCount }, (_, r) =>
Array.from({ length: columns }, (_, c) => {
const cell = sheet.findRow(r + 1)?.findCell(c + 1);
return cell && cell.type !== ExcelJS.ValueType.Null && !cell.isMerged
? previewCell(cell, workbook.properties.date1904)
: cell?.isMerged && cell.master.address === cell.address
? previewCell(cell, workbook.properties.date1904)
: null;
}),
),
merges: Object.values(sheet._merges)
.map((merge) => ({
top: merge.top - 1,
left: merge.left - 1,
bottom: merge.bottom - 1,
right: merge.right - 1,
}))
.filter((merge) => merge.top < rowCount && merge.left < columns),
};
}

View file

@ -0,0 +1,42 @@
import type { CSSProperties } from 'react';
export const MAX_EXCEL_PREVIEW_BYTES = 10 * 1024 * 1024;
export const MAX_EXCEL_PREVIEW_CELLS = 100_000;
export const MAX_EXCEL_PREVIEW_MERGED_CELLS = 100_000;
export const MAX_EXCEL_PREVIEW_MERGES = 10_000;
export interface ExcelPreviewCell {
text: string;
formula?: string;
uncalculated?: boolean;
style: CSSProperties;
}
export interface ExcelPreviewSheet {
name: string;
rows: (ExcelPreviewCell | null)[][];
columns: number;
truncated: boolean;
merges: { top: number; left: number; bottom: number; right: number }[];
}
export interface ExcelPreviewWorkbookInfo {
sheetNames: string[];
}
export type ExcelPreviewRequest =
| { type: 'load'; data: ArrayBuffer }
| { type: 'sheet'; index: number };
export type ExcelPreviewResult =
| { type: 'loaded'; workbook: ExcelPreviewWorkbookInfo }
| { type: 'sheet'; index: number; sheet: ExcelPreviewSheet }
| { type: 'error' };
export function excelColumnLabel(index: number): string {
let label = '';
for (let value = index + 1; value > 0; value = Math.floor((value - 1) / 26)) {
label = String.fromCharCode(65 + ((value - 1) % 26)) + label;
}
return label;
}

View file

@ -0,0 +1,32 @@
import {
getExcelWorkbookInfo,
loadExcelWorkbook,
projectExcelSheet,
} from './excel-preview-parser';
import type {
ExcelPreviewRequest,
ExcelPreviewResult,
} from './excel-preview-types';
let workbook: Awaited<ReturnType<typeof loadExcelWorkbook>> | undefined;
self.onmessage = async (event: MessageEvent<ExcelPreviewRequest>) => {
let result: ExcelPreviewResult;
try {
if (event.data.type === 'load') {
workbook = undefined;
workbook = await loadExcelWorkbook(event.data.data);
result = { type: 'loaded', workbook: getExcelWorkbookInfo(workbook) };
} else {
if (!workbook) throw new Error('Workbook is not loaded.');
result = {
type: 'sheet',
index: event.data.index,
sheet: projectExcelSheet(workbook, event.data.index),
};
}
} catch {
result = { type: 'error' };
}
self.postMessage(result);
};

View file

@ -0,0 +1,876 @@
import { expect, test, type Page, type TestInfo } from '@playwright/test';
import ExcelJS from 'exceljs';
import JSZip from 'jszip';
import { readFile } from 'node:fs/promises';
import type { DaemonEvent, DaemonSessionArtifact } from '@qwen-code/sdk/daemon';
import {
assistantTextEvent,
createWebShellDaemonScenario,
installMockDaemon,
replayCompleteEvent,
toolCallEvent,
turnCompleteEvent,
userTextEvent,
type WebShellDaemonScenario,
} from './utils/mockDaemon';
// Production's asset service worker would bypass the network failure mocks.
test.use({ serviceWorkers: 'block' });
const MIME =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
const previewSelector = '[data-web-shell-excel-preview]';
const workbookPath = 'reports/quarterly.xlsx';
async function workbookBytes(): Promise<Buffer> {
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('Quarterly');
sheet.addRow(['Metric', 'Value', 'Notes']);
sheet.addRow(['Revenue', 1234.5, 'Saved report']);
sheet.getCell('B2').numFmt = '"¥"#,##0.00';
sheet.addRow(['Margin', 0.125]);
sheet.getCell('B3').numFmt = '0.00%';
sheet.addRow(['Identifier', 123]);
sheet.getCell('B4').numFmt = '000000';
sheet.addRow(['Date', new Date('2026-10-08T00:00:00Z')]);
sheet.getCell('B5').numFmt = 'yyyy-mm-dd';
sheet.addRow(['Cached zero', { formula: '1-1', result: 0 }]);
sheet.addRow(['Pending formula', { formula: 'SUM(B2:B3)' }]);
sheet.addRow(['Error', { error: '#DIV/0!' }]);
sheet.addRow(['Literal HTML', '<img src=x onerror=alert(1)>']);
sheet.mergeCells('A10:C10');
sheet.getCell('A10').value = 'Merged report note';
sheet.getCell('A1').font = { bold: true, color: { argb: 'FFFFFFFF' } };
sheet.getCell('B1').font = { color: { argb: 'FF000000' } };
sheet.getCell('C1').font = { bold: true };
sheet.getCell('C1').fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FF000000' },
};
sheet.getCell('A1').fill = {
type: 'pattern',
pattern: 'solid',
fgColor: { argb: 'FF245B91' },
};
for (let row = 11; row <= 105; row++)
sheet.getCell(row, 1).value = `Row ${row}`;
workbook.addWorksheet('Details').addRow(['Second worksheet', 'Verified']);
workbook.addWorksheet('Empty');
const limited = workbook.addWorksheet('Limited');
limited.getCell('A1').value = 'Visible limit marker';
limited.getCell('AX2001').value = 'Outside preview limit';
return Buffer.from(await workbook.xlsx.writeBuffer());
}
function artifact(): DaemonSessionArtifact {
return {
id: 'excel-report',
title: 'Quarterly workbook',
kind: 'document',
storage: 'workspace',
source: 'tool',
status: 'available',
workspacePath: workbookPath,
mimeType: MIME,
retention: 'ephemeral',
clientRetained: false,
toolCallId: 'make-workbook',
toolName: 'Artifact',
createdAt: '2026-10-08T00:00:00Z',
updatedAt: '2026-10-08T00:00:00Z',
};
}
function referenceEvent(): DaemonEvent {
const text = `@${workbookPath}`;
return {
id: 1,
v: 1,
type: 'session_update',
data: {
update: {
sessionUpdate: 'user_message_chunk',
content: { type: 'text', text },
_meta: {
inputAnnotations: [
{
type: 'reference',
start: 0,
end: text.length,
text,
reference: {
id: 'excel-reference',
kind: 'file',
value: workbookPath,
serialized: text,
metadata: { fileKind: 'file' },
},
},
],
},
},
},
};
}
async function install(
page: Page,
info: TestInfo,
scenario: WebShellDaemonScenario,
bytes: Buffer,
) {
const daemon = await installMockDaemon(page, scenario, {
baseURL: String(info.project.use.baseURL),
});
const byteReads: string[] = [];
const textReads: string[] = [];
const attachmentReads: string[] = [];
await page.route('**/workspace/models', (route) =>
route.fulfill({ json: { models: [] } }),
);
await page.route('**/stat?*', (route) =>
route.fulfill({
json: {
type: 'file',
sizeBytes: bytes.length,
modifiedMs: 1,
},
}),
);
await page.route('**/file/bytes?*', (route) => {
const params = new URL(route.request().url()).searchParams;
byteReads.push(params.get('path') ?? '');
const offset = Number(params.get('offset') ?? 0);
const chunk = bytes.subarray(
offset,
offset + Number(params.get('maxBytes') ?? bytes.length),
);
return route.fulfill({
json: {
path: params.get('path'),
offset,
sizeBytes: bytes.length,
returnedBytes: chunk.length,
contentBase64: chunk.toString('base64'),
},
});
});
await page.route('**/file?*', (route) => {
textReads.push(route.request().url());
return route.fulfill({
status: 400,
json: { error: 'Binary files must use byte reads' },
});
});
await page.route('**/session/*/attachments/*', (route) => {
attachmentReads.push(route.request().url());
return route.fulfill({ contentType: MIME, body: bytes });
});
await page.route('**/session/*/attachments', (route) =>
route.fulfill({
json: {
attachments: [
{
type: 'resource',
attachmentId: 'incoming.xlsx',
mimeType: MIME,
size: bytes.length,
},
],
},
}),
);
const open = async () => {
await page.goto(`/session/${scenario.sessionId}?theme=dark&lang=en`);
await daemon.sse.waitForConnection(scenario.sessionId);
await daemon.sendEvent(
replayCompleteEvent({
sessionId: scenario.sessionId,
replayedCount: scenario.events.length,
}),
);
await expect(
page.locator('[data-web-shell-composer-editor] .cm-content'),
).toBeVisible();
};
return { open, byteReads, textReads, attachmentReads };
}
async function pasteWorkbook(
page: Page,
bytes: Buffer,
name = 'incoming.xlsx',
) {
await page.locator('[data-web-shell-composer-editor] .cm-content').evaluate(
(element, file) => {
const transfer = new DataTransfer();
transfer.items.add(
new File(
[Uint8Array.from(atob(file.base64), (char) => char.charCodeAt(0))],
file.name,
{ type: file.mimeType },
),
);
element.dispatchEvent(
new ClipboardEvent('paste', {
bubbles: true,
cancelable: true,
clipboardData: transfer,
}),
);
},
{ base64: bytes.toString('base64'), name, mimeType: MIME },
);
await page
.locator('[data-web-shell-composer-attachments]')
.getByRole('button')
.filter({ hasText: name })
.first()
.click();
}
test('previews artifact and @file with lazy Excel loading, formats and virtual scrolling', async ({
page,
}, info) => {
await page.setViewportSize({ width: 1500, height: 1000 });
const bytes = await workbookBytes();
const scenario = createWebShellDaemonScenario({
events: [
referenceEvent(),
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 2 },
),
assistantTextEvent('The workbook is ready.', { id: 3 }),
turnCompleteEvent('report', { id: 4 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const modules: string[] = [];
const workers: string[] = [];
page.on('worker', (worker) => workers.push(worker.url()));
page.on('request', (request) => {
if (/SpreadsheetPreview|excel-preview\.worker/.test(request.url()))
modules.push(request.url());
});
const mock = await install(page, info, scenario, bytes);
await mock.open();
expect(modules).toEqual([]);
expect(workers).toEqual([]);
await page
.locator('[data-web-shell-message-list] [title="quarterly.xlsx"] > button')
.click();
const preview = page.locator(previewSelector);
const table = preview.getByRole('table', { name: 'Quarterly', exact: true });
await expect(table).toBeVisible();
const explicitBlackCell = table.getByRole('cell', {
name: 'Value',
exact: true,
});
await expect(explicitBlackCell).toHaveCSS('color', 'rgb(0, 0, 0)');
await expect(explicitBlackCell).toHaveCSS(
'background-color',
'rgb(255, 255, 255)',
);
const missingForegroundCell = table.getByRole('cell', {
name: 'Notes',
exact: true,
});
await expect(missingForegroundCell).toHaveCSS('font-weight', '700');
await expect(missingForegroundCell).toHaveCSS('color', 'rgb(0, 0, 0)');
await expect(missingForegroundCell).toHaveCSS(
'background-color',
'rgb(255, 255, 255)',
);
expect(modules.some((url) => url.includes('SpreadsheetPreview'))).toBe(true);
// Worker creation is observable in both dev and the production inline build.
expect(workers).toHaveLength(1);
for (const value of [
'¥1,234.50',
'12.50%',
'000123',
'2026-10-08',
'#DIV/0!',
'Not calculated',
]) {
await expect(table).toContainText(value);
}
await expect(
table
.getByRole('row')
.filter({ hasText: 'Cached zero' })
.getByRole('cell')
.nth(1),
).toHaveText('0');
await expect(
table.getByRole('cell', { name: 'Merged report note', exact: true }),
).toHaveAttribute('colspan', '3');
await expect(table).toContainText('<img src=x onerror=alert(1)>');
await expect(table.locator('img')).toHaveCount(0);
await preview.locator('[data-web-shell-excel-scroll]').evaluate((element) => {
element.scrollTop = element.scrollHeight;
});
await expect(table).toContainText('Row 105');
await expect(table).not.toContainText('Revenue');
await preview.getByRole('tab', { name: 'Details', exact: true }).click();
await expect(
preview.getByRole('table', { name: 'Details', exact: true }),
).toContainText('Second worksheet');
await preview.getByRole('tab', { name: 'Empty', exact: true }).click();
await expect(preview).toContainText('This worksheet is empty.');
await expect(preview.getByRole('table')).toHaveCount(0);
await preview.getByRole('tab', { name: 'Limited', exact: true }).click();
await expect(preview).toContainText('Preview limited to');
await expect(preview).toContainText('Visible limit marker');
await expect(preview).not.toContainText('Outside preview limit');
await preview.getByRole('tab', { name: 'Quarterly', exact: true }).click();
await expect(table).toContainText('Revenue');
await preview.getByRole('tab', { name: 'Quarterly', exact: true }).focus();
await page.keyboard.press('ArrowRight');
await expect(
preview.getByRole('tab', { name: 'Details', exact: true }),
).toBeFocused();
await expect(
preview.getByRole('tab', { name: 'Details', exact: true }),
).toHaveAttribute('aria-selected', 'true');
await expect(
preview.getByRole('table', { name: 'Details', exact: true }),
).toContainText('Second worksheet');
await page.keyboard.press('ArrowLeft');
await expect(table).toContainText('Revenue');
const selectedColors = await preview
.getByRole('tab', { name: 'Quarterly', exact: true })
.evaluate((element) => {
const sample = document.createElement('span');
sample.style.color = 'var(--agent-blue-400)';
element.append(sample);
const colors = {
actual: getComputedStyle(element).color,
expected: getComputedStyle(sample).color,
};
sample.remove();
return colors;
});
await expect(
preview.getByRole('tab', { name: 'Quarterly', exact: true }),
).toHaveCSS('color', selectedColors.expected);
await page.screenshot({
path: info.outputPath('excel-artifact-mock-daemon.png'),
animations: 'disabled',
});
const downloadPromise = page.waitForEvent('download');
await preview.getByRole('link', { name: /Download/i }).click();
const download = await downloadPromise;
expect(await readFile((await download.path())!)).toEqual(bytes);
const previousReads = mock.byteReads.length;
await page
.locator('[data-web-shell-user-bubble]')
.getByText(workbookPath, { exact: true })
.click();
await expect(table).toBeVisible();
await expect.poll(() => mock.byteReads.length).toBeGreaterThan(previousReads);
expect(mock.byteReads.every((path) => path === workbookPath)).toBe(true);
expect(mock.textReads).toEqual([]);
});
test('keeps large worksheets virtual while scrolling through wrapped and merged cells', async ({
page,
}, info) => {
await page.setViewportSize({ width: 1500, height: 1000 });
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('Large');
for (let r = 1; r <= 2000; r++) {
sheet.addRow(
Array.from({ length: 50 }, (_, c) =>
c === 0 ? `Record ${r}` : r * 50 + c,
),
);
}
sheet.getCell('B5').value = 'Wrapped content\n'.repeat(8);
sheet.mergeCells('B40:C140');
sheet.getCell('B40').value = 'Cross-window merge';
workbook.addWorksheet('Small').addRow(['Small sheet top']);
const narrow = workbook.addWorksheet('Long');
narrow.getCell('A1').value = 'Long sheet top';
narrow.getCell('J5001').value = 'Past the former row limit';
for (let i = 3; i < 22; i++)
workbook.addWorksheet(`Extra ${i}`).addRow([`Sheet ${i} content`]);
workbook.getWorksheet('Extra 21')!.getCell('A100000').value =
'Last allowed row';
const bytes = Buffer.from(await workbook.xlsx.writeBuffer());
const scenario = createWebShellDaemonScenario({
events: [
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 1 },
),
turnCompleteEvent('report', { id: 2 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const mock = await install(page, info, scenario, bytes);
await mock.open();
await page
.locator('[data-web-shell-message-list] [title="quarterly.xlsx"] > button')
.click();
const preview = page.locator(previewSelector);
const table = preview.getByRole('table', { name: 'Large', exact: true });
const scroll = preview.locator('[data-web-shell-excel-scroll]');
await expect(
table.getByRole('cell', { name: 'Record 1', exact: true }),
).toBeVisible();
await expect(
preview.getByRole('button', {
name: /Next worksheets|Previous worksheets/,
}),
).toHaveCount(0);
expect(await table.locator('tbody tr[data-index]').count()).toBeLessThan(70);
expect(
await table
.locator('tbody tr[data-index="4"]')
.evaluate((row) => row.getBoundingClientRect().height),
).toBeGreaterThan(100);
await scroll.evaluate((element) => {
element.scrollTop = 2500;
});
await expect(
table.getByRole('cell', { name: 'Cross-window merge', exact: true }),
).toHaveAttribute('colspan', '2');
await expect
.poll(async () =>
Number(
await table
.locator('tbody tr[data-index]')
.first()
.getAttribute('data-index'),
),
)
.toBeGreaterThan(39);
for (const offset of ['end', 'start', 'end']) {
await scroll.evaluate((element, target) => {
element.scrollTop = target === 'end' ? element.scrollHeight : 0;
}, offset);
await expect(
table.getByRole('cell', {
name: offset === 'end' ? 'Record 2000' : 'Record 1',
exact: true,
}),
).toBeVisible();
expect(await table.locator('tbody tr[data-index]').count()).toBeLessThan(
70,
);
}
await preview.getByRole('tab', { name: 'Small', exact: true }).click();
await expect(preview.getByRole('table')).toContainText('Small sheet top');
for (const selector of ['thead th:first-child', 'tbody th[scope="row"]']) {
expect(
await preview
.getByRole('table')
.locator(selector)
.evaluate((element) => element.getBoundingClientRect().width),
).toBeCloseTo(56, 1);
}
await expect(preview.getByRole('tab')).toHaveCount(22);
await preview.getByRole('tab', { name: 'Extra 21', exact: true }).click();
await expect(preview.getByRole('table')).toContainText('Sheet 21 content');
await scroll.evaluate((element) => {
element.scrollTop = element.scrollHeight;
});
const lastRowNumber = preview.getByRole('rowheader', {
name: '100000',
exact: true,
});
await expect(lastRowNumber).toBeVisible();
await preview.getByRole('table').evaluate((element) => {
element.style.fontSize = '20px';
// Stress digit width without changing the virtualizer's measured row height.
element.style.lineHeight = '20px';
});
expect(
await lastRowNumber.evaluate(
(element) => element.getBoundingClientRect().width,
),
).toBeGreaterThanOrEqual(56);
const rowNumberBounds = await lastRowNumber.evaluate((element) => {
const range = document.createRange();
range.selectNodeContents(element);
const text = range.getBoundingClientRect();
const cell = element.getBoundingClientRect();
return { left: text.left - cell.left, right: cell.right - text.right };
});
expect(rowNumberBounds.left).toBeGreaterThanOrEqual(0);
expect(rowNumberBounds.right).toBeGreaterThanOrEqual(0);
await preview.screenshot({
path: info.outputPath('adaptive-row-gutter.png'),
});
await preview.getByRole('tab', { name: 'Long', exact: true }).click();
await expect(preview.getByRole('table')).toContainText('Long sheet top');
await expect(preview).not.toContainText('Preview limited to');
await scroll.evaluate((element) => {
element.scrollTop = element.scrollHeight;
});
await expect(
preview
.getByRole('table')
.getByRole('cell', { name: 'Past the former row limit', exact: true }),
).toBeVisible();
await preview.getByRole('tab', { name: 'Large', exact: true }).click();
await expect(
table.getByRole('cell', { name: 'Record 1', exact: true }),
).toBeVisible();
expect(await scroll.evaluate((element) => element.scrollTop)).toBe(0);
});
test('bounds worksheet tabs and reaches the final sheet across groups', async ({
page,
}, info) => {
const workbook = new ExcelJS.Workbook();
for (let i = 0; i < 60; i++)
workbook.addWorksheet(`Sheet ${i}`).addRow([`Content ${i}`]);
const bytes = Buffer.from(await workbook.xlsx.writeBuffer());
const mock = await install(page, info, createWebShellDaemonScenario(), bytes);
await mock.open();
await pasteWorkbook(page, bytes);
const preview = page.locator(previewSelector);
await expect(preview.getByRole('table')).toContainText('Content 0');
await expect(preview.getByRole('tab')).toHaveCount(50);
await preview.getByRole('button', { name: 'Next worksheets' }).click();
await expect(preview.getByRole('table')).toContainText('Content 50');
await expect(preview.getByRole('tab')).toHaveCount(10);
await preview
.getByRole('tab', { name: 'Sheet 50', exact: true })
.press('End');
await expect(
preview.getByRole('tab', { name: 'Sheet 59', exact: true }),
).toBeFocused();
await expect(preview.getByRole('table')).toContainText('Content 59');
await preview.screenshot({ path: info.outputPath('worksheet-groups.png') });
await preview
.getByRole('tab', { name: 'Sheet 59', exact: true })
.press('Home');
await expect(
preview.getByRole('tab', { name: 'Sheet 0', exact: true }),
).toBeFocused();
await expect(preview.getByRole('table')).toContainText('Content 0');
await preview.getByRole('button', { name: 'Next worksheets' }).click();
await preview
.getByRole('tab', { name: 'Sheet 50', exact: true })
.press('ArrowLeft');
await expect(
preview.getByRole('tab', { name: 'Sheet 49', exact: true }),
).toBeFocused();
await expect(preview.getByRole('table')).toContainText('Content 49');
});
test('@smoke previews incoming unsent Blob and leaves invalid workbook downloadable', async ({
page,
}, info) => {
const bytes = await workbookBytes();
const mock = await install(page, info, createWebShellDaemonScenario(), bytes);
await mock.open();
await pasteWorkbook(page, bytes);
const preview = page.locator(previewSelector);
await expect(preview.getByRole('table', { name: 'Quarterly' })).toContainText(
'Revenue',
);
expect(mock.byteReads).toEqual([]);
expect(mock.attachmentReads).toEqual([]);
await pasteWorkbook(page, Buffer.from('not a ZIP workbook'), 'broken.xlsx');
await expect(preview.getByRole('alert')).toBeVisible();
await expect(preview.getByRole('table')).toHaveCount(0);
const downloadPromise = page.waitForEvent('download');
await preview.getByRole('link', { name: /Download/i }).click();
const download = await downloadPromise;
expect(await readFile((await download.path())!)).toEqual(
Buffer.from('not a ZIP workbook'),
);
});
test('opens persisted attachment from message and Sources, then restores it after reload', async ({
page,
}, info) => {
const bytes = await workbookBytes();
const scenario = createWebShellDaemonScenario({
events: [
userTextEvent('Read this workbook', { id: 1 }),
{
id: 2,
v: 1,
type: 'session_update',
data: {
update: {
sessionUpdate: 'user_message_chunk',
content: {
type: 'resource',
attachmentId: 'incoming.xlsx',
mimeType: MIME,
size: bytes.length,
},
},
},
},
assistantTextEvent('Workbook attached.', { id: 3 }),
turnCompleteEvent('incoming', { id: 4 }),
],
});
scenario.capabilities.features.push('session_attachment_list');
const mock = await install(page, info, scenario, bytes);
await mock.open();
await page
.locator('[data-web-shell-user-files]')
.getByRole('button', { name: /incoming.xlsx/ })
.click();
await expect(
page.locator(previewSelector).getByRole('table', { name: 'Quarterly' }),
).toBeVisible();
await page.locator('[data-web-shell-turn-sources-trigger]').click();
await page
.locator('[data-web-shell-turn-sources]')
.getByRole('button', { name: 'incoming.xlsx', exact: true })
.click();
await expect(
page.locator(previewSelector).getByRole('table', { name: 'Quarterly' }),
).toContainText('Revenue');
const previousReads = mock.attachmentReads.length;
await mock.open();
await expect(
page.locator(previewSelector).getByRole('table', { name: 'Quarterly' }),
).toContainText('Revenue');
expect(mock.attachmentReads.length).toBeGreaterThan(previousReads);
expect(mock.byteReads).toEqual([]);
expect(mock.textReads).toEqual([]);
});
for (const kind of [
'excessive merged area',
'out-of-grid column definitions',
]) {
test(`rejects ${kind} without losing the original download or crashing on reopen`, async ({
page,
}, info) => {
const zip = await JSZip.loadAsync(await workbookBytes());
const path = 'xl/worksheets/sheet1.xml';
const xml = await zip.file(path)!.async('string');
zip.file(
path,
kind === 'excessive merged area'
? xml.replace(
/<mergeCells[^>]*>[\s\S]*?<\/mergeCells>/,
'<mergeCells><mergeCell ref="A1:J10001"/></mergeCells>',
)
: xml.replace(
'<sheetData>',
'<cols><col min="1" max="4294967295" width="10"/></cols><sheetData>',
),
);
const bytes = await zip.generateAsync({
type: 'nodebuffer',
compression: 'DEFLATE',
});
const scenario = createWebShellDaemonScenario({
events: [
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 1 },
),
turnCompleteEvent('report', { id: 2 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const mock = await install(page, info, scenario, bytes);
await mock.open();
await page
.locator(
'[data-web-shell-message-list] [title="quarterly.xlsx"] > button',
)
.click();
const preview = page.locator(previewSelector);
await expect(preview.getByRole('alert')).toContainText('too complex');
await expect(preview.getByRole('table')).toHaveCount(0);
const downloadPromise = page.waitForEvent('download');
await preview.getByRole('link', { name: /Download/i }).click();
expect(await readFile((await (await downloadPromise).path())!)).toEqual(
bytes,
);
await page.reload();
await expect(preview.getByRole('alert')).toContainText('too complex');
await page.screenshot({
path: info.outputPath(
kind === 'excessive merged area'
? 'excel-merge-limit-mock-daemon.png'
: 'excel-column-limit-mock-daemon.png',
),
});
});
}
test('retains all content when peripheral empty cells carry formatting', async ({
page,
}, info) => {
const book = new ExcelJS.Workbook();
const sheet = book.addWorksheet('Orders');
for (let row = 1; row <= 2000; row++)
sheet.addRow([`Order ${row}`, row, row * 2]);
sheet.getCell('XFD1').font = { bold: true };
sheet.getCell('C5000').font = { bold: true };
const bytes = Buffer.from(await book.xlsx.writeBuffer());
const scenario = createWebShellDaemonScenario({
events: [
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 1 },
),
turnCompleteEvent('report', { id: 2 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const mock = await install(page, info, scenario, bytes);
await mock.open();
await page
.locator('[data-web-shell-message-list] [title="quarterly.xlsx"] > button')
.click();
const preview = page.locator(previewSelector);
await expect(preview.getByRole('table')).toHaveAttribute(
'aria-rowcount',
'2001',
);
await expect(preview.getByRole('columnheader')).toHaveCount(4);
await expect(preview.getByRole('status')).toHaveCount(0);
await preview.locator('[data-web-shell-excel-scroll]').evaluate((element) => {
element.scrollTop = element.scrollHeight;
});
await expect(
preview.getByRole('cell', { name: 'Order 2000', exact: true }),
).toBeVisible();
await page.screenshot({
path: info.outputPath('excel-formatted-extent-mock-daemon.png'),
});
});
for (const allowWorker of [false, true]) {
test(`host worker policy ${allowWorker ? 'permits preview' : 'keeps download fallback'}`, async ({
page,
}, info) => {
const bytes = await workbookBytes();
const scenario = createWebShellDaemonScenario({
events: [
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 1 },
),
turnCompleteEvent('report', { id: 2 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const mock = await install(page, info, scenario, bytes);
await page.route(
(url) => url.pathname === `/session/${scenario.sessionId}`,
async (route) => {
const response = await route.fetch();
await route.fulfill({
response,
headers: {
...response.headers(),
// Vite dev serves a worker URL; production inlines the worker as a blob.
'content-security-policy': allowWorker
? "worker-src 'self' blob:"
: "worker-src 'none'",
},
});
},
);
await mock.open();
await page
.locator(
'[data-web-shell-message-list] [title="quarterly.xlsx"] > button',
)
.click();
const preview = page.locator(previewSelector);
if (allowWorker) {
await expect(preview.getByRole('table')).toBeVisible();
await expect(preview.getByRole('alert')).toHaveCount(0);
} else {
await expect(preview.getByRole('alert')).toBeVisible();
await expect(preview.getByRole('table')).toHaveCount(0);
}
const downloadPromise = page.waitForEvent('download');
await preview.getByRole('link', { name: /Download/i }).click();
const download = await downloadPromise;
expect(await readFile((await download.path())!)).toEqual(bytes);
});
}
test('keeps artifact and incoming Blob downloadable when the lazy preview module fails', async ({
page,
}, info) => {
const bytes = await workbookBytes();
const scenario = createWebShellDaemonScenario({
events: [
userTextEvent('Prepare the workbook', { id: 1 }),
toolCallEvent(
'make-workbook',
'Artifact',
{ file_path: workbookPath },
{ id: 2 },
),
assistantTextEvent('The workbook is ready.', { id: 3 }),
turnCompleteEvent('report', { id: 4 }),
],
artifacts: [artifact()],
});
scenario.capabilities.features.push('session_artifacts');
const mock = await install(page, info, scenario, bytes);
const blockedModules: string[] = [];
await page.route(
/\/SpreadsheetPreview(?:-[^/?]+)?\.(?:tsx|js)(?:\?|$)/,
(route) => {
blockedModules.push(route.request().url());
return route.abort('failed');
},
);
await mock.open();
await page
.locator('[data-web-shell-message-list] [title="quarterly.xlsx"] > button')
.click();
const panel = page.getByRole('complementary', {
name: 'Right panel',
exact: true,
});
await expect(panel.getByRole('alert')).toBeVisible();
expect(blockedModules.length).toBeGreaterThan(0);
await expect(panel.locator(previewSelector)).toHaveCount(0);
expect(mock.byteReads).toEqual([]);
const artifactDownloadPromise = page.waitForEvent('download');
await panel.getByRole('button', { name: 'Download', exact: true }).click();
const artifactDownload = await artifactDownloadPromise;
expect(await readFile((await artifactDownload.path())!)).toEqual(bytes);
const workspaceReadCount = mock.byteReads.length;
await pasteWorkbook(page, bytes);
await expect(panel.getByRole('alert')).toBeVisible();
const attachmentDownloadPromise = page.waitForEvent('download');
await panel
.getByRole('link', { name: 'Download incoming.xlsx', exact: true })
.click();
const attachmentDownload = await attachmentDownloadPromise;
expect(await readFile((await attachmentDownload.path())!)).toEqual(bytes);
expect(mock.byteReads).toHaveLength(workspaceReadCount);
expect(mock.attachmentReads).toEqual([]);
expect(mock.textReads).toEqual([]);
});

View file

@ -766,6 +766,20 @@ const EN: Messages = {
'common.downloadFailed': (v) => `Download failed: ${v?.message ?? ''}`,
'common.open': 'Open',
'common.openFailed': (v) => `Could not open link: ${v?.message ?? ''}`,
'excel.worksheet': 'Worksheet',
'excel.row': 'Row',
'excel.truncated': (v) =>
`Preview limited to ${v?.cells} cells per worksheet. Download the original for all content.`,
'excel.previousWorksheets': 'Previous worksheets',
'excel.nextWorksheets': 'Next worksheets',
'excel.empty': 'This worksheet is empty.',
'excel.notCalculated': 'Not calculated',
'excel.tooLarge':
'Excel preview supports files up to 10 MiB. Download the original to open it.',
'excel.invalid':
'Unable to preview this workbook. It may be damaged, password protected, too complex, or unsupported by this browser. You can download the original.',
'excel.timeout':
'This workbook took too long to preview. Download the original to open it.',
'artifact.openLink': 'Open link',
'artifact.longDocument': 'File is large. Source is shown by default.',
'artifact.renderFullPreview': 'Render full preview',
@ -5113,6 +5127,18 @@ const ZH: Messages = {
'common.downloadFailed': (v) => `下载失败:${v?.message ?? ''}`,
'common.open': '打开',
'common.openFailed': (v) => `无法打开链接:${v?.message ?? ''}`,
'excel.worksheet': '工作表',
'excel.row': '行',
'excel.truncated': (v) =>
`每个工作表最多预览 ${v?.cells} 个单元格。下载原文件查看全部内容。`,
'excel.previousWorksheets': '上一组工作表',
'excel.nextWorksheets': '下一组工作表',
'excel.empty': '此工作表为空。',
'excel.notCalculated': '未计算',
'excel.tooLarge': 'Excel 预览支持最大 10 MiB 的文件,请下载原文件打开。',
'excel.invalid':
'无法预览此工作簿,文件可能已损坏、受密码保护、复杂度过高,或当前浏览器不支持。你可以下载原文件。',
'excel.timeout': '工作簿预览超时,请下载原文件打开。',
'artifact.openLink': '打开链接',
'artifact.longDocument': '文件过大,默认展示源码。',
'artifact.renderFullPreview': '完整排版预览',

View file

@ -70,6 +70,7 @@
"clsx": "^2.1.1",
"codemirror": "^6.0.0",
"echarts": "^6.0.0",
"exceljs": "4.4.0",
"fzf": "^0.5.2",
"katex": "^0.16.47",
"lucide-react": "^1.24.0",
@ -81,6 +82,7 @@
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"shiki": "^1.29.2",
"ssf": "0.11.2",
"tailwind-merge": "^3.6.0",
"turndown": "^7.2.4",
"vaul": "^1.1.2"
@ -102,6 +104,7 @@
"@types/turndown": "^5.0.6",
"@vitejs/plugin-react": "^4.2.0",
"jsdom": "^26.1.0",
"jszip": "3.10.2",
"openapi-typescript": "^7.13.0",
"postcss": "^8.5.17",
"postcss-selector-parser": "^7.1.4",

379
pnpm-lock.yaml generated
View file

@ -5,6 +5,8 @@ settings:
excludeLinksFromLockfile: false
overrides:
brace-expansion@1: 1.1.21
brace-expansion@2: 2.1.7
typescript: 5.8.3
'@microsoft/api-extractor>typescript': 5.9.3
'@qwen-code/mobile-mcp>typescript': 5.8.2
@ -1555,6 +1557,9 @@ importers:
echarts:
specifier: ^6.0.0
version: 6.1.0
exceljs:
specifier: 4.4.0
version: 4.4.0
fzf:
specifier: ^0.5.2
version: 0.5.2
@ -1588,6 +1593,9 @@ importers:
shiki:
specifier: ^1.29.2
version: 1.29.2
ssf:
specifier: 0.11.2
version: 0.11.2
tailwind-merge:
specifier: ^3.6.0
version: 3.6.0
@ -1631,6 +1639,9 @@ importers:
jsdom:
specifier: ^26.1.0
version: 26.1.0(supports-color@7.2.0)
jszip:
specifier: 3.10.2
version: 3.10.2
openapi-typescript:
specifier: ^7.13.0
version: 7.13.0(typescript@5.8.3)
@ -2555,6 +2566,12 @@ packages:
resolution: {integrity: sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@fast-csv/format@4.3.5':
resolution: {integrity: sha512-8iRn6QF3I8Ak78lNAa+Gdl5MJJBM5vRHivFtMRUWINdevNo00K7OXxS2PshawLKTejVwieIlPmK5YlLu6w4u8A==}
'@fast-csv/parse@4.3.6':
resolution: {integrity: sha512-uRsLYksqpbDmWaSmzvJcuApSEe38+6NQZBUsuAyMZKqHxH0g1wcJgsKUvN3WC8tewaqFjBMMGrkHmC+T7k8LvA==}
'@floating-ui/core@1.8.0':
resolution: {integrity: sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==}
@ -4923,6 +4940,9 @@ packages:
'@types/node-fetch@2.6.13':
resolution: {integrity: sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==}
'@types/node@14.18.63':
resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==}
'@types/node@18.19.130':
resolution: {integrity: sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg==}
@ -5429,10 +5449,22 @@ packages:
anynum@1.0.1:
resolution: {integrity: sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==}
archiver-utils@2.1.0:
resolution: {integrity: sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==}
engines: {node: '>= 6'}
archiver-utils@3.0.4:
resolution: {integrity: sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==}
engines: {node: '>= 10'}
archiver-utils@5.0.2:
resolution: {integrity: sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==}
engines: {node: '>= 14'}
archiver@5.3.2:
resolution: {integrity: sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==}
engines: {node: '>= 10'}
archiver@7.0.1:
resolution: {integrity: sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==}
engines: {node: '>= 14'}
@ -5583,6 +5615,10 @@ packages:
before-after-hook@3.0.2:
resolution: {integrity: sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==}
big-integer@1.6.52:
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
engines: {node: '>=0.6'}
bignumber.js@9.3.1:
resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==}
@ -5590,6 +5626,9 @@ packages:
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
binary@0.3.0:
resolution: {integrity: sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==}
binaryextensions@6.11.0:
resolution: {integrity: sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==}
engines: {node: '>=4'}
@ -5597,6 +5636,9 @@ packages:
bl@4.1.0:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
bluebird@3.4.7:
resolution: {integrity: sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==}
body-parser@2.3.0:
resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==}
engines: {node: '>=18'}
@ -5607,11 +5649,11 @@ packages:
boundary@2.0.0:
resolution: {integrity: sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==}
brace-expansion@1.1.12:
resolution: {integrity: sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==}
brace-expansion@1.1.21:
resolution: {integrity: sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==}
brace-expansion@2.1.4:
resolution: {integrity: sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==}
brace-expansion@2.1.7:
resolution: {integrity: sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==}
brace-expansion@5.0.9:
resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==}
@ -5636,12 +5678,20 @@ packages:
buffer-equal-constant-time@1.0.1:
resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}
buffer-indexof-polyfill@1.0.2:
resolution: {integrity: sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==}
engines: {node: '>=0.10'}
buffer@5.7.1:
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
buffer@6.0.3:
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
buffers@0.1.1:
resolution: {integrity: sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==}
engines: {node: '>=0.2.0'}
bun-ffi-structs@0.3.1:
resolution: {integrity: sha512-3gM7PpVWLyrwxWjcilSiGuhWanhZivvo6l0u573NziPH6f/gwk6McbaYgn7oJWov6pKGRTDbrg94W5DcJsKTtQ==}
peerDependencies:
@ -5707,6 +5757,9 @@ packages:
resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==}
engines: {node: '>=12'}
chainsaw@0.1.0:
resolution: {integrity: sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==}
chalk@2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
engines: {node: '>=4'}
@ -5886,6 +5939,10 @@ packages:
component-emitter@1.3.1:
resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==}
compress-commons@4.1.2:
resolution: {integrity: sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==}
engines: {node: '>= 10'}
compress-commons@6.0.2:
resolution: {integrity: sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==}
engines: {node: '>= 14'}
@ -5957,6 +6014,10 @@ packages:
engines: {node: '>=0.8'}
hasBin: true
crc32-stream@4.0.3:
resolution: {integrity: sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==}
engines: {node: '>= 10'}
crc32-stream@6.0.0:
resolution: {integrity: sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==}
engines: {node: '>= 14'}
@ -6362,6 +6423,9 @@ packages:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
duplexer2@0.1.4:
resolution: {integrity: sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==}
eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
@ -6699,6 +6763,10 @@ packages:
resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
engines: {node: '>=18.0.0'}
exceljs@4.4.0:
resolution: {integrity: sha512-XctvKaEMaj1Ii9oDOqbW/6e1gXknSY4g/aLCDicOXqBE4M0nRWkUu0PTp++UPNzoFY12BNHMfs/VadKIS6llvg==}
engines: {node: '>=8.3.0'}
execa@5.1.1:
resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
engines: {node: '>=10'}
@ -6742,6 +6810,10 @@ packages:
fast-content-type-parse@2.0.1:
resolution: {integrity: sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==}
fast-csv@4.3.6:
resolution: {integrity: sha512-2RNSpuwwsJGP0frGsOmTb9oUF+VkFSM4SyLTDgwf2ciHWTarN0lQTC+F2f/t5J9QjW+c65VFIAAu85GsvMIusw==}
engines: {node: '>=10.0.0'}
fast-deep-equal@3.1.3:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
@ -6885,6 +6957,10 @@ packages:
resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}
engines: {node: '>= 0.6'}
frac@1.1.2:
resolution: {integrity: sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==}
engines: {node: '>=0.8'}
fraction.js@5.3.4:
resolution: {integrity: sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==}
@ -6920,6 +6996,11 @@ packages:
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
fstream@1.0.12:
resolution: {integrity: sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==}
engines: {node: '>=0.6'}
deprecated: This package is no longer supported.
function-bind@1.1.2:
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
@ -7257,6 +7338,9 @@ packages:
imapflow@1.7.8:
resolution: {integrity: sha512-dJoCIdZOJh26Rn2PdwEzwj0bRDgGBxxX38pio534FagIHVuR2l0SAfLr6sJo32YfuJHiSs/U2ntNDHnMg3/Hlg==}
immediate@3.0.6:
resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==}
import-fresh@3.3.1:
resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==}
engines: {node: '>=6'}
@ -7721,6 +7805,9 @@ packages:
resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==}
engines: {node: '>=4.0'}
jszip@3.10.2:
resolution: {integrity: sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==}
jwa@2.0.1:
resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==}
@ -7784,6 +7871,9 @@ packages:
libqp@2.1.1:
resolution: {integrity: sha512-0Wd+GPz1O134cP62YU2GTOPNA7Qgl09XwCqM5zpBv87ERCXdfDtyKXvV7c9U22yWJh44QZqBocFnXN11K96qow==}
lie@3.3.0:
resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==}
lightningcss-android-arm64@1.32.0:
resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==}
engines: {node: '>= 12.0.0'}
@ -7876,6 +7966,9 @@ packages:
engines: {node: '>=20.17'}
hasBin: true
listenercount@1.0.1:
resolution: {integrity: sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==}
listr2@9.0.4:
resolution: {integrity: sha512-1wd/kpAdKRLwv7/3OKC8zZ5U8e/fajCfWMxacUvB79S5nLrYGPtUI/8chMQhn3LQjsRVErTb9i1ECAwW0ZIHnQ==}
engines: {node: '>=20.0.0'}
@ -7902,6 +7995,21 @@ packages:
lodash.camelcase@4.3.0:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
lodash.defaults@4.2.0:
resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==}
lodash.difference@4.5.0:
resolution: {integrity: sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==}
lodash.escaperegexp@4.1.2:
resolution: {integrity: sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==}
lodash.flatten@4.4.0:
resolution: {integrity: sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==}
lodash.groupby@4.6.0:
resolution: {integrity: sha512-5dcWxm23+VAoz+awKmBaiBvzox8+RqMgFhi7UvX9DHZr2HdxHXM/Wrf8cfKpsW37RNrvtPn6hSwNqurSILbmJw==}
lodash.identity@3.0.0:
resolution: {integrity: sha512-AupTIzdLQxJS5wIYUQlgGyk2XRTfGXA+MCghDHqZk0pzUNYvd3EESS6dkChNauNYVIutcb0dfHw1ri9Q1yPV8Q==}
@ -7911,9 +8019,19 @@ packages:
lodash.isboolean@3.0.3:
resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==}
lodash.isequal@4.5.0:
resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==}
deprecated: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
lodash.isfunction@3.0.9:
resolution: {integrity: sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw==}
lodash.isinteger@4.0.4:
resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==}
lodash.isnil@4.0.0:
resolution: {integrity: sha512-up2Mzq3545mwVnMhTDMdfoG1OurpA/s5t88JmQX809eH3C8491iu2sfKhTfhQtKY78oPNhiaHJUpT/dUDAAtng==}
lodash.isnumber@3.0.3:
resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==}
@ -7923,6 +8041,9 @@ packages:
lodash.isstring@4.0.1:
resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==}
lodash.isundefined@3.0.1:
resolution: {integrity: sha512-MXB1is3s899/cD8jheYYE2V9qTHwKvt+npCwpD+1Sxm3Q3cECXCiYHjeHWXNwr6Q0SOBPrYUDxendrO6goVTEA==}
lodash.merge@4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
@ -7935,6 +8056,12 @@ packages:
lodash.truncate@4.4.2:
resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==}
lodash.union@4.6.0:
resolution: {integrity: sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==}
lodash.uniq@4.5.0:
resolution: {integrity: sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==}
lodash@4.18.1:
resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==}
@ -8347,6 +8474,10 @@ packages:
mkdirp-classic@0.5.3:
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
mkdirp@0.5.6:
resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==}
hasBin: true
mlly@1.8.0:
resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==}
@ -8676,6 +8807,9 @@ packages:
package-manager-detector@1.6.0:
resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==}
pako@1.0.11:
resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==}
papaparse@5.5.4:
resolution: {integrity: sha512-SwzWD9gl/ElwYLCI0nUja1mFJzjq2D8ziShfNBa7zCHzkOozeOGDwHWQ+tvCzEZcewecWZ5U7kUopDnG+DFYEQ==}
@ -9346,6 +9480,11 @@ packages:
rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rimraf@2.7.1:
resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==}
deprecated: Rimraf versions prior to v4 are no longer supported
hasBin: true
rimraf@3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
deprecated: Rimraf versions prior to v4 are no longer supported
@ -9408,6 +9547,10 @@ packages:
resolution: {integrity: sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==}
engines: {node: '>=11.0.0'}
saxes@5.0.1:
resolution: {integrity: sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==}
engines: {node: '>=10'}
saxes@6.0.0:
resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}
engines: {node: '>=v12.22.7'}
@ -9456,6 +9599,9 @@ packages:
resolution: {integrity: sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==}
engines: {node: '>= 0.4'}
setimmediate@1.0.5:
resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==}
setprototypeof@1.2.0:
resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==}
@ -9604,6 +9750,10 @@ packages:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
ssf@0.11.2:
resolution: {integrity: sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==}
engines: {node: '>=0.8'}
ssri@12.0.0:
resolution: {integrity: sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==}
engines: {node: ^18.17.0 || >=20.5.0}
@ -9963,6 +10113,9 @@ packages:
resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==}
engines: {node: '>=18'}
traverse@0.3.9:
resolution: {integrity: sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==}
tree-dump@1.0.3:
resolution: {integrity: sha512-il+Cv80yVHFBwokQSfd4bldvr1Md951DpgAGfmhydt04L+YzHgubm2tQ7zueWDcGENKHq0ZvGFR/hjvNXilHEg==}
engines: {node: '>=10.0'}
@ -10184,6 +10337,9 @@ packages:
resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
engines: {node: '>= 0.8'}
unzipper@0.10.14:
resolution: {integrity: sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==}
update-browserslist-db@1.1.4:
resolution: {integrity: sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==}
hasBin: true
@ -10229,6 +10385,11 @@ packages:
resolution: {integrity: sha512-Qo+uWgilfSmAhXCMav1uYFynlQO7fMFiMVZsQqZRMIXp0O7rR7qjkj+cPvBHLgBqi960QCoo/PH2/6ZtVqKvrg==}
hasBin: true
uuid@8.3.2:
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
hasBin: true
uuid@9.0.1:
resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==}
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
@ -10642,6 +10803,10 @@ packages:
yoga-layout@3.2.1:
resolution: {integrity: sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==}
zip-stream@4.1.1:
resolution: {integrity: sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==}
engines: {node: '>= 10'}
zip-stream@6.0.1:
resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==}
engines: {node: '>= 14'}
@ -11459,6 +11624,25 @@ snapshots:
'@eslint/core': 0.15.2
levn: 0.4.1
'@fast-csv/format@4.3.5':
dependencies:
'@types/node': 14.18.63
lodash.escaperegexp: 4.1.2
lodash.isboolean: 3.0.3
lodash.isequal: 4.5.0
lodash.isfunction: 3.0.9
lodash.isnil: 4.0.0
'@fast-csv/parse@4.3.6':
dependencies:
'@types/node': 14.18.63
lodash.escaperegexp: 4.1.2
lodash.groupby: 4.6.0
lodash.isfunction: 3.0.9
lodash.isnil: 4.0.0
lodash.isundefined: 3.0.1
lodash.uniq: 4.5.0
'@floating-ui/core@1.8.0':
dependencies:
'@floating-ui/utils': 0.2.12
@ -13956,6 +14140,8 @@ snapshots:
'@types/node': 22.20.1
form-data: 4.0.6
'@types/node@14.18.63': {}
'@types/node@18.19.130':
dependencies:
undici-types: 5.26.5
@ -14699,6 +14885,32 @@ snapshots:
anynum@1.0.1: {}
archiver-utils@2.1.0:
dependencies:
glob: 7.2.3
graceful-fs: 4.2.11
lazystream: 1.0.1
lodash.defaults: 4.2.0
lodash.difference: 4.5.0
lodash.flatten: 4.4.0
lodash.isplainobject: 4.0.6
lodash.union: 4.6.0
normalize-path: 3.0.0
readable-stream: 2.3.8
archiver-utils@3.0.4:
dependencies:
glob: 7.2.3
graceful-fs: 4.2.11
lazystream: 1.0.1
lodash.defaults: 4.2.0
lodash.difference: 4.5.0
lodash.flatten: 4.4.0
lodash.isplainobject: 4.0.6
lodash.union: 4.6.0
normalize-path: 3.0.0
readable-stream: 3.6.2
archiver-utils@5.0.2:
dependencies:
glob: 10.5.0
@ -14709,6 +14921,16 @@ snapshots:
normalize-path: 3.0.0
readable-stream: 4.7.0
archiver@5.3.2:
dependencies:
archiver-utils: 2.1.0
async: 3.2.6
buffer-crc32: 0.2.13
readable-stream: 3.6.2
readdir-glob: 1.1.3
tar-stream: 2.2.0
zip-stream: 4.1.1
archiver@7.0.1:
dependencies:
archiver-utils: 5.0.2
@ -14883,10 +15105,17 @@ snapshots:
before-after-hook@3.0.2: {}
big-integer@1.6.52: {}
bignumber.js@9.3.1: {}
binary-extensions@2.3.0: {}
binary@0.3.0:
dependencies:
buffers: 0.1.1
chainsaw: 0.1.0
binaryextensions@6.11.0:
dependencies:
editions: 6.22.0
@ -14897,6 +15126,8 @@ snapshots:
inherits: 2.0.4
readable-stream: 3.6.2
bluebird@3.4.7: {}
body-parser@2.3.0(supports-color@7.2.0):
dependencies:
bytes: 3.1.2
@ -14915,12 +15146,12 @@ snapshots:
boundary@2.0.0: {}
brace-expansion@1.1.12:
brace-expansion@1.1.21:
dependencies:
balanced-match: 1.0.2
concat-map: 0.0.1
brace-expansion@2.1.4:
brace-expansion@2.1.7:
dependencies:
balanced-match: 1.0.2
@ -14946,6 +15177,8 @@ snapshots:
buffer-equal-constant-time@1.0.1: {}
buffer-indexof-polyfill@1.0.2: {}
buffer@5.7.1:
dependencies:
base64-js: 1.5.1
@ -14956,6 +15189,8 @@ snapshots:
base64-js: 1.5.1
ieee754: 1.2.1
buffers@0.1.1: {}
bun-ffi-structs@0.3.1(typescript@5.8.3):
dependencies:
typescript: 5.8.3
@ -15040,6 +15275,10 @@ snapshots:
loupe: 3.1.4
pathval: 2.0.1
chainsaw@0.1.0:
dependencies:
traverse: 0.3.9
chalk@2.4.2:
dependencies:
ansi-styles: 3.2.1
@ -15212,6 +15451,13 @@ snapshots:
component-emitter@1.3.1: {}
compress-commons@4.1.2:
dependencies:
buffer-crc32: 0.2.13
crc32-stream: 4.0.3
normalize-path: 3.0.0
readable-stream: 3.6.2
compress-commons@6.0.2:
dependencies:
crc-32: 1.2.2
@ -15279,6 +15525,11 @@ snapshots:
crc-32@1.2.2: {}
crc32-stream@4.0.3:
dependencies:
crc-32: 1.2.2
readable-stream: 3.6.2
crc32-stream@6.0.0:
dependencies:
crc-32: 1.2.2
@ -15699,6 +15950,10 @@ snapshots:
es-errors: 1.3.0
gopd: 1.2.0
duplexer2@0.1.4:
dependencies:
readable-stream: 2.3.8
eastasianwidth@0.2.0: {}
ecdsa-sig-formatter@1.0.11:
@ -16265,6 +16520,18 @@ snapshots:
dependencies:
eventsource-parser: 3.0.3
exceljs@4.4.0:
dependencies:
archiver: 5.3.2
dayjs: 1.11.21
fast-csv: 4.3.6
jszip: 3.10.2
readable-stream: 3.6.2
saxes: 5.0.1
tmp: 0.2.7
unzipper: 0.10.14
uuid: 8.3.2
execa@5.1.1:
dependencies:
cross-spawn: 7.0.6
@ -16385,6 +16652,11 @@ snapshots:
fast-content-type-parse@2.0.1: {}
fast-csv@4.3.6:
dependencies:
'@fast-csv/format': 4.3.5
'@fast-csv/parse': 4.3.6
fast-deep-equal@3.1.3: {}
fast-fifo@1.3.2: {}
@ -16538,6 +16810,8 @@ snapshots:
forwarded@0.2.0: {}
frac@1.1.2: {}
fraction.js@5.3.4: {}
fresh@2.0.0: {}
@ -16568,6 +16842,13 @@ snapshots:
fsevents@2.3.3:
optional: true
fstream@1.0.12:
dependencies:
graceful-fs: 4.2.11
inherits: 2.0.4
mkdirp: 0.5.6
rimraf: 2.7.1
function-bind@1.1.2: {}
function.prototype.name@1.1.8:
@ -16991,6 +17272,8 @@ snapshots:
pino: 10.3.1
socks: 2.8.9
immediate@3.0.6: {}
import-fresh@3.3.1:
dependencies:
parent-module: 1.0.1
@ -17444,6 +17727,13 @@ snapshots:
object.assign: 4.1.7
object.values: 1.2.1
jszip@3.10.2:
dependencies:
lie: 3.3.0
pako: 1.0.11
readable-stream: 2.3.8
setimmediate: 1.0.5
jwa@2.0.1:
dependencies:
buffer-equal-constant-time: 1.0.1
@ -17514,6 +17804,10 @@ snapshots:
libqp@2.1.1: {}
lie@3.3.0:
dependencies:
immediate: 3.0.6
lightningcss-android-arm64@1.32.0:
optional: true
@ -17590,6 +17884,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
listenercount@1.0.1: {}
listr2@9.0.4:
dependencies:
cli-truncate: 5.2.0
@ -17624,20 +17920,38 @@ snapshots:
lodash.camelcase@4.3.0: {}
lodash.defaults@4.2.0: {}
lodash.difference@4.5.0: {}
lodash.escaperegexp@4.1.2: {}
lodash.flatten@4.4.0: {}
lodash.groupby@4.6.0: {}
lodash.identity@3.0.0: {}
lodash.includes@4.3.0: {}
lodash.isboolean@3.0.3: {}
lodash.isequal@4.5.0: {}
lodash.isfunction@3.0.9: {}
lodash.isinteger@4.0.4: {}
lodash.isnil@4.0.0: {}
lodash.isnumber@3.0.3: {}
lodash.isplainobject@4.0.6: {}
lodash.isstring@4.0.1: {}
lodash.isundefined@3.0.1: {}
lodash.merge@4.6.2: {}
lodash.once@4.1.1: {}
@ -17646,6 +17960,10 @@ snapshots:
lodash.truncate@4.4.2: {}
lodash.union@4.6.0: {}
lodash.uniq@4.5.0: {}
lodash@4.18.1: {}
log-symbols@6.0.0:
@ -18255,15 +18573,15 @@ snapshots:
minimatch@3.1.5:
dependencies:
brace-expansion: 1.1.12
brace-expansion: 1.1.21
minimatch@5.1.9:
dependencies:
brace-expansion: 2.1.4
brace-expansion: 2.1.7
minimatch@9.0.9:
dependencies:
brace-expansion: 2.1.4
brace-expansion: 2.1.7
minimist@1.2.8: {}
@ -18305,6 +18623,10 @@ snapshots:
mkdirp-classic@0.5.3: {}
mkdirp@0.5.6:
dependencies:
minimist: 1.2.8
mlly@1.8.0:
dependencies:
acorn: 8.15.0
@ -18711,6 +19033,8 @@ snapshots:
package-manager-detector@1.6.0: {}
pako@1.0.11: {}
papaparse@5.5.4: {}
parent-module@1.0.1:
@ -19500,6 +19824,10 @@ snapshots:
rfdc@1.4.1: {}
rimraf@2.7.1:
dependencies:
glob: 7.2.3
rimraf@3.0.2:
dependencies:
glob: 7.2.3
@ -19594,6 +19922,10 @@ snapshots:
sax@1.6.0: {}
saxes@5.0.1:
dependencies:
xmlchars: 2.2.0
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
@ -19669,6 +20001,8 @@ snapshots:
es-errors: 1.3.0
es-object-atoms: 1.1.1
setimmediate@1.0.5: {}
setprototypeof@1.2.0: {}
shadcn@4.13.0(supports-color@7.2.0)(typescript@5.8.3):
@ -19926,6 +20260,10 @@ snapshots:
split2@4.2.0: {}
ssf@0.11.2:
dependencies:
frac: 1.1.2
ssri@12.0.0:
dependencies:
minipass: 7.1.3
@ -20351,6 +20689,8 @@ snapshots:
dependencies:
punycode: 2.3.1
traverse@0.3.9: {}
tree-dump@1.0.3(tslib@2.8.1):
dependencies:
tslib: 2.8.1
@ -20582,6 +20922,19 @@ snapshots:
unpipe@1.0.0: {}
unzipper@0.10.14:
dependencies:
big-integer: 1.6.52
binary: 0.3.0
bluebird: 3.4.7
buffer-indexof-polyfill: 1.0.2
duplexer2: 0.1.4
fstream: 1.0.12
graceful-fs: 4.2.11
listenercount: 1.0.1
readable-stream: 2.3.8
setimmediate: 1.0.5
update-browserslist-db@1.1.4(browserslist@4.28.0):
dependencies:
browserslist: 4.28.0
@ -20620,6 +20973,8 @@ snapshots:
uuid@14.0.0: {}
uuid@8.3.2: {}
uuid@9.0.1: {}
v8-to-istanbul@9.3.0:
@ -21111,6 +21466,12 @@ snapshots:
yoga-layout@3.2.1: {}
zip-stream@4.1.1:
dependencies:
archiver-utils: 3.0.4
compress-commons: 4.1.2
readable-stream: 3.6.2
zip-stream@6.0.1:
dependencies:
archiver-utils: 5.0.2

View file

@ -46,6 +46,8 @@ fetchRetryMaxtimeout: 120000
fetchTimeout: 300000
overrides:
'brace-expansion@1': '1.1.21'
'brace-expansion@2': '2.1.7'
typescript: '5.8.3'
'@microsoft/api-extractor>typescript': '5.9.3'
'@qwen-code/mobile-mcp>typescript': '5.8.2'