@xmoon76/dsh-pi-tui 0.1.5 → 0.1.7

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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { Agent, ModelSelectionRef } from "@deepseek-ai/dsh-agent";
3
+ import { ContentBlock } from "@deepseek-ai/dsh-llm";
3
4
  import { SessionEvent, SessionId } from "@deepseek-ai/dsh-session";
4
5
  import { CommandDescriptor } from "@deepseek-ai/dsh-commands";
5
6
  import { EventEmitter } from "events";
@@ -14,6 +15,20 @@ interface Diag {
14
15
  dispose(): void;
15
16
  }
16
17
  //#endregion
18
+ //#region src/tui-app.d.ts
19
+ /** One queued inbox row for the queue pane (mirrors the agent Inbox's lists). */
20
+ interface QueueItem {
21
+ /** The pending message id (agent inbox identity). */
22
+ id: string;
23
+ /** The message text, single-line display form. */
24
+ text: string;
25
+ /** next-turn followup vs next-step steer. */
26
+ mode: 'followup' | 'steer';
27
+ /** Plugin notice (e.g. a background-job completion): NOT steerable — it
28
+ * renders with its own marker and the hint drops the steer verbs. */
29
+ notice?: boolean;
30
+ }
31
+ //#endregion
17
32
  //#region src/skill-catalog.d.ts
18
33
  /**
19
34
  * The standing-scope skill catalog adapter: the SINGLE narrow seam between
@@ -162,6 +177,24 @@ declare function shouldSteerOnEnter(parsed: {
162
177
  declare function shouldConsumeAdvertisedMiss(execution: {
163
178
  readonly result: unknown;
164
179
  } | undefined, wasAdvertised: boolean): boolean;
180
+ /** One unsettled subagent delegation, in tool/call order. */
181
+ interface PendingSubagentCall {
182
+ readonly callId: string;
183
+ readonly description: string;
184
+ }
185
+ /**
186
+ * Match the child a user is about to view against the unsettled subagent
187
+ * calls (pure, exported for the headless suite). The child's durable label
188
+ * is the delegation's `description`; duplicate descriptions take the MOST
189
+ * RECENT call (the one the user is most likely watching), an empty/absent
190
+ * label falls back to a LONE pending call, and no match disables the
191
+ * auto-pop (the user exits the viewer with Esc as before — never a wrong
192
+ * pop). Mutates `pending` by removing the matched call.
193
+ * @param pending - the unsettled calls, in order (oldest first).
194
+ * @param label - the child's durable label; '' or undefined = no description.
195
+ * @returns the matched call, or undefined when nothing matches.
196
+ */
197
+ declare function matchPendingSubagentCall(pending: PendingSubagentCall[], label: string | undefined): PendingSubagentCall | undefined;
165
198
  /**
166
199
  * The pre-mount surface catalog resolution:
167
200
  * - an explicit `--session` start PREFETCHES the resumed agent's effective
@@ -212,6 +245,73 @@ declare function resolveInitialCatalog(options: ResolveInitialCatalogOptions): P
212
245
  declare function subagentJobTranscriptId(snapshot: unknown): string | undefined;
213
246
  /** Viewer body for a subagent job with no uniquely matched child. */
214
247
  declare function subagentJobViewHint(status: string, detail: string | undefined): string;
248
+ /** The message-source projection the queue filter reads (a structural subset
249
+ * of dsh's message sources, so the helpers are testable without dsh types). */
250
+ interface QueueNoticeSource {
251
+ readonly form?: string;
252
+ readonly kind?: string;
253
+ readonly summary?: string;
254
+ }
255
+ /**
256
+ * Whether a plain submitted draft is the quit word: exactly `exit` (trimmed,
257
+ * lowercase). The runner intercepts this BEFORE any session creation or
258
+ * submission (shell muscle memory); anything else — `exit!`, `Exit`, or a
259
+ * draft with a recalled entry still in it — is an ordinary message.
260
+ * @param text - the submitted draft.
261
+ */
262
+ declare function isPlainExitPrompt(text: string): boolean;
263
+ /**
264
+ * Whether an inbox message is a BACKGROUND-SUBAGENT settlement notice — the
265
+ * runtime's account of a child ending, not steerable user input. Two dsh
266
+ * producers push these into the parent's inbox:
267
+ * - continuable children: `source.kind === 'subagent-settled'` (the
268
+ * continuation manager's settlement notice);
269
+ * - one-shot background subagent jobs: tool-jobs completion notices whose
270
+ * summary starts with the job kind (`subagent <label> [status: …]`).
271
+ * The queue pane mirrors the inbox, but these belong to the task browser
272
+ * (terminal job rows / inactive child rows), so the mirror drops them and
273
+ * only failures surface as a transient error notify.
274
+ * @param source - the message source projection, or undefined for a plain row.
275
+ */
276
+ declare function isSubagentSettlementNotice(source: QueueNoticeSource | undefined): boolean;
277
+ /**
278
+ * Whether a subagent settlement notice reports FAILURE, classified on the
279
+ * producers' own deterministic wording:
280
+ * - `subagent-settled` summaries: "finished and will do no further work"
281
+ * is the only success wording; aborted / max-tokens / refusal / error /
282
+ * unknown endings all fail;
283
+ * - tool-jobs subagent summaries carry the terminal status line, whose
284
+ * failure statuses are `failed` and `killed` (dsh JobStatus).
285
+ * A notice that cannot be classified is treated as success (silent).
286
+ * @param source - the message source projection.
287
+ */
288
+ declare function subagentNoticeIsFailure(source: QueueNoticeSource | undefined): boolean;
289
+ /** One inbox message as the queue mirror sees it (a structural projection). */
290
+ interface QueueInboxMessage {
291
+ readonly id: string;
292
+ readonly content: readonly ContentBlock[];
293
+ readonly source?: QueueNoticeSource;
294
+ }
295
+ /** The mirror result for one inbox batch: the rows to show plus the failed
296
+ * settlement summaries the caller should notify (each once). */
297
+ interface QueueFoldResult {
298
+ /** Queue rows (background-subagent settlement notices excluded). */
299
+ readonly rows: QueueItem[];
300
+ /** Failed settlement summaries not yet notified (the caller notifies). */
301
+ readonly failures: readonly string[];
302
+ }
303
+ /**
304
+ * Build the queue-pane rows for one inbox batch, dropping background-subagent
305
+ * settlement notices (the task browser is their surface) and reporting which
306
+ * FAILED settlements should notify. Pure and injectable so the filter +
307
+ * once-notify semantics are testable without the agent.
308
+ * @param messages - one inbox batch (next-turn or next-step), in order.
309
+ * @param mode - the delivery mode for surviving rows.
310
+ * @param notified - the notify-once guard; failed notices already in it are
311
+ * skipped, and a newly-reported id is ADDED here so a re-render can never
312
+ * double-notify.
313
+ */
314
+ declare function foldQueueRows(messages: readonly QueueInboxMessage[], mode: 'followup' | 'steer', notified: Set<string>): QueueFoldResult;
215
315
  /**
216
316
  * Whether a shell command matches a destructive pattern. `rm` is treated
217
317
  * specially: any spelling of recursive + force flags (`rm -rf`, `rm -r -f`,
@@ -237,6 +337,17 @@ declare function runningProfile(argv?: readonly string[], fallback?: string): st
237
337
  * @returns the resume command line, or undefined without a session.
238
338
  */
239
339
  declare function resumeCommand(profile: string, sessionId: string): string | undefined;
340
+ /**
341
+ * A launch-time open-lock refusal: the requested session is held by another
342
+ * live dsh process (or its lock cannot be verified). Unlike a stale/missing
343
+ * session id, this is NOT recoverable by falling back to a fresh session —
344
+ * the user asked for a specific session and must resolve the holder first.
345
+ * Thrown from the resume path and re-thrown past the resume catch so the
346
+ * runner exits with the refusal as the error message.
347
+ */
348
+ declare class SessionLockRefusedError extends Error {
349
+ constructor(message: string);
350
+ }
240
351
  /** One agent's preset composition: the id to record and the setup that installs it. */
241
352
  interface AgentComposition {
242
353
  /** Preset id for the session header, absent when the deployment composes no roster. */
@@ -312,4 +423,4 @@ declare function recomposeBlank(ctx: Context, agent: {
312
423
  */
313
424
  declare function apply(ctx: Context, config: Config): void;
314
425
  //#endregion
315
- export { AgentComposition, Config, InitialCatalogResolution, LOCAL_COMMANDS, RecomposableSession, RecomposeOutcome, ResolveInitialCatalogOptions, SESSIONLESS_COMMANDS, apply, composeAgent, dangerCommand, forkSeed, inject, name, recomposeBlank, recordedPreset, resolveInitialCatalog, resumeCommand, runningProfile, shouldConsumeAdvertisedMiss, shouldSteerOnEnter, subagentJobTranscriptId, subagentJobViewHint };
426
+ export { AgentComposition, Config, InitialCatalogResolution, LOCAL_COMMANDS, PendingSubagentCall, QueueFoldResult, QueueInboxMessage, QueueNoticeSource, RecomposableSession, RecomposeOutcome, ResolveInitialCatalogOptions, SESSIONLESS_COMMANDS, SessionLockRefusedError, apply, composeAgent, dangerCommand, foldQueueRows, forkSeed, inject, isPlainExitPrompt, isSubagentSettlementNotice, matchPendingSubagentCall, name, recomposeBlank, recordedPreset, resolveInitialCatalog, resumeCommand, runningProfile, shouldConsumeAdvertisedMiss, shouldSteerOnEnter, subagentJobTranscriptId, subagentJobViewHint, subagentNoticeIsFailure };