windmill-cli 1.846.1 → 1.848.0

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.
Files changed (2) hide show
  1. package/esm/main.js +92 -21
  2. package/package.json +1 -1
package/esm/main.js CHANGED
@@ -16766,7 +16766,7 @@ var init_OpenAPI = __esm(() => {
16766
16766
  PASSWORD: undefined,
16767
16767
  TOKEN: getEnv3("WM_TOKEN"),
16768
16768
  USERNAME: undefined,
16769
- VERSION: "1.846.1",
16769
+ VERSION: "1.848.0",
16770
16770
  WITH_CREDENTIALS: true,
16771
16771
  interceptors: {
16772
16772
  request: new Interceptors,
@@ -20074,7 +20074,7 @@ var init_auth = __esm(async () => {
20074
20074
  });
20075
20075
 
20076
20076
  // src/core/constants.ts
20077
- var WM_FORK_PREFIX = "wm-fork", VERSION = "1.846.1";
20077
+ var WM_FORK_PREFIX = "wm-fork", VERSION = "1.848.0";
20078
20078
 
20079
20079
  // src/utils/resource_folders.ts
20080
20080
  import { existsSync } from "node:fs";
@@ -22111,7 +22111,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22111
22111
  value: variable.value ?? "",
22112
22112
  is_secret: variable.is_secret,
22113
22113
  description: variable.description ?? "",
22114
- labels: variable.labels
22114
+ labels: variable.labels,
22115
+ value_valid_until: variable.value_valid_until ?? null
22115
22116
  },
22116
22117
  alreadyEncrypted: false
22117
22118
  });
@@ -22123,7 +22124,8 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
22123
22124
  value: variable.value ?? "",
22124
22125
  is_secret: variable.is_secret,
22125
22126
  description: variable.description ?? "",
22126
- labels: variable.labels
22127
+ labels: variable.labels,
22128
+ value_valid_until: variable.value_valid_until ?? null
22127
22129
  }
22128
22130
  });
22129
22131
  }
@@ -36749,7 +36751,8 @@ var init_settings2 = __esm(async () => {
36749
36751
  "guest_jwt_public_key",
36750
36752
  "guest_jwt_jwks_url",
36751
36753
  "error_handler_fallback_to_instance_alerts",
36752
- "add_admins_and_developers_to_forks"
36754
+ "add_admins_and_developers_to_forks",
36755
+ "variable_expiration_handler"
36753
36756
  ];
36754
36757
  instanceSettingsPath = INSTANCE_SETTINGS_PATH;
36755
36758
  instanceConfigsPath = INSTANCE_CONFIGS_PATH;
@@ -58794,7 +58797,7 @@ var init_openflow = __esm(() => {
58794
58797
  openflow_default = {
58795
58798
  openapi: "3.0.3",
58796
58799
  info: {
58797
- version: "1.846.1",
58800
+ version: "1.848.0",
58798
58801
  title: "OpenFlow Spec",
58799
58802
  contact: {
58800
58803
  name: "Ruben Fiszel",
@@ -72679,7 +72682,7 @@ async function loadRunnablesFromBackend(backendPath, defaultTs = "bun") {
72679
72682
  ...lock ? { lock } : {}
72680
72683
  };
72681
72684
  }
72682
- } else if (runnable?.type === "script" || runnable?.type === "hubscript" || runnable?.type === "flow") {
72685
+ } else if (runnable?.type === "script" || runnable?.type === "hubscript" || runnable?.type === "flow" || runnable?.type === "agent") {
72683
72686
  const { type, schema: _schema, ...rest } = runnable;
72684
72687
  runnable.type = "path";
72685
72688
  runnable.runType = type;
@@ -74701,6 +74704,38 @@ function buildWmillTs(runnables, inlineSchemaOverrides = {}, pathSchemaOverrides
74701
74704
  }
74702
74705
  return Z(runnables);
74703
74706
  }
74707
+ function agentRunnableSchema(memory) {
74708
+ const managed = memory?.kind === "compaction" || (memory?.kind === "window" || memory?.kind === "auto") && Boolean(memory.context_length);
74709
+ const legacy = memory?.kind === "manual";
74710
+ const history = {};
74711
+ if (managed) {
74712
+ history.memory_id = {
74713
+ type: "string",
74714
+ description: "The conversation the message belongs to: reuse it to continue one, or omit it for a single run"
74715
+ };
74716
+ } else if (!legacy) {
74717
+ history.previous_messages = {
74718
+ type: "array",
74719
+ description: "The history to answer from, as chat messages: this agent keeps no memory",
74720
+ items: { type: "object" }
74721
+ };
74722
+ }
74723
+ return {
74724
+ $schema: "https://json-schema.org/draft/2020-12/schema",
74725
+ type: "object",
74726
+ properties: {
74727
+ user_message: { type: "string", description: "The message to answer" },
74728
+ ...history,
74729
+ user_attachments: {
74730
+ type: "array",
74731
+ description: "Files the message carries, as object storage references",
74732
+ items: { type: "object", resourceType: "s3object" }
74733
+ }
74734
+ },
74735
+ required: ["user_message"],
74736
+ order: ["user_message", ...Object.keys(history), "user_attachments"]
74737
+ };
74738
+ }
74704
74739
  async function fetchPathRunnableSchemas(workspaceId, runnables) {
74705
74740
  const schemas = {};
74706
74741
  for (const [runnableId, runnable] of Object.entries(runnables)) {
@@ -74718,6 +74753,12 @@ async function fetchPathRunnableSchemas(workspaceId, runnables) {
74718
74753
  });
74719
74754
  if (script.schema)
74720
74755
  schemas[runnableId] = script.schema;
74756
+ } else if (runnable.runType === "agent") {
74757
+ const agent = await getResource({
74758
+ workspace: workspaceId,
74759
+ path: runnable.path
74760
+ });
74761
+ schemas[runnableId] = agentRunnableSchema(agent.value?.memory);
74721
74762
  } else if (runnable.runType === "flow") {
74722
74763
  const flow = await getFlowByPath({
74723
74764
  workspace: workspaceId,
@@ -74735,7 +74776,7 @@ async function fetchPathRunnableSchemas(workspaceId, runnables) {
74735
74776
  }
74736
74777
  function convertRunnablesToApiFormat(runnables) {
74737
74778
  for (const [runnableId, runnable] of Object.entries(runnables)) {
74738
- if (runnable?.type === "script" || runnable?.type === "hubscript" || runnable?.type === "flow") {
74779
+ if (runnable?.type === "script" || runnable?.type === "hubscript" || runnable?.type === "flow" || runnable?.type === "agent") {
74739
74780
  const originalType = runnable.type;
74740
74781
  runnable.runType = originalType;
74741
74782
  runnable.type = "path";
@@ -74896,8 +74937,8 @@ async function getJobStatus(workspace, jobId) {
74896
74937
  id: jobId
74897
74938
  });
74898
74939
  }
74899
- async function streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token) {
74900
- const sseUrl = `${baseUrl}api/w/${workspace}/jobs_u/getupdate_sse/${jobId}?fast=true`;
74940
+ async function streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token, streamOffset) {
74941
+ const sseUrl = `${baseUrl}api/w/${workspace}/jobs_u/getupdate_sse/${jobId}?fast=true` + (streamOffset !== undefined ? `&stream_offset=${streamOffset}` : "");
74901
74942
  const extraHeaders = getHeaders2();
74902
74943
  const response = await fetch(sseUrl, {
74903
74944
  headers: {
@@ -74916,6 +74957,7 @@ async function streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token) {
74916
74957
  }
74917
74958
  const decoder = new TextDecoder;
74918
74959
  let buffer = "";
74960
+ let lastOffset = streamOffset;
74919
74961
  try {
74920
74962
  while (true) {
74921
74963
  const { done, value } = await reader.read();
@@ -74934,7 +74976,7 @@ async function streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token) {
74934
74976
  if (type === "ping" || type === "timeout") {
74935
74977
  if (type === "timeout") {
74936
74978
  reader.cancel();
74937
- return;
74979
+ return streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token, lastOffset);
74938
74980
  }
74939
74981
  continue;
74940
74982
  }
@@ -74958,6 +75000,9 @@ async function streamJobWithSSE(workspace, jobId, reqId, ws, baseUrl, token) {
74958
75000
  reader.cancel();
74959
75001
  return;
74960
75002
  }
75003
+ if (update.stream_offset !== undefined) {
75004
+ lastOffset = update.stream_offset;
75005
+ }
74961
75006
  if (update.new_result_stream !== undefined) {
74962
75007
  ws.send(JSON.stringify({
74963
75008
  type: "streamJobUpdate",
@@ -76877,7 +76922,8 @@ async function pushVariable(workspace, remotePath, variable, localVariable, plai
76877
76922
  }
76878
76923
  const { extra_perms: localPerms, ...localVariableBody } = localVariable;
76879
76924
  if (variable) {
76880
- if (isSuperset(localVariableBody, variable)) {
76925
+ const clearsValueValidUntil = localVariableBody.value_valid_until === undefined && variable.value_valid_until !== undefined && variable.value_valid_until !== null;
76926
+ if (!clearsValueValidUntil && isSuperset(localVariableBody, variable)) {
76881
76927
  debug(`Variable ${remotePath} is up-to-date`);
76882
76928
  } else {
76883
76929
  debug(`Variable ${remotePath} is not up-to-date, updating`);
@@ -76896,7 +76942,8 @@ async function pushVariable(workspace, remotePath, variable, localVariable, plai
76896
76942
  requestBody: {
76897
76943
  ...localVariableBody,
76898
76944
  is_secret: nextIsSecret,
76899
- ...wsSpecific !== undefined ? { ws_specific: wsSpecific } : {}
76945
+ ...wsSpecific !== undefined ? { ws_specific: wsSpecific } : {},
76946
+ ...clearsValueValidUntil ? { value_valid_until: null } : {}
76900
76947
  }
76901
76948
  });
76902
76949
  }
@@ -77462,7 +77509,8 @@ async function pushNativeTrigger(workspace, filePath, _remoteTrigger, localTrigg
77462
77509
  script_path: localTrigger.script_path,
77463
77510
  is_flow: localTrigger.is_flow,
77464
77511
  service_config: localTrigger.service_config,
77465
- summary: localTrigger.summary
77512
+ summary: localTrigger.summary,
77513
+ connection_path: localTrigger.connection_path
77466
77514
  };
77467
77515
  if (remoteTrigger) {
77468
77516
  const localCompare = {
@@ -87095,7 +87143,7 @@ An app can be demoed by recording a session: every interaction becomes a step ca
87095
87143
 
87096
87144
  Apply it to customer data, internal notes and anything else a viewer of the demo should not see. It costs nothing when the app is never recorded.
87097
87145
 
87098
- ### Chat UIs over a flow in chat mode
87146
+ ### Chat UIs over a flow in chat mode or a saved agent
87099
87147
 
87100
87148
  A flow deployed with chat mode on is a chat backend (streaming answer, tool calls, memory, conversation history). Do not drive it through a runnable: add \`@windmill-labs/chat-sdk\` to \`package.json\` and use it directly, it detects the app's Windmill and credential.
87101
87149
 
@@ -87108,9 +87156,31 @@ const chat = useWindmillChat({ flowPath: 'f/support/assistant' })
87108
87156
 
87109
87157
  \`@windmill-labs/chat-sdk/ai-sdk\` gives a \`ChatTransport\` for the Vercel AI SDK's \`useChat\`, \`@windmill-labs/chat-sdk/assistant-ui\` a runtime for assistant-ui. The flow must be deployed, not a draft. A sandboxed app needs \`jobs:run\` in its frontend SDK scopes, plus \`flow_conversations:write\` for the conversation sidebar; without them the chat keeps history in the browser.
87110
87158
 
87159
+ #### A saved agent: an \`agent\` runnable
87160
+
87161
+ Chat with a saved AI agent (an \`ai_agent\` resource) through an \`agent\` runnable, a path runnable whose \`path\` is the agent's. Each call runs one turn of the agent's chat as the app, so a sandboxed app declares no frontend SDK scope, viewers get no consent prompt and need no access to the agent. Prefer it in every app, sandboxed or not:
87162
+
87163
+ In \`raw_app.yaml\`:
87164
+
87165
+ \`\`\`yaml
87166
+ runnables:
87167
+ chat:
87168
+ type: agent
87169
+ path: f/support/agent
87170
+ \`\`\`
87171
+
87172
+ \`\`\`tsx
87173
+ import { useWindmillChat } from '@windmill-labs/chat-sdk/react'
87174
+ import * as wmill from './wmill'
87175
+
87176
+ const chat = useWindmillChat({ wmill, runnable: 'chat' })
87177
+ \`\`\`
87178
+
87179
+ \`runnable\` is the runnable's key; each runnable keeps its own conversations. The runnable takes \`user_message\` and \`memory_id\`, the conversation id, which the chat fills in: the agent remembers earlier turns of a conversation, and a signed-in viewer's conversations are theirs alone. Called directly as \`backend.<key>({ user_message })\` without \`memory_id\`, it is a single run with no conversation, for a one-off question. The chat needs an agent with managed memory. An agent whose memory is off keeps none: its runnable takes \`previous_messages\` (chat messages) instead of \`memory_id\`, and the app keeps the history itself. The chat keeps its transcript in the app's own storage. \`chat.stop()\` stops following without cancelling the turn, and a message sent while it still runs is refused with \`TurnRunningError\`. Attachments are not supported this way.
87180
+
87111
87181
  ## Backend runnables
87112
87182
 
87113
- Each runnable has a unique key (used to call it from the frontend) and one of four types:
87183
+ Each runnable has a unique key (used to call it from the frontend) and one of five types:
87114
87184
 
87115
87185
  | Type | What it is |
87116
87186
  |---|---|
@@ -87118,6 +87188,7 @@ Each runnable has a unique key (used to call it from the frontend) and one of fo
87118
87188
  | \`script\` | Reference to an existing workspace script by path. |
87119
87189
  | \`flow\` | Reference to an existing workspace flow by path. |
87120
87190
  | \`hubscript\` | Reference to a hub script by path. |
87191
+ | \`agent\` | Reference to a saved AI agent by path. Each call is one turn of its chat (see the chat section above). |
87121
87192
 
87122
87193
  ### Inline runnables
87123
87194
 
@@ -87159,9 +87230,9 @@ An inline runnable runs as an ordinary Windmill job. \`import * as wmill from 'w
87159
87230
 
87160
87231
  Use only \`wmill\` functions the SDK actually exports; for an endpoint none of them covers, the generated service classes (\`JobService\`, \`ScriptService\`, ...) are importable from \`windmill-client\`. What is not available is a name you guessed at: \`getBaseUrl\` and \`getWorkspaceToken\` are inventions, not API.
87161
87232
 
87162
- ### Path runnables (script / flow / hubscript)
87233
+ ### Path runnables (script / flow / hubscript / agent)
87163
87234
 
87164
- When \`type\` is \`script\`, \`flow\`, or \`hubscript\`, the runnable just stores a \`path\` to an existing workspace or hub item — no inline code. The referenced item's input/output schema becomes the runnable's surface.
87235
+ When \`type\` is \`script\`, \`flow\`, \`hubscript\` or \`agent\`, the runnable just stores a \`path\` to an existing workspace or hub item — no inline code. The referenced item's input/output schema becomes the runnable's surface; an agent's is \`user_message\` and \`user_attachments\`, plus \`memory_id\` when the agent keeps managed memory or \`previous_messages\` when its memory is off.
87165
87236
 
87166
87237
  Before writing an inline runnable, look for a workspace script or flow that already does the job, or a Hub script (a prebuilt integration at \`hub/<version>/<app>/<name>\`) for a third-party service, and reference it instead of copying its logic.
87167
87238
 
@@ -87170,7 +87241,7 @@ Before writing an inline runnable, look for a workspace script or flow that alre
87170
87241
  This decides whether an app works before anything is deployed:
87171
87242
 
87172
87243
  - **Inline runnables run the app's current code.** The editor sends the runnable's source with each request, so an inline runnable works in the preview with nothing deployed.
87173
- - **Path runnables (\`script\` / \`flow\` / \`hubscript\`) run the DEPLOYED item at that path.** So do \`wmill.runFlow\`, \`wmill.runFlowAsync\` and \`wmill.runScriptByPath\` called from inside a runnable. A draft — including a draft you just created — does not exist for them.
87244
+ - **Path runnables (\`script\` / \`flow\` / \`hubscript\` / \`agent\`) run the DEPLOYED item at that path.** So do \`wmill.runFlow\`, \`wmill.runFlowAsync\` and \`wmill.runScriptByPath\` called from inside a runnable. A draft — including a draft you just created — does not exist for them.
87174
87245
 
87175
87246
  So an app wired to a flow you just wrote does nothing until **that flow is deployed**. The app itself does NOT have to be deployed for this: the preview runs the app's draft, so the referenced flow is the only thing that has to exist deployed.
87176
87247
 
@@ -87280,7 +87351,7 @@ def main(user_id: str):
87280
87351
  7. **Mark sensitive UI with \`data-wm-no-record\`** — it is what keeps that data out of a recorded demo; passwords are handled for you.
87281
87352
  8. **Reach for \`backendAsync\` + \`waitJob\`** for long work — never a hand-written job-polling runnable.
87282
87353
  9. **Deploy what a path runnable points at** — a path runnable aimed at a draft fails at runtime; tell the user what needs deploying.
87283
- 10. **Use \`@windmill-labs/chat-sdk\` for a chat over a chat-mode flow** — never a runnable that runs the flow and polls its stream.
87354
+ 10. **Use \`@windmill-labs/chat-sdk\` for a chat over a chat-mode flow or a saved agent** — never hand-roll a runnable that runs it and polls its stream; a saved agent is an \`agent\` runnable passed as \`{ wmill, runnable }\`.
87284
87355
  `,
87285
87356
  triggers: `---
87286
87357
  name: triggers
@@ -88597,7 +88668,7 @@ write a secret you were not given: keep the placeholder.
88597
88668
  | \`ai_config\` | Providers, default and completion models, custom prompts, \`copilot_disabled\`. |
88598
88669
  | \`large_file_storage\` | Workspace object storage: \`{ type, s3_resource_path \\| azure_blob_resource_path \\| gcs_resource_path, public_resource?, secondary_storage?, advanced_permissions? }\`. |
88599
88670
  | \`git_sync\` | \`{ repositories: [...] }\`, each with \`git_repo_resource_path\`, \`script_path\` and \`settings\` (include/exclude paths and types). Server-owned fields (webhook secrets, sync state, credentials) are never read nor written. |
88600
- | \`datatable\` | \`{ datatables: { <name>: { database: { resource_type, resource_path? } } } }\`. Role permissions are \`datatable_permissions\`. |
88671
+ | \`datatable\` | \`{ datatables: { <name>: { database: { resource_type, resource_path } } } }\`, both required: \`resource_type: postgresql\` with \`resource_path\` a Postgres resource's path, or \`instance\`, or \`external_instance\` (Enterprise only), with \`resource_path\` the name of a database a superadmin set up. A fork's entry can instead be \`{ reference: { workspace_id, datatable } }\`, pointing at its parent's data table; keep it as is. \`main\` is the one scripts use by default. Role permissions are \`datatable_permissions\`. |
88601
88672
  | \`datatable_permissions\` | \`{ <data table>: { default_role, roles: { <role>: [tenants] } } }\`: who may connect to each data table as which role. Tenants are \`u/<user>\`, \`g/<group>\`, \`f/<folder>\` or \`*\`; \`admin\` is always a role, and \`default_role: null\` means no default. A data table the value omits is no longer under roles. Only a data table on a cluster Windmill manages can be. |
88602
88673
  | \`protection_rules\` | \`{ <rule name>: { rules: [...], bypass_groups: [...], bypass_users: [...] } }\`, rules among \`DisableDirectDeployment\`, \`DisableWorkspaceForking\`, \`RestrictDeployToDeployers\`, \`RestrictAnonymousAppDeployment\`, \`RestrictPublicRunSharing\`, \`RestrictGuestAppDeployment\`, \`RequireIsolatedForks\`. A rule the value omits is deleted. The dev workspace lock is not listed and cannot be set here. |
88603
88674
  | \`ducklake\` | \`{ ducklakes: { <name>: { catalog, storage, ... } } }\`. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windmill-cli",
3
- "version": "1.846.1",
3
+ "version": "1.848.0",
4
4
  "description": "CLI for Windmill",
5
5
  "license": "Apache 2.0",
6
6
  "type": "module",