instar 0.23.6 → 0.23.8

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 (34) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +43 -6
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/commands/setup.d.ts +10 -0
  5. package/dist/commands/setup.d.ts.map +1 -1
  6. package/dist/commands/setup.js +250 -10
  7. package/dist/commands/setup.js.map +1 -1
  8. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  9. package/dist/core/PostUpdateMigrator.js +1 -0
  10. package/dist/core/PostUpdateMigrator.js.map +1 -1
  11. package/dist/core/SessionManager.d.ts +2 -0
  12. package/dist/core/SessionManager.d.ts.map +1 -1
  13. package/dist/core/SessionManager.js +53 -1
  14. package/dist/core/SessionManager.js.map +1 -1
  15. package/dist/lifeline/MessageQueue.d.ts +2 -0
  16. package/dist/lifeline/MessageQueue.d.ts.map +1 -1
  17. package/dist/lifeline/MessageQueue.js.map +1 -1
  18. package/dist/lifeline/TelegramLifeline.d.ts +9 -0
  19. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
  20. package/dist/lifeline/TelegramLifeline.js +133 -11
  21. package/dist/lifeline/TelegramLifeline.js.map +1 -1
  22. package/dist/messaging/TelegramAdapter.d.ts +17 -0
  23. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  24. package/dist/messaging/TelegramAdapter.js +139 -14
  25. package/dist/messaging/TelegramAdapter.js.map +1 -1
  26. package/dist/scaffold/templates.d.ts.map +1 -1
  27. package/dist/scaffold/templates.js +1 -0
  28. package/dist/scaffold/templates.js.map +1 -1
  29. package/dist/types/pipeline.d.ts +3 -3
  30. package/dist/types/pipeline.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/data/builtin-manifest.json +18 -18
  33. package/upgrades/0.23.8.md +38 -0
  34. package/upgrades/NEXT.md +21 -24
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwPH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA6gCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwzEtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAwPH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA8gCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAy1EtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -718,7 +718,8 @@ function messageToPipeline(msg, topicName) {
718
718
  content: msg.content,
719
719
  type: msg.content.startsWith('[voice]') ? 'voice'
720
720
  : msg.content.startsWith('[image:') ? 'photo'
721
- : 'text',
721
+ : msg.content.startsWith('[document:') ? 'document'
722
+ : 'text',
722
723
  timestamp: msg.receivedAt,
723
724
  };
724
725
  }
@@ -3203,18 +3204,54 @@ export async function startServer(options) {
3203
3204
  console.warn(`[server] Dashboard topic setup failed: ${err instanceof Error ? err.message : String(err)}`);
3204
3205
  }
3205
3206
  }
3206
- // Self-healing: ensure autostart is installed so the server always restarts
3207
+ // Self-healing: ensure autostart is installed AND uses the correct format.
3207
3208
  // This is a non-negotiable requirement — the user must always be able to reach their agent remotely.
3208
- // If autostart isn't installed, install it silently. The agent should never require human intervention
3209
- // to ensure its own resilience.
3209
+ // If autostart isn't installed, install it silently. If it uses the old /bin/bash entry point
3210
+ // (vulnerable to macOS TCC/FDA restrictions), regenerate it with the node + JS wrapper.
3210
3211
  try {
3211
3212
  const hasTelegram = !!telegram;
3212
3213
  const autostartInstalled = isAutostartInstalled(config.projectName);
3213
- if (!autostartInstalled) {
3214
+ let needsReinstall = !autostartInstalled;
3215
+ // On macOS, keep node symlink fresh and check plist format
3216
+ if (process.platform === 'darwin') {
3217
+ // Always update the node symlink — primary defense against NVM/asdf switches
3218
+ try {
3219
+ const { ensureStableNodeSymlink } = await import('./setup.js');
3220
+ ensureStableNodeSymlink(config.projectDir);
3221
+ }
3222
+ catch { /* non-critical */ }
3223
+ if (!needsReinstall) {
3224
+ const label = `ai.instar.${config.projectName}`;
3225
+ const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${label}.plist`);
3226
+ try {
3227
+ const plistContent = fs.readFileSync(plistPath, 'utf-8');
3228
+ if (!plistContent.includes('instar-boot.js')) {
3229
+ needsReinstall = true;
3230
+ console.log(pc.yellow(` Auto-start uses legacy format — upgrading to TCC-safe node entry point`));
3231
+ }
3232
+ else if (!plistContent.includes('.instar/bin/node')) {
3233
+ needsReinstall = true;
3234
+ console.log(pc.yellow(` Auto-start uses direct node path — upgrading to stable symlink`));
3235
+ }
3236
+ else {
3237
+ // Verify node path in plist still exists (should be the symlink)
3238
+ const nodeMatch = plistContent.match(/<string>(\/[^<]+node[^<]*)<\/string>/);
3239
+ if (nodeMatch && !fs.existsSync(nodeMatch[1])) {
3240
+ needsReinstall = true;
3241
+ console.log(pc.yellow(` Auto-start node path stale (${nodeMatch[1]}) — regenerating`));
3242
+ }
3243
+ }
3244
+ }
3245
+ catch { /* plist read failed — will reinstall */
3246
+ needsReinstall = true;
3247
+ }
3248
+ }
3249
+ }
3250
+ if (needsReinstall) {
3214
3251
  const { installAutoStart } = await import('./setup.js');
3215
3252
  const installed = installAutoStart(config.projectName, config.projectDir, hasTelegram);
3216
3253
  if (installed) {
3217
- console.log(pc.green(` Auto-start self-healed: installed ${process.platform === 'darwin' ? 'LaunchAgent' : 'systemd service'}`));
3254
+ console.log(pc.green(` Auto-start self-healed: installed ${process.platform === 'darwin' ? 'LaunchAgent (node + JS wrapper)' : 'systemd service'}`));
3218
3255
  }
3219
3256
  else {
3220
3257
  console.log(pc.yellow(` Auto-start not available on ${process.platform}`));