Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: artifact image thumbnails with inline preview and lightbox

Gus37888a6b1d97
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index aa60db94a..b99f2d121 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -81,6 +81,9 @@ importers:
postal-mime:
specifier: ^2.7.4
version: 2.7.4
+ sharp:
+ specifier: ^0.33.0
+ version: 0.33.5
devDependencies:
'@alook/shared':
specifier: workspace:*
@@ -1689,34 +1692,68 @@ packages:
resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [darwin]
+
resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [arm64]
os: [darwin]
+ resolution: {integrity: sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [darwin]
+
resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [x64]
os: [darwin]
+ resolution: {integrity: sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==}
+ cpu: [arm64]
+ os: [darwin]
+
resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==}
cpu: [arm64]
os: [darwin]
+ resolution: {integrity: sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==}
+ cpu: [x64]
+ os: [darwin]
+
resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==}
cpu: [x64]
os: [darwin]
+ resolution: {integrity: sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==}
cpu: [arm64]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==}
cpu: [arm]
@@ -1735,30 +1772,61 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==}
cpu: [s390x]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==}
cpu: [x64]
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==}
cpu: [arm64]
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==}
cpu: [x64]
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1766,6 +1834,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1787,6 +1862,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1794,6 +1876,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1801,6 +1890,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1808,6 +1904,13 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1815,6 +1918,11 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [wasm32]
+
resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -1826,12 +1934,24 @@ packages:
cpu: [arm64]
os: [win32]
+ resolution: {integrity: sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [ia32]
+ os: [win32]
+
resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
cpu: [ia32]
os: [win32]
+ resolution: {integrity: sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+ cpu: [x64]
+ os: [win32]
+
resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -4075,6 +4195,13 @@ packages:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
+ resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
+
+ resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}
+ engines: {node: '>=12.5.0'}
+
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
@@ -5509,6 +5636,9 @@ packages:
resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==}
+ resolution: {integrity: sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==}
+
resolution: {integrity: sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==}
engines: {node: '>= 0.4'}
@@ -7185,6 +7315,10 @@ packages:
resolution: {integrity: sha512-84IJhUsK0xqSCRJx3QxyZe2NpUXj2Nwk8Vc8Ow/tCOND3yz4CT6uU4655vqicNXhzG9Q1cyUt+TBl2SiCJwNgg==}
hasBin: true
+ resolution: {integrity: sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==}
+ engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
+
resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -7237,6 +7371,9 @@ packages:
resolution: {integrity: sha512-WszCLXwT4h2k1ufIXAgsbiTOazqqevFCIncOuUBZJ91DdvWcC5+OFkluWRQPrcuSYd8fjq+o2y1QfWqYMoAToQ==}
hasBin: true
+ resolution: {integrity: sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==}
+
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
@@ -9545,25 +9682,47 @@ snapshots:
'@img/[email protected]': {}
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-arm64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-x64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-darwin-x64': 1.2.4
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
@@ -9573,23 +9732,45 @@ snapshots:
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm': 1.0.5
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.2.4
@@ -9605,26 +9786,51 @@ snapshots:
'@img/sharp-libvips-linux-riscv64': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-s390x': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linux-x64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-arm64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.2.4
optional: true
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-x64': 1.0.4
+ optional: true
+
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.2.4
optional: true
+ dependencies:
+ '@emnapi/runtime': 1.10.0
+ optional: true
+
dependencies:
'@emnapi/runtime': 1.10.0
@@ -9633,9 +9839,15 @@ snapshots:
optional: true
+ optional: true
+
optional: true
+ optional: true
+
optional: true
@@ -11902,6 +12114,16 @@ snapshots:
+ dependencies:
+ color-name: 1.1.4
+ simple-swizzle: 0.2.4
+
+ dependencies:
+ color-convert: 2.0.1
+ color-string: 1.9.1
+
dependencies:
delayed-stream: 1.0.0
@@ -12612,8 +12834,8 @@ snapshots:
'@next/eslint-plugin-next': 16.2.7
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
- eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
- eslint-plugin-import: 2.32.0([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
eslint-plugin-react: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks: 7.1.1([email protected]([email protected]))
@@ -12635,7 +12857,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.3
@@ -12646,21 +12868,21 @@ snapshots:
tinyglobby: 0.2.17
unrs-resolver: 1.12.2
optionalDependencies:
- eslint-plugin-import: 2.32.0([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
- eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -12671,7 +12893,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
hasown: 2.0.4
is-core-module: 2.16.2
is-glob: 4.0.3
@@ -13684,6 +13906,8 @@ snapshots:
+
dependencies:
async-function: 1.0.0
@@ -15924,6 +16148,32 @@ snapshots:
- supports-color
- typescript
+ dependencies:
+ color: 4.2.3
+ detect-libc: 2.1.2
+ semver: 7.8.2
+ optionalDependencies:
+ '@img/sharp-darwin-arm64': 0.33.5
+ '@img/sharp-darwin-x64': 0.33.5
+ '@img/sharp-libvips-darwin-arm64': 1.0.4
+ '@img/sharp-libvips-darwin-x64': 1.0.4
+ '@img/sharp-libvips-linux-arm': 1.0.5
+ '@img/sharp-libvips-linux-arm64': 1.0.4
+ '@img/sharp-libvips-linux-s390x': 1.0.4
+ '@img/sharp-libvips-linux-x64': 1.0.4
+ '@img/sharp-libvips-linuxmusl-arm64': 1.0.4
+ '@img/sharp-libvips-linuxmusl-x64': 1.0.4
+ '@img/sharp-linux-arm': 0.33.5
+ '@img/sharp-linux-arm64': 0.33.5
+ '@img/sharp-linux-s390x': 0.33.5
+ '@img/sharp-linux-x64': 0.33.5
+ '@img/sharp-linuxmusl-arm64': 0.33.5
+ '@img/sharp-linuxmusl-x64': 0.33.5
+ '@img/sharp-wasm32': 0.33.5
+ '@img/sharp-win32-ia32': 0.33.5
+ '@img/sharp-win32-x64': 0.33.5
+
dependencies:
'@img/colour': 1.1.0
@@ -16016,6 +16266,10 @@ snapshots:
+ dependencies:
+ is-arrayish: 0.3.4
+
diff --git a/src/cli/commands/sync.ts b/src/cli/commands/sync.ts
index b1c86fc9a..33570086f 100644
--- a/src/cli/commands/sync.ts
+++ b/src/cli/commands/sync.ts
@@ -32,12 +32,34 @@ export function syncCommand(): Command {
const filename = basename(opts.file);
const contentType = guessContentType(filename);
+ let thumbnailBytes: Buffer | null = null;
+ const isRasterImage = contentType.startsWith("image/") && contentType !== "image/svg+xml";
+ if (isRasterImage) {
+ try {
+ const sharpMod = await import("sharp");
+ const sharp = sharpMod.default;
+ thumbnailBytes = await sharp(bytes)
+ .resize(200, 200, { fit: "inside" })
+ .jpeg({ quality: 70 })
+ .toBuffer();
+ } catch (err) {
+ console.error(`Warning: thumbnail generation skipped: ${(err as Error).message}`);
+ }
+ }
+
const form = new FormData();
form.append(
"file",
new Blob([new Uint8Array(bytes)], { type: contentType }),
filename
);
+ if (thumbnailBytes) {
+ form.append(
+ "thumbnail",
+ new Blob([new Uint8Array(thumbnailBytes)], { type: "image/jpeg" }),
+ `thumb_${filename}.jpg`
+ );
+ }
form.append("agent_id", agentId);
form.append("conversation_id", opts.conversation_id);
diff --git a/src/cli/package.json b/src/cli/package.json
index a6b848a96..1d141bbe2 100644
--- a/src/cli/package.json
+++ b/src/cli/package.json
@@ -38,7 +38,7 @@
},
"scripts": {
"dev": "bun run src/index.ts",
- "build": "bun build src/index.ts --outdir dist --target node --format esm --external citty --external commander --external postal-mime --external playwright-core && bun build daemon/session-runner.ts --outdir dist --target node --format esm --external citty --external commander --external postal-mime && bun build daemon/meeting-runner.ts --outdir dist --target node --format esm --external playwright-core && node scripts/prepare-dist.mjs",
+ "build": "bun build src/index.ts --outdir dist --target node --format esm --external citty --external commander --external postal-mime --external playwright-core --external sharp && bun build daemon/session-runner.ts --outdir dist --target node --format esm --external citty --external commander --external postal-mime && bun build daemon/meeting-runner.ts --outdir dist --target node --format esm --external playwright-core && node scripts/prepare-dist.mjs",
"prepack": "pnpm run build",
"knip": "knip",
"test": "vitest run",
@@ -50,7 +50,8 @@
"citty": "^0.2.2",
"commander": "^14.0.3",
"playwright-core": "^1.60.0",
- "postal-mime": "^2.7.4"
+ "postal-mime": "^2.7.4",
+ "sharp": "^0.33.0"
},
"devDependencies": {
"@alook/shared": "workspace:*",
diff --git a/src/shared/src/db/queries/artifact.ts b/src/shared/src/db/queries/artifact.ts
index 191d21da1..86365240a 100644
--- a/src/shared/src/db/queries/artifact.ts
+++ b/src/shared/src/db/queries/artifact.ts
@@ -14,6 +14,7 @@ export async function createArtifact(
contentType: string;
size: number;
r2Key: string;
+ thumbnailR2Key?: string;
source?: string;
}
) {
@@ -62,6 +63,7 @@ export function artifactToResponse(row: typeof artifact.$inferSelect): Artifact
content_type: row.contentType,
size: row.size,
source: row.source,
+ has_thumbnail: row.thumbnailR2Key != null,
created_at: row.createdAt,
};
}
diff --git a/src/shared/src/db/schema.ts b/src/shared/src/db/schema.ts
index 32f0eaa1e..3fcb2b8e6 100644
--- a/src/shared/src/db/schema.ts
+++ b/src/shared/src/db/schema.ts
@@ -559,6 +559,7 @@ export const artifact = sqliteTable(
contentType: text("content_type").notNull().default("application/octet-stream"),
size: integer("size").notNull(),
r2Key: text("r2_key").notNull(),
+ thumbnailR2Key: text("thumbnail_r2_key"),
source: text("source").notNull().default("agent"),
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
},
diff --git a/src/shared/src/types.ts b/src/shared/src/types.ts
index 42efca3f9..dd30501d2 100644
--- a/src/shared/src/types.ts
+++ b/src/shared/src/types.ts
@@ -230,6 +230,7 @@ export interface Artifact {
content_type: string;
size: number;
source: string;
+ has_thumbnail: boolean;
created_at: string;
}
diff --git a/src/shared/test/queries/artifact.test.ts b/src/shared/test/queries/artifact.test.ts
index 09b199d92..9bd34f8e7 100644
--- a/src/shared/test/queries/artifact.test.ts
+++ b/src/shared/test/queries/artifact.test.ts
@@ -43,6 +43,7 @@ describe("artifactToResponse", () => {
contentType: "application/pdf",
size: 2048,
r2Key: "uploads/report.pdf",
+ thumbnailR2Key: null,
source: "upload",
createdAt: "2026-01-15T10:00:00.000Z",
};
@@ -57,10 +58,30 @@ describe("artifactToResponse", () => {
content_type: "application/pdf",
size: 2048,
source: "upload",
+ has_thumbnail: false,
created_at: "2026-01-15T10:00:00.000Z",
});
});
+ it("returns has_thumbnail true when thumbnailR2Key is set", () => {
+ const row = {
+ id: "art_123",
+ conversationId: "conv_456",
+ agentId: "ag_789",
+ workspaceId: "ws_001",
+ filename: "photo.png",
+ contentType: "image/png",
+ size: 50000,
+ r2Key: "uploads/photo.png",
+ thumbnailR2Key: "uploads/photo_thumb.jpg",
+ source: "agent",
+ createdAt: "2026-01-15T10:00:00.000Z",
+ };
+
+ const result = artifactQueries.artifactToResponse(row as any);
+ expect(result.has_thumbnail).toBe(true);
+ });
+
it("excludes internal fields like r2Key and workspaceId", () => {
const row = {
id: "art_1",
@@ -71,6 +92,7 @@ describe("artifactToResponse", () => {
contentType: "text/plain",
size: 100,
r2Key: "secret/key",
+ thumbnailR2Key: null,
source: null,
createdAt: "2026-01-01T00:00:00.000Z",
};
@@ -80,6 +102,7 @@ describe("artifactToResponse", () => {
expect(result).not.toHaveProperty("r2Key");
expect(result).not.toHaveProperty("workspace_id");
expect(result).not.toHaveProperty("workspaceId");
+ expect(result).not.toHaveProperty("thumbnailR2Key");
});
it("handles null source", () => {
@@ -92,6 +115,7 @@ describe("artifactToResponse", () => {
contentType: "text/plain",
size: 0,
r2Key: "key",
+ thumbnailR2Key: null,
source: null,
createdAt: "2026-01-01T00:00:00.000Z",
};
diff --git a/src/web/migrations/0042_artifact_thumbnail.sql b/src/web/migrations/0042_artifact_thumbnail.sql
new file mode 100644
index 000000000..40b7f97cb
--- /dev/null
+++ b/src/web/migrations/0042_artifact_thumbnail.sql
@@ -0,0 +1 @@
+ALTER TABLE artifact ADD COLUMN thumbnail_r2_key TEXT;
diff --git a/src/web/src/app/api/agents/[id]/chat-init/route.test.ts b/src/web/src/app/api/agents/[id]/chat-init/route.test.ts
index 77cbc5bcf..805d0e3e3 100644
--- a/src/web/src/app/api/agents/[id]/chat-init/route.test.ts
+++ b/src/web/src/app/api/agents/[id]/chat-init/route.test.ts
@@ -19,6 +19,7 @@ const mockArtifactToResponse = vi.fn((r: any) => ({
content_type: r.contentType,
size: r.size,
source: r.source,
+ has_thumbnail: r.thumbnailR2Key != null,
created_at: r.createdAt,
}));
diff --git a/src/web/src/app/api/artifacts/[id]/thumbnail/route.test.ts b/src/web/src/app/api/artifacts/[id]/thumbnail/route.test.ts
new file mode 100644
index 000000000..6765f51af
--- /dev/null
+++ b/src/web/src/app/api/artifacts/[id]/thumbnail/route.test.ts
@@ -0,0 +1,109 @@
+import { describe, expect, it, vi, beforeEach } from "vitest";
+import { NextRequest } from "next/server";
+
+const mockGetArtifact = vi.fn();
+const mockGetAgent = vi.fn();
+const mockBucketGet = vi.fn();
+
+vi.mock("@opennextjs/cloudflare", () => ({
+ getCloudflareContext: vi.fn(() => ({
+ env: {
+ DB: {},
+ EMAIL_BUCKET: { get: (...a: unknown[]) => mockBucketGet(...a) },
+ },
+ })),
+}));
+
+vi.mock("@/lib/db", () => ({ getDb: vi.fn(() => ({})) }));
+
+vi.mock("@alook/shared", async () => {
+ const actual = await vi.importActual<typeof import("@alook/shared")>("@alook/shared");
+ return {
+ ...actual,
+ queries: {
+ artifact: { getArtifact: (...a: unknown[]) => mockGetArtifact(...a) },
+ agent: { getAgent: (...a: unknown[]) => mockGetAgent(...a) },
+ },
+ };
+});
+
+vi.mock("@/lib/middleware/auth", () => ({
+ withAuth: (handler: any) => async (req: any, ctx?: any) => {
+ const params = ctx?.params instanceof Promise ? await ctx.params : ctx?.params;
+ return handler(req, { userId: "u1", email: "[email protected]", params });
+ },
+}));
+
+vi.mock("@/lib/middleware/workspace", () => ({
+ withWorkspaceMember: vi.fn(async () => ({ workspaceId: "w1" })),
+}));
+
+import { GET } from "./route";
+
+beforeEach(() => vi.clearAllMocks());
+
+describe("GET /api/artifacts/[id]/thumbnail", () => {
+ it("serves thumbnail JPEG with aggressive cache headers", async () => {
+ mockGetArtifact.mockResolvedValue({
+ id: "art_1",
+ agentId: "ag1",
+ thumbnailR2Key: "artifacts/w1/ag1/c1/art_1/thumbnail.jpg",
+ });
+ mockGetAgent.mockResolvedValue({ id: "ag1" });
+ mockBucketGet.mockResolvedValue({ body: new Blob([new Uint8Array(100)]).stream() });
+
+ const res = await GET(
+ new NextRequest("http://localhost/api/artifacts/art_1/thumbnail?workspace_id=w1"),
+ { params: { id: "art_1" } } as any,
+ );
+
+ expect(res.status).toBe(200);
+ expect(res.headers.get("Content-Type")).toBe("image/jpeg");
+ expect(res.headers.get("Cache-Control")).toBe("public, max-age=31536000, immutable");
+ expect(mockBucketGet).toHaveBeenCalledWith("artifacts/w1/ag1/c1/art_1/thumbnail.jpg");
+ });
+
+ it("returns 404 when artifact has no thumbnail", async () => {
+ mockGetArtifact.mockResolvedValue({
+ id: "art_1",
+ agentId: "ag1",
+ thumbnailR2Key: null,
+ });
+ mockGetAgent.mockResolvedValue({ id: "ag1" });
+
+ const res = await GET(
+ new NextRequest("http://localhost/api/artifacts/art_1/thumbnail?workspace_id=w1"),
+ { params: { id: "art_1" } } as any,
+ );
+
+ expect(res.status).toBe(404);
+ expect(mockBucketGet).not.toHaveBeenCalled();
+ });
+
+ it("returns 404 when artifact not found", async () => {
+ mockGetArtifact.mockResolvedValue(null);
+
+ const res = await GET(
+ new NextRequest("http://localhost/api/artifacts/art_missing/thumbnail?workspace_id=w1"),
+ { params: { id: "art_missing" } } as any,
+ );
+
+ expect(res.status).toBe(404);
+ });
+
+ it("returns 404 when agent not accessible to user", async () => {
+ mockGetArtifact.mockResolvedValue({
+ id: "art_1",
+ agentId: "ag1",
+ thumbnailR2Key: "artifacts/w1/ag1/c1/art_1/thumbnail.jpg",
+ });
+ mockGetAgent.mockResolvedValue(null);
+
+ const res = await GET(
+ new NextRequest("http://localhost/api/artifacts/art_1/thumbnail?workspace_id=w1"),
+ { params: { id: "art_1" } } as any,
+ );
+
+ expect(res.status).toBe(404);
+ });
+});
diff --git a/src/web/src/app/api/artifacts/[id]/thumbnail/route.ts b/src/web/src/app/api/artifacts/[id]/thumbnail/route.ts
new file mode 100644
index 000000000..e40dfb2ac
--- /dev/null
+++ b/src/web/src/app/api/artifacts/[id]/thumbnail/route.ts
@@ -0,0 +1,43 @@
+import { NextRequest } from "next/server";
+import { getCloudflareContext } from "@opennextjs/cloudflare";
+import { queries } from "@alook/shared";
+import { getDb } from "@/lib/db"
+import { withAuth } from "@/lib/middleware/auth";
+import { withWorkspaceMember } from "@/lib/middleware/workspace";
+import { writeError } from "@/lib/middleware/helpers";
+
+export const GET = withAuth(async (req: NextRequest, ctx) => {
+ const ws = await withWorkspaceMember(req, ctx);
+ if (ws instanceof Response) return ws;
+
+ const id = ctx.params?.id as string;
+ const { env } = getCloudflareContext();
+ const db = getDb((env as Env).DB);
+ const bucket = (env as Env).EMAIL_BUCKET;
+
+ const row = await queries.artifact.getArtifact(db, id, ws.workspaceId);
+ if (!row) {
+ return writeError("not found", 404);
+ }
+
+ const agent = await queries.agent.getAgent(db, row.agentId, ws.workspaceId, ctx.userId);
+ if (!agent) {
+ return writeError("not found", 404);
+ }
+
+ if (!row.thumbnailR2Key) {
+ return writeError("no thumbnail", 404);
+ }
+
+ const object = await bucket.get(row.thumbnailR2Key);
+ if (!object) {
+ return writeError("thumbnail content not found", 404);
+ }
+
+ return new Response(object.body, {
+ headers: {
+ "Content-Type": "image/jpeg",
+ "Cache-Control": "public, max-age=31536000, immutable",
+ },
+ });
+});
diff --git a/src/web/src/app/api/artifacts/upload/route.test.ts b/src/web/src/app/api/artifacts/upload/route.test.ts
index d946d928a..357de80ec 100644
--- a/src/web/src/app/api/artifacts/upload/route.test.ts
+++ b/src/web/src/app/api/artifacts/upload/route.test.ts
@@ -96,4 +96,36 @@ describe("POST /api/artifacts/upload", () => {
const res = await POST(req, {});
expect(res.status).toBe(400);
});
+
+ it("uploads thumbnail to R2 when provided", async () => {
+ mockGetConversation.mockResolvedValue({ id: "c1", agentId: "a1", userId: "u1" });
+ mockCreateArtifact.mockResolvedValue({ id: "art_xyz" });
+ mockGetAgent.mockResolvedValue({ ownerId: "owner1" });
+
+ const file = new File(["img-data"], "photo.png", { type: "image/png" });
+ const thumb = new File(["thumb-data"], "thumb_photo.png.jpg", { type: "image/jpeg" });
+ const fd = new FormData();
+ fd.append("file", file);
+ fd.append("thumbnail", thumb);
+ fd.append("conversation_id", "c1");
+
+ const res = await POST(new NextRequest("http://localhost/api/artifacts/upload", { method: "POST", body: fd }), {});
+ expect(res.status).toBe(200);
+ expect(mockPut).toHaveBeenCalledTimes(2);
+ const thumbCall = mockPut.mock.calls[1];
+ expect(thumbCall[0]).toContain("thumbnail.jpg");
+ expect(mockCreateArtifact.mock.calls[0]![1]).toHaveProperty("thumbnailR2Key");
+ });
+
+ it("skips thumbnail when not provided (backward compat)", async () => {
+ mockGetConversation.mockResolvedValue({ id: "c1", agentId: "a1", userId: "u1" });
+ mockCreateArtifact.mockResolvedValue({ id: "art_xyz" });
+ mockGetAgent.mockResolvedValue({ ownerId: "owner1" });
+
+ const file = new File(["hello"], "doc.txt", { type: "text/plain" });
+ const res = await POST(formReq({ file, conversation_id: "c1" }), {});
+ expect(res.status).toBe(200);
+ expect(mockPut).toHaveBeenCalledTimes(1);
+ expect(mockCreateArtifact.mock.calls[0]![1].thumbnailR2Key).toBeUndefined();
+ });
});
diff --git a/src/web/src/app/api/artifacts/upload/route.ts b/src/web/src/app/api/artifacts/upload/route.ts
index 55a3b5a0b..8d92b185c 100644
--- a/src/web/src/app/api/artifacts/upload/route.ts
+++ b/src/web/src/app/api/artifacts/upload/route.ts
@@ -58,6 +58,15 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
httpMetadata: { contentType },
});
+ let thumbnailR2Key: string | undefined;
+ const thumbnail = formData.get("thumbnail");
+ if (thumbnail instanceof File && thumbnail.size <= 50 * 1024) {
+ thumbnailR2Key = `artifacts/${ws.workspaceId}/${agentId}/${conversationId}/${artifactId}/thumbnail.jpg`;
+ await bucket.put(thumbnailR2Key, await thumbnail.arrayBuffer(), {
+ httpMetadata: { contentType: "image/jpeg" },
+ });
+ }
+
const row = await queries.artifact.createArtifact(db, {
id: artifactId,
conversationId,
@@ -67,6 +76,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
contentType,
size: file.size,
r2Key,
+ thumbnailR2Key,
});
const response = queries.artifact.artifactToResponse(row);
diff --git a/src/web/src/components/agent-chat/agent-chat-view.test.ts b/src/web/src/components/agent-chat/agent-chat-view.test.ts
index 9483cd4b4..77d75aaf3 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.test.ts
+++ b/src/web/src/components/agent-chat/agent-chat-view.test.ts
@@ -241,6 +241,7 @@ function artifact(id: string, created_at: string): Artifact {
content_type: "text/plain",
size: 100,
source: "agent",
+ has_thumbnail: false,
created_at,
};
}
@@ -344,7 +345,7 @@ function msgInConv(id: string, created_at: string, conversation_id: string): Mes
}
function artifactInConv(id: string, created_at: string, conversation_id: string): Artifact {
- return { id, conversation_id, agent_id: "agent1", filename: "file.txt", content_type: "text/plain", size: 100, source: "agent", created_at };
+ return { id, conversation_id, agent_id: "agent1", filename: "file.txt", content_type: "text/plain", size: 100, source: "agent", has_thumbnail: false, created_at };
}
describe("buildTimeline — conversation grouping", () => {
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsx
index b901fc496..eb83b38f5 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -68,6 +68,7 @@ import {
formatSize,
} from "@/components/agent-chat/artifact-sheet";
import { EmailEventSheet } from "@/components/agent-chat/email-event-sheet";
+import { ImageLightbox } from "@/components/agent-chat/image-lightbox";
import { CalendarEventSheet } from "@/components/calendar/calendar-event-sheet";
import { IssueSheet } from "@/components/issues/issue-sheet";
import {
@@ -177,6 +178,7 @@ export function AgentChatView({
issueConvId,
issueTaskId,
} = useChatSheets(workspaceId);
+ const [lightboxArtifact, setLightboxArtifact] = useState<Artifact | null>(null);
const {
pendingFiles,
setPendingFiles,
@@ -356,7 +358,9 @@ export function AgentChatView({
const handleArtifactClick = useCallback(
(artifact: Artifact) => {
- if (isPreviewable(artifact)) {
+ if (artifact.content_type.startsWith("image/")) {
+ setLightboxArtifact(artifact);
+ } else if (isPreviewable(artifact)) {
setSelectedArtifact(artifact);
setArtifactSheetOpen(true);
} else {
@@ -369,7 +373,9 @@ export function AgentChatView({
const handleIssueArtifactClick = useCallback(
(artifact: Artifact) => {
- if (isPreviewable(artifact)) {
+ if (artifact.content_type.startsWith("image/")) {
+ setLightboxArtifact(artifact);
+ } else if (isPreviewable(artifact)) {
setSelectedArtifact(artifact);
setArtifactSheetOpen(true);
} else {
@@ -813,6 +819,7 @@ export function AgentChatView({
version={versionMap.get(item.data.id) ?? 1}
hasDuplicates={duplicateFilenames.has(item.data.filename)}
onClick={handleArtifactClick}
+ workspaceId={workspaceId}
/>
</AgentRow>
</div>
@@ -1211,6 +1218,13 @@ export function AgentChatView({
</div>
</div>
+ <ImageLightbox
+ open={lightboxArtifact != null}
+ onClose={() => setLightboxArtifact(null)}
+ artifact={lightboxArtifact}
+ workspaceId={workspaceId}
+ />
+
<ArtifactSheet
open={artifactSheetOpen}
onOpenChange={(v) => {
diff --git a/src/web/src/components/agent-chat/chat-view-parts.tsx b/src/web/src/components/agent-chat/chat-view-parts.tsx
index 31f63003e..33842713b 100644
--- a/src/web/src/components/agent-chat/chat-view-parts.tsx
+++ b/src/web/src/components/agent-chat/chat-view-parts.tsx
@@ -1,6 +1,6 @@
"use client";
-import React from "react";
+import React, { useState } from "react";
import type { Artifact } from "@alook/shared";
import { useAgentContext } from "@/contexts/agent-context";
import { AgentPreviewCard } from "@/components/agent-preview-card";
@@ -10,6 +10,7 @@ import {
PopoverContent,
} from "@/components/ui/popover";
import { FileCard } from "@/components/agent-chat/event-cards/file-card";
+import { getArtifactThumbnailUrl } from "@/components/artifact-content-renderer";
function MentionHighlight(
props: Record<string, unknown> & { children?: React.ReactNode },
@@ -82,12 +83,37 @@ export function ArtifactCard({
version,
hasDuplicates,
onClick,
+ workspaceId,
}: {
artifact: Artifact;
version: number;
hasDuplicates: boolean;
onClick: (a: Artifact) => void;
+ workspaceId: string;
}) {
+ const [thumbError, setThumbError] = useState(false);
+ const thumbnailUrl = artifact.has_thumbnail
+ ? getArtifactThumbnailUrl(artifact.id, workspaceId)
+ : undefined;
+
+ if (thumbnailUrl && !thumbError) {
+ return (
+ <button
+ type="button"
+ onClick={() => onClick(artifact)}
+ className="max-w-64 overflow-hidden rounded-(--radius) border border-(--border) cursor-pointer [transition:translate_.2s_cubic-bezier(.2,.8,.2,1),box-shadow_.2s_ease] hover:-translate-y-0.5 [box-shadow:var(--e1)] hover:[box-shadow:var(--e2)]"
+ >
+ <img
+ src={thumbnailUrl}
+ alt={artifact.filename}
+ loading="lazy"
+ onError={() => setThumbError(true)}
+ className="block w-full h-auto"
+ />
+ </button>
+ );
+ }
+
return (
<FileCard
filename={artifact.filename}
diff --git a/src/web/src/components/agent-chat/image-lightbox.tsx b/src/web/src/components/agent-chat/image-lightbox.tsx
new file mode 100644
index 000000000..eff99741d
--- /dev/null
+++ b/src/web/src/components/agent-chat/image-lightbox.tsx
@@ -0,0 +1,69 @@
+"use client";
+
+import React, { useEffect, useCallback } from "react";
+import { createPortal } from "react-dom";
+import type { Artifact } from "@alook/shared";
+import { X, Download } from "lucide-react";
+import { getArtifactUrl } from "@/components/artifact-content-renderer";
+
+export function ImageLightbox({
+ open,
+ onClose,
+ artifact,
+ workspaceId,
+}: {
+ open: boolean;
+ onClose: () => void;
+ artifact: Artifact | null;
+ workspaceId: string;
+}) {
+ const handleKeyDown = useCallback(
+ (e: KeyboardEvent) => {
+ if (e.key === "Escape") onClose();
+ },
+ [onClose],
+ );
+
+ useEffect(() => {
+ if (!open) return;
+ document.addEventListener("keydown", handleKeyDown);
+ return () => document.removeEventListener("keydown", handleKeyDown);
+ }, [open, handleKeyDown]);
+
+ if (!open || !artifact) return null;
+
+ const fullUrl = getArtifactUrl(artifact.id, workspaceId);
+ const downloadUrl = getArtifactUrl(artifact.id, workspaceId, true);
+
+ return createPortal(
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-md animate-in fade-in duration-150"
+ onClick={onClose}
+ >
+ <div className="absolute top-4 right-4 flex items-center gap-2">
+ <a
+ href={downloadUrl}
+ download={artifact.filename}
+ onClick={(e) => e.stopPropagation()}
+ className="rounded-full p-2 text-white/70 hover:text-white hover:bg-white/10 transition-colors"
+ >
+ <Download className="size-5" />
+ </a>
+ <button
+ type="button"
+ onClick={onClose}
+ className="rounded-full p-2 text-white/70 hover:text-white hover:bg-white/10 transition-colors"
+ >
+ <X className="size-5" />
+ </button>
+ </div>
+ <img
+ src={fullUrl}
+ alt={artifact.filename}
+ onClick={(e) => e.stopPropagation()}
+ className="max-w-[90vw] max-h-[90vh] object-contain rounded-lg"
+ />
+ </div>,
+ document.body,
+ );
+}
diff --git a/src/web/src/components/agent-chat/message-list.tsx b/src/web/src/components/agent-chat/message-list.tsx
index 2076d947b..5f257e248 100644
--- a/src/web/src/components/agent-chat/message-list.tsx
+++ b/src/web/src/components/agent-chat/message-list.tsx
@@ -11,7 +11,7 @@ import { highlightMentions } from "@/lib/highlight-mentions";
import { TaskStream } from "@/components/task-stream";
import { RuntimeErrorBlock } from "@/components/agent-chat/runtime-error-block";
import { AnimatedAvatar, type AvatarConfig } from "@/components/avatar";
-import { FileText, Flag, Copy, Check, MessageSquareQuote, MessageSquare } from "lucide-react";
+import { FileText, Flag, Copy, Check, MessageSquareQuote, MessageSquare, Image } from "lucide-react";
import { EmailCard } from "@/components/agent-chat/event-cards/email-card";
import { CalendarCard } from "@/components/agent-chat/event-cards/calendar-card";
import { IssueCard } from "@/components/agent-chat/event-cards/issue-card";
@@ -195,7 +195,7 @@ function AttachmentChips({
onClick={(e) => { e.stopPropagation(); onArtifactClick(a); }}
className="inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80 hover:bg-primary-foreground/20 transition-colors cursor-pointer"
>
- <FileText className="size-3 shrink-0" />
+ {a.content_type.startsWith("image/") ? <Image className="size-3 shrink-0" /> : <FileText className="size-3 shrink-0" />}
<span className="truncate max-w-37.5">{a.filename}</span>
</button>
))}
diff --git a/src/web/src/components/artifact-content-renderer.tsx b/src/web/src/components/artifact-content-renderer.tsx
index 88dfa8674..b7b4f4d9a 100644
--- a/src/web/src/components/artifact-content-renderer.tsx
+++ b/src/web/src/components/artifact-content-renderer.tsx
@@ -41,6 +41,11 @@ export function getArtifactUrl(id: string, workspaceId: string, download?: boole
return `/api/artifacts/${id}/content?${params}`;
}
+export function getArtifactThumbnailUrl(id: string, workspaceId: string): string {
+ const params = new URLSearchParams({ workspace_id: workspaceId });
+ return `/api/artifacts/${id}/thumbnail?${params}`;
+}
+
export function computeArtifactVersions(artifacts: Artifact[]): { versionMap: Map<string, number>; duplicateFilenames: Set<string> } {
const groups = new Map<string, Artifact[]>();
for (const a of artifacts) {
diff --git a/src/web/src/lib/chat-cache.test.ts b/src/web/src/lib/chat-cache.test.ts
index ccebc63ba..f8e2bb9f2 100644
--- a/src/web/src/lib/chat-cache.test.ts
+++ b/src/web/src/lib/chat-cache.test.ts
@@ -33,6 +33,7 @@ function makeArtifact(overrides: Partial<Artifact> = {}): Artifact {
content_type: "application/pdf",
size: 1024,
source: "agent",
+ has_thumbnail: false,
created_at: new Date().toISOString(),
...overrides,
};