terminal-smart-cli 0.97.42 → 0.97.43

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/bin/ts.js +10 -2
  2. package/package.json +1 -1
package/bin/ts.js CHANGED
@@ -225,8 +225,16 @@ function _convScope(kind = 'chat', cwd = process.cwd()) {
225
225
  async function ensureConv(token, kind = 'chat', cwd = process.cwd(), forceNew = false) {
226
226
  const scope = _convScope(kind, cwd);
227
227
  const scopes = Object.assign({}, cfg.convScopes || {});
228
- if (!forceNew && scopes[scope]) return scopes[scope];
229
- const r = await api('/api/conversations', { method: 'POST', token, body: { title: conversationScope.conversationTitle(cwd, 'CLI') } });
228
+ const memoryBus = require('../lib/memory-bus');
229
+ const workstreamId = memoryBus.scope(cwd).workstreamId;
230
+ if (!forceNew && scopes[scope]) {
231
+ // Conversas criadas antes do vínculo de workstream recebem-no na primeira
232
+ // reutilização. A API só preenche se estiver vazio, então não sobrescreve
233
+ // projeto já ligado a uma conversa aberta em outra superfície.
234
+ try { await api(`/api/conversations/${scopes[scope]}`, { method: 'PUT', token, body: { workstreamId, onlyIfEmpty: true } }); } catch (_) {}
235
+ return scopes[scope];
236
+ }
237
+ const r = await api('/api/conversations', { method: 'POST', token, body: { title: conversationScope.conversationTitle(cwd, 'CLI'), scope: 'cloud', workstreamId } });
230
238
  scopes[scope] = r.id;
231
239
  // convId permanece como ponte de compatibilidade para instalações antigas;
232
240
  // toda nova leitura usa convScopes, nunca o id global legado.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.42",
3
+ "version": "0.97.43",
4
4
  "description": "Terminal Smart no seu terminal — pergunte, analise logs por pipe e orquestre agentes de IA. Comando: ts",
5
5
  "bin": {
6
6
  "ts": "bin/ts.js"