@dotrino/terminal-agent 0.22.0 → 0.24.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.
Files changed (2) hide show
  1. package/consoles.js +11 -1
  2. package/package.json +6 -3
package/consoles.js CHANGED
@@ -55,6 +55,16 @@ export function cwdOf (pid) {
55
55
  return dir === home ? '~' : dir.startsWith(home + '/') ? '~' + dir.slice(home.length) : dir
56
56
  }
57
57
 
58
+ /**
59
+ * `usuario@máquina` de ESTA máquina, tal como lo pone el prompt de una shell (`\u@\h`: el nombre
60
+ * hasta el primer punto). Va con cada consola para que el panel sepa si su título habla de OTRA
61
+ * (tras un `ssh`) y solo entonces la enseñe. Si el sistema no lo dice, `null`: no se inventa.
62
+ */
63
+ export function userAtHost () {
64
+ try { return `${os.userInfo().username}@${os.hostname().split('.')[0]}` } catch (_) { return null }
65
+ }
66
+ const HOST = userAtHost()
67
+
58
68
  const randomId = () => [...crypto.getRandomValues(new Uint8Array(8))].map((x) => x.toString(16).padStart(2, '0')).join('')
59
69
 
60
70
  class Console {
@@ -242,7 +252,7 @@ class Console {
242
252
  const watchers = [...this.viewers].filter((v) => v.origin).map((v) => ({ origin: v.origin, device: v.device || null, tag: v.tag || null }))
243
253
  const d = this.decider()
244
254
  const sizeBy = d ? { origin: d.origin || null, device: d.device || null, tag: d.tag || null, pinned: !!d && d === this.pinnedViewer() } : null
245
- return { id: this.id, n: this.n, activity: this.busy ? 'busy' : 'idle', doneAt: this.doneAt, sizeBy, origin: this.origin, title: this.title, cwd: cwdOf(this.pty?.pid), cols: this.cols, rows: this.rows, createdAt: this.createdAt, lastActive: this.lastActive, viewers: this.viewers.size, watchers }
255
+ return { id: this.id, n: this.n, activity: this.busy ? 'busy' : 'idle', doneAt: this.doneAt, sizeBy, origin: this.origin, title: this.title, host: HOST, cwd: cwdOf(this.pty?.pid), cols: this.cols, rows: this.rows, createdAt: this.createdAt, lastActive: this.lastActive, viewers: this.viewers.size, watchers }
246
256
  }
247
257
  }
248
258
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/terminal-agent",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Dotrino Terminal: las ventanas de esta máquina (dotrino-terminal) y su agente, que deja abrir esas mismas consolas desde los otros aparatos de tu cuenta, cifrado punto a punto.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@dotrino/identity": "0.107.2",
30
- "@dotrino/proxy-client": "0.27.1",
31
- "@dotrino/remote-agent": "0.14.0",
30
+ "@dotrino/proxy-client": "0.29.0",
31
+ "@dotrino/remote-agent": "0.15.1",
32
32
  "@dotrino/update": "0.2.2",
33
33
  "@dotrino/vault": "0.79.0",
34
34
  "@xterm/addon-serialize": "0.13.0",
@@ -49,5 +49,8 @@
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.0.0",
51
51
  "typescript": "5.9.3"
52
+ },
53
+ "optionalDependencies": {
54
+ "@dotrino/webrtc": "0.1.0"
52
55
  }
53
56
  }