diff --git a/CHANGELOG.md b/CHANGELOG.md index 41dcce672d..98335f7532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [1.535.0](https://github.com/windmill-labs/windmill/compare/v1.534.1...v1.535.0) (2025-08-25) + + +### Features + +* **aichat:** show diff mode on inline scripts changes ([#6454](https://github.com/windmill-labs/windmill/issues/6454)) ([eca3109](https://github.com/windmill-labs/windmill/commit/eca3109ec63967e3041521bf74d34a12c70f5ff8)) + + +### Bug Fixes + +* fix opening advanced popup for run resetting tag to default ([d328894](https://github.com/windmill-labs/windmill/commit/d3288947b2d2539b2f3302059a9aad2841275a28)) + +## [1.534.1](https://github.com/windmill-labs/windmill/compare/v1.534.0...v1.534.1) (2025-08-25) + + +### Bug Fixes + +* add alias to subquery for older postgres versions ([#6455](https://github.com/windmill-labs/windmill/issues/6455)) ([16d233b](https://github.com/windmill-labs/windmill/commit/16d233bf466fd818ec1f9235377e4c1a8239d98c)) +* **frontend:** fix test step behavior ([#6427](https://github.com/windmill-labs/windmill/issues/6427)) ([fc20b7b](https://github.com/windmill-labs/windmill/commit/fc20b7bd91d33115aacb38cc46394f9c6465aa0f)) + +## [1.534.0](https://github.com/windmill-labs/windmill/compare/v1.533.1...v1.534.0) (2025-08-25) + + +### Features + +* **backend:** support unencrypted connection to mssql ([#6453](https://github.com/windmill-labs/windmill/issues/6453)) ([8d31c2a](https://github.com/windmill-labs/windmill/commit/8d31c2ab0d34036dc8057611857a5d72aad8598f)) + + +### Bug Fixes + +* **aichat:** fix wrong current model logic ([#6451](https://github.com/windmill-labs/windmill/issues/6451)) ([e951c89](https://github.com/windmill-labs/windmill/commit/e951c896b865df48d331968953c9e44848236516)) +* **flow:** test this step preload step input evaluation ([1073eb0](https://github.com/windmill-labs/windmill/commit/1073eb0e682e7bd253c6d62225361b487d7f6d2f)) + ## [1.533.1](https://github.com/windmill-labs/windmill/compare/v1.533.0...v1.533.1) (2025-08-23) diff --git a/README.md b/README.md index 27784d4922..5bfad3e7bf 100644 --- a/README.md +++ b/README.md @@ -332,40 +332,40 @@ you to have it being synced automatically everyday. ## Environment Variables -| Environment Variable name | Default | Description | Api Server/Worker/All | -| ----------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | -| DATABASE_URL | | The Postgres database url. | All | -| WORKER_GROUP | default | The worker group the worker belongs to and get its configuration pulled from | Worker | -| MODE | standalone | The mode if the binary. Possible values: standalone, worker, server, agent | All | -| METRICS_ADDR | None | (ee only) The socket addr at which to expose Prometheus metrics at the /metrics path. Set to "true" to expose it on port 8001 | All | -| JSON_FMT | false | Output the logs in json format instead of logfmt | All | -| BASE_URL | http://localhost:8000 | The base url that is exposed publicly to access your instance. Is overriden by the instance settings if any. | Server | -| ZOMBIE_JOB_TIMEOUT | 30 | The timeout after which a job is considered to be zombie if the worker did not send pings about processing the job (every server check for zombie jobs every 30s) | Server | -| RESTART_ZOMBIE_JOBS | true | If true then a zombie job is restarted (in-place with the same uuid and some logs), if false the zombie job is failed | Server | -| SLEEP_QUEUE | 50 | The number of ms to sleep in between the last check for new jobs in the DB. It is multiplied by NUM_WORKERS such that in average, for one worker instance, there is one pull every SLEEP_QUEUE ms. | Worker | -| KEEP_JOB_DIR | false | Keep the job directory after the job is done. Useful for debugging. | Worker | -| LICENSE_KEY (EE only) | None | License key checked at startup for the Enterprise Edition of Windmill | Worker | -| SLACK_SIGNING_SECRET | None | The signing secret of your Slack app. See [Slack documentation](https://api.slack.com/authentication/verifying-requests-from-slack) | Server | -| COOKIE_DOMAIN | None | The domain of the cookie. If not set, the cookie will be set by the browser based on the full origin | Server | -| DENO_PATH | /usr/bin/deno | The path to the deno binary. | Worker | -| PYTHON_PATH | | The path to the python binary if wanting to not have it managed by uv. | Worker | -| GO_PATH | /usr/bin/go | The path to the go binary. | Worker | -| GOPRIVATE | | The GOPRIVATE env variable to use private go modules | Worker | -| GOPROXY | | The GOPROXY env variable to use | Worker | -| NETRC | | The netrc content to use a private go registry | Worker | -| PY_CONCURRENT_DOWNLOADS | 20 | Sets the maximum number of in-flight concurrent python downloads that windmill will perform at any given time. | Worker | -| PATH | None | The path environment variable, usually inherited | Worker | -| HOME | None | The home directory to use for Go and Bash , usually inherited | Worker | -| DATABASE_CONNECTIONS | 50 (Server)/3 (Worker) | The max number of connections in the database connection pool | All | -| SUPERADMIN_SECRET | None | A token that would let the caller act as a virtual superadmin superadmin@windmill.dev | Server | -| TIMEOUT_WAIT_RESULT | 20 | The number of seconds to wait before timeout on the 'run_wait_result' endpoint | Worker | -| QUEUE_LIMIT_WAIT_RESULT | None | The number of max jobs in the queue before rejecting immediately the request in 'run_wait_result' endpoint. Takes precedence on the query arg. If none is specified, there are no limit. | Worker | -| DENO_AUTH_TOKENS | None | Custom DENO_AUTH_TOKENS to pass to worker to allow the use of private modules | Worker | -| DISABLE_RESPONSE_LOGS | false | Disable response logs | Server | -| CREATE_WORKSPACE_REQUIRE_SUPERADMIN | true | If true, only superadmins can create new workspaces | Server | -| MIN_FREE_DISK_SPACE_MB | 15000 | Minimum amount of free space on worker. Sends critical alert if worker has less free space. | Worker | -| RUN_UPDATE_CA_CERTIFICATE_AT_START | false | If true, runs CA certificate update command at startup before other initialization | All | -| RUN_UPDATE_CA_CERTIFICATE_PATH | /usr/sbin/update-ca-certificates | Path to the CA certificate update command/script to run when RUN_UPDATE_CA_CERTIFICATE_AT_START is true | All | +| Environment Variable name | Default | Description | Api Server/Worker/All | +| ----------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | +| DATABASE_URL | | The Postgres database url. | All | +| WORKER_GROUP | default | The worker group the worker belongs to and get its configuration pulled from | Worker | +| MODE | standalone | The mode if the binary. Possible values: standalone, worker, server, agent | All | +| METRICS_ADDR | None | (ee only) The socket addr at which to expose Prometheus metrics at the /metrics path. Set to "true" to expose it on port 8001 | All | +| JSON_FMT | false | Output the logs in json format instead of logfmt | All | +| BASE_URL | http://localhost:8000 | The base url that is exposed publicly to access your instance. Is overriden by the instance settings if any. | Server | +| ZOMBIE_JOB_TIMEOUT | 30 | The timeout after which a job is considered to be zombie if the worker did not send pings about processing the job (every server check for zombie jobs every 30s) | Server | +| RESTART_ZOMBIE_JOBS | true | If true then a zombie job is restarted (in-place with the same uuid and some logs), if false the zombie job is failed | Server | +| SLEEP_QUEUE | 50 | The number of ms to sleep in between the last check for new jobs in the DB. It is multiplied by NUM_WORKERS such that in average, for one worker instance, there is one pull every SLEEP_QUEUE ms. | Worker | +| KEEP_JOB_DIR | false | Keep the job directory after the job is done. Useful for debugging. | Worker | +| LICENSE_KEY (EE only) | None | License key checked at startup for the Enterprise Edition of Windmill | Worker | +| SLACK_SIGNING_SECRET | None | The signing secret of your Slack app. See [Slack documentation](https://api.slack.com/authentication/verifying-requests-from-slack) | Server | +| COOKIE_DOMAIN | None | The domain of the cookie. If not set, the cookie will be set by the browser based on the full origin | Server | +| DENO_PATH | /usr/bin/deno | The path to the deno binary. | Worker | +| PYTHON_PATH | | The path to the python binary if wanting to not have it managed by uv. | Worker | +| GO_PATH | /usr/bin/go | The path to the go binary. | Worker | +| GOPRIVATE | | The GOPRIVATE env variable to use private go modules | Worker | +| GOPROXY | | The GOPROXY env variable to use | Worker | +| NETRC | | The netrc content to use a private go registry | Worker | +| PY_CONCURRENT_DOWNLOADS | 20 | Sets the maximum number of in-flight concurrent python downloads that windmill will perform at any given time. | Worker | +| PATH | None | The path environment variable, usually inherited | Worker | +| HOME | None | The home directory to use for Go and Bash , usually inherited | Worker | +| DATABASE_CONNECTIONS | 50 (Server)/3 (Worker) | The max number of connections in the database connection pool | All | +| SUPERADMIN_SECRET | None | A token that would let the caller act as a virtual superadmin superadmin@windmill.dev | Server | +| TIMEOUT_WAIT_RESULT | 20 | The number of seconds to wait before timeout on the 'run_wait_result' endpoint | Worker | +| QUEUE_LIMIT_WAIT_RESULT | None | The number of max jobs in the queue before rejecting immediately the request in 'run_wait_result' endpoint. Takes precedence on the query arg. If none is specified, there are no limit. | Worker | +| DENO_AUTH_TOKENS | None | Custom DENO_AUTH_TOKENS to pass to worker to allow the use of private modules | Worker | +| DISABLE_RESPONSE_LOGS | false | Disable response logs | Server | +| CREATE_WORKSPACE_REQUIRE_SUPERADMIN | true | If true, only superadmins can create new workspaces | Server | +| MIN_FREE_DISK_SPACE_MB | 15000 | Minimum amount of free space on worker. Sends critical alert if worker has less free space. | Worker | +| RUN_UPDATE_CA_CERTIFICATE_AT_START | false | If true, runs CA certificate update command at startup before other initialization | All | +| RUN_UPDATE_CA_CERTIFICATE_PATH | /usr/sbin/update-ca-certificates | Path to the CA certificate update command/script to run when RUN_UPDATE_CA_CERTIFICATE_AT_START is true | All | ## Run a local dev setup @@ -374,7 +374,6 @@ Using [Nix](./frontend/README_DEV.md#nix) (Recommended). See the [./frontend/README_DEV.md](./frontend/README_DEV.md) file for all running options. - ### only Frontend This will use the backend of but your own frontend @@ -400,29 +399,27 @@ npm run generate-backend-client-mac See the [./frontend/README_DEV.md](./frontend/README_DEV.md) file for all running options. -1. Create a Postgres Database for Windmill and create an admin role inside your - Postgres setup. The easiest way to get a working db is to run +1. Start a local Postgres database using for instance the `start-dev-db.sh` script which will make a database available at `postgres://postgres:changeme@localhost:5432/windmill` + Then run the migrations using the following command: ``` cargo install sqlx-cli env DATABASE_URL= sqlx migrate run ``` - This will also avoid compile time issue with sqlx's `query!` macro -2. Install [nsjail](https://github.com/google/nsjail) and have it accessible in + This will also avoid compile time issue with sqlx's `query!` macro. +2. (optional, linux only) Install [nsjail](https://github.com/google/nsjail) and have it accessible in your PATH -3. Install deno and python3, have the bins at `/usr/bin/deno` and - `/usr/local/bin/python3` -4. Install [caddy](https://caddyserver.com) -5. Install the [lld linker](https://lld.llvm.org/) -6. Go to `frontend/`: - 1. `npm install`, `npm run generate-backend-client` then `npm run dev` +3. Install bun, deno and python3 (+ any languages you want to use), have the bins at `/usr/bin/bun`,`/usr/bin/deno`, and + `/usr/local/bin/python3` or set the corresponding environment variables. +4. (optional) Install the [lld linker](https://lld.llvm.org/) +5. Go to `frontend/`: + 1. `npm install`, `npm run generate-backend-client` then `REMOTE=http://localhost:8000 npm run dev` 2. You might need to set some extra heap space for the node runtime `export NODE_OPTIONS="--max-old-space-size=4096"` - 3. In another shell `npm run build` otherwise the backend will not find the - `frontend/build` folder and will not compile. - 4. In another shell `sudo caddy run --config Caddyfile` -7. Go to `backend/`: - `env DATABASE_URL= RUST_LOG=info cargo run` -8. Et voilĂ , windmill should be available at `http://localhost/` + 3. Create an empty `frontend/build` folder using `mkdir frontend/build` +6. Go to `backend/`: + 1. `env DATABASE_URL= RUST_LOG=info cargo run` + 2. You can specify any feature flag you want to enable, for example `cargo run --features python` to enable the python executor. +7. Et voilĂ , windmill should be available at `http://localhost:3000` ## Contributors diff --git a/backend/.sqlx/query-543859cf1c8d9e3bf2c2b23d21d096d01fe7a72d749229f21634b549c6b1241a.json b/backend/.sqlx/query-298f8609319a2928257fd5be60bb37f292c786d2348efe11d19868e5dc8fba11.json similarity index 68% rename from backend/.sqlx/query-543859cf1c8d9e3bf2c2b23d21d096d01fe7a72d749229f21634b549c6b1241a.json rename to backend/.sqlx/query-298f8609319a2928257fd5be60bb37f292c786d2348efe11d19868e5dc8fba11.json index f5285690ec..605025b997 100644 --- a/backend/.sqlx/query-543859cf1c8d9e3bf2c2b23d21d096d01fe7a72d749229f21634b549c6b1241a.json +++ b/backend/.sqlx/query-298f8609319a2928257fd5be60bb37f292c786d2348efe11d19868e5dc8fba11.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT elem FROM (SELECT unnest($1::TEXT[]) AS elem)\n WHERE elem NOT IN (SELECT datname FROM pg_catalog.pg_database);", + "query": "SELECT elem FROM (SELECT unnest($1::TEXT[]) AS elem) AS e\n WHERE elem NOT IN (SELECT datname FROM pg_catalog.pg_database);", "describe": { "columns": [ { @@ -18,5 +18,5 @@ null ] }, - "hash": "543859cf1c8d9e3bf2c2b23d21d096d01fe7a72d749229f21634b549c6b1241a" + "hash": "298f8609319a2928257fd5be60bb37f292c786d2348efe11d19868e5dc8fba11" } diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 5effd205d1..5866575aa6 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -496,7 +496,7 @@ dependencies = [ "memchr", "num", "regex", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] @@ -3132,7 +3132,7 @@ dependencies = [ "log", "recursive", "regex", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] @@ -5130,8 +5130,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" dependencies = [ "bit-set 0.5.3", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", ] [[package]] @@ -5141,8 +5141,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" dependencies = [ "bit-set 0.8.0", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", ] [[package]] @@ -5929,8 +5929,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", ] [[package]] @@ -6891,7 +6891,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.9", + "regex-automata 0.4.10", "same-file", "walkdir", "winapi-util", @@ -7150,9 +7150,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ "getrandom 0.3.3", "libc", @@ -10607,14 +10607,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata 0.4.10", + "regex-syntax 0.8.6", ] [[package]] @@ -10628,20 +10628,20 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", ] [[package]] name = "regex-lite" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" +checksum = "943f41321c63ef1c92fd763bfe054d2668f7f225a5c29f0105903dc2fc04ba30" [[package]] name = "regex-syntax" @@ -10657,9 +10657,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" [[package]] name = "rend" @@ -13263,7 +13263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d60769b80ad7953d8a7b2c70cdfe722bbcdcac6bccc8ac934c40c034d866fc18" dependencies = [ "byteorder", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", "utf8-ranges", ] @@ -14182,7 +14182,7 @@ checksum = "0203df02a3b6dd63575cc1d6e609edc2181c9a11867a271b25cfd2abff3ec5ca" dependencies = [ "cc", "regex", - "regex-syntax 0.8.5", + "regex-syntax 0.8.6", "tree-sitter-language", ] @@ -14596,9 +14596,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.6" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "137a3c834eaf7139b73688502f3f1141a0337c5d8e4d9b536f9b8c796e26a7c4" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", @@ -15129,7 +15129,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windmill" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "axum", @@ -15183,7 +15183,7 @@ dependencies = [ [[package]] name = "windmill-api" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "argon2", @@ -15300,7 +15300,7 @@ dependencies = [ [[package]] name = "windmill-api-client" -version = "1.533.1" +version = "1.535.0" dependencies = [ "base64 0.22.1", "chrono", @@ -15315,7 +15315,7 @@ dependencies = [ [[package]] name = "windmill-audit" -version = "1.533.1" +version = "1.535.0" dependencies = [ "chrono", "serde", @@ -15328,7 +15328,7 @@ dependencies = [ [[package]] name = "windmill-autoscaling" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "axum", @@ -15347,7 +15347,7 @@ dependencies = [ [[package]] name = "windmill-common" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "async-recursion", @@ -15427,7 +15427,7 @@ dependencies = [ [[package]] name = "windmill-git-sync" -version = "1.533.1" +version = "1.535.0" dependencies = [ "regex", "serde", @@ -15442,7 +15442,7 @@ dependencies = [ [[package]] name = "windmill-indexer" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "bytes", @@ -15466,7 +15466,7 @@ dependencies = [ [[package]] name = "windmill-macros" -version = "1.533.1" +version = "1.535.0" dependencies = [ "itertools 0.14.0", "lazy_static", @@ -15478,7 +15478,7 @@ dependencies = [ [[package]] name = "windmill-parser" -version = "1.533.1" +version = "1.535.0" dependencies = [ "convert_case 0.6.0", "serde", @@ -15487,7 +15487,7 @@ dependencies = [ [[package]] name = "windmill-parser-bash" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "lazy_static", @@ -15499,7 +15499,7 @@ dependencies = [ [[package]] name = "windmill-parser-csharp" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "serde_json", @@ -15511,7 +15511,7 @@ dependencies = [ [[package]] name = "windmill-parser-go" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "gosyn", @@ -15523,7 +15523,7 @@ dependencies = [ [[package]] name = "windmill-parser-graphql" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "lazy_static", @@ -15535,7 +15535,7 @@ dependencies = [ [[package]] name = "windmill-parser-java" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "serde_json", @@ -15547,7 +15547,7 @@ dependencies = [ [[package]] name = "windmill-parser-nu" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "nu-parser", @@ -15558,7 +15558,7 @@ dependencies = [ [[package]] name = "windmill-parser-php" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -15569,7 +15569,7 @@ dependencies = [ [[package]] name = "windmill-parser-py" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "itertools 0.14.0", @@ -15581,7 +15581,7 @@ dependencies = [ [[package]] name = "windmill-parser-py-imports" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "async-recursion", @@ -15604,7 +15604,7 @@ dependencies = [ [[package]] name = "windmill-parser-ruby" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "lazy_static", @@ -15618,7 +15618,7 @@ dependencies = [ [[package]] name = "windmill-parser-rust" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "convert_case 0.6.0", @@ -15635,7 +15635,7 @@ dependencies = [ [[package]] name = "windmill-parser-sql" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "lazy_static", @@ -15649,7 +15649,7 @@ dependencies = [ [[package]] name = "windmill-parser-ts" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "lazy_static", @@ -15667,7 +15667,7 @@ dependencies = [ [[package]] name = "windmill-parser-wasm" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "getrandom 0.2.16", @@ -15692,7 +15692,7 @@ dependencies = [ [[package]] name = "windmill-parser-yaml" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "serde_json", @@ -15702,7 +15702,7 @@ dependencies = [ [[package]] name = "windmill-queue" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "async-recursion", @@ -15735,7 +15735,7 @@ dependencies = [ [[package]] name = "windmill-sql-datatype-parser-wasm" -version = "1.533.1" +version = "1.535.0" dependencies = [ "wasm-bindgen", "wasm-bindgen-test", @@ -15745,7 +15745,7 @@ dependencies = [ [[package]] name = "windmill-worker" -version = "1.533.1" +version = "1.535.0" dependencies = [ "anyhow", "async-recursion", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 055eb778e5..7168cade28 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "windmill" -version = "1.533.1" +version = "1.535.0" authors.workspace = true edition.workspace = true @@ -33,7 +33,7 @@ members = [ ] [workspace.package] -version = "1.533.1" +version = "1.535.0" authors = ["Ruben Fiszel "] edition = "2021" diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 03d1bfdd8b..29597b13c7 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -1,7 +1,7 @@ openapi: "3.0.3" info: - version: 1.533.1 + version: 1.535.0 title: Windmill API contact: diff --git a/backend/windmill-api/src/settings.rs b/backend/windmill-api/src/settings.rs index 245900b1db..73936466c0 100644 --- a/backend/windmill-api/src/settings.rs +++ b/backend/windmill-api/src/settings.rs @@ -575,7 +575,7 @@ async fn databases_exist( Json(database_names): Json>, ) -> JsonResult> { let result = sqlx::query_scalar!( - r#"SELECT elem FROM (SELECT unnest($1::TEXT[]) AS elem) + r#"SELECT elem FROM (SELECT unnest($1::TEXT[]) AS elem) AS e WHERE elem NOT IN (SELECT datname FROM pg_catalog.pg_database);"#, database_names.as_slice() ) diff --git a/backend/windmill-worker/src/mssql_executor.rs b/backend/windmill-worker/src/mssql_executor.rs index 7f5ec7c116..7e4ccd2958 100644 --- a/backend/windmill-worker/src/mssql_executor.rs +++ b/backend/windmill-worker/src/mssql_executor.rs @@ -5,7 +5,9 @@ use regex::Regex; use serde::Deserialize; use serde_json::value::RawValue; use serde_json::{Map, Value}; -use tiberius::{AuthMethod, Client, ColumnData, Config, FromSqlOwned, Query, Row, SqlBrowser}; +use tiberius::{ + AuthMethod, Client, ColumnData, Config, EncryptionLevel, FromSqlOwned, Query, Row, SqlBrowser, +}; use tokio::net::TcpStream; use tokio_util::compat::TokioAsyncWriteCompatExt; use uuid::Uuid; @@ -39,6 +41,7 @@ struct MssqlDatabase { trust_cert: Option, #[serde(default, deserialize_with = "empty_as_none")] ca_cert: Option, + encrypt: Option, } #[derive(Debug, Deserialize)] @@ -146,6 +149,12 @@ pub async fn do_mssql( tracing::info!("MSSQL: using provided CA certificate for trust"); } + config.encryption(if database.encrypt.unwrap_or(true) { + EncryptionLevel::Required + } else { + EncryptionLevel::NotSupported + }); + let tcp = if use_instance_name { TcpStream::connect_named(&config).await.map_err(to_anyhow)? // named instance } else { diff --git a/benchmarks/lib.ts b/benchmarks/lib.ts index 138aaa8648..aa2dbfd3d3 100644 --- a/benchmarks/lib.ts +++ b/benchmarks/lib.ts @@ -2,7 +2,7 @@ import { sleep } from "https://deno.land/x/sleep@v1.2.1/mod.ts"; import * as windmill from "https://deno.land/x/windmill@v1.174.0/mod.ts"; import * as api from "https://deno.land/x/windmill@v1.174.0/windmill-api/index.ts"; -export const VERSION = "v1.533.1"; +export const VERSION = "v1.535.0"; export async function login(email: string, password: string): Promise { return await windmill.UserService.login({ diff --git a/cli/src/main.ts b/cli/src/main.ts index 9cd029cef1..ef8c27d7c1 100644 --- a/cli/src/main.ts +++ b/cli/src/main.ts @@ -68,7 +68,7 @@ export { // } // }); -export const VERSION = "1.533.1"; +export const VERSION = "1.535.0"; const command = new Command() .name("wmill") diff --git a/frontend/README_DEV.md b/frontend/README_DEV.md index 88c18440cb..c17ac944c8 100644 --- a/frontend/README_DEV.md +++ b/frontend/README_DEV.md @@ -15,44 +15,45 @@ That's it! You are ready to go. > Using **direnv** is highly recommended, since it can load shell automatically based on your CWD. It also can give you hints. ### Development + ```bash # enter a dev shell containing all necessary packages. `direnv allow` if direnv is installed. -nix develop +nix develop ## or ignore if you have `direnv` # Start db (if not started already) -sudo docker compose up db -d +./start-dev-db.sh # run the frontend. wm # In an other shell: # -nix develop +nix develop ## or ignore if you have `direnv` cd backend # You don't need to install anything extra. All dependencies are already in place! -cargo run --features all_languages +cargo run --features all_languages ``` The default proxy is setup to use the local backend: . -### wm-* Commands +### wm-\* Commands Nix shell provides you with several helper commands prefixed with `wm-` ```bash # Start minio server (implements S3) -wm-minio -# Note: You will need access to EE private repo in order to compile, don't forget "enterprise" and "parquet" freatures as well. +wm-minio +# Note: You will need access to EE private repo in order to compile, don't forget "enterprise" and "parquet" freatures as well. # Generate keys for local dev. -wm-minio-keys +wm-minio-keys # Minio data as well as generated keys are stored in `backend/.minio-data` ``` -You can read about all others commands individually in [flake.nix](../flake.nix). +You can read about all others commands individually in [flake.nix](../flake.nix). ### dev.nu @@ -106,7 +107,7 @@ REMOTE=http://localhost REMOTE_LSP=http://localhost npm run dev Sometimes it is important to build docker image for your branch locally. It is crucial part of testing, since local environment may differ from the containerized one. -That's why we provide [docker/dev.nu](../docker/dev.nu). It is helper that can build images locally and execute them. +That's why we provide [docker/dev.nu](../docker/dev.nu). It is helper that can build images locally and execute them. it can build the image and run on local repository. @@ -150,7 +151,7 @@ If you develop wasm parser for new language you can also pass `--wasm-pkg (undefined) const history = initHistory(flowStore.val) - const testSteps = new TestSteps() + const stepsInputArgs = new StepsInputArgs() const selectedIdStore = writable('settings-metadata') const triggersCount = writable(undefined) const modulesTestStates = new ModulesTestStates((moduleId) => { @@ -481,7 +481,7 @@ pathStore: writable(''), flowStateStore, flowStore, - testSteps, + stepsInputArgs, saveDraft: () => {}, initialPathStore: writable(''), fakeInitialPath: '', @@ -806,7 +806,7 @@ noEditor on:applyArgs={(ev) => { if (ev.detail.kind === 'preprocessor') { - testSteps.setStepArgs('preprocessor', ev.detail.args ?? {}) + stepsInputArgs.setStepArgs('preprocessor', ev.detail.args ?? {}) $selectedIdStore = 'preprocessor' } else { previewArgsStore.val = ev.detail.args ?? {} @@ -818,6 +818,7 @@ isOwner={flowPreviewContent?.getIsOwner()} {suspendStatus} onOpenDetails={flowPreviewButtons?.openPreview} + previewOpen={flowPreviewButtons?.getPreviewOpen()} /> {/key} diff --git a/frontend/src/lib/components/DiffDrawer.svelte b/frontend/src/lib/components/DiffDrawer.svelte index 5d178aab75..bbb2b99401 100644 --- a/frontend/src/lib/components/DiffDrawer.svelte +++ b/frontend/src/lib/components/DiffDrawer.svelte @@ -212,7 +212,7 @@ import { BROWSER } from 'esm-env' - import { createEventDispatcher, onMount } from 'svelte' + import { onMount } from 'svelte' import '@codingame/monaco-vscode-standalone-languages' import '@codingame/monaco-vscode-standalone-json-language-features' @@ -10,24 +10,47 @@ import { initializeVscode } from './vscode' import EditorTheme from './EditorTheme.svelte' import Button from '$lib/components/common/button/Button.svelte' + import { twMerge } from 'tailwind-merge' + import type { ButtonType } from './common' const SIDE_BY_SIDE_MIN_WIDTH = 700 - export let automaticLayout = true - export let fixedOverflowWidgets = true - export let defaultLang: string | undefined = undefined - export let defaultModifiedLang: string | undefined = undefined - export let defaultOriginal: string | undefined = undefined - export let defaultModified: string | undefined = undefined - export let readOnly = false - export let showButtons = false - export let showHistoryButton: boolean = true + export interface ButtonProp { + text: string + color?: ButtonType.Color + onClick: () => void + } - let diffEditor: meditor.IStandaloneDiffEditor | undefined - let diffDivEl: HTMLDivElement | null = null - let editorWidth: number = SIDE_BY_SIDE_MIN_WIDTH + interface Props { + open?: boolean + className?: string + automaticLayout?: boolean + fixedOverflowWidgets?: boolean + defaultLang?: string + defaultModifiedLang?: string + defaultOriginal?: string + defaultModified?: string + readOnly?: boolean + buttons?: ButtonProp[] + } + + let { + open = false, + className = '', + automaticLayout = true, + fixedOverflowWidgets = true, + defaultLang, + defaultModifiedLang, + defaultOriginal = undefined, + defaultModified = undefined, + readOnly = false, + buttons = [] + }: Props = $props() + + let diffEditor: meditor.IStandaloneDiffEditor | undefined = $state(undefined) + let diffDivEl: HTMLDivElement | null = $state(null) + let editorWidth: number = $state(SIDE_BY_SIDE_MIN_WIDTH) - export let open = false async function loadDiffEditor() { await initializeVscode() @@ -105,9 +128,15 @@ diffEditor?.updateOptions({ renderSideBySide: editorWidth >= SIDE_BY_SIDE_MIN_WIDTH }) } - $: onWidthChange(editorWidth) + $effect(() => { + if (open && diffDivEl) { + loadDiffEditor() + } + }) - $: open && diffDivEl && loadDiffEditor() + $effect(() => { + onWidthChange(editorWidth) + }) onMount(() => { if (BROWSER) { @@ -116,32 +145,24 @@ } } }) - - const dispatch = createEventDispatcher<{ - hideDiffMode: void - seeHistory: void - }>() {#if open}
- {#if showButtons} + {#if buttons.length > 0}
- {#if showHistoryButton} - {button.text} - {/if} - + {/each}
{/if} {/if} diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte index 0573c67c40..4f764065e4 100644 --- a/frontend/src/lib/components/FlowBuilder.svelte +++ b/frontend/src/lib/components/FlowBuilder.svelte @@ -77,7 +77,7 @@ } from './triggers/utils' import DraftTriggersConfirmationModal from './common/confirmationModal/DraftTriggersConfirmationModal.svelte' import { Triggers } from './triggers/triggers.svelte' - import { TestSteps } from './flows/testSteps.svelte' + import { StepsInputArgs } from './flows/stepsInputArgs.svelte' import { aiChatManager } from './copilot/chat/AIChatManager.svelte' import type { GraphModuleState } from './graph' import { @@ -571,7 +571,7 @@ payloadData: undefined }) - const testSteps = new TestSteps() + const stepsInputArgs = new StepsInputArgs() function select(selectedId: string) { selectedIdStore.set(selectedId) @@ -592,7 +592,7 @@ flowStateStore, flowStore, pathStore, - testSteps, + stepsInputArgs, saveDraft, initialPathStore, fakeInitialPath, @@ -1129,6 +1129,8 @@ bind:this={flowPreviewButtons} {loading} onRunPreview={() => { + // Reset manually edited args inputs when running a preview + stepsInputArgs.resetManuallyEditedArgs() modulesTestStates.hideJobsInGraph() localModuleStates = {} showJobStatus = true @@ -1170,7 +1172,7 @@ {newFlow} on:applyArgs={(ev) => { if (ev.detail.kind === 'preprocessor') { - testSteps.setStepArgs('preprocessor', ev.detail.args ?? {}) + stepsInputArgs.setStepArgs('preprocessor', ev.detail.args ?? {}) $selectedIdStore = 'preprocessor' } }} @@ -1218,6 +1220,7 @@ delete modulesTestStates.states[id] }} {flowHasChanged} + previewOpen={flowPreviewButtons?.getPreviewOpen()} /> {:else} Loading... diff --git a/frontend/src/lib/components/FlowPreviewContent.svelte b/frontend/src/lib/components/FlowPreviewContent.svelte index 01163fa07d..77c3c17e93 100644 --- a/frontend/src/lib/components/FlowPreviewContent.svelte +++ b/frontend/src/lib/components/FlowPreviewContent.svelte @@ -140,7 +140,7 @@ jobId = await runFlowPreview(args, newFlow, $pathStore, restartedFrom) isRunning = true if (inputSelected) { - savedArgs = previewArgs.val + savedArgs = $state.snapshot(previewArgs.val) inputSelected = undefined } onRunPreview?.() @@ -166,7 +166,7 @@ if (preventEscape) { selectInput(undefined) event.preventDefault() - event.stopPropagation + event.stopPropagation() } break } @@ -506,7 +506,7 @@ schema={flowStore.val.schema} bind:args={previewArgs.val} on:change={() => { - savedArgs = previewArgs.val + savedArgs = $state.snapshot(previewArgs.val) }} bind:isValid helperScript={flowStore.val.schema?.['x-windmill-dyn-select-code'] && diff --git a/frontend/src/lib/components/ModulePreview.svelte b/frontend/src/lib/components/ModulePreview.svelte index 93ea296ec6..ebee88985f 100644 --- a/frontend/src/lib/components/ModulePreview.svelte +++ b/frontend/src/lib/components/ModulePreview.svelte @@ -18,6 +18,7 @@ noEditor?: boolean scriptProgress?: any focusArg?: string + onJobDone?: () => void } let { @@ -28,7 +29,8 @@ testIsLoading = $bindable(false), noEditor = false, scriptProgress = $bindable(undefined), - focusArg = undefined + focusArg = undefined, + onJobDone }: Props = $props() const { flowStore } = getContext('FlowEditorContext') @@ -46,6 +48,7 @@ bind:testIsLoading bind:scriptProgress bind:this={moduleTest} + {onJobDone} />
diff --git a/frontend/src/lib/components/ModulePreviewForm.svelte b/frontend/src/lib/components/ModulePreviewForm.svelte index 531fd9f24e..9c21d1e173 100644 --- a/frontend/src/lib/components/ModulePreviewForm.svelte +++ b/frontend/src/lib/components/ModulePreviewForm.svelte @@ -1,11 +1,11 @@
- {#if keys.length > 0} - {#each keys as argName, i (argName)} - {#if Object.keys(schema.properties ?? {}).includes(argName)} -
- {#if schema?.properties?.[argName]} - testSteps?.getStepInputArgs(mod.id, argName), - (v) => testSteps?.setStepInputArgs(mod.id, argName, v) - } - type={schema.properties[argName].type} - oneOf={schema.properties[argName].oneOf} - required={schema?.required?.includes(argName)} - pattern={schema.properties[argName].pattern} - bind:editor={editor[argName]} - bind:valid={inputCheck[argName]} - defaultValue={schema.properties[argName].default} - enum_={schema.properties[argName].enum} - format={schema.properties[argName].format} - contentEncoding={schema.properties[argName].contentEncoding} - properties={schema.properties[argName].properties} - nestedRequired={schema.properties[argName].required} - itemsType={schema.properties[argName].items} - extra={schema.properties[argName]} - nullable={schema.properties[argName].nullable} - title={schema.properties[argName].title} - placeholder={schema.properties[argName].placeholder} - /> - {/if} - {#if testSteps?.isArgManuallySet(mod.id, argName)} -
- -
- {/if} -
- {/if} - {/each} + {#if initialized} + {#if keys.length > 0} + {#each keys as argName, i (argName)} + {#if Object.keys(schema.properties ?? {}).includes(argName)} +
+ {#if schema?.properties?.[argName]} + stepsInputArgs?.getStepInputArgs(mod.id, argName), + (v) => stepsInputArgs?.setStepInputArgs(mod.id, argName, v) + } + type={schema.properties[argName].type} + oneOf={schema.properties[argName].oneOf} + required={schema?.required?.includes(argName)} + pattern={schema.properties[argName].pattern} + bind:editor={editor[argName]} + bind:valid={inputCheck[argName]} + defaultValue={schema.properties[argName].default} + enum_={schema.properties[argName].enum} + format={schema.properties[argName].format} + contentEncoding={schema.properties[argName].contentEncoding} + properties={schema.properties[argName].properties} + nestedRequired={schema.properties[argName].required} + itemsType={schema.properties[argName].items} + extra={schema.properties[argName]} + nullable={schema.properties[argName].nullable} + title={schema.properties[argName].title} + placeholder={schema.properties[argName].placeholder} + /> + {/if} + {#if stepsInputArgs?.isArgManuallySet(mod.id, argName)} +
+ +
+ {/if} +
+ {/if} + {/each} + {/if} + {:else} +
Loading test step arguments...
{/if}
diff --git a/frontend/src/lib/components/ModulePreviewResultViewer.svelte b/frontend/src/lib/components/ModulePreviewResultViewer.svelte index 4ea6c2c154..35e716a92d 100644 --- a/frontend/src/lib/components/ModulePreviewResultViewer.svelte +++ b/frontend/src/lib/components/ModulePreviewResultViewer.svelte @@ -7,7 +7,7 @@ import { type Script, type Job, type FlowModule } from '$lib/gen' import OutputPickerInner from '$lib/components/flows/propPicker/OutputPickerInner.svelte' import { Pane, Splitpanes } from 'svelte-splitpanes' - import type { FlowEditorContext } from './flows/types' + import type { FlowEditorContext, OutputViewerJob } from './flows/types' import { getContext } from 'svelte' import { getStringError } from './copilot/chat/utils' import AiAgentLogViewer from './AIAgentLogViewer.svelte' @@ -17,9 +17,8 @@ editor: Editor | undefined diffEditor: DiffEditor | undefined loopStatus?: { type: 'inside' | 'self'; flow: 'forloopflow' | 'whileloopflow' } | undefined - lastJob?: Job | undefined + testJob?: Job & { result_stream?: string } scriptProgress?: number | undefined - testJob?: Job | undefined mod: FlowModule testIsLoading?: boolean disableMock?: boolean @@ -34,7 +33,6 @@ editor, diffEditor, loopStatus = undefined, - lastJob = undefined, scriptProgress = $bindable(undefined), testJob = undefined, mod, @@ -46,21 +44,20 @@ tagLabel = undefined }: Props = $props() - const { testSteps } = getContext('FlowEditorContext') + const { stepsInputArgs } = getContext('FlowEditorContext') - let selectedJob: Job | undefined = $state(undefined) - let preview: 'mock' | 'job' | undefined = $state(undefined) let jobProgressReset: () => void = $state(() => {}) - $effect(() => { - if (preview != undefined && testJob) { - preview = undefined - } - }) - - let forceJson = $state(false) + let outputPickerInner: OutputPickerInner | undefined = $state(undefined) + export function getOutputPickerInner() { + return outputPickerInner + } + const selectedJob: OutputViewerJob = $derived.by( + () => outputPickerInner?.getSelectedJob?.() ?? undefined + ) const logJob = $derived(testJob ?? selectedJob) + const preview = $derived.by(() => outputPickerInner?.getPreview?.()) @@ -75,7 +72,6 @@ {/if} {#snippet copilot_fix()} - {#if lang && editor && diffEditor && testSteps.getStepArgs(mod.id) && selectedJob?.type === 'CompletedJob' && !selectedJob.success && getStringError(selectedJob.result)} + {#if lang && editor && diffEditor && stepsInputArgs.getStepArgs(mod.id) && selectedJob?.type === 'CompletedJob' && !selectedJob.success && getStringError(selectedJob.result)} {/if} {/snippet} - {#if (mod.mock?.enabled && preview != 'job') || preview == 'mock'} + {#if (mod.mock?.enabled && preview !== 'job' && testJob?.type !== 'QueuedJob') || preview === 'mock'} {/if} diff --git a/frontend/src/lib/components/ModuleTest.svelte b/frontend/src/lib/components/ModuleTest.svelte index 0ff430f148..df22ebfd72 100644 --- a/frontend/src/lib/components/ModuleTest.svelte +++ b/frontend/src/lib/components/ModuleTest.svelte @@ -14,6 +14,7 @@ testIsLoading?: boolean noEditor?: boolean scriptProgress?: any + onJobDone?: () => void } let { @@ -21,10 +22,11 @@ testJob = $bindable(undefined), testIsLoading = $bindable(false), noEditor = false, - scriptProgress = $bindable(undefined) + scriptProgress = $bindable(undefined), + onJobDone }: Props = $props() - const { flowStore, flowStateStore, pathStore, testSteps, previewArgs, modulesTestStates } = + const { flowStore, flowStateStore, pathStore, stepsInputArgs, previewArgs, modulesTestStates } = getContext('FlowEditorContext') let jobLoader: JobLoader | undefined = $state(undefined) @@ -32,12 +34,12 @@ let stepHistoryLoader = getStepHistoryLoaderContext() export function runTestWithStepArgs() { - runTest(testSteps.getStepArgs(mod.id)) + runTest(stepsInputArgs.getStepArgs(mod.id)) } export function loadArgsAndRunTest() { - testSteps?.updateStepArgs(mod.id, flowStateStore.val, flowStore?.val, previewArgs?.val) - runTest(testSteps.getStepArgs(mod.id)) + stepsInputArgs?.updateStepArgs(mod.id, flowStateStore.val, flowStore?.val, previewArgs?.val) + runTest(stepsInputArgs.getStepArgs(mod.id)) } export async function runTest(args: any) { @@ -138,6 +140,7 @@ if (modulesTestStates.states[mod.id]) { modulesTestStates.states[mod.id].testJob = testJob } + onJobDone?.() } export function cancelJob() { diff --git a/frontend/src/lib/components/RunForm.svelte b/frontend/src/lib/components/RunForm.svelte index 530d939d49..da4c61be04 100644 --- a/frontend/src/lib/components/RunForm.svelte +++ b/frontend/src/lib/components/RunForm.svelte @@ -77,7 +77,7 @@ } let { - runnable = $bindable(), + runnable, runAction, buttonText = 'Run', schedulable = true, @@ -309,7 +309,7 @@ bind:scheduledForStr bind:invisible_to_owner bind:overrideTag - bind:runnable + {runnable} /> {/snippet} diff --git a/frontend/src/lib/components/RunFormAdvancedPopup.svelte b/frontend/src/lib/components/RunFormAdvancedPopup.svelte index 5766ad619a..97138d090c 100644 --- a/frontend/src/lib/components/RunFormAdvancedPopup.svelte +++ b/frontend/src/lib/components/RunFormAdvancedPopup.svelte @@ -70,7 +70,19 @@ {#if !$userStore?.operator} {#if $workerTags && $workerTags?.length > 0}
- overrideTag ?? '', + (v) => { + if (v == '') { + overrideTag = undefined + } else { + overrideTag = v + } + } + } + > {#if overrideTag} {:else} diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte index e563af8551..15f69838d6 100644 --- a/frontend/src/lib/components/ScriptBuilder.svelte +++ b/frontend/src/lib/components/ScriptBuilder.svelte @@ -1128,7 +1128,7 @@ > {label} - {#if lang === 'nu' || lang === 'ruby'} + {#if lang === 'ruby'} BETA {/if} diff --git a/frontend/src/lib/components/ScriptEditor.svelte b/frontend/src/lib/components/ScriptEditor.svelte index cc7c87dd9e..677d69fa4c 100644 --- a/frontend/src/lib/components/ScriptEditor.svelte +++ b/frontend/src/lib/components/ScriptEditor.svelte @@ -626,16 +626,28 @@ {args} /> { - showHistoryDrawer = true - }} + buttons={diffMode + ? [ + { + text: 'See changes history', + onClick: () => { + showHistoryDrawer = true + } + }, + { + text: 'Quit diff mode', + onClick: () => { + hideDiffMode() + }, + color: 'red' + } + ] + : []} /> {/key}
diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte index f72c27e543..d95fb7e04d 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte @@ -423,7 +423,7 @@ modelContextWindow - diff --git a/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte b/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte index 8170731ee9..9b7f7f96ba 100644 --- a/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte +++ b/frontend/src/lib/components/copilot/chat/flow/FlowAIChat.svelte @@ -6,7 +6,7 @@ import { dfs } from '$lib/components/flows/previousResults' import { dfs as dfsApply } from '$lib/components/flows/dfs' import { getSubModules } from '$lib/components/flows/flowExplorer' - import type { FlowModule, OpenFlow } from '$lib/gen' + import type { FlowModule, OpenFlow, RawScript } from '$lib/gen' import { getIndexInNestedModules, getNestedModules } from './utils' import type { AIModuleAction, FlowAIChatHelpers } from './core' import { @@ -19,7 +19,7 @@ import DiffDrawer from '$lib/components/DiffDrawer.svelte' let { - flowModuleSchemaMap, + flowModuleSchemaMap }: { flowModuleSchemaMap: FlowModuleSchemaMap | undefined } = $props() @@ -174,6 +174,17 @@ if (!newModule) { throw new Error('Module not found') } + + // Apply the old code to the editor and hide diff editor if the reverted module is a rawscript + if ( + newModule.value.type === 'rawscript' && + $currentEditor?.type === 'script' && + $currentEditor.stepId === id + ) { + $currentEditor.editor.setCode((oldModule.value as RawScript).content) + $currentEditor.hideDiffMode() + } + newModule.value = oldModule.value } @@ -525,6 +536,47 @@ return cleanup }) + // Automatically show diff mode when selecting a rawscript module with pending changes + $effect(() => { + if ( + $currentEditor?.type === 'script' && + $selectedId && + affectedModules[$selectedId] && + lastSnapshot + ) { + const moduleLastSnapshot = getModule($selectedId, lastSnapshot) + const currentModule = getModule($selectedId) + + if ( + moduleLastSnapshot && + currentModule && + currentModule.value.type === 'rawscript' && + moduleLastSnapshot.value.type === 'rawscript' + ) { + // Show diff mode automatically + $currentEditor.setDiffOriginal?.(moduleLastSnapshot.value.content ?? '') + $currentEditor.showDiffMode() + $currentEditor.setDiffButtons?.([ + { + text: 'Accept Changes', + color: 'green', + onClick: () => { + flowHelpers.acceptModuleAction($selectedId) + $currentEditor?.hideDiffMode() + } + }, + { + text: 'Reject Changes', + onClick: () => { + flowHelpers.revertModuleAction($selectedId) + $currentEditor?.hideDiffMode() + } + } + ]) + } + } + }) + let diffDrawer: DiffDrawer | undefined = $state(undefined) diff --git a/frontend/src/lib/components/copilot/chat/script/core.ts b/frontend/src/lib/components/copilot/chat/script/core.ts index ee6b364ecf..1154623f3a 100644 --- a/frontend/src/lib/components/copilot/chat/script/core.ts +++ b/frontend/src/lib/components/copilot/chat/script/core.ts @@ -8,7 +8,7 @@ import type { ChatCompletionTool, ChatCompletionUserMessageParam } from 'openai/resources/index.mjs' -import { copilotSessionModel, type DBSchema, dbSchemas } from '$lib/stores' +import { type DBSchema, dbSchemas, getCurrentModel } from '$lib/stores' import { getDbSchemas } from '$lib/components/apps/components/display/dbtable/utils' import type { ContextElement } from '../context' import { PYTHON_PREPROCESSOR_MODULE_CODE, TS_PREPROCESSOR_MODULE_CODE } from '$lib/script_helpers' @@ -655,7 +655,8 @@ export async function searchExternalIntegrationResources(args: { query: string } (r: PackageSearchQuery) => r.searchScore >= SCORE_THRESHOLD ) - const modelContextWindow = getModelContextWindow(get(copilotSessionModel)?.model ?? '') + const model = getCurrentModel() + const modelContextWindow = getModelContextWindow(model.model) const results: PackageSearchResult[] = await Promise.all( filtered.map(async (r: PackageSearchQuery) => { let documentation = '' diff --git a/frontend/src/lib/components/copilot/chat/shared.ts b/frontend/src/lib/components/copilot/chat/shared.ts index 7c7fb071e8..d3589df323 100644 --- a/frontend/src/lib/components/copilot/chat/shared.ts +++ b/frontend/src/lib/components/copilot/chat/shared.ts @@ -5,7 +5,7 @@ import type { } from 'openai/resources/chat/completions.mjs' import { get } from 'svelte/store' import type { CodePieceElement, ContextElement, FlowModuleCodePieceElement } from './context' -import { copilotSessionModel, workspaceStore } from '$lib/stores' +import { workspaceStore, getCurrentModel } from '$lib/stores' import type { ExtendedOpenFlow } from '$lib/components/flows/types' import type { FunctionParameters } from 'openai/resources/shared.mjs' import { zodToJsonSchema } from 'zod-to-json-schema' @@ -455,8 +455,8 @@ export async function buildSchemaForTool( toolDef.function.parameters = { ...schema, additionalProperties: false } // OPEN AI models don't support strict mode well with schema with complex properties, so we disable it - const model = get(copilotSessionModel)?.provider - if (model === 'openai' || model === 'azure_openai') { + const model = getCurrentModel() + if (model.provider === 'openai' || model.provider === 'azure_openai') { toolDef.function.strict = false } return true diff --git a/frontend/src/lib/components/copilot/lib.ts b/frontend/src/lib/components/copilot/lib.ts index 99175891a5..45e2f6982d 100644 --- a/frontend/src/lib/components/copilot/lib.ts +++ b/frontend/src/lib/components/copilot/lib.ts @@ -1,7 +1,6 @@ import type { AIProvider, AIProviderModel } from '$lib/gen' import { - copilotInfo, - copilotSessionModel, + getCurrentModel, workspaceStore, type DBSchema, type GraphqlSchema, @@ -23,7 +22,16 @@ import { z } from 'zod' export const SUPPORTED_LANGUAGES = new Set(Object.keys(GEN_CONFIG.prompts)) -const OPENAI_MODELS = ['gpt-5', 'gpt-5-mini', 'gpt-5-nano', 'gpt-4o', 'gpt-4o-mini', 'o4-mini', 'o3', 'o3-mini'] +const OPENAI_MODELS = [ + 'gpt-5', + 'gpt-5-mini', + 'gpt-5-nano', + 'gpt-4o', + 'gpt-4o-mini', + 'o4-mini', + 'o3', + 'o3-mini' +] // need at least one model for each provider except customai export const AI_DEFAULT_MODELS: Record = { @@ -468,18 +476,9 @@ function getProviderAndCompletionConfig({ ? ChatCompletionCreateParamsStreaming : ChatCompletionCreateParamsNonStreaming } { - let info = get(copilotInfo) - const modelProvider = - forceModelProvider ?? get(copilotSessionModel) ?? info.defaultModel ?? info.aiModels[0] - - if (!modelProvider) { - throw new Error('No model selected') - } - + const modelProvider = forceModelProvider ?? getCurrentModel() const providerConfig = PROVIDER_COMPLETION_CONFIG_MAP[modelProvider.provider] - const processedMessages = prepareMessages(modelProvider.provider, messages) - return { provider: modelProvider.provider, config: { diff --git a/frontend/src/lib/components/flows/FlowEditor.svelte b/frontend/src/lib/components/flows/FlowEditor.svelte index 5ab9593ccf..0e1f929df7 100644 --- a/frontend/src/lib/components/flows/FlowEditor.svelte +++ b/frontend/src/lib/components/flows/FlowEditor.svelte @@ -58,6 +58,7 @@ suspendStatus?: StateStore> onDelete?: (id: string) => void flowHasChanged?: boolean + previewOpen: boolean } let { @@ -91,7 +92,8 @@ job, suspendStatus, onDelete, - flowHasChanged + flowHasChanged, + previewOpen }: Props = $props() let flowModuleSchemaMap: FlowModuleSchemaMap | undefined = $state() @@ -206,6 +208,7 @@ {isOwner} {suspendStatus} onOpenDetails={onOpenPreview} + {previewOpen} /> {/if}
diff --git a/frontend/src/lib/components/flows/content/FlowEditorPanel.svelte b/frontend/src/lib/components/flows/content/FlowEditorPanel.svelte index 668fcf2d54..0007220030 100644 --- a/frontend/src/lib/components/flows/content/FlowEditorPanel.svelte +++ b/frontend/src/lib/components/flows/content/FlowEditorPanel.svelte @@ -34,6 +34,7 @@ isOwner?: boolean suspendStatus?: StateStore> onOpenDetails?: () => void + previewOpen?: boolean } let { @@ -49,7 +50,8 @@ job, isOwner, suspendStatus, - onOpenDetails + onOpenDetails, + previewOpen = false }: Props = $props() const { @@ -95,6 +97,7 @@ }} on:applyArgs {onTestFlow} + {previewOpen} /> {:else if $selectedId === 'Result'} diff --git a/frontend/src/lib/components/flows/content/FlowInput.svelte b/frontend/src/lib/components/flows/content/FlowInput.svelte index 716e12f90a..926f3febd1 100644 --- a/frontend/src/lib/components/flows/content/FlowInput.svelte +++ b/frontend/src/lib/components/flows/content/FlowInput.svelte @@ -48,9 +48,10 @@ noEditor: boolean disabled: boolean onTestFlow?: () => void + previewOpen: boolean } - let { noEditor, disabled, onTestFlow }: Props = $props() + let { noEditor, disabled, onTestFlow, previewOpen }: Props = $props() const { flowStore, previewArgs, @@ -63,7 +64,6 @@ let addPropertyV2: AddPropertyV2 | undefined = $state(undefined) let previewSchema: Record | undefined = $state(undefined) let payloadData: Record | undefined = undefined - let previewArguments: Record | undefined = $state(previewArgs.val) let dropdownItems: Array<{ label: string onClick: () => void @@ -195,7 +195,9 @@ function handleKeydown(event: KeyboardEvent) { if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') { - runPreview() + if (!previewOpen) { + runPreview() + } } else if (event.key === 'Enter' && previewSchema && !preventEnter) { applySchemaAndArgs() connectFirstNode() @@ -205,9 +207,6 @@ } function runPreview() { - if (previewArguments) { - previewArgs.val = structuredClone($state.snapshot(previewArguments)) - } onTestFlow?.() } @@ -248,8 +247,8 @@ async function applySchemaAndArgs() { flowStore.val.schema = applyDiff(flowStore.val.schema, diff) - if (previewArguments) { - savedPreviewArgs = structuredClone($state.snapshot(previewArguments)) + if (previewArgs.val) { + savedPreviewArgs = structuredClone($state.snapshot(previewArgs.val)) } updatePreviewSchemaAndArgs(undefined) if ($flowInputEditorState) { @@ -259,11 +258,13 @@ function updatePreviewArguments(payloadData: Record | undefined) { if (!payloadData) { - previewArguments = savedPreviewArgs + if (savedPreviewArgs) { + previewArgs.val = savedPreviewArgs + } return } - savedPreviewArgs = structuredClone($state.snapshot(previewArguments)) - previewArguments = structuredClone($state.snapshot(payloadData)) + savedPreviewArgs = structuredClone($state.snapshot(previewArgs.val)) + previewArgs.val = structuredClone($state.snapshot(payloadData)) } let tabButtonWidth = 0 @@ -372,7 +373,7 @@ displayWebhookWarning editTab={$flowInputEditorState?.selectedTab} {previewSchema} - bind:args={previewArguments} + bind:args={previewArgs.val} bind:editPanelSize={ () => { return editPanelSize @@ -399,9 +400,8 @@ }} shouldDispatchChanges={true} on:change={() => { - previewArguments = previewArguments if (!previewSchema) { - savedPreviewArgs = structuredClone($state.snapshot(previewArguments)) + savedPreviewArgs = structuredClone($state.snapshot(previewArgs.val)) } refreshStateStore(flowStore) }} @@ -560,7 +560,7 @@ on:isEditing={(e) => { preventEnter = e.detail }} - previewArgs={previewArguments} + previewArgs={previewArgs.val} {isValid} limitPayloadSize bind:this={savedInputsPicker} @@ -583,7 +583,7 @@ on:select={(e) => { updatePreviewSchemaAndArgs(e.detail ?? undefined) }} - selected={!!previewArguments} + selected={!!previewArgs.val} bind:this={jsonInputs} /> diff --git a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte index f30dd02ca2..072139549f 100644 --- a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte +++ b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte @@ -36,7 +36,7 @@ import FlowModuleMockTransitionMessage from './FlowModuleMockTransitionMessage.svelte' import Tooltip from '$lib/components/Tooltip.svelte' import { SecondsInput } from '$lib/components/common' - import DiffEditor from '$lib/components/DiffEditor.svelte' + import DiffEditor, { type ButtonProp } from '$lib/components/DiffEditor.svelte' import FlowModuleTimeout from './FlowModuleTimeout.svelte' import HighlightCode from '$lib/components/HighlightCode.svelte' import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte' @@ -47,7 +47,7 @@ import { isCloudHosted } from '$lib/cloud' import { loadSchemaFromModule } from '../flowInfers' import FlowModuleSkip from './FlowModuleSkip.svelte' - import { type Job, JobService } from '$lib/gen' + import { type Job } from '$lib/gen' import { workspaceStore } from '$lib/stores' import { checkIfParentLoop } from '../utils' import ModulePreviewResultViewer from '$lib/components/ModulePreviewResultViewer.svelte' @@ -102,6 +102,15 @@ let workspaceScriptTag: string | undefined = $state(undefined) let workspaceScriptLang: ScriptLang | undefined = $state(undefined) let diffMode = $state(false) + let diffButtons = $state([ + { + text: 'Quit diff mode', + color: 'red', + onClick: () => { + hideDiffMode() + } + } + ]) let editor: Editor | undefined = $state() let diffEditor: DiffEditor | undefined = $state() @@ -120,7 +129,6 @@ let s3Kind = $state('s3_client') let validCode = $state(true) let width = $state(1200) - let lastJob: Job | undefined = $state(undefined) let testJob: Job | undefined = $state(undefined) let testIsLoading = $state(false) let scriptProgress = $state(undefined) @@ -197,43 +205,10 @@ let editorSettingsPanelSize = $state(100 - untrack(() => editorPanelSize)) let stepHistoryLoader = getStepHistoryLoaderContext() - let lastJobId: string | undefined = undefined - function onSelectedIdChange() { if (!flowStateStore?.val?.[$selectedId]?.schema && flowModule) { reload(flowModule) } - lastJobId = undefined - } - - async function getLastJob() { - if ( - !flowStateStore || - !flowModule.id || - flowStateStore.val[flowModule.id]?.previewResult === 'never tested this far' || - !flowStateStore.val[flowModule.id]?.previewJobId - ) { - return - } - - if ( - lastJobId == flowStateStore.val[flowModule.id]?.previewJobId || - lastJob?.id == flowStateStore.val[flowModule.id]?.previewJobId || - flowStateStore.val[flowModule.id]?.previewSuccess == undefined - ) { - return - } - lastJobId = flowStateStore.val[flowModule.id]?.previewJobId - - const job = await JobService.getJob({ - workspace: $workspaceStore ?? '', - id: flowStateStore.val[flowModule.id]?.previewJobId ?? '', - noCode: true - }) - if (job && job.type === 'CompletedJob') { - lastJobId = flowStateStore.val[flowModule.id]?.previewJobId - lastJob = job - } } let leftPanelSize = $state(0) @@ -270,13 +245,6 @@ $effect.pre(() => { $selectedId && untrack(() => onSelectedIdChange()) }) - $effect(() => { - if (testJob && testJob.type === 'CompletedJob') { - lastJob = $state.snapshot(testJob) - } else if ($workspaceStore && $pathStore && flowModule?.id && flowStateStore) { - untrack(() => getLastJob()) - } - }) let parentLoop = $derived( flowStore.val && flowModule ? checkIfParentLoop(flowStore.val, flowModule.id) : undefined ) @@ -297,7 +265,13 @@ showDiffMode, hideDiffMode, diffMode, - lastDeployedCode + lastDeployedCode, + setDiffOriginal: (code: string) => { + diffEditor?.setOriginal(code ?? '') + }, + setDiffButtons: (buttons: ButtonProp[]) => { + diffButtons = buttons + } }) }) @@ -322,6 +296,12 @@ let rawScriptLang = $derived( flowModule.value.type == 'rawscript' ? flowModule.value.language : undefined ) + + let modulePreviewResultViewer: ModulePreviewResultViewer | undefined = $state(undefined) + + function onJobDone() { + modulePreviewResultViewer?.getOutputPickerInner()?.setJobPreview() + } @@ -486,10 +466,8 @@ automaticLayout fixedOverflowWidgets defaultLang={scriptLangToEditorLang(flowModule.value.language)} - class="h-full" - showButtons={diffMode} - showHistoryButton={false} - on:hideDiffMode={hideDiffMode} + className="h-full" + buttons={diffMode ? diffButtons : []} /> {/key} {/if} @@ -596,6 +574,7 @@ bind:testIsLoading bind:scriptProgress focusArg={highlightArg} + {onJobDone} /> {:else if selected === 'advanced'} @@ -900,15 +879,15 @@ flowModule = flowModule refreshStateStore(flowStore) }} - {lastJob} - {scriptProgress} {testJob} + {scriptProgress} mod={flowModule} {testIsLoading} disableMock={preprocessorModule || failureModule} disableHistory={failureModule} loadingJob={stepHistoryLoader?.stepStates[flowModule.id]?.loadingJobs} tagLabel={customUi?.tagLabel} + bind:this={modulePreviewResultViewer} /> {/if} diff --git a/frontend/src/lib/components/flows/content/FlowModuleScript.svelte b/frontend/src/lib/components/flows/content/FlowModuleScript.svelte index cdac0709f8..121cba59f1 100644 --- a/frontend/src/lib/components/flows/content/FlowModuleScript.svelte +++ b/frontend/src/lib/components/flows/content/FlowModuleScript.svelte @@ -140,7 +140,7 @@ {:then Module} { - if (testJob && testJob.type === 'CompletedJob') { - lastJob = $state.snapshot(testJob) - } else if (id) { - updateLastJob(flowStateStore) - } - }) - let isConnectingCandidate = $derived( !!id && !!$flowPropPickerConfig && !!pickableIds && Object.keys(pickableIds).includes(id) ) @@ -207,6 +181,9 @@ const action = $derived(getAiModuleAction(id)) let testRunDropdownOpen = $state(false) + + let outputPickerInner: OutputPickerInner | undefined = $state(undefined) + let historyOpen = $derived.by(() => outputPickerInner?.getHistoryOpen?.() ?? false) {#if deletable && id && editId} @@ -271,7 +248,15 @@ {@const flowStore = flowEditorContext?.flowStore.val} {@const mod = flowStore?.value ? dfsPreviousResults(id, flowStore, false)[0] : undefined} {#if mod && flowStateStore?.val?.[id]} - + { + outputPickerInner?.setJobPreview?.() + }} + /> {/if} {/if} @@ -455,7 +440,6 @@ prefix={'results'} connectingData={isConnecting ? connectingData : undefined} {mock} - {lastJob} {testJob} moduleId={id} onSelect={selectConnection} @@ -463,12 +447,12 @@ {path} {loopStatus} rightMargin - bind:derivedHistoryOpen={historyOpen} historyOffset={{ mainAxis: 12, crossAxis: -9 }} clazz="p-1" isLoading={testIsLoading || (id ? stepHistoryLoader?.stepStates[id]?.loadingJobs : false)} initial={id ? stepHistoryLoader?.stepStates[id]?.initial : undefined} + bind:this={outputPickerInner} /> {/snippet} diff --git a/frontend/src/lib/components/flows/map/VirtualItem.svelte b/frontend/src/lib/components/flows/map/VirtualItem.svelte index 25dfcad15a..aa63e64eef 100644 --- a/frontend/src/lib/components/flows/map/VirtualItem.svelte +++ b/frontend/src/lib/components/flows/map/VirtualItem.svelte @@ -146,7 +146,7 @@ {selected} {hover} id={id ?? ''} - isConnectingCandidate={true} + isConnectingCandidate={nodeKind !== 'result'} variant="virtual" type={outputType} {darkMode} diff --git a/frontend/src/lib/components/flows/propPicker/InputPickerInner.svelte b/frontend/src/lib/components/flows/propPicker/InputPickerInner.svelte index 193574b044..bde5e1c9d8 100644 --- a/frontend/src/lib/components/flows/propPicker/InputPickerInner.svelte +++ b/frontend/src/lib/components/flows/propPicker/InputPickerInner.svelte @@ -13,14 +13,14 @@ let { inputTransform, id, onEditInput }: Props = $props() - const { flowStore, flowStateStore, testSteps, previewArgs } = + const { flowStore, flowStateStore, stepsInputArgs, previewArgs } = getContext('FlowEditorContext') || {} onMount(() => { - testSteps?.updateStepArgs(id, flowStateStore?.val, flowStore?.val, previewArgs?.val) + stepsInputArgs?.updateStepArgs(id, flowStateStore?.val, flowStore?.val, previewArgs?.val) }) - const input = $derived(testSteps?.getStepArgs(id)) + const input = $derived(stepsInputArgs?.getStepArgs(id))
@@ -42,10 +42,10 @@ {:else if inputTransform[key].type === 'static'} {/if} - {#if testSteps?.isArgManuallySet(id, key)} + {#if stepsInputArgs?.isArgManuallySet(id, key)}
{:else if connectingData !== undefined || simpleViewer} + {:else if jsonView} + {#await import('$lib/components/JsonEditor.svelte')} {:then Module} @@ -653,12 +634,12 @@ class="h-full" /> {/await} - {:else if (mock?.enabled || preview == 'mock') && preview != 'job'} + {:else if (mock?.enabled || preview == 'mock') && preview != 'job' && !executingTestJob} + {#if fullResult}
{/if} {:else if selectedJob != undefined && (selectedJob.result_stream || selectedJob.type == 'CompletedJob')} + {#if fullResult}
{#key selectedJob} {/if} - {:else if !job} + {:else if !lastJob}

{customEmptyJobMessage ?? 'Test this step to see results'}{#if !disableMock} @@ -753,6 +734,47 @@ {/snippet} +{#snippet historyPicker()} + + {#snippet trigger()} +