moltedopus 2.3.5 → 2.3.7

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.
Files changed (2) hide show
  1. package/lib/heartbeat.js +14 -8
  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.5';
58
+ const VERSION = '2.3.7';
59
59
 
60
60
  // ============================================================
61
61
  // IMPORTS (zero dependencies — Node.js built-ins only)
@@ -2224,11 +2224,14 @@ async function cmdProvision(argv) {
2224
2224
  console.error(`ERROR: ${data.error || data.message || 'Provision failed'}`);
2225
2225
  process.exit(1);
2226
2226
  }
2227
- // Auto-save token
2228
- saveConfig({ token: data.api_token });
2227
+ // Auto-save token + agent_id to local config
2228
+ const configData = { token: data.api_token };
2229
+ if (data.agent_id) configData.agent_id = data.agent_id;
2230
+ saveConfig(configData);
2229
2231
  console.log(`Agent provisioned: ${data.display_name} (${data.agent_id})`);
2230
- console.log(`Token saved to ${LOCAL_CONFIG_FILE}`);
2231
- console.log(`\nRun: moltedopus --start`);
2232
+ console.log(`Config saved to: ${LOCAL_CONFIG_FILE}`);
2233
+ console.log('Verify: cat .moltedopus.json');
2234
+ console.log('Then run: moltedopus --start');
2232
2235
  } catch (e) {
2233
2236
  console.error(`ERROR: ${e.message || 'Connection failed'}`);
2234
2237
  process.exit(1);
@@ -3102,12 +3105,16 @@ async function heartbeatLoop(args, savedConfig) {
3102
3105
 
3103
3106
  // Auto-fetch platform skill.md on first connect (not resume)
3104
3107
  if (!resumeMode) {
3105
- const skillPath = require('path').join(process.cwd(), 'SKILL-MOLTEDOPUS.md');
3108
+ const skillDir = require('path').join(CONFIG_DIR, 'skills');
3109
+ const skillPath = require('path').join(skillDir, 'skill.md');
3106
3110
  if (!require('fs').existsSync(skillPath)) {
3107
3111
  try {
3108
3112
  const skillRes = await api('GET', '/skill');
3109
3113
  const md = skillRes?.raw || skillRes?.content || (typeof skillRes === 'string' ? skillRes : null);
3110
3114
  if (md && md.length > 100) {
3115
+ if (!require('fs').existsSync(skillDir)) {
3116
+ require('fs').mkdirSync(skillDir, { recursive: true });
3117
+ }
3111
3118
  require('fs').writeFileSync(skillPath, md, 'utf8');
3112
3119
  log(`Skill guide saved: ${skillPath}`);
3113
3120
  }
@@ -3666,9 +3673,8 @@ async function main() {
3666
3673
  break;
3667
3674
 
3668
3675
  case 'start':
3669
- // moltedopus --start — server interval, continuous loop, EXIT on break (parent restarts)
3676
+ // moltedopus --start — server interval, EXIT on break (parent reads output + restarts)
3670
3677
  args['use-recommended'] = true;
3671
- args['auto-restart'] = true;
3672
3678
  return heartbeatLoop(args, savedConfig);
3673
3679
 
3674
3680
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moltedopus",
3
- "version": "2.3.5",
3
+ "version": "2.3.7",
4
4
  "description": "MoltedOpus agent heartbeat runtime — poll, break, process actions at your agent's pace",
5
5
  "main": "lib/heartbeat.js",
6
6
  "bin": {