@pinepaper.studio/mcp-server 1.6.8 → 1.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.de.md +1 -1
  2. package/README.es.md +1 -1
  3. package/README.fr.md +1 -1
  4. package/README.hi.md +1 -1
  5. package/README.ja.md +1 -1
  6. package/README.ko.md +1 -1
  7. package/README.md +89 -4
  8. package/README.pt-BR.md +1 -1
  9. package/README.zh-CN.md +1 -1
  10. package/dist/browser/index.d.ts +1 -1
  11. package/dist/browser/index.d.ts.map +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/index.js.map +1 -1
  14. package/dist/browser/puppeteer-controller.d.ts +86 -2
  15. package/dist/browser/puppeteer-controller.d.ts.map +1 -1
  16. package/dist/browser/puppeteer-controller.js +143 -60
  17. package/dist/browser/puppeteer-controller.js.map +1 -1
  18. package/dist/cli.js +12 -0
  19. package/dist/cli.js.map +1 -1
  20. package/dist/design/design-systems.d.ts +105 -7
  21. package/dist/design/design-systems.d.ts.map +1 -1
  22. package/dist/design/design-systems.js +210 -16
  23. package/dist/design/design-systems.js.map +1 -1
  24. package/dist/tools/definitions.d.ts.map +1 -1
  25. package/dist/tools/definitions.js +63 -3
  26. package/dist/tools/definitions.js.map +1 -1
  27. package/dist/tools/engine-methods.d.ts.map +1 -1
  28. package/dist/tools/engine-methods.js +2 -0
  29. package/dist/tools/engine-methods.js.map +1 -1
  30. package/dist/tools/handlers.d.ts.map +1 -1
  31. package/dist/tools/handlers.js +212 -8
  32. package/dist/tools/handlers.js.map +1 -1
  33. package/dist/tools/minimal-descriptions.d.ts.map +1 -1
  34. package/dist/tools/minimal-descriptions.js +2 -1
  35. package/dist/tools/minimal-descriptions.js.map +1 -1
  36. package/dist/tools/toolkits.d.ts.map +1 -1
  37. package/dist/tools/toolkits.js +1 -0
  38. package/dist/tools/toolkits.js.map +1 -1
  39. package/dist/types/code-generator.d.ts +10 -0
  40. package/dist/types/code-generator.d.ts.map +1 -1
  41. package/dist/types/code-generator.js +75 -8
  42. package/dist/types/code-generator.js.map +1 -1
  43. package/dist/types/schemas.d.ts +75 -35
  44. package/dist/types/schemas.d.ts.map +1 -1
  45. package/dist/types/schemas.js +43 -3
  46. package/dist/types/schemas.js.map +1 -1
  47. package/manifest.json +5 -1
  48. package/package.json +1 -1
package/README.de.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  Der PinePaper MCP-Server lässt KI-Assistenten über das Model Context Protocol Grafiken in [PinePaper Studio](https://pinepaper.studio) erstellen und animieren. Funktioniert mit jeder KI, die MCP-Tool-Aufrufe unterstützt (Claude, GPT, Gemini, lokale Modelle usw.).
16
16
 
17
- Der Server bietet **151 Tools**: Zeichnen, Animation, Diagramme, Karten, Typografie, Physik, Bildbearbeitung, Datenvisualisierung und Export:
17
+ Der Server bietet **152 Tools**: Zeichnen, Animation, Diagramme, Karten, Typografie, Physik, Bildbearbeitung, Datenvisualisierung und Export:
18
18
 
19
19
  - Text, Formen, Geometrie und komplexe Grafiken erstellen
20
20
  - Mit deklarativen **Relationen** animieren statt mit Keyframes
package/README.es.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  El servidor MCP de PinePaper permite a los asistentes de IA crear y animar gráficos en [PinePaper Studio](https://pinepaper.studio) a través del Model Context Protocol. Funciona con cualquier IA que soporte llamadas a herramientas MCP (Claude, GPT, Gemini, modelos locales, etc.).
16
16
 
17
- Expone **151 herramientas**: dibujo, animación, diagramas, mapas, tipografía, física, edición de imágenes, visualización de datos y exportación:
17
+ Expone **152 herramientas**: dibujo, animación, diagramas, mapas, tipografía, física, edición de imágenes, visualización de datos y exportación:
18
18
 
19
19
  - Crear texto, formas, geometría y gráficos complejos
20
20
  - Animar con **relaciones** declarativas en lugar de fotogramas clave
package/README.fr.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  Le serveur MCP PinePaper permet aux assistants IA de créer et d'animer des graphiques dans [PinePaper Studio](https://pinepaper.studio) via le Model Context Protocol. Compatible avec toute IA gérant les appels d'outils MCP (Claude, GPT, Gemini, modèles locaux, etc.).
16
16
 
17
- Il expose **151 outils** : dessin, animation, diagrammes, cartes, typographie, physique, retouche d'image, visualisation de données et export :
17
+ Il expose **152 outils** : dessin, animation, diagrammes, cartes, typographie, physique, retouche d'image, visualisation de données et export :
18
18
 
19
19
  - Créer du texte, des formes, de la géométrie et des graphiques complexes
20
20
  - Animer avec des **relations** déclaratives plutôt que des images clés
package/README.hi.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  PinePaper MCP सर्वर AI असिस्टेंट्स को Model Context Protocol के ज़रिए [PinePaper Studio](https://pinepaper.studio) में ग्राफ़िक्स बनाने और एनिमेट करने देता है। MCP टूल कॉलिंग वाले किसी भी AI (Claude, GPT, Gemini, लोकल मॉडल आदि) के साथ काम करता है।
16
16
 
17
- सर्वर **151 टूल** देता है — ड्रॉइंग, एनिमेशन, डायग्राम, नक्शे, टाइपोग्राफ़ी, फिज़िक्स, इमेज एडिटिंग, डेटा विज़ुअलाइज़ेशन और एक्सपोर्ट:
17
+ सर्वर **152 टूल** देता है — ड्रॉइंग, एनिमेशन, डायग्राम, नक्शे, टाइपोग्राफ़ी, फिज़िक्स, इमेज एडिटिंग, डेटा विज़ुअलाइज़ेशन और एक्सपोर्ट:
18
18
 
19
19
  - टेक्स्ट, आकृतियाँ, ज्यामिति और जटिल ग्राफ़िक्स बनाना
20
20
  - कीफ़्रेम की जगह व्यवहार बताने वाले **रिलेशन** से एनिमेशन
package/README.ja.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  PinePaper MCP サーバーは、MCP 経由で AI アシスタントが [PinePaper Studio](https://pinepaper.studio) 上にグラフィックを作成・アニメーションさせるためのサーバーです。MCP ツールコールに対応した AI(Claude、GPT、Gemini、ローカルモデルなど)で動作します。
16
16
 
17
- **151 個のツール**を提供 — 描画・アニメーション・図・地図・タイポグラフィ・物理・画像編集・データ可視化・エクスポート:
17
+ **152 個のツール**を提供 — 描画・アニメーション・図・地図・タイポグラフィ・物理・画像編集・データ可視化・エクスポート:
18
18
 
19
19
  - テキスト、図形、ジオメトリ、複雑なグラフィックの作成
20
20
  - キーフレームではなく、ふるまいを宣言する**リレーション**でアニメーション
package/README.ko.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  PinePaper MCP 서버는 AI 어시스턴트가 MCP를 통해 [PinePaper Studio](https://pinepaper.studio)에서 그래픽을 만들고 애니메이션하게 해줍니다. MCP 툴 콜을 지원하는 모든 AI(Claude, GPT, Gemini, 로컬 모델 등)와 호환됩니다.
16
16
 
17
- **151개의 툴** 제공 — 드로잉, 애니메이션, 다이어그램, 지도, 타이포그래피, 물리, 이미지 편집, 데이터 시각화, 내보내기:
17
+ **152개의 툴** 제공 — 드로잉, 애니메이션, 다이어그램, 지도, 타이포그래피, 물리, 이미지 편집, 데이터 시각화, 내보내기:
18
18
 
19
19
  - 텍스트·도형·기하·복잡한 그래픽 생성
20
20
  - 키프레임 대신 행동을 선언하는 **릴레이션**으로 애니메이션
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  PinePaper MCP Server enables AI assistants to create and animate graphics in [PinePaper Studio](https://pinepaper.studio) via the Model Context Protocol (MCP). Works with any AI that supports MCP tool calling (Claude, GPT, Gemini, local models, etc.).
27
27
 
28
- The server exposes **151 tools** across drawing, animation, diagrams, maps, typography, physics, image editing, data visualization, and export. Using natural language, you can:
28
+ The server exposes **152 tools** across drawing, animation, diagrams, maps, typography, physics, image editing, data visualization, and export. Using natural language, you can:
29
29
 
30
30
  - Create geometric shapes, text collages, diagrams, and data charts
31
31
  - Apply 37+ character-level text effects and 28+ vertex deformation presets
@@ -36,7 +36,7 @@ The server exposes **151 tools** across drawing, animation, diagrams, maps, typo
36
36
 
37
37
  ## Running it: local or hosted
38
38
 
39
- **Local is free and complete.** Every one of the 151 tools works when you run
39
+ **Local is free and complete.** Every one of the 152 tools works when you run
40
40
  this server yourself. There is no reduced tier and nothing held back.
41
41
 
42
42
  What it needs:
@@ -208,6 +208,80 @@ If you do not want an agent executing anything, `code` mode is a first-class pat
208
208
  - Puppeteer mode launches Chrome with `--no-sandbox` and `--disable-setuid-sandbox`. That is routine for headless automation and it does weaken Chrome's own process sandbox. If that matters where you are running it, use `code` mode or put the server in a container.
209
209
  - Puppeteer itself is an **optional** peer dependency, kept out of the default tree precisely because a headless browser plus an install script is what scanners flag hardest. Install it only if you want the executing mode.
210
210
 
211
+ ## What's new in 1.6.9
212
+
213
+ ### New: `pinepaper_export_store`
214
+
215
+ Recover an export the studio is still holding, instead of re-rendering it.
216
+
217
+ - `list` — what is held: `{id, format, size, createdAt}`, newest first. IDs survive a page reload.
218
+ - `save` — page it out to a file and release it. Returns a `filePath`, and is safe to repeat.
219
+ - `release` — drop it without saving.
220
+
221
+ Reach for it when an export fails with `Failed to write data to data pipe` — that is the browser's transport, not the encoder, so the bytes are often already stored — or when an error names an `exportId`.
222
+
223
+ **Retention:** held exports last until released, or until a later export needs the space, and eviction drops the oldest first. Save or release each export before starting the next one.
224
+
225
+ ### New: `scale` on `pinepaper_agent_export`
226
+
227
+ Render video at a fraction of the platform preset (`0.1`–`1`).
228
+
229
+ - `scale: 0.5` with `quality: "draft"` is a fast look-check before committing to a full render.
230
+ - Smaller frames also mean smaller files: the encoder derives its target from resolution, so this is the size control. There is no bitrate option.
231
+ - Video only (`mp4`/`webm`/`gif`) — passing it to `png`/`svg`/`pdf`/`wav` is rejected rather than ignored. Omitting it leaves exports exactly as before.
232
+
233
+ ### New: `list_motion` on `pinepaper_design_system`
234
+
235
+ Returns each licensed design system's motion curves **and** its durations; previously only the curves were reachable. Durations come back in milliseconds and in seconds.
236
+
237
+ These are the design systems' motion scales — Material's duration ladder, and so on. Aesthetic styles such as `bauhaus_geometric` carry no motion data of their own, so pair a system's motion with a style.
238
+
239
+ ### `list_styles` now returns style tokens
240
+
241
+ `pinepaper_design_system` `list_styles` returns each style's palette, background, font stacks, type sizes and variants, not just its name. Building in a style by hand no longer means reading the generator source to find its colours.
242
+
243
+ ### Fixed: `compose` placed everything off-centre
244
+
245
+ `compose` positioned items by their top-left corner while the canvas positions by centre, so every composed scene was displaced and left-aligned headlines ran off the edge of the canvas. Composed scenes now land where the layout intends.
246
+
247
+ ### Fixed: exports could report success while failing
248
+
249
+ `pinepaper_agent_export` could return success when the export itself had failed, so a failed render passed silently and a batch could lose chunks without saying so. A failed export is now an error, and names a recovery path when the failure looks like a transport problem.
250
+
251
+ ### Fixed: long exports timed out at ten seconds
252
+
253
+ Video exports running longer than about ten seconds failed with a `PP_TIMEOUT` that looked like a problem with the scene.
254
+
255
+ - `PINEPAPER_EXPORT_TIMEOUT` sets the budget (default `300000` ms). For exports over five minutes, raise `PINEPAPER_TIMEOUT` to match.
256
+ - `PINEPAPER_GOVERNOR=off` is an escape hatch for older studio builds.
257
+
258
+ ### Fixed: exports failed on a fresh session
259
+
260
+ Exporting immediately after connecting failed with a message blaming the studio's version. The export now waits for the studio's export subsystem to finish loading.
261
+
262
+ ### Fixed: large exports could be left undeliverable
263
+
264
+ A read failure partway through paging a large export left the file unrecoverable. Reads now retry at a smaller size, and anything still held can be recovered with `pinepaper_export_store`.
265
+
266
+ ### Fixed: connection failures behind proxies, and a false "ready"
267
+
268
+ Connecting could burn the full timeout against a studio that was already usable, and the connection had no configuration.
269
+
270
+ - `PINEPAPER_WAIT_UNTIL` — what a navigation waits for (default `domcontentloaded`; set `networkidle2` for the previous behaviour).
271
+ - `PINEPAPER_TIMEOUT` — navigation and readiness timeout in ms (default `30000`).
272
+ - `PINEPAPER_PROXY` — routes Chrome through a proxy, for origins that reject headless Chrome. Setting it also relaxes certificate checking, which an intercepting proxy requires.
273
+
274
+ Connections now wait for the studio's API rather than for its canvas library, so "connected" means tool calls will work.
275
+
276
+ ### Fixed: `pinepaper_animate_letter_collage` ignored its animation type
277
+
278
+ The requested animation type was discarded on every call. **This fix also needs a studio update** — the other half is an engine change that has not shipped yet, so collage animation stays static until it does.
279
+
280
+ ### Documentation
281
+
282
+ - **Rotation** — `pinepaper_create_item` documents `properties: { rotation: 45 }`, and that rotation is baked into the geometry, so reading `item.rotation` back returns `0`. Verify a rotation by geometry or pixels, not by re-reading the property.
283
+ - **Dense motion** — `pinepaper_keyframe_animate` points at cheaper routes before you author hundreds of keyframes: the `time_expression` relation for motion that is a function of time, `staggered_with` / `wave_through` for a whole group, and `pinepaper_execute_custom_code` for procedural scenes.
284
+
211
285
  ## What's new in 1.6.8
212
286
 
213
287
  **Long-form export stops crossing the bridge as one string.** `pinepaper_agent_export` handed the bytes back as a base64 data URL. Two things were wrong with that and only one of them was a bug.
@@ -490,7 +564,7 @@ Fourteen new tools (121 → 135) and new actions across the surface — the rele
490
564
 
491
565
  ## Toolkits & Token Budget
492
566
 
493
- 151 tools is a lot of context. The server ships a **toolkit** system that serves only the tools a given client needs, plus a **verbosity** system that controls how long each tool description is.
567
+ 152 tools is a lot of context. The server ships a **toolkit** system that serves only the tools a given client needs, plus a **verbosity** system that controls how long each tool description is.
494
568
 
495
569
  **Toolkit profiles** (`PINEPAPER_TOOLKIT`):
496
570
 
@@ -695,7 +769,7 @@ Generate instruction/code pairs for LLM fine-tuning:
695
769
 
696
770
  ## Tools Reference
697
771
 
698
- All 151 tools, grouped by the tag used for toolkit filtering.
772
+ All 152 tools, grouped by the tag used for toolkit filtering.
699
773
 
700
774
  ### Canvas (`canvas`)
701
775
  | Tool | Description |
@@ -936,6 +1010,7 @@ All 151 tools, grouped by the tag used for toolkit filtering.
936
1010
  | `pinepaper_agent_batch_execute` | Execute multiple operations in batch |
937
1011
  | `pinepaper_interchange` | Lottie, dotLottie, GLB, BVH, PNG sequence |
938
1012
  | `pinepaper_agent_export` | Smart export with platform auto-detection |
1013
+ | `pinepaper_export_store` | Recover an export the studio is still holding — list, save to a file, or release |
939
1014
  | `pinepaper_agent_analyze` | Analyze content for export recommendations |
940
1015
 
941
1016
  ### Browser (`browser`)
@@ -1197,6 +1272,16 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
1197
1272
  | `PINEPAPER_METRICS_ENABLED` | Enable performance metrics tracking | `true` |
1198
1273
  | `PINEPAPER_METRICS_RETENTION` | Max metrics to retain in memory | `1000` |
1199
1274
  | `PINEPAPER_SCREENSHOT_MODE` | Screenshot mode (`on_request`/`always`/`never`) | `on_request` |
1275
+ | `PINEPAPER_WAIT_UNTIL` | What a navigation waits for (`load`/`domcontentloaded`/`networkidle0`/`networkidle2`) | `domcontentloaded` |
1276
+ | `PINEPAPER_TIMEOUT` | Navigation and readiness timeout, in ms | `30000` |
1277
+ | `PINEPAPER_PROXY` | Chrome `--proxy-server` value; also ignores certificate errors, for an intercepting proxy | unset |
1278
+ | `PINEPAPER_EXPORT_TIMEOUT` | Governor budget for an export run, in ms (raise `PINEPAPER_TIMEOUT` alongside it) | `300000` |
1279
+ | `PINEPAPER_GOVERNOR` | `off` runs code by raw eval — no governor report, no error codes, no seeded determinism | on |
1280
+
1281
+ Behind a proxy, or against a Studio with analytics or polling connections open,
1282
+ `networkidle2` may never settle: set `PINEPAPER_WAIT_UNTIL` only if you need the
1283
+ old behaviour back. Readiness does not depend on it — the connection waits for
1284
+ Studio's `app.create` either way.
1200
1285
 
1201
1286
  ### Performance Metrics
1202
1287
 
package/README.pt-BR.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  O servidor MCP do PinePaper permite que assistentes de IA criem e animem gráficos no [PinePaper Studio](https://pinepaper.studio) via Model Context Protocol. Funciona com qualquer IA que suporte chamadas de ferramenta MCP (Claude, GPT, Gemini, modelos locais etc.).
16
16
 
17
- São **151 ferramentas**: desenho, animação, diagramas, mapas, tipografia, física, edição de imagens, visualização de dados e exportação:
17
+ São **152 ferramentas**: desenho, animação, diagramas, mapas, tipografia, física, edição de imagens, visualização de dados e exportação:
18
18
 
19
19
  - Criar texto, formas, geometria e gráficos complexos
20
20
  - Animar com **relações** declarativas em vez de keyframes
package/README.zh-CN.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  PinePaper MCP 服务器让 AI 助手通过 MCP 协议在 [PinePaper Studio](https://pinepaper.studio) 中创建和驱动图形动画。兼容任何支持 MCP 工具调用的 AI(Claude、GPT、Gemini、本地模型等)。
16
16
 
17
- 服务器提供 **151 个工具**,覆盖绘图、动画、图表、地图、排版、物理、图像编辑、数据可视化与导出:
17
+ 服务器提供 **152 个工具**,覆盖绘图、动画、图表、地图、排版、物理、图像编辑、数据可视化与导出:
18
18
 
19
19
  - 创建文本、形状、几何图形与复杂图稿
20
20
  - 用行为驱动的**关系(relations)**做动画,而不是逐帧关键帧
@@ -4,5 +4,5 @@
4
4
  * Exports for browser-side usage of PinePaper MCP tools.
5
5
  */
6
6
  export { PinePaperBridge, PinePaperStudioHandler, createBridge, createStudioHandler, type BridgeMessage, type BridgeConfig, } from './bridge.js';
7
- export { PinePaperBrowserController, getBrowserController, resetBrowserController, resetBrowserControllerSync, type BrowserControllerConfig, type ExecuteResult, type AgentConnectOptions, type BatchExecuteResult, } from './puppeteer-controller.js';
7
+ export { PinePaperBrowserController, getBrowserController, resetBrowserController, resetBrowserControllerSync, PAGE_WAIT_UNTIL, type BrowserControllerConfig, type ExecuteCodeOptions, type PageWaitUntil, type ExecuteResult, type AgentConnectOptions, type BatchExecuteResult, } from './puppeteer-controller.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,EACf,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,2BAA2B,CAAC"}
@@ -4,5 +4,5 @@
4
4
  * Exports for browser-side usage of PinePaper MCP tools.
5
5
  */
6
6
  export { PinePaperBridge, PinePaperStudioHandler, createBridge, createStudioHandler, } from './bridge.js';
7
- export { PinePaperBrowserController, getBrowserController, resetBrowserController, resetBrowserControllerSync, } from './puppeteer-controller.js';
7
+ export { PinePaperBrowserController, getBrowserController, resetBrowserController, resetBrowserControllerSync, PAGE_WAIT_UNTIL, } from './puppeteer-controller.js';
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,GAK3B,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,eAAe,GAOhB,MAAM,2BAA2B,CAAC"}
@@ -4,6 +4,13 @@
4
4
  * Controls a real browser instance running PinePaper Studio.
5
5
  * Executes code directly via page.evaluate() and provides screenshots.
6
6
  */
7
+ /**
8
+ * What a navigation waits for. Puppeteer's own union, spelled out here so the
9
+ * env var can be validated against it without importing puppeteer — which is
10
+ * an optional peer, absent on most installs (see connect()).
11
+ */
12
+ export type PageWaitUntil = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
13
+ export declare const PAGE_WAIT_UNTIL: readonly PageWaitUntil[];
7
14
  export interface BrowserControllerConfig {
8
15
  /** PinePaper Studio URL (default: https://pinepaper.studio) */
9
16
  studioUrl?: string;
@@ -17,6 +24,45 @@ export interface BrowserControllerConfig {
17
24
  timeout?: number;
18
25
  /** Enable agent mode with ?agent=1 URL parameter */
19
26
  agentMode?: boolean;
27
+ /**
28
+ * What navigations wait for (default: 'domcontentloaded').
29
+ *
30
+ * Every goto/reload used to be networkidle2, which asks for two-or-fewer
31
+ * connections held for half a second — a bar Studio never clears behind a
32
+ * proxy, or with analytics and polling sockets open. Connect then burned the
33
+ * entire timeout and failed against a page that had been usable for seconds.
34
+ * Readiness is waitForPinePaper()'s job; a navigation only has to hand us a
35
+ * document.
36
+ */
37
+ waitUntil?: PageWaitUntil;
38
+ /**
39
+ * Chrome --proxy-server value (e.g. 'http://127.0.0.1:8080'). Setting it also
40
+ * passes --ignore-certificate-errors, because a proxy that intercepts TLS
41
+ * presents its own certificate and Chrome would otherwise refuse every
42
+ * origin. Unset → neither flag, and certificate checking stays on.
43
+ */
44
+ proxy?: string;
45
+ /**
46
+ * Run code through FxTool's governor (app.runGenerated) when the build has
47
+ * one. Default true. False raw-evals instead — see ExecuteCodeOptions.
48
+ */
49
+ governor?: boolean;
50
+ }
51
+ export interface ExecuteCodeOptions {
52
+ /**
53
+ * Governor budget for this run, in ms. FxTool's runGenerated defaults to
54
+ * 10_000 (RUN_DEFAULTS.timeoutMs, an async-tail Promise.race): a sane guard
55
+ * against a runaway script, and the wrong number for an export — the one
56
+ * operation that legitimately runs for minutes.
57
+ */
58
+ governorTimeoutMs?: number;
59
+ /**
60
+ * Skip app.runGenerated entirely and raw-eval the code. That gives up the
61
+ * governor report, the structured error codes and the seeded PRNG, so it is
62
+ * the escape hatch for a deployed build whose governor ignores the budget
63
+ * above — never a fast path. Defaults to the controller's `governor: false`.
64
+ */
65
+ bypassGovernor?: boolean;
20
66
  }
21
67
  export interface AgentConnectOptions {
22
68
  /** Run browser in headless mode (default: true for agent workflows) */
@@ -62,6 +108,29 @@ export interface ExecuteResult {
62
108
  */
63
109
  canvasReset?: boolean;
64
110
  }
111
+ /**
112
+ * Is PinePaper Studio actually usable? Evaluated IN THE PAGE, so it closes over
113
+ * nothing.
114
+ *
115
+ * The old test was `app !== undefined || pinepaper !== undefined || paper !==
116
+ * undefined`, hand-copied into four places. `window.paper` is Paper.js, which
117
+ * attaches the moment the canvas script loads — long before Studio has built
118
+ * its API — so all four sites could report ready against a page that would
119
+ * throw on the first call.
120
+ *
121
+ * The test is FxTool's own, mirrored rather than invented: js/app.js polls
122
+ * `app && app.itemRegistry && typeof app.create === 'function'` under the
123
+ * comment "No global ready event exists — poll for the app surface the executor
124
+ * needs". Two ordering details make both halves earn their place:
125
+ * `window.PinePaper` is first assigned the CLASS at module load (no `create` —
126
+ * create() is an instance method) and only later the instance, and the instance
127
+ * assigns itself to the global from INSIDE its own constructor.
128
+ *
129
+ * Every candidate global is tested, not just the first truthy one: picking
130
+ * `window.app` because it exists and then failing it would trade a false ready
131
+ * for a false not-ready, which costs the whole timeout.
132
+ */
133
+ export declare function pinePaperIsReady(): boolean;
65
134
  /**
66
135
  * Controls PinePaper Studio via Puppeteer.
67
136
  *
@@ -78,6 +147,13 @@ export declare class PinePaperBrowserController {
78
147
  private isAgentMode;
79
148
  private connectingPromise;
80
149
  constructor(config?: BrowserControllerConfig);
150
+ /**
151
+ * Chrome flags shared by both launch paths, so a proxy configured once does
152
+ * not go missing from whichever path the caller happens to take.
153
+ */
154
+ private launchArgs;
155
+ /** Launch options shared by both paths — see MIN_PROTOCOL_TIMEOUT_MS. */
156
+ private launchOptions;
81
157
  /**
82
158
  * Get URL with agent mode parameter
83
159
  */
@@ -102,6 +178,14 @@ export declare class PinePaperBrowserController {
102
178
  * Whether the browser is running in headless mode
103
179
  */
104
180
  get isHeadless(): boolean;
181
+ /**
182
+ * The resolved connection settings. Read-only, and a copy: these are what the
183
+ * env vars and the caller's config actually worked out to, which is otherwise
184
+ * only observable by launching a browser.
185
+ */
186
+ get connectionSettings(): Readonly<Required<BrowserControllerConfig>>;
187
+ /** The Chrome flags this controller would launch with. Exposed for tests. */
188
+ chromeArgs(): string[];
105
189
  /**
106
190
  * Launch browser and navigate to PinePaper Studio.
107
191
  * When agentMode is enabled (default), this automatically uses connectAgent().
@@ -134,7 +218,7 @@ export declare class PinePaperBrowserController {
134
218
  /**
135
219
  * Execute JavaScript code in PinePaper Studio
136
220
  */
137
- executeCode(code: string, takeScreenshot?: boolean): Promise<ExecuteResult>;
221
+ executeCode(code: string, takeScreenshot?: boolean, options?: ExecuteCodeOptions): Promise<ExecuteResult>;
138
222
  /**
139
223
  * Take a screenshot of the current canvas
140
224
  */
@@ -180,7 +264,7 @@ export declare class PinePaperBrowserController {
180
264
  /**
181
265
  * Execute code with a timeout
182
266
  */
183
- executeWithTimeout(code: string, timeoutMs: number, takeScreenshot?: boolean): Promise<ExecuteResult>;
267
+ executeWithTimeout(code: string, timeoutMs: number, takeScreenshot?: boolean, options?: ExecuteCodeOptions): Promise<ExecuteResult>;
184
268
  /**
185
269
  * Quick reset: Clear canvas without full page refresh
186
270
  */
@@ -1 +1 @@
1
- {"version":3,"file":"puppeteer-controller.d.ts","sourceRoot":"","sources":["../../src/browser/puppeteer-controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH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