@ever-works/opencode-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
@@ -504,6 +504,13 @@ var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
504
504
  allowedMergeMethods: ["squash"],
505
505
  protectedBranches: ["main", "master", "develop", "stage"]
506
506
  });
507
+ var MERGE_POLICY_PROTECTED_BRANCH_FLOOR = Object.freeze([
508
+ "main",
509
+ "master",
510
+ "develop",
511
+ "stage"
512
+ ]);
513
+ var MERGE_POLICY_ALWAYS_APPROVED_BRANCHES = Object.freeze(["main", "master"]);
507
514
  var MERGE_APPROVAL_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
508
515
  var TOOL_GRANT_SCOPE_PRECEDENCE = Object.freeze([
509
516
  "tenant",
@@ -1216,6 +1223,111 @@ var FLEET_HEALTH_DISK_CRITICAL_MARGIN_BYTES = 1024 ** 3;
1216
1223
  var FLEET_HEALTH_MAX_MIB = 2 ** 40;
1217
1224
  var FLEET_HEALTH_MAX_UPTIME_SEC = 100 * 365 * 24 * 60 * 60;
1218
1225
  var FLEET_HEALTH_BYTES_PER_MIB = 1024 * 1024;
1226
+ var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
1227
+ // Works — reads, plus the settings update (its merge / check / command
1228
+ // fields are refused for run tokens by the Works controller).
1229
+ { method: "GET", pathPattern: "/api/works" },
1230
+ { method: "GET", pathPattern: "/api/works/{id}" },
1231
+ { method: "PUT", pathPattern: "/api/works/{id}" },
1232
+ { method: "GET", pathPattern: "/api/works/{id}/config" },
1233
+ { method: "GET", pathPattern: "/api/works/{id}/items" },
1234
+ { method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
1235
+ { method: "GET", pathPattern: "/api/works/{id}/history" },
1236
+ { method: "GET", pathPattern: "/api/works/{id}/generator-form" },
1237
+ { method: "GET", pathPattern: "/api/works/{id}/schedule" },
1238
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons" },
1239
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
1240
+ // Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
1241
+ // lands `proposed` (review-gated), see the KB controller. No unlock.
1242
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
1243
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
1244
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
1245
+ { method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
1246
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
1247
+ // Deploy — reads and the capability check only.
1248
+ { method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
1249
+ { method: "GET", pathPattern: "/api/deploy/providers" },
1250
+ { method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
1251
+ // Plugins — read only.
1252
+ { method: "GET", pathPattern: "/api/plugins" },
1253
+ { method: "GET", pathPattern: "/api/plugins/{pluginId}" },
1254
+ // Missions — reads, plus pause (the safe direction).
1255
+ { method: "GET", pathPattern: "/api/me/missions" },
1256
+ { method: "GET", pathPattern: "/api/me/missions/{id}" },
1257
+ { method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
1258
+ { method: "GET", pathPattern: "/api/me/missions/{id}/works" },
1259
+ { method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
1260
+ // Ideas — reads, plus filing a new Idea (a proposal a person builds).
1261
+ { method: "POST", pathPattern: "/api/me/work-proposals" },
1262
+ { method: "GET", pathPattern: "/api/me/work-proposals" },
1263
+ { method: "GET", pathPattern: "/api/me/work-proposals/status" },
1264
+ { method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
1265
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
1266
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
1267
+ // Account-wide usage.
1268
+ { method: "GET", pathPattern: "/api/me/usage/account-wide" },
1269
+ // Tasks — reads and collaboration writes. Create / update / transition /
1270
+ // assign / chat carry body refusals for run tokens in the Tasks
1271
+ // controller (no checks, no schedule, no force, no dispatch, no @agent).
1272
+ { method: "GET", pathPattern: "/api/tasks" },
1273
+ { method: "POST", pathPattern: "/api/tasks" },
1274
+ { method: "GET", pathPattern: "/api/tasks/{id}" },
1275
+ { method: "PATCH", pathPattern: "/api/tasks/{id}" },
1276
+ { method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
1277
+ { method: "GET", pathPattern: "/api/tasks/{id}/activity" },
1278
+ { method: "POST", pathPattern: "/api/tasks/{id}/transition" },
1279
+ { method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
1280
+ { method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
1281
+ { method: "GET", pathPattern: "/api/tasks/{id}/diff" },
1282
+ { method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
1283
+ { method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
1284
+ { method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
1285
+ { method: "POST", pathPattern: "/api/tasks/{id}/relations" },
1286
+ { method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
1287
+ { method: "GET", pathPattern: "/api/tasks/{id}/chat" },
1288
+ { method: "POST", pathPattern: "/api/tasks/{id}/chat" },
1289
+ { method: "GET", pathPattern: "/api/tasks/{id}/spend" },
1290
+ // Inbox — read only (no reply, no archive / delete / mark-read).
1291
+ { method: "GET", pathPattern: "/api/inbox" },
1292
+ { method: "GET", pathPattern: "/api/inbox/unread-count" },
1293
+ { method: "GET", pathPattern: "/api/inbox/{id}" },
1294
+ // Goals — reads, a draft create, field-limited update, pause, and the
1295
+ // ASKING side of the definition of done (propose, never approve).
1296
+ { method: "GET", pathPattern: "/api/me/goals" },
1297
+ { method: "POST", pathPattern: "/api/me/goals" },
1298
+ { method: "GET", pathPattern: "/api/me/goals/{id}" },
1299
+ { method: "PATCH", pathPattern: "/api/me/goals/{id}" },
1300
+ { method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
1301
+ { method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
1302
+ { method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
1303
+ // Fleet — reads only.
1304
+ { method: "GET", pathPattern: "/api/fleet/nodes" },
1305
+ { method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
1306
+ { method: "GET", pathPattern: "/api/fleet/runner-status" },
1307
+ { method: "GET", pathPattern: "/api/fleet/execution-preferences" },
1308
+ { method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
1309
+ // Agents — reads, plus cancel and pause (the safe direction).
1310
+ { method: "GET", pathPattern: "/api/agents" },
1311
+ { method: "GET", pathPattern: "/api/agents/{id}" },
1312
+ { method: "GET", pathPattern: "/api/agents/{id}/runs" },
1313
+ { method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
1314
+ { method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
1315
+ { method: "POST", pathPattern: "/api/agents/{id}/pause" },
1316
+ { method: "GET", pathPattern: "/api/agents/{id}/budget" },
1317
+ // Agent Plugins — read only (installing a package installs instructions).
1318
+ { method: "GET", pathPattern: "/api/agent-plugins" },
1319
+ { method: "GET", pathPattern: "/api/agent-plugins/findings" },
1320
+ { method: "GET", pathPattern: "/api/agent-plugins/catalog" },
1321
+ { method: "GET", pathPattern: "/api/agent-plugins/updates" }
1322
+ ]);
1323
+ var MACHINE_PRINCIPAL_WORK_WRITABLE_FIELDS = Object.freeze(["name", "description"]);
1324
+ function splitSegments(normalizedPath) {
1325
+ return normalizedPath.split("/").filter((segment) => segment.length > 0);
1326
+ }
1327
+ var FLEET_RUN_TOKEN_ROUTE_SHAPES = FLEET_RUN_TOKEN_ROUTES.map((route) => ({
1328
+ method: route.method.toUpperCase(),
1329
+ shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
1330
+ }));
1219
1331
  var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
1220
1332
  var EMAIL_INBOX_BURST_SENDS = 10;
1221
1333
  var EMAIL_INBOX_BURST_RECIPIENTS = 20;
@@ -1757,9 +1869,15 @@ var INTEGRATION_SCOPES = [
1757
1869
  "email:write",
1758
1870
  "events:read",
1759
1871
  "webhooks:manage",
1760
- "links:write"
1872
+ "links:write",
1873
+ "merges:decide"
1874
+ ];
1875
+ var INTEGRATION_MERGE_DECISION_SCOPE = "merges:decide";
1876
+ var INTEGRATION_OPT_IN_SCOPES = [
1877
+ "org:write",
1878
+ "email:write",
1879
+ INTEGRATION_MERGE_DECISION_SCOPE
1761
1880
  ];
1762
- var INTEGRATION_OPT_IN_SCOPES = ["org:write", "email:write"];
1763
1881
  var EVER_GAUZY_PRESET_SCOPES = INTEGRATION_SCOPES.filter(
1764
1882
  (scope) => !INTEGRATION_OPT_IN_SCOPES.includes(scope)
1765
1883
  );
@@ -7657,6 +7775,7 @@ function isSafeWebhookUrl(rawUrl) {
7657
7775
  if (host.startsWith("[") && host.endsWith("]")) {
7658
7776
  host = host.slice(1, -1);
7659
7777
  }
7778
+ host = host.replace(/\.+$/, "");
7660
7779
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
7661
7780
  return false;
7662
7781
  }
@@ -7686,23 +7805,69 @@ function isPrivateIPv4(ip) {
7686
7805
  if (a === 172 && b >= 16 && b <= 31) return true;
7687
7806
  if (a === 192 && b === 168) return true;
7688
7807
  if (a === 192 && b === 0 && parts[2] === 0) return true;
7808
+ if (a === 198 && (b === 18 || b === 19)) return true;
7809
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
7810
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
7811
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
7689
7812
  if (a === 100 && b >= 64 && b <= 127) return true;
7690
7813
  if (a >= 224) return true;
7691
7814
  return false;
7692
7815
  }
7693
- function isPrivateIPv6(ip) {
7694
- const lower = ip.toLowerCase();
7695
- if (lower === "::1" || lower === "::") return true;
7696
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
7697
- const firstHextet = lower.split(":", 1)[0];
7698
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
7699
- const group0 = parseInt(firstHextet, 16);
7700
- if ((group0 & 65472) === 65152) return true;
7701
- }
7702
- if (lower.startsWith("::ffff:")) {
7703
- const v4 = lower.slice("::ffff:".length);
7704
- if ((0, import_net.isIP)(v4) === 4) return isPrivateIPv4(v4);
7816
+ function parseIPv6Groups(ip) {
7817
+ let text = ip.trim().toLowerCase();
7818
+ const zone = text.indexOf("%");
7819
+ if (zone >= 0) text = text.slice(0, zone);
7820
+ if ((0, import_net.isIP)(text) !== 6) return null;
7821
+ const lastColon = text.lastIndexOf(":");
7822
+ const tail = text.slice(lastColon + 1);
7823
+ if (tail.includes(".")) {
7824
+ if ((0, import_net.isIP)(tail) !== 4) return null;
7825
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
7826
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
7827
+ }
7828
+ const halves = text.split("::");
7829
+ if (halves.length > 2) return null;
7830
+ const head = halves[0] ? halves[0].split(":") : [];
7831
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
7832
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
7833
+ if (fill < 0) return null;
7834
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
7835
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
7836
+ return null;
7705
7837
  }
7838
+ return groups;
7839
+ }
7840
+ function ipv4FromGroups(high, low) {
7841
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
7842
+ }
7843
+ function embeddedIPv4(ip) {
7844
+ const g = parseIPv6Groups(ip);
7845
+ if (!g) return null;
7846
+ const zeros = (from, to) => g.slice(from, to).every((group) => group === 0);
7847
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
7848
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
7849
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
7850
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
7851
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
7852
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
7853
+ return null;
7854
+ }
7855
+ function isPrivateIPv6(ip) {
7856
+ const g = parseIPv6Groups(ip);
7857
+ if (!g) {
7858
+ const lower = ip.toLowerCase();
7859
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
7860
+ }
7861
+ if (g.every((group) => group === 0)) return true;
7862
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
7863
+ if ((g[0] & 65024) === 64512) return true;
7864
+ if ((g[0] & 65472) === 65152) return true;
7865
+ if ((g[0] & 65472) === 65216) return true;
7866
+ if ((g[0] & 65280) === 65280) return true;
7867
+ if (g[0] === 8193 && g[1] === 3512) return true;
7868
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
7869
+ const v4 = embeddedIPv4(ip);
7870
+ if (v4 && isPrivateIPv4(v4)) return true;
7706
7871
  return false;
7707
7872
  }
7708
7873
  var IMAGE_CAPTURE_DELAY_MS = 500;
package/dist/index.js CHANGED
@@ -471,6 +471,13 @@ var PLATFORM_DEFAULT_MERGE_POLICY = Object.freeze({
471
471
  allowedMergeMethods: ["squash"],
472
472
  protectedBranches: ["main", "master", "develop", "stage"]
473
473
  });
474
+ var MERGE_POLICY_PROTECTED_BRANCH_FLOOR = Object.freeze([
475
+ "main",
476
+ "master",
477
+ "develop",
478
+ "stage"
479
+ ]);
480
+ var MERGE_POLICY_ALWAYS_APPROVED_BRANCHES = Object.freeze(["main", "master"]);
474
481
  var MERGE_APPROVAL_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
475
482
  var TOOL_GRANT_SCOPE_PRECEDENCE = Object.freeze([
476
483
  "tenant",
@@ -1183,6 +1190,111 @@ var FLEET_HEALTH_DISK_CRITICAL_MARGIN_BYTES = 1024 ** 3;
1183
1190
  var FLEET_HEALTH_MAX_MIB = 2 ** 40;
1184
1191
  var FLEET_HEALTH_MAX_UPTIME_SEC = 100 * 365 * 24 * 60 * 60;
1185
1192
  var FLEET_HEALTH_BYTES_PER_MIB = 1024 * 1024;
1193
+ var FLEET_RUN_TOKEN_ROUTES = Object.freeze([
1194
+ // Works — reads, plus the settings update (its merge / check / command
1195
+ // fields are refused for run tokens by the Works controller).
1196
+ { method: "GET", pathPattern: "/api/works" },
1197
+ { method: "GET", pathPattern: "/api/works/{id}" },
1198
+ { method: "PUT", pathPattern: "/api/works/{id}" },
1199
+ { method: "GET", pathPattern: "/api/works/{id}/config" },
1200
+ { method: "GET", pathPattern: "/api/works/{id}/items" },
1201
+ { method: "GET", pathPattern: "/api/works/{id}/categories-tags" },
1202
+ { method: "GET", pathPattern: "/api/works/{id}/history" },
1203
+ { method: "GET", pathPattern: "/api/works/{id}/generator-form" },
1204
+ { method: "GET", pathPattern: "/api/works/{id}/schedule" },
1205
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons" },
1206
+ { method: "GET", pathPattern: "/api/works/{id}/comparisons/{slug}" },
1207
+ // Knowledge Base (`apps/mcp/src/tools/kb`). A document a run token writes
1208
+ // lands `proposed` (review-gated), see the KB controller. No unlock.
1209
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents" },
1210
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents" },
1211
+ { method: "GET", pathPattern: "/api/works/{id}/kb/documents/{docIdOrPath}" },
1212
+ { method: "PATCH", pathPattern: "/api/works/{id}/kb/documents/{docId}" },
1213
+ { method: "POST", pathPattern: "/api/works/{id}/kb/documents/{docId}/lock" },
1214
+ // Deploy — reads and the capability check only.
1215
+ { method: "GET", pathPattern: "/api/deploy/works/{id}/domains" },
1216
+ { method: "GET", pathPattern: "/api/deploy/providers" },
1217
+ { method: "POST", pathPattern: "/api/deploy/works/{id}/check" },
1218
+ // Plugins — read only.
1219
+ { method: "GET", pathPattern: "/api/plugins" },
1220
+ { method: "GET", pathPattern: "/api/plugins/{pluginId}" },
1221
+ // Missions — reads, plus pause (the safe direction).
1222
+ { method: "GET", pathPattern: "/api/me/missions" },
1223
+ { method: "GET", pathPattern: "/api/me/missions/{id}" },
1224
+ { method: "GET", pathPattern: "/api/me/missions/{id}/budget" },
1225
+ { method: "GET", pathPattern: "/api/me/missions/{id}/works" },
1226
+ { method: "POST", pathPattern: "/api/me/missions/{id}/pause" },
1227
+ // Ideas — reads, plus filing a new Idea (a proposal a person builds).
1228
+ { method: "POST", pathPattern: "/api/me/work-proposals" },
1229
+ { method: "GET", pathPattern: "/api/me/work-proposals" },
1230
+ { method: "GET", pathPattern: "/api/me/work-proposals/status" },
1231
+ { method: "GET", pathPattern: "/api/me/work-proposals/preferences" },
1232
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}" },
1233
+ { method: "GET", pathPattern: "/api/me/work-proposals/{id}/budget" },
1234
+ // Account-wide usage.
1235
+ { method: "GET", pathPattern: "/api/me/usage/account-wide" },
1236
+ // Tasks — reads and collaboration writes. Create / update / transition /
1237
+ // assign / chat carry body refusals for run tokens in the Tasks
1238
+ // controller (no checks, no schedule, no force, no dispatch, no @agent).
1239
+ { method: "GET", pathPattern: "/api/tasks" },
1240
+ { method: "POST", pathPattern: "/api/tasks" },
1241
+ { method: "GET", pathPattern: "/api/tasks/{id}" },
1242
+ { method: "PATCH", pathPattern: "/api/tasks/{id}" },
1243
+ { method: "GET", pathPattern: "/api/tasks/{id}/subtasks" },
1244
+ { method: "GET", pathPattern: "/api/tasks/{id}/activity" },
1245
+ { method: "POST", pathPattern: "/api/tasks/{id}/transition" },
1246
+ { method: "GET", pathPattern: "/api/tasks/{id}/run-candidates" },
1247
+ { method: "GET", pathPattern: "/api/tasks/{id}/pr-status" },
1248
+ { method: "GET", pathPattern: "/api/tasks/{id}/diff" },
1249
+ { method: "POST", pathPattern: "/api/tasks/{id}/assignees" },
1250
+ { method: "POST", pathPattern: "/api/tasks/{id}/reviewers" },
1251
+ { method: "POST", pathPattern: "/api/tasks/{id}/approvers" },
1252
+ { method: "POST", pathPattern: "/api/tasks/{id}/relations" },
1253
+ { method: "GET", pathPattern: "/api/tasks/{id}/escalations" },
1254
+ { method: "GET", pathPattern: "/api/tasks/{id}/chat" },
1255
+ { method: "POST", pathPattern: "/api/tasks/{id}/chat" },
1256
+ { method: "GET", pathPattern: "/api/tasks/{id}/spend" },
1257
+ // Inbox — read only (no reply, no archive / delete / mark-read).
1258
+ { method: "GET", pathPattern: "/api/inbox" },
1259
+ { method: "GET", pathPattern: "/api/inbox/unread-count" },
1260
+ { method: "GET", pathPattern: "/api/inbox/{id}" },
1261
+ // Goals — reads, a draft create, field-limited update, pause, and the
1262
+ // ASKING side of the definition of done (propose, never approve).
1263
+ { method: "GET", pathPattern: "/api/me/goals" },
1264
+ { method: "POST", pathPattern: "/api/me/goals" },
1265
+ { method: "GET", pathPattern: "/api/me/goals/{id}" },
1266
+ { method: "PATCH", pathPattern: "/api/me/goals/{id}" },
1267
+ { method: "GET", pathPattern: "/api/me/goals/{id}/samples" },
1268
+ { method: "POST", pathPattern: "/api/me/goals/{id}/pause" },
1269
+ { method: "POST", pathPattern: "/api/me/goals/{id}/dod/propose" },
1270
+ // Fleet — reads only.
1271
+ { method: "GET", pathPattern: "/api/fleet/nodes" },
1272
+ { method: "GET", pathPattern: "/api/fleet/nodes/{id}" },
1273
+ { method: "GET", pathPattern: "/api/fleet/runner-status" },
1274
+ { method: "GET", pathPattern: "/api/fleet/execution-preferences" },
1275
+ { method: "GET", pathPattern: "/api/fleet/agents/{agentId}/node-affinity" },
1276
+ // Agents — reads, plus cancel and pause (the safe direction).
1277
+ { method: "GET", pathPattern: "/api/agents" },
1278
+ { method: "GET", pathPattern: "/api/agents/{id}" },
1279
+ { method: "GET", pathPattern: "/api/agents/{id}/runs" },
1280
+ { method: "GET", pathPattern: "/api/agents/{id}/runs/{runId}" },
1281
+ { method: "POST", pathPattern: "/api/agents/{id}/runs/{runId}/cancel" },
1282
+ { method: "POST", pathPattern: "/api/agents/{id}/pause" },
1283
+ { method: "GET", pathPattern: "/api/agents/{id}/budget" },
1284
+ // Agent Plugins — read only (installing a package installs instructions).
1285
+ { method: "GET", pathPattern: "/api/agent-plugins" },
1286
+ { method: "GET", pathPattern: "/api/agent-plugins/findings" },
1287
+ { method: "GET", pathPattern: "/api/agent-plugins/catalog" },
1288
+ { method: "GET", pathPattern: "/api/agent-plugins/updates" }
1289
+ ]);
1290
+ var MACHINE_PRINCIPAL_WORK_WRITABLE_FIELDS = Object.freeze(["name", "description"]);
1291
+ function splitSegments(normalizedPath) {
1292
+ return normalizedPath.split("/").filter((segment) => segment.length > 0);
1293
+ }
1294
+ var FLEET_RUN_TOKEN_ROUTE_SHAPES = FLEET_RUN_TOKEN_ROUTES.map((route) => ({
1295
+ method: route.method.toUpperCase(),
1296
+ shape: splitSegments(route.pathPattern).map((part) => /^\{[^}]+\}$/.test(part) ? "*" : part.toLowerCase())
1297
+ }));
1186
1298
  var EMAIL_INBOX_DEFAULT_DAILY_CAP = 100;
1187
1299
  var EMAIL_INBOX_BURST_SENDS = 10;
1188
1300
  var EMAIL_INBOX_BURST_RECIPIENTS = 20;
@@ -1724,9 +1836,15 @@ var INTEGRATION_SCOPES = [
1724
1836
  "email:write",
1725
1837
  "events:read",
1726
1838
  "webhooks:manage",
1727
- "links:write"
1839
+ "links:write",
1840
+ "merges:decide"
1841
+ ];
1842
+ var INTEGRATION_MERGE_DECISION_SCOPE = "merges:decide";
1843
+ var INTEGRATION_OPT_IN_SCOPES = [
1844
+ "org:write",
1845
+ "email:write",
1846
+ INTEGRATION_MERGE_DECISION_SCOPE
1728
1847
  ];
1729
- var INTEGRATION_OPT_IN_SCOPES = ["org:write", "email:write"];
1730
1848
  var EVER_GAUZY_PRESET_SCOPES = INTEGRATION_SCOPES.filter(
1731
1849
  (scope) => !INTEGRATION_OPT_IN_SCOPES.includes(scope)
1732
1850
  );
@@ -7624,6 +7742,7 @@ function isSafeWebhookUrl(rawUrl) {
7624
7742
  if (host.startsWith("[") && host.endsWith("]")) {
7625
7743
  host = host.slice(1, -1);
7626
7744
  }
7745
+ host = host.replace(/\.+$/, "");
7627
7746
  if (CLOUD_METADATA_HOSTNAMES.has(host)) {
7628
7747
  return false;
7629
7748
  }
@@ -7653,23 +7772,69 @@ function isPrivateIPv4(ip) {
7653
7772
  if (a === 172 && b >= 16 && b <= 31) return true;
7654
7773
  if (a === 192 && b === 168) return true;
7655
7774
  if (a === 192 && b === 0 && parts[2] === 0) return true;
7775
+ if (a === 198 && (b === 18 || b === 19)) return true;
7776
+ if (a === 192 && b === 0 && parts[2] === 2) return true;
7777
+ if (a === 198 && b === 51 && parts[2] === 100) return true;
7778
+ if (a === 203 && b === 0 && parts[2] === 113) return true;
7656
7779
  if (a === 100 && b >= 64 && b <= 127) return true;
7657
7780
  if (a >= 224) return true;
7658
7781
  return false;
7659
7782
  }
7660
- function isPrivateIPv6(ip) {
7661
- const lower = ip.toLowerCase();
7662
- if (lower === "::1" || lower === "::") return true;
7663
- if (lower.startsWith("fc") || lower.startsWith("fd")) return true;
7664
- const firstHextet = lower.split(":", 1)[0];
7665
- if (/^[0-9a-f]{1,4}$/.test(firstHextet)) {
7666
- const group0 = parseInt(firstHextet, 16);
7667
- if ((group0 & 65472) === 65152) return true;
7668
- }
7669
- if (lower.startsWith("::ffff:")) {
7670
- const v4 = lower.slice("::ffff:".length);
7671
- if (isIP(v4) === 4) return isPrivateIPv4(v4);
7783
+ function parseIPv6Groups(ip) {
7784
+ let text = ip.trim().toLowerCase();
7785
+ const zone = text.indexOf("%");
7786
+ if (zone >= 0) text = text.slice(0, zone);
7787
+ if (isIP(text) !== 6) return null;
7788
+ const lastColon = text.lastIndexOf(":");
7789
+ const tail = text.slice(lastColon + 1);
7790
+ if (tail.includes(".")) {
7791
+ if (isIP(tail) !== 4) return null;
7792
+ const [a, b, c, d] = tail.split(".").map((part) => Number(part));
7793
+ text = `${text.slice(0, lastColon + 1)}${(a << 8 | b).toString(16)}:${(c << 8 | d).toString(16)}`;
7794
+ }
7795
+ const halves = text.split("::");
7796
+ if (halves.length > 2) return null;
7797
+ const head = halves[0] ? halves[0].split(":") : [];
7798
+ const rest = halves.length === 2 && halves[1] ? halves[1].split(":") : [];
7799
+ const fill = halves.length === 2 ? 8 - head.length - rest.length : 0;
7800
+ if (fill < 0) return null;
7801
+ const groups = [...head, ...new Array(fill).fill("0"), ...rest].map((group) => parseInt(group, 16));
7802
+ if (groups.length !== 8 || groups.some((group) => Number.isNaN(group) || group < 0 || group > 65535)) {
7803
+ return null;
7672
7804
  }
7805
+ return groups;
7806
+ }
7807
+ function ipv4FromGroups(high, low) {
7808
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
7809
+ }
7810
+ function embeddedIPv4(ip) {
7811
+ const g = parseIPv6Groups(ip);
7812
+ if (!g) return null;
7813
+ const zeros = (from, to) => g.slice(from, to).every((group) => group === 0);
7814
+ if (zeros(0, 5) && g[5] === 65535) return ipv4FromGroups(g[6], g[7]);
7815
+ if (zeros(0, 4) && g[4] === 65535 && g[5] === 0) return ipv4FromGroups(g[6], g[7]);
7816
+ if (zeros(0, 6) && (g[6] !== 0 || g[7] > 1)) return ipv4FromGroups(g[6], g[7]);
7817
+ if (g[0] === 100 && g[1] === 65435 && zeros(2, 6)) return ipv4FromGroups(g[6], g[7]);
7818
+ if (g[0] === 8194) return ipv4FromGroups(g[1], g[2]);
7819
+ if (g[0] === 8193 && g[1] === 0) return ipv4FromGroups(g[6] ^ 65535, g[7] ^ 65535);
7820
+ return null;
7821
+ }
7822
+ function isPrivateIPv6(ip) {
7823
+ const g = parseIPv6Groups(ip);
7824
+ if (!g) {
7825
+ const lower = ip.toLowerCase();
7826
+ return lower === "::1" || lower === "::" || lower.startsWith("fc") || lower.startsWith("fd");
7827
+ }
7828
+ if (g.every((group) => group === 0)) return true;
7829
+ if (g.slice(0, 7).every((group) => group === 0) && g[7] === 1) return true;
7830
+ if ((g[0] & 65024) === 64512) return true;
7831
+ if ((g[0] & 65472) === 65152) return true;
7832
+ if ((g[0] & 65472) === 65216) return true;
7833
+ if ((g[0] & 65280) === 65280) return true;
7834
+ if (g[0] === 8193 && g[1] === 3512) return true;
7835
+ if (g[0] === 100 && g[1] === 65435 && g[2] === 1) return true;
7836
+ const v4 = embeddedIPv4(ip);
7837
+ if (v4 && isPrivateIPv4(v4)) return true;
7673
7838
  return false;
7674
7839
  }
7675
7840
  var IMAGE_CAPTURE_DELAY_MS = 500;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ever-works/opencode-plugin",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "OpenCode Generator Plugin - Full pipeline plugin that delegates generation to OpenCode",
5
5
  "author": {
6
6
  "name": "Ever Co. LTD",
@@ -33,14 +33,14 @@
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
  "dependencies": {
39
39
  "extract-zip": "^2.0.1",
40
40
  "tar": "^7.5.21"
41
41
  },
42
42
  "devDependencies": {
43
- "@ever-works/plugin": "^1.2.6",
43
+ "@ever-works/plugin": "^1.2.9",
44
44
  "@types/node": "^26.6.4",
45
45
  "tsup": "^8.0.0",
46
46
  "typescript": "^5.9.3",
@@ -78,8 +78,8 @@
78
78
  "url": "https://github.com/ever-works/ever-works/issues"
79
79
  },
80
80
  "everworksRelease": {
81
- "contentHash": "sha256:5129c5da3e1066b23df241e8695c2324ae1f3ee2192924ed94b698301bc8e821",
82
- "commit": "eff002871bfd7f9f8e0f984907f45265ae8b01e0",
83
- "source": "https://github.com/ever-works/ever-works/tree/eff002871bfd7f9f8e0f984907f45265ae8b01e0/packages/plugins/opencode"
81
+ "contentHash": "sha256:efe5c09da9143d6ee0fd057449ac1e8ca67f216b08399c1996fb03d79291f460",
82
+ "commit": "5b5a17e1cdc02e06383d508a6424a863521fc3e0",
83
+ "source": "https://github.com/ever-works/ever-works/tree/5b5a17e1cdc02e06383d508a6424a863521fc3e0/packages/plugins/opencode"
84
84
  }
85
85
  }