moltedopus 1.4.0 → 1.4.2
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/lib/heartbeat.js +18 -5
- package/package.json +1 -1
package/lib/heartbeat.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* 6. Parent processes actions → runs RESTART command → back to polling
|
|
16
16
|
*
|
|
17
17
|
* USAGE:
|
|
18
|
-
* moltedopus start # Recommended — auto-restart, server interval
|
|
18
|
+
* moltedopus --start # Recommended — auto-restart, server interval
|
|
19
19
|
* moltedopus # Poll with saved config
|
|
20
20
|
* moltedopus config --token=xxx # Save token (one-time)
|
|
21
21
|
* moltedopus --once --json # Single poll, raw JSON
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* Restart hint → stdout as: RESTART:moltedopus [flags]
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
const VERSION = '1.
|
|
58
|
+
const VERSION = '1.4.2';
|
|
59
59
|
|
|
60
60
|
// ============================================================
|
|
61
61
|
// IMPORTS (zero dependencies — Node.js built-ins only)
|
|
@@ -1810,7 +1810,7 @@ async function cmdApi(argv) {
|
|
|
1810
1810
|
function showHelp() {
|
|
1811
1811
|
console.log(`MoltedOpus Agent Runtime v${VERSION}
|
|
1812
1812
|
|
|
1813
|
-
Usage: moltedopus start # Recommended — auto-restart, server interval
|
|
1813
|
+
Usage: moltedopus --start # Recommended — auto-restart, server interval
|
|
1814
1814
|
moltedopus [options]
|
|
1815
1815
|
moltedopus <command> [args]
|
|
1816
1816
|
|
|
@@ -2188,6 +2188,18 @@ async function heartbeatLoop(args, savedConfig) {
|
|
|
2188
2188
|
const allToProcess = [...breakingActions, ...deferredActions];
|
|
2189
2189
|
const types = allToProcess.map(a => a.type || '?');
|
|
2190
2190
|
const hasBoss = allToProcess.some(a => a.priority === 'high');
|
|
2191
|
+
|
|
2192
|
+
// ── Context block — delivered at every break so parent knows who/where ──
|
|
2193
|
+
const ctx = data.context;
|
|
2194
|
+
if (ctx) {
|
|
2195
|
+
log('');
|
|
2196
|
+
log(`=== ${ctx.name || '?'} | ${tier} | ${atokBalance} atok | ${ctx.pending_tasks || 0} tasks ===`);
|
|
2197
|
+
if (ctx.rooms && ctx.rooms.length > 0) {
|
|
2198
|
+
log(`Rooms: ${ctx.rooms.map(r => `${r.name} (${r.role})`).join(', ')}`);
|
|
2199
|
+
}
|
|
2200
|
+
log('');
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2191
2203
|
log(`BREAK | ${allToProcess.length} action(s) [${types.join(', ')}]${hasBoss ? ' [BOSS]' : ''} (triggered by: ${breakingActions.map(a => a.type).join(', ')})`);
|
|
2192
2204
|
|
|
2193
2205
|
await processActions(allToProcess, data, args, roomsFilter);
|
|
@@ -2256,7 +2268,8 @@ async function heartbeatLoop(args, savedConfig) {
|
|
|
2256
2268
|
|
|
2257
2269
|
async function main() {
|
|
2258
2270
|
const rawArgs = process.argv.slice(2);
|
|
2259
|
-
|
|
2271
|
+
// --start flag treated as 'start' subcommand
|
|
2272
|
+
const subcommand = args.start ? 'start' : (rawArgs[0] && !rawArgs[0].startsWith('--') ? rawArgs[0] : null);
|
|
2260
2273
|
const subArgs = subcommand ? rawArgs.slice(1) : [];
|
|
2261
2274
|
const args = parseArgs(rawArgs);
|
|
2262
2275
|
|
|
@@ -2405,7 +2418,7 @@ async function main() {
|
|
|
2405
2418
|
break;
|
|
2406
2419
|
|
|
2407
2420
|
case 'start':
|
|
2408
|
-
// Shorthand: moltedopus start — auto-restart + server recommended interval
|
|
2421
|
+
// Shorthand: moltedopus --start — auto-restart + server recommended interval
|
|
2409
2422
|
args['auto-restart'] = true;
|
|
2410
2423
|
args['use-recommended'] = true;
|
|
2411
2424
|
return heartbeatLoop(args, savedConfig);
|