dsh-additions 0.0.0-stage → 0.10.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/CHANGELOG.md +240 -0
- package/LICENSE +21 -0
- package/README.md +325 -3
- package/assets/ding.wav +0 -0
- package/assets/uh-oh.wav +0 -0
- package/cordis.patch.yml +35 -0
- package/lib/client.js +1935 -0
- package/lib/index.js +393 -0
- package/lib/move.js +680 -0
- package/lib/quit.js +223 -0
- package/lib/rename.js +98 -0
- package/lib/sounds.js +156 -0
- package/lib/workspace-stats.js +420 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/it.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +94 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.10.0 — 2026-11-27
|
|
4
|
+
|
|
5
|
+
- **Metadati del plugin localizzati** nelle otto lingue di DSH più l'italiano:
|
|
6
|
+
`locale/<id>.json` con `meta.title` e `meta.description` (l'inglese è il
|
|
7
|
+
fallback dichiarato), export `./locale/*.json` e file inclusi nel tarball. La
|
|
8
|
+
pagina Plugins mostra così titolo e descrizione nella lingua attiva invece del
|
|
9
|
+
nome tecnico e della descrizione inglese.
|
|
10
|
+
- **Errori completamente localizzati**: il client mappa **ogni** codice delle
|
|
11
|
+
rotte di spostamento/preflight e delle statistiche su una frase localizzata
|
|
12
|
+
(`reason.*`): si aggiungono `same-workspace`, `workspace-not-found`,
|
|
13
|
+
`missing-target`/`relative-path`/`invalid-path`/`workspace-create-failed`,
|
|
14
|
+
`unsupported-format`, `clone-invalid`, `attach-failed`, `invalid-body`,
|
|
15
|
+
`internal`, `path-not-found` e `not-a-directory`. Anche il pannello
|
|
16
|
+
«Workspace» traduce gli errori della scansione.
|
|
17
|
+
- Elenchi esportati `MOVE_ERROR_CODES` (`lib/move.js`) e `STATS_ERROR_CODES`
|
|
18
|
+
(`lib/workspace-stats.js`) con un test di contratto: ogni codice ha una
|
|
19
|
+
chiave `reason.*` presente in tutte e nove le lingue.
|
|
20
|
+
- Correzione di traduzione: il portoghese usa «Espaços de trabalho» per i
|
|
21
|
+
workspace.
|
|
22
|
+
- 96 test (inclusi i nuovi controlli su metadati e copertura delle traduzioni).
|
|
23
|
+
|
|
24
|
+
## 0.9.0 — 2026-11-27
|
|
25
|
+
|
|
26
|
+
P0 del backlog: sicurezza dei dati e comportamento con lavoro in corso.
|
|
27
|
+
|
|
28
|
+
- **La copia viene validata prima di archiviare l'originale.** Dopo la
|
|
29
|
+
scrittura il plugin riapre la copia in sola lettura e verifica id, `cwd`,
|
|
30
|
+
`isSeeded` e cut, lunghezza, sequenze dense da zero, tipi, timestamp e marker
|
|
31
|
+
di consegna intestati alla copia. Se qualcosa non torna: `clone-invalid`, la
|
|
32
|
+
copia non viene registrata né l'originale archiviato, e il file viene rimosso
|
|
33
|
+
quando il percorso è assoluto. `scripts/integration.mjs` esercita la
|
|
34
|
+
validazione su un log reale da 1.322 eventi con 170 watermark.
|
|
35
|
+
- **Le chat in esecuzione vengono rifiutate** (`source-busy`, 409) prima di
|
|
36
|
+
scrivere: turno aperto, subagenti discendenti, job posseduti o promemoria
|
|
37
|
+
attivi, letti dalla waterfall `workspace/session-activity` — la stessa che
|
|
38
|
+
governa l'archiviazione del registry.
|
|
39
|
+
- **Preflight** `GET /api/additions.preflight?sessionId=…`: sola lettura, il
|
|
40
|
+
dialog la interroga all'apertura e mostra il motivo localizzato (chat in
|
|
41
|
+
esecuzione, vuota, subagente, inesistente) invece di far scegliere una
|
|
42
|
+
destinazione che poi fallirebbe.
|
|
43
|
+
- **Un motore di spostamento per plugin**: richieste concorrenti sulla stessa
|
|
44
|
+
chat sono serializzate (`move-in-progress`) e un `requestId` ripetuto risponde
|
|
45
|
+
la stessa copia senza scriverne una seconda (le richieste fallite si possono
|
|
46
|
+
ritentare).
|
|
47
|
+
- **Audit delle identità**: solo i marker di consegna della copia vengono
|
|
48
|
+
ri-puntati; `job/*.owner` resta l'originale (contratto del formato: la storia
|
|
49
|
+
copiata non trasferisce l'esecuzione) e `subagent/catalog` continua a nominare
|
|
50
|
+
le sessioni figlie. Test dedicato con tutte e tre le forme.
|
|
51
|
+
- **Cross-platform**: il confronto delle directory segue il filesystem
|
|
52
|
+
(case-sensitive fuori da Windows/macOS), gli id con separatori di percorso
|
|
53
|
+
sono rifiutati, un header senza versione di formato valida è rifiutato.
|
|
54
|
+
- **Contratto di compatibilità**: `engines.dsh` (`>=0.2.2-rc.1 <0.3.0-0`) e
|
|
55
|
+
l'elenco delle API host/client usate nel README.
|
|
56
|
+
- Il motore vive in `lib/move.js` con test dedicati; `lib/index.js` resta le
|
|
57
|
+
rotte e le altre superfici. 93 test unitari.
|
|
58
|
+
|
|
59
|
+
## 0.8.0 — 2026-11-27
|
|
60
|
+
|
|
61
|
+
- **`/rename <titolo>`**: rinomina la chat corrente dal composer. Riusa il
|
|
62
|
+
percorso del rename nativo (`SessionTitleService.rename` → evento
|
|
63
|
+
`session/title` con sorgente `user`), quindi il titolo è durevole, blocca la
|
|
64
|
+
rigenerazione automatica e segue il log in una copia spostata. Il testo dopo
|
|
65
|
+
il comando è il titolo; una coppia di virgolette esterna viene tolta. Senza
|
|
66
|
+
argomento risponde con il titolo attuale e l'uso.
|
|
67
|
+
- Il comando si registra in modo opzionale (`ctx.inject(['sessionTitle'])`):
|
|
68
|
+
in una composizione senza il servizio dei titoli non compare, e il resto del
|
|
69
|
+
plugin (move, statistiche, suoni, `/quit`) resta intatto.
|
|
70
|
+
- 9 test nuovi (`tests/rename.test.js`): parsing del titolo, registrazione,
|
|
71
|
+
rinomina, virgolette, uso, chat non viva, titolo invalido, errore generico e
|
|
72
|
+
wiring di `apply` con e senza il servizio. Totale: 80 test.
|
|
73
|
+
|
|
74
|
+
## 0.7.0 — 2026-11-27
|
|
75
|
+
|
|
76
|
+
- **Il plugin ha un suo namespace di impostazioni** (`additions`): `lib/index.js`
|
|
77
|
+
esporta ora un `Config` schemastery, e `sounds.enabled`, `sounds.ding` e
|
|
78
|
+
`sounds.approval` sono campi `.volatile()`. `settings.describe()` serve quindi
|
|
79
|
+
la namespace `additions` con esattamente quei tre campi, e le scritture si
|
|
80
|
+
applicano a caldo (nessun riavvio).
|
|
81
|
+
- **Pagina di configurazione nella pagina Plugins**: metà browser registrata in
|
|
82
|
+
`plugins.row.config` (chiavi `dsh-additions#additions` e, per il profilo con
|
|
83
|
+
l'alias storico, `dsh-chatshifter#additions`) con
|
|
84
|
+
- la casella «Attiva i suoni di notifica» (scrive subito),
|
|
85
|
+
- le due caselle di testo per i file di fine turno e di richiesta
|
|
86
|
+
autorizzazione (Salva/Annulla, inviate insieme),
|
|
87
|
+
- lo stato del salvataggio e i messaggi di rifiuto.
|
|
88
|
+
- La pagina segue il namespace servito (`ctx.configForms.whileServed`): su un
|
|
89
|
+
host senza la namespace non compare, e il resto del plugin resta intatto
|
|
90
|
+
(`configForms` è iniettato in modo opzionale).
|
|
91
|
+
- Il player segue le impostazioni accettate senza reload: la cache dei buffer è
|
|
92
|
+
per cue **e percorso**, quindi cambiare file si sente dal segnale successivo
|
|
93
|
+
anche a pagina aperta.
|
|
94
|
+
- **Nuova dipendenza**: `@deepseek-ai/schemastery` (`~3.19.0`), la libreria di
|
|
95
|
+
schema che DSH usa per la configurazione. Se manca, il modulo si carica lo
|
|
96
|
+
stesso (`Config` indefinito → niente namespace, nessuna validazione) e lo
|
|
97
|
+
segnala nel log del host.
|
|
98
|
+
- `VERSION` della metà host allineata al pacchetto (0.7.0).
|
|
99
|
+
- 23 test nuovi o aggiornati: schema (`volatileForm`-equivalente e proiezione),
|
|
100
|
+
riferimenti volatili nelle rotte, player per percorso, pagina (switch, caselle,
|
|
101
|
+
Salva, rifiuto, namespace non servito) e locale completa in 9 lingue.
|
|
102
|
+
- Verificato sul profilo live: `settings/describe` serve `additions` con i tre
|
|
103
|
+
campi; una scrittura `settings/mutate` ha aggiornato la configurazione a caldo
|
|
104
|
+
(`/api/additions.info` e la rotta del suono hanno visto il nuovo percorso) e
|
|
105
|
+
l'`unset` ha ripristinato il default lasciando il patch del profilo pulito.
|
|
106
|
+
|
|
107
|
+
## 0.6.0 — 2026-11-26
|
|
108
|
+
|
|
109
|
+
- **Segnali sonori** (`lib/sounds.js` + watcher nel bundle browser): un `ding`
|
|
110
|
+
quando il modello finisce il turno e un «uh oh» quando una richiesta di
|
|
111
|
+
permesso è in attesa. I due eventi si ricavano da `uiSession.sessionStatus`
|
|
112
|
+
(`running: true → false`, `pendingInteraction.kind === 'approval'`), quindi
|
|
113
|
+
nessun listener entra nel waterfall delle approvazioni.
|
|
114
|
+
- I suoni predefiniti sono **sintetizzati** (nessun campione di terzi):
|
|
115
|
+
`assets/ding.wav` (campana) e `assets/uh-oh.wav` (due sillabe discendenti),
|
|
116
|
+
generati da `scripts/make-sounds.mjs`, 16-bit mono 22 kHz.
|
|
117
|
+
- **File sostituibili**: `sounds.ding` / `sounds.approval` accettano un percorso
|
|
118
|
+
assoluto a un file audio (wav/mp3/ogg/m4a/flac/webm); un file illeggibile
|
|
119
|
+
ricade sul suono impacchettato e la risposta lo segnala con l'header
|
|
120
|
+
`x-additions-sound-source`. `sounds.enabled` e `sounds.volume` governano i
|
|
121
|
+
segnali; la rotta è `GET /api/additions.sound?which=ding|approval`.
|
|
122
|
+
- L'AudioContext si crea al primo gesto (pointerdown/keydown) e riprende da solo:
|
|
123
|
+
i browser bloccano l'audio prima di un'interazione. Un segnale che non può
|
|
124
|
+
suonare viene loggato e inghiottito, mai propagato all'interfaccia.
|
|
125
|
+
- Corretto anche `VERSION` in `lib/index.js`, rimasto a `0.3.0` mentre il
|
|
126
|
+
pacchetto era alla 0.5.x: `/api/additions.info` ora riporta la versione vera.
|
|
127
|
+
- 12 test nuovi (7 host sui suoni e sulla rotta, 5 sul bundle: transizioni,
|
|
128
|
+
caching del buffer, player disabilitato, `configure`).
|
|
129
|
+
|
|
130
|
+
## 0.5.3 — 2026-11-26
|
|
131
|
+
|
|
132
|
+
- **Repository rinominato** in `kormoran/dsh-additions` (prima
|
|
133
|
+
`dsh-chatshifter`): aggiornati `repository`/`homepage`/`bugs` in
|
|
134
|
+
`package.json` e le istruzioni di installazione nel README. Nessuna modifica
|
|
135
|
+
al codice; il pacchetto npm si chiamava già `dsh-additions`.
|
|
136
|
+
|
|
137
|
+
## 0.5.2 — 2026-11-25
|
|
138
|
+
|
|
139
|
+
- **La tab «Workspace» ora è trovabile**: il `+` del pannello destro apre la tab
|
|
140
|
+
*guida*, e la guida elenca solo i tipi che dichiarano voci `guide`. La
|
|
141
|
+
definition ora porta `guide: [{ id: 'workspaces', order: 10, title, description }]`
|
|
142
|
+
(senza `icon`: la guida ripiega sul proprio glifo, così il pannello non dipende
|
|
143
|
+
da un artwork esterno). Nuove chiavi `guide.title`/`guide.description` nelle 9
|
|
144
|
+
lingue; il test del bundle verifica la voce.
|
|
145
|
+
|
|
146
|
+
## 0.5.1 — 2026-11-25
|
|
147
|
+
|
|
148
|
+
- **Corretto il click su «Sposta nel workspace…»**: `MenuItemButton` segnala la
|
|
149
|
+
scelta con `onSelect`, non `onClick`. La riga veniva renderizzata (`t` e `open`
|
|
150
|
+
arrivavano) ma il gestore non veniva mai invocato: il menu restava aperto e non
|
|
151
|
+
succedeva nulla, senza errori in console. Ora la riga usa `onSelect`, e due test
|
|
152
|
+
di regressione fissano il contratto del primitivo (`onSelect` presente,
|
|
153
|
+
`onClick` assente, chiusura del menu e apertura del dialog con
|
|
154
|
+
`sessionId`/`displayTitle`).
|
|
155
|
+
|
|
156
|
+
## 0.5.0 — 2026-11-24
|
|
157
|
+
|
|
158
|
+
- **Pannello destro «Workspace»**: nuova tab per `ctx.sidebarRightTabs`
|
|
159
|
+
(`{id, kind, priority, title}`) con corpo in `sidebar.right.pane.tab` e chip in
|
|
160
|
+
`sidebar.right.pane.tab.title`. Elenca i workspace con titolo, percorso e data
|
|
161
|
+
di creazione; «Dettagli» chiama `GET /api/additions.workspace-stats` e mostra
|
|
162
|
+
dimensione, directory, file, righe di codice, righe di documentazione e totale,
|
|
163
|
+
con avviso quando la scansione è parziale e pulsanti Aggiorna/Indietro.
|
|
164
|
+
- La tab si registra in modo condizionale (`ctx.inject(['sidebarRightTabs'])`):
|
|
165
|
+
se il pannello destro non è composto, il resto della metà browser continua a
|
|
166
|
+
funzionare.
|
|
167
|
+
- 17 chiavi nuove tradotte nelle 9 lingue (dizionari di base + pannello uniti in
|
|
168
|
+
un namespace completo) e due test in più sul bundle (46 totali).
|
|
169
|
+
|
|
170
|
+
## 0.4.0 — 2026-11-24
|
|
171
|
+
|
|
172
|
+
- **Metà browser portata all'API client corrente.** DSH 0.2.1-rc.2 non espone
|
|
173
|
+
più `ctx.contextMenus`: la voce «Sposta nel workspace…» ora si registra in
|
|
174
|
+
`sidebar.workspaces.session.menu.item` con `ctx.slots.inject`/`ctx.slots.register`,
|
|
175
|
+
e il flusso di scelta della destinazione è diventato un dialog in
|
|
176
|
+
`shell.overlay` (lista dei workspace, «Un'altra cartella…», avviso su cosa non
|
|
177
|
+
viaggia, esito). Undici test del bundle coprono registrazioni, dizionari e
|
|
178
|
+
controller.
|
|
179
|
+
- **Motore delle statistiche workspace** (`lib/workspace-stats.js`) con la rotta
|
|
180
|
+
autenticata `GET /api/additions.workspace-stats?workspaceId=…|path=…`:
|
|
181
|
+
dimensione in byte, numero di directory e file, righe di codice e righe di
|
|
182
|
+
documentazione (contate separatamente, più il totale). Scansione limitata da
|
|
183
|
+
tetto di tempo, di voci e di byte letti, con rapportino `truncated`/`exhausted`;
|
|
184
|
+
directory generate e vendorizzate escluse, symlink non seguiti, file binari
|
|
185
|
+
contati come byte e non come righe. Nove test su fixture, budget e rotta.
|
|
186
|
+
- Il pannello destro «Workspace» che consuma queste statistiche arriva nel
|
|
187
|
+
prossimo passo: qui c'è il lato dati completo e testato.
|
|
188
|
+
|
|
189
|
+
## 0.3.0 — 2026-11-24
|
|
190
|
+
|
|
191
|
+
- **Rinomina**: il plugin diventa `dsh-additions` (pacchetto, bundle `id`,
|
|
192
|
+
rotte `/api/additions.*`, namespace locale `additions`, voce del loader).
|
|
193
|
+
Percorso dei nomi: `dsh-chatshifter` → `dsh-commander` (abbandonato: nome npm
|
|
194
|
+
occupato da un plugin di terzi) → `dsh-additions`. Il repository GitHub resta
|
|
195
|
+
`dsh-chatshifter` finché non lo si rinomina.
|
|
196
|
+
- **Nuovo comando `/quit`** (`lib/quit.js`): ferma il processo DSH dal composer.
|
|
197
|
+
Emette `SIGINT` dopo un ritardo configurabile — è il percorso ordinato di
|
|
198
|
+
`Ctrl+C`, quello che smonta i plugin e chiude il server web — con un watchdog
|
|
199
|
+
che forza `process.exit(0)` se lo smontaggio si blocca. Config:
|
|
200
|
+
`quit.command`, `quit.delayMs`, `quit.graceMs`. Gli argomenti sono rifiutati.
|
|
201
|
+
- La scheda del browser non può essere chiusa da script (limite dei browser):
|
|
202
|
+
il comando lo dice nel risultato e la pagina va chiusa a mano.
|
|
203
|
+
- 9 nuovi test su configurazione, ordine interrupt/watchdog, idempotenza,
|
|
204
|
+
annullamento e rifiuto degli argomenti.
|
|
205
|
+
|
|
206
|
+
## Non pubblicato — correzioni del 24/11
|
|
207
|
+
|
|
208
|
+
- Comando di test corretto per Node ≥ 22.8: `npm test` e il README usano
|
|
209
|
+
`node --test --test-isolation=none "tests/*.test.js"` al posto di `tests/`,
|
|
210
|
+
che su Node 24 fallisce con `ERR_UNSUPPORTED_DIR_IMPORT`.
|
|
211
|
+
- Documentato nel README il canale di installazione (tarball/npm vs `link:`) e
|
|
212
|
+
il fatto che una voce nuova entra nel grafo solo al riavvio di DSH.
|
|
213
|
+
|
|
214
|
+
## 0.2.0 — 2026-11-12
|
|
215
|
+
|
|
216
|
+
- Interfaccia localizzata in tutte le lingue di DSH più l'italiano: `zh`, `en`,
|
|
217
|
+
`ja`, `es`, `fr`, `de`, `ru`, `pt`, `it` (namespace `chatshifter`, baseline
|
|
218
|
+
`zh`, fallback `en`).
|
|
219
|
+
- La voce di menu, la conferma, l'avanzamento e l'esito seguono la lingua attiva.
|
|
220
|
+
- Gli errori dell'host espongono `code` e `details` stabili; il client li traduce
|
|
221
|
+
e ricade sul `message` inglese per i codici sconosciuti.
|
|
222
|
+
- Test di completezza dei dizionari, dei segnaposto e delle chiavi usate.
|
|
223
|
+
|
|
224
|
+
## 0.1.1 — 2026-11-12
|
|
225
|
+
|
|
226
|
+
- Corretto lo spostamento di chat che contengono marker
|
|
227
|
+
`session-log-deepseek/delivery-accepted`: i marker propri vengono ri-puntati
|
|
228
|
+
alla nuova identità, quelli del prefisso ereditato restano all'antenato.
|
|
229
|
+
- Aggiunti `scripts/repair-delivery.mjs` (riparazione in place con dry-run) e
|
|
230
|
+
`scripts/repro-delivery.mjs` (riproduzione del guasto).
|
|
231
|
+
- L'integrazione sceglie una sessione reale con watermark e verifica che la copia
|
|
232
|
+
li possieda.
|
|
233
|
+
|
|
234
|
+
## 0.1.0 — 2026-11-12
|
|
235
|
+
|
|
236
|
+
- Prima versione: sposta una chat in un altro workspace copiando la storia, la
|
|
237
|
+
registra nel workspace di destinazione e archivia l'originale.
|
|
238
|
+
- Voce «Sposta nel workspace…» nel menu contestuale della chat, scelta della
|
|
239
|
+
destinazione, conferma esplicita e report dell'esito.
|
|
240
|
+
- Configurazione `archiveSource` (default `true`).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Massimo Soricetti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,325 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# dsh-additions
|
|
2
|
+
|
|
3
|
+
Additional commands and functions for the DeepSeek Harness.
|
|
4
|
+
|
|
5
|
+
The plugin is a collection of functions added for my convenience as I used the harness;
|
|
6
|
+
hence the name `dsh-additions` because it's the place to add what you need—a
|
|
7
|
+
command, a panel, an action—without opening a new plugin each time.
|
|
8
|
+
For this reason, I left the numbering 0.x.0 instead of publishing it as "1.0.0": since
|
|
9
|
+
it's a collection of functions, there will probably never be a "complete" version of
|
|
10
|
+
this plugin. This is even more true because dsh itself is still in version 0.2.2 at the moment, so everything is still in progress.
|
|
11
|
+
|
|
12
|
+
## Workspace Statistics
|
|
13
|
+
|
|
14
|
+
The plugin can measure a workspace: total size in bytes, number of
|
|
15
|
+
directories, number of files, lines of **code**, and lines of **documentation**
|
|
16
|
+
(summed separately, plus the total). Documentation counts as code: `.md`,
|
|
17
|
+
`.rst`, `.txt`, `.tex`, `.adoc`, `.org`, `.mdx`, `.wiki` are added to the second
|
|
18
|
+
count.
|
|
19
|
+
|
|
20
|
+
The route is authenticated and responds only to the peer owner:
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
GET /api/additions.workspace-stats?workspaceId=<id>
|
|
24
|
+
GET /api/additions.workspace-stats?path=<absolute path>
|
|
25
|
+
→ { ok, workspaceTitle, cached,
|
|
26
|
+
path, sizeBytes, directories, files, codeFiles, docFiles,
|
|
27
|
+
codeLines, docLines, totalLines, truncated, exhausted, elapsedMs }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The scan is deliberately limited, because a workspace is an arbitrary directory
|
|
31
|
+
and a web request should never hang:
|
|
32
|
+
|
|
33
|
+
| Limit (`stats`) | Default | Effect |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `timeLimitMs` | `10000` | After this time, the scan stops and marks `truncated` |
|
|
36
|
+
| `cacheTtlMs` | `15000` | a second request within this time reuses the result (`cached: true`) |
|
|
37
|
+
| `maxEntries` | `200000` | maximum directory + file visited |
|
|
38
|
+
| `maxBytesRead` | `67108864` | bytes read to count lines |
|
|
39
|
+
|
|
40
|
+
Generated or vendor-generated directories (`.git`, `node_modules`, `.venv`, `dist`,
|
|
41
|
+
`build`, `target`, cache) are not counted; symlinks are not followed
|
|
42
|
+
; binary files (NUL in the first bytes) count as bytes but not as lines;
|
|
43
|
+
a file larger than 4 MB is partially counted and the result says
|
|
44
|
+
`exhausted: "file"`.
|
|
45
|
+
|
|
46
|
+
### Right panel "Workspace"
|
|
47
|
+
|
|
48
|
+
How to open: **`+`** (new tab) in the right panel → *guide* tab →
|
|
49
|
+
**"Workspace"** capsule. This is important to know because the `+` doesn't list registered types: it opens
|
|
50
|
+
the guide, and the guide only shows types that declare `guide` entries in their
|
|
51
|
+
definition (`{ id, order, title, description, icon? }`). A type without `guide` is
|
|
52
|
+
registered but unreachable from the UI.
|
|
53
|
+
|
|
54
|
+
The tab lists workspaces with title, path, and creation date. "Details"
|
|
55
|
+
reads live statistics and displays size, directory, files, lines of
|
|
56
|
+
code, lines of documentation, and total; if the scan is partial, it indicates this, and the
|
|
57
|
+
Refresh/Back buttons allow you to recalculate or return to the list.
|
|
58
|
+
|
|
59
|
+
The tab is only recorded if the right panel is composed
|
|
60
|
+
(`ctx.inject(['sidebarRightTabs'])`): without that service, the rest of the
|
|
61
|
+
browser half continues to function.
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
|
|
65
|
+
### `/rename` — renames the current chat
|
|
66
|
+
|
|
67
|
+
The native rename remains in the chat's `⋯` menu (the "Rename" item, with its
|
|
68
|
+
dialog); `/rename` is the keyboard variant, for when your hand is already on the
|
|
69
|
+
composer:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
/rename New title
|
|
73
|
+
/rename "A title with spaces"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The text after the command is the title (an outer pair of quotes is
|
|
77
|
+
removed). The command uses the same path as the native rename
|
|
78
|
+
(`SessionTitleService.rename`): it writes a `session/title` event with source
|
|
79
|
+
`user`, so the title is persistent, blocks automatic regeneration, and
|
|
80
|
+
travels with the log in a moved copy. Without an argument, it responds with the current title
|
|
81
|
+
and usage. If the title service is not composed, the command does not
|
|
82
|
+
appear and the rest of the plugin remains intact.
|
|
83
|
+
|
|
84
|
+
### `/quit` — Stop DSH
|
|
85
|
+
|
|
86
|
+
Type `/quit` in composer and send. The command responds, then after `delayMs`
|
|
87
|
+
it issues a `SIGINT` on the process: this is the same path as `Ctrl+C` in the launch terminal,
|
|
88
|
+
the one that unmounts plugins and shuts down the web server. If the unmount
|
|
89
|
+
blocks, a watchdog calls `process.exit(0)` after `graceMs`.
|
|
90
|
+
|
|
91
|
+
The purpose of this command is to kill the node.js process that runs dsh if
|
|
92
|
+
the harness was launched without a console window (like I do, so as not to have
|
|
93
|
+
yet another window in the way). Otherwise, the only way is to kill it from Task Manager.
|
|
94
|
+
|
|
95
|
+
| Config (`quit`) | Default | Meaning |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `command` | `quit` | command name |
|
|
98
|
+
| `delayMs` | `500` | Wait before interrupt, for the result to reach the browser |
|
|
99
|
+
| `graceMs` | `5000` | Time allowed for ordered unmounting before forced exit |
|
|
100
|
+
|
|
101
|
+
The browser tab **doesn't** close itself: Chrome and Edge ignore
|
|
102
|
+
`window.close()` on tabs opened by the user (and `dsh web` opens the browser from the
|
|
103
|
+
system, not via `window.open`). Close the tab when the page reports a
|
|
104
|
+
disconnection: the server has actually stopped.
|
|
105
|
+
|
|
106
|
+
Two things to know:
|
|
107
|
+
1. `/quit` also interrupts a current shift, and the session log remains readable upon the next resume;
|
|
108
|
+
2. `/quit` with arguments is rejected (`/quit takes no argument.`) without turning anything off.
|
|
109
|
+
|
|
110
|
+
## Sounds
|
|
111
|
+
|
|
112
|
+
Two beeps (can be disabled), so you don't have to look at the screen and can do other things while the model is running:
|
|
113
|
+
|
|
114
|
+
| Signal | When | Default sound |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| `ding` | model **ends round** (`running: true → false`) | synthesized bell |
|
|
117
|
+
| `approval` | there is a pending **permission request** (`pendingInteraction.kind === 'approval'`) | «uh oh» |
|
|
118
|
+
|
|
119
|
+
The two events are read from `uiSession.sessionStatus`, the same status the
|
|
120
|
+
client uses for activity dots: no listeners enter the approval
|
|
121
|
+
waterfall, so the plugin cannot delay or block a decision.
|
|
122
|
+
|
|
123
|
+
The default sounds are generated by [scripts/make-sounds.mjs](scripts/make-sounds.mjs)
|
|
124
|
+
(16-bit mono, 22 kHz): no third-party samples, clean license, 85 KB total.
|
|
125
|
+
|
|
126
|
+
### Activating and selecting the two files
|
|
127
|
+
|
|
128
|
+
Two equivalent paths, because the plugin declares its own settings namespace
|
|
129
|
+
(`additions`) and therefore has a configuration page.
|
|
130
|
+
|
|
131
|
+
**From the plugin page** — the normal way: open **Plugin** in the sidebar,
|
|
132
|
+
choose `dsh-additions`, open the `additions` line, and press the
|
|
133
|
+
configuration button. You will find:
|
|
134
|
+
|
|
135
|
+
- the **"Enable notification sounds"** checkbox (it works immediately, without reloading);
|
|
136
|
+
- the **"End shift"** checkbox with the path to the `ding` file;
|
|
137
|
+
- the **"Request authorization"** checkbox with the path to the `approval` file;
|
|
138
|
+
- **Save** / **Cancel** for the two text boxes (the paths are sent
|
|
139
|
+
together, so a half-written path doesn't replace a working sound).
|
|
140
|
+
|
|
141
|
+
The values thus selected end up in the profile patch (`~/.dsh/profiles/<name>/cordis.patch.yml`,
|
|
142
|
+
`additions` line) and are applied hot: they are *volatile* fields in the plugin's
|
|
143
|
+
schema, so neither the server nor the page need to be restarted.
|
|
144
|
+
|
|
145
|
+
**From the bundle configuration** — for those who prefer the file, or for a
|
|
146
|
+
generated profile:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
sounds:
|
|
150
|
+
enabled: true
|
|
151
|
+
volume: 0.7
|
|
152
|
+
ding: C:\sounds\bell.wav
|
|
153
|
+
approval: C:\sounds\uh-oh.mp3
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Field (`sounds`) | Default | Meaning |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `enabled` | `true` | turns off both signals (from the page: the checkbox) |
|
|
159
|
+
| `volume` | `0.7` | gain applied by browser (`0`–`1`); from file only |
|
|
160
|
+
| `ding` | packed asset | alternative file for end of shift (from page: box) |
|
|
161
|
+
| `approval` | packed asset | alternative file for permission request (from page: box) |
|
|
162
|
+
|
|
163
|
+
Accepted formats: wav, mp3, ogg, m4a, flac, webm; the path must be
|
|
164
|
+
**absolute**.
|
|
165
|
+
|
|
166
|
+
The file is read **at each playback** (no host-side caching): replacing it
|
|
167
|
+
or changing the path takes effect from the next cue. If the specified path
|
|
168
|
+
is unreadable, the plugin plays the packed asset, and the route response
|
|
169
|
+
declares this in the `x-additions-sound-source` header — a typo won't
|
|
170
|
+
cause you to miss the warning.
|
|
171
|
+
|
|
172
|
+
Two caveats:
|
|
173
|
+
|
|
174
|
+
- Browsers block audio until there's a user gesture: the AudioContext
|
|
175
|
+
is created and resumed with the first click or keystroke, so the **first** cue after
|
|
176
|
+
the page opens may remain silent;
|
|
177
|
+
- The end-of-shift signal applies to **every** session (even those created by
|
|
178
|
+
subagents): if you launch multiple jobs at once, you'll hear more dings.
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
## Languages
|
|
182
|
+
|
|
183
|
+
The plugin speaks all DSH languages plus Italian, both in the UI and in the
|
|
184
|
+
metadata presented on the Plugins page:
|
|
185
|
+
|
|
186
|
+
| `zh` | `en` | `ja` | `es` | `fr` | `de` | `ru` | `pt` | `it` |
|
|
187
|
+
|---|---|---|---|---|---|---|---|
|
|
188
|
+
|
|
189
|
+
- **UI**: The dictionaries are in `lib/client.js` under the `additions` namespace.
|
|
190
|
+
`zh` is the baseline: DSH types and sends each language against the Chinese key set
|
|
191
|
+
and also requires `en` as a fallback, so each dictionary must have
|
|
192
|
+
the same keys and placeholders (`{title}`, `{reason}`, etc.). The tests
|
|
193
|
+
`every key the bundle translates…` and `every locale is complete…` verify this.
|
|
194
|
+
- **Plugin metadata** (title and description on the Plugins page): One file
|
|
195
|
+
per language in `locale/<id>.json`, with `{ "meta": { "title", "description" } }`.
|
|
196
|
+
DSH reads `locale/en.json` and every language in the same folder;
|
|
197
|
+
English is the declared fallback. Files are exported as
|
|
198
|
+
`./locale/*.json` and included in the tarball.
|
|
199
|
+
- **Errors**: The host does not translate messages, it exposes a stable `code`; the client
|
|
200
|
+
maps **each** movement route and statistics code to a
|
|
201
|
+
localized phrase (`reason.*`). Unknown code falls back to the host's English
|
|
202
|
+
`message`. The `every refusal code the host can answer is
|
|
203
|
+
localized` test aligns the lists exported from `lib/move.js` and
|
|
204
|
+
`lib/workspace-stats.js` with the bundle map.
|
|
205
|
+
- **Platform limitation**: Command descriptions and results (`/quit`,
|
|
206
|
+
`/rename`) are host text and do not have a translation channel; DSH
|
|
207
|
+
localizes only the built-in commands client-side. They therefore remain in English in
|
|
208
|
+
every language, as with other external plugins.
|
|
209
|
+
|
|
210
|
+
Italian becomes selectable when a language pack registers the
|
|
211
|
+
`it` language: in the `web` profile, `dsh-locale-it` does this. The plugin only registers the
|
|
212
|
+
`it` dictionary, not the language definition, so it does not conflict
|
|
213
|
+
with the pack that owns it.
|
|
214
|
+
|
|
215
|
+
## Installation
|
|
216
|
+
|
|
217
|
+
Requirements: DSH with a web profile and Node.js ≥ 20. For Italian, you need a language
|
|
218
|
+
pack that registers `it` (`dsh-locale-it`).
|
|
219
|
+
|
|
220
|
+
From package (tarball or npm):
|
|
221
|
+
|
|
222
|
+
```powershell
|
|
223
|
+
dsh plugin --profile web add C:\path\dsh-additions-0.3.0.tgz
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
From GitHub repository, if the repository is accessible:
|
|
227
|
+
|
|
228
|
+
```powershell
|
|
229
|
+
dsh plugin --profile web add github:kormoran/dsh-additions
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
For development, with a link to checkout:
|
|
233
|
+
|
|
234
|
+
```powershell
|
|
235
|
+
dsh plugin --profile web add link:C:\path\dsh-additions
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The installation channel decides how the profile is updated:
|
|
239
|
+
|
|
240
|
+
| Installation | What goes in the profile | To update the code |
|
|
241
|
+
|---|---|---|
|
|
242
|
+
| `add <file>.tgz` / `add dsh-additions` | copy the package to `node_modules` | re-do `npm pack` and reinstall the tarball |
|
|
243
|
+
| `add link:<path>` | symlink at checkout | the file changes immediately, but the entry must be restarted |
|
|
244
|
+
|
|
245
|
+
In both cases, a **new** entry enters the graph only when DSH is restarted: the
|
|
246
|
+
server reads the profile bundles once, at boot.
|
|
247
|
+
|
|
248
|
+
After installation, **reload the page**: the entry appears in the `⋯` menu of
|
|
249
|
+
every chat in the sidebar, between "Create fork" and "Copy session ID". After
|
|
250
|
+
modifying `lib/client.js`, the served bundle is reviewed for file metadata
|
|
251
|
+
: to reread it without restarting DSH, disable and re-enable the
|
|
252
|
+
`additions` entry from the Plugins page (the opened page receives it hot);
|
|
253
|
+
a simple browser reload is not enough, because the graph pointed to by boot is
|
|
254
|
+
the one read by the entry at its last startup.
|
|
255
|
+
|
|
256
|
+
## Configuration
|
|
257
|
+
|
|
258
|
+
The plugin declares a `Config` schema and with it its own settings namespace (`additions`): fields marked *volatile* appear in the plugin's
|
|
259
|
+
configuration page and are applied hot.
|
|
260
|
+
|
|
261
|
+
| Field | Default | Meaning |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| `archiveSource` | `true` | Archives (hides) the original after a successful move. `false` leaves both chats visible. |
|
|
264
|
+
| `quit` | See [Commands](#quit--stop-dsh) | `command`, `delayMs`, `graceMs` of the `/quit` command. |
|
|
265
|
+
| `stats` | See [Workspace Statistics](#workspace-statistics) | Scan limits (time, entries, bytes, cache). |
|
|
266
|
+
| `sounds` | See [Sounds](#sounds) | `enabled`, `volume`, `ding`, `approval`; `enabled`, `ding`, and `approval` are editable from the page. |
|
|
267
|
+
|
|
268
|
+
Only the three volatile `sounds` fields appear on the plugin page;
|
|
269
|
+
`volume` and the other blocks remain configurable from the profile patch. A
|
|
270
|
+
write from the page saves the **complete** configuration of the line in the
|
|
271
|
+
profile patch (the non-volatile fields remain current).
|
|
272
|
+
|
|
273
|
+
## Internal API
|
|
274
|
+
|
|
275
|
+
Routes authenticated by the connection carrier (Peer owner only):
|
|
276
|
+
|
|
277
|
+
- `GET /api/additions.preflight?sessionId=…` — `{ ok, movable, source? }` or
|
|
278
|
+
`{ ok, movable: false, code, message, details? }`; read-only, does not write
|
|
279
|
+
anything. The dialog queries it before offering destinations.
|
|
280
|
+
- `POST /api/additions.move` — `{ sessionId, workspaceId? | targetPath?, keepOriginal?, requestId? }`
|
|
281
|
+
→ `{ ok, sessionId, workspaceId, workspaceTitle, workspacePath, source, events, location, validated, archived, archiveError? }`
|
|
282
|
+
- `GET /api/additions.info` — version and configuration of the host half.
|
|
283
|
+
|
|
284
|
+
- `GET /api/additions.workspace-stats` — Workspace statistics (see above).
|
|
285
|
+
- `GET /api/additions.sound?which=ding|approval` — The signal's audio file,
|
|
286
|
+
with `x-additions-sound-source: default|custom`.
|
|
287
|
+
|
|
288
|
+
Errors respond `{ ok: false, error: { code, message, details? } }`:
|
|
289
|
+
`code` is the stable contract that the client translates, `message` is an English fallback
|
|
290
|
+
for API consumers, and `details` carries the placeholder values
|
|
291
|
+
(`sessionId`, `path`, `reason`, `activity`, …). Movement codes:
|
|
292
|
+
|
|
293
|
+
| `code` | HTTP | When |
|
|
294
|
+
|---|---|---|
|
|
295
|
+
| `missing-session`, `invalid-session-id`, `missing-target`, `relative-path`, `invalid-body` | 400 | Unusable request (id cannot contain path separators) |
|
|
296
|
+
| `session-not-found`, `workspace-not-found` | 404 | Non-existent chat or workspace |
|
|
297
|
+
| `subagent-session`, `empty-session`, `unsupported-format`, `same-workspace`, `source-busy`, `move-in-progress` | 409 | Rejection on merit, before writing |
|
|
298
|
+
| `invalid-path`, `workspace-create-failed` | 400 | The chosen folder cannot be made a workspace |
|
|
299
|
+
| `clone-invalid`, `attach-failed` | 500 | The copy failed validation or registration; the original is not archived |
|
|
300
|
+
| `internal` | 500 | Unexpected failure, in host log |
|
|
301
|
+
|
|
302
|
+
The client locates `source-busy`, `subagent-session`, `empty-session`,
|
|
303
|
+
`session-not-found`, and `move-in-progress`; for other codes, it displays the
|
|
304
|
+
host`s `message`.
|
|
305
|
+
|
|
306
|
+
## Known Limitations
|
|
307
|
+
|
|
308
|
+
- An empty source chat, a subagent subsession, or a chat that is
|
|
309
|
+
still working are rejected **before** writing; the dialog indicates this
|
|
310
|
+
before allowing the destination to be chosen.
|
|
311
|
+
- The copy is instantaneous and is not transactional with the workspace: if
|
|
312
|
+
registration fails, the copy is removed best-effort (only an absolute
|
|
313
|
+
path is affected), and the `attach-failed` error reports the id and reason.
|
|
314
|
+
- The chat identity changes: any links or automations that cite the original id
|
|
315
|
+
must be updated. The job owner remains the original one by contract (the copied history does not transfer execution), so the
|
|
316
|
+
jobs listed in the copy still belong to the original chat.
|
|
317
|
+
- **Title of fork-derived copies**: A session that was already a fork and didn't
|
|
318
|
+
yet have a `session/title` event remains untitled, because the
|
|
319
|
+
title service excludes seed sessions from automatic generation. The copy is not
|
|
320
|
+
alive when moved, so you can't ask the service to
|
|
321
|
+
generate it: use `/rename <title>` on the copy (or on the source before
|
|
322
|
+
moving it).
|
|
323
|
+
- **When archiving the open chat**, the client does not clear the selection as does
|
|
324
|
+
native archiving: the view remains until you navigate elsewhere. There is no
|
|
325
|
+
public API to close the current view.
|
package/assets/ding.wav
ADDED
|
Binary file
|
package/assets/uh-oh.wav
ADDED
|
Binary file
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# dsh-additions bundle patch: inserts the host row into the profile roster.
|
|
2
|
+
# The node half (exports ".") registers the `/quit` and `/rename` slash commands,
|
|
3
|
+
# declares the `additions` settings namespace, and serves the /api/additions.*
|
|
4
|
+
# routes (move, workspace statistics, notification sounds); the browser half
|
|
5
|
+
# (exports "./client", declared in package.json dsh.client) adds the "Sposta nel
|
|
6
|
+
# workspace…" action, the right-panel «Workspace» tab, the two notification cues
|
|
7
|
+
# and the plugin's settings page (Plugins → dsh-additions → additions row).
|
|
8
|
+
- insert:
|
|
9
|
+
- id: additions
|
|
10
|
+
name: 'dsh-additions'
|
|
11
|
+
config:
|
|
12
|
+
# Hide the original chat (registry archive) once the copy is safe.
|
|
13
|
+
archiveSource: true
|
|
14
|
+
# `/quit` timing. The command result must reach the browser before the
|
|
15
|
+
# process goes away, so the interrupt is delayed; `graceMs` is the
|
|
16
|
+
# watchdog that forces the exit if graceful disposal stalls.
|
|
17
|
+
quit:
|
|
18
|
+
delayMs: 500
|
|
19
|
+
graceMs: 5000
|
|
20
|
+
# Workspace statistics: bounds for the directory walk behind
|
|
21
|
+
# /api/additions.workspace-stats.
|
|
22
|
+
stats:
|
|
23
|
+
timeLimitMs: 10000
|
|
24
|
+
cacheTtlMs: 15000
|
|
25
|
+
# Notification cues. `enabled`, `ding` and `approval` are the plugin's
|
|
26
|
+
# editable settings fields (`Config` marks them volatile): the settings
|
|
27
|
+
# page writes them into this profile's patch, and they apply live.
|
|
28
|
+
# Point `ding`/`approval` at any absolute audio path (wav/mp3/ogg/
|
|
29
|
+
# m4a/flac); a missing file falls back to the packaged cue. `volume` is
|
|
30
|
+
# an ordinary field, edited here rather than from the page.
|
|
31
|
+
sounds:
|
|
32
|
+
enabled: true
|
|
33
|
+
volume: 0.7
|
|
34
|
+
# ding: 'C:\suoni\campanello.wav'
|
|
35
|
+
# approval: 'C:\suoni\uh-oh.mp3'
|