svamp-cli 0.2.255 → 0.2.257
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/bin/skills/artifact/SKILL.md +1 -1
- package/dist/{agentCommands-Bd7sTL72.mjs → agentCommands-fCsOp7ko.mjs} +5 -5
- package/dist/{auth-K6RHd3Se.mjs → auth-BH6Awl3O.mjs} +1 -1
- package/dist/cli.mjs +61 -61
- package/dist/{commands-B1rI6nQ_.mjs → commands-B5veY89L.mjs} +1 -1
- package/dist/{commands-yoeiGRYI.mjs → commands-B6BkPRui.mjs} +84 -19
- package/dist/{commands-BjhpfRPs.mjs → commands-BCmpKBjg.mjs} +1 -1
- package/dist/{commands-zkbQRqlq.mjs → commands-BpNDUqvv.mjs} +6 -6
- package/dist/{commands-DwXWC_ka.mjs → commands-BzF6GzdR.mjs} +1 -1
- package/dist/{commands-E4FV1Mrf.mjs → commands-CE1PdEJJ.mjs} +1 -1
- package/dist/{commands-DSFK1j6n.mjs → commands-DNIxtTXe.mjs} +2 -2
- package/dist/{fleet-B_38I5pd.mjs → fleet-XYsLuf-3.mjs} +1 -1
- package/dist/{frpc-C6yDezIg.mjs → frpc-QESvQN-s.mjs} +1 -1
- package/dist/{headlessCli-0He_Dybz.mjs → headlessCli-DuCmcrAL.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{package-Dm1gKqm5.mjs → package-BA3c2JLu.mjs} +1 -1
- package/dist/{rpc-D_d_zq8R.mjs → rpc-Bscxex4z.mjs} +1 -1
- package/dist/{rpc-BAhRday-.mjs → rpc-DCeDG4c7.mjs} +1 -1
- package/dist/{run-ClMTHM__.mjs → run-BmOCcZRG.mjs} +1 -1
- package/dist/{run-DsAMQZUu.mjs → run-BtGnnEMI.mjs} +138 -85
- package/dist/{scheduler-BwZS9UWD.mjs → scheduler-Dbqmnd_o.mjs} +20 -2
- package/dist/{serveCommands-sEZ7mQc4.mjs → serveCommands-DueTsJSe.mjs} +5 -5
- package/dist/{serveManager-C1-FPoEa.mjs → serveManager-BclzoPIb.mjs} +2 -2
- package/dist/{sideband-CQJ-0LbS.mjs → sideband-C_ifGgde.mjs} +1 -1
- package/package.json +1 -1
|
@@ -2985,7 +2985,7 @@ async function registerMachineService(server, machineId, metadata, daemonState,
|
|
|
2985
2985
|
const tunnels = handlers.tunnels;
|
|
2986
2986
|
if (!tunnels) throw new Error("Tunnel management not available");
|
|
2987
2987
|
if (tunnels.has(params.name)) throw new Error(`Tunnel '${params.name}' already running`);
|
|
2988
|
-
const { FrpcTunnel } = await import('./frpc-
|
|
2988
|
+
const { FrpcTunnel } = await import('./frpc-QESvQN-s.mjs');
|
|
2989
2989
|
const tunnel = new FrpcTunnel({
|
|
2990
2990
|
name: params.name,
|
|
2991
2991
|
ports: params.ports,
|
|
@@ -3452,7 +3452,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
|
|
|
3452
3452
|
}
|
|
3453
3453
|
const deps = buildSessionDeps(rpc, { cwd, ownerEmail: owner });
|
|
3454
3454
|
const sender = { name: context?.user?.email || context?.user?.id || "user", kind: "user", verified: true };
|
|
3455
|
-
const { toolsForRole } = await import('./sideband-
|
|
3455
|
+
const { toolsForRole } = await import('./sideband-C_ifGgde.mjs');
|
|
3456
3456
|
const r2 = await runWiseAgent({ message: params.message, sender, config: { tools: toolsForRole(role2) }, deps, transport, model: resolved.model });
|
|
3457
3457
|
return fmt(r2);
|
|
3458
3458
|
}
|
|
@@ -3551,7 +3551,7 @@ QUESTION: ${params.question || "Summarize this concisely."}` }
|
|
|
3551
3551
|
if (r.error || !r.sender) return { error: r.error || "unauthorized" };
|
|
3552
3552
|
const callId = "call_" + Math.random().toString(16).slice(2, 12);
|
|
3553
3553
|
const rendered = renderMessage(c, { sender: r.sender, body: { message: kwargs.message }, callId });
|
|
3554
|
-
const { queryCore } = await import('./commands-
|
|
3554
|
+
const { queryCore } = await import('./commands-CE1PdEJJ.mjs');
|
|
3555
3555
|
const timeout = c.reply?.timeout_sec || 120;
|
|
3556
3556
|
let result;
|
|
3557
3557
|
try {
|
|
@@ -10239,21 +10239,37 @@ class ProcessSupervisor {
|
|
|
10239
10239
|
* a desired-stopped intent so a daemon restart does not resurrect it. `stopAll` (a daemon
|
|
10240
10240
|
* shutdown, not a user action) passes false so keepAlive processes auto-restore (#nightly).
|
|
10241
10241
|
*/
|
|
10242
|
+
/**
|
|
10243
|
+
* #0347: run `fn` in the entry's lifecycle critical section. Each call awaits the previous
|
|
10244
|
+
* lifecycle op's SETTLEMENT before running, so stop/restart/apply/update/remove are strictly
|
|
10245
|
+
* serialized per entry and can never interleave across an `await killChild` (which is what let
|
|
10246
|
+
* two ops double-spawn an orphan, or resurrect a just-stopped process). The chain tail never
|
|
10247
|
+
* rejects (a failed op must not wedge the queue); the caller still gets the real result/error.
|
|
10248
|
+
*/
|
|
10249
|
+
runExclusive(entry, fn) {
|
|
10250
|
+
const prev = entry.opLock ?? Promise.resolve();
|
|
10251
|
+
const result = prev.then(fn, fn);
|
|
10252
|
+
entry.opLock = result.then(() => void 0, () => void 0);
|
|
10253
|
+
return result;
|
|
10254
|
+
}
|
|
10242
10255
|
async stop(idOrName, opts) {
|
|
10243
10256
|
const entry = this.require(idOrName);
|
|
10244
10257
|
entry.stopping = true;
|
|
10245
10258
|
this.clearTimers(entry);
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
entry.child
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
entry.
|
|
10255
|
-
|
|
10256
|
-
|
|
10259
|
+
return this.runExclusive(entry, async () => {
|
|
10260
|
+
entry.stopping = true;
|
|
10261
|
+
if (entry.child) {
|
|
10262
|
+
await this.killChild(entry.child);
|
|
10263
|
+
entry.child = void 0;
|
|
10264
|
+
}
|
|
10265
|
+
entry.state.status = "stopped";
|
|
10266
|
+
entry.state.stoppedAt = Date.now();
|
|
10267
|
+
entry.state.pid = void 0;
|
|
10268
|
+
if (opts?.markDesiredStopped !== false && !entry.deleted && !entry.spec.desiredStopped) {
|
|
10269
|
+
entry.spec.desiredStopped = true;
|
|
10270
|
+
await this.persistSpec(entry.spec);
|
|
10271
|
+
}
|
|
10272
|
+
});
|
|
10257
10273
|
}
|
|
10258
10274
|
/** Restart a process (stop if running, then start again). */
|
|
10259
10275
|
async restart(idOrName) {
|
|
@@ -10261,25 +10277,27 @@ class ProcessSupervisor {
|
|
|
10261
10277
|
if (entry.deleted) throw new Error(`Process '${idOrName}' has been removed`);
|
|
10262
10278
|
if (entry.restarting) return;
|
|
10263
10279
|
entry.restarting = true;
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
entry.
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
entry.spec.desiredStopped
|
|
10276
|
-
|
|
10280
|
+
return this.runExclusive(entry, async () => {
|
|
10281
|
+
try {
|
|
10282
|
+
if (entry.child) {
|
|
10283
|
+
entry.stopping = true;
|
|
10284
|
+
this.clearTimers(entry);
|
|
10285
|
+
await this.killChild(entry.child);
|
|
10286
|
+
entry.child = void 0;
|
|
10287
|
+
}
|
|
10288
|
+
if (entry.deleted) return;
|
|
10289
|
+
entry.stopping = false;
|
|
10290
|
+
this.resetFailureTracking(entry);
|
|
10291
|
+
if (entry.spec.desiredStopped) {
|
|
10292
|
+
entry.spec.desiredStopped = false;
|
|
10293
|
+
await this.persistSpec(entry.spec);
|
|
10294
|
+
}
|
|
10295
|
+
entry.state.restartCount++;
|
|
10296
|
+
await this.startEntry(entry, false);
|
|
10297
|
+
} finally {
|
|
10298
|
+
entry.restarting = false;
|
|
10277
10299
|
}
|
|
10278
|
-
|
|
10279
|
-
await this.startEntry(entry, false);
|
|
10280
|
-
} finally {
|
|
10281
|
-
entry.restarting = false;
|
|
10282
|
-
}
|
|
10300
|
+
});
|
|
10283
10301
|
}
|
|
10284
10302
|
/** Stop the process and remove it from supervision (deletes persisted spec). */
|
|
10285
10303
|
async remove(idOrName) {
|
|
@@ -10288,15 +10306,17 @@ class ProcessSupervisor {
|
|
|
10288
10306
|
entry.deleted = true;
|
|
10289
10307
|
entry.stopping = true;
|
|
10290
10308
|
this.clearTimers(entry);
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10309
|
+
return this.runExclusive(entry, async () => {
|
|
10310
|
+
if (entry.child) {
|
|
10311
|
+
await this.killChild(entry.child);
|
|
10312
|
+
entry.child = void 0;
|
|
10313
|
+
}
|
|
10314
|
+
entry.state.status = "stopped";
|
|
10315
|
+
entry.state.stoppedAt = Date.now();
|
|
10316
|
+
entry.state.pid = void 0;
|
|
10317
|
+
this.entries.delete(id);
|
|
10318
|
+
await this.deleteSpec(id);
|
|
10319
|
+
});
|
|
10300
10320
|
}
|
|
10301
10321
|
/** List all supervised processes. */
|
|
10302
10322
|
list() {
|
|
@@ -10330,26 +10350,28 @@ class ProcessSupervisor {
|
|
|
10330
10350
|
if (this.specsEqual(existing.spec, spec)) {
|
|
10331
10351
|
return { action: "no-change", info: this.toInfo(existing) };
|
|
10332
10352
|
}
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
+
return this.runExclusive(existing, async () => {
|
|
10354
|
+
const updatedSpec = {
|
|
10355
|
+
...spec,
|
|
10356
|
+
id: existing.spec.id,
|
|
10357
|
+
createdAt: existing.spec.createdAt
|
|
10358
|
+
// preserve original creation time
|
|
10359
|
+
};
|
|
10360
|
+
existing.spec = updatedSpec;
|
|
10361
|
+
await this.persistSpec(updatedSpec);
|
|
10362
|
+
existing.stopping = true;
|
|
10363
|
+
this.clearTimers(existing);
|
|
10364
|
+
if (existing.child) {
|
|
10365
|
+
await this.killChild(existing.child);
|
|
10366
|
+
existing.child = void 0;
|
|
10367
|
+
}
|
|
10368
|
+
if (existing.deleted) return { action: "updated", info: this.toInfo(existing) };
|
|
10369
|
+
existing.stopping = false;
|
|
10370
|
+
this.resetFailureTracking(existing);
|
|
10371
|
+
existing.state.status = "starting";
|
|
10372
|
+
this.spawnProcess(existing);
|
|
10373
|
+
return { action: "updated", info: this.toInfo(existing) };
|
|
10374
|
+
});
|
|
10353
10375
|
}
|
|
10354
10376
|
/**
|
|
10355
10377
|
* Update a running process's spec and restart it.
|
|
@@ -10358,21 +10380,23 @@ class ProcessSupervisor {
|
|
|
10358
10380
|
async update(idOrName, partialSpec) {
|
|
10359
10381
|
const entry = this.require(idOrName);
|
|
10360
10382
|
if (entry.deleted) throw new Error(`Process '${idOrName}' has been removed`);
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10383
|
+
return this.runExclusive(entry, async () => {
|
|
10384
|
+
const updatedSpec = { ...entry.spec, ...partialSpec };
|
|
10385
|
+
entry.spec = updatedSpec;
|
|
10386
|
+
await this.persistSpec(updatedSpec);
|
|
10387
|
+
entry.stopping = true;
|
|
10388
|
+
this.clearTimers(entry);
|
|
10389
|
+
if (entry.child) {
|
|
10390
|
+
await this.killChild(entry.child);
|
|
10391
|
+
entry.child = void 0;
|
|
10392
|
+
}
|
|
10393
|
+
if (entry.deleted) return this.toInfo(entry);
|
|
10394
|
+
entry.stopping = false;
|
|
10395
|
+
this.resetFailureTracking(entry);
|
|
10396
|
+
entry.state.status = "starting";
|
|
10397
|
+
this.spawnProcess(entry);
|
|
10398
|
+
return this.toInfo(entry);
|
|
10399
|
+
});
|
|
10376
10400
|
}
|
|
10377
10401
|
// ── Spec equality ─────────────────────────────────────────────────────────
|
|
10378
10402
|
/** Compare two specs for equality (ignoring id, createdAt, and runtime state). */
|
|
@@ -13534,7 +13558,7 @@ async function startDaemon(options) {
|
|
|
13534
13558
|
try {
|
|
13535
13559
|
const dir = loadSessionIndex()[sessionId]?.directory;
|
|
13536
13560
|
if (!dir) return;
|
|
13537
|
-
const { reconcileServiceLinks } = await import('./agentCommands-
|
|
13561
|
+
const { reconcileServiceLinks } = await import('./agentCommands-fCsOp7ko.mjs');
|
|
13538
13562
|
const configPath = getSvampConfigPath(dir, sessionId);
|
|
13539
13563
|
const config = readSvampConfig(configPath);
|
|
13540
13564
|
const entries = Array.from(urls.entries());
|
|
@@ -13552,7 +13576,7 @@ async function startDaemon(options) {
|
|
|
13552
13576
|
}
|
|
13553
13577
|
}
|
|
13554
13578
|
async function createExposedTunnel(spec) {
|
|
13555
|
-
const { FrpcTunnel } = await import('./frpc-
|
|
13579
|
+
const { FrpcTunnel } = await import('./frpc-QESvQN-s.mjs');
|
|
13556
13580
|
const tunnel = new FrpcTunnel({
|
|
13557
13581
|
name: spec.name,
|
|
13558
13582
|
ports: spec.ports,
|
|
@@ -13572,7 +13596,8 @@ async function startDaemon(options) {
|
|
|
13572
13596
|
return tunnel;
|
|
13573
13597
|
}
|
|
13574
13598
|
const tunnelRecreateState = /* @__PURE__ */ new Map();
|
|
13575
|
-
const
|
|
13599
|
+
const tunnelRecreateInFlight = /* @__PURE__ */ new Set();
|
|
13600
|
+
const { ServeManager } = await import('./serveManager-BclzoPIb.mjs');
|
|
13576
13601
|
const serveManager = new ServeManager(SVAMP_HOME, (msg) => logger.log(`[SERVE] ${msg}`), hyphaServerUrl);
|
|
13577
13602
|
ensureAutoInstalledSkills(logger).catch(() => {
|
|
13578
13603
|
});
|
|
@@ -15688,11 +15713,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
15688
15713
|
});
|
|
15689
15714
|
},
|
|
15690
15715
|
onIssue: async (params) => {
|
|
15691
|
-
const { issueRpc } = await import('./rpc-
|
|
15716
|
+
const { issueRpc } = await import('./rpc-Bscxex4z.mjs');
|
|
15692
15717
|
return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
|
|
15693
15718
|
},
|
|
15694
15719
|
onWorkflow: async (params) => {
|
|
15695
|
-
const { workflowRpc } = await import('./rpc-
|
|
15720
|
+
const { workflowRpc } = await import('./rpc-DCeDG4c7.mjs');
|
|
15696
15721
|
return workflowRpc(params?.cwd || directory, params || {});
|
|
15697
15722
|
},
|
|
15698
15723
|
onRipgrep: async (args, cwd) => {
|
|
@@ -16241,11 +16266,11 @@ ${capturedError}${buildClaudeErrorHint(capturedError)}`;
|
|
|
16241
16266
|
});
|
|
16242
16267
|
},
|
|
16243
16268
|
onIssue: async (params) => {
|
|
16244
|
-
const { issueRpc } = await import('./rpc-
|
|
16269
|
+
const { issueRpc } = await import('./rpc-Bscxex4z.mjs');
|
|
16245
16270
|
return issueRpc(params?.cwd || directory, params || {}, { notifySession: notifyIssueOwner, rekickLoopOwner });
|
|
16246
16271
|
},
|
|
16247
16272
|
onWorkflow: async (params) => {
|
|
16248
|
-
const { workflowRpc } = await import('./rpc-
|
|
16273
|
+
const { workflowRpc } = await import('./rpc-DCeDG4c7.mjs');
|
|
16249
16274
|
return workflowRpc(params?.cwd || directory, params || {});
|
|
16250
16275
|
},
|
|
16251
16276
|
onRipgrep: async (args, cwd) => {
|
|
@@ -16905,7 +16930,8 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
|
|
|
16905
16930
|
return void 0;
|
|
16906
16931
|
}
|
|
16907
16932
|
});
|
|
16908
|
-
|
|
16933
|
+
const channelHttpHost = process.env.SVAMP_CHANNEL_HTTP_HOST || "127.0.0.1";
|
|
16934
|
+
channelHttpServer.listen(channelHttpPort, channelHttpHost, () => logger.log(`[channels] HTTP ingress on ${channelHttpHost}:${channelHttpPort} (POST /channel/<id>)`));
|
|
16909
16935
|
} catch (e) {
|
|
16910
16936
|
logger.error(`[channels] HTTP ingress failed to start: ${e.message}`);
|
|
16911
16937
|
}
|
|
@@ -17209,7 +17235,7 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
|
|
|
17209
17235
|
const PING_TIMEOUT_MS = 15e3;
|
|
17210
17236
|
const POST_RECONNECT_GRACE_MS = 2e4;
|
|
17211
17237
|
const RECONNECT_JITTER_MS = 2500;
|
|
17212
|
-
const { WorkflowScheduler } = await import('./scheduler-
|
|
17238
|
+
const { WorkflowScheduler } = await import('./scheduler-Dbqmnd_o.mjs');
|
|
17213
17239
|
const workflowScheduler = new WorkflowScheduler({
|
|
17214
17240
|
projectRoots: () => {
|
|
17215
17241
|
const dirs = /* @__PURE__ */ new Set();
|
|
@@ -17384,13 +17410,40 @@ ${oracle.output.trim().slice(0, 500)}`, "\u{1F501} Continuing loop");
|
|
|
17384
17410
|
} catch {
|
|
17385
17411
|
}
|
|
17386
17412
|
tunnels.delete(name);
|
|
17413
|
+
tunnelRecreateInFlight.add(name);
|
|
17387
17414
|
createExposedTunnel(spec).then((fresh) => {
|
|
17388
17415
|
tunnels.set(name, fresh);
|
|
17389
17416
|
logger.log(`frpc tunnel '${name}' recreated`);
|
|
17390
17417
|
}).catch((err) => {
|
|
17391
17418
|
logger.log(`frpc tunnel '${name}' recreate failed: ${err.message} (will retry)`);
|
|
17419
|
+
}).finally(() => {
|
|
17420
|
+
tunnelRecreateInFlight.delete(name);
|
|
17392
17421
|
});
|
|
17393
17422
|
}
|
|
17423
|
+
try {
|
|
17424
|
+
for (const spec of loadExposedTunnels()) {
|
|
17425
|
+
if (tunnels.has(spec.name)) continue;
|
|
17426
|
+
if (tunnelRecreateInFlight.has(spec.name)) continue;
|
|
17427
|
+
const now = Date.now();
|
|
17428
|
+
const st = tunnelRecreateState.get(spec.name) ?? { nextAttemptAt: 0, attempts: 0 };
|
|
17429
|
+
if (now < st.nextAttemptAt) continue;
|
|
17430
|
+
st.attempts++;
|
|
17431
|
+
st.nextAttemptAt = now + Math.min(15e3 * Math.pow(2, st.attempts - 1), 5 * 6e4);
|
|
17432
|
+
tunnelRecreateState.set(spec.name, st);
|
|
17433
|
+
logger.log(`frpc tunnel '${spec.name}' missing from live set \u2014 rebuilding (attempt ${st.attempts})`);
|
|
17434
|
+
tunnelRecreateInFlight.add(spec.name);
|
|
17435
|
+
createExposedTunnel(spec).then((fresh) => {
|
|
17436
|
+
tunnels.set(spec.name, fresh);
|
|
17437
|
+
logger.log(`frpc tunnel '${spec.name}' rebuilt`);
|
|
17438
|
+
}).catch((err) => {
|
|
17439
|
+
logger.log(`frpc tunnel '${spec.name}' rebuild failed: ${err.message} (will retry)`);
|
|
17440
|
+
}).finally(() => {
|
|
17441
|
+
tunnelRecreateInFlight.delete(spec.name);
|
|
17442
|
+
});
|
|
17443
|
+
}
|
|
17444
|
+
} catch (e) {
|
|
17445
|
+
logger.log(`frpc tunnel reconcile pass error: ${e.message}`);
|
|
17446
|
+
}
|
|
17394
17447
|
} finally {
|
|
17395
17448
|
heartbeatRunning = false;
|
|
17396
17449
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as resolveProjectRoot, H as listWorkflows, I as isWorkflowEnabled, J as workflowCrons, C as runWorkflow, K as cronMatches } from './run-
|
|
1
|
+
import { n as resolveProjectRoot, H as listWorkflows, I as isWorkflowEnabled, J as workflowCrons, C as runWorkflow, K as cronMatches } from './run-BtGnnEMI.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|
|
@@ -42,6 +42,11 @@ class WorkflowScheduler {
|
|
|
42
42
|
lastTickMs = null;
|
|
43
43
|
// In-flight runs (fire-and-forget). `idle()` awaits them — used by tests; harmless in prod.
|
|
44
44
|
pending = /* @__PURE__ */ new Set();
|
|
45
|
+
// #0329: per-workflow (root\0name) in-flight guard. A scheduled workflow whose steps outlast its
|
|
46
|
+
// cron period (a `session loop`, a test suite, a deploy) would otherwise be fired AGAIN on the next
|
|
47
|
+
// matching minute while the prior run is still executing — two concurrent runs of a destructive step
|
|
48
|
+
// can race. We skip a fire while the same workflow is already running.
|
|
49
|
+
running = /* @__PURE__ */ new Set();
|
|
45
50
|
// Default cap on how many skipped minutes we look back over on a single tick. Deliberately small: it
|
|
46
51
|
// rescues genuine short gaps (a >60s event-loop stall, a brief suspend) without resurrecting daily
|
|
47
52
|
// crons hours late after a long sleep — multi-hour catch-up needs persisted last-fire state, out of
|
|
@@ -105,9 +110,19 @@ class WorkflowScheduler {
|
|
|
105
110
|
}
|
|
106
111
|
return fired;
|
|
107
112
|
}
|
|
113
|
+
/** True if a scheduled run of this workflow is already executing (test/introspection helper). */
|
|
114
|
+
isRunning(root, name) {
|
|
115
|
+
return this.running.has(`${root}\0${name}`);
|
|
116
|
+
}
|
|
108
117
|
fire(root, wf) {
|
|
109
118
|
const owner = wf.session || null;
|
|
119
|
+
const key = `${root}\0${wf.name}`;
|
|
120
|
+
if (this.running.has(key)) {
|
|
121
|
+
this.deps.log?.(`[workflow] schedule skipped "${wf.name}" in ${root} \u2014 previous run still in progress`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
110
124
|
this.deps.log?.(`[workflow] schedule fired "${wf.name}" in ${root}${owner ? ` as ${owner}` : ""}`);
|
|
125
|
+
this.running.add(key);
|
|
111
126
|
const p = runWorkflow(root, wf, {
|
|
112
127
|
trigger: "schedule",
|
|
113
128
|
actor: owner,
|
|
@@ -119,7 +134,10 @@ class WorkflowScheduler {
|
|
|
119
134
|
return void 0;
|
|
120
135
|
});
|
|
121
136
|
this.pending.add(p);
|
|
122
|
-
p.finally(() =>
|
|
137
|
+
p.finally(() => {
|
|
138
|
+
this.pending.delete(p);
|
|
139
|
+
this.running.delete(key);
|
|
140
|
+
});
|
|
123
141
|
}
|
|
124
142
|
}
|
|
125
143
|
|
|
@@ -54,7 +54,7 @@ async function handleServeCommand() {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function serveAdd(args, machineId) {
|
|
57
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
57
|
+
const { connectAndGetMachine } = await import('./commands-CE1PdEJJ.mjs');
|
|
58
58
|
const pos = positionalArgs(args);
|
|
59
59
|
const name = pos[0];
|
|
60
60
|
if (!name) {
|
|
@@ -93,7 +93,7 @@ async function serveAdd(args, machineId) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
async function serveApply(args, machineId) {
|
|
96
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
96
|
+
const { connectAndGetMachine } = await import('./commands-CE1PdEJJ.mjs');
|
|
97
97
|
const fs = await import('fs');
|
|
98
98
|
const yaml = await import('yaml');
|
|
99
99
|
const file = positionalArgs(args)[0];
|
|
@@ -182,7 +182,7 @@ async function serveApply(args, machineId) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
async function serveRemove(args, machineId) {
|
|
185
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
185
|
+
const { connectAndGetMachine } = await import('./commands-CE1PdEJJ.mjs');
|
|
186
186
|
const pos = positionalArgs(args);
|
|
187
187
|
const name = pos[0];
|
|
188
188
|
if (!name) {
|
|
@@ -202,7 +202,7 @@ async function serveRemove(args, machineId) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
async function serveList(args, machineId) {
|
|
205
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
205
|
+
const { connectAndGetMachine } = await import('./commands-CE1PdEJJ.mjs');
|
|
206
206
|
const all = hasFlag(args, "--all", "-a");
|
|
207
207
|
const json = hasFlag(args, "--json");
|
|
208
208
|
const sessionId = getFlag(args, "--session");
|
|
@@ -235,7 +235,7 @@ async function serveList(args, machineId) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
async function serveInfo(machineId) {
|
|
238
|
-
const { connectAndGetMachine } = await import('./commands-
|
|
238
|
+
const { connectAndGetMachine } = await import('./commands-CE1PdEJJ.mjs');
|
|
239
239
|
const { machine, server } = await connectAndGetMachine(machineId);
|
|
240
240
|
try {
|
|
241
241
|
const info = await machine.serveInfo();
|
|
@@ -4,7 +4,7 @@ import * as fs from 'fs';
|
|
|
4
4
|
import * as http from 'http';
|
|
5
5
|
import * as net from 'net';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
-
import { l as getHyphaServerUrl, S as ServeAuth, m as hasCookieToken } from './run-
|
|
7
|
+
import { l as getHyphaServerUrl, S as ServeAuth, m as hasCookieToken } from './run-BtGnnEMI.mjs';
|
|
8
8
|
import 'os';
|
|
9
9
|
import 'fs/promises';
|
|
10
10
|
import 'url';
|
|
@@ -751,7 +751,7 @@ class ServeManager {
|
|
|
751
751
|
const mount = this.mounts.get(mountName);
|
|
752
752
|
const subdomainOverride = mount?.access === "link" && mount.linkToken ? /* @__PURE__ */ new Map([[this.port, buildLinkSubdomain(subdomainSafe, mount.linkToken)]]) : void 0;
|
|
753
753
|
try {
|
|
754
|
-
const { FrpcTunnel } = await import('./frpc-
|
|
754
|
+
const { FrpcTunnel } = await import('./frpc-QESvQN-s.mjs');
|
|
755
755
|
let tunnel;
|
|
756
756
|
tunnel = new FrpcTunnel({
|
|
757
757
|
name: tunnelName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as READ_ONLY_TOOLS, N as loadMachineContext, O as buildMachineInstructions, P as machineToolsForRole, Q as buildMachineTools } from './run-
|
|
1
|
+
import { R as READ_ONLY_TOOLS, N as loadMachineContext, O as buildMachineInstructions, P as machineToolsForRole, Q as buildMachineTools } from './run-BtGnnEMI.mjs';
|
|
2
2
|
import 'node:child_process';
|
|
3
3
|
import 'os';
|
|
4
4
|
import 'fs/promises';
|