@mushi-mushi/cli 0.35.2 → 0.35.3
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/{chunk-VAQTC77F.js → chunk-AWAWVAQN.js} +26 -8
- package/dist/{chunk-XUPFPVB2.js → chunk-JHCDXD3S.js} +2 -2
- package/dist/{chunk-VNGG2M3O.js → chunk-PCZRZE4Y.js} +1 -1
- package/dist/{chunk-OWUJYMV6.js → chunk-QLR6ZPEQ.js} +1 -1
- package/dist/{chunk-DBXL4RLE.js → chunk-WLX3HRNB.js} +1 -1
- package/dist/{chunk-ZA2HNXTH.js → chunk-ZT67ZX2O.js} +1 -1
- package/dist/{connect-YC6MRVZN.js → connect-5UJIK6E4.js} +2 -2
- package/dist/{connect-SH7D5RJP.js → connect-XQCE4JKF.js} +3 -3
- package/dist/{daemon-STJJNPRM.js → daemon-LZWDEQ6D.js} +3 -3
- package/dist/index.js +6 -6
- package/dist/init.js +3 -3
- package/dist/{version-6ZDAJV77.js → version-M4YSUKSX.js} +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
requireConfig,
|
|
9
9
|
requireUuid,
|
|
10
10
|
tryLoadWorkerKey
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WLX3HRNB.js";
|
|
12
12
|
import {
|
|
13
13
|
MUSHI_CLI_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
15
15
|
|
|
16
16
|
// src/worker/daemon.ts
|
|
17
17
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
@@ -608,9 +608,11 @@ function runProc(cmd, args, opts = {}) {
|
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
async function clearWorktree(repoDir, wt) {
|
|
611
|
-
if (
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
if (existsSync(wt)) {
|
|
612
|
+
await runProc("git", ["worktree", "remove", "--force", wt], { cwd: repoDir });
|
|
613
|
+
if (existsSync(wt)) rmSync(wt, { recursive: true, force: true });
|
|
614
|
+
}
|
|
615
|
+
await runProc("git", ["worktree", "unlock", wt], { cwd: repoDir });
|
|
614
616
|
await runProc("git", ["worktree", "prune"], { cwd: repoDir });
|
|
615
617
|
}
|
|
616
618
|
var GIT_TIMEOUT_MS = 10 * 6e4;
|
|
@@ -983,7 +985,7 @@ function registerWorkCommands(program) {
|
|
|
983
985
|
if (opts.repoDir || opts.report || opts.followups) {
|
|
984
986
|
throw new MushiCliError("E_INVALID_INPUT", "--daemon takes its lanes and clones from the worker config, not from --repo-dir, --report or --followups.", "mushi worker install");
|
|
985
987
|
}
|
|
986
|
-
const { runDaemon: runDaemon2 } = await import("./daemon-
|
|
988
|
+
const { runDaemon: runDaemon2 } = await import("./daemon-LZWDEQ6D.js");
|
|
987
989
|
await runDaemon2({ configPath: opts.workerConfig });
|
|
988
990
|
return;
|
|
989
991
|
}
|
|
@@ -2128,6 +2130,7 @@ var IDLE_MS = 15 * 6e4;
|
|
|
2128
2130
|
var BACKOFF_MS = 2 * 6e4;
|
|
2129
2131
|
var GH_CHECK_MS = 5 * 6e4;
|
|
2130
2132
|
var CURSOR_CHECK_MS = 20 * 6e4;
|
|
2133
|
+
var KEY_REFUSALS_TO_STOP = 3;
|
|
2131
2134
|
function createDaemon(cfg, deps) {
|
|
2132
2135
|
const lanes = cfg.lanes.map((local) => ({
|
|
2133
2136
|
local,
|
|
@@ -2167,6 +2170,8 @@ function createDaemon(cfg, deps) {
|
|
|
2167
2170
|
return r.data;
|
|
2168
2171
|
};
|
|
2169
2172
|
const refusedByKey = (r) => !r.ok && (r.httpStatus === 401 || r.httpStatus === 403 && /REVOKED|INVALID_API_KEY|WORKER_KEY_REQUIRED|INSUFFICIENT_SCOPE/.test(r.error.code));
|
|
2173
|
+
const revokedForSure = (r) => !r.ok && r.httpStatus === 403 && /REVOKED|WORKER_KEY_REQUIRED|INSUFFICIENT_SCOPE/.test(r.error.code);
|
|
2174
|
+
let keyRefusals = 0;
|
|
2170
2175
|
function stopAll(why) {
|
|
2171
2176
|
stopped = why;
|
|
2172
2177
|
for (const l of lanes) for (const ac of l.running.values()) ac.abort();
|
|
@@ -2409,7 +2414,12 @@ function createDaemon(cfg, deps) {
|
|
|
2409
2414
|
while (!stopped && lane.running.size < c.concurrency && agents() < g.max_agents && now >= lane.nextClaimAt) {
|
|
2410
2415
|
const r = await deps.call("/v1/worker/claim", { method: "POST", body: JSON.stringify({ laneId: lane.serverId }) });
|
|
2411
2416
|
if (refusedByKey(r)) {
|
|
2412
|
-
stopAll(`the server refused this worker's key (${r.error.code}); it was revoked or lost access`);
|
|
2417
|
+
if (revokedForSure(r)) stopAll(`the server refused this worker's key (${r.error.code}); it was revoked or lost access`);
|
|
2418
|
+
else {
|
|
2419
|
+
lane.nextClaimAt = now + BACKOFF_MS;
|
|
2420
|
+
lane.state = "backoff";
|
|
2421
|
+
say(lane, `claim refused (${r.error.code}); the next heartbeat checks the key again`);
|
|
2422
|
+
}
|
|
2413
2423
|
return;
|
|
2414
2424
|
}
|
|
2415
2425
|
if (!r.ok) {
|
|
@@ -2471,9 +2481,17 @@ function createDaemon(cfg, deps) {
|
|
|
2471
2481
|
if (stopped) return;
|
|
2472
2482
|
const hb = await deps.call("/v1/worker/heartbeat", { method: "POST", body: JSON.stringify(heartbeatBody()) });
|
|
2473
2483
|
if (refusedByKey(hb)) {
|
|
2474
|
-
|
|
2484
|
+
const code = hb.error.code;
|
|
2485
|
+
keyRefusals++;
|
|
2486
|
+
if (revokedForSure(hb) || keyRefusals >= KEY_REFUSALS_TO_STOP) {
|
|
2487
|
+
stopAll(`the server refused this worker's key (${code}) ${keyRefusals > 1 ? `${keyRefusals} times in a row` : ""}; it was revoked or lost access`.replace(/\s+;/, ";"));
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
hostState = "backoff";
|
|
2491
|
+
say(null, `the server refused this worker's key (${code}); checking again before stopping (${keyRefusals} of ${KEY_REFUSALS_TO_STOP})`);
|
|
2475
2492
|
return;
|
|
2476
2493
|
}
|
|
2494
|
+
if (hb.ok) keyRefusals = 0;
|
|
2477
2495
|
if (!hb.ok) {
|
|
2478
2496
|
hostState = "backoff";
|
|
2479
2497
|
say(null, `heartbeat failed: ${hb.error.code} ${hb.error.message}`);
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
requireUuid,
|
|
10
10
|
saveConfig,
|
|
11
11
|
savedSdkKeyFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WLX3HRNB.js";
|
|
13
13
|
import {
|
|
14
14
|
MUSHI_MCP_PIN_SPEC
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
16
16
|
import {
|
|
17
17
|
assertEndpoint,
|
|
18
18
|
normalizeEndpoint
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
saveConfig,
|
|
7
7
|
savedSdkKeyFor,
|
|
8
8
|
waitForIngestReady
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZT67ZX2O.js";
|
|
10
10
|
import {
|
|
11
11
|
MUSHI_MCP_PIN_SPEC
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PCZRZE4Y.js";
|
|
13
13
|
import {
|
|
14
14
|
detectFramework,
|
|
15
15
|
envVarsToWrite,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveSdkEnvKey,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JHCDXD3S.js";
|
|
6
6
|
import "./chunk-KOBEOGNF.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WLX3HRNB.js";
|
|
8
|
+
import "./chunk-QLR6ZPEQ.js";
|
|
9
9
|
import "./chunk-LGGE3LH7.js";
|
|
10
10
|
export {
|
|
11
11
|
resolveSdkEnvKey,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
readWorkerKey,
|
|
8
8
|
runDaemon,
|
|
9
9
|
workerHostId
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-AWAWVAQN.js";
|
|
11
|
+
import "./chunk-WLX3HRNB.js";
|
|
12
|
+
import "./chunk-QLR6ZPEQ.js";
|
|
13
13
|
import "./chunk-LGGE3LH7.js";
|
|
14
14
|
export {
|
|
15
15
|
assertWorkerKey,
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
sanitizeEndpoint,
|
|
23
23
|
sanitizeProjectId,
|
|
24
24
|
writeMcpServerEntry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-JHCDXD3S.js";
|
|
26
26
|
import {
|
|
27
27
|
FRAMEWORKS,
|
|
28
28
|
detectFramework,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
registerUxCommands,
|
|
50
50
|
registerWorkCommands,
|
|
51
51
|
validateWorkerConfig
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-AWAWVAQN.js";
|
|
53
53
|
import {
|
|
54
54
|
CONFIG_PATH,
|
|
55
55
|
MushiCliError,
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
tryDeleteWorkerKey,
|
|
88
88
|
trySaveKeyToKeychain,
|
|
89
89
|
trySaveWorkerKey
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-WLX3HRNB.js";
|
|
91
91
|
import {
|
|
92
92
|
MUSHI_CLI_VERSION,
|
|
93
93
|
MUSHI_MCP_PIN_SPEC
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
95
95
|
import {
|
|
96
96
|
CLOUD_API_ENDPOINT,
|
|
97
97
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -1594,7 +1594,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1594
1594
|
}
|
|
1595
1595
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1596
1596
|
const checks = [];
|
|
1597
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1597
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-M4YSUKSX.js");
|
|
1598
1598
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1599
1599
|
const parse2 = (v) => {
|
|
1600
1600
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -2567,7 +2567,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2567
2567
|
if (p.isCancel(answer) || !answer) return;
|
|
2568
2568
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2569
2569
|
try {
|
|
2570
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2570
|
+
const { runConnect: runConnect2 } = await import("./connect-XQCE4JKF.js");
|
|
2571
2571
|
const saved = loadConfig();
|
|
2572
2572
|
const result = await runConnect2(
|
|
2573
2573
|
{
|
package/dist/init.js
CHANGED
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
saveConfig,
|
|
26
26
|
savedSdkKeyFor,
|
|
27
27
|
trySaveKeyToKeychain
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZT67ZX2O.js";
|
|
29
29
|
import {
|
|
30
30
|
MUSHI_CLI_VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-PCZRZE4Y.js";
|
|
32
32
|
import {
|
|
33
33
|
FRAMEWORKS,
|
|
34
34
|
detectFramework,
|
|
@@ -2127,7 +2127,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2127
2127
|
if (p.isCancel(answer) || !answer) return;
|
|
2128
2128
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2129
2129
|
try {
|
|
2130
|
-
const { runConnect } = await import("./connect-
|
|
2130
|
+
const { runConnect } = await import("./connect-5UJIK6E4.js");
|
|
2131
2131
|
const saved = loadConfig();
|
|
2132
2132
|
const result = await runConnect(
|
|
2133
2133
|
{
|
package/dist/version.js
CHANGED
package/package.json
CHANGED