wizards 0.7.3 → 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/README.md +4 -4
- package/bin/wizards.mjs +95 -26
- package/{apps/web/dist/install.sh → install.sh} +23 -5
- package/package.json +2 -58
- package/apps/runtime/dist/agents/architect.js +0 -444
- package/apps/runtime/dist/agents/studio-assistant.js +0 -883
- package/apps/runtime/dist/agents/subscription.js +0 -207
- package/apps/runtime/dist/agents/thought.js +0 -21
- package/apps/runtime/dist/agents/website.js +0 -480
- package/apps/runtime/dist/app.js +0 -359
- package/apps/runtime/dist/apple/wizards-apple +0 -0
- package/apps/runtime/dist/assistant/browser.js +0 -26
- package/apps/runtime/dist/assistant/docs.js +0 -158
- package/apps/runtime/dist/assistant/knows.js +0 -353
- package/apps/runtime/dist/assistant/primer.js +0 -26
- package/apps/runtime/dist/assistant/runs.js +0 -24
- package/apps/runtime/dist/auth/account.js +0 -175
- package/apps/runtime/dist/auth/device.js +0 -112
- package/apps/runtime/dist/auth/index.js +0 -358
- package/apps/runtime/dist/auth/keys.js +0 -55
- package/apps/runtime/dist/auth/local-ticket.js +0 -26
- package/apps/runtime/dist/authoring/example.js +0 -74
- package/apps/runtime/dist/authoring/guide.js +0 -433
- package/apps/runtime/dist/authoring/ops.js +0 -117
- package/apps/runtime/dist/browser/fast/action-space.js +0 -160
- package/apps/runtime/dist/browser/fast/classifier.js +0 -91
- package/apps/runtime/dist/browser/fast/decide.js +0 -171
- package/apps/runtime/dist/browser/fast/driver.js +0 -141
- package/apps/runtime/dist/browser/fast/instructions.js +0 -33
- package/apps/runtime/dist/browser/fast/run.js +0 -249
- package/apps/runtime/dist/browser/fast/span-picker.js +0 -153
- package/apps/runtime/dist/browser/fast/text-helper.js +0 -178
- package/apps/runtime/dist/browser/snapshot.js +0 -335
- package/apps/runtime/dist/cli/account.js +0 -385
- package/apps/runtime/dist/cli/autostart.js +0 -182
- package/apps/runtime/dist/cli/autoupdate.js +0 -221
- package/apps/runtime/dist/cli/clients.js +0 -44
- package/apps/runtime/dist/cli/connect.js +0 -539
- package/apps/runtime/dist/cli/environment.js +0 -93
- package/apps/runtime/dist/cli/exec.js +0 -45
- package/apps/runtime/dist/cli/features.js +0 -50
- package/apps/runtime/dist/cli/home.js +0 -88
- package/apps/runtime/dist/cli/install-env.js +0 -33
- package/apps/runtime/dist/cli/machine.js +0 -106
- package/apps/runtime/dist/cli/main.js +0 -222
- package/apps/runtime/dist/cli/mcp.js +0 -136
- package/apps/runtime/dist/cli/menu.js +0 -202
- package/apps/runtime/dist/cli/processes.js +0 -72
- package/apps/runtime/dist/cli/report.js +0 -66
- package/apps/runtime/dist/cli/setup.js +0 -335
- package/apps/runtime/dist/cli/start.js +0 -276
- package/apps/runtime/dist/cli/status.js +0 -203
- package/apps/runtime/dist/cli/ui.js +0 -59
- package/apps/runtime/dist/cli/uninstall-main.js +0 -20
- package/apps/runtime/dist/cli/uninstall.js +0 -231
- package/apps/runtime/dist/cli/update.js +0 -86
- package/apps/runtime/dist/cli/validate.js +0 -75
- package/apps/runtime/dist/cli/versions.js +0 -106
- package/apps/runtime/dist/connectors/builtin.js +0 -86
- package/apps/runtime/dist/connectors/external.js +0 -409
- package/apps/runtime/dist/connectors/gmail.js +0 -107
- package/apps/runtime/dist/connectors/imap.js +0 -261
- package/apps/runtime/dist/connectors/index.js +0 -325
- package/apps/runtime/dist/connectors/mail.js +0 -72
- package/apps/runtime/dist/connectors/outlook.js +0 -90
- package/apps/runtime/dist/connectors/plugin-connections.js +0 -343
- package/apps/runtime/dist/connectors/via-account.js +0 -65
- package/apps/runtime/dist/credits/credits.js +0 -100
- package/apps/runtime/dist/credits/estimate.js +0 -152
- package/apps/runtime/dist/db/adopt.js +0 -149
- package/apps/runtime/dist/db/client.js +0 -173
- package/apps/runtime/dist/db/control-schema.js +0 -133
- package/apps/runtime/dist/db/migrations/control/0000_last_absorbing_man.sql +0 -47
- package/apps/runtime/dist/db/migrations/control/0001_gorgeous_nicolaos.sql +0 -41
- package/apps/runtime/dist/db/migrations/control/0002_secret_penance.sql +0 -1
- package/apps/runtime/dist/db/migrations/control/0003_nasty_mordo.sql +0 -3
- package/apps/runtime/dist/db/migrations/control/0004_breezy_eddie_brock.sql +0 -6
- package/apps/runtime/dist/db/migrations/control/0005_chilly_oracle.sql +0 -1
- package/apps/runtime/dist/db/migrations/control/0006_sleepy_mojo.sql +0 -1
- package/apps/runtime/dist/db/migrations/control/0007_common_the_hand.sql +0 -15
- package/apps/runtime/dist/db/migrations/control/0008_runner.sql +0 -8
- package/apps/runtime/dist/db/migrations/control/0009_plugin_claim.sql +0 -9
- package/apps/runtime/dist/db/migrations/control/0010_tan_snowbird.sql +0 -6
- package/apps/runtime/dist/db/migrations/control/meta/0000_snapshot.json +0 -311
- package/apps/runtime/dist/db/migrations/control/meta/0001_snapshot.json +0 -599
- package/apps/runtime/dist/db/migrations/control/meta/0002_snapshot.json +0 -607
- package/apps/runtime/dist/db/migrations/control/meta/0003_snapshot.json +0 -311
- package/apps/runtime/dist/db/migrations/control/meta/0004_snapshot.json +0 -350
- package/apps/runtime/dist/db/migrations/control/meta/0005_snapshot.json +0 -358
- package/apps/runtime/dist/db/migrations/control/meta/0006_snapshot.json +0 -365
- package/apps/runtime/dist/db/migrations/control/meta/0007_snapshot.json +0 -460
- package/apps/runtime/dist/db/migrations/control/meta/0008_snapshot.json +0 -505
- package/apps/runtime/dist/db/migrations/control/meta/0009_snapshot.json +0 -561
- package/apps/runtime/dist/db/migrations/control/meta/0010_snapshot.json +0 -600
- package/apps/runtime/dist/db/migrations/control/meta/_journal.json +0 -83
- package/apps/runtime/dist/db/migrations/tenant/0000_eminent_freak.sql +0 -188
- package/apps/runtime/dist/db/migrations/tenant/0001_salty_master_chief.sql +0 -1
- package/apps/runtime/dist/db/migrations/tenant/0002_cloudy_firebird.sql +0 -1
- package/apps/runtime/dist/db/migrations/tenant/0003_brown_warbound.sql +0 -52
- package/apps/runtime/dist/db/migrations/tenant/0004_romantic_nocturne.sql +0 -6
- package/apps/runtime/dist/db/migrations/tenant/0005_reflective_forgotten_one.sql +0 -2
- package/apps/runtime/dist/db/migrations/tenant/0006_hard_war_machine.sql +0 -30
- package/apps/runtime/dist/db/migrations/tenant/0007_space_data.sql +0 -43
- package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +0 -1
- package/apps/runtime/dist/db/migrations/tenant/0009_knowledge.sql +0 -104
- package/apps/runtime/dist/db/migrations/tenant/0010_plugin_connection.sql +0 -15
- package/apps/runtime/dist/db/migrations/tenant/0011_runners.sql +0 -2
- package/apps/runtime/dist/db/migrations/tenant/0012_assistant_chat.sql +0 -40
- package/apps/runtime/dist/db/migrations/tenant/0013_run_origin.sql +0 -1
- package/apps/runtime/dist/db/migrations/tenant/0014_run_answer.sql +0 -2
- package/apps/runtime/dist/db/migrations/tenant/0015_device_calls.sql +0 -13
- package/apps/runtime/dist/db/migrations/tenant/0016_even_trish_tilby.sql +0 -12
- package/apps/runtime/dist/db/migrations/tenant/meta/0000_snapshot.json +0 -1323
- package/apps/runtime/dist/db/migrations/tenant/meta/0001_snapshot.json +0 -1330
- package/apps/runtime/dist/db/migrations/tenant/meta/0002_snapshot.json +0 -1337
- package/apps/runtime/dist/db/migrations/tenant/meta/0003_snapshot.json +0 -1605
- package/apps/runtime/dist/db/migrations/tenant/meta/0004_snapshot.json +0 -1645
- package/apps/runtime/dist/db/migrations/tenant/meta/0005_snapshot.json +0 -1659
- package/apps/runtime/dist/db/migrations/tenant/meta/0006_snapshot.json +0 -1696
- package/apps/runtime/dist/db/migrations/tenant/meta/0007_snapshot.json +0 -2012
- package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +0 -2019
- package/apps/runtime/dist/db/migrations/tenant/meta/0009_snapshot.json +0 -2837
- package/apps/runtime/dist/db/migrations/tenant/meta/0010_snapshot.json +0 -2942
- package/apps/runtime/dist/db/migrations/tenant/meta/0011_snapshot.json +0 -2956
- package/apps/runtime/dist/db/migrations/tenant/meta/0012_snapshot.json +0 -3132
- package/apps/runtime/dist/db/migrations/tenant/meta/0013_snapshot.json +0 -3139
- package/apps/runtime/dist/db/migrations/tenant/meta/0014_snapshot.json +0 -3154
- package/apps/runtime/dist/db/migrations/tenant/meta/0015_snapshot.json +0 -3243
- package/apps/runtime/dist/db/migrations/tenant/meta/0016_snapshot.json +0 -3326
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +0 -125
- package/apps/runtime/dist/db/schema.js +0 -602
- package/apps/runtime/dist/debug.js +0 -196
- package/apps/runtime/dist/docs/dev/index.md +0 -41
- package/apps/runtime/dist/docs/dev/meta.json +0 -7
- package/apps/runtime/dist/docs/dev/plugins/connections.md +0 -74
- package/apps/runtime/dist/docs/dev/plugins/events.md +0 -89
- package/apps/runtime/dist/docs/dev/plugins/examples.md +0 -101
- package/apps/runtime/dist/docs/dev/plugins/index.md +0 -78
- package/apps/runtime/dist/docs/dev/plugins/layout.md +0 -90
- package/apps/runtime/dist/docs/dev/plugins/meta.json +0 -28
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +0 -94
- package/apps/runtime/dist/docs/dev/plugins/reference.md +0 -348
- package/apps/runtime/dist/docs/dev/plugins/reloading.md +0 -76
- package/apps/runtime/dist/docs/dev/plugins/routes.md +0 -185
- package/apps/runtime/dist/docs/dev/plugins/runners.md +0 -230
- package/apps/runtime/dist/docs/dev/plugins/server.md +0 -281
- package/apps/runtime/dist/docs/dev/plugins/shipping.md +0 -79
- package/apps/runtime/dist/docs/dev/plugins/space.md +0 -297
- package/apps/runtime/dist/docs/dev/plugins/starters.md +0 -70
- package/apps/runtime/dist/docs/dev/plugins/studio.md +0 -363
- package/apps/runtime/dist/docs/dev/plugins/styling.md +0 -129
- package/apps/runtime/dist/docs/dev/plugins/tables.md +0 -104
- package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -139
- package/apps/runtime/dist/docs/dev/wizard-format.md +0 -121
- package/apps/runtime/dist/docs/meta.json +0 -3
- package/apps/runtime/dist/docs/user/ai-apps.md +0 -112
- package/apps/runtime/dist/docs/user/assistant.md +0 -77
- package/apps/runtime/dist/docs/user/build-a-wizard.md +0 -116
- package/apps/runtime/dist/docs/user/command-line.md +0 -83
- package/apps/runtime/dist/docs/user/connectors.md +0 -90
- package/apps/runtime/dist/docs/user/create-account.md +0 -52
- package/apps/runtime/dist/docs/user/data.md +0 -66
- package/apps/runtime/dist/docs/user/first-start.md +0 -55
- package/apps/runtime/dist/docs/user/index.md +0 -49
- package/apps/runtime/dist/docs/user/install.md +0 -121
- package/apps/runtime/dist/docs/user/local-only.md +0 -42
- package/apps/runtime/dist/docs/user/meta.json +0 -32
- package/apps/runtime/dist/docs/user/models.md +0 -156
- package/apps/runtime/dist/docs/user/plugins.md +0 -71
- package/apps/runtime/dist/docs/user/run.md +0 -98
- package/apps/runtime/dist/docs/user/server.md +0 -52
- package/apps/runtime/dist/docs/user/space.md +0 -126
- package/apps/runtime/dist/docs/user/steps.md +0 -220
- package/apps/runtime/dist/docs/user/test-and-share.md +0 -224
- package/apps/runtime/dist/docs/user/troubleshooting.md +0 -67
- package/apps/runtime/dist/docs/user/wordpress.md +0 -121
- package/apps/runtime/dist/documents/parse.js +0 -246
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +0 -193
- package/apps/runtime/dist/engenty/connections-external/errors.js +0 -11
- package/apps/runtime/dist/engenty/connections-external/import-service.js +0 -270
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +0 -34
- package/apps/runtime/dist/engenty/connections-external/importer/map-auth.js +0 -185
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-mcp.js +0 -63
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-openapi.js +0 -130
- package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +0 -143
- package/apps/runtime/dist/engenty/connections-external/invoke/mcp-client.js +0 -143
- package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +0 -119
- package/apps/runtime/dist/engenty/connections-external/oauth-dcr.js +0 -88
- package/apps/runtime/dist/engenty/connections-external/registry-client.js +0 -336
- package/apps/runtime/dist/engenty/connections-external/registry-source.js +0 -82
- package/apps/runtime/dist/engenty/connections-external/types.js +0 -7
- package/apps/runtime/dist/engenty/connections-github/connector.js +0 -209
- package/apps/runtime/dist/engenty/connections-google/connectors/calendar.js +0 -381
- package/apps/runtime/dist/engenty/connections-google/connectors/contacts.js +0 -94
- package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +0 -290
- package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +0 -567
- package/apps/runtime/dist/engenty/connections-google/definitions.js +0 -11
- package/apps/runtime/dist/engenty/connections-google/shared.js +0 -73
- package/apps/runtime/dist/engenty/connections-hubspot/connector.js +0 -140
- package/apps/runtime/dist/engenty/connections-microsoft/action.js +0 -17
- package/apps/runtime/dist/engenty/connections-microsoft/graph.js +0 -114
- package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +0 -286
- package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +0 -492
- package/apps/runtime/dist/engenty/connections-s3/s3.js +0 -328
- package/apps/runtime/dist/engenty/connections-sdk/files-capability.js +0 -86
- package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +0 -150
- package/apps/runtime/dist/engenty/connections-sdk/registry.js +0 -89
- package/apps/runtime/dist/engenty/connections-sdk/storage-capability.js +0 -84
- package/apps/runtime/dist/engenty/connections-sdk/types.js +0 -30
- package/apps/runtime/dist/engenty/connections-slack/connector.js +0 -360
- package/apps/runtime/dist/engenty/csv-import/csv-matrix.js +0 -178
- package/apps/runtime/dist/engenty/csv-import/import-sources.js +0 -87
- package/apps/runtime/dist/engenty/csv-import/parse-csv.js +0 -129
- package/apps/runtime/dist/engenty/csv-import/serialize-csv.js +0 -20
- package/apps/runtime/dist/engenty/csv-import/types.js +0 -1
- package/apps/runtime/dist/engenty/csv-import/xlsx-workbook.js +0 -159
- package/apps/runtime/dist/engenty/doc-converter/interface.js +0 -9
- package/apps/runtime/dist/engenty/doc-converter/page-break.js +0 -92
- package/apps/runtime/dist/engenty/doc-converter/providers/local/index.js +0 -72
- package/apps/runtime/dist/engenty/document-scanner/schemas/classifier.js +0 -30
- package/apps/runtime/dist/engenty/document-scanner/schemas/index.js +0 -4
- package/apps/runtime/dist/engenty/document-scanner/schemas/invoice.js +0 -73
- package/apps/runtime/dist/engenty/document-scanner/schemas/receipt.js +0 -63
- package/apps/runtime/dist/engenty/document-scanner/schemas/shared.js +0 -40
- package/apps/runtime/dist/engenty/search-index/chunks.js +0 -164
- package/apps/runtime/dist/engenty/search-index/contracts.js +0 -9
- package/apps/runtime/dist/engenty/shims/connections-sdk.js +0 -39
- package/apps/runtime/dist/engenty/shims/plugin-sdk.js +0 -1
- package/apps/runtime/dist/engenty/shims/web-ingest.js +0 -19
- package/apps/runtime/dist/engenty/web-ingest/ssrf.js +0 -277
- package/apps/runtime/dist/engine/asks.js +0 -82
- package/apps/runtime/dist/engine/decide.js +0 -82
- package/apps/runtime/dist/engine/device.js +0 -194
- package/apps/runtime/dist/engine/events.js +0 -128
- package/apps/runtime/dist/engine/input.js +0 -208
- package/apps/runtime/dist/engine/owner.js +0 -32
- package/apps/runtime/dist/engine/prepare.js +0 -90
- package/apps/runtime/dist/engine/push.js +0 -58
- package/apps/runtime/dist/engine/requirements.js +0 -355
- package/apps/runtime/dist/engine/resources.js +0 -198
- package/apps/runtime/dist/engine/runner.js +0 -970
- package/apps/runtime/dist/engine/steps.js +0 -1000
- package/apps/runtime/dist/engine/surface.js +0 -91
- package/apps/runtime/dist/engine/template.js +0 -240
- package/apps/runtime/dist/engine/types.js +0 -4
- package/apps/runtime/dist/env.js +0 -295
- package/apps/runtime/dist/features.js +0 -123
- package/apps/runtime/dist/files/blobs.js +0 -22
- package/apps/runtime/dist/files/objects.js +0 -86
- package/apps/runtime/dist/files/storage.js +0 -120
- package/apps/runtime/dist/files/web-images.js +0 -101
- package/apps/runtime/dist/film/project.js +0 -257
- package/apps/runtime/dist/film/skills.js +0 -91
- package/apps/runtime/dist/film/sounds.js +0 -122
- package/apps/runtime/dist/film/step.js +0 -289
- package/apps/runtime/dist/film/tools.js +0 -99
- package/apps/runtime/dist/geocode.js +0 -58
- package/apps/runtime/dist/harness/apple.js +0 -269
- package/apps/runtime/dist/harness/claude.js +0 -147
- package/apps/runtime/dist/harness/codex.js +0 -229
- package/apps/runtime/dist/harness/cursor.js +0 -93
- package/apps/runtime/dist/harness/env.js +0 -124
- package/apps/runtime/dist/harness/gemini.js +0 -126
- package/apps/runtime/dist/harness/index.js +0 -95
- package/apps/runtime/dist/harness/model.js +0 -271
- package/apps/runtime/dist/harness/prompt.js +0 -121
- package/apps/runtime/dist/harness/terminal.js +0 -194
- package/apps/runtime/dist/harness/types.js +0 -7
- package/apps/runtime/dist/index.js +0 -113
- package/apps/runtime/dist/limits.js +0 -81
- package/apps/runtime/dist/link-preview.js +0 -60
- package/apps/runtime/dist/log.js +0 -106
- package/apps/runtime/dist/manage.js +0 -249
- package/apps/runtime/dist/mcp/auth.js +0 -161
- package/apps/runtime/dist/mcp/bridge.js +0 -59
- package/apps/runtime/dist/mcp/flow-app.js +0 -97
- package/apps/runtime/dist/mcp/handler.js +0 -54
- package/apps/runtime/dist/mcp/scopes.js +0 -14
- package/apps/runtime/dist/mcp/seen.js +0 -65
- package/apps/runtime/dist/mcp/tools.js +0 -572
- package/apps/runtime/dist/media/conversation.js +0 -167
- package/apps/runtime/dist/media/ffmpeg.js +0 -121
- package/apps/runtime/dist/media/generate.js +0 -120
- package/apps/runtime/dist/media/marking.js +0 -121
- package/apps/runtime/dist/media/transcribe.js +0 -198
- package/apps/runtime/dist/model-errors.js +0 -42
- package/apps/runtime/dist/models.js +0 -1106
- package/apps/runtime/dist/plugin.js +0 -61
- package/apps/runtime/dist/plugins/channels.js +0 -78
- package/apps/runtime/dist/plugins/claims.js +0 -56
- package/apps/runtime/dist/plugins/discovery.js +0 -155
- package/apps/runtime/dist/plugins/events.js +0 -63
- package/apps/runtime/dist/plugins/jobs.js +0 -64
- package/apps/runtime/dist/plugins/loader.js +0 -501
- package/apps/runtime/dist/plugins/migrations.js +0 -69
- package/apps/runtime/dist/plugins/pro-keys.js +0 -34
- package/apps/runtime/dist/plugins/pro-state.js +0 -83
- package/apps/runtime/dist/plugins/pro.js +0 -310
- package/apps/runtime/dist/plugins/public.js +0 -44
- package/apps/runtime/dist/plugins/registry.js +0 -122
- package/apps/runtime/dist/plugins/runs.js +0 -210
- package/apps/runtime/dist/render/browser-path.js +0 -54
- package/apps/runtime/dist/render/chromium.js +0 -98
- package/apps/runtime/dist/render/convert.js +0 -158
- package/apps/runtime/dist/render/downloads.js +0 -299
- package/apps/runtime/dist/render/guard.js +0 -25
- package/apps/runtime/dist/render/shaped.js +0 -137
- package/apps/runtime/dist/routes/api.js +0 -440
- package/apps/runtime/dist/routes/debug.js +0 -42
- package/apps/runtime/dist/routes/delivery.js +0 -90
- package/apps/runtime/dist/routes/internal.js +0 -81
- package/apps/runtime/dist/routes/lang.js +0 -25
- package/apps/runtime/dist/routes/marketplace.js +0 -43
- package/apps/runtime/dist/routes/plugin-public.js +0 -113
- package/apps/runtime/dist/routes/plugins.js +0 -212
- package/apps/runtime/dist/routes/runs.js +0 -1422
- package/apps/runtime/dist/routes/studio.js +0 -1600
- package/apps/runtime/dist/routes/wizard-stream.js +0 -30
- package/apps/runtime/dist/running.js +0 -39
- package/apps/runtime/dist/sandbox/docker.js +0 -75
- package/apps/runtime/dist/sandbox/index.js +0 -23
- package/apps/runtime/dist/sandbox/types.js +0 -1
- package/apps/runtime/dist/secrets/crypto.js +0 -28
- package/apps/runtime/dist/secrets/signing.js +0 -52
- package/apps/runtime/dist/secrets/vault.js +0 -59
- package/apps/runtime/dist/services/access.js +0 -88
- package/apps/runtime/dist/services/api.js +0 -248
- package/apps/runtime/dist/services/architect.js +0 -95
- package/apps/runtime/dist/services/assistant-chats.js +0 -311
- package/apps/runtime/dist/services/brand.js +0 -85
- package/apps/runtime/dist/services/cloud.js +0 -456
- package/apps/runtime/dist/services/draft-events.js +0 -27
- package/apps/runtime/dist/services/engenty-shapes.js +0 -71
- package/apps/runtime/dist/services/errors.js +0 -29
- package/apps/runtime/dist/services/files.js +0 -178
- package/apps/runtime/dist/services/knowledge-model.js +0 -559
- package/apps/runtime/dist/services/knowledge.js +0 -721
- package/apps/runtime/dist/services/links.js +0 -16
- package/apps/runtime/dist/services/marketplace.js +0 -492
- package/apps/runtime/dist/services/onboarding.js +0 -152
- package/apps/runtime/dist/services/package-file.js +0 -82
- package/apps/runtime/dist/services/package.js +0 -170
- package/apps/runtime/dist/services/profile.js +0 -51
- package/apps/runtime/dist/services/project-files.js +0 -439
- package/apps/runtime/dist/services/project-index.js +0 -707
- package/apps/runtime/dist/services/projects.js +0 -387
- package/apps/runtime/dist/services/relevance.js +0 -58
- package/apps/runtime/dist/services/runners.js +0 -178
- package/apps/runtime/dist/services/runs.js +0 -524
- package/apps/runtime/dist/services/shares.js +0 -130
- package/apps/runtime/dist/services/site.js +0 -270
- package/apps/runtime/dist/services/space-categories.js +0 -861
- package/apps/runtime/dist/services/space-data.js +0 -792
- package/apps/runtime/dist/services/space-origin.js +0 -207
- package/apps/runtime/dist/services/spaces.js +0 -656
- package/apps/runtime/dist/services/translations.js +0 -306
- package/apps/runtime/dist/services/widgets.js +0 -34
- package/apps/runtime/dist/services/wizard-icon.js +0 -157
- package/apps/runtime/dist/services/wizards.js +0 -420
- package/apps/runtime/dist/settings.js +0 -16
- package/apps/runtime/dist/store/errors.js +0 -4
- package/apps/runtime/dist/store/index.js +0 -299
- package/apps/runtime/dist/store/shared-lists.js +0 -123
- package/apps/runtime/dist/tenants/control.js +0 -238
- package/apps/runtime/dist/tenants/tenant.js +0 -26
- package/apps/runtime/dist/texts.js +0 -203
- package/apps/runtime/dist/tools/browser.js +0 -703
- package/apps/runtime/dist/tools/connector.js +0 -204
- package/apps/runtime/dist/tools/index.js +0 -291
- package/apps/runtime/dist/tools/mail.js +0 -104
- package/apps/runtime/dist/tools/net-guard.js +0 -170
- package/apps/runtime/dist/tools/pages.js +0 -81
- package/apps/runtime/dist/tools/plugin.js +0 -180
- package/apps/runtime/dist/tools/project.js +0 -154
- package/apps/runtime/dist/tools/shared.js +0 -69
- package/apps/runtime/dist/tools/store.js +0 -238
- package/apps/runtime/dist/update.js +0 -113
- package/apps/runtime/dist/widgets/bundle.js +0 -99
- package/apps/runtime/dist/widgets/render.js +0 -329
- package/apps/runtime/dist/widgets/runtime.js +0 -108
- package/apps/runtime/dist/widgets/script.js +0 -30
- package/apps/runtime/dist/widgets/step.js +0 -223
- package/apps/web/dist/ai-labels/ai-black.svg +0 -20
- package/apps/web/dist/ai-labels/ai-generated-black.svg +0 -31
- package/apps/web/dist/ai-labels/ai-generated-white.svg +0 -32
- package/apps/web/dist/ai-labels/ai-modified-black.svg +0 -30
- package/apps/web/dist/ai-labels/ai-modified-white.svg +0 -31
- package/apps/web/dist/ai-labels/ai-white.svg +0 -21
- package/apps/web/dist/assets/AboutDialog--aZOfowz.js +0 -1
- package/apps/web/dist/assets/ChangelogDialog-CcMXT8l9.js +0 -1
- package/apps/web/dist/assets/ChatView-BqK5nH84.js +0 -10
- package/apps/web/dist/assets/EditorPage-BRZmuMsK.js +0 -3
- package/apps/web/dist/assets/FlowPreview-CpA_aX8t.js +0 -1
- package/apps/web/dist/assets/Harness-BrP-ENHg.css +0 -1
- package/apps/web/dist/assets/Harness-C8demwfW.js +0 -16
- package/apps/web/dist/assets/NewWizardChannels-vph1mN1m.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-u1BIy4q9.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-BR3FmORm.js +0 -1
- package/apps/web/dist/assets/ProjectPage-BWN0iO0X.js +0 -1
- package/apps/web/dist/assets/PublicRunner-CohatW8Y.js +0 -1
- package/apps/web/dist/assets/ReadOnly-rQGZBuzb.js +0 -1
- package/apps/web/dist/assets/RunDrawer-Cs8XqQUo.js +0 -4
- package/apps/web/dist/assets/RunnerView-B85O0i1h.js +0 -1
- package/apps/web/dist/assets/SettingsPage-CM6HfO-O.js +0 -1
- package/apps/web/dist/assets/SetupPage-BpAobBc4.js +0 -1
- package/apps/web/dist/assets/SharePage-CbmAN4M4.js +0 -1
- package/apps/web/dist/assets/changelog-BBR59khF.js +0 -1
- package/apps/web/dist/assets/engenty-eXZ-EAwd.js +0 -1
- package/apps/web/dist/assets/esm-CY-A_13f.js +0 -7
- package/apps/web/dist/assets/fluffy-engenty-ClRou7yu.js +0 -456
- package/apps/web/dist/assets/index-C7HL_Fjz.js +0 -14
- package/apps/web/dist/assets/index-Co9Yr23e.css +0 -1
- package/apps/web/dist/assets/jsx-runtime-BNakU3Ej.js +0 -1
- package/apps/web/dist/assets/lock--JFmtLDU.js +0 -1
- package/apps/web/dist/assets/oss-credits-BJrR7BR1.js +0 -1
- package/apps/web/dist/assets/pdfmake-Cx9scTbD.js +0 -228
- package/apps/web/dist/assets/phone-DMtADQ4-.js +0 -1
- package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +0 -1
- package/apps/web/dist/assets/qr-scanner-worker.min-CJaXo3yu.js +0 -98
- package/apps/web/dist/assets/qr-scanner.min-C_UI0gH-.js +0 -1
- package/apps/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
- package/apps/web/dist/assets/settings-menu-Dac4JUiM.js +0 -1
- package/apps/web/dist/assets/ui-CTXSFCzc.js +0 -137
- package/apps/web/dist/assets/upload-Bcpc3mDn.js +0 -1
- package/apps/web/dist/assets/vfs_fonts-DllDSYt1.js +0 -1
- package/apps/web/dist/embed.js +0 -266
- package/apps/web/dist/favicon.svg +0 -1
- 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 +0 -48
- package/apps/web/dist/manifest.webmanifest +0 -21
- package/apps/web/dist/mcp/flow.html +0 -980
- package/apps/web/dist/sw.js +0 -15
- package/modules/README.md +0 -15
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +0 -1150
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.js +0 -4
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.d.ts +0 -322
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.js +0 -4
- package/node_modules/@engenty-wizards/plugin-sdk/dist/thread.d.ts +0 -174
- package/node_modules/@engenty-wizards/plugin-sdk/dist/thread.js +0 -821
- package/node_modules/@engenty-wizards/plugin-sdk/package.json +0 -11
- package/node_modules/@engenty-wizards/shared/dist/assistant.d.ts +0 -174
- package/node_modules/@engenty-wizards/shared/dist/assistant.js +0 -65
- package/node_modules/@engenty-wizards/shared/dist/changes.d.ts +0 -22
- package/node_modules/@engenty-wizards/shared/dist/changes.js +0 -61
- package/node_modules/@engenty-wizards/shared/dist/connectors.d.ts +0 -77
- package/node_modules/@engenty-wizards/shared/dist/connectors.js +0 -2
- package/node_modules/@engenty-wizards/shared/dist/decision.d.ts +0 -76
- package/node_modules/@engenty-wizards/shared/dist/decision.js +0 -147
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +0 -2922
- package/node_modules/@engenty-wizards/shared/dist/definition.js +0 -1920
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.d.ts +0 -5
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.js +0 -132
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.d.ts +0 -11
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.js +0 -209
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.d.ts +0 -532
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +0 -217
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.d.ts +0 -3
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.js +0 -3
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.d.ts +0 -14
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.js +0 -166
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.d.ts +0 -33
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.js +0 -99
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.d.ts +0 -78
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.js +0 -70
- package/node_modules/@engenty-wizards/shared/dist/features.d.ts +0 -41
- package/node_modules/@engenty-wizards/shared/dist/features.js +0 -89
- package/node_modules/@engenty-wizards/shared/dist/fit.d.ts +0 -71
- package/node_modules/@engenty-wizards/shared/dist/fit.js +0 -382
- package/node_modules/@engenty-wizards/shared/dist/json-schema.d.ts +0 -14
- package/node_modules/@engenty-wizards/shared/dist/json-schema.js +0 -66
- package/node_modules/@engenty-wizards/shared/dist/knowledge.d.ts +0 -199
- package/node_modules/@engenty-wizards/shared/dist/knowledge.js +0 -68
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.d.ts +0 -35
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.js +0 -107
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.d.ts +0 -20
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.js +0 -136
- package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +0 -227
- package/node_modules/@engenty-wizards/shared/dist/marketplace.js +0 -354
- package/node_modules/@engenty-wizards/shared/dist/merge.d.ts +0 -7
- package/node_modules/@engenty-wizards/shared/dist/merge.js +0 -40
- package/node_modules/@engenty-wizards/shared/dist/numbers.d.ts +0 -24
- package/node_modules/@engenty-wizards/shared/dist/numbers.js +0 -54
- package/node_modules/@engenty-wizards/shared/dist/projects.d.ts +0 -224
- package/node_modules/@engenty-wizards/shared/dist/projects.js +0 -319
- package/node_modules/@engenty-wizards/shared/dist/providers.d.ts +0 -101
- package/node_modules/@engenty-wizards/shared/dist/providers.js +0 -390
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +0 -679
- package/node_modules/@engenty-wizards/shared/dist/run.js +0 -618
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.d.ts +0 -546
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.js +0 -523
- package/node_modules/@engenty-wizards/shared/dist/runners.d.ts +0 -93
- package/node_modules/@engenty-wizards/shared/dist/runners.js +0 -146
- package/node_modules/@engenty-wizards/shared/dist/shape.d.ts +0 -102
- package/node_modules/@engenty-wizards/shared/dist/shape.js +0 -318
- package/node_modules/@engenty-wizards/shared/dist/space-data.d.ts +0 -89
- package/node_modules/@engenty-wizards/shared/dist/space-data.js +0 -47
- package/node_modules/@engenty-wizards/shared/dist/store.d.ts +0 -117
- package/node_modules/@engenty-wizards/shared/dist/store.js +0 -81
- package/node_modules/@engenty-wizards/shared/dist/surface.d.ts +0 -115
- package/node_modules/@engenty-wizards/shared/dist/surface.js +0 -442
- package/node_modules/@engenty-wizards/shared/dist/texts.d.ts +0 -45
- package/node_modules/@engenty-wizards/shared/dist/texts.js +0 -54
- package/node_modules/@engenty-wizards/shared/dist/translation.d.ts +0 -23
- package/node_modules/@engenty-wizards/shared/dist/translation.js +0 -154
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +0 -48
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.js +0 -49
- package/node_modules/@engenty-wizards/shared/dist/workspace.d.ts +0 -16
- package/node_modules/@engenty-wizards/shared/dist/workspace.js +0 -51
- package/node_modules/@engenty-wizards/shared/package.json +0 -10
- package/plugin/.claude-plugin/plugin.json +0 -9
- package/plugin/.mcp.json +0 -8
- package/plugin/commands/wizard.md +0 -8
- package/plugin/skills/build-wizard/SKILL.md +0 -27
- package/plugin/skills/use-wizard/SKILL.md +0 -18
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { readdir, readFile } from "node:fs/promises";
|
|
4
|
-
import { dirname, join, relative, resolve } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { zipSync } from "fflate";
|
|
7
|
-
import { env } from "./env.js";
|
|
8
|
-
/**
|
|
9
|
-
* The Claude Code plugin for this deployment: the `plugin/` folder with this server's URL filled
|
|
10
|
-
* in, served as a marketplace (`url` source) whose one plugin is a zip (`archive` source). So
|
|
11
|
-
* every deployment hands out its own plugin and no domain is baked into the repo.
|
|
12
|
-
*/
|
|
13
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
/** The folder that holds `plugin/` and the root package.json: three levels above this file. */
|
|
15
|
-
const base = resolve(here, "../../..");
|
|
16
|
-
const root = existsSync(join(base, "plugin")) ? base : undefined;
|
|
17
|
-
export const PLUGIN_NAME = "engenty-wizards";
|
|
18
|
-
export const MARKETPLACE_NAME = "engenty";
|
|
19
|
-
export const pluginBase = `${env.appUrl}/api/claude-plugin`;
|
|
20
|
-
async function filesUnder(dir) {
|
|
21
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
22
|
-
const nested = await Promise.all(entries.map((e) => (e.isDirectory() ? filesUnder(join(dir, e.name)) : [join(dir, e.name)])));
|
|
23
|
-
return nested.flat();
|
|
24
|
-
}
|
|
25
|
-
let built = null;
|
|
26
|
-
export function pluginArchive() {
|
|
27
|
-
built ??= (async () => {
|
|
28
|
-
if (!root) {
|
|
29
|
-
throw new Error("plugin/ folder missing");
|
|
30
|
-
}
|
|
31
|
-
const { version } = JSON.parse(await readFile(join(root, "package.json"), "utf8"));
|
|
32
|
-
const dir = join(root, "plugin");
|
|
33
|
-
const files = {};
|
|
34
|
-
for (const path of (await filesUnder(dir)).sort()) {
|
|
35
|
-
const text = (await readFile(path, "utf8"))
|
|
36
|
-
.replaceAll("{{APP_URL}}", env.appUrl)
|
|
37
|
-
.replaceAll("{{VERSION}}", version);
|
|
38
|
-
// Fixed timestamps keep the archive, and so its sha256, stable across restarts.
|
|
39
|
-
files[relative(dir, path)] = new TextEncoder().encode(text);
|
|
40
|
-
}
|
|
41
|
-
const zip = zipSync(files, { level: 9, mtime: new Date("2026-01-01T00:00:00Z") });
|
|
42
|
-
return { zip, sha256: createHash("sha256").update(zip).digest("hex"), version };
|
|
43
|
-
})();
|
|
44
|
-
return built;
|
|
45
|
-
}
|
|
46
|
-
export async function pluginMarketplace() {
|
|
47
|
-
const { sha256, version } = await pluginArchive();
|
|
48
|
-
return {
|
|
49
|
-
name: MARKETPLACE_NAME,
|
|
50
|
-
owner: { name: "engenty" },
|
|
51
|
-
description: "engenty wizards for Claude Code",
|
|
52
|
-
plugins: [
|
|
53
|
-
{
|
|
54
|
-
name: PLUGIN_NAME,
|
|
55
|
-
description: "Build page-by-page AI wizards that people open on a shared link — designed, tested and published from Claude Code.",
|
|
56
|
-
version,
|
|
57
|
-
source: { source: "archive", url: `${pluginBase}/${PLUGIN_NAME}.zip`, sha256 },
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
};
|
|
61
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { bookChannelUsage, ManageError, managed, requestChannelNumber, tenantChannels, withdrawChannelRequest, } from "../manage.js";
|
|
2
|
-
import { currentTenant } from "../tenants/tenant.js";
|
|
3
|
-
/**
|
|
4
|
-
* `server.channels`: the numbers the Manage-App gives the current tenant
|
|
5
|
-
* (docs/manage-contract.md, "Numbers of a tenant"). Without a Manage-App there are none.
|
|
6
|
-
*/
|
|
7
|
-
/** A refusal of the Manage-App as a plugin passes it on: its status and its code. */
|
|
8
|
-
const asked = (work) => work.catch((err) => {
|
|
9
|
-
throw err instanceof ManageError
|
|
10
|
-
? Object.assign(new Error(err.message), { status: err.status, code: err.code })
|
|
11
|
-
: err;
|
|
12
|
-
});
|
|
13
|
-
const unmanaged = () => Object.assign(new Error("This runtime has no Manage-App, so it has no numbers."), {
|
|
14
|
-
status: 404,
|
|
15
|
-
code: "not_managed",
|
|
16
|
-
});
|
|
17
|
-
export const channelsApi = {
|
|
18
|
-
async get() {
|
|
19
|
-
if (!managed) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const c = await asked(tenantChannels(currentTenant()));
|
|
23
|
-
return {
|
|
24
|
-
number: c.number
|
|
25
|
-
? {
|
|
26
|
-
number: c.number.number,
|
|
27
|
-
country: c.number.country,
|
|
28
|
-
kinds: c.number.kinds,
|
|
29
|
-
providerRef: c.number.providerRef ?? null,
|
|
30
|
-
}
|
|
31
|
-
: null,
|
|
32
|
-
request: c.request
|
|
33
|
-
? {
|
|
34
|
-
id: c.request.id,
|
|
35
|
-
country: c.request.country,
|
|
36
|
-
wish: c.request.wish,
|
|
37
|
-
createdAt: c.request.createdAt,
|
|
38
|
-
}
|
|
39
|
-
: null,
|
|
40
|
-
shared: c.shared,
|
|
41
|
-
allowed: c.allowed !== false,
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
async request(input) {
|
|
45
|
-
if (!managed) {
|
|
46
|
-
throw unmanaged();
|
|
47
|
-
}
|
|
48
|
-
const { request } = await asked(requestChannelNumber(currentTenant(), {
|
|
49
|
-
userId: input.userId,
|
|
50
|
-
country: input.country.toUpperCase(),
|
|
51
|
-
wish: input.wish ?? null,
|
|
52
|
-
lang: input.lang,
|
|
53
|
-
}));
|
|
54
|
-
return {
|
|
55
|
-
id: request.id,
|
|
56
|
-
country: request.country,
|
|
57
|
-
wish: request.wish,
|
|
58
|
-
createdAt: request.createdAt,
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
async withdraw() {
|
|
62
|
-
if (!managed) {
|
|
63
|
-
throw unmanaged();
|
|
64
|
-
}
|
|
65
|
-
return (await asked(withdrawChannelRequest(currentTenant()))).withdrawn;
|
|
66
|
-
},
|
|
67
|
-
async book(input) {
|
|
68
|
-
if (!managed || input.quantity <= 0) {
|
|
69
|
-
return { credits: 0 };
|
|
70
|
-
}
|
|
71
|
-
return asked(bookChannelUsage(currentTenant(), {
|
|
72
|
-
kind: input.kind,
|
|
73
|
-
quantity: input.quantity,
|
|
74
|
-
idempotencyKey: input.key,
|
|
75
|
-
...(input.runId ? { runId: input.runId } : {}),
|
|
76
|
-
}));
|
|
77
|
-
},
|
|
78
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { and, eq } from "drizzle-orm";
|
|
2
|
-
import { control, controlDb } from "../db/client.js";
|
|
3
|
-
import { currentTenant } from "../tenants/tenant.js";
|
|
4
|
-
import { publicRefOf } from "./public.js";
|
|
5
|
-
/**
|
|
6
|
-
* `server.claims`: keys a plugin holds across the runtime's tenants, each for one tenant at a
|
|
7
|
-
* time (control `plugin_claim`). A key is the plugin's own; another plugin's of the same name is
|
|
8
|
-
* another key.
|
|
9
|
-
*/
|
|
10
|
-
const MAX_KEY = 200;
|
|
11
|
-
function checked(key) {
|
|
12
|
-
if (!key || key.length > MAX_KEY) {
|
|
13
|
-
throw Object.assign(new Error(`A key is 1 to ${MAX_KEY} characters.`), {
|
|
14
|
-
status: 400,
|
|
15
|
-
code: "invalid",
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return key;
|
|
19
|
-
}
|
|
20
|
-
export function claimsApiFor(plugin) {
|
|
21
|
-
const where = (key) => and(eq(control.pluginClaim.plugin, plugin), eq(control.pluginClaim.key, checked(key)));
|
|
22
|
-
const holderOf = async (key) => (await controlDb.query.pluginClaim.findFirst({ where: where(key) }))?.tenantId ?? null;
|
|
23
|
-
return {
|
|
24
|
-
async take(key) {
|
|
25
|
-
const tenantId = currentTenant();
|
|
26
|
-
await controlDb
|
|
27
|
-
.insert(control.pluginClaim)
|
|
28
|
-
.values({ plugin, key: checked(key), tenantId, updatedAt: new Date() })
|
|
29
|
-
.onConflictDoNothing();
|
|
30
|
-
return (await holderOf(key)) === tenantId;
|
|
31
|
-
},
|
|
32
|
-
async put(key) {
|
|
33
|
-
const tenantId = currentTenant();
|
|
34
|
-
const updatedAt = new Date();
|
|
35
|
-
await controlDb
|
|
36
|
-
.insert(control.pluginClaim)
|
|
37
|
-
.values({ plugin, key: checked(key), tenantId, updatedAt })
|
|
38
|
-
.onConflictDoUpdate({
|
|
39
|
-
target: [control.pluginClaim.plugin, control.pluginClaim.key],
|
|
40
|
-
set: { tenantId, updatedAt },
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
async drop(key) {
|
|
44
|
-
await controlDb
|
|
45
|
-
.delete(control.pluginClaim)
|
|
46
|
-
.where(and(where(key), eq(control.pluginClaim.tenantId, currentTenant())));
|
|
47
|
-
},
|
|
48
|
-
async holder(key) {
|
|
49
|
-
const tenantId = await holderOf(key);
|
|
50
|
-
return tenantId ? publicRefOf(plugin, tenantId) : null;
|
|
51
|
-
},
|
|
52
|
-
async mine(key) {
|
|
53
|
-
return (await holderOf(key)) === currentTenant();
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { basename, extname, join, resolve, sep } from "node:path";
|
|
3
|
-
import { PLUGIN_ID } from "@engenty-wizards/shared/definition";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
/**
|
|
6
|
-
* Finding plugins. A folder of plugins holds, in any mix:
|
|
7
|
-
*
|
|
8
|
-
* notify.ts one file: the server half, its id is the file's name
|
|
9
|
-
* contacts/engenty.plugin.json a folder with a manifest: `src/plugin.ts`, `dist/client.js`
|
|
10
|
-
* hello/index.ts a folder without one: the server half, its id is the folder's name
|
|
11
|
-
* node_modules/<package> packages installed there that carry a manifest
|
|
12
|
-
*/
|
|
13
|
-
export const MANIFEST_FILE = "engenty.plugin.json";
|
|
14
|
-
/** Further fields (an engenty module's `provides`, `capabilities`, …) are kept as they are. */
|
|
15
|
-
const manifestSchema = z.looseObject({
|
|
16
|
-
id: z.string().regex(PLUGIN_ID),
|
|
17
|
-
name: z.string().min(1),
|
|
18
|
-
version: z.string().default("0.0.0"),
|
|
19
|
-
description: z.string().optional(),
|
|
20
|
-
server: z.string().optional(),
|
|
21
|
-
studio: z.string().optional(),
|
|
22
|
-
styles: z.string().optional(),
|
|
23
|
-
features: z
|
|
24
|
-
.record(z.string().regex(/^[a-z][a-zA-Z0-9]*$/), z.union([
|
|
25
|
-
z.boolean(),
|
|
26
|
-
z.object({
|
|
27
|
-
kind: z.enum(["release", "plan"]).optional(),
|
|
28
|
-
default: z.boolean().optional(),
|
|
29
|
-
label: z.string().max(80).optional(),
|
|
30
|
-
hint: z.string().max(300).optional(),
|
|
31
|
-
}),
|
|
32
|
-
]))
|
|
33
|
-
.optional(),
|
|
34
|
-
});
|
|
35
|
-
/** `.mjs` is left out: Node keeps such a file once imported, so a reload would not read it again. */
|
|
36
|
-
const CODE = new Set([".ts", ".js"]);
|
|
37
|
-
const SERVER_ENTRIES = ["src/plugin.ts", "src/plugin.js", "dist/plugin.js"];
|
|
38
|
-
const INDEX_ENTRIES = ["index.ts", "index.js"];
|
|
39
|
-
const isDir = (path) => statSync(path, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
40
|
-
const firstExisting = (root, names) => names.map((name) => join(root, name)).find((path) => existsSync(path)) ?? null;
|
|
41
|
-
/** A path of the manifest must stay inside the plugin's folder. */
|
|
42
|
-
function inside(root, relative) {
|
|
43
|
-
const path = resolve(root, relative);
|
|
44
|
-
return path.startsWith(root + sep) && existsSync(path) ? path : null;
|
|
45
|
-
}
|
|
46
|
-
function fromManifest(root) {
|
|
47
|
-
const parsed = manifestSchema.safeParse(JSON.parse(readFileSync(join(root, MANIFEST_FILE), "utf8")));
|
|
48
|
-
if (!parsed.success) {
|
|
49
|
-
throw new Error(`${MANIFEST_FILE}: ${z.prettifyError(parsed.error)}`);
|
|
50
|
-
}
|
|
51
|
-
const manifest = parsed.data;
|
|
52
|
-
const entry = manifest.server
|
|
53
|
-
? inside(root, manifest.server)
|
|
54
|
-
: firstExisting(root, SERVER_ENTRIES);
|
|
55
|
-
if (manifest.server && !entry) {
|
|
56
|
-
throw new Error(`"server": ${manifest.server} is not a file of the plugin.`);
|
|
57
|
-
}
|
|
58
|
-
return {
|
|
59
|
-
id: manifest.id,
|
|
60
|
-
manifest,
|
|
61
|
-
root,
|
|
62
|
-
entry,
|
|
63
|
-
studio: inside(root, manifest.studio ?? "dist/client.js"),
|
|
64
|
-
styles: inside(root, manifest.styles ?? "dist/client.css"),
|
|
65
|
-
single: false,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/** A plugin without a manifest: its id is the name of its file or folder. */
|
|
69
|
-
function bare(id, root, entry, single) {
|
|
70
|
-
if (!PLUGIN_ID.test(id)) {
|
|
71
|
-
throw new Error(`"${id}" is no plugin id: lower case, digits and "-", starting with a letter.`);
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
id,
|
|
75
|
-
manifest: { id, name: id, version: "0.0.0" },
|
|
76
|
-
root,
|
|
77
|
-
entry,
|
|
78
|
-
studio: null,
|
|
79
|
-
styles: null,
|
|
80
|
-
single,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
/** Packages below `node_modules` that are plugins: `<name>` and `@scope/<name>`. */
|
|
84
|
-
function packagesIn(nodeModules) {
|
|
85
|
-
const out = [];
|
|
86
|
-
for (const name of readdirSync(nodeModules).sort()) {
|
|
87
|
-
if (name.startsWith(".")) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
const path = join(nodeModules, name);
|
|
91
|
-
const candidates = name.startsWith("@")
|
|
92
|
-
? readdirSync(path)
|
|
93
|
-
.sort()
|
|
94
|
-
.map((child) => join(path, child))
|
|
95
|
-
: [path];
|
|
96
|
-
out.push(...candidates.filter((dir) => existsSync(join(dir, MANIFEST_FILE))));
|
|
97
|
-
}
|
|
98
|
-
return out;
|
|
99
|
-
}
|
|
100
|
-
function sourceAt(path) {
|
|
101
|
-
if (!isDir(path)) {
|
|
102
|
-
const ext = extname(path);
|
|
103
|
-
return CODE.has(ext) && !path.endsWith(".d.ts")
|
|
104
|
-
? bare(basename(path, ext), resolve(path, ".."), path, true)
|
|
105
|
-
: null;
|
|
106
|
-
}
|
|
107
|
-
if (existsSync(join(path, MANIFEST_FILE))) {
|
|
108
|
-
return fromManifest(path);
|
|
109
|
-
}
|
|
110
|
-
const index = firstExisting(path, INDEX_ENTRIES);
|
|
111
|
-
return index ? bare(basename(path), path, index, false) : null;
|
|
112
|
-
}
|
|
113
|
-
/** The plugins in these folders. Of two with one id the first found stays. */
|
|
114
|
-
export function discoverPlugins(dirs) {
|
|
115
|
-
const found = new Map();
|
|
116
|
-
const problems = [];
|
|
117
|
-
const take = (path) => {
|
|
118
|
-
try {
|
|
119
|
-
const source = sourceAt(path);
|
|
120
|
-
if (!source) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const first = found.get(source.id);
|
|
124
|
-
if (first) {
|
|
125
|
-
problems.push({
|
|
126
|
-
path,
|
|
127
|
-
message: `Plugin "${source.id}" is already loaded from ${first.root}.`,
|
|
128
|
-
});
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
found.set(source.id, source);
|
|
132
|
-
}
|
|
133
|
-
catch (err) {
|
|
134
|
-
problems.push({ path, message: err.message });
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
for (const dir of dirs) {
|
|
138
|
-
if (!isDir(dir)) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
for (const name of readdirSync(dir).sort()) {
|
|
142
|
-
if (name.startsWith(".") || name.startsWith("_")) {
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
const path = join(dir, name);
|
|
146
|
-
if (name === "node_modules") {
|
|
147
|
-
packagesIn(path).forEach(take);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
take(path);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return { found: [...found.values()], problems };
|
|
155
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { eq } from "drizzle-orm";
|
|
2
|
-
import { db, schema } from "../db/client.js";
|
|
3
|
-
import { currentTenant } from "../tenants/tenant.js";
|
|
4
|
-
import { pluginsOf } from "./registry.js";
|
|
5
|
-
/**
|
|
6
|
-
* Tells the current tenant's plugins what happened. A plugin cannot fail what the runtime does:
|
|
7
|
-
* what a listener throws is logged and nothing more.
|
|
8
|
-
*/
|
|
9
|
-
export async function emitPluginEvent(event, payload) {
|
|
10
|
-
try {
|
|
11
|
-
const listening = (await pluginsOf(currentTenant())).filter((p) => p.listeners[event]?.length);
|
|
12
|
-
if (!listening.length) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
// What is costly to gather is gathered only when someone listens.
|
|
16
|
-
const told = typeof payload === "function" ? await payload() : payload;
|
|
17
|
-
if (!told) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
for (const plugin of listening) {
|
|
21
|
-
for (const listener of plugin.listeners[event] ?? []) {
|
|
22
|
-
try {
|
|
23
|
-
await listener(told);
|
|
24
|
-
}
|
|
25
|
-
catch (err) {
|
|
26
|
-
console.error(`[plugin ${plugin.source.id}] ${event}:`, err);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
console.error(`[plugins] ${event}:`, err);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/** A run reached its end. */
|
|
36
|
-
export function runEnded(runId, status) {
|
|
37
|
-
return emitPluginEvent(`run.${status}`, async () => {
|
|
38
|
-
const run = await db.query.run.findFirst({ where: eq(schema.run.id, runId) });
|
|
39
|
-
const wizard = run && (await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) }));
|
|
40
|
-
if (!run || !wizard) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
run: { id: run.id, wizardId: run.wizardId, mode: run.mode, status },
|
|
45
|
-
wizard: { id: wizard.id, title: run.definition.title, projectId: wizard.projectId },
|
|
46
|
-
values: run.state.values,
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* A space was made, changed or deleted. Not waited for: the request that changed the space
|
|
52
|
-
* answers without its plugins.
|
|
53
|
-
*/
|
|
54
|
-
export function spaceChanged(event, spaceId) {
|
|
55
|
-
void emitPluginEvent(event, { space: { id: spaceId } });
|
|
56
|
-
}
|
|
57
|
-
/** A file of a space was read and is ready, or was removed. Not waited for either. */
|
|
58
|
-
export function spaceFileChanged(event, file) {
|
|
59
|
-
void emitPluginEvent(event, {
|
|
60
|
-
space: { id: file.projectId },
|
|
61
|
-
file: { id: file.id, name: file.name, kind: file.kind, mime: file.mime },
|
|
62
|
-
});
|
|
63
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { and, eq } from "drizzle-orm";
|
|
2
|
-
import { control, controlDb, withTenant } from "../db/client.js";
|
|
3
|
-
import { env } from "../env.js";
|
|
4
|
-
import { loadedPlugins, pluginIdsOf } from "./registry.js";
|
|
5
|
-
/**
|
|
6
|
-
* Plugins' jobs (`server.every`). A tick looks once a minute which job is due for which tenant
|
|
7
|
-
* and runs it inside that tenant. When a job ran is kept in the control database, so a restart
|
|
8
|
-
* does not start the count again; a runtime that was off runs a due job once when it starts,
|
|
9
|
-
* not once per turn it missed.
|
|
10
|
-
*/
|
|
11
|
-
/** Jobs that run right now, by tenant, plugin and name: one turn at a time each. */
|
|
12
|
-
const running = new Set();
|
|
13
|
-
/** Starts every job that is due, and is done when they are. */
|
|
14
|
-
export async function runDueJobs(now = new Date()) {
|
|
15
|
-
const jobs = loadedPlugins().flatMap((plugin) => [...plugin.jobs].map(([name, job]) => ({ plugin, name, job })));
|
|
16
|
-
if (!jobs.length) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const tenants = await controlDb.query.tenant.findMany({
|
|
20
|
-
where: eq(control.tenant.status, "active"),
|
|
21
|
-
});
|
|
22
|
-
const started = [];
|
|
23
|
-
for (const tenant of tenants) {
|
|
24
|
-
const has = await pluginIdsOf(tenant.id);
|
|
25
|
-
for (const { plugin, name, job } of jobs) {
|
|
26
|
-
const id = plugin.source.id;
|
|
27
|
-
const key = `${tenant.id}/${id}/${name}`;
|
|
28
|
-
if (!has.has(id) || running.has(key)) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const where = and(eq(control.pluginJob.tenantId, tenant.id), eq(control.pluginJob.plugin, id), eq(control.pluginJob.name, name));
|
|
32
|
-
const last = (await controlDb.query.pluginJob.findFirst({ where }))?.lastRunAt ?? null;
|
|
33
|
-
if (last && now.getTime() - last.getTime() < job.everyMs) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
running.add(key);
|
|
37
|
-
// The start counts as the run: a turn that throws or hangs is not repeated every minute.
|
|
38
|
-
await controlDb
|
|
39
|
-
.insert(control.pluginJob)
|
|
40
|
-
.values({ tenantId: tenant.id, plugin: id, name, lastRunAt: now })
|
|
41
|
-
.onConflictDoUpdate({
|
|
42
|
-
target: [control.pluginJob.tenantId, control.pluginJob.plugin, control.pluginJob.name],
|
|
43
|
-
set: { lastRunAt: now },
|
|
44
|
-
});
|
|
45
|
-
started.push(withTenant(tenant.id, () => job.handler({ tenantId: tenant.id, lastRun: last, signal: plugin.stopped.signal }))
|
|
46
|
-
.catch((err) => console.error(`[plugin ${id}] job ${name}:`, err))
|
|
47
|
-
.finally(() => running.delete(key)));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
await Promise.all(started);
|
|
51
|
-
}
|
|
52
|
-
const TICK_MS = 60_000;
|
|
53
|
-
let timer = null;
|
|
54
|
-
/** Looks for due jobs now and then once a minute, while the runtime runs. */
|
|
55
|
-
export function startJobs() {
|
|
56
|
-
if (timer || !env.plugins.jobs) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const tick = () => void runDueJobs().catch((err) => console.error("[plugins] jobs:", err));
|
|
60
|
-
// Soon after the start, not during it: tenant databases open first.
|
|
61
|
-
setTimeout(tick, 5_000).unref();
|
|
62
|
-
timer = setInterval(tick, TICK_MS);
|
|
63
|
-
timer.unref();
|
|
64
|
-
}
|