feat(plugins): file viewers — pages by type, fetchFile, inline previews #40
Closed
gabrielvidal
wants to merge 0 commits from
file-viewers into main
pull from: file-viewers
merge into: gabrielvidal:main
gabrielvidal:main
gabrielvidal:fresh-context-plugin
gabrielvidal:remove-hooks-page
gabrielvidal:palette-plugins
gabrielvidal:linear-projects
gabrielvidal:agent-messaging
gabrielvidal:model-router
gabrielvidal:conv-card-layout
gabrielvidal:ask-more-options
gabrielvidal:agent-limits
gabrielvidal:generic-ui-strings
gabrielvidal:android-push-bridge
gabrielvidal:auto-translate
gabrielvidal:filter-chips
gabrielvidal:plugin-catalog
gabrielvidal:plugins-page-rework
gabrielvidal:hub-mcp-plugin
gabrielvidal:translation-plugin
gabrielvidal:scheduled-doors
gabrielvidal:cron-jobs-plugin
gabrielvidal:context-skills-plugin
gabrielvidal:files-plugins
gabrielvidal:worker-names
gabrielvidal:details-panel-perf
gabrielvidal:services-plugin-only
gabrielvidal:fix-test-env-leaks
gabrielvidal:bg-shells-plugin
gabrielvidal:feat-commits-plugins
gabrielvidal:fix-branch-line-tag-rows
gabrielvidal:retire-dead-leftovers
gabrielvidal:runner-into-harness-pi
gabrielvidal:retire-tool-proxy
gabrielvidal:new-project-policy-plugin-only
gabrielvidal:guest-jobs-sonnet
gabrielvidal:push-buttons-everywhere
gabrielvidal:mail-send-plugin
gabrielvidal:ui-polish-batch
gabrielvidal:command-palette-plugin
gabrielvidal:keyboard-shortcuts-plugin
gabrielvidal:prompt-shortcuts-plugin
gabrielvidal:matomo-site-grants
gabrielvidal:lab-chrome-plugin
gabrielvidal:performance-plugin
gabrielvidal:whats-new-plugin
gabrielvidal:skills-agents-plugin
gabrielvidal:goals-plugin-only
gabrielvidal:storage-server-side
gabrielvidal:plugin-scheduled-conversations
gabrielvidal:plugin-fences
gabrielvidal:handoff-plugin
gabrielvidal:plugin-commands
gabrielvidal:plugin-speed
gabrielvidal:cleanup-provider-harness
gabrielvidal:plugin-conversation-labels
gabrielvidal:plugin-plan-usage
gabrielvidal:fix-worker-harness-sync
gabrielvidal:plugin-gcloud-reauth
gabrielvidal:feat/plugin-cards-in-thread
gabrielvidal:feat/plugin-proxy-wake
gabrielvidal:unify-subagents-children
gabrielvidal:wave3d-frontend-typed-plugins
gabrielvidal:wave3c-sidecar-strict-plugins
gabrielvidal:wave3a-catalog-accounts-profiles
gabrielvidal:wave3b-pricing-usage-cutover
gabrielvidal:wave1a-typed-plugins
gabrielvidal:wave1b-sidecar-runtime
gabrielvidal:fix-ios-overlay-scroll
gabrielvidal:batch2-work-resources-core
gabrielvidal:batch2-apikeys
gabrielvidal:plugin-blue-green-deploy
gabrielvidal:plugin-ship
gabrielvidal:plugin-project-env
gabrielvidal:plugin-memories
gabrielvidal:plugin-activity
gabrielvidal:plugin-templates
gabrielvidal:plugin-desk-phone
gabrielvidal:batch1-platform
gabrielvidal:plugins-list-view
gabrielvidal:dash-plugins
gabrielvidal:pets-plugin
gabrielvidal:ha-push-channel
gabrielvidal:mail-agents
gabrielvidal:graph-fix
gabrielvidal:graph-plugin
gabrielvidal:services-plugin
gabrielvidal:left-to-do-plugin
gabrielvidal:plugins-gallery
gabrielvidal:home-conv-menu
gabrielvidal:meta-business
gabrielvidal:agy-rdrand
gabrielvidal:bg-lag
gabrielvidal:conv-load-perf
gabrielvidal:askform-instant
gabrielvidal:fix/drawer-menu-done-chip
gabrielvidal:pi-midrun-compaction
gabrielvidal:interrupt-menu-btn
gabrielvidal:authz
gabrielvidal:inkling
gabrielvidal:repo-plugins
gabrielvidal:work-sync
gabrielvidal:leftovers
gabrielvidal:fix/agy-guest-guard
gabrielvidal:feat/model-presets
gabrielvidal:scroll-back
gabrielvidal:feedback-bell
gabrielvidal:feat/movies-tool
gabrielvidal:feat/running-thread-padding
gabrielvidal:feat/drawer-filter-button-card-chat
gabrielvidal:burn-rate
gabrielvidal:guest-install
gabrielvidal:guest-usage
gabrielvidal:guest-palette
gabrielvidal:guest-form-links
gabrielvidal:form-open-buttons
gabrielvidal:clarifier-lean
gabrielvidal:auto-archive
gabrielvidal:guests-profile
gabrielvidal:conv-motion
gabrielvidal:share-target
gabrielvidal:terminal-sync
gabrielvidal:work-context-past
gabrielvidal:work-context-brief
gabrielvidal:enroll-codes
gabrielvidal:open-image-file
gabrielvidal:worker-uploads
gabrielvidal:conv-drawer-search
gabrielvidal:stack-motion-v3
gabrielvidal:notif-stack-fixes
gabrielvidal:home-motion
gabrielvidal:i18n-fr
gabrielvidal:local-electricity-cost
gabrielvidal:cache-pill-thread
gabrielvidal:cache-scenarios
gabrielvidal:fresh-start
gabrielvidal:msg-select
gabrielvidal:shortcuts-setup
gabrielvidal:ui-0-40-3
gabrielvidal:outbox-landing
gabrielvidal:resume-scope
gabrielvidal:conv-filter-range
gabrielvidal:fix-subagent-form-session
gabrielvidal:ask-form-integration
gabrielvidal:form-visual-options
gabrielvidal:watcher-perf
gabrielvidal:last-msg-summary
gabrielvidal:secret-fields
gabrielvidal:commit-review
gabrielvidal:summary-mode-fixes
gabrielvidal:service-tag-parser
gabrielvidal:clarifier
gabrielvidal:fetch-diet-2
gabrielvidal:fetch-diet
gabrielvidal:conv-look
gabrielvidal:pwa-links
gabrielvidal:tool-widgets
gabrielvidal:worker-autoupdate
gabrielvidal:usage-rings
gabrielvidal:opencode-harness
gabrielvidal:notif-diet
gabrielvidal:conv-resources
gabrielvidal:scheduled-tasks
gabrielvidal:profiles
gabrielvidal:notify-exact-cost
gabrielvidal:usage-measuring
gabrielvidal:guest-projects
gabrielvidal:usage-calibration
gabrielvidal:account-switch
gabrielvidal:multiuser-improve
gabrielvidal:form-groups
gabrielvidal:multiuser
gabrielvidal:motion-reel
gabrielvidal:dashboards-fixes
gabrielvidal:split-big-files
gabrielvidal:held-regex
gabrielvidal:subagent-interrupts
gabrielvidal:form-html
gabrielvidal:tokunia-video
gabrielvidal:settings-uniform
gabrielvidal:worker-ask-fix
gabrielvidal:worker-generic-mac
gabrielvidal:runner-shortcuts
gabrielvidal:notify-unify
gabrielvidal:perf-list-cache
gabrielvidal:mac-worker
gabrielvidal:model-switch
gabrielvidal:pipeline-paths
gabrielvidal:multi-account
gabrielvidal:feature-flags
gabrielvidal:qwen38-support
gabrielvidal:url-prompt
gabrielvidal:running-pages
gabrielvidal:homelab-tag
gabrielvidal:root-project
gabrielvidal:or-models
gabrielvidal:deploying-loader
gabrielvidal:worktree-diff
gabrielvidal:conv-tags
gabrielvidal:tags-page
gabrielvidal:agents-page
gabrielvidal:icon-picker-shortcuts
gabrielvidal:conv-cta
gabrielvidal:stamp-refine
gabrielvidal:post-task-cache
gabrielvidal:post-tidy-completed
gabrielvidal:form-badge
gabrielvidal:hooks-delay-seconds
gabrielvidal:cost-dashboard
gabrielvidal:plan-forms
gabrielvidal:form-mobile
gabrielvidal:guidelines-dag
gabrielvidal:skills-view
gabrielvidal:navbar-hold
gabrielvidal:spawnbox-status
gabrielvidal:hold-editable-expand
gabrielvidal:drawer-transparent
gabrielvidal:hold-fix
gabrielvidal:hold-editable
gabrielvidal:charroll-bump
No Reviewers
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
gabrielvidal (Gabriel Vidal)
Clear assignees
No Assignees
gabrielvidal
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gabrielvidal/ai-agent#40
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The hub side of "file viewers as plugins" (form
viewers-for-pdf-media-and-3d-files_jl74lk): a generic contract so separate plugins can show file types the explorer can't (pdf, media, 3D, html, code, office, archives, fonts). A viewer is its own full plugin page, picked by the file's extension. It reads the bytes through a newfetchFilebridge. A message naming such a file gets an inline preview card under it that opens the same viewer. Guests get viewers the way they get file-explorer (managed,defaultForGuests). What a guest can read is still decided by/api/host-file/raw.Key changes
ui.pages[].fileTypes(1..32^[a-z0-9]{1,10}$, valid only on anopens: ["host-file"]page; written only when set).pluginOpenHref(…, "host-file", {path})picks the first active page whosefileTypeshas the path's extension (fileExt: lowercased,:linesuffix ignored). Otherwise it picks the first untypedhost-filepage; folders always go there. File chips,/file/*, a frame'sopen()and previewhrefs all follow this. Every frame'sinitnow hasfileOpeners: {ext: route}, and a typed page is neveropeners["host-file"].fileIcongains icons for 3D, archive, font and audio files.aiAgentPlugin.fetchFile(url)→Promise<Blob>: any hub media/file path (isHubMediaPath), any content type, ≤ 100 MB (MAX_FILE_BYTES), sent with cookies.mediaUrlis unchanged.ui.filePreviews[]({id, label, html, fileTypes, height, vis?}, ≤ 4 per plugin) inplugins/manifest.py./api/plugins[/ui]lists them asui.filePreviews(withouthtml), and/api/plugins/{id}/ui/preview/{previewId}serves the document.PluginFilePreviews.tsxdraws them under assistant messages:messageHostPaths: inline code, running text, link targets; never inside fenced code), one card per distinct file, at most 4 per message;{preview, path, name, ext, href, sessionId, conversationId};resize(0)collapses it;vis.aiAgentPlugin.navigate(path, {replace: true}), so a page that forwards a file to its viewer on load doesn't trap Back.pdf-viewerpage + preview; the kitchen-sink thread namesnotes/brief.pdf.docs/plugins.md→ "File viewers: pages by type, fetchFile, previews (since 2026-11-28)", written for the eight viewer-plugin runs.Key decisions
allow-scripts allow-popups allow-popups-to-escape-sandbox, opaque origin) ran all of these with the flags as they are, so nothing was widened:blob:URLs in<img>,<video>and<audio>;FontFace(buffer)and an@font-facefrom ablob:URL;blob:Worker, including pdf.js's worker built from its CDN source fetched as text;<script integrity crossorigin>and an ESMimport()from jsDelivr.usePluginOpenernow says "has" when any page opens the kind.Changelog
Test notes
test_plugin_file_viewers.py(new: normalisation, refusals, fingerprint unchanged without the keys, descriptors, the preview document, the capability line). Everytest_plugin*.py,test_authz_matrix,test_hostfilesandtest_csppass (bwrap tmpfs/data). No route was added, soopenapi.json,src/generatedandmatrix.golden.txtdidn't need regenerating.fileViewers.test.tscovers opener resolution,fileOpenersandfetchFilelimits.PluginFilePreviews.test.tsxcovers detection, the per-message rules and mount-on-visible. Full vitest: 1123 pass; the one failure is the knownFreshContextCacheExpiredNotice.tscis clean.frontend/dist, a throwawayfileviewer-demoplugin + file-explorer 1.1.0) driven with puppeteer:?path=;fetchFilereturned the pdf's bytes;.pdfrow to the viewer, while a README stayed in the explorer and Back skipped the handover;fetchFileworked inside their project and got 404 outside it.file-viewers-explorer(file-explorer 1.1.0). Nothing was deployed from the EVOX2.🤖 Generated with Claude Code
Screenshots
ui.pages[].fileTypes (a viewer page picked by extension; host-file links, file chips, /file/* and open() follow it; init.fileOpeners), the aiAgentPlugin.fetchFile bridge (any hub file path, any type, <= 100 MB) and ui.filePreviews (a card under an agent's message naming a previewable host file, mounted once visible). navigate(path, {replace}). Docs: plugins.md → File viewers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Merged into
mainas1b3f5246by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/cadefe6f-0940-4688-bc56-1306d9265430.Pull request closed