instar 0.28.73 → 0.28.74

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 (43) hide show
  1. package/dist/commands/server.d.ts.map +1 -1
  2. package/dist/commands/server.js +51 -23
  3. package/dist/commands/server.js.map +1 -1
  4. package/dist/core/SessionManager.d.ts +4 -0
  5. package/dist/core/SessionManager.d.ts.map +1 -1
  6. package/dist/core/SessionManager.js +15 -4
  7. package/dist/core/SessionManager.js.map +1 -1
  8. package/dist/core/types.d.ts +15 -0
  9. package/dist/core/types.d.ts.map +1 -1
  10. package/dist/core/types.js.map +1 -1
  11. package/dist/lifeline/TelegramLifeline.d.ts +8 -0
  12. package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
  13. package/dist/lifeline/TelegramLifeline.js +31 -1
  14. package/dist/lifeline/TelegramLifeline.js.map +1 -1
  15. package/dist/messaging/TelegramAdapter.d.ts +28 -0
  16. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  17. package/dist/messaging/TelegramAdapter.js +79 -1
  18. package/dist/messaging/TelegramAdapter.js.map +1 -1
  19. package/dist/messaging/TelegramMarkdownFormatter.d.ts +76 -0
  20. package/dist/messaging/TelegramMarkdownFormatter.d.ts.map +1 -0
  21. package/dist/messaging/TelegramMarkdownFormatter.js +493 -0
  22. package/dist/messaging/TelegramMarkdownFormatter.js.map +1 -0
  23. package/dist/messaging/imessage/IMessageAdapter.d.ts +3 -6
  24. package/dist/messaging/imessage/IMessageAdapter.d.ts.map +1 -1
  25. package/dist/messaging/imessage/IMessageAdapter.js +20 -21
  26. package/dist/messaging/imessage/IMessageAdapter.js.map +1 -1
  27. package/dist/messaging/imessage/NativeBackend.d.ts +26 -0
  28. package/dist/messaging/imessage/NativeBackend.d.ts.map +1 -1
  29. package/dist/messaging/imessage/NativeBackend.js +133 -0
  30. package/dist/messaging/imessage/NativeBackend.js.map +1 -1
  31. package/dist/messaging/telegramFormatMetrics.d.ts +22 -0
  32. package/dist/messaging/telegramFormatMetrics.d.ts.map +1 -0
  33. package/dist/messaging/telegramFormatMetrics.js +38 -0
  34. package/dist/messaging/telegramFormatMetrics.js.map +1 -0
  35. package/dist/messaging/types.d.ts +7 -0
  36. package/dist/messaging/types.d.ts.map +1 -1
  37. package/dist/messaging/types.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/data/builtin-manifest.json +5 -5
  40. package/src/templates/scripts/telegram-reply.sh +52 -8
  41. package/upgrades/0.28.74.md +48 -0
  42. package/upgrades/side-effects/telegram-markdown-renderer-pr1.md +124 -0
  43. /package/upgrades/side-effects/{capability-map-user-provenance-fallback.md → 0.28.73.md} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4PH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA81CD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAsoJtE;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;AA4PH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAg4CD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA8oJtE;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"}
@@ -1100,7 +1100,38 @@ function wireIMessageRouting(imessage, sessionManager) {
1100
1100
  const sender = msg.channel?.identifier;
1101
1101
  if (!sender)
1102
1102
  return;
1103
- const text = msg.content;
1103
+ // Build the text with attachment references inlined. iMessage stores the
1104
+ // attachment placeholder character (\uFFFC) in the text where the photo sits,
1105
+ // but doesn't include the path. We replace placeholders with explicit
1106
+ // [image:/path] tags (matching the Telegram pattern) so Claude can read the
1107
+ // files via the Read tool. Attachments are auto-hardlinked into
1108
+ // .instar/imessage/attachments/ by the user-context sync script, avoiding
1109
+ // the need for FDA on node.
1110
+ let text = msg.content;
1111
+ const attachments = msg.metadata?.attachments ?? [];
1112
+ if (attachments.length > 0) {
1113
+ // If text has no placeholders but has attachments, append refs at the end.
1114
+ // Otherwise replace each \uFFFC with an [image:/path] tag sequentially.
1115
+ const tags = attachments.map((a) => {
1116
+ if (!a.path)
1117
+ return '[attachment path unavailable]';
1118
+ // For images/PDFs/etc., use [image:...] so Claude's existing handling applies.
1119
+ // The path will be the hardlinked one if the sync script ran; otherwise
1120
+ // the TCC-protected original (which Claude may or may not be able to read).
1121
+ const isImage = (a.mimeType || '').startsWith('image/');
1122
+ const kind = isImage ? 'image' : 'file';
1123
+ return `[${kind}:${a.path}]`;
1124
+ });
1125
+ if (text.includes('\uFFFC')) {
1126
+ // Replace each placeholder with the next tag
1127
+ let i = 0;
1128
+ text = text.replace(/\uFFFC/g, () => tags[i++] ?? '[image:missing]');
1129
+ }
1130
+ else {
1131
+ // No inline placeholders — append tags at the end
1132
+ text = (text ? text + ' ' : '') + tags.join(' ');
1133
+ }
1134
+ }
1104
1135
  const senderName = msg.metadata?.senderName ?? undefined;
1105
1136
  const senderNorm = sender.toLowerCase();
1106
1137
  // Skip empty messages (reactions, read receipts, lookback artifacts)
@@ -1509,26 +1540,9 @@ export async function startServer(options) {
1509
1540
  return `${checkName}: ${message}`;
1510
1541
  }
1511
1542
  }
1512
- // Migration: fix autoApply default bug from init.ts (pre-0.9.47).
1513
- // init.ts wrote `updates.autoApply: false` despite the intended default being true.
1514
- // One-time fix: rewrite the config file if autoApply is explicitly false.
1515
- if (config.updates?.autoApply === false) {
1516
- try {
1517
- const configPath = path.join(config.projectDir, '.instar', 'config.json');
1518
- if (fs.existsSync(configPath)) {
1519
- const raw = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
1520
- if (raw.updates?.autoApply === false) {
1521
- raw.updates.autoApply = true;
1522
- fs.writeFileSync(configPath, JSON.stringify(raw, null, 2) + '\n');
1523
- config.updates = { ...config.updates, autoApply: true };
1524
- console.log(`[migration] Fixed updates.autoApply: false → true (bug in init.ts pre-0.9.47)`);
1525
- }
1526
- }
1527
- }
1528
- catch (err) {
1529
- console.error(`[migration] Failed to fix autoApply config:`, err);
1530
- }
1531
- }
1543
+ // Migration disabled we manage updates via the daily rebase job,
1544
+ // not via npm auto-updates. The migration was forcing autoApply: true
1545
+ // which overwrites our intentional autoApply: false setting.
1532
1546
  const serverSessionName = `${config.projectName}-server`;
1533
1547
  if (options.foreground) {
1534
1548
  // Run in foreground — useful for development
@@ -2124,7 +2138,14 @@ export async function startServer(options) {
2124
2138
  const isStandbyTelegram = !coordinator.isAwake && telegramConfig;
2125
2139
  if ((skipTelegram || isStandbyTelegram) && telegramConfig) {
2126
2140
  // Send-only mode: no polling, but sendToTopic() works for session replies
2127
- telegram = new TelegramAdapter(telegramConfig.config, config.stateDir);
2141
+ telegram = new TelegramAdapter({
2142
+ ...telegramConfig.config,
2143
+ // PR2: hot-reloadable accessors. Sending-side authoritative —
2144
+ // each send re-reads config so a canary flip lands without restart.
2145
+ getFormatMode: () => config
2146
+ .telegramFormatMode,
2147
+ getLintStrict: () => config.telegramLintStrict,
2148
+ }, config.stateDir);
2128
2149
  console.log(pc.green(` Telegram send-only mode (${isStandbyTelegram ? 'standby' : 'lifeline owns polling'})`));
2129
2150
  // Resolve any topic names still using the fallback "topic-NNNN" pattern
2130
2151
  telegram.resolveUnknownTopicNames().catch(err => {
@@ -2175,7 +2196,14 @@ export async function startServer(options) {
2175
2196
  }
2176
2197
  }
2177
2198
  if (telegramConfig && !skipTelegram && !isStandbyTelegram) {
2178
- telegram = new TelegramAdapter(telegramConfig.config, config.stateDir);
2199
+ telegram = new TelegramAdapter({
2200
+ ...telegramConfig.config,
2201
+ // PR2: hot-reloadable accessors. Sending-side authoritative —
2202
+ // each send re-reads config so a canary flip lands without restart.
2203
+ getFormatMode: () => config
2204
+ .telegramFormatMode,
2205
+ getLintStrict: () => config.telegramLintStrict,
2206
+ }, config.stateDir);
2179
2207
  telegram.intelligence = sharedIntelligence ?? null;
2180
2208
  await telegram.start();
2181
2209
  console.log(pc.green(` Telegram connected (stall alerts: ${sharedIntelligence ? 'LLM-gated' : 'timer-only'})`));