@acryldev/blends 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/docs/framework/LICENSE +0 -23
- package/docs/framework/README.md +0 -70
- package/docs/framework/agents/index.md +0 -59
- package/docs/framework/api/acryl.md +0 -247
- package/docs/framework/api/context.md +0 -478
- package/docs/framework/api/exception.md +0 -80
- package/docs/framework/api/index.md +0 -12
- package/docs/framework/api/presets.md +0 -62
- package/docs/framework/api/request.md +0 -396
- package/docs/framework/api/routing.md +0 -303
- package/docs/framework/api/summary.md +0 -143
- package/docs/framework/concepts/benchmarks.md +0 -26
- package/docs/framework/concepts/developer-experience.md +0 -5
- package/docs/framework/concepts/middleware.md +0 -21
- package/docs/framework/concepts/motivation.md +0 -14
- package/docs/framework/concepts/routers.md +0 -63
- package/docs/framework/concepts/stacks.md +0 -235
- package/docs/framework/concepts/web-standard.md +0 -27
- package/docs/framework/cordis/acryl-in-a-cordis-app.md +0 -160
- package/docs/framework/cordis/concepts.md +0 -105
- package/docs/framework/cordis/middleware.md +0 -8
- package/docs/framework/cordis/migration-from-0-3.md +0 -111
- package/docs/framework/cordis/migration-from-0-4.md +0 -14
- package/docs/framework/cordis/migration-from-dsh-webserver.md +0 -109
- package/docs/framework/cordis/migration-to-1-0.md +0 -46
- package/docs/framework/cordis/mounting.md +0 -85
- package/docs/framework/cordis/node-server.md +0 -100
- package/docs/framework/cordis/plugin-lifecycle.md +0 -111
- package/docs/framework/cordis/surfaces.md +0 -71
- package/docs/framework/cordis/transport-and-cancellation.md +0 -57
- package/docs/framework/cordis/validation.md +0 -135
- package/docs/framework/getting-started/basic.md +0 -201
- package/docs/framework/getting-started/bun.md +0 -219
- package/docs/framework/getting-started/deploy.md +0 -133
- package/docs/framework/getting-started/desktop.md +0 -80
- package/docs/framework/getting-started/nodejs.md +0 -365
- package/docs/framework/getting-started/other-runtimes.md +0 -30
- package/docs/framework/guides/best-practices.md +0 -231
- package/docs/framework/guides/bring-your-own-tool.md +0 -218
- package/docs/framework/guides/client-modules.md +0 -210
- package/docs/framework/guides/create-acrylblends.md +0 -143
- package/docs/framework/guides/data.md +0 -314
- package/docs/framework/guides/examples.md +0 -3
- package/docs/framework/guides/faq.md +0 -19
- package/docs/framework/guides/forms-and-sessions.md +0 -235
- package/docs/framework/guides/helpers.md +0 -33
- package/docs/framework/guides/jsx-dom.md +0 -301
- package/docs/framework/guides/jsx.md +0 -487
- package/docs/framework/guides/middleware.md +0 -253
- package/docs/framework/guides/production.md +0 -80
- package/docs/framework/guides/rpc.md +0 -878
- package/docs/framework/guides/testing.md +0 -133
- package/docs/framework/guides/validation.md +0 -470
- package/docs/framework/helpers/accepts.md +0 -60
- package/docs/framework/helpers/adapter.md +0 -57
- package/docs/framework/helpers/conninfo.md +0 -77
- package/docs/framework/helpers/cookie.md +0 -232
- package/docs/framework/helpers/css.md +0 -282
- package/docs/framework/helpers/dev.md +0 -64
- package/docs/framework/helpers/factory.md +0 -180
- package/docs/framework/helpers/html.md +0 -123
- package/docs/framework/helpers/jwt.md +0 -184
- package/docs/framework/helpers/proxy.md +0 -115
- package/docs/framework/helpers/route.md +0 -143
- package/docs/framework/helpers/ssg.md +0 -390
- package/docs/framework/helpers/streaming.md +0 -224
- package/docs/framework/helpers/testing.md +0 -118
- package/docs/framework/helpers/websocket.md +0 -208
- package/docs/framework/middleware/builtin/basic-auth.md +0 -165
- package/docs/framework/middleware/builtin/bearer-auth.md +0 -138
- package/docs/framework/middleware/builtin/body-limit.md +0 -71
- package/docs/framework/middleware/builtin/cache.md +0 -99
- package/docs/framework/middleware/builtin/combine.md +0 -94
- package/docs/framework/middleware/builtin/compress.md +0 -59
- package/docs/framework/middleware/builtin/context-storage.md +0 -74
- package/docs/framework/middleware/builtin/cors.md +0 -134
- package/docs/framework/middleware/builtin/csrf.md +0 -105
- package/docs/framework/middleware/builtin/etag.md +0 -54
- package/docs/framework/middleware/builtin/ip-restriction.md +0 -69
- package/docs/framework/middleware/builtin/jsx-renderer.md +0 -283
- package/docs/framework/middleware/builtin/jwk.md +0 -192
- package/docs/framework/middleware/builtin/jwt.md +0 -145
- package/docs/framework/middleware/builtin/language.md +0 -232
- package/docs/framework/middleware/builtin/logger.md +0 -74
- package/docs/framework/middleware/builtin/loopback-only.md +0 -31
- package/docs/framework/middleware/builtin/method-not-allowed.md +0 -48
- package/docs/framework/middleware/builtin/method-override.md +0 -80
- package/docs/framework/middleware/builtin/mount.md +0 -103
- package/docs/framework/middleware/builtin/pretty-json.md +0 -53
- package/docs/framework/middleware/builtin/request-id.md +0 -87
- package/docs/framework/middleware/builtin/secure-headers.md +0 -247
- package/docs/framework/middleware/builtin/timeout.md +0 -98
- package/docs/framework/middleware/builtin/timing.md +0 -100
- package/docs/framework/middleware/builtin/trailing-slash.md +0 -74
- package/docs/framework/middleware/third-party.md +0 -4
- package/docs/framework/workshop/README.md +0 -294
- package/docs/framework/workshop/facilitator.md +0 -101
- package/plugins/agent/LICENSE +0 -21
- package/plugins/agent/agent.ts +0 -229
- package/plugins/agent/index.ts +0 -20
- package/plugins/agent/memory.ts +0 -24
- package/plugins/agent/model.ts +0 -94
- package/plugins/agent/package.json +0 -41
- package/plugins/agent/plugin.json +0 -13
- package/plugins/agent/tools.ts +0 -67
- package/plugins/agent-panel/LICENSE +0 -21
- package/plugins/agent-panel/client/describe.ts +0 -101
- package/plugins/agent-panel/client/driver-pick.ts +0 -22
- package/plugins/agent-panel/client/frame.ts +0 -51
- package/plugins/agent-panel/client/main.ts +0 -707
- package/plugins/agent-panel/client/markdown.ts +0 -219
- package/plugins/agent-panel/headless.ts +0 -220
- package/plugins/agent-panel/index.ts +0 -523
- package/plugins/agent-panel/launch.ts +0 -67
- package/plugins/agent-panel/mount.ts +0 -27
- package/plugins/agent-panel/package.json +0 -69
- package/plugins/agent-panel/plugin.json +0 -28
- package/plugins/agent-panel/registry.ts +0 -17
- package/plugins/agent-panel/visitors.ts +0 -231
- package/plugins/app-settings/LICENSE +0 -21
- package/plugins/app-settings/index.ts +0 -270
- package/plugins/app-settings/merge.ts +0 -79
- package/plugins/app-settings/package.json +0 -45
- package/plugins/app-settings/plugin.json +0 -16
- package/plugins/builder/LICENSE +0 -21
- package/plugins/builder/index.ts +0 -171
- package/plugins/builder/package.json +0 -52
- package/plugins/builder/plugin.json +0 -17
- package/plugins/builder/script.ts +0 -158
- package/plugins/db/LICENSE +0 -47
- package/plugins/db/package.json +0 -67
- package/plugins/db/plugin.json +0 -25
- package/plugins/db/src/conformance.ts +0 -224
- package/plugins/db/src/cordis.ts +0 -13
- package/plugins/db/src/facade/database.ts +0 -41
- package/plugins/db/src/facade/migrations.ts +0 -50
- package/plugins/db/src/facade/schema.ts +0 -9
- package/plugins/db/src/index.ts +0 -19
- package/plugins/db/src/migration-files.ts +0 -31
- package/plugins/db-sqlite/LICENSE +0 -47
- package/plugins/db-sqlite/package.json +0 -89
- package/plugins/db-sqlite/plugin.json +0 -29
- package/plugins/db-sqlite/src/facade/node.ts +0 -199
- package/plugins/db-sqlite/src/index.ts +0 -95
- package/plugins/db-sqlite/src/open.ts +0 -61
- package/plugins/desktop-shell/LICENSE +0 -21
- package/plugins/desktop-shell/app-page.ts +0 -151
- package/plugins/desktop-shell/app-root.ts +0 -19
- package/plugins/desktop-shell/assets/acrylblends-logo.png +0 -0
- package/plugins/desktop-shell/attach.ts +0 -72
- package/plugins/desktop-shell/bin.ts +0 -5
- package/plugins/desktop-shell/brand.ts +0 -166
- package/plugins/desktop-shell/door-shell.ts +0 -385
- package/plugins/desktop-shell/frame.ts +0 -317
- package/plugins/desktop-shell/git.ts +0 -44
- package/plugins/desktop-shell/host-supervisor.ts +0 -63
- package/plugins/desktop-shell/launch.ts +0 -106
- package/plugins/desktop-shell/main.ts +0 -545
- package/plugins/desktop-shell/menu.ts +0 -60
- package/plugins/desktop-shell/package.json +0 -58
- package/plugins/desktop-shell/plugin.json +0 -20
- package/plugins/desktop-shell/preload.cjs +0 -8
- package/plugins/desktop-shell/product.ts +0 -164
- package/plugins/desktop-shell/shutdown.ts +0 -177
- package/plugins/desktop-shell/update-menu.ts +0 -126
- package/plugins/desktop-shell/updater.ts +0 -228
- package/plugins/desktop-shell/user-data.ts +0 -38
- package/plugins/desktop-shell/watch-host.d.mts +0 -10
- package/plugins/desktop-shell/watch-host.mjs +0 -130
- package/plugins/desktop-shell/window.ts +0 -119
- package/plugins/desktop-web/LICENSE +0 -21
- package/plugins/desktop-web/app-root.ts +0 -12
- package/plugins/desktop-web/launch.ts +0 -54
- package/plugins/desktop-web/main.ts +0 -108
- package/plugins/desktop-web/package.json +0 -49
- package/plugins/desktop-web/plugin.json +0 -21
- package/plugins/desktop-web/shutdown.ts +0 -177
- package/plugins/desktop-web/user-data.ts +0 -38
- package/plugins/desktop-web/window.ts +0 -29
- package/plugins/door/LICENSE +0 -47
- package/plugins/door/package.json +0 -116
- package/plugins/door/plugin.json +0 -39
- package/plugins/door/src/cli/acryl.ts +0 -335
- package/plugins/door/src/host/api.ts +0 -9
- package/plugins/door/src/host/audit.ts +0 -64
- package/plugins/door/src/host/channel.ts +0 -407
- package/plugins/door/src/host/chat-tools.ts +0 -76
- package/plugins/door/src/host/door-file.ts +0 -99
- package/plugins/door/src/host/door.ts +0 -492
- package/plugins/door/src/host/http.ts +0 -80
- package/plugins/door/src/host/mcp-routes.ts +0 -83
- package/plugins/door/src/host/operator-routes.ts +0 -58
- package/plugins/door/src/host/page-routes.ts +0 -69
- package/plugins/door/src/host/page-socket.ts +0 -88
- package/plugins/door/src/host/shell.ts +0 -147
- package/plugins/door/src/host/shim.ts +0 -125
- package/plugins/door/src/host/verbs.ts +0 -160
- package/plugins/door/src/index.ts +0 -337
- package/plugins/door/src/page/api.ts +0 -9
- package/plugins/door/src/page/base.ts +0 -32
- package/plugins/door/src/page/channel.ts +0 -209
- package/plugins/door/src/page/driver/accessibility.ts +0 -177
- package/plugins/door/src/page/driver/actions.ts +0 -207
- package/plugins/door/src/page/driver/driver.ts +0 -216
- package/plugins/door/src/page/driver/ref-table.ts +0 -78
- package/plugins/door/src/page/driver/sensitivity.ts +0 -85
- package/plugins/door/src/page/driver/snapshot.ts +0 -135
- package/plugins/door/src/page/index.ts +0 -100
- package/plugins/door/src/page/indicator.ts +0 -80
- package/plugins/door/src/page/main.ts +0 -7
- package/plugins/door/src/page/outline.ts +0 -56
- package/plugins/door/src/page/protocol.ts +0 -233
- package/plugins/door/src/page/snapshot-text.ts +0 -19
- package/plugins/door/src/page/socket-source.ts +0 -75
- package/plugins/door/src/page/user-input.ts +0 -24
- package/plugins/door/src/shell/protocol.ts +0 -133
- package/plugins/driver-acp/LICENSE +0 -21
- package/plugins/driver-acp/README.md +0 -53
- package/plugins/driver-acp/chat.ts +0 -258
- package/plugins/driver-acp/connection.ts +0 -239
- package/plugins/driver-acp/index.ts +0 -67
- package/plugins/driver-acp/package.json +0 -52
- package/plugins/driver-acp/plugin.json +0 -15
- package/plugins/driver-acp/provenance.json +0 -20
- package/plugins/driver-pty/LICENSE +0 -21
- package/plugins/driver-pty/client/terminal.ts +0 -191
- package/plugins/driver-pty/client/vendor/LICENSE +0 -21
- package/plugins/driver-pty/client/vendor/LICENSE-addon-fit +0 -19
- package/plugins/driver-pty/client/vendor/VERSION +0 -4
- package/plugins/driver-pty/client/vendor/addon-fit.d.mts +0 -6
- package/plugins/driver-pty/client/vendor/addon-fit.mjs +0 -18
- package/plugins/driver-pty/client/vendor/xterm-css.d.mts +0 -2
- package/plugins/driver-pty/client/vendor/xterm-css.mjs +0 -2
- package/plugins/driver-pty/client/vendor/xterm.d.mts +0 -17
- package/plugins/driver-pty/client/vendor/xterm.mjs +0 -53
- package/plugins/driver-pty/index.ts +0 -280
- package/plugins/driver-pty/package.json +0 -55
- package/plugins/driver-pty/plugin.json +0 -16
- package/plugins/driver-pty/spawn.ts +0 -74
- package/plugins/driver-pty/terminal.ts +0 -86
- package/plugins/drivers/LICENSE +0 -21
- package/plugins/drivers/index.ts +0 -75
- package/plugins/drivers/package.json +0 -37
- package/plugins/drivers/plugin.json +0 -11
- package/plugins/extensions/LICENSE +0 -21
- package/plugins/extensions/browser.ts +0 -100
- package/plugins/extensions/index.ts +0 -991
- package/plugins/extensions/ledger.ts +0 -39
- package/plugins/extensions/package.json +0 -48
- package/plugins/extensions/plugin-store.ts +0 -27
- package/plugins/extensions/plugin.json +0 -15
- package/plugins/extensions/resolve.ts +0 -169
- package/plugins/extensions/routes.ts +0 -92
- package/plugins/extensions/stage.ts +0 -82
- package/plugins/feedback/LICENSE +0 -21
- package/plugins/feedback/client.d.ts +0 -22
- package/plugins/feedback/client.js +0 -471
- package/plugins/feedback/index.ts +0 -143
- package/plugins/feedback/package.json +0 -44
- package/plugins/feedback/plugin.json +0 -14
- package/plugins/feedback/store.ts +0 -307
- package/plugins/home/LICENSE +0 -21
- package/plugins/home/index.ts +0 -124
- package/plugins/home/package.json +0 -41
- package/plugins/home/plugin.json +0 -14
- package/plugins/inspect/LICENSE +0 -21
- package/plugins/inspect/package.json +0 -84
- package/plugins/inspect/plugin.json +0 -24
- package/plugins/inspect/src/index.ts +0 -3
- package/plugins/inspect/src/report.ts +0 -131
- package/plugins/inspect/src/service.ts +0 -68
- package/plugins/instance/LICENSE +0 -21
- package/plugins/instance/archive.ts +0 -395
- package/plugins/instance/bundle-overlay.ts +0 -10
- package/plugins/instance/bundle.ts +0 -230
- package/plugins/instance/home.ts +0 -395
- package/plugins/instance/index.ts +0 -284
- package/plugins/instance/package.json +0 -61
- package/plugins/instance/plugin.json +0 -16
- package/plugins/instance/storage.ts +0 -463
- package/plugins/kv/LICENSE +0 -47
- package/plugins/kv/package.json +0 -67
- package/plugins/kv/plugin.json +0 -26
- package/plugins/kv/src/check.ts +0 -58
- package/plugins/kv/src/conformance.ts +0 -226
- package/plugins/kv/src/copy.ts +0 -39
- package/plugins/kv/src/cordis.ts +0 -13
- package/plugins/kv/src/index.ts +0 -14
- package/plugins/kv/src/kv.ts +0 -37
- package/plugins/kv-db/LICENSE +0 -47
- package/plugins/kv-db/package.json +0 -91
- package/plugins/kv-db/plugin.json +0 -31
- package/plugins/kv-db/src/index.ts +0 -37
- package/plugins/kv-db/src/open.ts +0 -80
- package/plugins/kv-json/LICENSE +0 -47
- package/plugins/kv-json/package.json +0 -89
- package/plugins/kv-json/plugin.json +0 -29
- package/plugins/kv-json/src/index.ts +0 -78
- package/plugins/kv-json/src/open.ts +0 -249
- package/plugins/manifest/LICENSE +0 -21
- package/plugins/manifest/app-plugins.ts +0 -86
- package/plugins/manifest/index.ts +0 -645
- package/plugins/manifest/lock.ts +0 -115
- package/plugins/manifest/package.json +0 -57
- package/plugins/manifest/plugin.json +0 -19
- package/plugins/manifest/snapshot.ts +0 -275
- package/plugins/manifest/upgrade-cli.ts +0 -70
- package/plugins/manifest/upgrade.ts +0 -97
- package/plugins/node-server/LICENSE +0 -47
- package/plugins/node-server/package.json +0 -94
- package/plugins/node-server/plugin.json +0 -32
- package/plugins/node-server/src/adapter/conninfo.ts +0 -23
- package/plugins/node-server/src/adapter/early-hints.ts +0 -55
- package/plugins/node-server/src/adapter/error.ts +0 -11
- package/plugins/node-server/src/adapter/headers.ts +0 -249
- package/plugins/node-server/src/adapter/index.ts +0 -6
- package/plugins/node-server/src/adapter/listener.ts +0 -549
- package/plugins/node-server/src/adapter/raw.ts +0 -18
- package/plugins/node-server/src/adapter/request.ts +0 -798
- package/plugins/node-server/src/adapter/response.ts +0 -186
- package/plugins/node-server/src/adapter/serve-static.ts +0 -238
- package/plugins/node-server/src/adapter/server.ts +0 -59
- package/plugins/node-server/src/adapter/types.ts +0 -94
- package/plugins/node-server/src/adapter/url.ts +0 -42
- package/plugins/node-server/src/adapter/utils/response/constants.ts +0 -1
- package/plugins/node-server/src/adapter/utils/response.ts +0 -4
- package/plugins/node-server/src/adapter/utils/stream.ts +0 -88
- package/plugins/node-server/src/adapter/utils.ts +0 -96
- package/plugins/node-server/src/adapter/websocket-types.ts +0 -49
- package/plugins/node-server/src/adapter/websocket.ts +0 -409
- package/plugins/node-server/src/client-modules.ts +0 -300
- package/plugins/node-server/src/index.ts +0 -440
- package/plugins/node-server/src/register.ts +0 -65
- package/plugins/node-server/src/test-websocket.ts +0 -110
- package/plugins/node-server/src/transpile.ts +0 -139
- package/plugins/node-server/src/upgrade-hub.ts +0 -152
- package/plugins/openai/LICENSE +0 -21
- package/plugins/openai/index.ts +0 -218
- package/plugins/openai/package.json +0 -43
- package/plugins/openai/plugin.json +0 -14
- package/plugins/openai/prompt.ts +0 -60
- package/plugins/page/package.json +0 -51
- package/plugins/page/plugin.json +0 -16
- package/plugins/page/src/favicon.ts +0 -19
- package/plugins/page/src/index.ts +0 -168
- package/plugins/plugin-share/LICENSE +0 -21
- package/plugins/plugin-share/README.md +0 -86
- package/plugins/plugin-share/index.ts +0 -791
- package/plugins/plugin-share/native.ts +0 -290
- package/plugins/plugin-share/package.json +0 -54
- package/plugins/plugin-share/package.ts +0 -186
- package/plugins/plugin-share/plugin.json +0 -19
- package/plugins/plugin-share/publish.ts +0 -79
- package/plugins/plugin-share/pull-check.ts +0 -142
- package/plugins/plugin-share/pull-list.ts +0 -71
- package/plugins/plugin-share/pulled-records.ts +0 -70
- package/plugins/router/LICENSE +0 -47
- package/plugins/router/package.json +0 -118
- package/plugins/router/plugin.json +0 -31
- package/plugins/router/src/browser/client.ts +0 -3
- package/plugins/router/src/browser/jsx-dom.ts +0 -9
- package/plugins/router/src/browser/read-sse.ts +0 -3
- package/plugins/router/src/client.ts +0 -2
- package/plugins/router/src/connection.ts +0 -42
- package/plugins/router/src/core/adapter/aws-lambda/conninfo.ts +0 -73
- package/plugins/router/src/core/adapter/aws-lambda/handler.ts +0 -682
- package/plugins/router/src/core/adapter/aws-lambda/index.ts +0 -14
- package/plugins/router/src/core/adapter/aws-lambda/types.ts +0 -173
- package/plugins/router/src/core/adapter/bun/conninfo.ts +0 -43
- package/plugins/router/src/core/adapter/bun/index.ts +0 -11
- package/plugins/router/src/core/adapter/bun/serve-static.ts +0 -32
- package/plugins/router/src/core/adapter/bun/server.ts +0 -14
- package/plugins/router/src/core/adapter/bun/ssg.ts +0 -26
- package/plugins/router/src/core/adapter/bun/websocket.ts +0 -113
- package/plugins/router/src/core/adapter/cloudflare-pages/conninfo.ts +0 -26
- package/plugins/router/src/core/adapter/cloudflare-pages/handler.ts +0 -122
- package/plugins/router/src/core/adapter/cloudflare-pages/index.ts +0 -11
- package/plugins/router/src/core/adapter/cloudflare-workers/conninfo.ts +0 -7
- package/plugins/router/src/core/adapter/cloudflare-workers/index.ts +0 -8
- package/plugins/router/src/core/adapter/cloudflare-workers/serve-static-module.ts +0 -12
- package/plugins/router/src/core/adapter/cloudflare-workers/serve-static.ts +0 -41
- package/plugins/router/src/core/adapter/cloudflare-workers/utils.ts +0 -50
- package/plugins/router/src/core/adapter/cloudflare-workers/websocket.ts +0 -52
- package/plugins/router/src/core/adapter/lambda-edge/conninfo.ts +0 -15
- package/plugins/router/src/core/adapter/lambda-edge/handler.ts +0 -239
- package/plugins/router/src/core/adapter/lambda-edge/index.ts +0 -14
- package/plugins/router/src/core/adapter/netlify/conninfo.ts +0 -57
- package/plugins/router/src/core/adapter/netlify/handler.ts +0 -10
- package/plugins/router/src/core/adapter/netlify/index.ts +0 -6
- package/plugins/router/src/core/adapter/netlify/mod.ts +0 -2
- package/plugins/router/src/core/adapter/service-worker/handler.ts +0 -37
- package/plugins/router/src/core/adapter/service-worker/index.ts +0 -36
- package/plugins/router/src/core/adapter/service-worker/types.ts +0 -14
- package/plugins/router/src/core/adapter/vercel/conninfo.ts +0 -8
- package/plugins/router/src/core/adapter/vercel/handler.ts +0 -8
- package/plugins/router/src/core/adapter/vercel/index.ts +0 -7
- package/plugins/router/src/core/app-base.ts +0 -544
- package/plugins/router/src/core/app.ts +0 -34
- package/plugins/router/src/core/client/client.ts +0 -249
- package/plugins/router/src/core/client/fetch-result-please.ts +0 -95
- package/plugins/router/src/core/client/index.ts +0 -17
- package/plugins/router/src/core/client/types.ts +0 -393
- package/plugins/router/src/core/client/utils.ts +0 -117
- package/plugins/router/src/core/compose.ts +0 -73
- package/plugins/router/src/core/context.ts +0 -781
- package/plugins/router/src/core/helper/accepts/accepts.ts +0 -96
- package/plugins/router/src/core/helper/accepts/index.ts +0 -6
- package/plugins/router/src/core/helper/adapter/index.ts +0 -90
- package/plugins/router/src/core/helper/conninfo/index.ts +0 -6
- package/plugins/router/src/core/helper/conninfo/types.ts +0 -45
- package/plugins/router/src/core/helper/cookie/index.ts +0 -146
- package/plugins/router/src/core/helper/css/common.ts +0 -337
- package/plugins/router/src/core/helper/css/index.ts +0 -262
- package/plugins/router/src/core/helper/dev/index.ts +0 -79
- package/plugins/router/src/core/helper/factory/index.ts +0 -375
- package/plugins/router/src/core/helper/html/index.ts +0 -57
- package/plugins/router/src/core/helper/proxy/index.ts +0 -203
- package/plugins/router/src/core/helper/route/index.ts +0 -144
- package/plugins/router/src/core/helper/ssg/index.ts +0 -14
- package/plugins/router/src/core/helper/ssg/middleware.ts +0 -83
- package/plugins/router/src/core/helper/ssg/plugins.ts +0 -72
- package/plugins/router/src/core/helper/ssg/ssg.ts +0 -471
- package/plugins/router/src/core/helper/ssg/utils.ts +0 -118
- package/plugins/router/src/core/helper/streaming/index.ts +0 -9
- package/plugins/router/src/core/helper/streaming/sse.ts +0 -101
- package/plugins/router/src/core/helper/streaming/stream.ts +0 -45
- package/plugins/router/src/core/helper/streaming/text.ts +0 -15
- package/plugins/router/src/core/helper/streaming/utils.ts +0 -11
- package/plugins/router/src/core/helper/testing/index.ts +0 -28
- package/plugins/router/src/core/helper/websocket/index.ts +0 -146
- package/plugins/router/src/core/http-exception.ts +0 -77
- package/plugins/router/src/core/index.ts +0 -53
- package/plugins/router/src/core/jsx/base.ts +0 -490
- package/plugins/router/src/core/jsx/children.ts +0 -20
- package/plugins/router/src/core/jsx/components.ts +0 -257
- package/plugins/router/src/core/jsx/constants.ts +0 -6
- package/plugins/router/src/core/jsx/context.ts +0 -266
- package/plugins/router/src/core/jsx/dom/client.ts +0 -89
- package/plugins/router/src/core/jsx/dom/components.ts +0 -39
- package/plugins/router/src/core/jsx/dom/context.ts +0 -52
- package/plugins/router/src/core/jsx/dom/css.ts +0 -263
- package/plugins/router/src/core/jsx/dom/hooks/index.ts +0 -91
- package/plugins/router/src/core/jsx/dom/index.ts +0 -170
- package/plugins/router/src/core/jsx/dom/intrinsic-element/components.ts +0 -438
- package/plugins/router/src/core/jsx/dom/jsx-dev-runtime.ts +0 -23
- package/plugins/router/src/core/jsx/dom/jsx-runtime.ts +0 -8
- package/plugins/router/src/core/jsx/dom/render.ts +0 -879
- package/plugins/router/src/core/jsx/dom/server.ts +0 -76
- package/plugins/router/src/core/jsx/dom/utils.ts +0 -7
- package/plugins/router/src/core/jsx/hooks/index.ts +0 -437
- package/plugins/router/src/core/jsx/index.ts +0 -115
- package/plugins/router/src/core/jsx/intrinsic-element/common.ts +0 -23
- package/plugins/router/src/core/jsx/intrinsic-element/components.ts +0 -210
- package/plugins/router/src/core/jsx/intrinsic-elements.ts +0 -938
- package/plugins/router/src/core/jsx/jsx-dev-runtime.ts +0 -26
- package/plugins/router/src/core/jsx/jsx-runtime.ts +0 -51
- package/plugins/router/src/core/jsx/streaming.ts +0 -231
- package/plugins/router/src/core/jsx/types.ts +0 -41
- package/plugins/router/src/core/jsx/utils.ts +0 -202
- package/plugins/router/src/core/middleware/basic-auth/index.ts +0 -152
- package/plugins/router/src/core/middleware/bearer-auth/index.ts +0 -220
- package/plugins/router/src/core/middleware/body-limit/index.ts +0 -110
- package/plugins/router/src/core/middleware/cache/index.ts +0 -323
- package/plugins/router/src/core/middleware/combine/index.ts +0 -171
- package/plugins/router/src/core/middleware/compress/index.ts +0 -142
- package/plugins/router/src/core/middleware/context-storage/index.ts +0 -58
- package/plugins/router/src/core/middleware/cors/index.ts +0 -163
- package/plugins/router/src/core/middleware/csrf/index.ts +0 -150
- package/plugins/router/src/core/middleware/etag/digest.ts +0 -95
- package/plugins/router/src/core/middleware/etag/index.ts +0 -135
- package/plugins/router/src/core/middleware/ip-restriction/index.ts +0 -278
- package/plugins/router/src/core/middleware/jsx-renderer/index.ts +0 -162
- package/plugins/router/src/core/middleware/jwk/index.ts +0 -1
- package/plugins/router/src/core/middleware/jwk/jwk.ts +0 -196
- package/plugins/router/src/core/middleware/jwt/index.ts +0 -9
- package/plugins/router/src/core/middleware/jwt/jwt.ts +0 -190
- package/plugins/router/src/core/middleware/language/index.ts +0 -12
- package/plugins/router/src/core/middleware/language/language.ts +0 -314
- package/plugins/router/src/core/middleware/logger/index.ts +0 -95
- package/plugins/router/src/core/middleware/method-not-allowed/index.ts +0 -141
- package/plugins/router/src/core/middleware/method-override/index.ts +0 -147
- package/plugins/router/src/core/middleware/mount/index.ts +0 -108
- package/plugins/router/src/core/middleware/powered-by/index.ts +0 -35
- package/plugins/router/src/core/middleware/pretty-json/index.ts +0 -67
- package/plugins/router/src/core/middleware/request-id/index.ts +0 -7
- package/plugins/router/src/core/middleware/request-id/request-id.ts +0 -59
- package/plugins/router/src/core/middleware/secure-headers/index.ts +0 -8
- package/plugins/router/src/core/middleware/secure-headers/permissions-policy.ts +0 -101
- package/plugins/router/src/core/middleware/secure-headers/secure-headers.ts +0 -340
- package/plugins/router/src/core/middleware/serve-static/index.ts +0 -135
- package/plugins/router/src/core/middleware/serve-static/path.ts +0 -25
- package/plugins/router/src/core/middleware/timeout/index.ts +0 -58
- package/plugins/router/src/core/middleware/timing/index.ts +0 -8
- package/plugins/router/src/core/middleware/timing/timing.ts +0 -256
- package/plugins/router/src/core/middleware/trailing-slash/index.ts +0 -156
- package/plugins/router/src/core/preset/quick.ts +0 -24
- package/plugins/router/src/core/preset/tiny.ts +0 -20
- package/plugins/router/src/core/request/constants.ts +0 -1
- package/plugins/router/src/core/request.ts +0 -502
- package/plugins/router/src/core/router/linear-router/index.ts +0 -6
- package/plugins/router/src/core/router/linear-router/router.ts +0 -152
- package/plugins/router/src/core/router/pattern-router/index.ts +0 -6
- package/plugins/router/src/core/router/pattern-router/router.ts +0 -54
- package/plugins/router/src/core/router/reg-exp-router/index.ts +0 -7
- package/plugins/router/src/core/router/reg-exp-router/matcher.ts +0 -33
- package/plugins/router/src/core/router/reg-exp-router/node.ts +0 -170
- package/plugins/router/src/core/router/reg-exp-router/prepared-router.ts +0 -165
- package/plugins/router/src/core/router/reg-exp-router/router.ts +0 -174
- package/plugins/router/src/core/router/reg-exp-router/trie.ts +0 -84
- package/plugins/router/src/core/router/smart-router/index.ts +0 -6
- package/plugins/router/src/core/router/smart-router/router.ts +0 -70
- package/plugins/router/src/core/router/trie-router/index.ts +0 -6
- package/plugins/router/src/core/router/trie-router/node.ts +0 -221
- package/plugins/router/src/core/router/trie-router/router.ts +0 -18
- package/plugins/router/src/core/router/utils.ts +0 -1
- package/plugins/router/src/core/router.ts +0 -103
- package/plugins/router/src/core/types.ts +0 -2782
- package/plugins/router/src/core/utils/accept.ts +0 -268
- package/plugins/router/src/core/utils/basic-auth.ts +0 -26
- package/plugins/router/src/core/utils/body.ts +0 -263
- package/plugins/router/src/core/utils/buffer.ts +0 -117
- package/plugins/router/src/core/utils/color.ts +0 -56
- package/plugins/router/src/core/utils/compress.ts +0 -10
- package/plugins/router/src/core/utils/concurrent.ts +0 -55
- package/plugins/router/src/core/utils/constants.ts +0 -4
- package/plugins/router/src/core/utils/cookie.ts +0 -281
- package/plugins/router/src/core/utils/crypto.ts +0 -58
- package/plugins/router/src/core/utils/encode.ts +0 -34
- package/plugins/router/src/core/utils/filepath.ts +0 -60
- package/plugins/router/src/core/utils/handler.ts +0 -15
- package/plugins/router/src/core/utils/headers.ts +0 -355
- package/plugins/router/src/core/utils/html.ts +0 -182
- package/plugins/router/src/core/utils/http-status.ts +0 -72
- package/plugins/router/src/core/utils/ipaddr.ts +0 -374
- package/plugins/router/src/core/utils/jwt/index.ts +0 -7
- package/plugins/router/src/core/utils/jwt/jwa.ts +0 -38
- package/plugins/router/src/core/utils/jwt/jws.ts +0 -235
- package/plugins/router/src/core/utils/jwt/jwt.ts +0 -292
- package/plugins/router/src/core/utils/jwt/types.ts +0 -157
- package/plugins/router/src/core/utils/jwt/utf8.ts +0 -7
- package/plugins/router/src/core/utils/mime.ts +0 -94
- package/plugins/router/src/core/utils/stream.ts +0 -107
- package/plugins/router/src/core/utils/types.ts +0 -174
- package/plugins/router/src/core/utils/url.ts +0 -337
- package/plugins/router/src/core/validator/index.ts +0 -8
- package/plugins/router/src/core/validator/utils.ts +0 -69
- package/plugins/router/src/core/validator/validator.ts +0 -185
- package/plugins/router/src/helpers/index.ts +0 -17
- package/plugins/router/src/helpers/read-sse.ts +0 -111
- package/plugins/router/src/helpers/schema-validator.ts +0 -62
- package/plugins/router/src/index.ts +0 -6
- package/plugins/router/src/middleware/index.ts +0 -28
- package/plugins/router/src/middleware/loopback-only.ts +0 -183
- package/plugins/router/src/service.ts +0 -477
- package/plugins/router-http/LICENSE +0 -21
- package/plugins/router-http/package.json +0 -87
- package/plugins/router-http/plugin.json +0 -23
- package/plugins/router-http/src/bridge.ts +0 -54
- package/plugins/router-http/src/index.ts +0 -141
- package/plugins/router-http/src/serve.ts +0 -55
- package/plugins/sandbox/LICENSE +0 -21
- package/plugins/sandbox/index.ts +0 -150
- package/plugins/sandbox/package.json +0 -41
- package/plugins/sandbox/plugin.json +0 -13
- package/plugins/sandbox/runner.mjs +0 -18
- package/plugins/save/LICENSE +0 -21
- package/plugins/save/cli.ts +0 -19
- package/plugins/save/index.ts +0 -55
- package/plugins/save/package.json +0 -43
- package/plugins/save/plugin.json +0 -15
- package/plugins/save/share-cli.ts +0 -95
- package/plugins/save/share.ts +0 -193
- package/plugins/showcase/LICENSE +0 -21
- package/plugins/showcase/cards.ts +0 -162
- package/plugins/showcase/index.ts +0 -117
- package/plugins/showcase/package.json +0 -49
- package/plugins/showcase/plugin.json +0 -14
- package/plugins/state/LICENSE +0 -21
- package/plugins/state/package.json +0 -104
- package/plugins/state/plugin.json +0 -27
- package/plugins/state/src/cell.ts +0 -67
- package/plugins/state/src/client-source.ts +0 -244
- package/plugins/state/src/index.ts +0 -3
- package/plugins/state/src/service.ts +0 -146
- package/plugins/state/src/socket.ts +0 -96
- package/plugins/tasks/LICENSE +0 -21
- package/plugins/tasks/index.ts +0 -246
- package/plugins/tasks/package.json +0 -45
- package/plugins/tasks/plugin.json +0 -14
- package/plugins/tasks/store.ts +0 -86
- package/plugins/web-server/package.json +0 -52
- package/plugins/web-server/plugin.json +0 -20
- package/plugins/web-server/src/index.ts +0 -164
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The desktop window on the ACRYL frame (docs/plans/ide-host-inversion.md, section 27). An app with `scripts/ide-host.mjs` runs inside the frame on `npm run dev`;
|
|
3
|
-
* `npm run desktop` shows that same frame: it attaches to a host that already runs (the host's address record, `frame-url.json` in the app's data folder), or starts the host
|
|
4
|
-
* the way `npm run dev` does and loads the address it prints. Nothing here imports electron: `main.ts` decides with these functions and owns the window.
|
|
5
|
-
*/
|
|
6
|
-
import { type ChildProcess, spawn, spawnSync } from 'node:child_process'
|
|
7
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
8
|
-
import { connect } from 'node:net'
|
|
9
|
-
import { join, resolve } from 'node:path'
|
|
10
|
-
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
11
|
-
import { appDataHome } from '@acryldev/instance'
|
|
12
|
-
|
|
13
|
-
/** The launcher every frame app has; without it the app runs on its own server (made before the frame). */
|
|
14
|
-
export const HOST_SCRIPT = join('scripts', 'ide-host.mjs')
|
|
15
|
-
|
|
16
|
-
/** The line the host prints once it serves the frame, with the launch token in the address. */
|
|
17
|
-
const HOST_LINE = /acrylblends host: (http:\/\/\S+)/u
|
|
18
|
-
|
|
19
|
-
const LOOPBACK = new Set(['127.0.0.1', 'localhost', '[::1]'])
|
|
20
|
-
|
|
21
|
-
/** How long a stopping host gets before its tree is killed. */
|
|
22
|
-
export const HOST_STOP_GRACE_MS = 5_000
|
|
23
|
-
|
|
24
|
-
export function isFrameApp(root: string, exists: (path: string) => boolean = existsSync): boolean {
|
|
25
|
-
return exists(join(root, HOST_SCRIPT))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** The app home the host uses: `ACRYLBLENDS_HOME` when set, else the app's data folder under ~/.acryl (`appDataHome`, the one place that decides it). */
|
|
29
|
-
export function frameHome(root: string, env: Record<string, string | undefined>): string {
|
|
30
|
-
const pinned = env.ACRYLBLENDS_HOME?.trim()
|
|
31
|
-
return pinned === undefined || pinned === ''
|
|
32
|
-
? appDataHome(resolve(root), process.platform, env)
|
|
33
|
-
: resolve(pinned)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** The frame address in the host's output so far, or `undefined` while it has not printed it. */
|
|
37
|
-
export function hostAddress(output: string): string | undefined {
|
|
38
|
-
return HOST_LINE.exec(output)?.[1]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** A loopback `http:` address, or `undefined` for anything else: the window only ever opens a frame on this machine. */
|
|
42
|
-
export function loopbackAddress(url: unknown): URL | undefined {
|
|
43
|
-
if (typeof url !== 'string') return undefined
|
|
44
|
-
try {
|
|
45
|
-
const parsed = new URL(url)
|
|
46
|
-
return parsed.protocol === 'http:' && LOOPBACK.has(parsed.hostname) ? parsed : undefined
|
|
47
|
-
} catch {
|
|
48
|
-
return undefined
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface RecordDeps {
|
|
53
|
-
readonly read?: (file: string) => string
|
|
54
|
-
/** Whether something accepts a connection at the address. */
|
|
55
|
-
readonly listening?: (url: URL) => Promise<boolean>
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const tcpListening = (url: URL, timeoutMs = 500): Promise<boolean> =>
|
|
59
|
-
new Promise((done) => {
|
|
60
|
-
const socket = connect({
|
|
61
|
-
host: url.hostname.replace(/^\[|\]$/gu, ''),
|
|
62
|
-
port: Number(url.port || 80),
|
|
63
|
-
})
|
|
64
|
-
const finish = (listening: boolean) => {
|
|
65
|
-
socket.destroy()
|
|
66
|
-
done(listening)
|
|
67
|
-
}
|
|
68
|
-
socket.setTimeout(timeoutMs)
|
|
69
|
-
socket.once('connect', () => finish(true))
|
|
70
|
-
socket.once('timeout', () => finish(false))
|
|
71
|
-
socket.once('error', () => finish(false))
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* The frame that already runs for this app: the host's address record, when it names a loopback address and something listens there. A record a stopped host
|
|
76
|
-
* left behind is not a running frame.
|
|
77
|
-
*/
|
|
78
|
-
export async function runningFrame(
|
|
79
|
-
home: string,
|
|
80
|
-
deps: RecordDeps = {},
|
|
81
|
-
): Promise<string | undefined> {
|
|
82
|
-
const read = deps.read ?? ((file: string) => readFileSync(file, 'utf8'))
|
|
83
|
-
let record: { url?: unknown }
|
|
84
|
-
try {
|
|
85
|
-
record = JSON.parse(read(join(home, 'frame-url.json'))) as { url?: unknown }
|
|
86
|
-
} catch {
|
|
87
|
-
return undefined
|
|
88
|
-
}
|
|
89
|
-
const url = loopbackAddress(record.url)
|
|
90
|
-
if (url === undefined) return undefined
|
|
91
|
-
return (await (deps.listening ?? tcpListening)(url)) ? url.href : undefined
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** An address as the door may show it: the frame's launch token removed (the token is the way into the frame, so it never goes to a log). */
|
|
95
|
-
export function withoutToken(href: string): string {
|
|
96
|
-
try {
|
|
97
|
-
const parsed = new URL(href)
|
|
98
|
-
if (!parsed.searchParams.has('token')) return href
|
|
99
|
-
parsed.searchParams.delete('token')
|
|
100
|
-
return parsed.href
|
|
101
|
-
} catch {
|
|
102
|
-
return href
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* What the Settings... menu item runs in a frame window: the window event the page's root owner opens its own Settings on (`@acryldev/blends-frame`'s
|
|
108
|
-
* `OPEN_SETTINGS_EVENT`, and the IDE's `@acryldev/workspace`; keep the string in step). The same dialog as the top bar's gear, never a second one.
|
|
109
|
-
*/
|
|
110
|
-
export const openFrameSettings = "window.dispatchEvent(new Event('acryl:open-settings'))"
|
|
111
|
-
|
|
112
|
-
/** What the window does with a navigation: stay on the frame's origin, hand the address to the system browser, or refuse it. */
|
|
113
|
-
export type Navigation = 'stay' | 'external' | 'block'
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* ACRYL Desktop's rule (`electron-shell-generation.ts`): only the main frame is checked, so the frame's tiles (the app's page in an iframe) navigate freely;
|
|
117
|
-
* the frame's own origin stays in the window, an `http(s)` or `mailto` address goes to the system browser, anything else is refused.
|
|
118
|
-
*/
|
|
119
|
-
export function navigation(target: string, origin: string, mainFrame = true): Navigation {
|
|
120
|
-
if (!mainFrame) return 'stay'
|
|
121
|
-
let parsed: URL
|
|
122
|
-
try {
|
|
123
|
-
parsed = new URL(target)
|
|
124
|
-
} catch {
|
|
125
|
-
return 'block'
|
|
126
|
-
}
|
|
127
|
-
if (parsed.origin === origin) return 'stay'
|
|
128
|
-
return parsed.protocol === 'http:' ||
|
|
129
|
-
parsed.protocol === 'https:' ||
|
|
130
|
-
parsed.protocol === 'mailto:'
|
|
131
|
-
? 'external'
|
|
132
|
-
: 'block'
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/** How the host is started: the npm and Node that ran `npm run desktop`, never Electron's Node (node-pty and DSH's rows are built for Node's ABI). */
|
|
136
|
-
export function hostCommand(
|
|
137
|
-
env: Record<string, string | undefined>,
|
|
138
|
-
platform: NodeJS.Platform,
|
|
139
|
-
): { file: string; args: string[]; shell: boolean } {
|
|
140
|
-
const node = env.npm_node_execpath
|
|
141
|
-
const npm = env.npm_execpath
|
|
142
|
-
if (node !== undefined && node !== '' && npm !== undefined && npm !== '')
|
|
143
|
-
return /\.c?js$/u.test(npm)
|
|
144
|
-
? { file: node, args: [npm, 'run', 'dev'], shell: false }
|
|
145
|
-
: { file: npm, args: ['run', 'dev'], shell: platform === 'win32' }
|
|
146
|
-
// Started without npm (Electron run by hand): npm from the PATH, `npm.cmd` through the shell on Windows (scripts/lib/platform.mjs, npmSpawn).
|
|
147
|
-
return platform === 'win32'
|
|
148
|
-
? { file: 'npm.cmd', args: ['run', 'dev'], shell: true }
|
|
149
|
-
: { file: 'npm', args: ['run', 'dev'], shell: false }
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/** How a host ended: its exit, the last of its output, and whether the window asked for it (`stop`) or it ended by itself. */
|
|
153
|
-
export interface HostEnd {
|
|
154
|
-
readonly code: number | null
|
|
155
|
-
readonly signal: NodeJS.Signals | null
|
|
156
|
-
readonly tail: string
|
|
157
|
-
readonly requested: boolean
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export interface FrameHost {
|
|
161
|
-
/** The frame address the host printed, or a rejection with the host's output when it ended first. */
|
|
162
|
-
readonly ready: Promise<string>
|
|
163
|
-
/** Resolves once, when the host has ended, whenever that is: after it served the frame too (a stop it did not get asked for is a death). */
|
|
164
|
-
readonly ended: Promise<HostEnd>
|
|
165
|
-
/** Stop the host and what it started; resolves once it has exited. */
|
|
166
|
-
stop(): Promise<void>
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export interface FrameHostLaunch {
|
|
170
|
-
/**
|
|
171
|
-
* A packaged product has no npm to run `npm run dev` with: the host runs on the app's own Electron runtime as Node, with the same loader the dev script uses.
|
|
172
|
-
*/
|
|
173
|
-
readonly runtime?: string
|
|
174
|
-
/**
|
|
175
|
-
* Where the Program is when it is not in the app folder: a product's bundle. The host, its loader and the resolver that serves the Program from there
|
|
176
|
-
* and the person's files from the app's source (plugins/instance/bundle-overlay.ts) start from it; the host still runs in the app folder.
|
|
177
|
-
*/
|
|
178
|
-
readonly program?: string
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* What a packaged host watches: the person's own files that make the app, and nothing else. `node --watch` alone follows only the modules the host has loaded,
|
|
183
|
-
* so a new plugin folder, or a row added to `blend.yaml`, stayed unseen until some loaded file changed (found on a packed app: a plugin written into
|
|
184
|
-
* `plugins/notes/` was not served after 15 s). Naming a path turns the module watching off, so the folders are named whole; `.git` (a commit must not restart
|
|
185
|
-
* the app) and the app's data are not among them.
|
|
186
|
-
*/
|
|
187
|
-
export const WATCHED_IN_SOURCE = ['src', 'plugins', 'blend.yaml'] as const
|
|
188
|
-
|
|
189
|
-
/** The packaged host's watcher (watch-host.mjs, next to this file): node --watch's restarts, on a real change of a file only, never an access-time event. */
|
|
190
|
-
export const WATCH_HOST = fileURLToPath(new URL('./watch-host.mjs', import.meta.url))
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* The arguments of a packaged product's host (the runtime is Electron as Node): the watcher first, so a saved change in the person's source or plugins
|
|
194
|
-
* restarts the host and the app shows it, with no extensions plugin in the frame to do it (found on a packed app: an edit of `src/routes.ts` stayed unseen
|
|
195
|
-
* until the app was quit). It is not `node --watch`: macOS reports a moved access time as a change, and `git diff` moves it on every modified file, so an
|
|
196
|
-
* uncommitted edit of blend.yaml restarted the host without end (spec 051 T013). Then the loader and, when the Program is in a bundle, the overlay that serves it.
|
|
197
|
-
*/
|
|
198
|
-
export function packagedHostArgs(
|
|
199
|
-
program: string,
|
|
200
|
-
root: string,
|
|
201
|
-
exists: (path: string) => boolean = existsSync,
|
|
202
|
-
): string[] {
|
|
203
|
-
return [
|
|
204
|
-
WATCH_HOST,
|
|
205
|
-
...WATCHED_IN_SOURCE.map((name) => join(root, name))
|
|
206
|
-
.filter((path) => exists(path))
|
|
207
|
-
.map((path) => `--watch-path=${path}`),
|
|
208
|
-
'--',
|
|
209
|
-
// The loader first and the overlay second: a hook registered later runs first, so the overlay sees every import before the loader's aliases.
|
|
210
|
-
'--import',
|
|
211
|
-
pathToFileURL(join(program, 'plugins', 'node-server', 'src', 'register.ts')).href,
|
|
212
|
-
...(program === root
|
|
213
|
-
? []
|
|
214
|
-
: [
|
|
215
|
-
'--import',
|
|
216
|
-
pathToFileURL(join(program, 'plugins', 'instance', 'bundle-overlay.ts')).href,
|
|
217
|
-
]),
|
|
218
|
-
join(program, HOST_SCRIPT),
|
|
219
|
-
]
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/** Start the app's frame host as `npm run dev` does, in the app folder; its output is passed through to `write`. */
|
|
223
|
-
export function startFrameHost(
|
|
224
|
-
root: string,
|
|
225
|
-
env: NodeJS.ProcessEnv,
|
|
226
|
-
write: (text: string) => void,
|
|
227
|
-
platform: NodeJS.Platform = process.platform,
|
|
228
|
-
launch: FrameHostLaunch = {},
|
|
229
|
-
): FrameHost {
|
|
230
|
-
const program = launch.program ?? root
|
|
231
|
-
const command =
|
|
232
|
-
launch.runtime === undefined
|
|
233
|
-
? hostCommand(env, platform)
|
|
234
|
-
: { file: launch.runtime, args: packagedHostArgs(program, root), shell: false }
|
|
235
|
-
// The host leads its own process group on macOS and Linux, so a stop reaches npm, the host and every terminal it runs; Windows stops the tree with taskkill.
|
|
236
|
-
const child: ChildProcess = spawn(command.file, command.args, {
|
|
237
|
-
cwd: root,
|
|
238
|
-
env: {
|
|
239
|
-
...env,
|
|
240
|
-
...(launch.runtime === undefined
|
|
241
|
-
? { ELECTRON_RUN_AS_NODE: undefined }
|
|
242
|
-
: { ELECTRON_RUN_AS_NODE: '1' }),
|
|
243
|
-
},
|
|
244
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
245
|
-
shell: command.shell,
|
|
246
|
-
detached: platform !== 'win32',
|
|
247
|
-
windowsHide: true,
|
|
248
|
-
})
|
|
249
|
-
let output = ''
|
|
250
|
-
let exited = false
|
|
251
|
-
let requested = false
|
|
252
|
-
let outcome: Pick<HostEnd, 'code' | 'signal'> = { code: null, signal: null }
|
|
253
|
-
const exit = new Promise<void>((done) => {
|
|
254
|
-
child.once('exit', (code, signal) => {
|
|
255
|
-
exited = true
|
|
256
|
-
outcome = { code, signal }
|
|
257
|
-
done()
|
|
258
|
-
})
|
|
259
|
-
child.once('error', (cause) => {
|
|
260
|
-
exited = true
|
|
261
|
-
output += `\n${cause.message}`
|
|
262
|
-
done()
|
|
263
|
-
})
|
|
264
|
-
})
|
|
265
|
-
const ended = exit.then((): HostEnd => ({ ...outcome, tail: output.slice(-3000), requested }))
|
|
266
|
-
const ready = new Promise<string>((done, fail) => {
|
|
267
|
-
const take = (chunk: Buffer) => {
|
|
268
|
-
const text = chunk.toString()
|
|
269
|
-
write(text)
|
|
270
|
-
if (output.length < 200_000) output += text
|
|
271
|
-
const address = hostAddress(output)
|
|
272
|
-
if (address !== undefined) done(address)
|
|
273
|
-
}
|
|
274
|
-
child.stdout?.on('data', take)
|
|
275
|
-
child.stderr?.on('data', take)
|
|
276
|
-
void exit.then(() =>
|
|
277
|
-
fail(new Error(`the frame host ended before it served the frame:\n${output.slice(-3000)}`)),
|
|
278
|
-
)
|
|
279
|
-
})
|
|
280
|
-
const signal = (name: NodeJS.Signals) => {
|
|
281
|
-
if (child.pid === undefined) return
|
|
282
|
-
// Windows has no process groups and no SIGTERM a console process can answer: the whole tree (npm, the host, its terminals) is ended at once.
|
|
283
|
-
if (platform === 'win32') {
|
|
284
|
-
spawnSync('taskkill', ['/PID', String(child.pid), '/T', '/F'], {
|
|
285
|
-
stdio: 'ignore',
|
|
286
|
-
windowsHide: true,
|
|
287
|
-
})
|
|
288
|
-
return
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
process.kill(-child.pid, name)
|
|
292
|
-
} catch {
|
|
293
|
-
// The group is already gone.
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
// What the host left running (its terminals, the watcher's child) does not outlive a host that ended by itself.
|
|
297
|
-
void exit.then(() => {
|
|
298
|
-
if (!requested) signal('SIGTERM')
|
|
299
|
-
})
|
|
300
|
-
return {
|
|
301
|
-
ready,
|
|
302
|
-
ended,
|
|
303
|
-
async stop() {
|
|
304
|
-
requested = true
|
|
305
|
-
if (exited) return
|
|
306
|
-
signal('SIGTERM')
|
|
307
|
-
const graceful = await Promise.race([
|
|
308
|
-
exit.then(() => true),
|
|
309
|
-
new Promise<boolean>((done) => setTimeout(() => done(false), HOST_STOP_GRACE_MS).unref()),
|
|
310
|
-
])
|
|
311
|
-
if (!graceful) {
|
|
312
|
-
signal('SIGKILL')
|
|
313
|
-
await exit
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
}
|
|
317
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The git a desktop product ships (desktop/dugite-native, packed by scripts/pack-blank-mac.mjs into `Resources/git`, beside the app). A clean Mac has only
|
|
3
|
-
* the shim that asks to install the Command Line Tools, and Windows has no git, while versions, export, the terminals and every agent run `git`. The
|
|
4
|
-
* frame host gets it first on its PATH, so everything it starts (versions, the workspace's git, terminals, the chat's shell, PTY agents) finds the same git
|
|
5
|
-
* by name. Outside a product, or in a product packed without it, the person's own git is used as before.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { existsSync } from 'node:fs'
|
|
9
|
-
import { join } from 'node:path'
|
|
10
|
-
|
|
11
|
-
export interface ProductGit {
|
|
12
|
-
/** The executable to run (on macOS and Linux a wrapper that finds git's helpers from where it lies). */
|
|
13
|
-
readonly executable: string
|
|
14
|
-
/** The folder to put first on PATH. */
|
|
15
|
-
readonly bin: string
|
|
16
|
-
/** Git's licence and the offer of its source, shown from Settings > App. */
|
|
17
|
-
readonly licence: string
|
|
18
|
-
readonly source: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** The product's git under `resources` (Electron's `process.resourcesPath`), or undefined when the product carries none. */
|
|
22
|
-
export function productGit(resources: string, platform: NodeJS.Platform): ProductGit | undefined {
|
|
23
|
-
const dir = join(resources, 'git')
|
|
24
|
-
// dugite-native's Windows build is MinGit: `cmd/git.exe` finds its own helpers.
|
|
25
|
-
const bin = join(dir, platform === 'win32' ? 'cmd' : 'bin')
|
|
26
|
-
const executable = join(bin, platform === 'win32' ? 'git.exe' : 'git')
|
|
27
|
-
if (!existsSync(executable)) return undefined
|
|
28
|
-
return { executable, bin, licence: join(dir, 'COPYING.txt'), source: join(dir, 'SOURCE.txt') }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** `env` with the product's git first on its PATH (Windows names the variable `Path`, in any case; the existing name is kept). */
|
|
32
|
-
export function withGitFirst(
|
|
33
|
-
env: Readonly<Record<string, string | undefined>>,
|
|
34
|
-
git: ProductGit,
|
|
35
|
-
platform: NodeJS.Platform,
|
|
36
|
-
): Record<string, string | undefined> {
|
|
37
|
-
const key =
|
|
38
|
-
platform === 'win32'
|
|
39
|
-
? (Object.keys(env).find((name) => name.toUpperCase() === 'PATH') ?? 'Path')
|
|
40
|
-
: 'PATH'
|
|
41
|
-
const separator = platform === 'win32' ? ';' : ':'
|
|
42
|
-
const rest = (env[key] ?? '').split(separator).filter((dir) => dir !== '' && dir !== git.bin)
|
|
43
|
-
return { ...env, [key]: [git.bin, ...rest].join(separator) }
|
|
44
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the window does when its frame host stops by itself (found on an installed app 2026-11-09: the host had ended days before, nothing restarted it, and
|
|
3
|
-
* the window kept asking a closed port, a thousand errors and a dead page). Two small rules, both pure of Electron so they are tested without a window:
|
|
4
|
-
* when to start the host again, and where its output is kept so the next stop has a cause on disk.
|
|
5
|
-
*/
|
|
6
|
-
import { appendFileSync, mkdirSync, readdirSync, rmSync, statSync } from 'node:fs'
|
|
7
|
-
import { join } from 'node:path'
|
|
8
|
-
|
|
9
|
-
export interface RestartPolicy {
|
|
10
|
-
/** Stops inside `windowMs` that are forgiven; one more and the host is not started again by itself. */
|
|
11
|
-
readonly maxInWindow: number
|
|
12
|
-
readonly windowMs: number
|
|
13
|
-
/** The wait before the n-th restart inside the window: short first, then longer. */
|
|
14
|
-
readonly delaysMs: readonly number[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const RESTART_POLICY: RestartPolicy = Object.freeze({
|
|
18
|
-
maxInWindow: 4,
|
|
19
|
-
windowMs: 120_000,
|
|
20
|
-
delaysMs: [500, 2_000, 5_000, 10_000],
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export type RestartDecision = { restart: true; delayMs: number } | { restart: false }
|
|
24
|
-
|
|
25
|
-
/** `stops` are the times (ms) the host stopped by itself, oldest or newest first; those older than the window are forgotten. */
|
|
26
|
-
export function nextRestart(
|
|
27
|
-
stops: readonly number[],
|
|
28
|
-
now: number,
|
|
29
|
-
policy: RestartPolicy = RESTART_POLICY,
|
|
30
|
-
): RestartDecision {
|
|
31
|
-
const recent = stops.filter((at) => now - at < policy.windowMs).length
|
|
32
|
-
if (recent >= policy.maxInWindow) return { restart: false }
|
|
33
|
-
return {
|
|
34
|
-
restart: true,
|
|
35
|
-
delayMs: policy.delaysMs[Math.min(recent, policy.delaysMs.length - 1)] ?? 0,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const KEEP_DAYS = 14
|
|
40
|
-
|
|
41
|
-
/** The host's output, one file a day (`host-YYYY-MM-DD.log`) in the app's logs folder; files older than two weeks go. Never throws: a log must not stop the app. */
|
|
42
|
-
export function appendHostLog(dir: string, text: string, now: Date = new Date()): void {
|
|
43
|
-
try {
|
|
44
|
-
mkdirSync(dir, { recursive: true })
|
|
45
|
-
appendFileSync(join(dir, `host-${now.toISOString().slice(0, 10)}.log`), text)
|
|
46
|
-
for (const name of readdirSync(dir)) {
|
|
47
|
-
if (!/^host-\d{4}-\d{2}-\d{2}\.log$/u.test(name)) continue
|
|
48
|
-
const file = join(dir, name)
|
|
49
|
-
if (now.getTime() - statSync(file).mtimeMs > KEEP_DAYS * 86_400_000)
|
|
50
|
-
rmSync(file, { force: true })
|
|
51
|
-
}
|
|
52
|
-
} catch {
|
|
53
|
-
// The disk is full or the folder is gone: the host goes on.
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* `node --watch` does not end when the host it runs crashes: it prints this line and waits for a saved file (reproduced on a packed app by killing the host's
|
|
59
|
-
* child: the watcher stayed, the port was closed, nothing answered and nothing restarted). So the window reads the line as the host's death.
|
|
60
|
-
*/
|
|
61
|
-
export function hostCrashed(output: string): boolean {
|
|
62
|
-
return /Failed running '/u.test(output)
|
|
63
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `npm run desktop`: starts Electron on `main.ts` next to this file. It exists for one case: on Linux where the kernel restricts unprivileged user namespaces
|
|
3
|
-
* (Ubuntu 23.10 and later: `kernel.apparmor_restrict_unprivileged_userns=1`), Chromium's sandbox cannot start for an Electron that npm unpacked into node_modules, and Electron
|
|
4
|
-
* aborts before any of our code runs. There, and only there, it starts with `--no-sandbox` and says so; everywhere else Electron starts exactly as it does with the sandbox on.
|
|
5
|
-
*/
|
|
6
|
-
import { type ChildProcess, spawn } from 'node:child_process'
|
|
7
|
-
import { existsSync, readFileSync } from 'node:fs'
|
|
8
|
-
import { createRequire } from 'node:module'
|
|
9
|
-
import { join } from 'node:path'
|
|
10
|
-
import { acrylRoot, appIdOf, personHome } from '@acryldev/instance/home'
|
|
11
|
-
import { APP_ROOT_ENV } from './app-root.ts'
|
|
12
|
-
import { appTitle, brandedElectron, iconFile } from './brand.ts'
|
|
13
|
-
|
|
14
|
-
/** The sysctl that makes the sandbox fail for an Electron without an AppArmor profile; its value, or `undefined` where it does not exist (every system but a recent Ubuntu). */
|
|
15
|
-
export const RESTRICT_USERNS = '/proc/sys/kernel/apparmor_restrict_unprivileged_userns'
|
|
16
|
-
|
|
17
|
-
/** Whether the sandbox cannot start here: Linux, with the restriction on. `read` returns a file's text, or throws when there is none. */
|
|
18
|
-
export function sandboxBlocked(
|
|
19
|
-
platform: string,
|
|
20
|
-
read: (path: string) => string = (path) => readFileSync(path, 'utf8'),
|
|
21
|
-
): boolean {
|
|
22
|
-
if (platform !== 'linux') return false
|
|
23
|
-
try {
|
|
24
|
-
return read(RESTRICT_USERNS).trim() === '1'
|
|
25
|
-
} catch {
|
|
26
|
-
return false
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const SANDBOX_NOTICE =
|
|
31
|
-
"desktop: this Linux restricts unprivileged user namespaces (kernel.apparmor_restrict_unprivileged_userns=1), so Electron's sandbox cannot start; starting with --no-sandbox. " +
|
|
32
|
-
'To keep the sandbox, give Electron an AppArmor profile that allows `userns` (the way the VS Code and Chrome packages do): see docs/framework/getting-started/desktop.md'
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The arguments for Electron: the entry file, with `--no-sandbox` first when the sandbox is blocked. Chromium switches given to the script
|
|
36
|
-
* (`npm run desktop -- --remote-debugging-port=9222`) go before the entry; anything that is not a switch is dropped.
|
|
37
|
-
*/
|
|
38
|
-
export function electronArgs(
|
|
39
|
-
entry: string,
|
|
40
|
-
blocked: boolean,
|
|
41
|
-
extra: readonly string[] = [],
|
|
42
|
-
): string[] {
|
|
43
|
-
const switches = extra.filter((arg) => /^--[a-z][a-z0-9-]*(=.*)?$/u.test(arg))
|
|
44
|
-
return [...(blocked ? ['--no-sandbox'] : []), ...switches, entry]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** The signals the launcher hands to Electron: Ctrl-C, a stop, and the terminal closing. */
|
|
48
|
-
export const FORWARDED_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Start Electron and make it end the way it was asked to. On macOS and Linux Electron leads its own process group, so a terminal's Ctrl-C (which goes to the
|
|
52
|
-
* whole foreground group) reaches only this launcher, which hands Electron exactly one signal. Electron answers a first SIGINT, SIGTERM or SIGHUP with a
|
|
53
|
-
* graceful quit, the one that stops the frame host the window started; a second signal kills it at once, before any of that runs, and a Ctrl-C that reached
|
|
54
|
-
* both processes was two, as is one that npm passes on after the terminal sent it. Later signals are not passed on. Windows has no process groups and no such signals; there Electron starts as before. This process ends with Electron's exit code.
|
|
55
|
-
*/
|
|
56
|
-
export function runElectron(
|
|
57
|
-
file: string,
|
|
58
|
-
args: readonly string[],
|
|
59
|
-
platform: NodeJS.Platform = process.platform,
|
|
60
|
-
): ChildProcess {
|
|
61
|
-
const child = spawn(file, args, { stdio: 'inherit', detached: platform !== 'win32' })
|
|
62
|
-
// One signal, ever: npm hands a Ctrl-C to this process a second time, and Electron's quit is bounded (DESKTOP_SHUTDOWN_TIMEOUT_MS) without another.
|
|
63
|
-
let forwarded = false
|
|
64
|
-
for (const signal of FORWARDED_SIGNALS)
|
|
65
|
-
if (platform !== 'win32' || signal !== 'SIGHUP')
|
|
66
|
-
process.on(signal, () => {
|
|
67
|
-
if (forwarded) return
|
|
68
|
-
forwarded = true
|
|
69
|
-
child.kill(signal)
|
|
70
|
-
})
|
|
71
|
-
child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)))
|
|
72
|
-
return child
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** The Electron entry beside this file: the TypeScript an app copy carries, or the compiled `main.js` of the installed package. */
|
|
76
|
-
function mainFile(): string {
|
|
77
|
-
const compiled = join(import.meta.dirname, 'main.js')
|
|
78
|
-
return existsSync(compiled) ? compiled : join(import.meta.dirname, 'main.ts')
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Start the app in `projectRoot` as a desktop app: `npm run desktop` (bin.ts) with the app's folder, `extra` its arguments. Electron's main learns the
|
|
83
|
-
* app from ACRYLBLENDS_APP_ROOT (app-root.ts), since the shell is installed in node_modules, outside the app's tree.
|
|
84
|
-
*/
|
|
85
|
-
export function launchDesktop(projectRoot: string, extra: readonly string[]): ChildProcess {
|
|
86
|
-
const electron = createRequire(import.meta.url)('electron') as string
|
|
87
|
-
// ACRYLBLENDS_DESKTOP_SANDBOX=1: the owner has given Electron an AppArmor profile and wants the sandbox.
|
|
88
|
-
const blocked =
|
|
89
|
-
process.env.ACRYLBLENDS_DESKTOP_SANDBOX !== '1' && sandboxBlocked(process.platform)
|
|
90
|
-
if (blocked) console.warn(SANDBOX_NOTICE)
|
|
91
|
-
// macOS: the Dock and Cmd+Tab name the app and draw its icon only when the bundle says so (brand.ts); a copy that cannot be made leaves the stock Electron, with a note.
|
|
92
|
-
const branded = brandedElectron({
|
|
93
|
-
binary: electron,
|
|
94
|
-
folder: join(
|
|
95
|
-
acrylRoot(process.platform, process.env, personHome(process.env, process.platform)),
|
|
96
|
-
'electron',
|
|
97
|
-
),
|
|
98
|
-
id: appIdOf(projectRoot),
|
|
99
|
-
name: appTitle(projectRoot),
|
|
100
|
-
icon: iconFile(projectRoot),
|
|
101
|
-
})
|
|
102
|
-
if (branded.problem !== undefined)
|
|
103
|
-
console.warn(`desktop: the Dock shows Electron's own name and icon (${branded.problem})`)
|
|
104
|
-
process.env[APP_ROOT_ENV] = projectRoot
|
|
105
|
-
return runElectron(branded.binary, electronArgs(mainFile(), blocked, extra))
|
|
106
|
-
}
|