@dmsdc-ai/aigentry-telepty 0.1.38 → 0.1.40

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 (3) hide show
  1. package/cli.js +5 -5
  2. package/daemon.js +8 -1
  3. package/package.json +1 -1
package/cli.js CHANGED
@@ -744,7 +744,7 @@ async function main() {
744
744
  daemonWs.on('open', () => {
745
745
  wsReady = true;
746
746
  if (reconnectAttempts > 0) {
747
- console.error(`\n\x1b[32m⚡ Reconnected to daemon. Inject restored.\x1b[0m`);
747
+ // Silent reconnect — no console output to avoid breaking TUI rendering
748
748
  // Force CLI redraw by triggering SIGWINCH (resize +1/-1)
749
749
  const origCols = child.cols || process.stdout.columns || 80;
750
750
  const origRows = child.rows || process.stdout.rows || 30;
@@ -791,7 +791,7 @@ async function main() {
791
791
  reconnectAttempts++;
792
792
  const delay = Math.min(1000 * Math.pow(2, reconnectAttempts - 1), MAX_RECONNECT_DELAY);
793
793
  if (reconnectAttempts === 1) {
794
- console.error(`\n\x1b[33m⚠️ Disconnected from daemon. Reconnecting...\x1b[0m`);
794
+ // Silent — no console output to avoid breaking TUI rendering
795
795
  }
796
796
  reconnectTimer = setTimeout(() => {
797
797
  reconnectTimer = null;
@@ -818,9 +818,9 @@ async function main() {
818
818
  // Intercept terminal title escape sequences and prefix with session ID
819
819
  const titlePrefix = `\u26A1 ${sessionId}`;
820
820
  function rewriteTitleSequences(output) {
821
- // Match OSC title sequences: \x1b]0;TITLE\x07 or \x1b]2;TITLE\x07
822
- return output.replace(/\x1b\]([02]);([^\x07]*)\x07/g, (match, code, title) => {
823
- return `\x1b]${code};${titlePrefix} | ${title}\x07`;
821
+ // Match OSC title sequences with BEL (\x07) or ST (\x1b\\) terminator
822
+ return output.replace(/\x1b\]([02]);([^\x07\x1b]*?)(\x07|\x1b\\)/g, (match, code, title, term) => {
823
+ return `\x1b]${code};${titlePrefix} | ${title}${term}`;
824
824
  });
825
825
  }
826
826
 
package/daemon.js CHANGED
@@ -193,7 +193,14 @@ app.post('/api/sessions/spawn', (req, res) => {
193
193
  app.post('/api/sessions/register', (req, res) => {
194
194
  const { session_id, command, cwd = process.cwd() } = req.body;
195
195
  if (!session_id) return res.status(400).json({ error: 'session_id is required' });
196
- if (sessions[session_id]) return res.status(409).json({ error: `Session ID '${session_id}' is already active.` });
196
+ // Idempotent: allow re-registration (update command/cwd, keep clients)
197
+ if (sessions[session_id]) {
198
+ const existing = sessions[session_id];
199
+ if (command) existing.command = command;
200
+ if (cwd) existing.cwd = cwd;
201
+ console.log(`[REGISTER] Re-registered session ${session_id} (updated metadata)`);
202
+ return res.status(200).json({ session_id, type: 'wrapped', command: existing.command, cwd: existing.cwd, reregistered: true });
203
+ }
197
204
 
198
205
  const sessionRecord = {
199
206
  id: session_id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmsdc-ai/aigentry-telepty",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "main": "daemon.js",
5
5
  "bin": {
6
6
  "aigentry-telepty": "install.js",