dsh-tg-bridge 1.50.0 β†’ 1.51.0

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.
@@ -22,7 +22,7 @@ import { mediaPrompt } from './media.mjs';
22
22
  import { keyboardCommand } from './menu-card.mjs';
23
23
  import { replyText } from './reply-guard.mjs';
24
24
  import { QUIET_MS, quietGuard } from './quiet-guard.mjs';
25
- import { DIR, GOAL_CMD, THOUGHT_DIR } from '../core/paths.mjs';
25
+ import { DIR, GOAL_CMD, SAY, THOUGHT_DIR } from '../core/paths.mjs';
26
26
  import { renderPrices } from '../model/prices.mjs';
27
27
  import { settingsChipOf, turnPlan } from '../profile/profile-view.mjs';
28
28
  import { startProgress } from '../turn/progress.mjs';
@@ -341,7 +341,7 @@ ${helpLines((k, vars) => t(lang, k, vars)).join('\n')}`,
341
341
  // differently when it lands in the chat as a message of its own.
342
342
  const notesMode = reasoningMode(state, config, key);
343
343
  if (notesMode !== 'off') {
344
- const prompt = t(lang, 'prompt.reasoning', { say: join(DIR, 'say.mjs') });
344
+ const prompt = t(lang, 'prompt.reasoning', { say: SAY });
345
345
  const note = notesMode === 'chat' ? `\n\n${t(lang, 'prompt.reasoningChat')}` : '';
346
346
  text = `${prompt}${note}\n\n---\n\n${text}`;
347
347
  }
package/core/paths.mjs CHANGED
@@ -26,8 +26,12 @@ export const PENDING_DIR = join(DIR, 'pending');
26
26
  export const STEER_DIR = join(DIR, 'steer');
27
27
  export const THOUGHT_DIR = join(DIR, 'thoughts');
28
28
  // The helper the agent calls to confirm an addition in the chat while the turn
29
- // is still running. Lives next to the bridge so an installed copy works too.
30
- export const SAY = join(DIR, 'say.mjs');
29
+ // is still running. Lives next to the bridge's code, like GOAL_CMD above: a
30
+ // second instance keeps its state in DSH_TG_HOME, and pointing at DIR there
31
+ // named a file that does not exist β€” the agent's first πŸ’­ line failed with
32
+ // MODULE_NOT_FOUND, and the turn went off to repair the bridge instead of
33
+ // answering the person.
34
+ export const SAY = join(SELF_DIR, 'say.mjs');
31
35
  export const DONE_FILE = join(DIR, 'done.json');
32
36
  export const RESTART_MARKER = join(DIR, 'restart.pending');
33
37
  // `/restart confirm` leaves a note here for the process that replaces it: the
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # CHANGELOG β€” DSH Telegram bridge
2
2
 
3
+ ## 1.51.0
4
+
5
+ - **A second instance keeps its own πŸ’­ lines, markers and steer files.**
6
+ `DSH_TG_HOME` already moved the state folder, but four paths were still built
7
+ from `~/.dsh/tg-bridge`. The turn preamble named the agent
8
+ `<state>/say.mjs` β€” `chat/handle-message.mjs` built the path from `DIR`
9
+ instead of the `SAY` that `core/paths.mjs` already exported β€” so a second
10
+ instance's very first step failed with `MODULE_NOT_FOUND`, and a turn asked
11
+ to greet a person went off to repair the bridge instead of answering: the
12
+ word "ΠŸΡ€ΠΈΠ²Π΅Ρ‚" cost nine tool calls and two minutes. `say.mjs` itself took its
13
+ `active/`, `thoughts/` and `steer/` folders from `~/.dsh/tg-bridge` whatever
14
+ the instance was, so the adviser bot's lines landed in the first bot's
15
+ thoughts folder β€” a file nobody reads, and the card stayed empty. And two
16
+ bots running turns in the same folder both wrote a marker into one shared
17
+ `active/` folder, which `say.mjs` reads as "more than one live turn here" and
18
+ refuses to place a line at all. Markers now live under `DIR`, `say.mjs` takes
19
+ its folders from `DSH_TG_HOME`, and `SAY` is built from `SELF_DIR` the way
20
+ `GOAL_CMD` already was. A single instance behaves exactly as before. 2 tests.
21
+
3
22
  ## 1.50.0
4
23
 
5
24
  - **↻ β€” the last answer, asked again.** Every finished turn's card now opens a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.50.0",
3
+ "version": "1.51.0",
4
4
  "description": "Drive DeepSeek Harness from Telegram: one project, model and session per forum topic",
5
5
  "type": "module",
6
6
  "main": "plugin-bridge.mjs",
package/say.mjs CHANGED
@@ -24,9 +24,13 @@ import { homedir } from 'node:os';
24
24
  import { join } from 'node:path';
25
25
 
26
26
  const DSH_HOME = process.env.DSH_HOME || join(homedir(), '.dsh');
27
- const STEER = join(DSH_HOME, 'tg-bridge', 'steer');
27
+ // A second bridge instance keeps its state in its own folder (`DSH_TG_HOME`,
28
+ // see core/paths.mjs). Without this the adviser's πŸ’­ lines landed in the first
29
+ // bot's thoughts folder β€” a file nobody reads, so the card stayed empty.
30
+ const TG_DIR = (process.env.DSH_TG_HOME || '').trim() || join(DSH_HOME, 'tg-bridge');
31
+ const STEER = join(TG_DIR, 'steer');
28
32
  const ACKS = join(STEER, 'acks');
29
- const THOUGHTS = (process.env.DSH_TG_THOUGHTS || '').trim() || join(DSH_HOME, 'tg-bridge', 'thoughts');
33
+ const THOUGHTS = (process.env.DSH_TG_THOUGHTS || '').trim() || join(TG_DIR, 'thoughts');
30
34
 
31
35
  function findToken() {
32
36
  const env = (process.env.DSH_TELEGRAM_BOT_TOKEN || '').trim();
@@ -95,7 +99,7 @@ function activeThoughtFile() {
95
99
  */
96
100
  function activeMarker() {
97
101
  try {
98
- const dir = join(DSH_HOME, 'tg-bridge', 'active');
102
+ const dir = join(TG_DIR, 'active');
99
103
  const want = process.cwd().toLowerCase();
100
104
  const hits = [];
101
105
  for (const name of readdirSync(dir)) {
package/turn/active.mjs CHANGED
@@ -12,11 +12,18 @@
12
12
  // zero or two match: an ambiguous answer is the one thing worse than none.
13
13
  import { mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
14
14
  import { join } from 'node:path';
15
- import { DSH_HOME } from '../core/paths.mjs';
15
+ import { DIR } from '../core/paths.mjs';
16
16
 
17
- /** Where the markers live: under `~/.dsh`, next to the thoughts they name. */
17
+ /**
18
+ * Where the markers live: next to the thoughts they name.
19
+ *
20
+ * Under `DIR`, not a fixed `~/.dsh/tg-bridge`: a second bridge instance (the
21
+ * adviser bot) has its own state folder, and both bots run turns in the same
22
+ * workspace. Sharing one marker folder made each of them see two live turns in
23
+ * that folder and refuse to place a πŸ’­ line at all.
24
+ */
18
25
  export function activeDir() {
19
- return join(DSH_HOME, 'tg-bridge', 'active');
26
+ return join(DIR, 'active');
20
27
  }
21
28
 
22
29
  /**