@superblocksteam/vite-plugin-file-sync 2.0.74-next.2 → 2.0.75-next.3
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.
- package/dist/ai-service/agent/middleware.d.ts +14 -0
- package/dist/ai-service/agent/middleware.d.ts.map +1 -1
- package/dist/ai-service/agent/middleware.js +40 -0
- package/dist/ai-service/agent/middleware.js.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js +66 -5
- package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
- package/dist/ai-service/agent/subagents/apis/static-analysis.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/apis/static-analysis.js +11 -5
- package/dist/ai-service/agent/subagents/apis/static-analysis.js.map +1 -1
- package/dist/ai-service/agent/subagents/testing/prompt-builder.d.ts.map +1 -1
- package/dist/ai-service/agent/subagents/testing/prompt-builder.js +15 -0
- package/dist/ai-service/agent/subagents/testing/prompt-builder.js.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
- package/dist/ai-service/agent/tool-message-utils.js +3 -0
- package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js +11 -3
- package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/build-api.js +6 -0
- package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/get-api-docs.js +99 -3
- package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/integration-types.js +69 -17
- package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/test-api.js +26 -45
- package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
- package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
- package/dist/ai-service/agent/tools/apis/write-api.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/apis/write-api.js +8 -2
- package/dist/ai-service/agent/tools/apis/write-api.js.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-capture-screenshot.js +3 -0
- package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-debug.js +58 -6
- package/dist/ai-service/agent/tools/build-debug.js.map +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-delete-file.js +27 -196
- package/dist/ai-service/agent/tools/build-delete-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-edit-file.js +12 -22
- package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-finalize.js +3 -0
- package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-install-packages.js +15 -0
- package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
- package/dist/ai-service/agent/tools/build-list-files.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-list-files.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-list-files.js +6 -14
- package/dist/ai-service/agent/tools/build-list-files.js.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-manage-checklist.js +9 -0
- package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-multi-edit-file.js +8 -25
- package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.d.ts +10 -4
- package/dist/ai-service/agent/tools/build-read-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-read-file.js +75 -77
- package/dist/ai-service/agent/tools/build-read-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-reload-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-reload-file.js +5 -0
- package/dist/ai-service/agent/tools/build-reload-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-rename-file.js +3 -50
- package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -1
- package/dist/ai-service/agent/tools/build-validate-icons.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-validate-icons.js +8 -0
- package/dist/ai-service/agent/tools/build-validate-icons.js.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.d.ts +2 -2
- package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/build-write-file.js +7 -17
- package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
- package/dist/ai-service/agent/tools/clear-error-cache.d.ts +10 -0
- package/dist/ai-service/agent/tools/clear-error-cache.d.ts.map +1 -0
- package/dist/ai-service/agent/tools/clear-error-cache.js +38 -0
- package/dist/ai-service/agent/tools/clear-error-cache.js.map +1 -0
- package/dist/ai-service/agent/tools/get-console-logs.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/get-console-logs.js +6 -0
- package/dist/ai-service/agent/tools/get-console-logs.js.map +1 -1
- package/dist/ai-service/agent/tools/get-runtime-errors.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/get-runtime-errors.js +4 -0
- package/dist/ai-service/agent/tools/get-runtime-errors.js.map +1 -1
- package/dist/ai-service/agent/tools/index.d.ts +1 -0
- package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/index.js +1 -0
- package/dist/ai-service/agent/tools/index.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/execute-request.js +56 -9
- package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/metadata.js +6 -0
- package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
- package/dist/ai-service/agent/tools/integrations/run-code.d.ts.map +1 -1
- package/dist/ai-service/agent/tools/integrations/run-code.js +9 -0
- package/dist/ai-service/agent/tools/integrations/run-code.js.map +1 -1
- package/dist/ai-service/agent/tools.d.ts.map +1 -1
- package/dist/ai-service/agent/tools.js +27 -6
- package/dist/ai-service/agent/tools.js.map +1 -1
- package/dist/ai-service/agent/tools2/registry.d.ts +15 -0
- package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/registry.js +30 -0
- package/dist/ai-service/agent/tools2/registry.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js +11 -1
- package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/edit.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/edit.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/edit.js +10 -8
- package/dist/ai-service/agent/tools2/tools/edit.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/end-test-run.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/end-test-run.js +5 -0
- package/dist/ai-service/agent/tools2/tools/end-test-run.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +2 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +24 -0
- package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/glob.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/glob.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/glob.js +25 -85
- package/dist/ai-service/agent/tools2/tools/glob.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js +9 -0
- package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/grep.js +22 -5
- package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/list-attachments.js +4 -0
- package/dist/ai-service/agent/tools2/tools/list-attachments.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ls.d.ts +8 -1
- package/dist/ai-service/agent/tools2/tools/ls.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/ls.js +102 -83
- package/dist/ai-service/agent/tools2/tools/ls.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/read.d.ts +5 -2
- package/dist/ai-service/agent/tools2/tools/read.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/read.js +24 -12
- package/dist/ai-service/agent/tools2/tools/read.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/start-test-run.js +13 -0
- package/dist/ai-service/agent/tools2/tools/start-test-run.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.js +6 -0
- package/dist/ai-service/agent/tools2/tools/update-test-case-status.js.map +1 -1
- package/dist/ai-service/agent/tools2/tools/write.d.ts +4 -1
- package/dist/ai-service/agent/tools2/tools/write.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/tools/write.js +9 -4
- package/dist/ai-service/agent/tools2/tools/write.js.map +1 -1
- package/dist/ai-service/agent/tools2/types.d.ts +25 -0
- package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
- package/dist/ai-service/agent/tools2/types.js.map +1 -1
- package/dist/ai-service/app-interface/constants.d.ts +77 -0
- package/dist/ai-service/app-interface/constants.d.ts.map +1 -0
- package/dist/ai-service/app-interface/constants.js +129 -0
- package/dist/ai-service/app-interface/constants.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts +87 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.js +91 -0
- package/dist/ai-service/app-interface/filesystem/draft-manager.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts +35 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js +236 -0
- package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts +5 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.js +5 -0
- package/dist/ai-service/app-interface/filesystem/handlers/index.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/index.d.ts +12 -0
- package/dist/ai-service/app-interface/filesystem/index.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/index.js +11 -0
- package/dist/ai-service/app-interface/filesystem/index.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/validation.d.ts +71 -0
- package/dist/ai-service/app-interface/filesystem/validation.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/validation.js +170 -0
- package/dist/ai-service/app-interface/filesystem/validation.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +108 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +157 -0
- package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts +126 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts.map +1 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js +9 -0
- package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js.map +1 -0
- package/dist/ai-service/app-interface/linter.d.ts +4 -1
- package/dist/ai-service/app-interface/linter.d.ts.map +1 -1
- package/dist/ai-service/app-interface/linter.js +10 -6
- package/dist/ai-service/app-interface/linter.js.map +1 -1
- package/dist/ai-service/app-interface/shell.d.ts +205 -1
- package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
- package/dist/ai-service/app-interface/shell.js +474 -14
- package/dist/ai-service/app-interface/shell.js.map +1 -1
- package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
- package/dist/ai-service/chat/chat-session-store.js +8 -0
- package/dist/ai-service/chat/chat-session-store.js.map +1 -1
- package/dist/ai-service/features.d.ts +8 -0
- package/dist/ai-service/features.d.ts.map +1 -1
- package/dist/ai-service/features.js +8 -0
- package/dist/ai-service/features.js.map +1 -1
- package/dist/ai-service/index.d.ts +1 -1
- package/dist/ai-service/index.d.ts.map +1 -1
- package/dist/ai-service/index.js +26 -24
- package/dist/ai-service/index.js.map +1 -1
- package/dist/ai-service/judge/judge-executor.d.ts.map +1 -1
- package/dist/ai-service/judge/judge-executor.js +4 -0
- package/dist/ai-service/judge/judge-executor.js.map +1 -1
- package/dist/ai-service/llm/client.d.ts +19 -3
- package/dist/ai-service/llm/client.d.ts.map +1 -1
- package/dist/ai-service/llm/client.js +131 -12
- package/dist/ai-service/llm/client.js.map +1 -1
- package/dist/ai-service/llm/context/context.d.ts +4 -1
- package/dist/ai-service/llm/context/context.d.ts.map +1 -1
- package/dist/ai-service/llm/context/context.js +27 -5
- package/dist/ai-service/llm/context/context.js.map +1 -1
- package/dist/ai-service/llm/context/internal-types.d.ts +5 -0
- package/dist/ai-service/llm/context/internal-types.d.ts.map +1 -1
- package/dist/ai-service/llm/context/internal-types.js +5 -0
- package/dist/ai-service/llm/context/internal-types.js.map +1 -1
- package/dist/ai-service/llm/context/levels/l1.d.ts +4 -3
- package/dist/ai-service/llm/context/levels/l1.d.ts.map +1 -1
- package/dist/ai-service/llm/context/levels/l1.js +9 -8
- package/dist/ai-service/llm/context/levels/l1.js.map +1 -1
- package/dist/ai-service/llm/context/serialization.d.ts +8 -0
- package/dist/ai-service/llm/context/serialization.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/content-compaction.d.ts +7 -5
- package/dist/ai-service/llm/context/utils/content-compaction.d.ts.map +1 -1
- package/dist/ai-service/llm/context/utils/content-compaction.js +27 -6
- package/dist/ai-service/llm/context/utils/content-compaction.js.map +1 -1
- package/dist/ai-service/llm/error.d.ts +1 -0
- package/dist/ai-service/llm/error.d.ts.map +1 -1
- package/dist/ai-service/llm/error.js +29 -3
- package/dist/ai-service/llm/error.js.map +1 -1
- package/dist/ai-service/llm/stream/config.d.ts +14 -5
- package/dist/ai-service/llm/stream/config.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/config.js +17 -5
- package/dist/ai-service/llm/stream/config.js.map +1 -1
- package/dist/ai-service/llm/stream/errors.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/errors.js +7 -4
- package/dist/ai-service/llm/stream/errors.js.map +1 -1
- package/dist/ai-service/llm/stream/index.d.ts +4 -2
- package/dist/ai-service/llm/stream/index.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/index.js +4 -2
- package/dist/ai-service/llm/stream/index.js.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts +1 -1
- package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/orchestrator.js +5 -11
- package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
- package/dist/ai-service/llm/stream/retry-engine.js +3 -3
- package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts +8 -0
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts.map +1 -1
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js +108 -0
- package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js.map +1 -1
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.d.ts.map +1 -1
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js +360 -133
- package/dist/ai-service/mcp/embedded-playwright-mcp-server.js.map +1 -1
- package/dist/ai-service/security/index.d.ts +8 -0
- package/dist/ai-service/security/index.d.ts.map +1 -0
- package/dist/ai-service/security/index.js +8 -0
- package/dist/ai-service/security/index.js.map +1 -0
- package/dist/ai-service/security/safety-classifier.d.ts +103 -0
- package/dist/ai-service/security/safety-classifier.d.ts.map +1 -0
- package/dist/ai-service/security/safety-classifier.js +168 -0
- package/dist/ai-service/security/safety-classifier.js.map +1 -0
- package/dist/ai-service/security/secret-scanner.d.ts +145 -0
- package/dist/ai-service/security/secret-scanner.d.ts.map +1 -0
- package/dist/ai-service/security/secret-scanner.js +344 -0
- package/dist/ai-service/security/secret-scanner.js.map +1 -0
- package/dist/ai-service/state-machine/clark-fsm.d.ts +2 -1
- package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
- package/dist/ai-service/state-machine/clark-fsm.js +29 -8
- package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/agent-planning.js +17 -6
- package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js +9 -1
- package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
- package/dist/ai-service/template-renderer.d.ts.map +1 -1
- package/dist/ai-service/template-renderer.js +4 -1
- package/dist/ai-service/template-renderer.js.map +1 -1
- package/dist/ai-service/transform/api-builder/shared.js +2 -2
- package/dist/ai-service/transform/api-builder/shared.js.map +1 -1
- package/dist/components-manager.d.ts.map +1 -1
- package/dist/components-manager.js +17 -12
- package/dist/components-manager.js.map +1 -1
- package/dist/ensure-app-provider.d.ts +2 -0
- package/dist/ensure-app-provider.d.ts.map +1 -0
- package/dist/ensure-app-provider.js +209 -0
- package/dist/ensure-app-provider.js.map +1 -0
- package/dist/file-sync-vite-plugin.d.ts.map +1 -1
- package/dist/file-sync-vite-plugin.js +22 -12
- package/dist/file-sync-vite-plugin.js.map +1 -1
- package/dist/file-system-manager.d.ts +0 -6
- package/dist/file-system-manager.d.ts.map +1 -1
- package/dist/file-system-manager.js +119 -144
- package/dist/file-system-manager.js.map +1 -1
- package/dist/parsing/util.d.ts.map +1 -1
- package/dist/parsing/util.js +5 -1
- package/dist/parsing/util.js.map +1 -1
- package/dist/socket-manager.d.ts.map +1 -1
- package/dist/socket-manager.js +5 -0
- package/dist/socket-manager.js.map +1 -1
- package/dist/source-tracker.d.ts +4 -0
- package/dist/source-tracker.d.ts.map +1 -1
- package/dist/source-tracker.js +15 -8
- package/dist/source-tracker.js.map +1 -1
- package/dist/sync-service/index.d.ts.map +1 -1
- package/dist/sync-service/index.js +13 -8
- package/dist/sync-service/index.js.map +1 -1
- package/dist/util/logger.d.ts.map +1 -1
- package/dist/util/logger.js +16 -0
- package/dist/util/logger.js.map +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +4 -2
- package/dist/util.js.map +1 -1
- package/package.json +10 -16
- package/dist/ai-service/agent/tools/apis/api-source.d.ts +0 -24
- package/dist/ai-service/agent/tools/apis/api-source.d.ts.map +0 -1
- package/dist/ai-service/agent/tools/apis/api-source.js +0 -108
- package/dist/ai-service/agent/tools/apis/api-source.js.map +0 -1
- package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts +0 -7
- package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts.map +0 -1
- package/dist/ai-service/state-machine/helpers/file-read-tracker.js +0 -26
- package/dist/ai-service/state-machine/helpers/file-read-tracker.js.map +0 -1
|
@@ -174,8 +174,12 @@ const PLAYWRIGHT_ACTIONS = [
|
|
|
174
174
|
"scroll",
|
|
175
175
|
"scrollIntoView",
|
|
176
176
|
"checkRuntimeErrors",
|
|
177
|
+
"getEmbedEvents",
|
|
178
|
+
"triggerEmbedEvent",
|
|
179
|
+
"setEmbedProperties",
|
|
177
180
|
];
|
|
178
181
|
let capturedConsoleLogs = [];
|
|
182
|
+
let lastDrainedEmbedEvents = null;
|
|
179
183
|
export async function startEmbeddedPlaywrightMcpServer(options) {
|
|
180
184
|
const logger = options.logger;
|
|
181
185
|
// Create action logger for capturing Playwright actions
|
|
@@ -239,154 +243,174 @@ export async function startEmbeddedPlaywrightMcpServer(options) {
|
|
|
239
243
|
if (!context) {
|
|
240
244
|
throw new Error("Failed to create or reuse a Playwright context");
|
|
241
245
|
}
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
// Mock parent window for Playwright browser automation.
|
|
247
|
+
//
|
|
248
|
+
// NOTE: We always install this init script, even when init/bootstrap data is not available.
|
|
249
|
+
// This ensures third-party embed hooks (embed-emit-event) can be exercised and asserted in tests.
|
|
250
|
+
// When init/bootstrap data is provided, this script also simulates Superblocks editor messaging
|
|
251
|
+
// (sb-init, sb-bootstrap-response, etc.) needed for first-party embedding flows.
|
|
252
|
+
const initData = options.initData;
|
|
253
|
+
const bootstrapData = options.bootstrapData;
|
|
254
|
+
/**
|
|
255
|
+
* CRITICAL: Mock Parent Window Setup for Playwright Browser Automation
|
|
256
|
+
*
|
|
257
|
+
* WHY THIS IS NECESSARY:
|
|
258
|
+
* The Superblocks library code (in @superblocksteam/library) expects to run inside an iframe
|
|
259
|
+
* embedded by the Superblocks editor. It uses `window.parent.postMessage()` to communicate
|
|
260
|
+
* with the editor and relies on `window.parent !== window` to detect the embedded state.
|
|
261
|
+
*
|
|
262
|
+
* When running in Playwright for E2E testing, there is no parent iframe - the page runs
|
|
263
|
+
* standalone. Without this mock, the library would:
|
|
264
|
+
* 1. Fail the `isEmbeddedBySuperblocksFirstParty()` check
|
|
265
|
+
* 2. Never receive the `sb-init` message needed to establish socket connections
|
|
266
|
+
* 3. Never receive the `sb-bootstrap-response` with auth tokens and app data
|
|
267
|
+
*
|
|
268
|
+
* HOW IT WORKS:
|
|
269
|
+
* 1. We override `window.parent` with a mock object BEFORE library code loads (via addInitScript)
|
|
270
|
+
* 2. The mock intercepts `postMessage` calls from the library
|
|
271
|
+
* 3. When the library sends "sb-ready", we respond with "sb-init" containing peerId/auth data
|
|
272
|
+
* 4. When the library sends "sb-editor-request-bootstrap", we respond with bootstrap data
|
|
273
|
+
* 5. We also send initial messages proactively in case the library sets up listeners late
|
|
274
|
+
*
|
|
275
|
+
* TESTING NOTE:
|
|
276
|
+
* Integration tests for this setup should verify:
|
|
277
|
+
* 1. The app successfully initializes and shows content
|
|
278
|
+
* 2. API calls are authenticated (tokens were passed correctly)
|
|
279
|
+
* 3. Real-time features work (socket connection established via peerId)
|
|
280
|
+
*/
|
|
281
|
+
await context.addInitScript((payload) => {
|
|
282
|
+
const { initData: init, bootstrapData: bootstrap } = payload;
|
|
247
283
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* WHY THIS IS NECESSARY:
|
|
251
|
-
* The Superblocks library code (in @superblocksteam/library) expects to run inside an iframe
|
|
252
|
-
* embedded by the Superblocks editor. It uses `window.parent.postMessage()` to communicate
|
|
253
|
-
* with the editor and relies on `window.parent !== window` to detect the embedded state.
|
|
254
|
-
*
|
|
255
|
-
* When running in Playwright for E2E testing, there is no parent iframe - the page runs
|
|
256
|
-
* standalone. Without this mock, the library would:
|
|
257
|
-
* 1. Fail the `isEmbeddedBySuperblocksFirstParty()` check
|
|
258
|
-
* 2. Never receive the `sb-init` message needed to establish socket connections
|
|
259
|
-
* 3. Never receive the `sb-bootstrap-response` with auth tokens and app data
|
|
260
|
-
*
|
|
261
|
-
* HOW IT WORKS:
|
|
262
|
-
* 1. We override `window.parent` with a mock object BEFORE library code loads (via addInitScript)
|
|
263
|
-
* 2. The mock intercepts `postMessage` calls from the library
|
|
264
|
-
* 3. When the library sends "sb-ready", we respond with "sb-init" containing peerId/auth data
|
|
265
|
-
* 4. When the library sends "sb-editor-request-bootstrap", we respond with bootstrap data
|
|
266
|
-
* 5. We also send initial messages proactively in case the library sets up listeners late
|
|
284
|
+
* Capture embed events emitted by apps via @superblocksteam/library:
|
|
285
|
+
* useEmitEmbedEvent() -> embedStore.emitEvent() -> window.parent.postMessage({ type: "embed-emit-event" })
|
|
267
286
|
*
|
|
268
|
-
*
|
|
269
|
-
* - If the library changes how it detects parent window embedding (e.g., different checks)
|
|
270
|
-
* - If the message types or payload shapes change in the library
|
|
271
|
-
* - If the library adds additional security checks (e.g., origin verification on parent)
|
|
272
|
-
* - If timing changes require different setTimeout delays
|
|
273
|
-
*
|
|
274
|
-
* TESTING NOTE:
|
|
275
|
-
* Integration tests for this setup should verify:
|
|
276
|
-
* 1. The app successfully initializes and shows content
|
|
277
|
-
* 2. API calls are authenticated (tokens were passed correctly)
|
|
278
|
-
* 3. Real-time features work (socket connection established via peerId)
|
|
287
|
+
* We store them on the window so the MCP server can drain them and attach to test steps.
|
|
279
288
|
*/
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
289
|
+
const EMBED_EVENTS_KEY = "__sb_embed_events__";
|
|
290
|
+
window[EMBED_EVENTS_KEY] =
|
|
291
|
+
window[EMBED_EVENTS_KEY] ?? [];
|
|
292
|
+
window.__sbGetAndClearEmbedEvents = () => {
|
|
293
|
+
const events = Array.isArray(window[EMBED_EVENTS_KEY])
|
|
294
|
+
? window[EMBED_EVENTS_KEY]
|
|
295
|
+
: [];
|
|
296
|
+
window[EMBED_EVENTS_KEY] = [];
|
|
297
|
+
return events;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Mock parent window object that intercepts postMessage calls from the library.
|
|
301
|
+
* When the app sends messages expecting a parent response, we handle them here.
|
|
302
|
+
*/
|
|
303
|
+
const mockParent = {
|
|
304
|
+
postMessage: (message, _targetOrigin) => {
|
|
305
|
+
// Record third-party embed events emitted by the app.
|
|
306
|
+
if (message?.type === "embed-emit-event") {
|
|
307
|
+
window[EMBED_EVENTS_KEY].push({
|
|
308
|
+
timestamp: Date.now(),
|
|
309
|
+
eventName: message?.payload?.eventName,
|
|
310
|
+
payload: message?.payload?.payload,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
// When the app sends sb-ready, we respond with sb-init
|
|
314
|
+
// This triggers the library to establish its socket connection
|
|
315
|
+
if (message?.type === "sb-ready" && init) {
|
|
316
|
+
setTimeout(() => {
|
|
317
|
+
window.postMessage({
|
|
318
|
+
type: "sb-init",
|
|
319
|
+
payload: {
|
|
320
|
+
peerId: init.peerId,
|
|
321
|
+
userId: init.userId,
|
|
322
|
+
devServerAuthorization: init.devServerAuthorization,
|
|
323
|
+
appId: init.appId,
|
|
324
|
+
windowOriginUrl: init.windowOriginUrl,
|
|
325
|
+
},
|
|
326
|
+
startTime: Date.now(),
|
|
327
|
+
}, "*");
|
|
328
|
+
}, 10);
|
|
329
|
+
}
|
|
330
|
+
// When the app sends sb-editor-request-bootstrap, we respond with bootstrap data
|
|
331
|
+
// This provides auth tokens and configuration needed by the API manager
|
|
332
|
+
if (message?.type === "sb-editor-request-bootstrap" && bootstrap) {
|
|
333
|
+
setTimeout(() => {
|
|
334
|
+
window.postMessage({
|
|
335
|
+
type: "sb-bootstrap-response",
|
|
336
|
+
payload: bootstrap,
|
|
337
|
+
startTime: Date.now(),
|
|
338
|
+
}, "*");
|
|
339
|
+
}, 10);
|
|
340
|
+
}
|
|
341
|
+
// When the app sends authenticate-api-request, we respond with resolve-promise
|
|
342
|
+
// This allows API calls to proceed in test mode without actual auth
|
|
343
|
+
if (message?.type === "authenticate-api-request") {
|
|
344
|
+
const { callbackId } = message.payload || {};
|
|
345
|
+
if (callbackId) {
|
|
308
346
|
setTimeout(() => {
|
|
309
347
|
window.postMessage({
|
|
310
|
-
type: "
|
|
311
|
-
|
|
312
|
-
|
|
348
|
+
type: "resolve-promise",
|
|
349
|
+
callbackId,
|
|
350
|
+
payload: {}, // Empty success result - no auth errors
|
|
313
351
|
}, "*");
|
|
314
352
|
}, 10);
|
|
315
353
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
// These properties make the mock look like a real window object
|
|
357
|
+
// which helps pass any instanceof or property existence checks
|
|
358
|
+
window: window,
|
|
359
|
+
document: document,
|
|
360
|
+
location: window.location,
|
|
361
|
+
};
|
|
362
|
+
// Override window.parent to point to our mock
|
|
363
|
+
// This must happen before the library code runs (hence addInitScript)
|
|
364
|
+
Object.defineProperty(window, "parent", {
|
|
365
|
+
value: mockParent,
|
|
366
|
+
writable: false,
|
|
367
|
+
configurable: true,
|
|
368
|
+
});
|
|
369
|
+
// Send initial messages proactively after a delay
|
|
370
|
+
// This handles the case where the library sets up listeners after checking window.parent
|
|
371
|
+
if (init) {
|
|
372
|
+
setTimeout(() => {
|
|
373
|
+
window.postMessage({
|
|
374
|
+
type: "sb-init",
|
|
375
|
+
payload: {
|
|
376
|
+
peerId: init.peerId,
|
|
377
|
+
userId: init.userId,
|
|
378
|
+
devServerAuthorization: init.devServerAuthorization,
|
|
379
|
+
appId: init.appId,
|
|
380
|
+
windowOriginUrl: init.windowOriginUrl,
|
|
381
|
+
},
|
|
382
|
+
startTime: Date.now(),
|
|
383
|
+
}, "*");
|
|
384
|
+
}, 100);
|
|
385
|
+
}
|
|
386
|
+
if (bootstrap) {
|
|
387
|
+
setTimeout(() => {
|
|
388
|
+
window.postMessage({
|
|
389
|
+
type: "sb-bootstrap-response",
|
|
390
|
+
payload: bootstrap,
|
|
391
|
+
startTime: Date.now(),
|
|
392
|
+
}, "*");
|
|
393
|
+
}, 200);
|
|
394
|
+
// Send sb-global-sync with profiles data for API execution
|
|
395
|
+
// This sets superblocksContext.profiles which is needed for profileId
|
|
396
|
+
if (bootstrap.profiles) {
|
|
347
397
|
setTimeout(() => {
|
|
348
398
|
window.postMessage({
|
|
349
|
-
type: "sb-
|
|
399
|
+
type: "sb-global-sync",
|
|
350
400
|
payload: {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
appId: init.appId,
|
|
355
|
-
windowOriginUrl: init.windowOriginUrl,
|
|
401
|
+
global: {
|
|
402
|
+
profiles: bootstrap.profiles,
|
|
403
|
+
},
|
|
356
404
|
},
|
|
357
405
|
startTime: Date.now(),
|
|
358
406
|
}, "*");
|
|
359
|
-
},
|
|
360
|
-
}
|
|
361
|
-
if (bootstrap) {
|
|
362
|
-
setTimeout(() => {
|
|
363
|
-
window.postMessage({
|
|
364
|
-
type: "sb-bootstrap-response",
|
|
365
|
-
payload: bootstrap,
|
|
366
|
-
startTime: Date.now(),
|
|
367
|
-
}, "*");
|
|
368
|
-
}, 200);
|
|
369
|
-
// Send sb-global-sync with profiles data for API execution
|
|
370
|
-
// This sets superblocksContext.profiles which is needed for profileId
|
|
371
|
-
if (bootstrap.profiles) {
|
|
372
|
-
setTimeout(() => {
|
|
373
|
-
window.postMessage({
|
|
374
|
-
type: "sb-global-sync",
|
|
375
|
-
payload: {
|
|
376
|
-
global: {
|
|
377
|
-
profiles: bootstrap.profiles,
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
startTime: Date.now(),
|
|
381
|
-
}, "*");
|
|
382
|
-
}, 300);
|
|
383
|
-
}
|
|
407
|
+
}, 300);
|
|
384
408
|
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
409
|
+
}
|
|
410
|
+
}, {
|
|
411
|
+
initData,
|
|
412
|
+
bootstrapData,
|
|
413
|
+
});
|
|
390
414
|
// Seed a cookie/localStorage with JWT for app domain if provided
|
|
391
415
|
if (options?.jwt && options?.appUrl) {
|
|
392
416
|
try {
|
|
@@ -739,6 +763,9 @@ ACTIONS:
|
|
|
739
763
|
- reload: Reload the page. No params.
|
|
740
764
|
- navigate: Go to URL. Params: { url: string }
|
|
741
765
|
- getConsoleLogs: Get browser console logs. Params: { clear?: boolean }
|
|
766
|
+
- getEmbedEvents: Get the most recent embed events emitted by the app. Params: { }
|
|
767
|
+
- triggerEmbedEvent: Trigger an incoming embed event as if sent by the embedder. Params: { eventName: string, payload?: object }
|
|
768
|
+
- setEmbedProperties: Set embed properties as if sent by the embedder. Params: { properties: object }
|
|
742
769
|
- scroll: Scroll the page. Params: { x?: number, y?: number, deltaX?: number, deltaY?: number }
|
|
743
770
|
- scrollIntoView: Scroll element into view. Params: { selector: string }
|
|
744
771
|
- checkRuntimeErrors: Explicitly check for component crashes. No params.
|
|
@@ -811,6 +838,20 @@ TIPS:
|
|
|
811
838
|
type: "boolean",
|
|
812
839
|
description: "Clear logs after retrieving (for 'getConsoleLogs' action)",
|
|
813
840
|
},
|
|
841
|
+
eventName: {
|
|
842
|
+
type: "string",
|
|
843
|
+
description: "Embed event name to trigger (for 'triggerEmbedEvent' action)",
|
|
844
|
+
},
|
|
845
|
+
payload: {
|
|
846
|
+
type: "object",
|
|
847
|
+
description: "Optional payload to send with the embed event (for 'triggerEmbedEvent' action)",
|
|
848
|
+
additionalProperties: true,
|
|
849
|
+
},
|
|
850
|
+
properties: {
|
|
851
|
+
type: "object",
|
|
852
|
+
description: "Embed properties to set (for 'setEmbedProperties' action)",
|
|
853
|
+
additionalProperties: true,
|
|
854
|
+
},
|
|
814
855
|
x: {
|
|
815
856
|
type: "number",
|
|
816
857
|
description: "Absolute horizontal scroll position in pixels (for 'scroll' action)",
|
|
@@ -959,6 +1000,21 @@ async function captureScreenshot(page) {
|
|
|
959
1000
|
format: "png",
|
|
960
1001
|
};
|
|
961
1002
|
}
|
|
1003
|
+
async function drainEmbedEvents(page) {
|
|
1004
|
+
try {
|
|
1005
|
+
const events = await page.evaluate(() => {
|
|
1006
|
+
return window.__sbGetAndClearEmbedEvents?.() ?? null;
|
|
1007
|
+
});
|
|
1008
|
+
if (Array.isArray(events) && events.length > 0) {
|
|
1009
|
+
lastDrainedEmbedEvents = events;
|
|
1010
|
+
return events;
|
|
1011
|
+
}
|
|
1012
|
+
return null;
|
|
1013
|
+
}
|
|
1014
|
+
catch {
|
|
1015
|
+
return null;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
962
1018
|
async function executePlaywrightAction(action, page, params) {
|
|
963
1019
|
switch (action) {
|
|
964
1020
|
case "navigate": {
|
|
@@ -973,6 +1029,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
973
1029
|
});
|
|
974
1030
|
// Auto-capture screenshot after navigation
|
|
975
1031
|
const screenshot = await captureScreenshot(page);
|
|
1032
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
976
1033
|
// Check for runtime errors (component crashes)
|
|
977
1034
|
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
978
1035
|
return {
|
|
@@ -983,6 +1040,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
983
1040
|
format: screenshot.format,
|
|
984
1041
|
context: {
|
|
985
1042
|
url,
|
|
1043
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
986
1044
|
},
|
|
987
1045
|
...(runtimeErrors.hasErrors && {
|
|
988
1046
|
runtimeErrors: runtimeErrors.errors,
|
|
@@ -1000,6 +1058,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1000
1058
|
catch {
|
|
1001
1059
|
// Ignore screenshot errors
|
|
1002
1060
|
}
|
|
1061
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1003
1062
|
return {
|
|
1004
1063
|
success: false,
|
|
1005
1064
|
action: "navigate",
|
|
@@ -1008,6 +1067,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1008
1067
|
format: errorScreenshot?.format ?? "png",
|
|
1009
1068
|
context: {
|
|
1010
1069
|
url,
|
|
1070
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1011
1071
|
},
|
|
1012
1072
|
error: `Navigation to ${url} failed: ${String(error)}`,
|
|
1013
1073
|
};
|
|
@@ -1024,6 +1084,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1024
1084
|
.click({ timeout: params.timeout ?? 10000 });
|
|
1025
1085
|
// Auto-capture screenshot after action
|
|
1026
1086
|
const screenshot = await captureScreenshot(page);
|
|
1087
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1027
1088
|
// Check for runtime errors (component crashes)
|
|
1028
1089
|
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1029
1090
|
return {
|
|
@@ -1034,6 +1095,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1034
1095
|
format: screenshot.format,
|
|
1035
1096
|
context: {
|
|
1036
1097
|
selector,
|
|
1098
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1037
1099
|
},
|
|
1038
1100
|
...(runtimeErrors.hasErrors && {
|
|
1039
1101
|
runtimeErrors: runtimeErrors.errors,
|
|
@@ -1050,6 +1112,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1050
1112
|
catch {
|
|
1051
1113
|
// Ignore screenshot errors
|
|
1052
1114
|
}
|
|
1115
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1053
1116
|
return {
|
|
1054
1117
|
success: false,
|
|
1055
1118
|
action: "click",
|
|
@@ -1058,6 +1121,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1058
1121
|
format: errorScreenshot?.format ?? "png",
|
|
1059
1122
|
context: {
|
|
1060
1123
|
selector,
|
|
1124
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1061
1125
|
},
|
|
1062
1126
|
error: `Click failed on "${selector}": ${String(error)}`,
|
|
1063
1127
|
};
|
|
@@ -1075,6 +1139,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1075
1139
|
.fill(value, { timeout: params.timeout ?? 10000 });
|
|
1076
1140
|
// Auto-capture screenshot after fill
|
|
1077
1141
|
const screenshot = await captureScreenshot(page);
|
|
1142
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1078
1143
|
// Check for runtime errors (component crashes)
|
|
1079
1144
|
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1080
1145
|
return {
|
|
@@ -1086,6 +1151,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1086
1151
|
context: {
|
|
1087
1152
|
selector,
|
|
1088
1153
|
value,
|
|
1154
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1089
1155
|
},
|
|
1090
1156
|
...(runtimeErrors.hasErrors && {
|
|
1091
1157
|
runtimeErrors: runtimeErrors.errors,
|
|
@@ -1102,6 +1168,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1102
1168
|
catch {
|
|
1103
1169
|
// Ignore screenshot errors
|
|
1104
1170
|
}
|
|
1171
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1105
1172
|
return {
|
|
1106
1173
|
success: false,
|
|
1107
1174
|
action: "fill",
|
|
@@ -1111,6 +1178,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1111
1178
|
context: {
|
|
1112
1179
|
selector,
|
|
1113
1180
|
value,
|
|
1181
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1114
1182
|
},
|
|
1115
1183
|
error: `Fill failed on "${selector}": ${String(error)}`,
|
|
1116
1184
|
};
|
|
@@ -1120,6 +1188,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1120
1188
|
const description = params.description || "Capture current state";
|
|
1121
1189
|
// Capture screenshot in WebP format for optimal compression
|
|
1122
1190
|
const screenshot = await captureScreenshot(page);
|
|
1191
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1123
1192
|
return {
|
|
1124
1193
|
success: true,
|
|
1125
1194
|
action: "screenshot",
|
|
@@ -1128,6 +1197,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1128
1197
|
format: screenshot.format,
|
|
1129
1198
|
context: {
|
|
1130
1199
|
fullPage: Boolean(params.fullPage),
|
|
1200
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1131
1201
|
},
|
|
1132
1202
|
};
|
|
1133
1203
|
}
|
|
@@ -1199,6 +1269,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1199
1269
|
}
|
|
1200
1270
|
// Auto-capture screenshot after evaluation
|
|
1201
1271
|
const screenshot = await captureScreenshot(page);
|
|
1272
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1202
1273
|
// Check for runtime errors (component crashes)
|
|
1203
1274
|
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1204
1275
|
return {
|
|
@@ -1210,6 +1281,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1210
1281
|
format: screenshot.format,
|
|
1211
1282
|
context: {
|
|
1212
1283
|
script: script.substring(0, 100) + (script.length > 100 ? "..." : ""),
|
|
1284
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1213
1285
|
},
|
|
1214
1286
|
...(runtimeErrors.hasErrors && {
|
|
1215
1287
|
runtimeErrors: runtimeErrors.errors,
|
|
@@ -1226,6 +1298,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1226
1298
|
catch {
|
|
1227
1299
|
// Ignore screenshot errors
|
|
1228
1300
|
}
|
|
1301
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1229
1302
|
// If the error looks like a syntax error, provide helpful guidance
|
|
1230
1303
|
const errorMsg = String(error);
|
|
1231
1304
|
if (errorMsg.includes("SyntaxError") ||
|
|
@@ -1239,6 +1312,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1239
1312
|
format: errorScreenshot?.format ?? "png",
|
|
1240
1313
|
context: {
|
|
1241
1314
|
script: script.substring(0, 100) + (script.length > 100 ? "..." : ""),
|
|
1315
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1242
1316
|
},
|
|
1243
1317
|
error: "JavaScript evaluation failed. Make sure your code is browser-compatible " +
|
|
1244
1318
|
"(no import/export statements). Error: " +
|
|
@@ -1253,6 +1327,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1253
1327
|
format: errorScreenshot?.format ?? "png",
|
|
1254
1328
|
context: {
|
|
1255
1329
|
script: script.substring(0, 100) + (script.length > 100 ? "..." : ""),
|
|
1330
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1256
1331
|
},
|
|
1257
1332
|
error: String(error),
|
|
1258
1333
|
};
|
|
@@ -1280,6 +1355,150 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1280
1355
|
count: logs.length,
|
|
1281
1356
|
};
|
|
1282
1357
|
}
|
|
1358
|
+
case "getEmbedEvents": {
|
|
1359
|
+
const description = params.description || "Get embed events";
|
|
1360
|
+
const events = lastDrainedEmbedEvents ?? (await drainEmbedEvents(page)) ?? [];
|
|
1361
|
+
lastDrainedEmbedEvents = null;
|
|
1362
|
+
const screenshot = await captureScreenshot(page);
|
|
1363
|
+
// Check for runtime errors (component crashes)
|
|
1364
|
+
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1365
|
+
return {
|
|
1366
|
+
success: !runtimeErrors.hasErrors,
|
|
1367
|
+
action: "getEmbedEvents",
|
|
1368
|
+
description,
|
|
1369
|
+
screenshot: screenshot.data,
|
|
1370
|
+
format: screenshot.format,
|
|
1371
|
+
events,
|
|
1372
|
+
count: events.length,
|
|
1373
|
+
...(runtimeErrors.hasErrors && {
|
|
1374
|
+
runtimeErrors: runtimeErrors.errors,
|
|
1375
|
+
error: `Component crashed with ${runtimeErrors.errors.length} runtime error(s): ${runtimeErrors.errors.map((e) => e.header).join(", ")}`,
|
|
1376
|
+
}),
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
case "triggerEmbedEvent": {
|
|
1380
|
+
const description = params.description || "Trigger embed event";
|
|
1381
|
+
const eventName = params.eventName;
|
|
1382
|
+
const payload = params.payload ?? {};
|
|
1383
|
+
if (typeof eventName !== "string" || !eventName.trim()) {
|
|
1384
|
+
throw new Error("Missing eventName for triggerEmbedEvent action");
|
|
1385
|
+
}
|
|
1386
|
+
try {
|
|
1387
|
+
// Simulate the embedder sending a message into the iframe.
|
|
1388
|
+
// The library converts this to a CustomEvent `superblocks:${eventName}`,
|
|
1389
|
+
// which is what `useEmbedEvent()` listens to.
|
|
1390
|
+
await page.evaluate(({ eventName, payload }) => {
|
|
1391
|
+
window.postMessage({
|
|
1392
|
+
type: "embed-trigger-event",
|
|
1393
|
+
payload: { eventName, payload },
|
|
1394
|
+
startTime: Date.now(),
|
|
1395
|
+
}, "*");
|
|
1396
|
+
}, { eventName, payload });
|
|
1397
|
+
await page.waitForTimeout(50);
|
|
1398
|
+
const screenshot = await captureScreenshot(page);
|
|
1399
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1400
|
+
// Check for runtime errors (component crashes)
|
|
1401
|
+
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1402
|
+
return {
|
|
1403
|
+
success: !runtimeErrors.hasErrors,
|
|
1404
|
+
action: "triggerEmbedEvent",
|
|
1405
|
+
description,
|
|
1406
|
+
screenshot: screenshot.data,
|
|
1407
|
+
format: screenshot.format,
|
|
1408
|
+
context: {
|
|
1409
|
+
eventName,
|
|
1410
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1411
|
+
},
|
|
1412
|
+
...(runtimeErrors.hasErrors && {
|
|
1413
|
+
runtimeErrors: runtimeErrors.errors,
|
|
1414
|
+
error: `Component crashed with ${runtimeErrors.errors.length} runtime error(s): ${runtimeErrors.errors.map((e) => e.header).join(", ")}`,
|
|
1415
|
+
}),
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
catch (error) {
|
|
1419
|
+
let errorScreenshot = null;
|
|
1420
|
+
try {
|
|
1421
|
+
errorScreenshot = await captureScreenshot(page);
|
|
1422
|
+
}
|
|
1423
|
+
catch {
|
|
1424
|
+
// Ignore screenshot errors
|
|
1425
|
+
}
|
|
1426
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1427
|
+
return {
|
|
1428
|
+
success: false,
|
|
1429
|
+
action: "triggerEmbedEvent",
|
|
1430
|
+
description,
|
|
1431
|
+
screenshot: errorScreenshot?.data,
|
|
1432
|
+
format: errorScreenshot?.format ?? "png",
|
|
1433
|
+
context: {
|
|
1434
|
+
eventName,
|
|
1435
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1436
|
+
},
|
|
1437
|
+
error: `triggerEmbedEvent failed for "${eventName}": ${String(error)}`,
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
case "setEmbedProperties": {
|
|
1442
|
+
const description = params.description || "Set embed properties";
|
|
1443
|
+
const properties = params.properties;
|
|
1444
|
+
if (!properties || typeof properties !== "object") {
|
|
1445
|
+
throw new Error("Missing properties for setEmbedProperties action");
|
|
1446
|
+
}
|
|
1447
|
+
try {
|
|
1448
|
+
// Simulate the embedder sending embed properties into the iframe.
|
|
1449
|
+
// The library listens for "embed-property-change" and updates embedStore.properties,
|
|
1450
|
+
// which is what `useEmbedProperties()` reads.
|
|
1451
|
+
await page.evaluate(({ properties }) => {
|
|
1452
|
+
window.postMessage({
|
|
1453
|
+
type: "embed-property-change",
|
|
1454
|
+
payload: { properties },
|
|
1455
|
+
startTime: Date.now(),
|
|
1456
|
+
}, "*");
|
|
1457
|
+
}, { properties });
|
|
1458
|
+
await page.waitForTimeout(50);
|
|
1459
|
+
const screenshot = await captureScreenshot(page);
|
|
1460
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1461
|
+
// Check for runtime errors (component crashes)
|
|
1462
|
+
const runtimeErrors = await checkForRuntimeErrors(page);
|
|
1463
|
+
return {
|
|
1464
|
+
success: !runtimeErrors.hasErrors,
|
|
1465
|
+
action: "setEmbedProperties",
|
|
1466
|
+
description,
|
|
1467
|
+
screenshot: screenshot.data,
|
|
1468
|
+
format: screenshot.format,
|
|
1469
|
+
context: {
|
|
1470
|
+
properties,
|
|
1471
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1472
|
+
},
|
|
1473
|
+
...(runtimeErrors.hasErrors && {
|
|
1474
|
+
runtimeErrors: runtimeErrors.errors,
|
|
1475
|
+
error: `Component crashed with ${runtimeErrors.errors.length} runtime error(s): ${runtimeErrors.errors.map((e) => e.header).join(", ")}`,
|
|
1476
|
+
}),
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
catch (error) {
|
|
1480
|
+
let errorScreenshot = null;
|
|
1481
|
+
try {
|
|
1482
|
+
errorScreenshot = await captureScreenshot(page);
|
|
1483
|
+
}
|
|
1484
|
+
catch {
|
|
1485
|
+
// Ignore screenshot errors
|
|
1486
|
+
}
|
|
1487
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1488
|
+
return {
|
|
1489
|
+
success: false,
|
|
1490
|
+
action: "setEmbedProperties",
|
|
1491
|
+
description,
|
|
1492
|
+
screenshot: errorScreenshot?.data,
|
|
1493
|
+
format: errorScreenshot?.format ?? "png",
|
|
1494
|
+
context: {
|
|
1495
|
+
properties,
|
|
1496
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1497
|
+
},
|
|
1498
|
+
error: `setEmbedProperties failed: ${String(error)}`,
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1283
1502
|
case "scroll": {
|
|
1284
1503
|
const { x, y, deltaX, deltaY } = params;
|
|
1285
1504
|
const description = params.description || "Scroll page";
|
|
@@ -1293,6 +1512,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1293
1512
|
}
|
|
1294
1513
|
}, { x, y, deltaX, deltaY });
|
|
1295
1514
|
const screenshot = await captureScreenshot(page);
|
|
1515
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1296
1516
|
return {
|
|
1297
1517
|
success: true,
|
|
1298
1518
|
action: "scroll",
|
|
@@ -1304,6 +1524,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1304
1524
|
y,
|
|
1305
1525
|
deltaX,
|
|
1306
1526
|
deltaY,
|
|
1527
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1307
1528
|
},
|
|
1308
1529
|
};
|
|
1309
1530
|
}
|
|
@@ -1315,6 +1536,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1315
1536
|
catch {
|
|
1316
1537
|
// Ignore screenshot errors
|
|
1317
1538
|
}
|
|
1539
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1318
1540
|
return {
|
|
1319
1541
|
success: false,
|
|
1320
1542
|
action: "scroll",
|
|
@@ -1326,6 +1548,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1326
1548
|
y,
|
|
1327
1549
|
deltaX,
|
|
1328
1550
|
deltaY,
|
|
1551
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1329
1552
|
},
|
|
1330
1553
|
error: `Scroll failed: ${String(error)}`,
|
|
1331
1554
|
};
|
|
@@ -1342,6 +1565,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1342
1565
|
timeout: params.timeout ?? 10000,
|
|
1343
1566
|
});
|
|
1344
1567
|
const screenshot = await captureScreenshot(page);
|
|
1568
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1345
1569
|
return {
|
|
1346
1570
|
success: true,
|
|
1347
1571
|
action: "scrollIntoView",
|
|
@@ -1350,6 +1574,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1350
1574
|
format: screenshot.format,
|
|
1351
1575
|
context: {
|
|
1352
1576
|
selector,
|
|
1577
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1353
1578
|
},
|
|
1354
1579
|
};
|
|
1355
1580
|
}
|
|
@@ -1361,6 +1586,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1361
1586
|
catch {
|
|
1362
1587
|
// Ignore screenshot errors
|
|
1363
1588
|
}
|
|
1589
|
+
const embedEvents = await drainEmbedEvents(page);
|
|
1364
1590
|
return {
|
|
1365
1591
|
success: false,
|
|
1366
1592
|
action: "scrollIntoView",
|
|
@@ -1369,6 +1595,7 @@ async function executePlaywrightAction(action, page, params) {
|
|
|
1369
1595
|
format: errorScreenshot?.format ?? "png",
|
|
1370
1596
|
context: {
|
|
1371
1597
|
selector,
|
|
1598
|
+
...(embedEvents ? { embedEvents } : {}),
|
|
1372
1599
|
},
|
|
1373
1600
|
error: `scrollIntoView failed on "${selector}": ${String(error)}`,
|
|
1374
1601
|
};
|