@eventmodelers/cli 2.0.33 → 2.0.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.
- package/cli.js +24 -20
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -3534,6 +3534,30 @@ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false
|
|
|
3534
3534
|
onSubscribed,
|
|
3535
3535
|
});
|
|
3536
3536
|
|
|
3537
|
+
// The first heartbeat goes out BEFORE any channel is joined: joining runs a catch-up drain, and the platform only hands
|
|
3538
|
+
// prompts to an agent with a live heartbeat (403 AGENT_NOT_CONNECTED otherwise). Pinging after subscribing made that first
|
|
3539
|
+
// drain fail and left the backlog waiting for the next prompt:created.
|
|
3540
|
+
// `status`: 'shutting_down' is the last ping before an exit the board asked for; every other ping says what the agent is
|
|
3541
|
+
// doing right now — modeling while a turn runs (a prompt, a chat reply, a board change), idle otherwise.
|
|
3542
|
+
const ping = async (status) => {
|
|
3543
|
+
const agentStatus = status === 'shutting_down' ? status : turnsInFlight > 0 ? 'modeling' : 'idle';
|
|
3544
|
+
try {
|
|
3545
|
+
const res = await fetch(`${cfg.baseUrl}/api/agent-alive`, {
|
|
3546
|
+
method: 'POST',
|
|
3547
|
+
headers: { Authorization: `Bearer ${realtimeToken}`, 'Content-Type': 'application/json' },
|
|
3548
|
+
// chat_enabled tells the board this agent answers chat messages (the panel only offers chat
|
|
3549
|
+
// with one that does); a --worker reports false, and older CLIs send nothing, which the
|
|
3550
|
+
// backend reads as false too.
|
|
3551
|
+
body: JSON.stringify({ token: cfg.token, board_id: cfg.boardId, agent_type: 'MODELING', agent_id: cfg.agentId, chat_enabled: chat, status: agentStatus, ...(cfg.agentName ? { agent_name: cfg.agentName } : {}) }),
|
|
3552
|
+
signal: AbortSignal.timeout(10_000),
|
|
3553
|
+
});
|
|
3554
|
+
if (!res.ok) log(`ping failed: ${res.status} ${await res.text().catch(() => '')}`);
|
|
3555
|
+
} catch (err) {
|
|
3556
|
+
log(`ping error: ${err.message}`);
|
|
3557
|
+
}
|
|
3558
|
+
};
|
|
3559
|
+
await ping();
|
|
3560
|
+
|
|
3537
3561
|
// The kill signal is broadcast on the BOARD channel (see the platform's agent-kill /
|
|
3538
3562
|
// backoffice/killagent slices), not on the org channel this agent uses for prompts — without
|
|
3539
3563
|
// this second subscription a modeling agent can only be stopped with a kill(1).
|
|
@@ -3567,26 +3591,6 @@ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false
|
|
|
3567
3591
|
refreshRealtimeToken('scheduled').catch(() => {});
|
|
3568
3592
|
}, 10 * 60 * 1000);
|
|
3569
3593
|
|
|
3570
|
-
// `status`: 'shutting_down' is the last ping before an exit the board asked for; every other ping says what the agent is
|
|
3571
|
-
// doing right now — modeling while a turn runs (a prompt, a chat reply, a board change), idle otherwise.
|
|
3572
|
-
const ping = async (status) => {
|
|
3573
|
-
const agentStatus = status === 'shutting_down' ? status : turnsInFlight > 0 ? 'modeling' : 'idle';
|
|
3574
|
-
try {
|
|
3575
|
-
const res = await fetch(`${cfg.baseUrl}/api/agent-alive`, {
|
|
3576
|
-
method: 'POST',
|
|
3577
|
-
headers: { Authorization: `Bearer ${realtimeToken}`, 'Content-Type': 'application/json' },
|
|
3578
|
-
// chat_enabled tells the board this agent answers chat messages (the panel only offers chat
|
|
3579
|
-
// with one that does); a --worker reports false, and older CLIs send nothing, which the
|
|
3580
|
-
// backend reads as false too.
|
|
3581
|
-
body: JSON.stringify({ token: cfg.token, board_id: cfg.boardId, agent_type: 'MODELING', agent_id: cfg.agentId, chat_enabled: chat, status: agentStatus, ...(cfg.agentName ? { agent_name: cfg.agentName } : {}) }),
|
|
3582
|
-
signal: AbortSignal.timeout(10_000),
|
|
3583
|
-
});
|
|
3584
|
-
if (!res.ok) log(`ping failed: ${res.status} ${await res.text().catch(() => '')}`);
|
|
3585
|
-
} catch (err) {
|
|
3586
|
-
log(`ping error: ${err.message}`);
|
|
3587
|
-
}
|
|
3588
|
-
};
|
|
3589
|
-
await ping();
|
|
3590
3594
|
setInterval(ping, 15_000);
|
|
3591
3595
|
reportStatus = () => { ping(); };
|
|
3592
3596
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventmodelers/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"description": "Eventmodelers CLI — real-time Claude agent + skills for Claude Code, for any stack (Node, Supabase, Axon, OpenCQRS, UmaDB, Kurrent, or modeling-only)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|