@taskless-app/swarm 0.6.32 → 0.6.34

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/cli.js +43 -11
  2. package/dist/overmind.js +694 -198
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1202,6 +1202,37 @@ var init_runGuards = __esm({
1202
1202
  }
1203
1203
  });
1204
1204
 
1205
+ // ../swarm-core/src/taskWeight.ts
1206
+ function isHeavyGrantEvent(e) {
1207
+ return has(e, HEAVY_GRANT_MARK);
1208
+ }
1209
+ function grantedCeilingUsd(events) {
1210
+ let max = null;
1211
+ for (const e of events) {
1212
+ if (!isHeavyGrantEvent(e)) continue;
1213
+ const m = /потолок \$([0-9]+(?:\.[0-9]+)?)/.exec(e.text ?? "");
1214
+ if (!m) continue;
1215
+ const v = Number(m[1]);
1216
+ if (Number.isFinite(v) && (max == null || v > max)) max = v;
1217
+ }
1218
+ return max;
1219
+ }
1220
+ function effectiveCostCeilingUsd(baseUsd, events) {
1221
+ if (!(baseUsd > 0)) return baseUsd;
1222
+ const granted = grantedCeilingUsd(events);
1223
+ if (granted == null) return baseUsd;
1224
+ return Math.min(Math.max(baseUsd, granted), baseUsd * HEAVY_CEILING_MAX_FACTOR);
1225
+ }
1226
+ var HEAVY_CEILING_MAX_FACTOR, HEAVY_GRANT_MARK, has;
1227
+ var init_taskWeight = __esm({
1228
+ "../swarm-core/src/taskWeight.ts"() {
1229
+ "use strict";
1230
+ HEAVY_CEILING_MAX_FACTOR = 2;
1231
+ HEAVY_GRANT_MARK = "\u0432\u0435\u0441 \u043F\u0440\u043E\u0433\u043E\u043D\u0430: \u0442\u044F\u0436\u0451\u043B\u0430\u044F";
1232
+ has = (e, mark) => !!e.text?.includes(mark);
1233
+ }
1234
+ });
1235
+
1205
1236
  // ../swarm-core/src/codeZones.ts
1206
1237
  function hasZoneModel(m) {
1207
1238
  return m.tasks > 0 && m.zones.length > 0;
@@ -1661,6 +1692,7 @@ var init_src = __esm({
1661
1692
  init_cost();
1662
1693
  init_modelPricing();
1663
1694
  init_runGuards();
1695
+ init_taskWeight();
1664
1696
  init_codeZones();
1665
1697
  init_effort();
1666
1698
  init_queuePlan();
@@ -3242,7 +3274,7 @@ var init_package = __esm({
3242
3274
  "package.json"() {
3243
3275
  package_default = {
3244
3276
  name: "@taskless-app/swarm",
3245
- version: "0.6.32",
3277
+ version: "0.6.34",
3246
3278
  type: "module",
3247
3279
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
3248
3280
  keywords: [
@@ -3293,7 +3325,7 @@ var init_package = __esm({
3293
3325
  execa: "^10.0.0",
3294
3326
  zod: "3.25.76"
3295
3327
  },
3296
- gitHead: "f40f0fb4d2f96809f88b7d6ae4f086c5f4f004da"
3328
+ gitHead: "4eabd911d4dfd557bfbfcbc27afd36415714b7eb"
3297
3329
  };
3298
3330
  }
3299
3331
  });
@@ -6077,10 +6109,10 @@ function detectPlatformKind(io = {}) {
6077
6109
  function detectSystemPm(kind, io = {}) {
6078
6110
  const env = io.env ?? process.env;
6079
6111
  const platform = io.platform ?? process.platform;
6080
- const has = io.hasCommand ?? ((n) => hasCommandInPath(n, env, platform));
6081
- if (kind === "macos") return has("brew") ? "brew" : null;
6082
- if (kind === "windows") return has("winget") ? "winget" : null;
6083
- return LINUX_PMS.find((p) => has(p.cmd))?.pm ?? null;
6112
+ const has2 = io.hasCommand ?? ((n) => hasCommandInPath(n, env, platform));
6113
+ if (kind === "macos") return has2("brew") ? "brew" : null;
6114
+ if (kind === "windows") return has2("winget") ? "winget" : null;
6115
+ return LINUX_PMS.find((p) => has2(p.cmd))?.pm ?? null;
6084
6116
  }
6085
6117
  function detectPlatform(io = {}) {
6086
6118
  const kind = detectPlatformKind(io);
@@ -6120,8 +6152,8 @@ function detectGlobalPm(entry, io = {}) {
6120
6152
  if (/\/node_modules\//.test(p)) return "npm";
6121
6153
  const env = io.env ?? process.env;
6122
6154
  const platform = io.platform ?? process.platform;
6123
- const has = io.hasCommand ?? ((n) => hasCommandInPath(n, env, platform));
6124
- return has("npm") ? "npm" : "unknown";
6155
+ const has2 = io.hasCommand ?? ((n) => hasCommandInPath(n, env, platform));
6156
+ return has2("npm") ? "npm" : "unknown";
6125
6157
  }
6126
6158
  function globalInstallCommand(pm, spec) {
6127
6159
  switch (pm) {
@@ -11939,8 +11971,8 @@ function resolveTsxCli() {
11939
11971
  }
11940
11972
  }
11941
11973
  var MCP_SERVER_NAME = "overmind";
11942
- function launchBudgetUsd(limit, spentUsd, env = process.env) {
11943
- return remainingRunBudgetUsd(limit ?? envCapUsd(env), spentUsd);
11974
+ function launchBudgetUsd(limit, spentUsd, env = process.env, weightEvents = []) {
11975
+ return remainingRunBudgetUsd(effectiveCostCeilingUsd(limit ?? envCapUsd(env), weightEvents), spentUsd);
11944
11976
  }
11945
11977
  function envCapUsd(env) {
11946
11978
  const raw = env.SWARM_MAX_COST_USD;
@@ -12106,7 +12138,7 @@ function makeLauncher(cfg) {
12106
12138
  // момент её совершения. Прод-сторож остаётся страховкой, но он по устройству видит
12107
12139
  // стоимость только по записанному итогу: живой прогон стоит для него ноль, сколько бы
12108
12140
  // ни жёг, — отсюда и $74 при лимите $20.
12109
- maxBudgetUsd: launchBudgetUsd(cfg.maxCostUsd?.() ?? null, run.cost_usd),
12141
+ maxBudgetUsd: launchBudgetUsd(cfg.maxCostUsd?.() ?? null, run.cost_usd, process.env, cfg.weightEvents?.(run) ?? []),
12110
12142
  // TASWM-395: усилие рассуждения — харнессу флагом (claude `--effort`). null = флага нет.
12111
12143
  effort
12112
12144
  });