@ever-works/activepieces-plugin 1.0.10 → 1.0.12

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 (3) hide show
  1. package/dist/index.cjs +179 -14
  2. package/dist/index.js +179 -14
  3. package/package.json +6 -6
package/dist/index.cjs CHANGED
@@ -492,6 +492,13 @@ var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
492
492
  allowedMergeMethods: ["squash"],
493
493
  protectedBranches: ["main", "master", "develop", "stage"]
494
494
  });
495
+ var MERGE_POLICY_PROTECTED_BRANCH_FLOOR = Object.freeze([
496
+ "main",
497
+ "master",
498
+ "develop",
499
+ "stage"
500
+ ]);
501
+ var MERGE_POLICY_ALWAYS_APPROVED_BRANCHES = Object.freeze(["main", "master"]);
495
502
  var MERGE_APPROVAL_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
496
503
  var TOOL_GRANT_SCOPE_PRECEDENCE = Object.freeze([
497
504
  "tenant",
@@ -1204,6 +1211,111 @@ var FLEET_HEALTH_DISK_CRITICAL_MARGIN_BYTES = 1024 ** 3;
1204
1211
  var FLEET_HEALTH_MAX_MIB = 2 ** 40;
1205
1212
  var FLEET_HEALTH_MAX_UPTIME_SEC = 100 * 365 * 24 * 60 * 60;
1206
1213
  var FLEET_HEALTH_BYTES_PER_MIB = 1024 * 1024;
1214
+ var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
1215
+ // Works — reads, plus the settings update (its merge / check / command
1216
+ // fields are refused for run tokens by the Works controller).
1217
+ { method: "GET", pathPattern: "/api/works" },
1218
+ { method: "GET", pathPattern: "/api/works/{id}" },
1219
+ { method: "PUT", pathPattern: "/api/works/{id}" },
1220
+ { method: "GET", pathPattern: "/api/works/{id}/config" },
1221
+ { method: "GET", pathPattern: "/api/works/{id}/items" },
1222
+ { method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
1223
+ { method: "GET", pathPattern: "/api/works/{id}/history" },
1224
+ { method: "GET", pathPattern: "/api/works/{id}/generator-form" },
1225
+ { method: "GET", pathPattern: "/api/works/{id}/schedule" },
1226
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons" },
1227
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
1228
+ // Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
1229
+ // lands `proposed` (review-gated), see the KB controller. No unlock.
1230
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
1231
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
1232
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
1233
+ { method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
1234
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
1235
+ // Deploy — reads and the capability check only.
1236
+ { method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
1237
+ { method: "GET", pathPattern: "/api/deploy/providers" },
1238
+ { method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
1239
+ // Plugins — read only.
1240
+ { method: "GET", pathPattern: "/api/plugins" },
1241
+ { method: "GET", pathPattern: "/api/plugins/{pluginId}" },
1242
+ // Missions — reads, plus pause (the safe direction).
1243
+ { method: "GET", pathPattern: "/api/me/missions" },
1244
+ { method: "GET", pathPattern: "/api/me/missions/{id}" },
1245
+ { method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
1246
+ { method: "GET", pathPattern: "/api/me/missions/{id}/works" },
1247
+ { method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
1248
+ // Ideas — reads, plus filing a new Idea (a proposal a person builds).
1249
+ { method: "POST", pathPattern: "/api/me/work-proposals" },
1250
+ { method: "GET", pathPattern: "/api/me/work-proposals" },
1251
+ { method: "GET", pathPattern: "/api/me/work-proposals/status" },
1252
+ { method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
1253
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
1254
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
1255
+ // Account-wide usage.
1256
+ { method: "GET", pathPattern: "/api/me/usage/account-wide" },
1257
+ // Tasks — reads and collaboration writes. Create / update / transition /
1258
+ // assign / chat carry body refusals for run tokens in the Tasks
1259
+ // controller (no checks, no schedule, no force, no dispatch, no @agent).
1260
+ { method: "GET", pathPattern: "/api/tasks" },
1261
+ { method: "POST", pathPattern: "/api/tasks" },
1262
+ { method: "GET", pathPattern: "/api/tasks/{id}" },
1263
+ { method: "PATCH", pathPattern: "/api/tasks/{id}" },
1264
+ { method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
1265
+ { method: "GET", pathPattern: "/api/tasks/{id}/activity" },
1266
+ { method: "POST", pathPattern: "/api/tasks/{id}/transition" },
1267
+ { method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
1268
+ { method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
1269
+ { method: "GET", pathPattern: "/api/tasks/{id}/diff" },
1270
+ { method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
1271
+ { method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
1272
+ { method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
1273
+ { method: "POST", pathPattern: "/api/tasks/{id}/relations" },
1274
+ { method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
1275
+ { method: "GET", pathPattern: "/api/tasks/{id}/chat" },
1276
+ { method: "POST", pathPattern: "/api/tasks/{id}/chat" },
1277
+ { method: "GET", pathPattern: "/api/tasks/{id}/spend" },
1278
+ // Inbox — read only (no reply, no archive / delete / mark-read).
1279
+ { method: "GET", pathPattern: "/api/inbox" },
1280
+ { method: "GET", pathPattern: "/api/inbox/unread-count" },
1281
+ { method: "GET", pathPattern: "/api/inbox/{id}" },
1282
+ // Goals — reads, a draft create, field-limited update, pause, and the
1283
+ // ASKING side of the definition of done (propose, never approve).
1284
+ { method: "GET", pathPattern: "/api/me/goals" },
1285
+ { method: "POST", pathPattern: "/api/me/goals" },
1286
+ { method: "GET", pathPattern: "/api/me/goals/{id}" },
1287
+ { method: "PATCH", pathPattern: "/api/me/goals/{id}" },
1288
+ { method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
1289
+ { method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
1290
+ { method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
1291
+ // Fleet — reads only.
1292
+ { method: "GET", pathPattern: "/api/fleet/nodes" },
1293
+ { method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
1294
+ { method: "GET", pathPattern: "/api/fleet/runner-status" },
1295
+ { method: "GET", pathPattern: "/api/fleet/execution-preferences" },
1296
+ { method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
1297
+ // Agents — reads, plus cancel and pause (the safe direction).
1298
+ { method: "GET", pathPattern: "/api/agents" },
1299
+ { method: "GET", pathPattern: "/api/agents/{id}" },
1300
+ { method: "GET", pathPattern: "/api/agents/{id}/runs" },
1301
+ { method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
1302
+ { method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
1303
+ { method: "POST", pathPattern: "/api/agents/{id}/pause" },
1304
+ { method: "GET", pathPattern: "/api/agents/{id}/budget" },
1305
+ // Agent Plugins — read only (installing a package installs instructions).
1306
+ { method: "GET", pathPattern: "/api/agent-plugins" },
1307
+ { method: "GET", pathPattern: "/api/agent-plugins/findings" },
1308
+ { method: "GET", pathPattern: "/api/agent-plugins/catalog" },
1309
+ { method: "GET", pathPattern: "/api/agent-plugins/updates" }
1310
+ ]);
1311
+ var MACHINE_PRINCIPAL_WORK_WRITABLE_FIELDS = Object.freeze(["name", "description"]);
1312
+ function splitSegments(normalizedPath) {
1313
+ return normalizedPath.split("/").filter((segment) => segment.length > 0);
1314
+ }
1315
+ var FLEET_RUN_TOKEN_ROUTE_SHAPES = FLEET_RUN_TOKEN_ROUTES.map((route) => ({
1316
+ method: route.method.toUpperCase(),
1317
+ shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
1318
+ }));
1207
1319
  var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
1208
1320
  var EMAIL_INBOX_BURST_SENDS = 10;
1209
1321
  var EMAIL_INBOX_BURST_RECIPIENTS = 20;
@@ -1745,9 +1857,15 @@ var INTEGRATION_SCOPES = [
1745
1857
  "email:write",
1746
1858
  "events:read",
1747
1859
  "webhooks:manage",
1748
- "links:write"
1860
+ "links:write",
1861
+ "merges:decide"
1862
+ ];
1863
+ var INTEGRATION_MERGE_DECISION_SCOPE = "merges:decide";
1864
+ var INTEGRATION_OPT_IN_SCOPES = [
1865
+ "org:write",
1866
+ "email:write",
1867
+ INTEGRATION_MERGE_DECISION_SCOPE
1749
1868
  ];
1750
- var INTEGRATION_OPT_IN_SCOPES = ["org:write", "email:write"];
1751
1869
  var EVER_GAUZY_PRESET_SCOPES = INTEGRATION_SCOPES.filter(
1752
1870
  (scope) => !INTEGRATION_OPT_IN_SCOPES.includes(scope)
1753
1871
  );
@@ -2540,6 +2658,7 @@ function isSafeWebhookUrl(rawUrl) {
2540
2658
  if (host.startsWith("[") && host.endsWith("]")) {
2541
2659
  host = host.slice(1, -1);
2542
2660
  }
2661
+ host = host.replace(/\.+$/, "");
2543
2662
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
2544
2663
  return false;
2545
2664
  }
@@ -2569,23 +2688,69 @@ function isPrivateIPv4(ip) {
2569
2688
  if (a === 172 && b >= 16 && b <= 31) return true;
2570
2689
  if (a === 192 && b === 168) return true;
2571
2690
  if (a === 192 && b === 0 && parts[2] === 0) return true;
2691
+ if (a === 198 && (b === 18 || b === 19)) return true;
2692
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
2693
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
2694
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
2572
2695
  if (a === 100 && b >= 64 && b <= 127) return true;
2573
2696
  if (a >= 224) return true;
2574
2697
  return false;
2575
2698
  }
2576
- function isPrivateIPv6(ip) {
2577
- const lower = ip.toLowerCase();
2578
- if (lower === "::1" || lower === "::") return true;
2579
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
2580
- const firstHextet = lower.split(":", 1)[0];
2581
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
2582
- const group0 = parseInt(firstHextet, 16);
2583
- if ((group0 & 65472) === 65152) return true;
2584
- }
2585
- if (lower.startsWith("::ffff:")) {
2586
- const v4 = lower.slice("::ffff:".length);
2587
- if ((0, import_net.isIP)(v4) === 4) return isPrivateIPv4(v4);
2699
+ function parseIPv6Groups(ip) {
2700
+ let text = ip.trim().toLowerCase();
2701
+ const zone = text.indexOf("%");
2702
+ if (zone >= 0) text = text.slice(0, zone);
2703
+ if ((0, import_net.isIP)(text) !== 6) return null;
2704
+ const lastColon = text.lastIndexOf(":");
2705
+ const tail = text.slice(lastColon + 1);
2706
+ if (tail.includes(".")) {
2707
+ if ((0, import_net.isIP)(tail) !== 4) return null;
2708
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
2709
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
2710
+ }
2711
+ const halves = text.split("::");
2712
+ if (halves.length > 2) return null;
2713
+ const head = halves[0] ? halves[0].split(":") : [];
2714
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
2715
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
2716
+ if (fill < 0) return null;
2717
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
2718
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
2719
+ return null;
2588
2720
  }
2721
+ return groups;
2722
+ }
2723
+ function ipv4FromGroups(high, low) {
2724
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
2725
+ }
2726
+ function embeddedIPv4(ip) {
2727
+ const g = parseIPv6Groups(ip);
2728
+ if (!g) return null;
2729
+ const zeros = (from, to) => g.slice(from, to).every((group) => group === 0);
2730
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
2731
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
2732
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
2733
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
2734
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
2735
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
2736
+ return null;
2737
+ }
2738
+ function isPrivateIPv6(ip) {
2739
+ const g = parseIPv6Groups(ip);
2740
+ if (!g) {
2741
+ const lower = ip.toLowerCase();
2742
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
2743
+ }
2744
+ if (g.every((group) => group === 0)) return true;
2745
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
2746
+ if ((g[0] & 65024) === 64512) return true;
2747
+ if ((g[0] & 65472) === 65152) return true;
2748
+ if ((g[0] & 65472) === 65216) return true;
2749
+ if ((g[0] & 65280) === 65280) return true;
2750
+ if (g[0] === 8193 && g[1] === 3512) return true;
2751
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
2752
+ const v4 = embeddedIPv4(ip);
2753
+ if (v4 && isPrivateIPv4(v4)) return true;
2589
2754
  return false;
2590
2755
  }
2591
2756
 
package/dist/index.js CHANGED
@@ -465,6 +465,13 @@ var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
465
465
  allowedMergeMethods: ["squash"],
466
466
  protectedBranches: ["main", "master", "develop", "stage"]
467
467
  });
468
+ var MERGE_POLICY_PROTECTED_BRANCH_FLOOR = Object.freeze([
469
+ "main",
470
+ "master",
471
+ "develop",
472
+ "stage"
473
+ ]);
474
+ var MERGE_POLICY_ALWAYS_APPROVED_BRANCHES = Object.freeze(["main", "master"]);
468
475
  var MERGE_APPROVAL_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
469
476
  var TOOL_GRANT_SCOPE_PRECEDENCE = Object.freeze([
470
477
  "tenant",
@@ -1177,6 +1184,111 @@ var FLEET_HEALTH_DISK_CRITICAL_MARGIN_BYTES = 1024 ** 3;
1177
1184
  var FLEET_HEALTH_MAX_MIB = 2 ** 40;
1178
1185
  var FLEET_HEALTH_MAX_UPTIME_SEC = 100 * 365 * 24 * 60 * 60;
1179
1186
  var FLEET_HEALTH_BYTES_PER_MIB = 1024 * 1024;
1187
+ var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
1188
+ // Works — reads, plus the settings update (its merge / check / command
1189
+ // fields are refused for run tokens by the Works controller).
1190
+ { method: "GET", pathPattern: "/api/works" },
1191
+ { method: "GET", pathPattern: "/api/works/{id}" },
1192
+ { method: "PUT", pathPattern: "/api/works/{id}" },
1193
+ { method: "GET", pathPattern: "/api/works/{id}/config" },
1194
+ { method: "GET", pathPattern: "/api/works/{id}/items" },
1195
+ { method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
1196
+ { method: "GET", pathPattern: "/api/works/{id}/history" },
1197
+ { method: "GET", pathPattern: "/api/works/{id}/generator-form" },
1198
+ { method: "GET", pathPattern: "/api/works/{id}/schedule" },
1199
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons" },
1200
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
1201
+ // Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
1202
+ // lands `proposed` (review-gated), see the KB controller. No unlock.
1203
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
1204
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
1205
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
1206
+ { method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
1207
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
1208
+ // Deploy — reads and the capability check only.
1209
+ { method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
1210
+ { method: "GET", pathPattern: "/api/deploy/providers" },
1211
+ { method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
1212
+ // Plugins — read only.
1213
+ { method: "GET", pathPattern: "/api/plugins" },
1214
+ { method: "GET", pathPattern: "/api/plugins/{pluginId}" },
1215
+ // Missions — reads, plus pause (the safe direction).
1216
+ { method: "GET", pathPattern: "/api/me/missions" },
1217
+ { method: "GET", pathPattern: "/api/me/missions/{id}" },
1218
+ { method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
1219
+ { method: "GET", pathPattern: "/api/me/missions/{id}/works" },
1220
+ { method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
1221
+ // Ideas — reads, plus filing a new Idea (a proposal a person builds).
1222
+ { method: "POST", pathPattern: "/api/me/work-proposals" },
1223
+ { method: "GET", pathPattern: "/api/me/work-proposals" },
1224
+ { method: "GET", pathPattern: "/api/me/work-proposals/status" },
1225
+ { method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
1226
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
1227
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
1228
+ // Account-wide usage.
1229
+ { method: "GET", pathPattern: "/api/me/usage/account-wide" },
1230
+ // Tasks — reads and collaboration writes. Create / update / transition /
1231
+ // assign / chat carry body refusals for run tokens in the Tasks
1232
+ // controller (no checks, no schedule, no force, no dispatch, no @agent).
1233
+ { method: "GET", pathPattern: "/api/tasks" },
1234
+ { method: "POST", pathPattern: "/api/tasks" },
1235
+ { method: "GET", pathPattern: "/api/tasks/{id}" },
1236
+ { method: "PATCH", pathPattern: "/api/tasks/{id}" },
1237
+ { method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
1238
+ { method: "GET", pathPattern: "/api/tasks/{id}/activity" },
1239
+ { method: "POST", pathPattern: "/api/tasks/{id}/transition" },
1240
+ { method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
1241
+ { method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
1242
+ { method: "GET", pathPattern: "/api/tasks/{id}/diff" },
1243
+ { method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
1244
+ { method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
1245
+ { method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
1246
+ { method: "POST", pathPattern: "/api/tasks/{id}/relations" },
1247
+ { method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
1248
+ { method: "GET", pathPattern: "/api/tasks/{id}/chat" },
1249
+ { method: "POST", pathPattern: "/api/tasks/{id}/chat" },
1250
+ { method: "GET", pathPattern: "/api/tasks/{id}/spend" },
1251
+ // Inbox — read only (no reply, no archive / delete / mark-read).
1252
+ { method: "GET", pathPattern: "/api/inbox" },
1253
+ { method: "GET", pathPattern: "/api/inbox/unread-count" },
1254
+ { method: "GET", pathPattern: "/api/inbox/{id}" },
1255
+ // Goals — reads, a draft create, field-limited update, pause, and the
1256
+ // ASKING side of the definition of done (propose, never approve).
1257
+ { method: "GET", pathPattern: "/api/me/goals" },
1258
+ { method: "POST", pathPattern: "/api/me/goals" },
1259
+ { method: "GET", pathPattern: "/api/me/goals/{id}" },
1260
+ { method: "PATCH", pathPattern: "/api/me/goals/{id}" },
1261
+ { method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
1262
+ { method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
1263
+ { method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
1264
+ // Fleet — reads only.
1265
+ { method: "GET", pathPattern: "/api/fleet/nodes" },
1266
+ { method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
1267
+ { method: "GET", pathPattern: "/api/fleet/runner-status" },
1268
+ { method: "GET", pathPattern: "/api/fleet/execution-preferences" },
1269
+ { method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
1270
+ // Agents — reads, plus cancel and pause (the safe direction).
1271
+ { method: "GET", pathPattern: "/api/agents" },
1272
+ { method: "GET", pathPattern: "/api/agents/{id}" },
1273
+ { method: "GET", pathPattern: "/api/agents/{id}/runs" },
1274
+ { method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
1275
+ { method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
1276
+ { method: "POST", pathPattern: "/api/agents/{id}/pause" },
1277
+ { method: "GET", pathPattern: "/api/agents/{id}/budget" },
1278
+ // Agent Plugins — read only (installing a package installs instructions).
1279
+ { method: "GET", pathPattern: "/api/agent-plugins" },
1280
+ { method: "GET", pathPattern: "/api/agent-plugins/findings" },
1281
+ { method: "GET", pathPattern: "/api/agent-plugins/catalog" },
1282
+ { method: "GET", pathPattern: "/api/agent-plugins/updates" }
1283
+ ]);
1284
+ var MACHINE_PRINCIPAL_WORK_WRITABLE_FIELDS = Object.freeze(["name", "description"]);
1285
+ function splitSegments(normalizedPath) {
1286
+ return normalizedPath.split("/").filter((segment) => segment.length > 0);
1287
+ }
1288
+ var FLEET_RUN_TOKEN_ROUTE_SHAPES = FLEET_RUN_TOKEN_ROUTES.map((route) => ({
1289
+ method: route.method.toUpperCase(),
1290
+ shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
1291
+ }));
1180
1292
  var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
1181
1293
  var EMAIL_INBOX_BURST_SENDS = 10;
1182
1294
  var EMAIL_INBOX_BURST_RECIPIENTS = 20;
@@ -1718,9 +1830,15 @@ var INTEGRATION_SCOPES = [
1718
1830
  "email:write",
1719
1831
  "events:read",
1720
1832
  "webhooks:manage",
1721
- "links:write"
1833
+ "links:write",
1834
+ "merges:decide"
1835
+ ];
1836
+ var INTEGRATION_MERGE_DECISION_SCOPE = "merges:decide";
1837
+ var INTEGRATION_OPT_IN_SCOPES = [
1838
+ "org:write",
1839
+ "email:write",
1840
+ INTEGRATION_MERGE_DECISION_SCOPE
1722
1841
  ];
1723
- var INTEGRATION_OPT_IN_SCOPES = ["org:write", "email:write"];
1724
1842
  var EVER_GAUZY_PRESET_SCOPES = INTEGRATION_SCOPES.filter(
1725
1843
  (scope) => !INTEGRATION_OPT_IN_SCOPES.includes(scope)
1726
1844
  );
@@ -2513,6 +2631,7 @@ function isSafeWebhookUrl(rawUrl) {
2513
2631
  if (host.startsWith("[") && host.endsWith("]")) {
2514
2632
  host = host.slice(1, -1);
2515
2633
  }
2634
+ host = host.replace(/\.+$/, "");
2516
2635
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
2517
2636
  return false;
2518
2637
  }
@@ -2542,23 +2661,69 @@ function isPrivateIPv4(ip) {
2542
2661
  if (a === 172 && b >= 16 && b <= 31) return true;
2543
2662
  if (a === 192 && b === 168) return true;
2544
2663
  if (a === 192 && b === 0 && parts[2] === 0) return true;
2664
+ if (a === 198 && (b === 18 || b === 19)) return true;
2665
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
2666
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
2667
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
2545
2668
  if (a === 100 && b >= 64 && b <= 127) return true;
2546
2669
  if (a >= 224) return true;
2547
2670
  return false;
2548
2671
  }
2549
- function isPrivateIPv6(ip) {
2550
- const lower = ip.toLowerCase();
2551
- if (lower === "::1" || lower === "::") return true;
2552
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
2553
- const firstHextet = lower.split(":", 1)[0];
2554
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
2555
- const group0 = parseInt(firstHextet, 16);
2556
- if ((group0 & 65472) === 65152) return true;
2557
- }
2558
- if (lower.startsWith("::ffff:")) {
2559
- const v4 = lower.slice("::ffff:".length);
2560
- if (isIP(v4) === 4) return isPrivateIPv4(v4);
2672
+ function parseIPv6Groups(ip) {
2673
+ let text = ip.trim().toLowerCase();
2674
+ const zone = text.indexOf("%");
2675
+ if (zone >= 0) text = text.slice(0, zone);
2676
+ if (isIP(text) !== 6) return null;
2677
+ const lastColon = text.lastIndexOf(":");
2678
+ const tail = text.slice(lastColon + 1);
2679
+ if (tail.includes(".")) {
2680
+ if (isIP(tail) !== 4) return null;
2681
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
2682
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
2683
+ }
2684
+ const halves = text.split("::");
2685
+ if (halves.length > 2) return null;
2686
+ const head = halves[0] ? halves[0].split(":") : [];
2687
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
2688
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
2689
+ if (fill < 0) return null;
2690
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
2691
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
2692
+ return null;
2561
2693
  }
2694
+ return groups;
2695
+ }
2696
+ function ipv4FromGroups(high, low) {
2697
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
2698
+ }
2699
+ function embeddedIPv4(ip) {
2700
+ const g = parseIPv6Groups(ip);
2701
+ if (!g) return null;
2702
+ const zeros = (from, to) => g.slice(from, to).every((group) => group === 0);
2703
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
2704
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
2705
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
2706
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
2707
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
2708
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
2709
+ return null;
2710
+ }
2711
+ function isPrivateIPv6(ip) {
2712
+ const g = parseIPv6Groups(ip);
2713
+ if (!g) {
2714
+ const lower = ip.toLowerCase();
2715
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
2716
+ }
2717
+ if (g.every((group) => group === 0)) return true;
2718
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
2719
+ if ((g[0] & 65024) === 64512) return true;
2720
+ if ((g[0] & 65472) === 65152) return true;
2721
+ if ((g[0] & 65472) === 65216) return true;
2722
+ if ((g[0] & 65280) === 65280) return true;
2723
+ if (g[0] === 8193 && g[1] === 3512) return true;
2724
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
2725
+ const v4 = embeddedIPv4(ip);
2726
+ if (v4 && isPrivateIPv4(v4)) return true;
2562
2727
  return false;
2563
2728
  }
2564
2729
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ever-works/activepieces-plugin",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Activepieces Automation Pipeline Plugin - Delegates Work generation steps to Activepieces flows",
5
5
  "author": {
6
6
  "name": "Ever Co. LTD",
@@ -33,10 +33,10 @@
33
33
  "test:coverage": "vitest run --coverage"
34
34
  },
35
35
  "peerDependencies": {
36
- "@ever-works/plugin": "^1.2.6"
36
+ "@ever-works/plugin": "^1.2.9"
37
37
  },
38
38
  "devDependencies": {
39
- "@ever-works/plugin": "^1.2.6",
39
+ "@ever-works/plugin": "^1.2.9",
40
40
  "@types/node": "^26.6.4",
41
41
  "tsup": "^8.0.0",
42
42
  "typescript": "^5.9.3",
@@ -76,8 +76,8 @@
76
76
  "url": "https://github.com/ever-works/ever-works/issues"
77
77
  },
78
78
  "everworksRelease": {
79
- "contentHash": "sha256:9ed5f2971d727b8a25c4d16ea0c3d3b868bc88741e9bae48fdd78e2ff153543c",
80
- "commit": "eff002871bfd7f9f8e0f984907f45265ae8b01e0",
81
- "source": "https://github.com/ever-works/ever-works/tree/eff002871bfd7f9f8e0f984907f45265ae8b01e0/packages/plugins/activepieces"
79
+ "contentHash": "sha256:ab45e1abb88fc67ca4be7bfc1067bb433885299fb505a706779a0c7347d43834",
80
+ "commit": "5b5a17e1cdc02e06383d508a6424a863521fc3e0",
81
+ "source": "https://github.com/ever-works/ever-works/tree/5b5a17e1cdc02e06383d508a6424a863521fc3e0/packages/plugins/activepieces"
82
82
  }
83
83
  }