@agi-fans/dsh-tui 0.16.0 → 0.17.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/lib/CHANGELOG.md +18 -1
- package/lib/chrome/tool-args.d.ts +9 -0
- package/lib/chrome/tool-args.js +20 -0
- package/lib/chrome/tool-args.js.map +1 -0
- package/lib/chrome/tool-renderers.js +4 -13
- package/lib/chrome/tool-renderers.js.map +1 -1
- package/lib/commands/session.js +2 -4
- package/lib/commands/session.js.map +1 -1
- package/lib/runtime/composer-images.d.ts +44 -0
- package/lib/runtime/composer-images.js +149 -0
- package/lib/runtime/composer-images.js.map +1 -0
- package/lib/runtime/herdr-agent.d.ts +95 -0
- package/lib/runtime/herdr-agent.js +258 -0
- package/lib/runtime/herdr-agent.js.map +1 -0
- package/lib/runtime/plain-tui.d.ts +34 -0
- package/lib/runtime/plain-tui.js +119 -0
- package/lib/runtime/plain-tui.js.map +1 -0
- package/lib/runtime/provider-local.d.ts +3 -0
- package/lib/runtime/provider-local.js +107 -268
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/tool-presentation.js +15 -0
- package/lib/runtime/tool-presentation.js.map +1 -1
- package/lib/session/content-text.d.ts +12 -0
- package/lib/session/content-text.js +13 -0
- package/lib/session/content-text.js.map +1 -0
- package/lib/session/history-store.js.map +1 -0
- package/lib/session/json-file.d.ts +5 -0
- package/lib/session/json-file.js +21 -0
- package/lib/session/json-file.js.map +1 -0
- package/lib/session/model-favorites.js +15 -25
- package/lib/session/model-favorites.js.map +1 -1
- package/lib/session/release-notes.js +1 -18
- package/lib/session/release-notes.js.map +1 -1
- package/lib/session/session-controller.js +64 -140
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-library.js +4 -14
- package/lib/session/session-library.js.map +1 -1
- package/lib/session/subagent-roster.js +13 -43
- package/lib/session/subagent-roster.js.map +1 -1
- package/lib/session/subagent-tracker.d.ts +58 -0
- package/lib/session/subagent-tracker.js +129 -0
- package/lib/session/subagent-tracker.js.map +1 -0
- package/lib/session/update-check.js +2 -15
- package/lib/session/update-check.js.map +1 -1
- package/lib/session/version-compare.d.ts +3 -0
- package/lib/session/version-compare.js +21 -0
- package/lib/session/version-compare.js.map +1 -0
- package/lib/views/event-views.d.ts +11 -270
- package/lib/views/event-views.js +12 -964
- package/lib/views/event-views.js.map +1 -1
- package/lib/views/settings-list.js +12 -11
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/transcript-render.d.ts +179 -0
- package/lib/views/transcript-render.js +916 -0
- package/lib/views/transcript-render.js.map +1 -0
- package/lib/views/transcript-types.d.ts +104 -0
- package/lib/views/transcript-types.js +53 -0
- package/lib/views/transcript-types.js.map +1 -0
- package/package.json +2 -1
- package/lib/views/history-store.js.map +0 -1
- /package/lib/{views → session}/history-store.d.ts +0 -0
- /package/lib/{views → session}/history-store.js +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Herdr lifecycle integration.
|
|
3
|
+
*
|
|
4
|
+
* Herdr (https://herdr.dev) detects a fixed set of agents and lets every other
|
|
5
|
+
* agent claim a pane's lifecycle authority itself over the local socket
|
|
6
|
+
* (`pane.report_agent` / `pane.release_agent`). This module implements that
|
|
7
|
+
* contract: it reports `idle`, `working`, and `blocked` for omdsh and is a
|
|
8
|
+
* complete no-op outside a Herdr pane.
|
|
9
|
+
*
|
|
10
|
+
* The status projection is a pure controller; the reporter adds the stable
|
|
11
|
+
* source identity, the strictly increasing sequence Herdr requires, the native
|
|
12
|
+
* session reference, and best-effort socket delivery.
|
|
13
|
+
* @module runtime/herdr-agent
|
|
14
|
+
*/
|
|
15
|
+
import { connect } from 'node:net';
|
|
16
|
+
/** Stable, integration-unique source namespace Herdr requires for custom reports. */
|
|
17
|
+
export const HERDR_REPORT_SOURCE = 'custom:omdsh';
|
|
18
|
+
/** Agent label Herdr shows in its sidebar and agent list. */
|
|
19
|
+
export const HERDR_AGENT_LABEL = 'omdsh';
|
|
20
|
+
/**
|
|
21
|
+
* Pane-authoritative Herdr detection.
|
|
22
|
+
*
|
|
23
|
+
* `HERDR_ENV=1` is the canonical marker; the pane id and socket path are what
|
|
24
|
+
* the protocol needs. Client-side overrides (`HERDR_SOCKET_PATH`,
|
|
25
|
+
* `HERDR_BIN_PATH`, `HERDR_SESSION`) can be set outside a pane, so they are
|
|
26
|
+
* never detection evidence on their own.
|
|
27
|
+
*/
|
|
28
|
+
export function herdrEnvironment(env = process.env) {
|
|
29
|
+
if (env.HERDR_ENV !== '1')
|
|
30
|
+
return undefined;
|
|
31
|
+
const paneId = env.HERDR_PANE_ID?.trim();
|
|
32
|
+
const socketPath = env.HERDR_SOCKET_PATH?.trim();
|
|
33
|
+
if (paneId === undefined || paneId === '' || socketPath === undefined || socketPath === '')
|
|
34
|
+
return undefined;
|
|
35
|
+
return { paneId, socketPath };
|
|
36
|
+
}
|
|
37
|
+
const HERDR_MESSAGE_LIMIT = 240;
|
|
38
|
+
function cleanHerdrMessage(value) {
|
|
39
|
+
if (value === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const cleaned = value
|
|
42
|
+
.replace(/[\x00-\x1f\x7f-\x9f]/gu, ' ')
|
|
43
|
+
.replace(/\s+/gu, ' ')
|
|
44
|
+
.trim()
|
|
45
|
+
.slice(0, HERDR_MESSAGE_LIMIT);
|
|
46
|
+
return cleaned === '' ? undefined : cleaned;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pure state projection: an active driver plus the human prompts it is blocked
|
|
50
|
+
* on decide the single semantic state Herdr understands. `blocked` wins over
|
|
51
|
+
* `working` because a blocked pane must reject `herdr agent prompt` input.
|
|
52
|
+
*/
|
|
53
|
+
export class HerdrAgentStatusController {
|
|
54
|
+
#running = false;
|
|
55
|
+
#prompts = 0;
|
|
56
|
+
#promptMessage;
|
|
57
|
+
#last;
|
|
58
|
+
/** The initial report makes Herdr attach the agent to the pane before any turn. */
|
|
59
|
+
start() {
|
|
60
|
+
return this.#publish(true);
|
|
61
|
+
}
|
|
62
|
+
setRunning(running) {
|
|
63
|
+
this.#running = running;
|
|
64
|
+
return this.#publish();
|
|
65
|
+
}
|
|
66
|
+
prompt(message) {
|
|
67
|
+
this.#prompts += 1;
|
|
68
|
+
const cleaned = cleanHerdrMessage(message);
|
|
69
|
+
if (cleaned !== undefined)
|
|
70
|
+
this.#promptMessage = cleaned;
|
|
71
|
+
return this.#publish();
|
|
72
|
+
}
|
|
73
|
+
promptResolved() {
|
|
74
|
+
if (this.#prompts === 0)
|
|
75
|
+
return undefined;
|
|
76
|
+
this.#prompts -= 1;
|
|
77
|
+
if (this.#prompts === 0)
|
|
78
|
+
this.#promptMessage = undefined;
|
|
79
|
+
return this.#publish();
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Forget the last projection without reporting. A replaced session makes
|
|
83
|
+
* the previous state meaningless, but only a fresh signal may publish,
|
|
84
|
+
* because a compaction or resume can swap sessions mid-driver.
|
|
85
|
+
*/
|
|
86
|
+
reset() {
|
|
87
|
+
this.#running = false;
|
|
88
|
+
this.#prompts = 0;
|
|
89
|
+
this.#promptMessage = undefined;
|
|
90
|
+
this.#last = undefined;
|
|
91
|
+
}
|
|
92
|
+
#desired() {
|
|
93
|
+
if (this.#prompts > 0) {
|
|
94
|
+
return this.#promptMessage === undefined
|
|
95
|
+
? { state: 'blocked' }
|
|
96
|
+
: { state: 'blocked', message: this.#promptMessage };
|
|
97
|
+
}
|
|
98
|
+
return this.#running ? { state: 'working' } : { state: 'idle' };
|
|
99
|
+
}
|
|
100
|
+
#publish(force = false) {
|
|
101
|
+
const next = this.#desired();
|
|
102
|
+
const signature = `${next.state}\u0000${next.message ?? ''}`;
|
|
103
|
+
if (!force && signature === this.#last)
|
|
104
|
+
return undefined;
|
|
105
|
+
this.#last = signature;
|
|
106
|
+
return next;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Report omdsh lifecycle state to the Herdr pane that owns this process.
|
|
111
|
+
*
|
|
112
|
+
* Reports are best-effort and silent, matching Herdr's own integrations: a
|
|
113
|
+
* missing or restarted server must never disturb the TUI.
|
|
114
|
+
*/
|
|
115
|
+
export class HerdrAgentReporter {
|
|
116
|
+
#environment;
|
|
117
|
+
#transport;
|
|
118
|
+
#controller = new HerdrAgentStatusController();
|
|
119
|
+
#now;
|
|
120
|
+
#seq;
|
|
121
|
+
#sessionId;
|
|
122
|
+
#released = false;
|
|
123
|
+
constructor(options = {}) {
|
|
124
|
+
this.#now = options.now ?? (() => Date.now());
|
|
125
|
+
this.#seq = this.#now() * 1000;
|
|
126
|
+
this.#environment = herdrEnvironment(options.env ?? process.env);
|
|
127
|
+
this.#transport = this.#environment === undefined
|
|
128
|
+
? undefined
|
|
129
|
+
: (options.transport ?? defaultHerdrTransport)(this.#environment.socketPath);
|
|
130
|
+
}
|
|
131
|
+
/** Whether this process runs inside a Herdr pane with a usable socket. */
|
|
132
|
+
get active() {
|
|
133
|
+
return this.#transport !== undefined;
|
|
134
|
+
}
|
|
135
|
+
start() {
|
|
136
|
+
this.#report(this.#controller.start());
|
|
137
|
+
}
|
|
138
|
+
setRunning(running) {
|
|
139
|
+
this.#report(this.#controller.setRunning(running));
|
|
140
|
+
}
|
|
141
|
+
prompt(message) {
|
|
142
|
+
this.#report(this.#controller.prompt(message));
|
|
143
|
+
}
|
|
144
|
+
promptResolved() {
|
|
145
|
+
this.#report(this.#controller.promptResolved());
|
|
146
|
+
}
|
|
147
|
+
/** Attach the native session reference Herdr exposes on its agent records. */
|
|
148
|
+
setSession(sessionId) {
|
|
149
|
+
const trimmed = sessionId?.trim();
|
|
150
|
+
const next = trimmed === undefined || trimmed === '' ? undefined : trimmed;
|
|
151
|
+
if (next === this.#sessionId)
|
|
152
|
+
return;
|
|
153
|
+
this.#sessionId = next;
|
|
154
|
+
this.#controller.reset();
|
|
155
|
+
}
|
|
156
|
+
/** Release the pane's lifecycle authority; later reports are dropped. */
|
|
157
|
+
release() {
|
|
158
|
+
const environment = this.#environment;
|
|
159
|
+
const transport = this.#transport;
|
|
160
|
+
if (this.#released || environment === undefined || transport === undefined)
|
|
161
|
+
return;
|
|
162
|
+
this.#released = true;
|
|
163
|
+
this.#deliver(transport, {
|
|
164
|
+
id: `${HERDR_REPORT_SOURCE}:release:${this.#now()}`,
|
|
165
|
+
method: 'pane.release_agent',
|
|
166
|
+
params: {
|
|
167
|
+
pane_id: environment.paneId,
|
|
168
|
+
source: HERDR_REPORT_SOURCE,
|
|
169
|
+
agent: HERDR_AGENT_LABEL,
|
|
170
|
+
seq: this.#nextSeq(),
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
#report(status) {
|
|
175
|
+
const environment = this.#environment;
|
|
176
|
+
const transport = this.#transport;
|
|
177
|
+
if (status === undefined || this.#released || environment === undefined || transport === undefined)
|
|
178
|
+
return;
|
|
179
|
+
const params = {
|
|
180
|
+
pane_id: environment.paneId,
|
|
181
|
+
source: HERDR_REPORT_SOURCE,
|
|
182
|
+
agent: HERDR_AGENT_LABEL,
|
|
183
|
+
state: status.state,
|
|
184
|
+
seq: this.#nextSeq(),
|
|
185
|
+
};
|
|
186
|
+
if (status.message !== undefined)
|
|
187
|
+
params.message = status.message;
|
|
188
|
+
if (this.#sessionId !== undefined)
|
|
189
|
+
params.agent_session_id = this.#sessionId;
|
|
190
|
+
this.#deliver(transport, {
|
|
191
|
+
id: `${HERDR_REPORT_SOURCE}:${status.state}:${this.#now()}`,
|
|
192
|
+
method: 'pane.report_agent',
|
|
193
|
+
params,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/** A broken transport must never throw into the TUI's status or dispose path. */
|
|
197
|
+
#deliver(transport, request) {
|
|
198
|
+
try {
|
|
199
|
+
transport.send(request);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Best-effort delivery, matching Herdr's own integrations.
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Strictly increasing across reporter instances in one process: Herdr
|
|
207
|
+
* ignores a report whose sequence is not above the last accepted one for the
|
|
208
|
+
* same source, so a plugin reload must not restart below a used sequence.
|
|
209
|
+
*/
|
|
210
|
+
#nextSeq() {
|
|
211
|
+
this.#seq = Math.max(this.#seq + 1, this.#now() * 1000);
|
|
212
|
+
return this.#seq;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const HERDR_REQUEST_TIMEOUT_MS = 500;
|
|
216
|
+
/**
|
|
217
|
+
* One JSON line per request over a short-lived local connection. The server
|
|
218
|
+
* acknowledges every request, but delivery stays fire-and-forget: the pane
|
|
219
|
+
* must never wait on Herdr, and `unref()` keeps a pending write from holding
|
|
220
|
+
* the process open.
|
|
221
|
+
*/
|
|
222
|
+
function defaultHerdrTransport(socketPath) {
|
|
223
|
+
const target = herdrSocketTarget(socketPath);
|
|
224
|
+
return {
|
|
225
|
+
send(request) {
|
|
226
|
+
let socket;
|
|
227
|
+
try {
|
|
228
|
+
socket = connect(target);
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
socket.unref();
|
|
234
|
+
let timer;
|
|
235
|
+
const finish = () => {
|
|
236
|
+
if (timer !== undefined)
|
|
237
|
+
clearTimeout(timer);
|
|
238
|
+
socket.destroy();
|
|
239
|
+
};
|
|
240
|
+
timer = setTimeout(finish, HERDR_REQUEST_TIMEOUT_MS);
|
|
241
|
+
timer.unref();
|
|
242
|
+
socket.on('error', finish);
|
|
243
|
+
socket.on('connect', () => { socket.write(`${JSON.stringify(request)}\n`); });
|
|
244
|
+
socket.on('data', finish);
|
|
245
|
+
socket.on('end', finish);
|
|
246
|
+
socket.on('close', finish);
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/** Herdr exports Unix-style paths; Windows dials them as named pipes. */
|
|
251
|
+
export function herdrSocketTarget(socketPath, platform = process.platform) {
|
|
252
|
+
const lowered = socketPath.toLowerCase();
|
|
253
|
+
if (platform !== 'win32' || lowered.startsWith('\\\\.\\pipe\\') || lowered.startsWith('\\\\?\\pipe\\')) {
|
|
254
|
+
return socketPath;
|
|
255
|
+
}
|
|
256
|
+
return `\\\\.\\pipe\\${socketPath}`;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=herdr-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herdr-agent.js","sourceRoot":"","sources":["../../src/runtime/herdr-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,OAAO,EAAe,MAAM,UAAU,CAAA;AAE/C,qFAAqF;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAA;AACjD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AA0BxC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACnE,IAAI,GAAG,CAAC,SAAS,KAAK,GAAG;QAAE,OAAO,SAAS,CAAA;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,CAAA;IACxC,MAAM,UAAU,GAAG,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAA;IAChD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,EAAE;QAAE,OAAO,SAAS,CAAA;IAC5G,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;AAC/B,CAAC;AAED,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAE/B,SAAS,iBAAiB,CAAC,KAAyB;IAClD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IACzC,MAAM,OAAO,GAAG,KAAK;SAClB,OAAO,CAAC,wBAAwB,EAAE,GAAG,CAAC;SACtC,OAAO,CAAC,OAAO,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AAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;YAC1B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;YAC5E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;YACzB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACxB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5B,CAAC;KACF,CAAA;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,UAAkB,EAAE,WAA4B,OAAO,CAAC,QAAQ;IAChG,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;IACxC,IAAI,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACvG,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,OAAO,gBAAgB,UAAU,EAAE,CAAA;AACrC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Non-TTY line input and incremental transcript printing. */
|
|
2
|
+
import type { TuiPrompt, TuiSubmission } from '../definition.ts';
|
|
3
|
+
import type { Block } from '../views/event-views.ts';
|
|
4
|
+
import type { TerminalLike } from './provider-local.ts';
|
|
5
|
+
export type PendingRead = {
|
|
6
|
+
resolve: (submission: TuiSubmission | null) => void;
|
|
7
|
+
signal?: AbortSignal | null;
|
|
8
|
+
/** Detaches this read's abort listener once the read settles. */
|
|
9
|
+
offAbort?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export interface PlainTuiDeps {
|
|
12
|
+
readonly term: TerminalLike;
|
|
13
|
+
/** Transcript blocks, read live so `print()` always flushes the newest tail. */
|
|
14
|
+
blocks(): readonly Block[];
|
|
15
|
+
/** The in-flight human prompt's request, if one is waiting on an answer. */
|
|
16
|
+
promptRequest(): TuiPrompt | undefined;
|
|
17
|
+
/** Resolve the in-flight prompt; the provider owns prompt bookkeeping. */
|
|
18
|
+
finishPrompt(answer: string | null): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pipe-mode counterpart of the TTY reader: a readline queue that buffers lines
|
|
22
|
+
* until the runner asks for the next submission, plus incremental transcript
|
|
23
|
+
* printing that emits each settled block exactly once.
|
|
24
|
+
*/
|
|
25
|
+
export declare class PlainTui {
|
|
26
|
+
#private;
|
|
27
|
+
constructor(deps: PlainTuiDeps);
|
|
28
|
+
readline(signal?: AbortSignal): Promise<TuiSubmission | null>;
|
|
29
|
+
/** Print blocks that settled since the last flush. */
|
|
30
|
+
print(): void;
|
|
31
|
+
/** Forget the print cursor so a replaced transcript reprints in full. */
|
|
32
|
+
resetPrinted(): void;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/** Non-TTY line input and incremental transcript printing. */
|
|
2
|
+
import { createInterface } from 'node:readline';
|
|
3
|
+
import { blockLines } from "../views/event-views.js";
|
|
4
|
+
import { createTheme } from "../chrome/theme.js";
|
|
5
|
+
/**
|
|
6
|
+
* Pipe-mode counterpart of the TTY reader: a readline queue that buffers lines
|
|
7
|
+
* until the runner asks for the next submission, plus incremental transcript
|
|
8
|
+
* printing that emits each settled block exactly once.
|
|
9
|
+
*/
|
|
10
|
+
export class PlainTui {
|
|
11
|
+
#deps;
|
|
12
|
+
#lineReader = null;
|
|
13
|
+
#pending = null;
|
|
14
|
+
#queue = [];
|
|
15
|
+
#closed = false;
|
|
16
|
+
#printed = 0;
|
|
17
|
+
constructor(deps) {
|
|
18
|
+
this.#deps = deps;
|
|
19
|
+
}
|
|
20
|
+
readline(signal) {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
if (this.#lineReader === null) {
|
|
23
|
+
this.#lineReader = createInterface({ input: this.#deps.term.input });
|
|
24
|
+
// Permanent listeners: once() handlers would auto-pause the input
|
|
25
|
+
// stream after one line and miss the EOF close.
|
|
26
|
+
this.#lineReader.on('line', (line) => { this.#resolveLine(line); });
|
|
27
|
+
this.#lineReader.on('close', () => {
|
|
28
|
+
this.#closed = true;
|
|
29
|
+
this.#resolveLine(null);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const pending = { resolve, signal: signal ?? null };
|
|
33
|
+
this.#pending = pending;
|
|
34
|
+
if (signal !== undefined) {
|
|
35
|
+
const onAbort = () => {
|
|
36
|
+
if (this.#pending !== pending)
|
|
37
|
+
return;
|
|
38
|
+
this.#pending = null;
|
|
39
|
+
resolve(null);
|
|
40
|
+
};
|
|
41
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
42
|
+
pending.offAbort = () => { signal.removeEventListener('abort', onAbort); };
|
|
43
|
+
}
|
|
44
|
+
this.#pump();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Queue one readline delivery, then drain. A single stream chunk can carry
|
|
49
|
+
* several lines; every line is buffered until the runner asks for the next
|
|
50
|
+
* read, and EOF waits for the queue before closing the reader.
|
|
51
|
+
*/
|
|
52
|
+
#resolveLine(line) {
|
|
53
|
+
const request = this.#deps.promptRequest();
|
|
54
|
+
if (request !== undefined && line !== null) {
|
|
55
|
+
const value = line.trim();
|
|
56
|
+
if (value === '') {
|
|
57
|
+
this.#deps.finishPrompt(null);
|
|
58
|
+
}
|
|
59
|
+
else if (request.allowCustom === false) {
|
|
60
|
+
const options = request.options ?? [];
|
|
61
|
+
const numeric = /^\d+$/u.test(value) ? Number(value) - 1 : -1;
|
|
62
|
+
const option = numeric >= 0
|
|
63
|
+
? options[numeric]
|
|
64
|
+
: options.find(item => item.label.toLowerCase() === value.toLowerCase());
|
|
65
|
+
this.#deps.finishPrompt(option?.value ?? option?.label ?? null);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.#deps.finishPrompt(value);
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (request !== undefined)
|
|
73
|
+
this.#deps.finishPrompt(null);
|
|
74
|
+
if (line !== null)
|
|
75
|
+
this.#queue.push(line);
|
|
76
|
+
this.#pump();
|
|
77
|
+
}
|
|
78
|
+
/** Resolve the pending read from the queue, or close it after EOF drained. */
|
|
79
|
+
#pump() {
|
|
80
|
+
const pending = this.#pending;
|
|
81
|
+
if (pending === null)
|
|
82
|
+
return;
|
|
83
|
+
const line = this.#queue.shift();
|
|
84
|
+
if (line !== undefined) {
|
|
85
|
+
pending.offAbort?.();
|
|
86
|
+
this.#pending = null;
|
|
87
|
+
pending.resolve({ text: line, images: [] });
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (this.#closed) {
|
|
91
|
+
pending.offAbort?.();
|
|
92
|
+
this.#pending = null;
|
|
93
|
+
pending.resolve(null);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** Print blocks that settled since the last flush. */
|
|
97
|
+
print() {
|
|
98
|
+
const theme = createTheme(false, false);
|
|
99
|
+
const width = this.#deps.term.width();
|
|
100
|
+
const blocks = this.#deps.blocks();
|
|
101
|
+
let out = '';
|
|
102
|
+
for (const block of blocks.slice(this.#printed)) {
|
|
103
|
+
// Pipe / CI output is not a viewport: print the full tool body.
|
|
104
|
+
for (const line of blockLines(block, theme, width, 0, true))
|
|
105
|
+
out += line + '\n';
|
|
106
|
+
}
|
|
107
|
+
this.#printed = blocks.length;
|
|
108
|
+
if (out !== '')
|
|
109
|
+
this.#deps.term.output.write(out);
|
|
110
|
+
}
|
|
111
|
+
/** Forget the print cursor so a replaced transcript reprints in full. */
|
|
112
|
+
resetPrinted() {
|
|
113
|
+
this.#printed = 0;
|
|
114
|
+
}
|
|
115
|
+
dispose() {
|
|
116
|
+
this.#lineReader?.close();
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AAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAA;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;YACpB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACvB,CAAC;IACH,CAAC;IAED,sDAAsD;IACtD,KAAK;QACH,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QAClC,IAAI,GAAG,GAAG,EAAE,CAAA;QACZ,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChD,gEAAgE;YAChE,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC;gBAAE,GAAG,IAAI,IAAI,GAAG,IAAI,CAAA;QACjF,CAAC;QACD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAA;QAC7B,IAAI,GAAG,KAAK,EAAE;YAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnD,CAAC;IAED,yEAAyE;IACzE,YAAY;QACV,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* printing of settled blocks.
|
|
11
11
|
* @module @agi-fans/dsh-tui
|
|
12
12
|
*/
|
|
13
|
+
import { HerdrAgentReporter } from './herdr-agent.ts';
|
|
13
14
|
import type { Context } from '@deepseek-ai/cordis';
|
|
14
15
|
import type { SessionEvent } from '@deepseek-ai/dsh-session';
|
|
15
16
|
import { type TuiAgentBehaviorSettingsBinding, type TuiCommand, type TuiPrompt, type TuiNoticeOptions, type TuiRecentSession, type TuiService, type TuiSessionControls, type TuiSessionStats, type TuiStatus, type TuiInputImage, type TuiInspectedSubagent, type TuiLoopStatus, type TuiSubagentRoster, type TuiSubmission } from '../definition.ts';
|
|
@@ -85,6 +86,8 @@ export declare class LocalTui implements TuiService {
|
|
|
85
86
|
alternateScreenOverlays?: boolean;
|
|
86
87
|
resizeDebounceMs?: number;
|
|
87
88
|
streamRenderMs?: number;
|
|
89
|
+
/** Herdr lifecycle reporter; production injects an environment-aware one. */
|
|
90
|
+
herdrReporter?: HerdrAgentReporter;
|
|
88
91
|
});
|
|
89
92
|
event(event: SessionEvent, presentation?: TuiToolPresentation): void;
|
|
90
93
|
/**
|