@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,480 @@
|
|
|
1
|
+
import { FONT_WEIGHTS } from "@engenty-wizards/shared/projects";
|
|
2
|
+
import { webContext } from "../render/chromium.js";
|
|
3
|
+
import { htmlToMarkdown } from "../render/convert.js";
|
|
4
|
+
import { safeFetch } from "../tools/net-guard.js";
|
|
5
|
+
const UA = { "user-agent": "Mozilla/5.0 (compatible; engenty-wizards/0.1)" };
|
|
6
|
+
const attr = (tag, name) => tag
|
|
7
|
+
.match(new RegExp(`\\b${name}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"))
|
|
8
|
+
?.slice(2)
|
|
9
|
+
.find(Boolean) ?? "";
|
|
10
|
+
function absolute(href, base) {
|
|
11
|
+
try {
|
|
12
|
+
const url = new URL(href.trim(), base);
|
|
13
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url.toString() : null;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function hex(value) {
|
|
20
|
+
const v = value.trim().toLowerCase();
|
|
21
|
+
const short = v.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/);
|
|
22
|
+
if (short) {
|
|
23
|
+
return `#${short[1]}${short[1]}${short[2]}${short[2]}${short[3]}${short[3]}`;
|
|
24
|
+
}
|
|
25
|
+
if (/^#[0-9a-f]{6}$/.test(v)) {
|
|
26
|
+
return v;
|
|
27
|
+
}
|
|
28
|
+
if (/^#[0-9a-f]{8}$/.test(v)) {
|
|
29
|
+
return v.slice(0, 7);
|
|
30
|
+
}
|
|
31
|
+
const rgb = v.match(/^rgba?\(\s*(\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})/);
|
|
32
|
+
if (rgb) {
|
|
33
|
+
return toHex(rgb.slice(1, 4).map(Number));
|
|
34
|
+
}
|
|
35
|
+
const hsl = v.match(/^hsla?\(\s*([\d.]+)(?:deg)?[\s,]+([\d.]+)%[\s,]+([\d.]+)%/);
|
|
36
|
+
if (hsl) {
|
|
37
|
+
const [h, sat, l] = [Number(hsl[1]), Number(hsl[2]) / 100, Number(hsl[3]) / 100];
|
|
38
|
+
const f = (n) => {
|
|
39
|
+
const k = (n + h / 30) % 12;
|
|
40
|
+
return 255 * (l - sat * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1)));
|
|
41
|
+
};
|
|
42
|
+
return toHex([f(0), f(8), f(4)]);
|
|
43
|
+
}
|
|
44
|
+
const ok = v.match(/^oklch\(\s*([\d.]+)(%?)\s+([\d.]+)\s+([\d.]+)/);
|
|
45
|
+
if (ok) {
|
|
46
|
+
return toHex(oklchToRgb(Number(ok[1]) / (ok[2] ? 100 : 1), Number(ok[3]), Number(ok[4])));
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const toHex = (rgb) => `#${rgb
|
|
51
|
+
.map((n) => Math.round(Math.max(0, Math.min(255, n)))
|
|
52
|
+
.toString(16)
|
|
53
|
+
.padStart(2, "0"))
|
|
54
|
+
.join("")}`;
|
|
55
|
+
/** OKLCH (as CSS writes it, Tailwind 4 among others) in sRGB, 0–255. */
|
|
56
|
+
function oklchToRgb(l, c, h) {
|
|
57
|
+
const a = c * Math.cos((h * Math.PI) / 180);
|
|
58
|
+
const b = c * Math.sin((h * Math.PI) / 180);
|
|
59
|
+
const l_ = (l + 0.3963377774 * a + 0.2158037573 * b) ** 3;
|
|
60
|
+
const m_ = (l - 0.1055613458 * a - 0.0638541728 * b) ** 3;
|
|
61
|
+
const s_ = (l - 0.0894841775 * a - 1.291485548 * b) ** 3;
|
|
62
|
+
const linear = [
|
|
63
|
+
4.0767416621 * l_ - 3.3077115913 * m_ + 0.2309699292 * s_,
|
|
64
|
+
-1.2684380046 * l_ + 2.6097574011 * m_ - 0.3413193965 * s_,
|
|
65
|
+
-0.0041960863 * l_ - 0.7034186147 * m_ + 1.707614701 * s_,
|
|
66
|
+
];
|
|
67
|
+
return linear.map((x) => 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.max(0, x) ** (1 / 2.4) - 0.055));
|
|
68
|
+
}
|
|
69
|
+
/** How far a colour is from grey, 0–255. */
|
|
70
|
+
function chroma(color) {
|
|
71
|
+
const [r, g, b] = [1, 3, 5].map((i) => Number.parseInt(color.slice(i, i + 2), 16));
|
|
72
|
+
return Math.max(r, g, b) - Math.min(r, g, b);
|
|
73
|
+
}
|
|
74
|
+
/** A colour as CSS writes it: hex, rgb(), hsl() or oklch(). */
|
|
75
|
+
const COLOUR = /#[0-9a-fA-F]{3,8}\b|rgba?\([^)]*\)|hsla?\([^)]*\)|oklch\([^)]*\)/;
|
|
76
|
+
function coloursOf(css) {
|
|
77
|
+
const variables = [];
|
|
78
|
+
for (const m of css.matchAll(new RegExp(`(--[\\w-]+)\\s*:\\s*(${COLOUR.source})`, "g"))) {
|
|
79
|
+
const value = hex(m[2]);
|
|
80
|
+
// Tailwind's own variables are its machinery, not the site's colours.
|
|
81
|
+
if (value && !m[1].startsWith("--tw-") && !variables.some((v) => v.name === m[1])) {
|
|
82
|
+
variables.push({ name: m[1], value });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const counts = new Map();
|
|
86
|
+
for (const m of css.matchAll(new RegExp(COLOUR.source, "g"))) {
|
|
87
|
+
const value = hex(m[0]);
|
|
88
|
+
if (value) {
|
|
89
|
+
counts.set(value, (counts.get(value) ?? 0) + 1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const telling = /brand|primary|accent|main|theme|secondary|highlight|cta|link/i;
|
|
93
|
+
return {
|
|
94
|
+
variables: variables
|
|
95
|
+
.sort((a, b) => Number(telling.test(b.name)) - Number(telling.test(a.name)))
|
|
96
|
+
.slice(0, 24),
|
|
97
|
+
frequent: [...counts.entries()]
|
|
98
|
+
.sort((a, b) => Number(chroma(b[0]) > 24) - Number(chroma(a[0]) > 24) || b[1] - a[1])
|
|
99
|
+
.slice(0, 12)
|
|
100
|
+
.map(([value]) => value),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
async function stylesheet(url, signal) {
|
|
104
|
+
try {
|
|
105
|
+
const res = await safeFetch(url, {
|
|
106
|
+
headers: UA,
|
|
107
|
+
signal: AbortSignal.any([AbortSignal.timeout(10_000), ...(signal ? [signal] : [])]),
|
|
108
|
+
});
|
|
109
|
+
return res.ok ? (await res.text()).slice(0, 400_000) : "";
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** The page as a browser shows it, for sites that write their text with scripts. */
|
|
116
|
+
async function rendered(url) {
|
|
117
|
+
try {
|
|
118
|
+
const context = await webContext();
|
|
119
|
+
try {
|
|
120
|
+
const page = await context.newPage();
|
|
121
|
+
await page.goto(url, { waitUntil: "networkidle", timeout: 25_000 }).catch(() => undefined);
|
|
122
|
+
return await page.content();
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
await context.close();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** A page's HTML, drawn in a browser when it has hardly any text without its scripts. */
|
|
133
|
+
async function loadPage(raw, signal) {
|
|
134
|
+
const res = await safeFetch(/^https?:\/\//i.test(raw) ? raw : `https://${raw}`, {
|
|
135
|
+
headers: UA,
|
|
136
|
+
signal: AbortSignal.any([AbortSignal.timeout(20_000), ...(signal ? [signal] : [])]),
|
|
137
|
+
});
|
|
138
|
+
const base = res.url;
|
|
139
|
+
let html = (await res.text()).slice(0, 1_500_000);
|
|
140
|
+
// Hardly any text in the page as sent: it is written in the browser.
|
|
141
|
+
if (res.ok && htmlToMarkdown(html).replace(/\s+/g, " ").length < 500) {
|
|
142
|
+
html = ((await rendered(base)) ?? html).slice(0, 1_500_000);
|
|
143
|
+
}
|
|
144
|
+
return { res, base, html };
|
|
145
|
+
}
|
|
146
|
+
const tagsOf = (html, name) => [...html.matchAll(new RegExp(`<${name}\\b[^>]*>`, "gi"))].map((m) => m[0]);
|
|
147
|
+
/** A `<meta>` by its name or property. */
|
|
148
|
+
function metaOf(html, key) {
|
|
149
|
+
const tag = tagsOf(html, "meta").find((t) => [attr(t, "name"), attr(t, "property")].some((v) => v.toLowerCase() === key));
|
|
150
|
+
return tag ? attr(tag, "content") : "";
|
|
151
|
+
}
|
|
152
|
+
const titleOf = (html) => html
|
|
153
|
+
.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1]
|
|
154
|
+
.replace(/\s+/g, " ")
|
|
155
|
+
.trim() ?? "";
|
|
156
|
+
/** The text of a link, as a reader sees it. */
|
|
157
|
+
const linkText = (inner) => inner
|
|
158
|
+
.replace(/<[^>]+>/g, " ")
|
|
159
|
+
.replace(/\s+/g, " ")
|
|
160
|
+
.trim()
|
|
161
|
+
.slice(0, 120);
|
|
162
|
+
/** The `<script type="application/ld+json">` blocks of a page, parsed; a `@graph` is spread out. */
|
|
163
|
+
export function jsonLdOf(html) {
|
|
164
|
+
const out = [];
|
|
165
|
+
for (const m of html.matchAll(/<script\b[^>]*type\s*=\s*["']application\/ld\+json["'][^>]*>([\s\S]*?)<\/script>/gi)) {
|
|
166
|
+
let parsed;
|
|
167
|
+
try {
|
|
168
|
+
parsed = JSON.parse(m[1].trim());
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
for (const item of Array.isArray(parsed) ? parsed : [parsed]) {
|
|
174
|
+
const graph = item?.["@graph"];
|
|
175
|
+
out.push(...(Array.isArray(graph) ? graph : [item]));
|
|
176
|
+
}
|
|
177
|
+
if (out.length >= 50) {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return out.slice(0, 50);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A page for a plugin (`server.web.read`): its whole text as Markdown, every link and its
|
|
185
|
+
* structured data, as against `readWebsite`, which picks what the assistant needs of a
|
|
186
|
+
* company's site.
|
|
187
|
+
*/
|
|
188
|
+
export async function readPage(raw, signal) {
|
|
189
|
+
const { res, base, html } = await loadPage(raw, signal);
|
|
190
|
+
const links = [];
|
|
191
|
+
for (const m of html.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)) {
|
|
192
|
+
const url = absolute(attr(`<a ${m[1]}>`, "href"), base)?.replace(/#.*$/, "");
|
|
193
|
+
if (url && !links.some((l) => l.url === url) && links.length < 2000) {
|
|
194
|
+
links.push({ url, text: linkText(m[2]) });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
url: base,
|
|
199
|
+
status: res.status,
|
|
200
|
+
etag: res.headers.get("etag"),
|
|
201
|
+
lastModified: res.headers.get("last-modified"),
|
|
202
|
+
title: titleOf(html),
|
|
203
|
+
description: metaOf(html, "description") || metaOf(html, "og:description"),
|
|
204
|
+
text: htmlToMarkdown(html).slice(0, 400_000),
|
|
205
|
+
links,
|
|
206
|
+
jsonld: jsonLdOf(html),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const saysLogo = (tag) => /logo/i.test([
|
|
210
|
+
attr(tag, "src"),
|
|
211
|
+
attr(tag, "alt"),
|
|
212
|
+
attr(tag, "class"),
|
|
213
|
+
attr(tag, "id"),
|
|
214
|
+
attr(tag, "aria-label"),
|
|
215
|
+
]
|
|
216
|
+
.filter(Boolean)
|
|
217
|
+
.join(" "));
|
|
218
|
+
/**
|
|
219
|
+
* The logos a page shows, best first: the logo its structured data names, pictures that say
|
|
220
|
+
* "logo", what its home link in the header shows, and its icons. `inline`: SVGs drawn into the
|
|
221
|
+
* page count too, as `data:` addresses — for a person to pick from, too long for a model to read.
|
|
222
|
+
*/
|
|
223
|
+
function logosOf(html, base, inline = false) {
|
|
224
|
+
const logos = [];
|
|
225
|
+
const add = (href, hint) => {
|
|
226
|
+
const url = href.startsWith("data:image/svg+xml") ? href : absolute(href, base);
|
|
227
|
+
if (url && !logos.some((l) => l.url === url)) {
|
|
228
|
+
logos.push({ url, hint });
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
for (const item of jsonLdOf(html)) {
|
|
232
|
+
const logo = item?.logo;
|
|
233
|
+
const href = typeof logo === "string" ? logo : logo?.url;
|
|
234
|
+
if (typeof href === "string") {
|
|
235
|
+
add(href, "the logo the page names in its structured data");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (const tag of tagsOf(html, "img")) {
|
|
239
|
+
const src = attr(tag, "src") || attr(tag, "data-src");
|
|
240
|
+
if (src && !src.startsWith("data:") && saysLogo(tag)) {
|
|
241
|
+
const alt = attr(tag, "alt");
|
|
242
|
+
add(src, `image on the page${alt ? `, alt "${alt}"` : ""}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// What the link home shows is the logo on most sites, said so or not.
|
|
246
|
+
for (const m of html.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)) {
|
|
247
|
+
const href = absolute(attr(`<a ${m[1]}>`, "href"), base);
|
|
248
|
+
if (!href || new URL(href).pathname !== "/" || new URL(href).host !== new URL(base).host) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
const img = tagsOf(m[2], "img")[0];
|
|
252
|
+
const src = img && (attr(img, "src") || attr(img, "data-src"));
|
|
253
|
+
if (src && !src.startsWith("data:")) {
|
|
254
|
+
add(src, "image in the link to the home page");
|
|
255
|
+
}
|
|
256
|
+
const svg = inline ? m[2].match(/<svg\b[\s\S]*?<\/svg>/i)?.[0] : undefined;
|
|
257
|
+
if (svg) {
|
|
258
|
+
add(svgUrl(svg), "drawing in the link to the home page");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (inline) {
|
|
262
|
+
for (const m of html.matchAll(/<svg\b[^>]*>[\s\S]*?<\/svg>/gi)) {
|
|
263
|
+
const open = m[0].match(/^<svg\b[^>]*>/i)?.[0] ?? "";
|
|
264
|
+
const title = m[0].match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1] ?? "";
|
|
265
|
+
if (saysLogo(open) || /logo/i.test(title)) {
|
|
266
|
+
add(svgUrl(m[0]), "drawing on the page");
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
for (const tag of tagsOf(html, "link")) {
|
|
271
|
+
const rel = attr(tag, "rel").toLowerCase();
|
|
272
|
+
if (/apple-touch-icon|mask-icon|(^|\s)icon/.test(rel)) {
|
|
273
|
+
add(attr(tag, "href"), `${rel} ${attr(tag, "sizes")}`.trim());
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return logos;
|
|
277
|
+
}
|
|
278
|
+
/** An inline SVG as a picture of its own: with its namespace, as a `data:` address. */
|
|
279
|
+
function svgUrl(svg) {
|
|
280
|
+
const own = /\bxmlns\s*=/.test(svg.match(/^<svg\b[^>]*>/i)?.[0] ?? "")
|
|
281
|
+
? svg
|
|
282
|
+
: svg.replace(/^<svg\b/i, '<svg xmlns="http://www.w3.org/2000/svg"');
|
|
283
|
+
return `data:image/svg+xml;base64,${Buffer.from(own).toString("base64")}`;
|
|
284
|
+
}
|
|
285
|
+
/** The logos on a web page, for a person to pick from (Logos › from a web address). */
|
|
286
|
+
export async function scanLogos(raw, signal) {
|
|
287
|
+
const { base, html } = await loadPage(raw, signal);
|
|
288
|
+
return logosOf(html, base, true)
|
|
289
|
+
.filter((l) => !l.url.startsWith("data:") || l.url.length < 400_000)
|
|
290
|
+
.slice(0, 16);
|
|
291
|
+
}
|
|
292
|
+
/** The CSS a page brings: its `<style>` blocks, style attributes and first stylesheets. */
|
|
293
|
+
async function cssOf(html, base, signal) {
|
|
294
|
+
const sheets = tagsOf(html, "link")
|
|
295
|
+
.filter((t) => /stylesheet/i.test(attr(t, "rel")))
|
|
296
|
+
.map((t) => absolute(attr(t, "href"), base))
|
|
297
|
+
.filter((u) => Boolean(u))
|
|
298
|
+
.slice(0, 4);
|
|
299
|
+
const inline = [...html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((m) => m[1]);
|
|
300
|
+
const styled = [...html.matchAll(/\bstyle\s*=\s*"([^"]*)"/gi)].map((m) => m[1]);
|
|
301
|
+
return [
|
|
302
|
+
...inline,
|
|
303
|
+
...styled,
|
|
304
|
+
...(await Promise.all(sheets.map((s) => stylesheet(s, signal)))),
|
|
305
|
+
].join("\n");
|
|
306
|
+
}
|
|
307
|
+
/** Family names that are no brand's own: generic and system faces. */
|
|
308
|
+
const GENERIC_FONT = /^(serif|sans-serif|monospace|cursive|fantasy|system-ui|ui-[a-z-]+|-apple-system|blinkmacsystemfont|inherit|initial|unset|revert|emoji|math|fangsong|segoe ui( emoji| symbol)?|helvetica( neue)?|arial|roboto|noto (sans|color emoji)|apple color emoji|courier( new)?|times( new roman)?|georgia|menlo|monaco|consolas|var\(.*|liberation mono|sfmono-regular|sf mono|sf pro( text| display)?|dejavu sans( mono)?)$/i;
|
|
309
|
+
/** "Geist Variable" is Geist: a variable font's file name, not another family. */
|
|
310
|
+
const familyName = (raw) => raw
|
|
311
|
+
.replace(/^[\s"'(]+|[\s"')]+$/g, "")
|
|
312
|
+
.replace(/\s+variable$/i, "")
|
|
313
|
+
.trim();
|
|
314
|
+
/**
|
|
315
|
+
* The typefaces a page uses, most used first, with the weights its `@font-face` rules or its
|
|
316
|
+
* Google / Bunny Fonts links name.
|
|
317
|
+
*/
|
|
318
|
+
function fontsOf(css, html) {
|
|
319
|
+
const counts = new Map();
|
|
320
|
+
const weights = new Map();
|
|
321
|
+
const count = (family, n = 1) => counts.set(family, (counts.get(family) ?? 0) + n);
|
|
322
|
+
const weigh = (family, list) => {
|
|
323
|
+
const set = weights.get(family) ?? new Set();
|
|
324
|
+
for (const w of list) {
|
|
325
|
+
set.add(w);
|
|
326
|
+
}
|
|
327
|
+
weights.set(family, set);
|
|
328
|
+
};
|
|
329
|
+
const first = (decl) => decl
|
|
330
|
+
.split(",")
|
|
331
|
+
.map(familyName)
|
|
332
|
+
.find((f) => /[a-z]/i.test(f) && !GENERIC_FONT.test(f));
|
|
333
|
+
// --font-weight-…, --font-size-… and the like are no families.
|
|
334
|
+
for (const m of css.matchAll(/(?:font-family|--font-(?!weight|size|feature|variation|style|stretch)[\w-]+)\s*:\s*([^;}]+)/gi)) {
|
|
335
|
+
const family = first(m[1]);
|
|
336
|
+
if (family) {
|
|
337
|
+
count(family);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
for (const m of css.matchAll(/@font-face\s*\{([^}]*)\}/gi)) {
|
|
341
|
+
const family = first(m[1].match(/font-family\s*:\s*([^;]+)/i)?.[1] ?? "");
|
|
342
|
+
const range = (m[1].match(/font-weight\s*:\s*([^;]+)/i)?.[1] ?? "400")
|
|
343
|
+
.split(/\s+/)
|
|
344
|
+
.map(Number)
|
|
345
|
+
.filter((n) => n >= 100 && n <= 900);
|
|
346
|
+
if (family && range.length) {
|
|
347
|
+
const [lo, hi] = [Math.min(...range), Math.max(...range)];
|
|
348
|
+
weigh(family, FONT_WEIGHTS.filter((w) => w >= lo && w <= hi));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
// fonts.googleapis.com/css2?family=Inter:wght@400;700 and fonts.bunny.net/css?family=inter:400,700
|
|
352
|
+
for (const m of html.matchAll(/fonts\.(?:googleapis\.com|bunny\.net)\/css2?\?([^"'\s>]+)/gi)) {
|
|
353
|
+
for (const part of m[1].replace(/&/g, "&").split("&")) {
|
|
354
|
+
if (!part.startsWith("family=")) {
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
for (const one of decodeURIComponent(part.slice(7)).split("|")) {
|
|
358
|
+
const [name, spec = ""] = one.split(":");
|
|
359
|
+
const family = familyName(name.replace(/\+/g, " ").replace(/-/g, " ")).replace(/\b\w/g, (c) => c.toUpperCase());
|
|
360
|
+
count(family, 3);
|
|
361
|
+
weigh(family, (spec.match(/\d{3}/g) ?? []).map(Number).filter((w) => w >= 100 && w <= 900));
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return [...counts.entries()]
|
|
366
|
+
.sort((a, b) => b[1] - a[1])
|
|
367
|
+
.slice(0, 6)
|
|
368
|
+
.map(([family]) => ({
|
|
369
|
+
family,
|
|
370
|
+
weights: [...(weights.get(family) ?? [])].sort((a, b) => a - b),
|
|
371
|
+
}));
|
|
372
|
+
}
|
|
373
|
+
/** The typefaces of a web page, for a person to pick from (Typography › from a web address). */
|
|
374
|
+
export async function scanFonts(raw, signal) {
|
|
375
|
+
const { base, html } = await loadPage(raw, signal);
|
|
376
|
+
return fontsOf(await cssOf(html, base, signal), html);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* The colours of a web page, for a person to pick from (Colours › from a web address): its
|
|
380
|
+
* theme colour, the colours its stylesheet names, then the ones it uses most. A named one is
|
|
381
|
+
* named after its variable ("--brand-primary" → "brand primary").
|
|
382
|
+
*/
|
|
383
|
+
export async function scanColors(raw, signal) {
|
|
384
|
+
const { base, html } = await loadPage(raw, signal);
|
|
385
|
+
const { variables, frequent } = coloursOf(await cssOf(html, base, signal));
|
|
386
|
+
const out = [];
|
|
387
|
+
const add = (name, value) => {
|
|
388
|
+
if (value && !out.some((c) => c.value === value)) {
|
|
389
|
+
out.push({ name, value });
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
add("theme color", hex(metaOf(html, "theme-color")));
|
|
393
|
+
for (const v of variables) {
|
|
394
|
+
add(v.name.replace(/^--/, "").replace(/[-_]+/g, " "), v.value);
|
|
395
|
+
}
|
|
396
|
+
for (const value of frequent) {
|
|
397
|
+
add("", value);
|
|
398
|
+
}
|
|
399
|
+
return out.slice(0, 24);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The pictures of a web page, for a person to pick assets from: its share image, then the
|
|
403
|
+
* images it shows, logos left out.
|
|
404
|
+
*/
|
|
405
|
+
export async function scanImages(raw, signal) {
|
|
406
|
+
const { base, html } = await loadPage(raw, signal);
|
|
407
|
+
const out = [];
|
|
408
|
+
const add = (href, hint) => {
|
|
409
|
+
const url = absolute(href, base);
|
|
410
|
+
if (url && !out.some((i) => i.url === url)) {
|
|
411
|
+
out.push({ url, hint });
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const og = metaOf(html, "og:image");
|
|
415
|
+
if (og) {
|
|
416
|
+
add(og, "share image");
|
|
417
|
+
}
|
|
418
|
+
for (const tag of tagsOf(html, "img")) {
|
|
419
|
+
const src = attr(tag, "src") || attr(tag, "data-src");
|
|
420
|
+
if (src && !src.startsWith("data:") && !saysLogo(tag)) {
|
|
421
|
+
add(src, attr(tag, "alt"));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return out.slice(0, 24);
|
|
425
|
+
}
|
|
426
|
+
export async function readWebsite(raw, signal) {
|
|
427
|
+
const { res, base, html } = await loadPage(raw, signal);
|
|
428
|
+
const tags = (name) => tagsOf(html, name);
|
|
429
|
+
const meta = (key) => metaOf(html, key);
|
|
430
|
+
const logos = logosOf(html, base);
|
|
431
|
+
const images = [];
|
|
432
|
+
for (const tag of tags("img")) {
|
|
433
|
+
const src = attr(tag, "src") || attr(tag, "data-src");
|
|
434
|
+
if (!src || src.startsWith("data:") || saysLogo(tag)) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const url = absolute(src, base);
|
|
438
|
+
if (url && images.length < 12 && !images.some((i) => i.url === url)) {
|
|
439
|
+
images.push({ url, alt: attr(tag, "alt") });
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const og = meta("og:image");
|
|
443
|
+
if (og) {
|
|
444
|
+
const url = absolute(og, base);
|
|
445
|
+
if (url) {
|
|
446
|
+
images.unshift({ url, alt: "share image (og:image)" });
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
const css = await cssOf(html, base, signal);
|
|
450
|
+
const host = new URL(base).hostname;
|
|
451
|
+
const links = [];
|
|
452
|
+
for (const m of html.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)) {
|
|
453
|
+
const url = absolute(attr(`<a ${m[1]}>`, "href"), base);
|
|
454
|
+
const text = linkText(m[2]).slice(0, 60);
|
|
455
|
+
if (url &&
|
|
456
|
+
new URL(url).hostname === host &&
|
|
457
|
+
/impressum|imprint|kontakt|contact|about|ueber|über|team|legal|unternehmen|company/i.test(`${url} ${text}`) &&
|
|
458
|
+
!links.some((l) => l.url === url)) {
|
|
459
|
+
links.push({ url, text });
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const text = htmlToMarkdown(html);
|
|
463
|
+
return {
|
|
464
|
+
url: base,
|
|
465
|
+
status: res.status,
|
|
466
|
+
title: html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1].trim() ?? "",
|
|
467
|
+
description: meta("description") || meta("og:description"),
|
|
468
|
+
text: text.length > 9000
|
|
469
|
+
? `${text.slice(0, 9000)}\n…[${text.length - 9000} more characters]`
|
|
470
|
+
: text,
|
|
471
|
+
brand: {
|
|
472
|
+
themeColor: hex(meta("theme-color")),
|
|
473
|
+
...coloursOf(css),
|
|
474
|
+
logos: logos.slice(0, 10),
|
|
475
|
+
images,
|
|
476
|
+
fonts: fontsOf(css, html),
|
|
477
|
+
},
|
|
478
|
+
links: links.slice(0, 10),
|
|
479
|
+
};
|
|
480
|
+
}
|