@taskless-app/swarm 0.6.86 → 0.6.87

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/dist/cli.js CHANGED
@@ -2834,6 +2834,57 @@ function parseGrokResult(raw) {
2834
2834
  if (aborted) result.aborted = aborted;
2835
2835
  return result;
2836
2836
  }
2837
+ function grokProbeOkFromOutput(out) {
2838
+ const rec = readGrokProbeRecord(out);
2839
+ if (!rec) return false;
2840
+ return typeof rec.text === "string" && rec.text.trim().length > 0 && (rec.stopReason === "max_turn_requests" || rec.stopReason === "end_turn");
2841
+ }
2842
+ function readGrokProbeRecord(out) {
2843
+ const line = out.split(/\r?\n/).find((item) => item.trimStart().startsWith("{"));
2844
+ if (line) {
2845
+ const parsed = parseJsonObject(line.trim());
2846
+ if (parsed) return parsed;
2847
+ }
2848
+ const whole = parseJsonObject(out.trim());
2849
+ if (whole) return whole;
2850
+ const sliced = extractJsonObject(out);
2851
+ return sliced ? parseJsonObject(sliced) : null;
2852
+ }
2853
+ function parseJsonObject(raw) {
2854
+ try {
2855
+ const parsed = JSON.parse(raw);
2856
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
2857
+ return parsed;
2858
+ } catch {
2859
+ return null;
2860
+ }
2861
+ }
2862
+ function extractJsonObject(raw) {
2863
+ const start = raw.indexOf("{");
2864
+ if (start < 0) return null;
2865
+ let depth = 0;
2866
+ let inString = false;
2867
+ let escape = false;
2868
+ for (let i = start; i < raw.length; i++) {
2869
+ const ch = raw[i];
2870
+ if (inString) {
2871
+ if (escape) escape = false;
2872
+ else if (ch === "\\") escape = true;
2873
+ else if (ch === '"') inString = false;
2874
+ continue;
2875
+ }
2876
+ if (ch === '"') {
2877
+ inString = true;
2878
+ continue;
2879
+ }
2880
+ if (ch === "{") depth++;
2881
+ else if (ch === "}") {
2882
+ depth--;
2883
+ if (depth === 0) return raw.slice(start, i + 1);
2884
+ }
2885
+ }
2886
+ return null;
2887
+ }
2837
2888
  var grokExecutor;
2838
2889
  var init_grok = __esm({
2839
2890
  "src/executors/grok.ts"() {
@@ -2896,7 +2947,8 @@ ${notice}` : spec.prompt;
2896
2947
  probe: {
2897
2948
  args: ["-p", "ok", "--output-format", "json", "--yolo", "--max-turns", "1", "--no-auto-update"],
2898
2949
  limitPattern: /usage limit/i,
2899
- authPattern: /not logged in|unauthorized|\b401\b|authentication required|auth required/i
2950
+ authPattern: /not logged in|unauthorized|\b401\b|authentication required|auth required/i,
2951
+ okFromOutput: grokProbeOkFromOutput
2900
2952
  }
2901
2953
  };
2902
2954
  }
@@ -4152,7 +4204,7 @@ var init_package = __esm({
4152
4204
  "package.json"() {
4153
4205
  package_default = {
4154
4206
  name: "@taskless-app/swarm",
4155
- version: "0.6.86",
4207
+ version: "0.6.87",
4156
4208
  type: "module",
4157
4209
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
4158
4210
  keywords: [
@@ -4204,7 +4256,7 @@ var init_package = __esm({
4204
4256
  undici: "^7.30.1",
4205
4257
  zod: "3.25.76"
4206
4258
  },
4207
- gitHead: "84b730050d788642d08a1cd14baf487b7e8298eb"
4259
+ gitHead: "68dc6ddb7ee57e70257f8164aa55db3615dc16be"
4208
4260
  };
4209
4261
  }
4210
4262
  });
@@ -13610,10 +13662,24 @@ function droneTestEnv(droneCap, base3 = process.env, host = hostForkSpec()) {
13610
13662
  const envCap = Number(base3.SWARM_MAX_IN_FLIGHT);
13611
13663
  const cap = droneCap != null && droneCap > 0 ? droneCap : Number.isFinite(envCap) && envCap > 0 ? envCap : 3;
13612
13664
  const share = String(testForksPerDrone(host.cores, host.totalMemGb, cap));
13613
- const operatorForks = /^[1-9]\d*$/.test(base3.TEST_MAX_FORKS ?? "") ? base3.TEST_MAX_FORKS : void 0;
13665
+ const positiveInt = (v) => /^[1-9]\d*$/.test(v ?? "") ? v : void 0;
13666
+ const operatorForks = positiveInt(base3.TEST_MAX_FORKS);
13667
+ const workers = operatorForks ?? share;
13668
+ const legacyMax = positiveInt(base3.VITEST_MAX_WORKERS) ?? workers;
13669
+ const legacyPair = (max, min) => {
13670
+ const out = {};
13671
+ if (!base3[min]) out[min] = "1";
13672
+ if (!base3[max]) {
13673
+ const opMin = positiveInt(base3[min]);
13674
+ out[max] = opMin && Number(opMin) > Number(legacyMax) ? opMin : legacyMax;
13675
+ }
13676
+ return out;
13677
+ };
13614
13678
  return {
13615
13679
  ...base3.TEST_MAX_FORKS ? {} : { TEST_MAX_FORKS: share },
13616
- ...base3.VITEST_MAX_WORKERS ? {} : { VITEST_MAX_WORKERS: operatorForks ?? share }
13680
+ ...base3.VITEST_MAX_WORKERS ? {} : { VITEST_MAX_WORKERS: workers },
13681
+ ...legacyPair("VITEST_MAX_FORKS", "VITEST_MIN_FORKS"),
13682
+ ...legacyPair("VITEST_MAX_THREADS", "VITEST_MIN_THREADS")
13617
13683
  };
13618
13684
  }
13619
13685
 
package/dist/overmind.js CHANGED
@@ -1301,7 +1301,10 @@ var init_hostResources = __esm({
1301
1301
  });
1302
1302
 
1303
1303
  // ../swarm-core/src/hostPool.ts
1304
- var HOST_REJECTION_TEXT, HOST_REPO_BLOCK_TEXT;
1304
+ function isFileHoldEvent(text) {
1305
+ return typeof text === "string" && text.endsWith(FILE_HOLD_EVENT_SUFFIX);
1306
+ }
1307
+ var HOST_REJECTION_TEXT, HOST_REPO_BLOCK_TEXT, FILE_HOLD_EVENT_SUFFIX;
1305
1308
  var init_hostPool = __esm({
1306
1309
  "../swarm-core/src/hostPool.ts"() {
1307
1310
  "use strict";
@@ -1323,6 +1326,7 @@ var init_hostPool = __esm({
1323
1326
  no_clone: "\u043A\u043B\u043E\u043D\u0430 \u043D\u0435\u0442",
1324
1327
  repo_off: "\u0440\u0430\u0431\u043E\u0442\u0430 \u043F\u043E \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u044E \u0432\u044B\u043A\u043B\u044E\u0447\u0435\u043D\u0430"
1325
1328
  };
1329
+ FILE_HOLD_EVENT_SUFFIX = " \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 (TASWM-348)";
1326
1330
  }
1327
1331
  });
1328
1332
 
@@ -3074,6 +3078,57 @@ function parseGrokResult(raw) {
3074
3078
  if (aborted) result.aborted = aborted;
3075
3079
  return result;
3076
3080
  }
3081
+ function grokProbeOkFromOutput(out) {
3082
+ const rec = readGrokProbeRecord(out);
3083
+ if (!rec) return false;
3084
+ return typeof rec.text === "string" && rec.text.trim().length > 0 && (rec.stopReason === "max_turn_requests" || rec.stopReason === "end_turn");
3085
+ }
3086
+ function readGrokProbeRecord(out) {
3087
+ const line = out.split(/\r?\n/).find((item) => item.trimStart().startsWith("{"));
3088
+ if (line) {
3089
+ const parsed = parseJsonObject(line.trim());
3090
+ if (parsed) return parsed;
3091
+ }
3092
+ const whole = parseJsonObject(out.trim());
3093
+ if (whole) return whole;
3094
+ const sliced = extractJsonObject(out);
3095
+ return sliced ? parseJsonObject(sliced) : null;
3096
+ }
3097
+ function parseJsonObject(raw) {
3098
+ try {
3099
+ const parsed = JSON.parse(raw);
3100
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
3101
+ return parsed;
3102
+ } catch {
3103
+ return null;
3104
+ }
3105
+ }
3106
+ function extractJsonObject(raw) {
3107
+ const start = raw.indexOf("{");
3108
+ if (start < 0) return null;
3109
+ let depth = 0;
3110
+ let inString = false;
3111
+ let escape = false;
3112
+ for (let i = start; i < raw.length; i++) {
3113
+ const ch = raw[i];
3114
+ if (inString) {
3115
+ if (escape) escape = false;
3116
+ else if (ch === "\\") escape = true;
3117
+ else if (ch === '"') inString = false;
3118
+ continue;
3119
+ }
3120
+ if (ch === '"') {
3121
+ inString = true;
3122
+ continue;
3123
+ }
3124
+ if (ch === "{") depth++;
3125
+ else if (ch === "}") {
3126
+ depth--;
3127
+ if (depth === 0) return raw.slice(start, i + 1);
3128
+ }
3129
+ }
3130
+ return null;
3131
+ }
3077
3132
  var grokExecutor;
3078
3133
  var init_grok = __esm({
3079
3134
  "src/executors/grok.ts"() {
@@ -3136,7 +3191,8 @@ ${notice}` : spec.prompt;
3136
3191
  probe: {
3137
3192
  args: ["-p", "ok", "--output-format", "json", "--yolo", "--max-turns", "1", "--no-auto-update"],
3138
3193
  limitPattern: /usage limit/i,
3139
- authPattern: /not logged in|unauthorized|\b401\b|authentication required|auth required/i
3194
+ authPattern: /not logged in|unauthorized|\b401\b|authentication required|auth required/i,
3195
+ okFromOutput: grokProbeOkFromOutput
3140
3196
  }
3141
3197
  };
3142
3198
  }
@@ -12084,10 +12140,24 @@ function droneTestEnv(droneCap, base3 = process.env, host = hostForkSpec()) {
12084
12140
  const envCap = Number(base3.SWARM_MAX_IN_FLIGHT);
12085
12141
  const cap = droneCap != null && droneCap > 0 ? droneCap : Number.isFinite(envCap) && envCap > 0 ? envCap : 3;
12086
12142
  const share = String(testForksPerDrone(host.cores, host.totalMemGb, cap));
12087
- const operatorForks = /^[1-9]\d*$/.test(base3.TEST_MAX_FORKS ?? "") ? base3.TEST_MAX_FORKS : void 0;
12143
+ const positiveInt = (v) => /^[1-9]\d*$/.test(v ?? "") ? v : void 0;
12144
+ const operatorForks = positiveInt(base3.TEST_MAX_FORKS);
12145
+ const workers = operatorForks ?? share;
12146
+ const legacyMax = positiveInt(base3.VITEST_MAX_WORKERS) ?? workers;
12147
+ const legacyPair = (max, min) => {
12148
+ const out = {};
12149
+ if (!base3[min]) out[min] = "1";
12150
+ if (!base3[max]) {
12151
+ const opMin = positiveInt(base3[min]);
12152
+ out[max] = opMin && Number(opMin) > Number(legacyMax) ? opMin : legacyMax;
12153
+ }
12154
+ return out;
12155
+ };
12088
12156
  return {
12089
12157
  ...base3.TEST_MAX_FORKS ? {} : { TEST_MAX_FORKS: share },
12090
- ...base3.VITEST_MAX_WORKERS ? {} : { VITEST_MAX_WORKERS: operatorForks ?? share }
12158
+ ...base3.VITEST_MAX_WORKERS ? {} : { VITEST_MAX_WORKERS: workers },
12159
+ ...legacyPair("VITEST_MAX_FORKS", "VITEST_MIN_FORKS"),
12160
+ ...legacyPair("VITEST_MAX_THREADS", "VITEST_MIN_THREADS")
12091
12161
  };
12092
12162
  }
12093
12163
 
@@ -12900,6 +12970,7 @@ function createModelLimitsPoller(options) {
12900
12970
 
12901
12971
  // src/overmind.ts
12902
12972
  init_src();
12973
+ init_src();
12903
12974
 
12904
12975
  // src/orchestrator.ts
12905
12976
  init_src();
@@ -13915,7 +13986,7 @@ function parkReasonUnretriable(reason) {
13915
13986
  // package.json
13916
13987
  var package_default = {
13917
13988
  name: "@taskless-app/swarm",
13918
- version: "0.6.86",
13989
+ version: "0.6.87",
13919
13990
  type: "module",
13920
13991
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
13921
13992
  keywords: [
@@ -13967,7 +14038,7 @@ var package_default = {
13967
14038
  undici: "^7.30.1",
13968
14039
  zod: "3.25.76"
13969
14040
  },
13970
- gitHead: "84b730050d788642d08a1cd14baf487b7e8298eb"
14041
+ gitHead: "68dc6ddb7ee57e70257f8164aa55db3615dc16be"
13971
14042
  };
13972
14043
 
13973
14044
  // src/version.ts
@@ -19710,6 +19781,9 @@ function executorHealthy(opts = {}) {
19710
19781
  if (executor.probe.authPattern?.test(out)) {
19711
19782
  return finish({ ok: false, reason: "auth", resetHint: null });
19712
19783
  }
19784
+ if (executor.probe.okFromOutput?.(out, code) === true) {
19785
+ return finish({ ok: true, reason: "ok", resetHint: null });
19786
+ }
19713
19787
  finish({ ok: false, reason: "provider", resetHint: null });
19714
19788
  });
19715
19789
  });
@@ -22723,9 +22797,10 @@ async function spawnQueuedRun(deps, run2) {
22723
22797
  }
22724
22798
  if (e instanceof FileOverlapError) {
22725
22799
  const logged = deps.overlapLogged ??= /* @__PURE__ */ new Map();
22800
+ const holdText = `${e.message}${FILE_HOLD_EVENT_SUFFIX}`;
22726
22801
  if (logged.get(run2.id) !== e.message) {
22727
22802
  logged.set(run2.id, e.message);
22728
- deps.db.addEvent(run2.id, "step", `${e.message} \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u043E\u0441\u0442\u0430\u0451\u0442\u0441\u044F \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 (TASWM-348)`);
22803
+ deps.db.addEvent(run2.id, "step", holdText);
22729
22804
  const blocker = deps.db.getRun(e.blockedByRunId);
22730
22805
  if (blocker)
22731
22806
  deps.db.addEvent(
@@ -22734,6 +22809,8 @@ async function spawnQueuedRun(deps, run2) {
22734
22809
  `${run2.task_slug} (#${run2.id}) \u0441\u0442\u043E\u0438\u0442 \u0432 \u043E\u0447\u0435\u0440\u0435\u0434\u0438 \u0438\u0437-\u0437\u0430 \u044D\u0442\u043E\u0439 \u0440\u0430\u0431\u043E\u0442\u044B \u2014 ${e.message} (TASWM-506)`
22735
22810
  );
22736
22811
  narrate(deps, `${droneLabel(run2)} \u2014 ${e.message}. \u041D\u0435 \u0441\u043F\u0430\u0432\u043D\u044E \u043F\u0430\u0440\u0430\u043B\u043B\u0435\u043B\u044C\u043D\u043E.`);
22812
+ } else if (!isFileHoldEvent(deps.db.events(run2.id).at(-1)?.text)) {
22813
+ deps.db.addEvent(run2.id, "step", holdText);
22737
22814
  }
22738
22815
  return "skipped";
22739
22816
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskless-app/swarm",
3
- "version": "0.6.86",
3
+ "version": "0.6.87",
4
4
  "type": "module",
5
5
  "description": "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
6
6
  "keywords": [
@@ -40,7 +40,7 @@
40
40
  "undici": "^7.30.1",
41
41
  "zod": "3.25.76"
42
42
  },
43
- "gitHead": "84b730050d788642d08a1cd14baf487b7e8298eb",
43
+ "gitHead": "68dc6ddb7ee57e70257f8164aa55db3615dc16be",
44
44
  "scripts": {
45
45
  "overmind": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/overmind.ts",
46
46
  "swarm": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=development\" tsx src/cli.ts",