dsh-remote-control-plugin 0.3.5 → 0.3.6

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/INSTALL.md +3 -3
  2. package/index.js +13 -6
  3. package/package.json +1 -1
package/INSTALL.md CHANGED
@@ -4,12 +4,12 @@ Published as `dsh-remote-control-plugin`. Self-contained: no dependencies, no bu
4
4
 
5
5
  ## Install
6
6
 
7
- Web GUI: **Plugins → Add plugin**, enter `dsh-remote-control-plugin@0.3.5`, keep the official npm
7
+ Web GUI: **Plugins → Add plugin**, enter `dsh-remote-control-plugin@0.3.6`, keep the official npm
8
8
  registry selected, then **Install** and **Enable now**. Restart DSH.
9
9
 
10
10
  From a chat (Standard or Creator preset — PTC disables `tool-plugin-manager`):
11
11
 
12
- > Install the DSH plugin bundle `dsh-remote-control-plugin@0.3.5` with plugin_manager.
12
+ > Install the DSH plugin bundle `dsh-remote-control-plugin@0.3.6` with plugin_manager.
13
13
 
14
14
  ## Connect two machines
15
15
 
@@ -27,7 +27,7 @@ Same-LAN machines need no relay. No reachable machine? Run
27
27
  - Approvals live in `$DSH_HOME/remote-control-peers.json`; delete it to revoke.
28
28
  - Relay and control API share one port (default `57330`).
29
29
  - Peer traffic is signed but not encrypted; use a private network or TLS in front.
30
- - 0.3.5 fixes: ordered transcript chunks, hosted relay persistence, stale
30
+ - 0.3.6 fixes: ordered transcript chunks, hosted relay persistence, stale
31
31
  relay peer pruning, relay fallback when a direct LAN route is blocked, a client
32
32
  module id that matches the package name, and a Devices config row for the
33
33
  remote session's model, permission preset, and plan mode.
package/index.js CHANGED
@@ -92,10 +92,15 @@ export function apply(ctx, rawConfig) {
92
92
  * remote read must not have side effects on the target.
93
93
  */
94
94
  async config(sessionId) {
95
- const values = {}
96
- const liveSession = typeof ctx.sessions?.get === 'function' ? ctx.sessions.get(sessionId) : undefined
97
- const agent = typeof ctx.agents?.get === 'function' ? ctx.agents.get(sessionId) : undefined
98
- const out = { sessionId, live: Boolean(liveSession), running: Boolean(agent) }
95
+ const out = { sessionId }
96
+ // Cordis throws when a service is read as a property without `inject`,
97
+ // so every optional service is reached through ctx.get inside a guard.
98
+ let liveSession
99
+ let agent
100
+ try { liveSession = ctx.get?.('sessions')?.get?.(sessionId) } catch { /* not injected */ }
101
+ try { agent = ctx.get?.('agents')?.get?.(sessionId) } catch { /* not injected */ }
102
+ out.live = Boolean(liveSession)
103
+ out.running = Boolean(agent)
99
104
 
100
105
  try {
101
106
  const catalog = await ctx.sessionController.modelCatalog()
@@ -148,7 +153,9 @@ export function apply(ctx, rawConfig) {
148
153
 
149
154
  const needsLive = typeof patch.permission === 'string' || typeof patch.plan === 'boolean'
150
155
  if (needsLive) {
151
- let agent = typeof ctx.agents?.get === 'function' ? ctx.agents.get(sessionId) : undefined
156
+ let agent
157
+ let session
158
+ try { agent = ctx.get?.('agents')?.get?.(sessionId) } catch { /* not injected */ }
152
159
  if (!agent) {
153
160
  try {
154
161
  const resolved = await ctx.sessionController.resolveAgent(sessionId)
@@ -157,7 +164,7 @@ export function apply(ctx, rawConfig) {
157
164
  failures.push(`resume: ${error?.message || error}`)
158
165
  }
159
166
  }
160
- const session = typeof ctx.sessions?.get === 'function' ? ctx.sessions.get(sessionId) : undefined
167
+ try { session = ctx.get?.('sessions')?.get?.(sessionId) } catch { /* not injected */ }
161
168
 
162
169
  if (typeof patch.permission === 'string') {
163
170
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-remote-control-plugin",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "Remote control for DSH: a Devices panel that discovers other DSH desktops signed into the same account, pairs with them once, and drives their sessions.",
6
6
  "exports": {