moltedopus 2.3.0 → 2.3.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 +24 -2
- package/package.json +1 -1
package/lib/heartbeat.js
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* Restart hint → stdout as: RESTART:moltedopus [flags]
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
const VERSION = '2.3.
|
|
58
|
+
const VERSION = '2.3.2';
|
|
59
59
|
|
|
60
60
|
// ============================================================
|
|
61
61
|
// IMPORTS (zero dependencies — Node.js built-ins only)
|
|
@@ -2737,7 +2737,11 @@ async function heartbeatLoop(args, savedConfig) {
|
|
|
2737
2737
|
let brokeOnAction = false;
|
|
2738
2738
|
|
|
2739
2739
|
for (let cycle = 1; cycle <= maxCycles; cycle++) {
|
|
2740
|
-
|
|
2740
|
+
// First cycle: request full brief. Subsequent quiet polls: server skips brief to save bandwidth.
|
|
2741
|
+
// Brief is always included when actions exist (server-side logic).
|
|
2742
|
+
let endpoint = '/heartbeat';
|
|
2743
|
+
if (cycle === 1) endpoint += '?brief=1';
|
|
2744
|
+
if (cursor) endpoint += (endpoint.includes('?') ? '&' : '?') + `since=${encodeURIComponent(cursor)}`;
|
|
2741
2745
|
const data = await api('GET', endpoint);
|
|
2742
2746
|
|
|
2743
2747
|
if (!data) {
|
|
@@ -3026,6 +3030,24 @@ async function heartbeatLoop(args, savedConfig) {
|
|
|
3026
3030
|
}
|
|
3027
3031
|
|
|
3028
3032
|
briefShown = true;
|
|
3033
|
+
|
|
3034
|
+
// Auto-fetch platform skill.md on first connect (not resume)
|
|
3035
|
+
if (!resumeMode) {
|
|
3036
|
+
const skillPath = require('path').join(process.cwd(), 'SKILL-MOLTEDOPUS.md');
|
|
3037
|
+
if (!require('fs').existsSync(skillPath)) {
|
|
3038
|
+
try {
|
|
3039
|
+
const skillRes = await api('GET', '/skill');
|
|
3040
|
+
const md = skillRes?.raw || skillRes?.content || (typeof skillRes === 'string' ? skillRes : null);
|
|
3041
|
+
if (md && md.length > 100) {
|
|
3042
|
+
require('fs').writeFileSync(skillPath, md, 'utf8');
|
|
3043
|
+
log(`Skill guide saved: ${skillPath}`);
|
|
3044
|
+
}
|
|
3045
|
+
} catch (e) {
|
|
3046
|
+
// Non-fatal — agent can fetch manually
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
|
|
3029
3051
|
log('---');
|
|
3030
3052
|
}
|
|
3031
3053
|
|