@engenty/wizards-runtime 0.0.0-stage → 0.7.5
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/LICENSE +110 -0
- package/README.md +214 -2
- package/apps/runtime/dist/agents/architect.js +444 -0
- package/apps/runtime/dist/agents/studio-assistant.js +883 -0
- package/apps/runtime/dist/agents/subscription.js +207 -0
- package/apps/runtime/dist/agents/thought.js +21 -0
- package/apps/runtime/dist/agents/website.js +480 -0
- package/apps/runtime/dist/app.js +359 -0
- package/apps/runtime/dist/apple/wizards-apple +0 -0
- package/apps/runtime/dist/assistant/browser.js +26 -0
- package/apps/runtime/dist/assistant/docs.js +158 -0
- package/apps/runtime/dist/assistant/knows.js +353 -0
- package/apps/runtime/dist/assistant/primer.js +26 -0
- package/apps/runtime/dist/assistant/runs.js +24 -0
- package/apps/runtime/dist/auth/account.js +175 -0
- package/apps/runtime/dist/auth/device.js +112 -0
- package/apps/runtime/dist/auth/index.js +358 -0
- package/apps/runtime/dist/auth/keys.js +55 -0
- package/apps/runtime/dist/auth/local-ticket.js +26 -0
- package/apps/runtime/dist/authoring/example.js +74 -0
- package/apps/runtime/dist/authoring/guide.js +433 -0
- package/apps/runtime/dist/authoring/ops.js +117 -0
- package/apps/runtime/dist/browser/fast/action-space.js +160 -0
- package/apps/runtime/dist/browser/fast/classifier.js +91 -0
- package/apps/runtime/dist/browser/fast/decide.js +171 -0
- package/apps/runtime/dist/browser/fast/driver.js +141 -0
- package/apps/runtime/dist/browser/fast/instructions.js +33 -0
- package/apps/runtime/dist/browser/fast/run.js +249 -0
- package/apps/runtime/dist/browser/fast/span-picker.js +153 -0
- package/apps/runtime/dist/browser/fast/text-helper.js +178 -0
- package/apps/runtime/dist/browser/snapshot.js +335 -0
- package/apps/runtime/dist/cli/account.js +385 -0
- package/apps/runtime/dist/cli/autostart.js +182 -0
- package/apps/runtime/dist/cli/autoupdate.js +221 -0
- package/apps/runtime/dist/cli/clients.js +44 -0
- package/apps/runtime/dist/cli/connect.js +540 -0
- package/apps/runtime/dist/cli/environment.js +93 -0
- package/apps/runtime/dist/cli/exec.js +45 -0
- package/apps/runtime/dist/cli/features.js +50 -0
- package/apps/runtime/dist/cli/home.js +88 -0
- package/apps/runtime/dist/cli/install-env.js +33 -0
- package/apps/runtime/dist/cli/machine.js +107 -0
- package/apps/runtime/dist/cli/main.js +222 -0
- package/apps/runtime/dist/cli/mcp.js +136 -0
- package/apps/runtime/dist/cli/menu.js +202 -0
- package/apps/runtime/dist/cli/processes.js +72 -0
- package/apps/runtime/dist/cli/report.js +66 -0
- package/apps/runtime/dist/cli/setup.js +335 -0
- package/apps/runtime/dist/cli/start.js +276 -0
- package/apps/runtime/dist/cli/status.js +203 -0
- package/apps/runtime/dist/cli/ui.js +59 -0
- package/apps/runtime/dist/cli/uninstall-main.js +20 -0
- package/apps/runtime/dist/cli/uninstall.js +231 -0
- package/apps/runtime/dist/cli/update.js +86 -0
- package/apps/runtime/dist/cli/validate.js +75 -0
- package/apps/runtime/dist/cli/versions.js +123 -0
- package/apps/runtime/dist/connectors/builtin.js +86 -0
- package/apps/runtime/dist/connectors/external.js +409 -0
- package/apps/runtime/dist/connectors/gmail.js +107 -0
- package/apps/runtime/dist/connectors/imap.js +261 -0
- package/apps/runtime/dist/connectors/index.js +325 -0
- package/apps/runtime/dist/connectors/mail.js +72 -0
- package/apps/runtime/dist/connectors/outlook.js +90 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +343 -0
- package/apps/runtime/dist/connectors/via-account.js +65 -0
- package/apps/runtime/dist/credits/credits.js +100 -0
- package/apps/runtime/dist/credits/estimate.js +152 -0
- package/apps/runtime/dist/db/adopt.js +149 -0
- package/apps/runtime/dist/db/client.js +173 -0
- package/apps/runtime/dist/db/control-schema.js +133 -0
- package/apps/runtime/dist/db/migrations/control/0000_last_absorbing_man.sql +47 -0
- package/apps/runtime/dist/db/migrations/control/0001_gorgeous_nicolaos.sql +41 -0
- package/apps/runtime/dist/db/migrations/control/0002_secret_penance.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0003_nasty_mordo.sql +3 -0
- package/apps/runtime/dist/db/migrations/control/0004_breezy_eddie_brock.sql +6 -0
- package/apps/runtime/dist/db/migrations/control/0005_chilly_oracle.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0006_sleepy_mojo.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0007_common_the_hand.sql +15 -0
- package/apps/runtime/dist/db/migrations/control/0008_runner.sql +8 -0
- package/apps/runtime/dist/db/migrations/control/0009_plugin_claim.sql +9 -0
- package/apps/runtime/dist/db/migrations/control/0010_tan_snowbird.sql +6 -0
- package/apps/runtime/dist/db/migrations/control/meta/0000_snapshot.json +311 -0
- package/apps/runtime/dist/db/migrations/control/meta/0001_snapshot.json +599 -0
- package/apps/runtime/dist/db/migrations/control/meta/0002_snapshot.json +607 -0
- package/apps/runtime/dist/db/migrations/control/meta/0003_snapshot.json +311 -0
- package/apps/runtime/dist/db/migrations/control/meta/0004_snapshot.json +350 -0
- package/apps/runtime/dist/db/migrations/control/meta/0005_snapshot.json +358 -0
- package/apps/runtime/dist/db/migrations/control/meta/0006_snapshot.json +365 -0
- package/apps/runtime/dist/db/migrations/control/meta/0007_snapshot.json +460 -0
- package/apps/runtime/dist/db/migrations/control/meta/0008_snapshot.json +505 -0
- package/apps/runtime/dist/db/migrations/control/meta/0009_snapshot.json +561 -0
- package/apps/runtime/dist/db/migrations/control/meta/0010_snapshot.json +600 -0
- package/apps/runtime/dist/db/migrations/control/meta/_journal.json +83 -0
- package/apps/runtime/dist/db/migrations/tenant/0000_eminent_freak.sql +188 -0
- package/apps/runtime/dist/db/migrations/tenant/0001_salty_master_chief.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0002_cloudy_firebird.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0003_brown_warbound.sql +52 -0
- package/apps/runtime/dist/db/migrations/tenant/0004_romantic_nocturne.sql +6 -0
- package/apps/runtime/dist/db/migrations/tenant/0005_reflective_forgotten_one.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0006_hard_war_machine.sql +30 -0
- package/apps/runtime/dist/db/migrations/tenant/0007_space_data.sql +43 -0
- package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0009_knowledge.sql +104 -0
- package/apps/runtime/dist/db/migrations/tenant/0010_plugin_connection.sql +15 -0
- package/apps/runtime/dist/db/migrations/tenant/0011_runners.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0012_assistant_chat.sql +40 -0
- package/apps/runtime/dist/db/migrations/tenant/0013_run_origin.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0014_run_answer.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0015_device_calls.sql +13 -0
- package/apps/runtime/dist/db/migrations/tenant/0016_even_trish_tilby.sql +12 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0000_snapshot.json +1323 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0001_snapshot.json +1330 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0002_snapshot.json +1337 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0003_snapshot.json +1605 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0004_snapshot.json +1645 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0005_snapshot.json +1659 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0006_snapshot.json +1696 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0007_snapshot.json +2012 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +2019 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0009_snapshot.json +2837 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0010_snapshot.json +2942 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0011_snapshot.json +2956 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0012_snapshot.json +3132 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0013_snapshot.json +3139 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0014_snapshot.json +3154 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0015_snapshot.json +3243 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0016_snapshot.json +3326 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +125 -0
- package/apps/runtime/dist/db/schema.js +602 -0
- package/apps/runtime/dist/debug.js +196 -0
- package/apps/runtime/dist/docs/dev/index.md +41 -0
- package/apps/runtime/dist/docs/dev/meta.json +7 -0
- package/apps/runtime/dist/docs/dev/plugins/connections.md +74 -0
- package/apps/runtime/dist/docs/dev/plugins/events.md +89 -0
- package/apps/runtime/dist/docs/dev/plugins/examples.md +101 -0
- package/apps/runtime/dist/docs/dev/plugins/index.md +78 -0
- package/apps/runtime/dist/docs/dev/plugins/layout.md +90 -0
- package/apps/runtime/dist/docs/dev/plugins/meta.json +28 -0
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +94 -0
- package/apps/runtime/dist/docs/dev/plugins/reference.md +348 -0
- package/apps/runtime/dist/docs/dev/plugins/reloading.md +76 -0
- package/apps/runtime/dist/docs/dev/plugins/routes.md +185 -0
- package/apps/runtime/dist/docs/dev/plugins/runners.md +230 -0
- package/apps/runtime/dist/docs/dev/plugins/server.md +281 -0
- package/apps/runtime/dist/docs/dev/plugins/shipping.md +79 -0
- package/apps/runtime/dist/docs/dev/plugins/space.md +297 -0
- package/apps/runtime/dist/docs/dev/plugins/starters.md +70 -0
- package/apps/runtime/dist/docs/dev/plugins/studio.md +363 -0
- package/apps/runtime/dist/docs/dev/plugins/styling.md +129 -0
- package/apps/runtime/dist/docs/dev/plugins/tables.md +104 -0
- package/apps/runtime/dist/docs/dev/plugins/tools.md +139 -0
- package/apps/runtime/dist/docs/dev/wizard-format.md +125 -0
- package/apps/runtime/dist/docs/meta.json +3 -0
- package/apps/runtime/dist/docs/user/ai-apps.md +112 -0
- package/apps/runtime/dist/docs/user/assistant.md +77 -0
- package/apps/runtime/dist/docs/user/build-a-wizard.md +116 -0
- package/apps/runtime/dist/docs/user/command-line.md +83 -0
- package/apps/runtime/dist/docs/user/connectors.md +90 -0
- package/apps/runtime/dist/docs/user/create-account.md +52 -0
- package/apps/runtime/dist/docs/user/data.md +66 -0
- package/apps/runtime/dist/docs/user/first-start.md +60 -0
- package/apps/runtime/dist/docs/user/index.md +49 -0
- package/apps/runtime/dist/docs/user/install.md +123 -0
- package/apps/runtime/dist/docs/user/local-only.md +42 -0
- package/apps/runtime/dist/docs/user/meta.json +32 -0
- package/apps/runtime/dist/docs/user/models.md +156 -0
- package/apps/runtime/dist/docs/user/plugins.md +71 -0
- package/apps/runtime/dist/docs/user/run.md +98 -0
- package/apps/runtime/dist/docs/user/server.md +52 -0
- package/apps/runtime/dist/docs/user/space.md +126 -0
- package/apps/runtime/dist/docs/user/steps.md +220 -0
- package/apps/runtime/dist/docs/user/test-and-share.md +224 -0
- package/apps/runtime/dist/docs/user/troubleshooting.md +67 -0
- package/apps/runtime/dist/docs/user/wordpress.md +121 -0
- package/apps/runtime/dist/documents/parse.js +246 -0
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +193 -0
- package/apps/runtime/dist/engenty/connections-external/errors.js +11 -0
- package/apps/runtime/dist/engenty/connections-external/import-service.js +270 -0
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +34 -0
- package/apps/runtime/dist/engenty/connections-external/importer/map-auth.js +185 -0
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-mcp.js +63 -0
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-openapi.js +130 -0
- package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +143 -0
- package/apps/runtime/dist/engenty/connections-external/invoke/mcp-client.js +143 -0
- package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +119 -0
- package/apps/runtime/dist/engenty/connections-external/oauth-dcr.js +88 -0
- package/apps/runtime/dist/engenty/connections-external/registry-client.js +336 -0
- package/apps/runtime/dist/engenty/connections-external/registry-source.js +82 -0
- package/apps/runtime/dist/engenty/connections-external/types.js +7 -0
- package/apps/runtime/dist/engenty/connections-github/connector.js +209 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/calendar.js +381 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/contacts.js +94 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +290 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +567 -0
- package/apps/runtime/dist/engenty/connections-google/definitions.js +11 -0
- package/apps/runtime/dist/engenty/connections-google/shared.js +73 -0
- package/apps/runtime/dist/engenty/connections-hubspot/connector.js +140 -0
- package/apps/runtime/dist/engenty/connections-microsoft/action.js +17 -0
- package/apps/runtime/dist/engenty/connections-microsoft/graph.js +114 -0
- package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +286 -0
- package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +492 -0
- package/apps/runtime/dist/engenty/connections-s3/s3.js +328 -0
- package/apps/runtime/dist/engenty/connections-sdk/files-capability.js +86 -0
- package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +150 -0
- package/apps/runtime/dist/engenty/connections-sdk/registry.js +89 -0
- package/apps/runtime/dist/engenty/connections-sdk/storage-capability.js +84 -0
- package/apps/runtime/dist/engenty/connections-sdk/types.js +30 -0
- package/apps/runtime/dist/engenty/connections-slack/connector.js +360 -0
- package/apps/runtime/dist/engenty/csv-import/csv-matrix.js +178 -0
- package/apps/runtime/dist/engenty/csv-import/import-sources.js +87 -0
- package/apps/runtime/dist/engenty/csv-import/parse-csv.js +129 -0
- package/apps/runtime/dist/engenty/csv-import/serialize-csv.js +20 -0
- package/apps/runtime/dist/engenty/csv-import/types.js +1 -0
- package/apps/runtime/dist/engenty/csv-import/xlsx-workbook.js +159 -0
- package/apps/runtime/dist/engenty/doc-converter/interface.js +9 -0
- package/apps/runtime/dist/engenty/doc-converter/page-break.js +92 -0
- package/apps/runtime/dist/engenty/doc-converter/providers/local/index.js +72 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/classifier.js +30 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/index.js +4 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/invoice.js +73 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/receipt.js +63 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/shared.js +40 -0
- package/apps/runtime/dist/engenty/search-index/chunks.js +164 -0
- package/apps/runtime/dist/engenty/search-index/contracts.js +9 -0
- package/apps/runtime/dist/engenty/shims/connections-sdk.js +39 -0
- package/apps/runtime/dist/engenty/shims/plugin-sdk.js +1 -0
- package/apps/runtime/dist/engenty/shims/web-ingest.js +19 -0
- package/apps/runtime/dist/engenty/web-ingest/ssrf.js +277 -0
- package/apps/runtime/dist/engine/asks.js +82 -0
- package/apps/runtime/dist/engine/decide.js +82 -0
- package/apps/runtime/dist/engine/device.js +194 -0
- package/apps/runtime/dist/engine/events.js +128 -0
- package/apps/runtime/dist/engine/input.js +208 -0
- package/apps/runtime/dist/engine/owner.js +32 -0
- package/apps/runtime/dist/engine/prepare.js +90 -0
- package/apps/runtime/dist/engine/push.js +58 -0
- package/apps/runtime/dist/engine/requirements.js +355 -0
- package/apps/runtime/dist/engine/resources.js +198 -0
- package/apps/runtime/dist/engine/runner.js +970 -0
- package/apps/runtime/dist/engine/steps.js +1000 -0
- package/apps/runtime/dist/engine/surface.js +91 -0
- package/apps/runtime/dist/engine/template.js +240 -0
- package/apps/runtime/dist/engine/types.js +4 -0
- package/apps/runtime/dist/env.js +295 -0
- package/apps/runtime/dist/features.js +123 -0
- package/apps/runtime/dist/files/blobs.js +22 -0
- package/apps/runtime/dist/files/objects.js +86 -0
- package/apps/runtime/dist/files/storage.js +120 -0
- package/apps/runtime/dist/files/web-images.js +101 -0
- package/apps/runtime/dist/film/project.js +257 -0
- package/apps/runtime/dist/film/skills.js +91 -0
- package/apps/runtime/dist/film/sounds.js +122 -0
- package/apps/runtime/dist/film/step.js +289 -0
- package/apps/runtime/dist/film/tools.js +99 -0
- package/apps/runtime/dist/geocode.js +58 -0
- package/apps/runtime/dist/harness/antigravity.js +129 -0
- package/apps/runtime/dist/harness/apple.js +270 -0
- package/apps/runtime/dist/harness/claude.js +147 -0
- package/apps/runtime/dist/harness/codex.js +229 -0
- package/apps/runtime/dist/harness/cursor.js +93 -0
- package/apps/runtime/dist/harness/env.js +124 -0
- package/apps/runtime/dist/harness/index.js +95 -0
- package/apps/runtime/dist/harness/model.js +279 -0
- package/apps/runtime/dist/harness/prompt.js +121 -0
- package/apps/runtime/dist/harness/terminal.js +194 -0
- package/apps/runtime/dist/harness/types.js +7 -0
- package/apps/runtime/dist/index.js +113 -0
- package/apps/runtime/dist/limits.js +81 -0
- package/apps/runtime/dist/link-preview.js +60 -0
- package/apps/runtime/dist/log.js +106 -0
- package/apps/runtime/dist/manage.js +249 -0
- package/apps/runtime/dist/mcp/auth.js +161 -0
- package/apps/runtime/dist/mcp/bridge.js +59 -0
- package/apps/runtime/dist/mcp/flow-app.js +97 -0
- package/apps/runtime/dist/mcp/handler.js +54 -0
- package/apps/runtime/dist/mcp/scopes.js +14 -0
- package/apps/runtime/dist/mcp/seen.js +65 -0
- package/apps/runtime/dist/mcp/tools.js +572 -0
- package/apps/runtime/dist/media/conversation.js +167 -0
- package/apps/runtime/dist/media/ffmpeg.js +121 -0
- package/apps/runtime/dist/media/generate.js +120 -0
- package/apps/runtime/dist/media/marking.js +121 -0
- package/apps/runtime/dist/media/transcribe.js +198 -0
- package/apps/runtime/dist/model-errors.js +42 -0
- package/apps/runtime/dist/models.js +1164 -0
- package/apps/runtime/dist/plugin.js +61 -0
- package/apps/runtime/dist/plugins/channels.js +78 -0
- package/apps/runtime/dist/plugins/claims.js +56 -0
- package/apps/runtime/dist/plugins/discovery.js +155 -0
- package/apps/runtime/dist/plugins/events.js +63 -0
- package/apps/runtime/dist/plugins/jobs.js +64 -0
- package/apps/runtime/dist/plugins/loader.js +508 -0
- package/apps/runtime/dist/plugins/migrations.js +69 -0
- package/apps/runtime/dist/plugins/pro-keys.js +34 -0
- package/apps/runtime/dist/plugins/pro-state.js +83 -0
- package/apps/runtime/dist/plugins/pro.js +310 -0
- package/apps/runtime/dist/plugins/public.js +44 -0
- package/apps/runtime/dist/plugins/registry.js +122 -0
- package/apps/runtime/dist/plugins/runs.js +210 -0
- package/apps/runtime/dist/render/browser-path.js +54 -0
- package/apps/runtime/dist/render/chromium.js +98 -0
- package/apps/runtime/dist/render/convert.js +158 -0
- package/apps/runtime/dist/render/downloads.js +299 -0
- package/apps/runtime/dist/render/guard.js +25 -0
- package/apps/runtime/dist/render/shaped.js +137 -0
- package/apps/runtime/dist/routes/api.js +440 -0
- package/apps/runtime/dist/routes/debug.js +42 -0
- package/apps/runtime/dist/routes/delivery.js +90 -0
- package/apps/runtime/dist/routes/internal.js +81 -0
- package/apps/runtime/dist/routes/lang.js +25 -0
- package/apps/runtime/dist/routes/marketplace.js +43 -0
- package/apps/runtime/dist/routes/plugin-public.js +113 -0
- package/apps/runtime/dist/routes/plugins.js +212 -0
- package/apps/runtime/dist/routes/runs.js +1422 -0
- package/apps/runtime/dist/routes/studio.js +1629 -0
- package/apps/runtime/dist/routes/wizard-stream.js +30 -0
- package/apps/runtime/dist/running.js +39 -0
- package/apps/runtime/dist/sandbox/docker.js +75 -0
- package/apps/runtime/dist/sandbox/index.js +23 -0
- package/apps/runtime/dist/sandbox/types.js +1 -0
- package/apps/runtime/dist/secrets/crypto.js +28 -0
- package/apps/runtime/dist/secrets/signing.js +52 -0
- package/apps/runtime/dist/secrets/vault.js +59 -0
- package/apps/runtime/dist/services/access.js +88 -0
- package/apps/runtime/dist/services/api.js +248 -0
- package/apps/runtime/dist/services/architect.js +95 -0
- package/apps/runtime/dist/services/assistant-chats.js +311 -0
- package/apps/runtime/dist/services/brand.js +85 -0
- package/apps/runtime/dist/services/cloud.js +456 -0
- package/apps/runtime/dist/services/draft-events.js +27 -0
- package/apps/runtime/dist/services/engenty-shapes.js +71 -0
- package/apps/runtime/dist/services/errors.js +29 -0
- package/apps/runtime/dist/services/files.js +178 -0
- package/apps/runtime/dist/services/knowledge-model.js +559 -0
- package/apps/runtime/dist/services/knowledge.js +721 -0
- package/apps/runtime/dist/services/links.js +16 -0
- package/apps/runtime/dist/services/marketplace.js +492 -0
- package/apps/runtime/dist/services/onboarding.js +152 -0
- package/apps/runtime/dist/services/package-file.js +82 -0
- package/apps/runtime/dist/services/package.js +170 -0
- package/apps/runtime/dist/services/profile.js +51 -0
- package/apps/runtime/dist/services/project-files.js +439 -0
- package/apps/runtime/dist/services/project-index.js +707 -0
- package/apps/runtime/dist/services/projects.js +387 -0
- package/apps/runtime/dist/services/relevance.js +58 -0
- package/apps/runtime/dist/services/runners.js +178 -0
- package/apps/runtime/dist/services/runs.js +524 -0
- package/apps/runtime/dist/services/shares.js +130 -0
- package/apps/runtime/dist/services/site.js +270 -0
- package/apps/runtime/dist/services/space-categories.js +861 -0
- package/apps/runtime/dist/services/space-data.js +792 -0
- package/apps/runtime/dist/services/space-origin.js +207 -0
- package/apps/runtime/dist/services/spaces.js +656 -0
- package/apps/runtime/dist/services/translations.js +306 -0
- package/apps/runtime/dist/services/widgets.js +34 -0
- package/apps/runtime/dist/services/wizard-icon.js +157 -0
- package/apps/runtime/dist/services/wizards.js +420 -0
- package/apps/runtime/dist/settings.js +16 -0
- package/apps/runtime/dist/store/errors.js +4 -0
- package/apps/runtime/dist/store/index.js +299 -0
- package/apps/runtime/dist/store/shared-lists.js +123 -0
- package/apps/runtime/dist/tenants/control.js +238 -0
- package/apps/runtime/dist/tenants/tenant.js +26 -0
- package/apps/runtime/dist/texts.js +207 -0
- package/apps/runtime/dist/tools/browser.js +703 -0
- package/apps/runtime/dist/tools/connector.js +204 -0
- package/apps/runtime/dist/tools/index.js +291 -0
- package/apps/runtime/dist/tools/mail.js +104 -0
- package/apps/runtime/dist/tools/net-guard.js +170 -0
- package/apps/runtime/dist/tools/pages.js +81 -0
- package/apps/runtime/dist/tools/plugin.js +180 -0
- package/apps/runtime/dist/tools/project.js +154 -0
- package/apps/runtime/dist/tools/shared.js +69 -0
- package/apps/runtime/dist/tools/store.js +238 -0
- package/apps/runtime/dist/update.js +113 -0
- package/apps/runtime/dist/widgets/bundle.js +99 -0
- package/apps/runtime/dist/widgets/render.js +329 -0
- package/apps/runtime/dist/widgets/runtime.js +108 -0
- package/apps/runtime/dist/widgets/script.js +30 -0
- package/apps/runtime/dist/widgets/step.js +223 -0
- package/apps/web/dist/ai-labels/ai-black.svg +20 -0
- package/apps/web/dist/ai-labels/ai-generated-black.svg +31 -0
- package/apps/web/dist/ai-labels/ai-generated-white.svg +32 -0
- package/apps/web/dist/ai-labels/ai-modified-black.svg +30 -0
- package/apps/web/dist/ai-labels/ai-modified-white.svg +31 -0
- package/apps/web/dist/ai-labels/ai-white.svg +21 -0
- package/apps/web/dist/assets/AboutDialog-D4mvc-zu.js +1 -0
- package/apps/web/dist/assets/ChangelogDialog-DLqpJsF6.js +1 -0
- package/apps/web/dist/assets/ChatView-3laypRcE.js +10 -0
- package/apps/web/dist/assets/EditorPage-BalA5U2Y.js +3 -0
- package/apps/web/dist/assets/FlowPreview-CusP7ci9.js +1 -0
- package/apps/web/dist/assets/Harness-BrP-ENHg.css +1 -0
- package/apps/web/dist/assets/Harness-iYLtOLaK.js +16 -0
- package/apps/web/dist/assets/NewWizardChannels-CbwJ9A56.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BOBYiB9i.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-CUwCiVIr.js +1 -0
- package/apps/web/dist/assets/ProjectPage-Bb16MdYG.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BCt7Q6C-.js +1 -0
- package/apps/web/dist/assets/ReadOnly-kIHX2TEy.js +1 -0
- package/apps/web/dist/assets/RunDrawer-hZ9oeSXu.js +4 -0
- package/apps/web/dist/assets/RunnerView-DUS9fPmx.js +1 -0
- package/apps/web/dist/assets/SettingsPage-BzwR50fi.js +1 -0
- package/apps/web/dist/assets/SetupPage-gAp7rPxp.js +1 -0
- package/apps/web/dist/assets/SharePage-DqZWHva_.js +1 -0
- package/apps/web/dist/assets/changelog-DugmCNSf.js +1 -0
- package/apps/web/dist/assets/engenty-eXZ-EAwd.js +1 -0
- package/apps/web/dist/assets/esm-DXeMu8Lb.js +7 -0
- package/apps/web/dist/assets/fluffy-engenty-ClRou7yu.js +456 -0
- package/apps/web/dist/assets/index-AfUa8xKD.css +1 -0
- package/apps/web/dist/assets/index-C5Sm7tTR.js +14 -0
- package/apps/web/dist/assets/jsx-runtime-BNakU3Ej.js +1 -0
- package/apps/web/dist/assets/lock-R_CfU0Xo.js +1 -0
- package/apps/web/dist/assets/oss-credits-cZ9NUaLZ.js +1 -0
- package/apps/web/dist/assets/pdfmake-Cx9scTbD.js +228 -0
- package/apps/web/dist/assets/phone-CgrIS4_-.js +1 -0
- package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +1 -0
- package/apps/web/dist/assets/qr-scanner-worker.min-CJaXo3yu.js +98 -0
- package/apps/web/dist/assets/qr-scanner.min-C_UI0gH-.js +1 -0
- package/apps/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/apps/web/dist/assets/settings-menu-2IMOOlLl.js +1 -0
- package/apps/web/dist/assets/ui-dzGvc3xk.js +137 -0
- package/apps/web/dist/assets/upload-BSuTilFF.js +1 -0
- package/apps/web/dist/assets/vfs_fonts-DllDSYt1.js +1 -0
- package/apps/web/dist/embed.js +266 -0
- package/apps/web/dist/favicon.svg +1 -0
- package/apps/web/dist/icons/apple-touch-icon.png +0 -0
- package/apps/web/dist/icons/icon-192.png +0 -0
- package/apps/web/dist/icons/icon-512.png +0 -0
- package/apps/web/dist/icons/icon-maskable-512.png +0 -0
- package/apps/web/dist/index.html +48 -0
- package/apps/web/dist/install.sh +577 -0
- package/apps/web/dist/manifest.webmanifest +21 -0
- package/apps/web/dist/mcp/flow.html +980 -0
- package/apps/web/dist/sw.js +15 -0
- package/bin/wizards.mjs +288 -0
- package/modules/README.md +15 -0
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +1150 -0
- package/node_modules/@engenty/wizards/dist/plugin/index.js +4 -0
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +322 -0
- package/node_modules/@engenty/wizards/dist/plugin/studio.js +4 -0
- package/node_modules/@engenty/wizards/dist/plugin/thread.d.ts +174 -0
- package/node_modules/@engenty/wizards/dist/plugin/thread.js +821 -0
- package/node_modules/@engenty/wizards/package.json +11 -0
- package/node_modules/@engenty-wizards/shared/dist/assistant.d.ts +174 -0
- package/node_modules/@engenty-wizards/shared/dist/assistant.js +65 -0
- package/node_modules/@engenty-wizards/shared/dist/changes.d.ts +22 -0
- package/node_modules/@engenty-wizards/shared/dist/changes.js +61 -0
- package/node_modules/@engenty-wizards/shared/dist/connectors.d.ts +77 -0
- package/node_modules/@engenty-wizards/shared/dist/connectors.js +2 -0
- package/node_modules/@engenty-wizards/shared/dist/decision.d.ts +76 -0
- package/node_modules/@engenty-wizards/shared/dist/decision.js +147 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +2922 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.js +1920 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.d.ts +5 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.js +132 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.d.ts +11 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.js +209 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.d.ts +532 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +217 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.d.ts +3 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.js +3 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.d.ts +14 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.js +166 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.d.ts +33 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.js +99 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.d.ts +78 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.js +70 -0
- package/node_modules/@engenty-wizards/shared/dist/features.d.ts +41 -0
- package/node_modules/@engenty-wizards/shared/dist/features.js +89 -0
- package/node_modules/@engenty-wizards/shared/dist/fit.d.ts +71 -0
- package/node_modules/@engenty-wizards/shared/dist/fit.js +382 -0
- package/node_modules/@engenty-wizards/shared/dist/json-schema.d.ts +14 -0
- package/node_modules/@engenty-wizards/shared/dist/json-schema.js +66 -0
- package/node_modules/@engenty-wizards/shared/dist/knowledge.d.ts +199 -0
- package/node_modules/@engenty-wizards/shared/dist/knowledge.js +68 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.d.ts +35 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.js +107 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.d.ts +20 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.js +136 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +227 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace.js +354 -0
- package/node_modules/@engenty-wizards/shared/dist/merge.d.ts +7 -0
- package/node_modules/@engenty-wizards/shared/dist/merge.js +40 -0
- package/node_modules/@engenty-wizards/shared/dist/numbers.d.ts +24 -0
- package/node_modules/@engenty-wizards/shared/dist/numbers.js +54 -0
- package/node_modules/@engenty-wizards/shared/dist/projects.d.ts +224 -0
- package/node_modules/@engenty-wizards/shared/dist/projects.js +319 -0
- package/node_modules/@engenty-wizards/shared/dist/providers.d.ts +101 -0
- package/node_modules/@engenty-wizards/shared/dist/providers.js +390 -0
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +680 -0
- package/node_modules/@engenty-wizards/shared/dist/run.js +620 -0
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.d.ts +546 -0
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.js +523 -0
- package/node_modules/@engenty-wizards/shared/dist/runners.d.ts +93 -0
- package/node_modules/@engenty-wizards/shared/dist/runners.js +146 -0
- package/node_modules/@engenty-wizards/shared/dist/shape.d.ts +102 -0
- package/node_modules/@engenty-wizards/shared/dist/shape.js +318 -0
- package/node_modules/@engenty-wizards/shared/dist/space-data.d.ts +89 -0
- package/node_modules/@engenty-wizards/shared/dist/space-data.js +47 -0
- package/node_modules/@engenty-wizards/shared/dist/store.d.ts +117 -0
- package/node_modules/@engenty-wizards/shared/dist/store.js +81 -0
- package/node_modules/@engenty-wizards/shared/dist/surface.d.ts +115 -0
- package/node_modules/@engenty-wizards/shared/dist/surface.js +442 -0
- package/node_modules/@engenty-wizards/shared/dist/texts.d.ts +45 -0
- package/node_modules/@engenty-wizards/shared/dist/texts.js +54 -0
- package/node_modules/@engenty-wizards/shared/dist/translation.d.ts +23 -0
- package/node_modules/@engenty-wizards/shared/dist/translation.js +154 -0
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +48 -0
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.js +49 -0
- package/node_modules/@engenty-wizards/shared/dist/workspace.d.ts +16 -0
- package/node_modules/@engenty-wizards/shared/dist/workspace.js +51 -0
- package/node_modules/@engenty-wizards/shared/package.json +10 -0
- package/package.json +77 -4
- package/plugin/.claude-plugin/plugin.json +9 -0
- package/plugin/.mcp.json +8 -0
- package/plugin/commands/wizard.md +8 -0
- package/plugin/skills/build-wizard/SKILL.md +27 -0
- package/plugin/skills/use-wizard/SKILL.md +18 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { env } from "../env.js";
|
|
5
|
+
import { extFor } from "../files/storage.js";
|
|
6
|
+
import { ffmpeg, hasFfmpeg, probeMedia, withTempDir } from "../media/ffmpeg.js";
|
|
7
|
+
import { newContext, offlineContext } from "../render/chromium.js";
|
|
8
|
+
export { hasFfmpeg } from "../media/ffmpeg.js";
|
|
9
|
+
const FPS = 25;
|
|
10
|
+
const MAX_SECONDS = 60;
|
|
11
|
+
/** Exports set `wizard.mode` to "export" so the widget hides its controls and does not autoplay. */
|
|
12
|
+
function forExport(html) {
|
|
13
|
+
return html.replace('<script type="application/json" id="wizard-payload">', '<script>window.__WIZARD_EXPORT=true</script><script type="application/json" id="wizard-payload">');
|
|
14
|
+
}
|
|
15
|
+
async function withWidget(html, size, scale, use) {
|
|
16
|
+
const context = await offlineContext({
|
|
17
|
+
viewport: { width: size.width, height: size.height },
|
|
18
|
+
deviceScaleFactor: scale,
|
|
19
|
+
});
|
|
20
|
+
const errors = [];
|
|
21
|
+
try {
|
|
22
|
+
const page = await context.newPage();
|
|
23
|
+
page.on("pageerror", (err) => errors.push(err.message));
|
|
24
|
+
page.on("console", (msg) => {
|
|
25
|
+
if (msg.type() === "error") {
|
|
26
|
+
errors.push(msg.text());
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
await page.setContent(forExport(html), { waitUntil: "load", timeout: 30_000 });
|
|
30
|
+
// A widget calls wizard.ready() after its first frame; one that never does gets 3 seconds.
|
|
31
|
+
await page.evaluate(() => Promise.race([window.wizard?.__ready, new Promise((r) => setTimeout(r, 3000))]));
|
|
32
|
+
return await use(page, errors);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await context.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function timelineOf(page) {
|
|
39
|
+
return page.evaluate(() => {
|
|
40
|
+
const t = window.wizard?.__timeline?.();
|
|
41
|
+
return t ? { duration: Number(t.duration), poster: Number(t.poster ?? 0) } : null;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async function seek(page, seconds) {
|
|
45
|
+
await page.evaluate(async (t) => {
|
|
46
|
+
// A film's seek waits for its clips to reach the frame; a drawn animation returns at once.
|
|
47
|
+
await window.wizard.__timeline().seek(t);
|
|
48
|
+
await new Promise((r) => requestAnimationFrame(() => r(null)));
|
|
49
|
+
}, seconds);
|
|
50
|
+
}
|
|
51
|
+
/** Loads the widget once: does it run, and does it animate? */
|
|
52
|
+
export async function probeWidget(html, size) {
|
|
53
|
+
return withWidget(html, size, 1, async (page, errors) => {
|
|
54
|
+
const timeline = await timelineOf(page);
|
|
55
|
+
if (timeline) {
|
|
56
|
+
await seek(page, timeline.poster);
|
|
57
|
+
}
|
|
58
|
+
const png = await page.screenshot({ type: "png" });
|
|
59
|
+
return {
|
|
60
|
+
duration: timeline ? Math.min(timeline.duration, MAX_SECONDS) : null,
|
|
61
|
+
errors: [...new Set(errors)].slice(0, 10),
|
|
62
|
+
png,
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export async function widgetPng(html, size) {
|
|
67
|
+
return withWidget(html, size, 2, async (page) => {
|
|
68
|
+
const timeline = await timelineOf(page);
|
|
69
|
+
if (timeline) {
|
|
70
|
+
await seek(page, timeline.poster);
|
|
71
|
+
}
|
|
72
|
+
return page.screenshot({ type: "png", fullPage: true });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export async function widgetPdf(html, size) {
|
|
76
|
+
return withWidget(html, size, 1, async (page) => {
|
|
77
|
+
const timeline = await timelineOf(page);
|
|
78
|
+
if (timeline) {
|
|
79
|
+
await seek(page, timeline.poster);
|
|
80
|
+
}
|
|
81
|
+
const height = await page.evaluate(() => document.documentElement.scrollHeight);
|
|
82
|
+
return page.pdf({
|
|
83
|
+
width: `${size.width}px`,
|
|
84
|
+
height: `${Math.max(size.height, height)}px`,
|
|
85
|
+
printBackground: true,
|
|
86
|
+
pageRanges: "1",
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/** Steps through the timeline frame by frame and encodes the frames as H.264 (no sound). */
|
|
91
|
+
async function encodeFrames(page, seconds, out, onProgress) {
|
|
92
|
+
const encoder = spawn(env.ffmpegPath, [
|
|
93
|
+
"-y",
|
|
94
|
+
"-loglevel",
|
|
95
|
+
"error",
|
|
96
|
+
"-f",
|
|
97
|
+
"image2pipe",
|
|
98
|
+
"-framerate",
|
|
99
|
+
String(FPS),
|
|
100
|
+
"-i",
|
|
101
|
+
"-",
|
|
102
|
+
"-c:v",
|
|
103
|
+
"libx264",
|
|
104
|
+
"-preset",
|
|
105
|
+
"veryfast",
|
|
106
|
+
"-crf",
|
|
107
|
+
"20",
|
|
108
|
+
"-pix_fmt",
|
|
109
|
+
"yuv420p",
|
|
110
|
+
"-movflags",
|
|
111
|
+
"+faststart",
|
|
112
|
+
out,
|
|
113
|
+
], { stdio: ["pipe", "ignore", "pipe"] });
|
|
114
|
+
let stderr = "";
|
|
115
|
+
encoder.stderr.on("data", (d) => {
|
|
116
|
+
stderr += String(d);
|
|
117
|
+
});
|
|
118
|
+
const done = new Promise((resolve, reject) => {
|
|
119
|
+
encoder.on("error", reject);
|
|
120
|
+
encoder.on("exit", (code) => code === 0 ? resolve() : reject(new Error(`ffmpeg: ${stderr.slice(0, 300)}`)));
|
|
121
|
+
});
|
|
122
|
+
const frames = Math.max(1, Math.round(seconds * FPS));
|
|
123
|
+
for (let i = 0; i < frames; i++) {
|
|
124
|
+
await seek(page, (i * seconds) / frames);
|
|
125
|
+
const jpeg = await page.screenshot({ type: "jpeg", quality: 92 });
|
|
126
|
+
if (!encoder.stdin.write(jpeg)) {
|
|
127
|
+
await new Promise((r) => encoder.stdin.once("drain", r));
|
|
128
|
+
}
|
|
129
|
+
if (i % FPS === 0) {
|
|
130
|
+
onProgress?.(i / frames);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
encoder.stdin.end();
|
|
134
|
+
await done;
|
|
135
|
+
}
|
|
136
|
+
/** Steps through the widget's timeline frame by frame and encodes the frames as H.264. */
|
|
137
|
+
export async function widgetMp4(html, size) {
|
|
138
|
+
if (!(await hasFfmpeg())) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const even = { width: size.width - (size.width % 2), height: size.height - (size.height % 2) };
|
|
142
|
+
return withTempDir(async (dir) => {
|
|
143
|
+
const out = join(dir, "out.mp4");
|
|
144
|
+
return withWidget(html, even, 1, async (page) => {
|
|
145
|
+
const timeline = await timelineOf(page);
|
|
146
|
+
if (!timeline) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
await encodeFrames(page, Math.min(timeline.duration, MAX_SECONDS), out);
|
|
150
|
+
return new Uint8Array(await readFile(out));
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// --- films: a timeline of clips and stills, with sound ---------------------------------
|
|
155
|
+
/** Where a film's page finds this run's clips, images and voice-over while it is rendered. */
|
|
156
|
+
export const FILM_MEDIA_ORIGIN = "http://wizard.media";
|
|
157
|
+
/** A film names at most this many sound tracks: voice-over, music, and every cut of a recording. */
|
|
158
|
+
const MAX_TRACKS = 48;
|
|
159
|
+
/**
|
|
160
|
+
* Renders a film widget: its page draws every frame from this run's clips and images, and names
|
|
161
|
+
* the sound that belongs to it (voice-over, the clips' own sound). Clips are re-encoded with a
|
|
162
|
+
* key frame every few frames first, so the page reaches any frame quickly and exactly.
|
|
163
|
+
*/
|
|
164
|
+
export async function renderFilm(html, size, media, onProgress) {
|
|
165
|
+
if (!(await hasFfmpeg())) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const even = { width: size.width - (size.width % 2), height: size.height - (size.height % 2) };
|
|
169
|
+
return withTempDir(async (dir) => {
|
|
170
|
+
// url → the file as it came (for its sound) and what the page is served.
|
|
171
|
+
const files = new Map();
|
|
172
|
+
let n = 0;
|
|
173
|
+
for (const [url, file] of media) {
|
|
174
|
+
const path = join(dir, `media-${n++}.${extFor(file.mime)}`);
|
|
175
|
+
await writeFile(path, file.bytes);
|
|
176
|
+
let served = file;
|
|
177
|
+
if (file.mime.startsWith("video/")) {
|
|
178
|
+
const seekable = join(dir, `seek-${n}.mp4`);
|
|
179
|
+
const { code } = await ffmpeg([
|
|
180
|
+
"-y",
|
|
181
|
+
"-loglevel",
|
|
182
|
+
"error",
|
|
183
|
+
"-i",
|
|
184
|
+
path,
|
|
185
|
+
"-an",
|
|
186
|
+
"-c:v",
|
|
187
|
+
"libx264",
|
|
188
|
+
"-preset",
|
|
189
|
+
"veryfast",
|
|
190
|
+
"-crf",
|
|
191
|
+
"20",
|
|
192
|
+
"-g",
|
|
193
|
+
"5",
|
|
194
|
+
"-pix_fmt",
|
|
195
|
+
"yuv420p",
|
|
196
|
+
"-movflags",
|
|
197
|
+
"+faststart",
|
|
198
|
+
seekable,
|
|
199
|
+
]);
|
|
200
|
+
if (code === 0) {
|
|
201
|
+
served = { bytes: new Uint8Array(await readFile(seekable)), mime: "video/mp4" };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
files.set(url, { path, served });
|
|
205
|
+
}
|
|
206
|
+
const context = await newContext({ viewport: even, deviceScaleFactor: 1 });
|
|
207
|
+
const errors = [];
|
|
208
|
+
try {
|
|
209
|
+
await context.route("**/*", async (route) => {
|
|
210
|
+
const request = route.request();
|
|
211
|
+
const file = files.get(request.url().split(/[?#]/)[0])?.served;
|
|
212
|
+
if (!file) {
|
|
213
|
+
await route.abort("blockedbyclient");
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
// Players ask for byte ranges and only seek freely when they get them.
|
|
217
|
+
const total = file.bytes.byteLength;
|
|
218
|
+
const range = request.headers().range?.match(/^bytes=(\d+)-(\d*)$/);
|
|
219
|
+
const from = range ? Math.min(Number(range[1]), total - 1) : 0;
|
|
220
|
+
const to = range?.[2] ? Math.min(Number(range[2]), total - 1) : total - 1;
|
|
221
|
+
await route.fulfill({
|
|
222
|
+
status: range ? 206 : 200,
|
|
223
|
+
contentType: file.mime,
|
|
224
|
+
headers: {
|
|
225
|
+
"accept-ranges": "bytes",
|
|
226
|
+
...(range ? { "content-range": `bytes ${from}-${to}/${total}` } : {}),
|
|
227
|
+
},
|
|
228
|
+
body: Buffer.from(file.bytes.subarray(from, to + 1)),
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
const page = await context.newPage();
|
|
232
|
+
page.on("pageerror", (err) => errors.push(err.message));
|
|
233
|
+
await page.setContent(forExport(html), { waitUntil: "load", timeout: 30_000 });
|
|
234
|
+
// A film is ready once its clips are loaded; that takes longer than a drawn widget.
|
|
235
|
+
await page.evaluate(() => Promise.race([window.wizard?.__ready, new Promise((r) => setTimeout(r, 45_000))]));
|
|
236
|
+
const timeline = await page.evaluate(() => {
|
|
237
|
+
const t = window.wizard?.__timeline?.();
|
|
238
|
+
return t
|
|
239
|
+
? {
|
|
240
|
+
duration: Number(t.duration),
|
|
241
|
+
poster: Number(t.poster ?? 0),
|
|
242
|
+
audio: (Array.isArray(t.audio) ? t.audio : []),
|
|
243
|
+
}
|
|
244
|
+
: null;
|
|
245
|
+
});
|
|
246
|
+
if (!timeline) {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const seconds = Math.min(timeline.duration, MAX_SECONDS);
|
|
250
|
+
const silent = join(dir, "silent.mp4");
|
|
251
|
+
await encodeFrames(page, seconds, silent, onProgress);
|
|
252
|
+
await seek(page, Math.min(timeline.poster, seconds));
|
|
253
|
+
const png = await page.screenshot({ type: "png" });
|
|
254
|
+
const tracks = [];
|
|
255
|
+
// Sounds from the wizard's workspace (wizard.url) arrive as data URLs.
|
|
256
|
+
const inline = new Map();
|
|
257
|
+
for (const track of timeline.audio.slice(0, MAX_TRACKS)) {
|
|
258
|
+
const data = String(track.src).match(/^data:(audio\/[\w.+-]+);base64,(.+)$/);
|
|
259
|
+
if (data && !inline.has(track.src)) {
|
|
260
|
+
const path = join(dir, `sound-${inline.size}.${extFor(data[1])}`);
|
|
261
|
+
await writeFile(path, Buffer.from(data[2], "base64"));
|
|
262
|
+
inline.set(track.src, path);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const track of timeline.audio.slice(0, MAX_TRACKS)) {
|
|
266
|
+
const path = inline.get(track.src) ?? files.get(String(track.src).split(/[?#]/)[0])?.path;
|
|
267
|
+
if (path && track.start < seconds && (await probeMedia(path)).audio) {
|
|
268
|
+
tracks.push({ ...track, path });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
let out = silent;
|
|
272
|
+
if (tracks.length) {
|
|
273
|
+
const mixed = join(dir, "film.mp4");
|
|
274
|
+
const chains = tracks.map((track, i) => {
|
|
275
|
+
const length = Math.min(track.duration ?? seconds, seconds - track.start);
|
|
276
|
+
const volume = Math.max(0, Math.min(2, track.volume ?? 1));
|
|
277
|
+
const delay = Math.round(Math.max(0, track.start) * 1000);
|
|
278
|
+
const cut = track.from !== undefined;
|
|
279
|
+
const from = Math.max(0, Number(track.from) || 0);
|
|
280
|
+
// A cut out of a recording gets short fades, so the hard cut does not click.
|
|
281
|
+
const fade = cut ? Math.min(0.03, length / 4) : 0.25;
|
|
282
|
+
const fadeIn = cut ? `afade=t=in:d=${fade.toFixed(3)},` : "";
|
|
283
|
+
return `[${i + 1}:a]atrim=${from.toFixed(3)}:${(from + length).toFixed(3)},asetpts=PTS-STARTPTS,${fadeIn}afade=t=out:st=${Math.max(0, length - fade).toFixed(3)}:d=${fade.toFixed(3)},adelay=${delay}:all=1,volume=${volume}[a${i}]`;
|
|
284
|
+
});
|
|
285
|
+
const mix = `${tracks.map((_, i) => `[a${i}]`).join("")}amix=inputs=${tracks.length}:normalize=0:duration=longest[mix]`;
|
|
286
|
+
const { code, stderr } = await ffmpeg([
|
|
287
|
+
"-y",
|
|
288
|
+
"-loglevel",
|
|
289
|
+
"error",
|
|
290
|
+
"-i",
|
|
291
|
+
silent,
|
|
292
|
+
...tracks.flatMap((track) => ["-i", track.path]),
|
|
293
|
+
"-filter_complex",
|
|
294
|
+
[...chains, mix].join(";"),
|
|
295
|
+
"-map",
|
|
296
|
+
"0:v",
|
|
297
|
+
"-map",
|
|
298
|
+
"[mix]",
|
|
299
|
+
"-c:v",
|
|
300
|
+
"copy",
|
|
301
|
+
"-c:a",
|
|
302
|
+
"aac",
|
|
303
|
+
"-b:a",
|
|
304
|
+
"160k",
|
|
305
|
+
"-t",
|
|
306
|
+
seconds.toFixed(3),
|
|
307
|
+
"-movflags",
|
|
308
|
+
"+faststart",
|
|
309
|
+
mixed,
|
|
310
|
+
]);
|
|
311
|
+
if (code === 0) {
|
|
312
|
+
out = mixed;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
errors.push(`The sound could not be mixed: ${stderr.slice(-200)}`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
mp4: new Uint8Array(await readFile(out)),
|
|
320
|
+
png,
|
|
321
|
+
duration: seconds,
|
|
322
|
+
errors: [...new Set(errors)].slice(0, 10),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
finally {
|
|
326
|
+
await context.close();
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `window.wizard` — the whole contract between a widget and the platform. Injected ahead of the
|
|
3
|
+
* widget's own scripts; reads its payload from <script type="application/json" id="wizard-payload">.
|
|
4
|
+
*
|
|
5
|
+
* wizard.data the run's data (keys from the widget step's `data` map)
|
|
6
|
+
* wizard.brand { name, accent, logo, colors, facts, theme } — logo as a data URL or
|
|
7
|
+
* null, colors [{ name, value }], facts { key: value }, theme { accent,
|
|
8
|
+
* second, background, display, body, dark } as the run page uses it
|
|
9
|
+
* wizard.state what the person did last time (ticks, an open tab), kept with the run
|
|
10
|
+
* wizard.save(state) keeps `state` with the run (small JSON); the next visit reads it
|
|
11
|
+
* wizard.share(text) hands text to the device's share sheet (or copies it)
|
|
12
|
+
* wizard.ai "generated" | "edited" when the run's media in `data` was made or
|
|
13
|
+
* changed by a model, else null — a film labels itself with it
|
|
14
|
+
* wizard.mode "view" in the browser, "export" while a PNG/PDF/MP4 is rendered
|
|
15
|
+
* wizard.file(path) text of a workspace file (JSON, CSV, SVG, …)
|
|
16
|
+
* wizard.json(path) a workspace JSON file, parsed
|
|
17
|
+
* wizard.url(path) a workspace file as a data URL (images, fonts, audio)
|
|
18
|
+
* wizard.ready() call once the first frame is drawn; exports wait for it
|
|
19
|
+
* wizard.timeline({ duration, seek, poster?, audio? })
|
|
20
|
+
* an animation of `duration` seconds; seek(t) must draw time t —
|
|
21
|
+
* synchronously, or as a promise that resolves once it is drawn (a
|
|
22
|
+
* film waits for its clips). Enables the MP4 export; `poster` is the
|
|
23
|
+
* second the PNG/PDF show (default 0). A film names its sound in
|
|
24
|
+
* `audio`: [{ src, start, duration?, from?, volume? }] — `from` is the
|
|
25
|
+
* second of the source a cut plays from.
|
|
26
|
+
*/
|
|
27
|
+
export const WIDGET_RUNTIME = `(function () {
|
|
28
|
+
var el = document.getElementById("wizard-payload");
|
|
29
|
+
var payload = el ? JSON.parse(el.textContent) : { data: {}, brand: {}, files: {}, base: "" };
|
|
30
|
+
var files = payload.files || {};
|
|
31
|
+
var resolveReady;
|
|
32
|
+
var readyPromise = new Promise(function (r) { resolveReady = r; });
|
|
33
|
+
var timeline = null;
|
|
34
|
+
function find(path) {
|
|
35
|
+
var p = String(path || "").replace(/^\\.?\\/+/, "");
|
|
36
|
+
return files[p] || files[payload.base + p] || null;
|
|
37
|
+
}
|
|
38
|
+
function utf8ToB64(text) {
|
|
39
|
+
var bytes = new TextEncoder().encode(text);
|
|
40
|
+
var bin = "";
|
|
41
|
+
for (var i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]);
|
|
42
|
+
return btoa(bin);
|
|
43
|
+
}
|
|
44
|
+
function b64ToUtf8(b64) {
|
|
45
|
+
var bin = atob(b64);
|
|
46
|
+
var bytes = new Uint8Array(bin.length);
|
|
47
|
+
for (var i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
|
48
|
+
return new TextDecoder().decode(bytes);
|
|
49
|
+
}
|
|
50
|
+
window.wizard = {
|
|
51
|
+
data: payload.data || {},
|
|
52
|
+
brand: payload.brand || {},
|
|
53
|
+
ai: payload.ai || null,
|
|
54
|
+
mode: window.__WIZARD_EXPORT ? "export" : "view",
|
|
55
|
+
file: function (path) {
|
|
56
|
+
var f = find(path);
|
|
57
|
+
if (!f) return undefined;
|
|
58
|
+
return f.text != null ? f.text : b64ToUtf8(f.b64);
|
|
59
|
+
},
|
|
60
|
+
json: function (path) {
|
|
61
|
+
var t = this.file(path);
|
|
62
|
+
return t == null ? undefined : JSON.parse(t);
|
|
63
|
+
},
|
|
64
|
+
url: function (path) {
|
|
65
|
+
var f = find(path);
|
|
66
|
+
if (!f) return "";
|
|
67
|
+
return "data:" + f.mime + ";base64," + (f.b64 != null ? f.b64 : utf8ToB64(f.text));
|
|
68
|
+
},
|
|
69
|
+
state: window.__WIZARD_STATE || {},
|
|
70
|
+
save: function (state) {
|
|
71
|
+
this.state = state;
|
|
72
|
+
if (parent !== window) parent.postMessage({ wizard: "state", state: state }, "*");
|
|
73
|
+
},
|
|
74
|
+
share: function (text) {
|
|
75
|
+
if (parent !== window) parent.postMessage({ wizard: "share", text: String(text) }, "*");
|
|
76
|
+
},
|
|
77
|
+
ready: function () { resolveReady(); },
|
|
78
|
+
timeline: function (t) {
|
|
79
|
+
if (t && typeof t.seek === "function" && t.duration > 0) timeline = t;
|
|
80
|
+
},
|
|
81
|
+
__ready: readyPromise,
|
|
82
|
+
__timeline: function () { return timeline; }
|
|
83
|
+
};
|
|
84
|
+
// A sandboxed frame can start at 0×0 and get its real size later without a "resize" event;
|
|
85
|
+
// widgets that fit themselves to the window would stay at scale 0. Fire it for them.
|
|
86
|
+
var lastW = innerWidth, lastH = innerHeight;
|
|
87
|
+
addEventListener("resize", function () { lastW = innerWidth; lastH = innerHeight; });
|
|
88
|
+
// A widget laid out as part of the page tells the page how tall its content is.
|
|
89
|
+
var lastTall = 0;
|
|
90
|
+
function tell() {
|
|
91
|
+
var tall = Math.ceil(document.documentElement.scrollHeight);
|
|
92
|
+
if (parent !== window && tall !== lastTall) {
|
|
93
|
+
lastTall = tall;
|
|
94
|
+
parent.postMessage({ wizard: "height", height: tall }, "*");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
addEventListener("load", tell);
|
|
98
|
+
if (window.ResizeObserver) {
|
|
99
|
+
new ResizeObserver(function () {
|
|
100
|
+
if (innerWidth !== lastW || innerHeight !== lastH) {
|
|
101
|
+
lastW = innerWidth;
|
|
102
|
+
lastH = innerHeight;
|
|
103
|
+
dispatchEvent(new Event("resize"));
|
|
104
|
+
}
|
|
105
|
+
tell();
|
|
106
|
+
}).observe(document.documentElement);
|
|
107
|
+
}
|
|
108
|
+
})();`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { offlineContext } from "../render/chromium.js";
|
|
2
|
+
/**
|
|
3
|
+
* Runs a model-written script over workspace files inside Chromium with no network: reshaping
|
|
4
|
+
* downloaded data (simplify outlines, merge files, precompute paths) without passing it through
|
|
5
|
+
* the model. `files` maps paths to text; the script's return value is the result.
|
|
6
|
+
*/
|
|
7
|
+
export async function runScript(script, files, timeoutMs = 20_000) {
|
|
8
|
+
const context = await offlineContext();
|
|
9
|
+
try {
|
|
10
|
+
const page = await context.newPage();
|
|
11
|
+
await page.setContent("<!doctype html><html><body></body></html>");
|
|
12
|
+
const run = page.evaluate(async ({ script, files }) => {
|
|
13
|
+
const fn = new Function("files", `return (async () => {\n${script}\n})();`);
|
|
14
|
+
return await fn(files);
|
|
15
|
+
}, { script, files });
|
|
16
|
+
let timer;
|
|
17
|
+
const timeout = new Promise((_, reject) => {
|
|
18
|
+
timer = setTimeout(() => reject(new Error(`The script ran longer than ${timeoutMs / 1000} seconds.`)), timeoutMs);
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
return await Promise.race([run, timeout]);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
await context.close();
|
|
29
|
+
}
|
|
30
|
+
}
|