@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,385 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { accountOverview, knownTeam, linkedAccount, unlink, } from "../auth/account.js";
|
|
3
|
+
import { DeviceSignInError, requestDeviceCode, waitForDeviceSignIn } from "../auth/device.js";
|
|
4
|
+
import { migrateControlDb } from "../db/client.js";
|
|
5
|
+
import { env } from "../env.js";
|
|
6
|
+
import { featuresFile, fileFeatures, writeFeature } from "../features.js";
|
|
7
|
+
import { readInstallNote, writeInstallNote } from "./home.js";
|
|
8
|
+
import { openBrowser, runningRuntime, settings } from "./start.js";
|
|
9
|
+
import { bold, busy, cmd, cyan, dim, tilde } from "./ui.js";
|
|
10
|
+
/**
|
|
11
|
+
* The account of this install, from the terminal. `wizards account` says where it stands,
|
|
12
|
+
* `sign-in` runs the device flow (auth/device.ts), `sign-out` ends the link the way the
|
|
13
|
+
* studio does. The setup's first step is the same sign-in. `--local` keeps an install off the
|
|
14
|
+
* account altogether: `account=off` in the install's `.features` hides every account surface
|
|
15
|
+
* (packages/shared/src/feature-flags.ts), and a note in install.json says so.
|
|
16
|
+
*
|
|
17
|
+
* Everything here reads and writes the install's settings and vault through the runtime's own
|
|
18
|
+
* modules, with or without a runtime running (install-env.ts puts this process where the
|
|
19
|
+
* runtime is). A runtime that runs reads the account from the settings as it goes; what it
|
|
20
|
+
* holds from its start is brought in line by a restart, which is offered.
|
|
21
|
+
*/
|
|
22
|
+
export const INTRO = "Your team, its space and your wizards live in the account. This computer joins the space.";
|
|
23
|
+
let prepared = null;
|
|
24
|
+
/** The control database as the runtime keeps it: a fresh install has none until something opens it. */
|
|
25
|
+
function ready() {
|
|
26
|
+
prepared ??= migrateControlDb();
|
|
27
|
+
return prepared;
|
|
28
|
+
}
|
|
29
|
+
/** Set up with `--local`: the install's `.features` says `account=off`. */
|
|
30
|
+
export function isLocalOnly(file = featuresFile()) {
|
|
31
|
+
return fileFeatures(file).account === false;
|
|
32
|
+
}
|
|
33
|
+
/** `--local`: the switch into the file, the note into install.json. */
|
|
34
|
+
export function localOnly(paths, file = featuresFile()) {
|
|
35
|
+
writeFeature("account", false, file);
|
|
36
|
+
writeInstallNote({ ...readInstallNote(paths), local: true }, paths);
|
|
37
|
+
}
|
|
38
|
+
/** A sign-in ends local-only: the switch follows the default again, the note goes. */
|
|
39
|
+
export function joinedAccount(paths, file = featuresFile()) {
|
|
40
|
+
if (isLocalOnly(file)) {
|
|
41
|
+
writeFeature("account", null, file);
|
|
42
|
+
}
|
|
43
|
+
const note = readInstallNote(paths);
|
|
44
|
+
if (note.local) {
|
|
45
|
+
const { local: _, ...rest } = note;
|
|
46
|
+
writeInstallNote(rest, paths);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** Where the account stands, from this machine alone: no round trip. */
|
|
50
|
+
export async function accountState() {
|
|
51
|
+
if (isLocalOnly()) {
|
|
52
|
+
return { kind: "local" };
|
|
53
|
+
}
|
|
54
|
+
await ready();
|
|
55
|
+
const account = await linkedAccount();
|
|
56
|
+
if (!account) {
|
|
57
|
+
return { kind: "none" };
|
|
58
|
+
}
|
|
59
|
+
return { kind: "linked", account, team: await knownTeam() };
|
|
60
|
+
}
|
|
61
|
+
/** "Matthias · team Platzer Fenster & Türen · 120 credits", as far as it is known. */
|
|
62
|
+
export function described(account, team, credits = true) {
|
|
63
|
+
const parts = [account.name || account.email];
|
|
64
|
+
if (team) {
|
|
65
|
+
// "Team Anna" and "New team" say it themselves: not "team Team Anna".
|
|
66
|
+
parts.push(/\bteam\b/i.test(team.name) ? team.name : `team ${team.name}`);
|
|
67
|
+
if (credits) {
|
|
68
|
+
parts.push(`${team.balanceCredits} credits`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return parts.join(" · ");
|
|
72
|
+
}
|
|
73
|
+
/** One line for the menu and `wizards status`, after the symbol. */
|
|
74
|
+
export function describeAccount(state) {
|
|
75
|
+
switch (state.kind) {
|
|
76
|
+
case "local":
|
|
77
|
+
return "only on this computer, no account";
|
|
78
|
+
case "none":
|
|
79
|
+
return "not signed in";
|
|
80
|
+
default:
|
|
81
|
+
return described(state.account, state.team, false);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** The account's site, as people know it: engenty.ai for account.engenty.ai. */
|
|
85
|
+
const host = () => new URL(env.local.accountUrl).host.replace(/^account\./, "");
|
|
86
|
+
/** `wizards account`: where it stands, with the Manage-App's word when it answers. */
|
|
87
|
+
async function status() {
|
|
88
|
+
const state = await accountState();
|
|
89
|
+
if (state.kind === "local") {
|
|
90
|
+
console.log(`Only on this computer, no account. ${dim(`To connect one: ${cmd("account sign-in")}`)}`);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
if (state.kind === "none") {
|
|
94
|
+
console.log(`Not signed in. ${dim(`To sign in: ${cmd("account sign-in")}`)}`);
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
const overview = await accountOverview();
|
|
98
|
+
const team = overview?.tenant ?? state.team;
|
|
99
|
+
console.log(`Signed in as ${described(state.account, team)} · ${host()}${overview
|
|
100
|
+
? ""
|
|
101
|
+
: dim(` (${host()} didn’t respond${team ? ", so this is from last time" : ""})`)}`);
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
/** A code as people read it off a screen: ABCD-EFGH. */
|
|
105
|
+
export function groupedCode(code) {
|
|
106
|
+
const plain = code.replace(/[\s-]+/g, "").toUpperCase();
|
|
107
|
+
return plain.length === 8 ? `${plain.slice(0, 4)}-${plain.slice(4)}` : code;
|
|
108
|
+
}
|
|
109
|
+
/** Whether a new account needs an invitation code, as the account's own pages say. */
|
|
110
|
+
async function signupByCode() {
|
|
111
|
+
try {
|
|
112
|
+
const res = await fetch(`${env.local.accountUrl}/api/config`, {
|
|
113
|
+
signal: AbortSignal.timeout(3000),
|
|
114
|
+
});
|
|
115
|
+
return (await res.json()).signup === "code";
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Enter and Esc on a terminal while it waits for the browser (Ctrl-C stays the spinner's: it
|
|
123
|
+
* ends the command). Returns what gives the keys back.
|
|
124
|
+
*/
|
|
125
|
+
function onKeys(keys) {
|
|
126
|
+
const input = process.stdin;
|
|
127
|
+
if (!input.isTTY) {
|
|
128
|
+
return () => undefined;
|
|
129
|
+
}
|
|
130
|
+
const raw = input.isRaw;
|
|
131
|
+
input.setRawMode(true);
|
|
132
|
+
input.resume();
|
|
133
|
+
const read = (data) => {
|
|
134
|
+
const key = data.toString();
|
|
135
|
+
if (key === "\r" || key === "\n") {
|
|
136
|
+
keys.enter();
|
|
137
|
+
}
|
|
138
|
+
else if (key === "\x1b") {
|
|
139
|
+
keys.escape();
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
input.on("data", read);
|
|
143
|
+
return () => {
|
|
144
|
+
input.off("data", read);
|
|
145
|
+
input.setRawMode(raw);
|
|
146
|
+
input.pause();
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The device flow on the terminal: the link and the code, the browser opened where there is
|
|
151
|
+
* one, then a wait while the person signs in, or creates their account, and allows it. On a
|
|
152
|
+
* terminal, Enter opens the page again and Esc goes on without an account: someone without an
|
|
153
|
+
* invitation code yet is not stuck in the wait. Null when it ended without an account.
|
|
154
|
+
*/
|
|
155
|
+
async function deviceSignIn(interactive) {
|
|
156
|
+
let code;
|
|
157
|
+
try {
|
|
158
|
+
code = await requestDeviceCode();
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
p.log.error(err.message);
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
const shown = groupedCode(code.userCode);
|
|
165
|
+
// The complete link carries the code: the page only asks to check it.
|
|
166
|
+
const link = code.verificationUriComplete ?? code.verificationUri;
|
|
167
|
+
p.log.message(code.verificationUriComplete
|
|
168
|
+
? `Open ${cyan(link)}\nThe page shows the code ${bold(shown)}: check that it matches.`
|
|
169
|
+
: `Open ${cyan(link)} and enter the code ${bold(shown)}.`);
|
|
170
|
+
const opened = openBrowser(link);
|
|
171
|
+
const newHere = (await signupByCode())
|
|
172
|
+
? "New here? Create your account on that page with your invitation code, or join the waitlist there."
|
|
173
|
+
: "New here? Your account is created on that page.";
|
|
174
|
+
const keys = interactive ? "Enter opens the page again · Esc signs in later" : "";
|
|
175
|
+
p.log.message(dim([opened ? "The page opens in your browser." : "", newHere, keys].filter(Boolean).join("\n")));
|
|
176
|
+
const spinner = busy("Waiting for you in the browser…");
|
|
177
|
+
const later = new AbortController();
|
|
178
|
+
const release = interactive
|
|
179
|
+
? onKeys({ enter: () => void openBrowser(link), escape: () => later.abort() })
|
|
180
|
+
: () => undefined;
|
|
181
|
+
try {
|
|
182
|
+
const account = await waitForDeviceSignIn(code, { signal: later.signal });
|
|
183
|
+
const overview = await accountOverview();
|
|
184
|
+
spinner.stop(`Signed in as ${described(account, overview?.tenant ?? null)}.`);
|
|
185
|
+
return account;
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
if (err instanceof DeviceSignInError && err.reason === "skipped") {
|
|
189
|
+
spinner.stop("Not signed in yet.");
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
spinner.fail(err instanceof DeviceSignInError
|
|
193
|
+
? err.message
|
|
194
|
+
: `The sign-in didn’t work. ${err.message}`);
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
release();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* A runtime that runs reads the account from the settings as it goes, but holds a few things
|
|
203
|
+
* from its start: the Pro modules it loaded, which source the models run on, what was sent to
|
|
204
|
+
* the cloud. A restart brings it in line; the person is asked, or told how.
|
|
205
|
+
*/
|
|
206
|
+
async function pickUp(paths, interactive, why) {
|
|
207
|
+
if (!(await runningRuntime(settings(paths).dataDir))) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (!interactive) {
|
|
211
|
+
p.log.info(`Run ${cmd("restart")} so ${why}.`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const answer = await p.confirm({
|
|
215
|
+
message: `Restart engenty wizards now, so ${why}?`,
|
|
216
|
+
initialValue: true,
|
|
217
|
+
});
|
|
218
|
+
if (p.isCancel(answer) || !answer) {
|
|
219
|
+
p.log.info(dim(`To do it later: ${cmd("restart")}`));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
// status.ts shows the account; loaded here when needed, so neither module waits on the other.
|
|
223
|
+
const { restart } = await import("./status.js");
|
|
224
|
+
await restart(paths);
|
|
225
|
+
}
|
|
226
|
+
const SIGNED_IN = "your plan’s Pro modules load and your published wizards arrive in the cloud";
|
|
227
|
+
async function signIn(paths, interactive) {
|
|
228
|
+
await ready();
|
|
229
|
+
const linked = await linkedAccount();
|
|
230
|
+
if (linked && isLocalOnly()) {
|
|
231
|
+
// Set up with --local by an older version, which kept the link: it only needs switching on.
|
|
232
|
+
joinedAccount(paths);
|
|
233
|
+
p.log.success(`Signed in as ${described(linked, await knownTeam(), false)} again.`);
|
|
234
|
+
await pickUp(paths, interactive, SIGNED_IN);
|
|
235
|
+
return 0;
|
|
236
|
+
}
|
|
237
|
+
if (linked) {
|
|
238
|
+
p.log.info(`Already signed in as ${described(linked, await knownTeam(), false)}. ${dim(`To switch accounts, run ${cmd("account sign-out")} first.`)}`);
|
|
239
|
+
return 0;
|
|
240
|
+
}
|
|
241
|
+
const account = await deviceSignIn(interactive);
|
|
242
|
+
if (!account) {
|
|
243
|
+
p.log.info(dim(`To sign in later: ${cmd("account sign-in")}`));
|
|
244
|
+
return 1;
|
|
245
|
+
}
|
|
246
|
+
joinedAccount(paths);
|
|
247
|
+
p.log.message(dim("What you publish here runs in the cloud too."));
|
|
248
|
+
await pickUp(paths, interactive, SIGNED_IN);
|
|
249
|
+
return 0;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Ends the link to the account: the same as the studio's sign-out (DELETE /api/studio/account).
|
|
253
|
+
*/
|
|
254
|
+
async function disconnect() {
|
|
255
|
+
await unlink();
|
|
256
|
+
// The same as the studio's sign-out (DELETE /api/studio/account): what was sent to the cloud
|
|
257
|
+
// is forgotten, the entitlement goes with the account's plan, and models that ran on its
|
|
258
|
+
// credits run on own keys again. This process never loaded Pro modules or models, so only the
|
|
259
|
+
// settings change here; a runtime that runs lets go of its modules on restart.
|
|
260
|
+
const [{ forgetCloud }, { refreshPro }, models] = await Promise.all([
|
|
261
|
+
import("../services/cloud.js"),
|
|
262
|
+
import("../plugins/pro.js"),
|
|
263
|
+
import("../models.js"),
|
|
264
|
+
]);
|
|
265
|
+
await forgetCloud();
|
|
266
|
+
await refreshPro();
|
|
267
|
+
await models.loadLocalModels();
|
|
268
|
+
if (models.localModelSettings().source === "account") {
|
|
269
|
+
await models.saveLocalModels({ source: "own" });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
async function signOut(paths, interactive) {
|
|
273
|
+
await ready();
|
|
274
|
+
// A link kept from an older --local counts as well: it is still on this computer.
|
|
275
|
+
const linked = await linkedAccount();
|
|
276
|
+
if (!linked) {
|
|
277
|
+
console.log(isLocalOnly()
|
|
278
|
+
? "No account is connected, so there’s nothing to sign out of."
|
|
279
|
+
: "Not signed in.");
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
282
|
+
const spinner = busy(`Signing out ${linked.name || linked.email}…`);
|
|
283
|
+
await disconnect();
|
|
284
|
+
spinner.stop("Signed out. Your wizards and results stay on this computer.");
|
|
285
|
+
await pickUp(paths, interactive, "it disconnects from the account");
|
|
286
|
+
return 0;
|
|
287
|
+
}
|
|
288
|
+
/** `wizards account [sign-in|sign-out]`. */
|
|
289
|
+
export async function accountCommand(paths, value, options) {
|
|
290
|
+
const interactive = !options.yes && Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
291
|
+
switch (value) {
|
|
292
|
+
case "":
|
|
293
|
+
return status();
|
|
294
|
+
case "sign-in":
|
|
295
|
+
case "signin":
|
|
296
|
+
case "login":
|
|
297
|
+
return signIn(paths, interactive);
|
|
298
|
+
case "sign-out":
|
|
299
|
+
case "signout":
|
|
300
|
+
case "logout":
|
|
301
|
+
return signOut(paths, interactive);
|
|
302
|
+
default:
|
|
303
|
+
console.error(`Usage: ${cmd("account [sign-in|sign-out]")}`);
|
|
304
|
+
return 2;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/** The menu's "Account": where it stands, and the way in or out. */
|
|
308
|
+
export async function accountMenu(paths) {
|
|
309
|
+
await status();
|
|
310
|
+
const state = await accountState();
|
|
311
|
+
const action = await p.select({
|
|
312
|
+
message: "Account",
|
|
313
|
+
options: [
|
|
314
|
+
state.kind === "linked"
|
|
315
|
+
? { value: "sign-out", label: "Sign out", hint: "your wizards and results stay here" }
|
|
316
|
+
: { value: "sign-in", label: "Sign in", hint: "with a code, in your browser" },
|
|
317
|
+
{ value: "back", label: "Back" },
|
|
318
|
+
],
|
|
319
|
+
});
|
|
320
|
+
if (p.isCancel(action) || action === "back") {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (action === "sign-in") {
|
|
324
|
+
await signIn(paths, true);
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
await signOut(paths, true);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The setup's first step. `--local` keeps the install off the account; else the person is
|
|
332
|
+
* asked to sign in, unless the setup runs without a terminal (`--yes`), which says how to do
|
|
333
|
+
* it later.
|
|
334
|
+
*/
|
|
335
|
+
export async function accountStep(paths, options, interactive) {
|
|
336
|
+
if (options.local) {
|
|
337
|
+
await ready();
|
|
338
|
+
const linked = await linkedAccount();
|
|
339
|
+
if (linked) {
|
|
340
|
+
// "Nothing leaves this computer" holds only without the link.
|
|
341
|
+
const spinner = busy(`Signing out ${linked.name || linked.email}…`);
|
|
342
|
+
await disconnect();
|
|
343
|
+
spinner.stop(`Signed out ${linked.name || linked.email}.`);
|
|
344
|
+
}
|
|
345
|
+
localOnly(paths);
|
|
346
|
+
p.log.warn(`No account: nothing leaves this computer. Your wizards, your space and results stay in ${tilde(settings(paths).dataDir)}. Links work only on this computer.`);
|
|
347
|
+
p.log.message(dim(`To connect an account any time: ${cmd("account sign-in")}`));
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const state = await accountState();
|
|
351
|
+
if (state.kind === "local") {
|
|
352
|
+
p.log.info(`Only on this computer, no account. ${dim(`To connect one: ${cmd("account sign-in")}`)}`);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (state.kind === "linked") {
|
|
356
|
+
const overview = await accountOverview();
|
|
357
|
+
p.log.success(`Signed in as ${described(state.account, overview?.tenant ?? state.team)}.`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
p.note(INTRO, "Your engenty account");
|
|
361
|
+
if (!interactive) {
|
|
362
|
+
p.log.info(dim(`To sign in later: ${cmd("account sign-in")}`));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const answer = await p.confirm({
|
|
366
|
+
message: "Sign in or create your account now?",
|
|
367
|
+
initialValue: true,
|
|
368
|
+
});
|
|
369
|
+
if (p.isCancel(answer)) {
|
|
370
|
+
p.cancel(`Setup stopped. To run it again: ${cmd("setup")}`);
|
|
371
|
+
return "cancelled";
|
|
372
|
+
}
|
|
373
|
+
if (!answer) {
|
|
374
|
+
p.log.info(dim(`To sign in later: ${cmd("account sign-in")}`));
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const account = await deviceSignIn(interactive);
|
|
378
|
+
if (!account) {
|
|
379
|
+
p.log.info(dim(`To sign in later: ${cmd("account sign-in")}`));
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
joinedAccount(paths);
|
|
383
|
+
p.log.message(dim("What you publish here runs in the cloud too."));
|
|
384
|
+
await pickUp(paths, interactive, SIGNED_IN);
|
|
385
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { lstatSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { installedByScript } from "./home.js";
|
|
7
|
+
import { findOnPath } from "./machine.js";
|
|
8
|
+
const run = promisify(execFile);
|
|
9
|
+
/**
|
|
10
|
+
* engenty wizards starting by itself when the person logs in, so that links and AI clients
|
|
11
|
+
* reach it without anybody starting it: `wizards start --no-open`, on a Mac from a
|
|
12
|
+
* LaunchAgent, on Linux from a systemd user service. Only for an install made by install.sh,
|
|
13
|
+
* whose command stays where it is.
|
|
14
|
+
*/
|
|
15
|
+
export const LOGIN_LABEL = "com.engenty.wizards.login";
|
|
16
|
+
/** The LaunchAgent. */
|
|
17
|
+
export const LOGIN_ITEM = join(homedir(), "Library", "LaunchAgents", `${LOGIN_LABEL}.plist`);
|
|
18
|
+
const xml = (text) => text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
19
|
+
/** The LaunchAgent: the command of this install, started again when it fails. */
|
|
20
|
+
export function loginItemText(command, log) {
|
|
21
|
+
const program = [command, "start", "--no-open"];
|
|
22
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
23
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
24
|
+
<plist version="1.0">
|
|
25
|
+
<dict>
|
|
26
|
+
<key>Label</key>
|
|
27
|
+
<string>${LOGIN_LABEL}</string>
|
|
28
|
+
<key>ProgramArguments</key>
|
|
29
|
+
<array>
|
|
30
|
+
${program.map((arg) => ` <string>${xml(arg)}</string>\n`).join("")} </array>
|
|
31
|
+
<key>RunAtLoad</key>
|
|
32
|
+
<true/>
|
|
33
|
+
<key>KeepAlive</key>
|
|
34
|
+
<dict>
|
|
35
|
+
<key>SuccessfulExit</key>
|
|
36
|
+
<false/>
|
|
37
|
+
</dict>
|
|
38
|
+
<key>StandardOutPath</key>
|
|
39
|
+
<string>${xml(log)}</string>
|
|
40
|
+
<key>StandardErrorPath</key>
|
|
41
|
+
<string>${xml(log)}</string>
|
|
42
|
+
<key>ProcessType</key>
|
|
43
|
+
<string>Interactive</string>
|
|
44
|
+
</dict>
|
|
45
|
+
</plist>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
export const UNIT = "engenty-wizards.service";
|
|
49
|
+
export function unitFile(env = process.env) {
|
|
50
|
+
return join(env.XDG_CONFIG_HOME || join(homedir(), ".config"), "systemd", "user", UNIT);
|
|
51
|
+
}
|
|
52
|
+
/** The systemd user service: the command of this install, started again when it fails. */
|
|
53
|
+
export function unitText(command) {
|
|
54
|
+
return [
|
|
55
|
+
"[Unit]",
|
|
56
|
+
"Description=engenty wizards",
|
|
57
|
+
"Documentation=https://github.com/engenty/wizards",
|
|
58
|
+
"",
|
|
59
|
+
"[Service]",
|
|
60
|
+
`ExecStart="${command.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}" start --no-open`,
|
|
61
|
+
"Restart=on-failure",
|
|
62
|
+
"RestartSec=5",
|
|
63
|
+
"",
|
|
64
|
+
"[Install]",
|
|
65
|
+
"WantedBy=default.target",
|
|
66
|
+
"",
|
|
67
|
+
].join("\n");
|
|
68
|
+
}
|
|
69
|
+
const MAC_HOW = `a LaunchAgent, ${LOGIN_LABEL}`;
|
|
70
|
+
const LINUX_HOW = `a systemd user service, ${UNIT}`;
|
|
71
|
+
async function systemdHere() {
|
|
72
|
+
if (!findOnPath("systemctl", process.env.PATH ?? "")) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
await run("systemctl", ["--user", "show-environment"], { timeout: 10_000 });
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Whether a file is there. Unlike existsSync, a folder it may not look into (a sandbox, its
|
|
85
|
+
* permissions) is an error, not "no file": `autostart off` must not say it's off then.
|
|
86
|
+
*/
|
|
87
|
+
export function present(file) {
|
|
88
|
+
try {
|
|
89
|
+
lstatSync(file);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (error.code === "ENOENT") {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
throw new Error(`Couldn’t check ${file}: ${error.message}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Whether it starts at login, read from the login item itself: a LaunchAgent or unit file that
|
|
101
|
+
* is there counts, whichever copy of the command wrote it. Only an install made by install.sh can
|
|
102
|
+
* write one.
|
|
103
|
+
*/
|
|
104
|
+
export async function autostartState(paths) {
|
|
105
|
+
if (process.platform !== "darwin" && process.platform !== "linux") {
|
|
106
|
+
return {
|
|
107
|
+
unavailable: process.platform === "win32" ? "not on Windows" : `not on ${process.platform}`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const file = process.platform === "darwin" ? LOGIN_ITEM : unitFile();
|
|
111
|
+
const there = present(file);
|
|
112
|
+
if (!there && !installedByScript(paths)) {
|
|
113
|
+
return { unavailable: "only for installs made with the install script" };
|
|
114
|
+
}
|
|
115
|
+
if (process.platform === "darwin") {
|
|
116
|
+
return { on: there, how: MAC_HOW };
|
|
117
|
+
}
|
|
118
|
+
if (!(await systemdHere())) {
|
|
119
|
+
return there
|
|
120
|
+
? { on: true, how: LINUX_HOW }
|
|
121
|
+
: { unavailable: "this system has no systemd user session" };
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
await run("systemctl", ["--user", "is-enabled", "--quiet", UNIT], { timeout: 10_000 });
|
|
125
|
+
return { on: true, how: LINUX_HOW };
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// A unit file that is there but not enabled still counts: `off` takes it away.
|
|
129
|
+
return { on: there, how: LINUX_HOW };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** The LaunchAgent unloaded from this login session, if launchd has it; errors are ignored. */
|
|
133
|
+
export async function unloadLoginItem() {
|
|
134
|
+
const uid = process.getuid?.();
|
|
135
|
+
if (process.platform !== "darwin" || uid === undefined) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
await run("launchctl", ["bootout", `gui/${uid}/${LOGIN_LABEL}`], { timeout: 15_000 }).catch(() => undefined);
|
|
139
|
+
}
|
|
140
|
+
/** The systemd user service disabled, stopped and its file gone. */
|
|
141
|
+
export async function removeUnit(file = unitFile()) {
|
|
142
|
+
if (findOnPath("systemctl", process.env.PATH ?? "")) {
|
|
143
|
+
await run("systemctl", ["--user", "disable", "--now", UNIT]).catch(() => undefined);
|
|
144
|
+
}
|
|
145
|
+
rmSync(file, { force: true });
|
|
146
|
+
if (findOnPath("systemctl", process.env.PATH ?? "")) {
|
|
147
|
+
await run("systemctl", ["--user", "daemon-reload"]).catch(() => undefined);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Switches it on or off; what it is afterwards, or an error the person can read. */
|
|
151
|
+
export async function setAutostart(paths, on) {
|
|
152
|
+
const state = await autostartState(paths);
|
|
153
|
+
if ("unavailable" in state) {
|
|
154
|
+
return state;
|
|
155
|
+
}
|
|
156
|
+
if (process.platform === "darwin") {
|
|
157
|
+
// Takes effect at the next login; nothing is started or stopped now.
|
|
158
|
+
if (on) {
|
|
159
|
+
mkdirSync(dirname(LOGIN_ITEM), { recursive: true });
|
|
160
|
+
writeFileSync(LOGIN_ITEM, loginItemText(join(paths.home, "bin", "wizards"), join(paths.home, "logs", "autostart.log")));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
rmSync(LOGIN_ITEM, { force: true });
|
|
164
|
+
}
|
|
165
|
+
return { on: present(LOGIN_ITEM), how: MAC_HOW };
|
|
166
|
+
}
|
|
167
|
+
const file = unitFile();
|
|
168
|
+
if (on) {
|
|
169
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
170
|
+
writeFileSync(file, unitText(join(paths.home, "bin", "wizards")));
|
|
171
|
+
await run("systemctl", ["--user", "daemon-reload"]);
|
|
172
|
+
await run("systemctl", ["--user", "enable", "--now", UNIT]);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
await removeUnit(file);
|
|
176
|
+
}
|
|
177
|
+
return autostartState(paths);
|
|
178
|
+
}
|
|
179
|
+
/** The state for a status line: a login item that can't be checked reads as unavailable. */
|
|
180
|
+
export function autostartForStatus(paths) {
|
|
181
|
+
return autostartState(paths).catch((error) => ({ unavailable: error.message }));
|
|
182
|
+
}
|