instar 0.4.3 → 0.4.4

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/dist/cli.js CHANGED
File without changes
@@ -55,15 +55,16 @@ async function respawnSessionForTopic(sessionManager, telegram, targetSession, t
55
55
  const tmpDir = '/tmp/instar-telegram';
56
56
  fs.mkdirSync(tmpDir, { recursive: true });
57
57
  let bootstrapMessage;
58
+ const relayNote = `You MUST relay your response via: cat <<'EOF' | .claude/scripts/telegram-reply.sh ${topicId}\nYour response\nEOF`;
58
59
  if (historyLines.length > 0) {
59
60
  const historyContent = historyLines.join('\n');
60
61
  const filepath = path.join(tmpDir, `history-${topicId}-${Date.now()}-${process.pid}.txt`);
61
62
  fs.writeFileSync(filepath, historyContent);
62
- // Single-line: user message + file reference for history
63
- bootstrapMessage = `[telegram:${topicId}] ${msg} (Session respawned. Thread history at ${filepath} — read it for context before responding.)`;
63
+ // Single-line: user message + file reference for history + relay instructions
64
+ bootstrapMessage = `[telegram:${topicId}] ${msg} (Session respawned. Thread history at ${filepath} — read it for context before responding. ${relayNote})`;
64
65
  }
65
66
  else {
66
- bootstrapMessage = `[telegram:${topicId}] ${msg}`;
67
+ bootstrapMessage = `[telegram:${topicId}] ${msg} (${relayNote})`;
67
68
  }
68
69
  const storedName = telegram.getTopicName(topicId);
69
70
  const topicName = storedName || targetSession;
@@ -154,7 +155,7 @@ function wireTelegramRouting(telegram, sessionManager) {
154
155
  (async () => {
155
156
  try {
156
157
  const topic = await telegram.createForumTopic(topicName, 9367192); // Green
157
- const newSession = await sessionManager.spawnInteractiveSession(`[telegram:${topic.topicId}] New session started.`, topicName);
158
+ const newSession = await sessionManager.spawnInteractiveSession(`[telegram:${topic.topicId}] New session started. (IMPORTANT: Relay all responses back via: cat <<'EOF' | .claude/scripts/telegram-reply.sh ${topic.topicId}\nYour response\nEOF)`, topicName);
158
159
  telegram.registerTopicSession(topic.topicId, newSession);
159
160
  await telegram.sendToTopic(topic.topicId, `Session created. I'm here.`);
160
161
  await telegram.sendToTopic(topicId, `New session created: "${topicName}" — check the new topic above.`);
@@ -188,19 +189,26 @@ function wireTelegramRouting(telegram, sessionManager) {
188
189
  // No session mapped — auto-spawn one
189
190
  console.log(`[telegram→session] No session for topic ${topicId}, auto-spawning...`);
190
191
  const storedName = telegram.getTopicName(topicId) || `topic-${topicId}`;
191
- // Single-line bootstrap to avoid tmux send-keys newline issues.
192
- // Multi-line context is written to a temp file for Claude to read.
192
+ // Write relay instructions to a temp file and reference it in the bootstrap message.
193
+ // The session needs to know HOW to respond back to Telegram.
193
194
  const contextLines = [
194
195
  `This session was auto-created for Telegram topic ${topicId}.`,
195
- `Respond to the user's message via Telegram relay: cat <<'EOF' | .claude/scripts/telegram-reply.sh ${topicId}`,
196
- `Your response here`,
196
+ ``,
197
+ `CRITICAL: You MUST relay your response back to Telegram after responding.`,
198
+ `Use the relay script:`,
199
+ ``,
200
+ `cat <<'EOF' | .claude/scripts/telegram-reply.sh ${topicId}`,
201
+ `Your response text here`,
197
202
  `EOF`,
203
+ ``,
204
+ `Strip the [telegram:${topicId}] prefix before interpreting the message.`,
205
+ `Only relay conversational text — not tool output or internal reasoning.`,
198
206
  ];
199
207
  const tmpDir = '/tmp/instar-telegram';
200
208
  fs.mkdirSync(tmpDir, { recursive: true });
201
209
  const ctxPath = path.join(tmpDir, `ctx-${topicId}-${Date.now()}.txt`);
202
210
  fs.writeFileSync(ctxPath, contextLines.join('\n'));
203
- const bootstrapMessage = `[telegram:${topicId}] ${text}`;
211
+ const bootstrapMessage = `[telegram:${topicId}] ${text} (IMPORTANT: Read ${ctxPath} for Telegram relay instructions — you MUST relay your response back.)`;
204
212
  sessionManager.spawnInteractiveSession(bootstrapMessage, storedName).then((newSessionName) => {
205
213
  telegram.registerTopicSession(topicId, newSessionName);
206
214
  telegram.sendToTopic(topicId, `Session created.`).catch(() => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Persistent autonomy infrastructure for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",