windmill-cli 1.836.0 → 1.838.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.
- package/esm/main.js +71 -13
- 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.
|
|
16769
|
+
VERSION: "1.838.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.
|
|
20077
|
+
var WM_FORK_PREFIX = "wm-fork", VERSION = "1.838.0";
|
|
20078
20078
|
|
|
20079
20079
|
// src/utils/resource_folders.ts
|
|
20080
20080
|
import { existsSync } from "node:fs";
|
|
@@ -22132,15 +22132,23 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
|
|
|
22132
22132
|
workspace: workspaceFrom,
|
|
22133
22133
|
path
|
|
22134
22134
|
});
|
|
22135
|
+
let value = resource.value ?? "";
|
|
22136
|
+
const agent = resource.resource_type === "ai_agent" && typeof value === "object";
|
|
22137
|
+
if (agent) {
|
|
22138
|
+
const { on_behalf_of: _, ...rest } = value;
|
|
22139
|
+
value = onBehalfOf ? { ...rest, on_behalf_of: onBehalfOf } : rest;
|
|
22140
|
+
}
|
|
22141
|
+
const agentPreserve = agent ? { preserve_on_behalf_of: preserveOnBehalfOf } : {};
|
|
22135
22142
|
if (alreadyExists) {
|
|
22136
22143
|
await provider.updateResource({
|
|
22137
22144
|
workspace: workspaceTo,
|
|
22138
22145
|
path,
|
|
22139
22146
|
requestBody: {
|
|
22140
22147
|
path,
|
|
22141
|
-
value
|
|
22148
|
+
value,
|
|
22142
22149
|
description: resource.description ?? "",
|
|
22143
|
-
labels: resource.labels
|
|
22150
|
+
labels: resource.labels,
|
|
22151
|
+
...agentPreserve
|
|
22144
22152
|
}
|
|
22145
22153
|
});
|
|
22146
22154
|
} else {
|
|
@@ -22148,10 +22156,11 @@ async function deployItem(provider, kind, path, workspaceFrom, workspaceTo, onBe
|
|
|
22148
22156
|
workspace: workspaceTo,
|
|
22149
22157
|
requestBody: {
|
|
22150
22158
|
path,
|
|
22151
|
-
value
|
|
22159
|
+
value,
|
|
22152
22160
|
resource_type: resource.resource_type,
|
|
22153
22161
|
description: resource.description ?? "",
|
|
22154
|
-
labels: resource.labels
|
|
22162
|
+
labels: resource.labels,
|
|
22163
|
+
...agentPreserve
|
|
22155
22164
|
}
|
|
22156
22165
|
});
|
|
22157
22166
|
}
|
|
@@ -22331,6 +22340,9 @@ async function getOnBehalfOf(provider, kind, path, workspace) {
|
|
|
22331
22340
|
} else if (kind === "app" || kind === "raw_app") {
|
|
22332
22341
|
const app = await provider.getAppByPath({ workspace, path });
|
|
22333
22342
|
return app.policy?.on_behalf_of_email;
|
|
22343
|
+
} else if (kind === "resource") {
|
|
22344
|
+
const resource = await provider.getResource({ workspace, path });
|
|
22345
|
+
return resource.resource_type === "ai_agent" ? resource.value?.on_behalf_of : undefined;
|
|
22334
22346
|
} else if (kind === "schedule") {
|
|
22335
22347
|
const schedule = await provider.getSchedule({ workspace, path });
|
|
22336
22348
|
return schedule.permissioned_as;
|
|
@@ -58782,7 +58794,7 @@ var init_openflow = __esm(() => {
|
|
|
58782
58794
|
openflow_default = {
|
|
58783
58795
|
openapi: "3.0.3",
|
|
58784
58796
|
info: {
|
|
58785
|
-
version: "1.
|
|
58797
|
+
version: "1.838.0",
|
|
58786
58798
|
title: "OpenFlow Spec",
|
|
58787
58799
|
contact: {
|
|
58788
58800
|
name: "Ruben Fiszel",
|
|
@@ -63126,6 +63138,14 @@ async function preCheckPermissionedAs(changes, userEmail, userIsAdminOrDeployer,
|
|
|
63126
63138
|
if (match) {
|
|
63127
63139
|
currentOwner = match[1];
|
|
63128
63140
|
}
|
|
63141
|
+
} else if (typeStr === "resource") {
|
|
63142
|
+
if (/["']?resource_type["']?\s*:\s*["']?ai_agent\b/.test(beforeContent) && /["']?run_on_behalf_of["']?\s*:\s*true\b/.test(beforeContent)) {
|
|
63143
|
+
wouldChangeItems.push({
|
|
63144
|
+
path: change.path,
|
|
63145
|
+
currentOwner: "(agent owner)"
|
|
63146
|
+
});
|
|
63147
|
+
}
|
|
63148
|
+
continue;
|
|
63129
63149
|
} else if (typeStr.endsWith("_trigger")) {
|
|
63130
63150
|
wouldChangeItems.push({
|
|
63131
63151
|
path: change.path,
|
|
@@ -67162,7 +67182,7 @@ function validateFilesetPointer(dirPath, remotePath) {
|
|
|
67162
67182
|
throw new Error(`Resource ${remotePath.replaceAll(SEP8, "/")} uses '!inline_fileset ${dirPath}', ` + `but a fileset directory must live next to its resource file, at '${expected}'. ` + `Move the directory there (e.g. 'git mv ${pointer} ${expected}') and update the ` + `'!inline_fileset' value to match.`);
|
|
67163
67183
|
}
|
|
67164
67184
|
}
|
|
67165
|
-
async function pushResource(workspace, remotePath, resource, localResource, originalLocalPath, wsSpecific, enforceCanonicalFileset) {
|
|
67185
|
+
async function pushResource(workspace, remotePath, resource, localResource, originalLocalPath, wsSpecific, enforceCanonicalFileset, permissionedAsContext) {
|
|
67166
67186
|
remotePath = removeType(remotePath, "resource");
|
|
67167
67187
|
try {
|
|
67168
67188
|
resource = await getResource({
|
|
@@ -67170,6 +67190,7 @@ async function pushResource(workspace, remotePath, resource, localResource, orig
|
|
|
67170
67190
|
path: remotePath.replaceAll(SEP8, "/")
|
|
67171
67191
|
});
|
|
67172
67192
|
} catch {}
|
|
67193
|
+
const claimed = agentOnBehalfOf(resource, localResource, permissionedAsContext);
|
|
67173
67194
|
const resolveInlineContent = async () => {
|
|
67174
67195
|
if (typeof localResource.value === "string" && localResource.value.startsWith("!inline_fileset ")) {
|
|
67175
67196
|
const dirPath = localResource.value.split(" ")[1];
|
|
@@ -67199,10 +67220,20 @@ async function pushResource(workspace, remotePath, resource, localResource, orig
|
|
|
67199
67220
|
return;
|
|
67200
67221
|
}
|
|
67201
67222
|
await resolveInlineContent();
|
|
67223
|
+
if (claimed) {
|
|
67224
|
+
info(`Preserving ${claimed} as permissioned_as for agent ${remotePath}`);
|
|
67225
|
+
}
|
|
67202
67226
|
await updateResource({
|
|
67203
67227
|
workspace,
|
|
67204
67228
|
path: remotePath.replaceAll(SEP8, "/"),
|
|
67205
|
-
requestBody: {
|
|
67229
|
+
requestBody: {
|
|
67230
|
+
...localResource,
|
|
67231
|
+
...wsSpecific !== undefined ? { ws_specific: wsSpecific } : {},
|
|
67232
|
+
...claimed ? {
|
|
67233
|
+
value: { ...localResource.value, on_behalf_of: claimed },
|
|
67234
|
+
preserve_on_behalf_of: true
|
|
67235
|
+
} : {}
|
|
67236
|
+
}
|
|
67206
67237
|
});
|
|
67207
67238
|
} else {
|
|
67208
67239
|
await resolveInlineContent();
|
|
@@ -67220,6 +67251,25 @@ async function pushResource(workspace, remotePath, resource, localResource, orig
|
|
|
67220
67251
|
});
|
|
67221
67252
|
}
|
|
67222
67253
|
}
|
|
67254
|
+
function agentOnBehalfOf(deployed, localResource, permissionedAsContext) {
|
|
67255
|
+
if (localResource.resource_type !== "ai_agent") {
|
|
67256
|
+
return;
|
|
67257
|
+
}
|
|
67258
|
+
const local = localResource.value;
|
|
67259
|
+
if (local && typeof local === "object") {
|
|
67260
|
+
delete local.on_behalf_of;
|
|
67261
|
+
}
|
|
67262
|
+
const value = deployed?.resource_type === "ai_agent" ? deployed.value : undefined;
|
|
67263
|
+
const onBehalfOf = value && typeof value === "object" ? value.on_behalf_of : undefined;
|
|
67264
|
+
if (deployed && onBehalfOf !== undefined) {
|
|
67265
|
+
const { on_behalf_of: _, ...rest } = value;
|
|
67266
|
+
deployed.value = rest;
|
|
67267
|
+
}
|
|
67268
|
+
if (!onBehalfOf || !permissionedAsContext?.userIsAdminOrDeployer) {
|
|
67269
|
+
return;
|
|
67270
|
+
}
|
|
67271
|
+
return onBehalfOf;
|
|
67272
|
+
}
|
|
67223
67273
|
async function push4(opts, filePath, remotePath) {
|
|
67224
67274
|
const workspace = await resolveWorkspace(opts);
|
|
67225
67275
|
await requireLogin(opts);
|
|
@@ -67231,7 +67281,7 @@ async function push4(opts, filePath, remotePath) {
|
|
|
67231
67281
|
throw new Error("file path must refer to a file.");
|
|
67232
67282
|
}
|
|
67233
67283
|
info(colors.bold.yellow("Pushing resource..."));
|
|
67234
|
-
await pushResource(workspace.workspaceId, remotePath, undefined, parseFromFile(filePath), filePath);
|
|
67284
|
+
await pushResource(workspace.workspaceId, remotePath, undefined, parseFromFile(filePath), filePath, undefined, undefined, await buildPermissionedAsContext(workspace.workspaceId, await readEffectiveSyncBehavior(opts, workspace)));
|
|
67235
67285
|
info(colors.bold.underline.green(`Resource ${remotePath} pushed`));
|
|
67236
67286
|
}
|
|
67237
67287
|
async function list6(opts) {
|
|
@@ -67315,7 +67365,9 @@ var init_resource = __esm(async () => {
|
|
|
67315
67365
|
init_context(),
|
|
67316
67366
|
init_utils(),
|
|
67317
67367
|
init_specific_items(),
|
|
67318
|
-
init_git()
|
|
67368
|
+
init_git(),
|
|
67369
|
+
init_permissioned_as(),
|
|
67370
|
+
init_conf()
|
|
67319
67371
|
]);
|
|
67320
67372
|
import_yaml19 = __toESM(require_dist(), 1);
|
|
67321
67373
|
command9 = new Command().description("resource related commands").option("--json", "Output as JSON (for piping to jq)").action(list6).command("list", "list all resources").option("--json", "Output as JSON (for piping to jq)").action(list6).command("get", "get a resource's details").arguments("<path:string>").option("--json", "Output as JSON (for piping to jq)").action(get3).command("new", "create a new resource locally").arguments("<path:string>").action(newResource).command("push", "push a local resource spec. This overrides any remote versions.").arguments("<file_path:string> <remote_path:string>").action(push4);
|
|
@@ -70887,7 +70939,7 @@ Run 'wmill folder add-missing' to create them locally, then push again.`;
|
|
|
70887
70939
|
} else if (specificItems && isSpecificItem(change.path, specificItems)) {
|
|
70888
70940
|
isFileResWsSpecific = true;
|
|
70889
70941
|
}
|
|
70890
|
-
await pushResource(workspace.workspaceId, serverPath, undefined, newObj, resourceFilePath, isFileResWsSpecific ? true : undefined, true);
|
|
70942
|
+
await pushResource(workspace.workspaceId, serverPath, undefined, newObj, resourceFilePath, isFileResWsSpecific ? true : undefined, true, permissionedAsContext);
|
|
70891
70943
|
}
|
|
70892
70944
|
if (stateTarget) {
|
|
70893
70945
|
await writeFile11(stateTarget, change.after, "utf-8");
|
|
@@ -77896,7 +77948,7 @@ async function pushObj(workspace, p, befObj, newObj, plainSecrets, alreadySynced
|
|
|
77896
77948
|
} else if (typeEnding === "resource") {
|
|
77897
77949
|
if (!alreadySynced.includes(p)) {
|
|
77898
77950
|
alreadySynced.push(p);
|
|
77899
|
-
await pushResource(workspace, p, befObj, newObj, originalLocalPath || p, wsSpecific, true);
|
|
77951
|
+
await pushResource(workspace, p, befObj, newObj, originalLocalPath || p, wsSpecific, true, permissionedAsContext);
|
|
77900
77952
|
}
|
|
77901
77953
|
} else if (typeEnding === "resource-type") {
|
|
77902
77954
|
await pushResourceType(workspace, p, befObj, newObj);
|
|
@@ -87377,6 +87429,12 @@ Example: \`f/databases/postgres_prod.resource.json\`
|
|
|
87377
87429
|
- \`value\` - Object containing the resource configuration
|
|
87378
87430
|
- \`resource_type\` - Name of the resource type (e.g., "postgresql", "slack")
|
|
87379
87431
|
|
|
87432
|
+
## Agents
|
|
87433
|
+
|
|
87434
|
+
An agent, as the Agents page lists it, is a resource of type \`ai_agent\`. Its value holds the
|
|
87435
|
+
agent's provider, system prompt, tools and memory settings, and a flow step uses a saved agent by
|
|
87436
|
+
linking its path.
|
|
87437
|
+
|
|
87380
87438
|
## Variable References
|
|
87381
87439
|
|
|
87382
87440
|
Reference variables in resource values:
|