@goodandready/dsh-messenger-gateway 0.4.7 → 0.4.8

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/lib/config.js CHANGED
@@ -7,8 +7,8 @@ const HomeEntry = z.object({
7
7
  })
8
8
 
9
9
  export const PluginConfig = z.object({
10
- enabled: z.boolean().default(true),
11
- internalBaseURL: z.string().default('http://127.0.0.1:3080'),
10
+ enabled: z.boolean().volatile().default(true),
11
+ internalBaseURL: z.string().volatile().default('http://127.0.0.1:3080'),
12
12
  telegram: z.object({
13
13
  enabled: z.boolean().default(false),
14
14
  botToken: z.string().role('secret').default(''),
@@ -102,3 +102,13 @@ export const PluginConfig = z.object({
102
102
  })
103
103
 
104
104
  export const Config = PluginConfig
105
+
106
+ // Unwrap Volatile boxes before any caller reads a value. The Loader mutates the
107
+ // boxes in place and re-announces them with loader/volatile-update, so this must
108
+ // read the entry config lazily rather than caching the parsed result.
109
+ export function plainConfig(value) {
110
+ if (value === null || typeof value !== 'object') return value
111
+ if (Array.isArray(value)) return value.map(plainConfig)
112
+ if (typeof value.get === 'function') return plainConfig(value.get())
113
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, plainConfig(v)]))
114
+ }
package/lib/index.js CHANGED
@@ -10,7 +10,8 @@ import {
10
10
  messengerApiSchema, parseMessengerBody,
11
11
  } from './messenger-api.js'
12
12
  import { listHomes } from './homes.js'
13
- import { Config } from './config.js'
13
+ export { plainConfig } from './config.js'
14
+ import { Config, plainConfig } from './config.js'
14
15
  import { setupSettings } from './settings-bridge.js'
15
16
 
16
17
  export const name = '@goodandready/dsh-messenger-gateway'
@@ -20,7 +21,8 @@ export const SETTINGS_NAMESPACE = 'dsh-messenger-gateway'
20
21
  export { Config }
21
22
 
22
23
  function resolveConfig(raw) {
23
- const cfg = Config(raw)
24
+ // Unwrap once here: everything downstream reads plain values.
25
+ const cfg = plainConfig(Config(raw))
24
26
  const home = process.env.DSH_HOME || join(homedir(), '.dsh')
25
27
  if (!cfg.media.cacheDir) {
26
28
  cfg.media = { ...cfg.media, cacheDir: join(home, 'messenger-gateway', 'cache') }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-messenger-gateway",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Telegram messenger bridge for DeepSeek Harness: sessions, steer, homes, inline asks, notify bridge, and optional TTS voice notes.",
5
5
  "license": "MIT",
6
6
  "type": "module",