@taskless-app/swarm 0.6.82 → 0.6.83
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 +33 -18
- package/dist/overmind.js +50 -23
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -2936,7 +2936,7 @@ function extractModelsBlocks(config) {
|
|
|
2936
2936
|
for (const line of lines) {
|
|
2937
2937
|
if (/^\s*\[/.test(line)) {
|
|
2938
2938
|
if (current) blocks.push(current);
|
|
2939
|
-
current = /^\s*\[models\./.test(line) ? [line] : null;
|
|
2939
|
+
current = /^\s*\[(?:models|providers)\./.test(line) ? [line] : null;
|
|
2940
2940
|
continue;
|
|
2941
2941
|
}
|
|
2942
2942
|
if (current) current.push(line);
|
|
@@ -2969,13 +2969,27 @@ function ensureKimiHome(worktree, realHome, env = process.env, swarmHome = SWARM
|
|
|
2969
2969
|
}
|
|
2970
2970
|
const realConfig = join7((env.KIMI_CODE_HOME ?? "").trim() || join7(realHome, ".kimi-code"), "config.toml");
|
|
2971
2971
|
try {
|
|
2972
|
-
const
|
|
2973
|
-
|
|
2972
|
+
const raw = readFileSync3(realConfig, "utf8");
|
|
2973
|
+
const blocks = extractModelsBlocks(raw);
|
|
2974
|
+
const defaultModel = resolveShadowDefaultModel(raw, blocks);
|
|
2975
|
+
if (blocks.length > 0) {
|
|
2976
|
+
const head = defaultModel ? `default_model = "${defaultModel}"
|
|
2977
|
+
|
|
2978
|
+
` : "";
|
|
2979
|
+
writeFileSync4(join7(home, "config.toml"), `${head}${blocks.join("\n\n")}
|
|
2974
2980
|
`);
|
|
2981
|
+
}
|
|
2975
2982
|
} catch {
|
|
2976
2983
|
}
|
|
2977
2984
|
return home;
|
|
2978
2985
|
}
|
|
2986
|
+
function resolveShadowDefaultModel(config, blocks) {
|
|
2987
|
+
const declared = /^default_model\s*=\s*"([^"]+)"/m.exec(config)?.[1];
|
|
2988
|
+
if (declared?.trim()) return declared.trim();
|
|
2989
|
+
const firstModel = blocks.find((b) => /^\s*\[models\./.test(b));
|
|
2990
|
+
const alias = /^\s*\[models\."([^"]+)"\]/.exec(firstModel ?? "")?.[1];
|
|
2991
|
+
return alias?.trim() || null;
|
|
2992
|
+
}
|
|
2979
2993
|
function modelArgs2(model) {
|
|
2980
2994
|
if (!model || isHarnessDefaultModel(model)) return [];
|
|
2981
2995
|
return ["-m", model];
|
|
@@ -3025,15 +3039,9 @@ var init_kimi = __esm({
|
|
|
3025
3039
|
resolveBin: (env) => resolveKimiBin(env ?? process.env),
|
|
3026
3040
|
plan: (spec) => {
|
|
3027
3041
|
const home = ensureKimiHome(spec.worktree, spec.realHome);
|
|
3028
|
-
|
|
3029
|
-
writeFileSync4(
|
|
3030
|
-
|
|
3031
|
-
JSON.stringify(
|
|
3032
|
-
{ mcpServers: { [spec.mcp.name]: { command: spec.mcp.command, args: spec.mcp.args, env: spec.mcp.env } } },
|
|
3033
|
-
null,
|
|
3034
|
-
2
|
|
3035
|
-
)
|
|
3036
|
-
);
|
|
3042
|
+
const mcpJson = kimiMcpJson(spec);
|
|
3043
|
+
writeFileSync4(join7(home, "mcp.json"), mcpJson);
|
|
3044
|
+
writeFileSync4(join7(spec.worktree, SWARM_MCP_CONFIG_FILE), mcpJson);
|
|
3037
3045
|
const args = [
|
|
3038
3046
|
// `--add-dir` стоит первым: настоящий флаг kimi, по нему реконсайл узнаёт
|
|
3039
3047
|
// worktree живого процесса после рестарта демона (worktreeFromKimiCmd).
|
|
@@ -4133,7 +4141,7 @@ var init_package = __esm({
|
|
|
4133
4141
|
"package.json"() {
|
|
4134
4142
|
package_default = {
|
|
4135
4143
|
name: "@taskless-app/swarm",
|
|
4136
|
-
version: "0.6.
|
|
4144
|
+
version: "0.6.83",
|
|
4137
4145
|
type: "module",
|
|
4138
4146
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
4139
4147
|
keywords: [
|
|
@@ -4185,7 +4193,7 @@ var init_package = __esm({
|
|
|
4185
4193
|
undici: "^7.30.1",
|
|
4186
4194
|
zod: "3.25.76"
|
|
4187
4195
|
},
|
|
4188
|
-
gitHead: "
|
|
4196
|
+
gitHead: "8fd42459bb1cbcdad50ebef72bcb3c36a5e2d1c6"
|
|
4189
4197
|
};
|
|
4190
4198
|
}
|
|
4191
4199
|
});
|
|
@@ -8274,8 +8282,8 @@ var SwarmClient = class _SwarmClient {
|
|
|
8274
8282
|
// предикат «репо есть локально» для решения, брать ли свободный прогон.
|
|
8275
8283
|
host;
|
|
8276
8284
|
repoExists;
|
|
8277
|
-
// TASWM-398: ЧЕМ эта машина исполняет прогоны — id адаптера (claude-code|codex).
|
|
8278
8285
|
executorId;
|
|
8286
|
+
executorFor;
|
|
8279
8287
|
// Зеркало.
|
|
8280
8288
|
runs = /* @__PURE__ */ new Map();
|
|
8281
8289
|
runtime = /* @__PURE__ */ new Map();
|
|
@@ -8393,6 +8401,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
8393
8401
|
this.repoExists = opts.repoExists ?? existsSync8;
|
|
8394
8402
|
this.questionSyncMs = opts.questionSyncMs ?? 3e3;
|
|
8395
8403
|
this.executorId = opts.executorId ?? EXECUTOR.id;
|
|
8404
|
+
this.executorFor = opts.executorFor;
|
|
8396
8405
|
this.outboxPath = opts.outboxPath;
|
|
8397
8406
|
this.mapPath = `${opts.outboxPath}.prodmap.json`;
|
|
8398
8407
|
this.stormPath = `${opts.outboxPath}.storm.jsonl`;
|
|
@@ -8503,10 +8512,16 @@ var SwarmClient = class _SwarmClient {
|
|
|
8503
8512
|
// в прод НЕ уходят. kind → role (плоский enum). Self-ref
|
|
8504
8513
|
// прогонов hero_run_id/resolves_run_id/superseded_by → heroId/resolvesRunId/
|
|
8505
8514
|
// supersededById как ОТЛОЖЕННЫЕ ссылки (RunRef) — cuid резолвится на флаше.
|
|
8506
|
-
runFields(patch) {
|
|
8515
|
+
runFields(patch, run) {
|
|
8507
8516
|
const out = {};
|
|
8508
8517
|
if ("status" in patch && patch.status !== void 0) out.status = patch.status;
|
|
8509
|
-
if (patch.status === "running")
|
|
8518
|
+
if (patch.status === "running") {
|
|
8519
|
+
try {
|
|
8520
|
+
out.executor = run && this.executorFor ? this.executorFor(run) : this.executorId;
|
|
8521
|
+
} catch {
|
|
8522
|
+
out.executor = this.executorId;
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8510
8525
|
if ("area" in patch) out.area = normalizeZoneLabel(patch.area) || null;
|
|
8511
8526
|
if ("model" in patch) out.model = patch.model ?? null;
|
|
8512
8527
|
if ("review_model" in patch) out.reviewModel = patch.review_model ?? null;
|
|
@@ -8758,7 +8773,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
8758
8773
|
d[k] = v;
|
|
8759
8774
|
}
|
|
8760
8775
|
d.updated_at = stamp();
|
|
8761
|
-
this.enqueueRun(d, this.runFields(patch));
|
|
8776
|
+
this.enqueueRun(d, this.runFields(patch, this.mat(d)));
|
|
8762
8777
|
return this.mat(d);
|
|
8763
8778
|
}
|
|
8764
8779
|
incRespawn(id) {
|
package/dist/overmind.js
CHANGED
|
@@ -3147,7 +3147,7 @@ function extractModelsBlocks(config) {
|
|
|
3147
3147
|
for (const line of lines) {
|
|
3148
3148
|
if (/^\s*\[/.test(line)) {
|
|
3149
3149
|
if (current) blocks.push(current);
|
|
3150
|
-
current = /^\s*\[models\./.test(line) ? [line] : null;
|
|
3150
|
+
current = /^\s*\[(?:models|providers)\./.test(line) ? [line] : null;
|
|
3151
3151
|
continue;
|
|
3152
3152
|
}
|
|
3153
3153
|
if (current) current.push(line);
|
|
@@ -3180,13 +3180,27 @@ function ensureKimiHome(worktree, realHome, env = process.env, swarmHome = SWARM
|
|
|
3180
3180
|
}
|
|
3181
3181
|
const realConfig = join8((env.KIMI_CODE_HOME ?? "").trim() || join8(realHome, ".kimi-code"), "config.toml");
|
|
3182
3182
|
try {
|
|
3183
|
-
const
|
|
3184
|
-
|
|
3183
|
+
const raw = readFileSync4(realConfig, "utf8");
|
|
3184
|
+
const blocks = extractModelsBlocks(raw);
|
|
3185
|
+
const defaultModel = resolveShadowDefaultModel(raw, blocks);
|
|
3186
|
+
if (blocks.length > 0) {
|
|
3187
|
+
const head = defaultModel ? `default_model = "${defaultModel}"
|
|
3188
|
+
|
|
3189
|
+
` : "";
|
|
3190
|
+
writeFileSync5(join8(home, "config.toml"), `${head}${blocks.join("\n\n")}
|
|
3185
3191
|
`);
|
|
3192
|
+
}
|
|
3186
3193
|
} catch {
|
|
3187
3194
|
}
|
|
3188
3195
|
return home;
|
|
3189
3196
|
}
|
|
3197
|
+
function resolveShadowDefaultModel(config, blocks) {
|
|
3198
|
+
const declared = /^default_model\s*=\s*"([^"]+)"/m.exec(config)?.[1];
|
|
3199
|
+
if (declared?.trim()) return declared.trim();
|
|
3200
|
+
const firstModel = blocks.find((b) => /^\s*\[models\./.test(b));
|
|
3201
|
+
const alias = /^\s*\[models\."([^"]+)"\]/.exec(firstModel ?? "")?.[1];
|
|
3202
|
+
return alias?.trim() || null;
|
|
3203
|
+
}
|
|
3190
3204
|
function modelArgs2(model) {
|
|
3191
3205
|
if (!model || isHarnessDefaultModel(model)) return [];
|
|
3192
3206
|
return ["-m", model];
|
|
@@ -3236,15 +3250,9 @@ var init_kimi = __esm({
|
|
|
3236
3250
|
resolveBin: (env) => resolveKimiBin(env ?? process.env),
|
|
3237
3251
|
plan: (spec) => {
|
|
3238
3252
|
const home = ensureKimiHome(spec.worktree, spec.realHome);
|
|
3239
|
-
|
|
3240
|
-
writeFileSync5(
|
|
3241
|
-
|
|
3242
|
-
JSON.stringify(
|
|
3243
|
-
{ mcpServers: { [spec.mcp.name]: { command: spec.mcp.command, args: spec.mcp.args, env: spec.mcp.env } } },
|
|
3244
|
-
null,
|
|
3245
|
-
2
|
|
3246
|
-
)
|
|
3247
|
-
);
|
|
3253
|
+
const mcpJson = kimiMcpJson(spec);
|
|
3254
|
+
writeFileSync5(join8(home, "mcp.json"), mcpJson);
|
|
3255
|
+
writeFileSync5(join8(spec.worktree, SWARM_MCP_CONFIG_FILE), mcpJson);
|
|
3248
3256
|
const args = [
|
|
3249
3257
|
// `--add-dir` стоит первым: настоящий флаг kimi, по нему реконсайл узнаёт
|
|
3250
3258
|
// worktree живого процесса после рестарта демона (worktreeFromKimiCmd).
|
|
@@ -8497,8 +8505,8 @@ var SwarmClient = class _SwarmClient {
|
|
|
8497
8505
|
// предикат «репо есть локально» для решения, брать ли свободный прогон.
|
|
8498
8506
|
host;
|
|
8499
8507
|
repoExists;
|
|
8500
|
-
// TASWM-398: ЧЕМ эта машина исполняет прогоны — id адаптера (claude-code|codex).
|
|
8501
8508
|
executorId;
|
|
8509
|
+
executorFor;
|
|
8502
8510
|
// Зеркало.
|
|
8503
8511
|
runs = /* @__PURE__ */ new Map();
|
|
8504
8512
|
runtime = /* @__PURE__ */ new Map();
|
|
@@ -8616,6 +8624,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
8616
8624
|
this.repoExists = opts.repoExists ?? existsSync9;
|
|
8617
8625
|
this.questionSyncMs = opts.questionSyncMs ?? 3e3;
|
|
8618
8626
|
this.executorId = opts.executorId ?? EXECUTOR.id;
|
|
8627
|
+
this.executorFor = opts.executorFor;
|
|
8619
8628
|
this.outboxPath = opts.outboxPath;
|
|
8620
8629
|
this.mapPath = `${opts.outboxPath}.prodmap.json`;
|
|
8621
8630
|
this.stormPath = `${opts.outboxPath}.storm.jsonl`;
|
|
@@ -8726,10 +8735,16 @@ var SwarmClient = class _SwarmClient {
|
|
|
8726
8735
|
// в прод НЕ уходят. kind → role (плоский enum). Self-ref
|
|
8727
8736
|
// прогонов hero_run_id/resolves_run_id/superseded_by → heroId/resolvesRunId/
|
|
8728
8737
|
// supersededById как ОТЛОЖЕННЫЕ ссылки (RunRef) — cuid резолвится на флаше.
|
|
8729
|
-
runFields(patch) {
|
|
8738
|
+
runFields(patch, run2) {
|
|
8730
8739
|
const out = {};
|
|
8731
8740
|
if ("status" in patch && patch.status !== void 0) out.status = patch.status;
|
|
8732
|
-
if (patch.status === "running")
|
|
8741
|
+
if (patch.status === "running") {
|
|
8742
|
+
try {
|
|
8743
|
+
out.executor = run2 && this.executorFor ? this.executorFor(run2) : this.executorId;
|
|
8744
|
+
} catch {
|
|
8745
|
+
out.executor = this.executorId;
|
|
8746
|
+
}
|
|
8747
|
+
}
|
|
8733
8748
|
if ("area" in patch) out.area = normalizeZoneLabel(patch.area) || null;
|
|
8734
8749
|
if ("model" in patch) out.model = patch.model ?? null;
|
|
8735
8750
|
if ("review_model" in patch) out.reviewModel = patch.review_model ?? null;
|
|
@@ -8981,7 +8996,7 @@ var SwarmClient = class _SwarmClient {
|
|
|
8981
8996
|
d[k] = v;
|
|
8982
8997
|
}
|
|
8983
8998
|
d.updated_at = stamp();
|
|
8984
|
-
this.enqueueRun(d, this.runFields(patch));
|
|
8999
|
+
this.enqueueRun(d, this.runFields(patch, this.mat(d)));
|
|
8985
9000
|
return this.mat(d);
|
|
8986
9001
|
}
|
|
8987
9002
|
incRespawn(id) {
|
|
@@ -13528,7 +13543,7 @@ function parkReasonUnretriable(reason) {
|
|
|
13528
13543
|
// package.json
|
|
13529
13544
|
var package_default = {
|
|
13530
13545
|
name: "@taskless-app/swarm",
|
|
13531
|
-
version: "0.6.
|
|
13546
|
+
version: "0.6.83",
|
|
13532
13547
|
type: "module",
|
|
13533
13548
|
description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
|
|
13534
13549
|
keywords: [
|
|
@@ -13580,7 +13595,7 @@ var package_default = {
|
|
|
13580
13595
|
undici: "^7.30.1",
|
|
13581
13596
|
zod: "3.25.76"
|
|
13582
13597
|
},
|
|
13583
|
-
gitHead: "
|
|
13598
|
+
gitHead: "8fd42459bb1cbcdad50ebef72bcb3c36a5e2d1c6"
|
|
13584
13599
|
};
|
|
13585
13600
|
|
|
13586
13601
|
// src/version.ts
|
|
@@ -24626,7 +24641,7 @@ async function loadSqlite() {
|
|
|
24626
24641
|
);
|
|
24627
24642
|
}
|
|
24628
24643
|
}
|
|
24629
|
-
async function makeStore(repo, worktreesDir, repoFlag) {
|
|
24644
|
+
async function makeStore(repo, worktreesDir, repoFlag, executorFor) {
|
|
24630
24645
|
const host = loadHostIdentity({
|
|
24631
24646
|
home: SWARM_HOME,
|
|
24632
24647
|
envHostId: process.env.SWARM_HOST_ID,
|
|
@@ -24692,7 +24707,14 @@ async function makeStore(repo, worktreesDir, repoFlag) {
|
|
|
24692
24707
|
(repoMap.unknown ? "\u041F\u0440\u043E\u0434 \u043D\u0435 \u0441\u043A\u0430\u0437\u0430\u043B, \u043A\u0430\u043A\u0438\u0435 \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0438 \u0443 \u0440\u043E\u044F, \u2014 \u043F\u0440\u043E\u0432\u0435\u0440\u044C `swarm login` \u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C \u0441\u0435\u0440\u0432\u0435\u0440\u0430. " : repoMap.missing.length ? `\u041D\u0438 \u043E\u0434\u043D\u043E\u0433\u043E \u0438\u0437 ${repoMap.missing.length} \u0440\u0435\u043F\u043E\u0437\u0438\u0442\u043E\u0440\u0438\u0435\u0432 \u0440\u043E\u044F \u0442\u0443\u0442 \u043D\u0435\u0442. ` : "\u0423 \u0432\u043B\u0430\u0434\u0435\u043B\u044C\u0446\u0430 \u043D\u0435\u0442 \u043F\u0440\u043E\u0435\u043A\u0442\u043E\u0432 \u0441 \u0432\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u044B\u043C \u0440\u043E\u0435\u043C. ") + "\u0415\u0441\u043B\u0438 \u043A\u043B\u043E\u043D\u044B \u043B\u0435\u0436\u0430\u0442 \u0432 \u0434\u0440\u0443\u0433\u043E\u043C \u043C\u0435\u0441\u0442\u0435 \u2014 \u0443\u043A\u0430\u0436\u0438: swarm start --repo <\u043F\u0443\u0442\u044C \u043A \u0440\u0435\u043F\u043E> (\u0437\u0430\u043F\u043E\u043C\u043D\u0438\u0442\u0441\u044F)."
|
|
24693
24708
|
);
|
|
24694
24709
|
}
|
|
24695
|
-
const client = new SwarmClient({
|
|
24710
|
+
const client = new SwarmClient({
|
|
24711
|
+
call,
|
|
24712
|
+
outboxPath: SWARM_OUTBOX,
|
|
24713
|
+
defaultRepo: repo,
|
|
24714
|
+
repoRegistry,
|
|
24715
|
+
host,
|
|
24716
|
+
...executorFor ? { executorFor } : {}
|
|
24717
|
+
});
|
|
24696
24718
|
await client.hydrate();
|
|
24697
24719
|
const rec = client.reconcileRuntime({ worktreesDir, listProcesses: listDroneProcesses });
|
|
24698
24720
|
const adopted = await client.takeRunningLocally();
|
|
@@ -24793,6 +24815,8 @@ async function runDaemon(opts) {
|
|
|
24793
24815
|
const remembered = effectiveRepoPaths("", loadRememberedRepos(SWARM_HOME))[0];
|
|
24794
24816
|
if (remembered) opts.repo = remembered;
|
|
24795
24817
|
}
|
|
24818
|
+
let lastSwarmModels = null;
|
|
24819
|
+
const runModelRefPin = /* @__PURE__ */ new Map();
|
|
24796
24820
|
const {
|
|
24797
24821
|
store: db,
|
|
24798
24822
|
reconciled,
|
|
@@ -24802,7 +24826,12 @@ async function runDaemon(opts) {
|
|
|
24802
24826
|
prodMcp,
|
|
24803
24827
|
reposServed,
|
|
24804
24828
|
repoFullNameOf
|
|
24805
|
-
} = await makeStore(
|
|
24829
|
+
} = await makeStore(
|
|
24830
|
+
opts.repo,
|
|
24831
|
+
worktreesDir,
|
|
24832
|
+
opts.repoFlag,
|
|
24833
|
+
(run2) => executorForRun(run2, lastSwarmModels, process.env, runModelRefPin.get(run2.id) ?? null).id
|
|
24834
|
+
);
|
|
24806
24835
|
await preflightAuth();
|
|
24807
24836
|
const outdated = outdatedLine(PACKAGE_VERSION, await latestRelease);
|
|
24808
24837
|
if (outdated) console.warn(`[overmind] ${outdated}`);
|
|
@@ -24836,8 +24865,6 @@ async function runDaemon(opts) {
|
|
|
24836
24865
|
}
|
|
24837
24866
|
} : void 0;
|
|
24838
24867
|
let lastDroneCap = null;
|
|
24839
|
-
let lastSwarmModels = null;
|
|
24840
|
-
const runModelRefPin = /* @__PURE__ */ new Map();
|
|
24841
24868
|
let lastSwarmEfforts = null;
|
|
24842
24869
|
let lastMaxCostUsd = null;
|
|
24843
24870
|
let lastOwnCapacity = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taskless-app/swarm",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.83",
|
|
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": "
|
|
43
|
+
"gitHead": "8fd42459bb1cbcdad50ebef72bcb3c36a5e2d1c6",
|
|
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",
|