ext-apps/examples
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Olivier Chafik 4fc95131bf
feat(pdf-server): get_viewer_state interact action (#590)
* feat(pdf-server): get_viewer_state interact action

New interact action that returns a JSON snapshot of the live viewer:
{currentPage, pageCount, zoom, displayMode, selectedAnnotationIds,
 selection: {text, contextBefore, contextAfter, boundingRect} | null}.

The viewer already pushes selection passively via setModelContext as
<pdf-selection> tags, but not all hosts surface model-context. This gives
the model an explicit pull.

selection.boundingRect is a single bbox in PDF points (top-left origin,
y-down) so it can be fed straight back into add_annotations. selection is
null when nothing is selected or the selection is outside the text-layer.

Wiring: new PdfCommand variant -> processCommands case ->
handleGetViewerState -> submit_viewer_state (new app-only tool, mirrors
submit_save_data) -> waitForViewerState -> text content block.

Also fills a gap in the display_pdf description: it listed interact
actions but was missing save_as; added that and get_viewer_state.

e2e: two tests covering selection:null and a programmatic text-layer
selection.

* test(pdf-server): fix get_viewer_state e2e race + assertions

readLastToolResult clicked .last() before the interact result panel
existed (callInteract doesn't block), so it expanded the display_pdf
panel instead. Wait for the expected panel count first.

Also: basic-host renders the full CallToolResult JSON, with the state
double-escaped inside content[0].text. Parse instead of regex-matching.

playwright.config.ts: honor PW_CHANNEL env to use system Chrome locally
when the bundled chromium_headless_shell is broken.
2026-04-02 08:47:48 +01:00
..
basic-host chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-preact chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-react chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-solid chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-svelte chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-vanillajs chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
basic-server-vue chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
budget-allocator-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
cohort-heatmap-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
customer-segmentation-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
debug-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
integration-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
map-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
pdf-server feat(pdf-server): get_viewer_state interact action (#590) 2026-04-02 08:47:48 +01:00
qr-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
quickstart chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
say-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
scenario-modeler-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
shadertoy-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
sheet-music-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
system-monitor-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
threejs-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
transcript-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
video-resource-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
wiki-explorer-server chore: bump ext-apps to 1.4.0 (#582) 2026-04-02 04:33:13 +01:00
run-all.ts add EXAMPLE=folder-name support for tests & basic-host (#292) 2026-01-19 20:16:37 +00:00