@dotrino/terminal-agent 0.36.1 → 0.37.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.
- package/README.md +4 -3
- package/bin/terminal.js +16 -13
- package/consoles.js +13 -1
- package/index.js +4 -2
- package/package.json +1 -1
- package/skills/dotrino-terminal-note/SKILL.md +12 -13
package/README.md
CHANGED
|
@@ -94,11 +94,12 @@ dotrino-terminal note # la enseña
|
|
|
94
94
|
dotrino-terminal note "texto" # la reemplaza («-» la lee de la entrada estándar)
|
|
95
95
|
dotrino-terminal note --add "línea" # le añade una línea
|
|
96
96
|
dotrino-terminal note --clear # la borra
|
|
97
|
-
dotrino-terminal note --task "tarea" # la
|
|
97
|
+
dotrino-terminal note --task "tarea" # la TAREA en curso, que va aparte de la nota
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
la
|
|
100
|
+
Son dos campos: la **nota** es de la persona (la edita desde la tarjeta) y la **tarea** es del
|
|
101
|
+
programa que corre dentro (`--task`). En la tarjeta la tarea se ve y se quita, no se edita; y
|
|
102
|
+
`--task` no puede tocar la nota.
|
|
102
103
|
|
|
103
104
|
Sin `--id`, es la consola en la que corre la orden: el agente pone su id en
|
|
104
105
|
`DOTRINO_TERMINAL_CONSOLE`. Vive en memoria, como la consola: se va con ella. Hasta 4000 caracteres.
|
package/bin/terminal.js
CHANGED
|
@@ -60,8 +60,8 @@ if (args.includes('-h') || args.includes('--help')) {
|
|
|
60
60
|
dotrino-terminal note <texto> la reemplaza («-» la lee de la entrada estándar)
|
|
61
61
|
dotrino-terminal note --add <texto> le añade una línea
|
|
62
62
|
dotrino-terminal note --clear la borra
|
|
63
|
-
dotrino-terminal note --task <texto> pone la
|
|
64
|
-
lo
|
|
63
|
+
dotrino-terminal note --task <texto> pone la TAREA en curso, que va aparte de la nota: es
|
|
64
|
+
lo que usa un programa; --task '' la quita
|
|
65
65
|
(--id <id> para otra consola; --json para leerla una máquina)
|
|
66
66
|
dotrino-terminal profiles [--json] los perfiles de esta máquina
|
|
67
67
|
dotrino-terminal link [--name <n>] enlaza un perfil con tu bóveda
|
|
@@ -86,8 +86,8 @@ Cerrar la ventana no cierra la consola: sigue abierta y se retoma después.`, `u
|
|
|
86
86
|
dotrino-terminal note <text> replace it ("-" reads it from standard input)
|
|
87
87
|
dotrino-terminal note --add <text> append a line
|
|
88
88
|
dotrino-terminal note --clear clear it
|
|
89
|
-
dotrino-terminal note --task <text> set the
|
|
90
|
-
|
|
89
|
+
dotrino-terminal note --task <text> set the TASK in progress, kept apart from the note: what
|
|
90
|
+
a program uses; --task '' removes it
|
|
91
91
|
(--id <id> for another console; --json for a machine to read)
|
|
92
92
|
dotrino-terminal profiles [--json] this machine's profiles
|
|
93
93
|
dotrino-terminal link [--name <n>] link a profile with your vault
|
|
@@ -392,7 +392,7 @@ async function list (conn) {
|
|
|
392
392
|
* agente pone su id en `DOTRINO_TERMINAL_CONSOLE`), que es como la cambia un programa desde dentro.
|
|
393
393
|
* No levanta ningún agente: sin agente no hay consola a la que ponerle nota.
|
|
394
394
|
*/
|
|
395
|
-
/**
|
|
395
|
+
/** Cómo se enseñan, al leer la nota, las líneas de la tarea (la que pone un programa con `note --task`). */
|
|
396
396
|
const TASK_MARK = '▸ '
|
|
397
397
|
|
|
398
398
|
async function note () {
|
|
@@ -424,12 +424,11 @@ async function note () {
|
|
|
424
424
|
}
|
|
425
425
|
let c
|
|
426
426
|
if (task !== undefined) {
|
|
427
|
-
// LA TAREA ES DEL PROGRAMA,
|
|
428
|
-
//
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
c = await ask({ type: 'note', id, text: [...mine, ...kept].join('\n').replace(/^\n+|\n+$/g, '') })
|
|
427
|
+
// LA TAREA ES DEL PROGRAMA, LA NOTA ES DE LA PERSONA: dos campos. Esta orden solo escribe el
|
|
428
|
+
// primero, así un agente de IA no puede pisar una nota personal ni por descuido.
|
|
429
|
+
c = await ask({ type: 'note', id, task: task.split('\n').map((l) => l.trim()).filter(Boolean).join('\n') })
|
|
430
|
+
// Un agente anterior a la 0.37 contesta, pero no guarda tareas: se dice, no se da por hecha.
|
|
431
|
+
if (c.task === undefined) die(t('el agente que corre es anterior a la 0.37.0 y no guarda tareas. Reinícialo con la versión nueva (cierra sus consolas).', 'the running agent predates 0.37.0 and keeps no tasks. Restart it with the new version (closes its consoles).'))
|
|
433
432
|
} else if (args.includes('--clear')) c = await ask({ type: 'note', id, text: '' })
|
|
434
433
|
else if (add !== undefined) {
|
|
435
434
|
const before = (await ask({ type: 'note', id })).note || ''
|
|
@@ -437,8 +436,12 @@ async function note () {
|
|
|
437
436
|
} else if (given !== null) c = await ask({ type: 'note', id, text: given })
|
|
438
437
|
else c = await ask({ type: 'note', id })
|
|
439
438
|
conn.close()
|
|
440
|
-
if (args.includes('--json')) console.log(JSON.stringify({ id: c.id, n: c.n, title: c.title, note: c.note }, null, 2))
|
|
441
|
-
else
|
|
439
|
+
if (args.includes('--json')) console.log(JSON.stringify({ id: c.id, n: c.n, title: c.title, task: c.task || '', note: c.note }, null, 2))
|
|
440
|
+
else {
|
|
441
|
+
// La tarea, marcada; debajo, la nota de la persona.
|
|
442
|
+
const lines = [...(c.task ? c.task.split('\n').map((l) => TASK_MARK + l) : []), ...(c.note ? [c.note] : [])]
|
|
443
|
+
if (lines.length) console.log(lines.join('\n'))
|
|
444
|
+
}
|
|
442
445
|
}
|
|
443
446
|
|
|
444
447
|
/** La ventana: la TTY enganchada a una consola del agente. */
|
package/consoles.js
CHANGED
|
@@ -83,6 +83,10 @@ class Console {
|
|
|
83
83
|
// DE QUÉ VA esta consola: una nota libre que escribe la persona desde cualquier pantalla, o el
|
|
84
84
|
// programa que corre dentro (`dotrino-terminal note`). En memoria, como todo lo de la consola.
|
|
85
85
|
this.note = ''
|
|
86
|
+
// LA TAREA EN CURSO, aparte de la nota: la pone el programa que corre dentro
|
|
87
|
+
// (`dotrino-terminal note --task`). Son dos campos para que un agente de IA no pueda pisar lo
|
|
88
|
+
// que escribió la persona, ni la persona tenga que editar lo del agente: solo lo quita.
|
|
89
|
+
this.task = ''
|
|
86
90
|
this.cols = cols
|
|
87
91
|
this.rows = rows
|
|
88
92
|
this.createdAt = Date.now()
|
|
@@ -152,6 +156,14 @@ class Console {
|
|
|
152
156
|
this._meta()
|
|
153
157
|
}
|
|
154
158
|
|
|
159
|
+
/** Cambia la tarea en curso (la del programa). No toca la nota de la persona. */
|
|
160
|
+
setTask (text) {
|
|
161
|
+
const task = String(text ?? '').slice(0, NOTE_MAX)
|
|
162
|
+
if (task === this.task) return
|
|
163
|
+
this.task = task
|
|
164
|
+
this._meta()
|
|
165
|
+
}
|
|
166
|
+
|
|
155
167
|
/** Avisa a todos los que miran de que cambió quién mira, el título o la nota. */
|
|
156
168
|
_meta () {
|
|
157
169
|
const info = this.info()
|
|
@@ -263,7 +275,7 @@ class Console {
|
|
|
263
275
|
const watchers = [...this.viewers].filter((v) => v.origin).map((v) => ({ origin: v.origin, device: v.device || null, tag: v.tag || null }))
|
|
264
276
|
const d = this.holder
|
|
265
277
|
const sizeBy = d ? { origin: d.origin || null, device: d.device || null, tag: d.tag || null } : null
|
|
266
|
-
return { id: this.id, n: this.n, activity: this.busy ? 'busy' : 'idle', doneAt: this.doneAt, sizeBy, origin: this.origin, title: this.title, note: this.note, host: HOST, cwd: cwdOf(this.pty?.pid), cols: this.cols, rows: this.rows, createdAt: this.createdAt, lastActive: this.lastActive, viewers: this.viewers.size, watchers }
|
|
278
|
+
return { id: this.id, n: this.n, activity: this.busy ? 'busy' : 'idle', doneAt: this.doneAt, sizeBy, origin: this.origin, title: this.title, note: this.note, task: this.task, host: HOST, cwd: cwdOf(this.pty?.pid), cols: this.cols, rows: this.rows, createdAt: this.createdAt, lastActive: this.lastActive, viewers: this.viewers.size, watchers }
|
|
267
279
|
}
|
|
268
280
|
}
|
|
269
281
|
|
package/index.js
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
* { type:'input', data } · { type:'resize', cols, rows } · { type:'take' } ·
|
|
16
16
|
* { type:'close' } (mata la consola enganchada) · { type:'kill', id } ·
|
|
17
17
|
* { type:'move', id, before? } (el orden del panel; contesta con `consoles`) ·
|
|
18
|
-
* { type:'note', id?, text? } (
|
|
19
|
-
*
|
|
18
|
+
* { type:'note', id?, text?, task? } (de qué va una consola: `text` es la nota de
|
|
19
|
+
* la persona y `task` la tarea que pone el programa; sin `id`, la enganchada;
|
|
20
|
+
* sin ninguno de los dos, solo lee; contesta con `noted`) ·
|
|
20
21
|
* { type:'unlock', code } (la clave de la máquina, si tiene: access.js)
|
|
21
22
|
* agente → cliente: { type:'consoles', list } · { type:'attached', id, fresh } ·
|
|
22
23
|
* { type:'replay', id, data, last } · { type:'out', data } ·
|
|
@@ -211,6 +212,7 @@ export function serveSession (session, hub, { origin = 'remote', gate = null } =
|
|
|
211
212
|
const c = msg.id == null ? current : hub.get(String(msg.id))
|
|
212
213
|
if (!c) return fail('no-console', 'that console no longer exists')
|
|
213
214
|
if (typeof msg.text === 'string') c.setNote(msg.text)
|
|
215
|
+
if (typeof msg.task === 'string') c.setTask(msg.task)
|
|
214
216
|
session.send({ type: 'noted', console: c.info() })
|
|
215
217
|
return
|
|
216
218
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/terminal-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.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": {
|
|
@@ -9,21 +9,21 @@ Cada consola de Dotrino Terminal tiene una **nota** que sale en una tarjeta flot
|
|
|
9
9
|
consola y, su primera línea, en la lista de consolas. Existe para que el dueño, con varias consolas
|
|
10
10
|
abiertas, sepa **de qué va la tarea en curso de cada una** sin entrar a leerla.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
La tarjeta tiene dos partes, y son dos campos distintos:
|
|
13
13
|
|
|
14
|
-
- **La tarea
|
|
15
|
-
- **
|
|
14
|
+
- **La tarea**: es TUYA. La pones con `--task`. El dueño la ve y puede quitarla, no la edita.
|
|
15
|
+
- **Las notas**: son **personales del dueño**. Las escribe él desde la tarjeta. No son tuyas.
|
|
16
16
|
|
|
17
17
|
## Regla dura: las notas personales no se tocan
|
|
18
18
|
|
|
19
|
-
**Usa SOLO `dotrino-terminal note --task`.** Esa orden
|
|
20
|
-
|
|
19
|
+
**Usa SOLO `dotrino-terminal note --task`.** Esa orden escribe la tarea y no puede tocar las notas
|
|
20
|
+
del dueño.
|
|
21
21
|
|
|
22
22
|
**Prohibido**, salvo que el usuario te lo pida con esas palabras en ese momento:
|
|
23
23
|
|
|
24
|
-
- `dotrino-terminal note "texto"` y `dotrino-terminal note -` (reemplazan
|
|
25
|
-
- `dotrino-terminal note --add …` (escribe
|
|
26
|
-
- `dotrino-terminal note --clear` (
|
|
24
|
+
- `dotrino-terminal note "texto"` y `dotrino-terminal note -` (reemplazan SUS notas)
|
|
25
|
+
- `dotrino-terminal note --add …` (escribe en sus notas como si fueras él)
|
|
26
|
+
- `dotrino-terminal note --clear` (borra sus notas)
|
|
27
27
|
|
|
28
28
|
No reescribas, ordenes, corrijas ni resumas lo que él escribió. Tampoco lo copies a tus líneas.
|
|
29
29
|
|
|
@@ -48,7 +48,7 @@ Falta: probar con firma real
|
|
|
48
48
|
EOF_TASK
|
|
49
49
|
|
|
50
50
|
dotrino-terminal note --task '' # quita tu tarea (lo del dueño se queda)
|
|
51
|
-
dotrino-terminal note # solo LEER
|
|
51
|
+
dotrino-terminal note # solo LEER: tu tarea (con «▸ ») y debajo sus notas
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
No hace falta decir qué consola: es la tuya.
|
|
@@ -66,8 +66,7 @@ No hace falta decir qué consola: es la tuya.
|
|
|
66
66
|
## Si falla
|
|
67
67
|
|
|
68
68
|
- «no sé de qué consola» / `no console to act on`: no corres dentro de Dotrino Terminal. Sigue sin nota.
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
(`npm i -g @dotrino/terminal-agent@latest`) y sigue sin
|
|
72
|
-
- «el agente no contestó: es anterior a la 0.36.0»: díselo al usuario una vez y no lo reintentes.
|
|
69
|
+
- «el agente que corre es anterior a la 0.37.0 y no guarda tareas», o «el agente no contestó»:
|
|
70
|
+
el agente de esta máquina es viejo. **No uses las otras formas como sustituto**: díselo al
|
|
71
|
+
usuario una vez (`npm i -g @dotrino/terminal-agent@latest` y reiniciarlo él) y sigue sin tarea.
|
|
73
72
|
- **Nunca reinicies el agente tú**: corres dentro de él y reiniciarlo cierra esta consola.
|