@xmoon76/dsh-pi-tui 0.4.8 → 0.5.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.
@@ -1,2 +1,2 @@
1
- import { B as PI_TUI_EXTENSIONS_SERVICE, H as describeKey, L as apply, R as inject, V as API_VERSION, z as name } from "./src-R8SVGB-L.mjs";
1
+ import { a as API_VERSION, i as PI_TUI_EXTENSIONS_SERVICE, n as inject, o as describeKey, r as name, t as apply } from "./extensions-Dg1qhjUi.mjs";
2
2
  export { API_VERSION, PI_TUI_EXTENSIONS_SERVICE, apply, describeKey, inject, name };
package/dist/index.d.mts CHANGED
@@ -1,89 +1,9 @@
1
1
  import { H as TuiAction } from "./public-types-YbB5Rhku.mjs";
2
- import z from "@deepseek-ai/schemastery";
3
- import { Agent, ModelSelectionRef } from "@deepseek-ai/dsh-agent";
4
- import { ContentBlock } from "@deepseek-ai/dsh-llm";
5
2
  import { SessionId } from "@deepseek-ai/dsh-session";
3
+ import { ContentBlock } from "@deepseek-ai/dsh-llm";
6
4
  import { Context, Volatile } from "@deepseek-ai/cordis";
7
- //#region src/image/admission.d.ts
8
- /** Structural subset of `ImageAttachmentRef`. */
9
- interface ImageAttachmentRefLike {
10
- readonly attachmentId: string;
11
- readonly mediaType: ImageMediaType;
12
- readonly bytes: number;
13
- readonly width: number;
14
- readonly height: number;
15
- readonly name?: string;
16
- }
17
- //#endregion
18
- //#region src/image/types.d.ts
19
- /**
20
- * Image draft vocabulary for the TUI input pipeline (plan M1).
21
- *
22
- * The draft layer is TUI-owned: it stages clipboard/file bytes until a
23
- * submission turns them into durable `ImageAttachmentRef`s through the dsh
24
- * attachment service. Nothing in this module persists; the durable boundary
25
- * is the harness's `ctx.attachments.saveImages()`.
26
- *
27
- * The media-type union mirrors `@deepseek-ai/dsh-attachment`'s
28
- * `ImageMediaType` structurally, so drafts flow into the harness without a
29
- * runtime dependency on the attachment package (AGENTS.md decision 7:
30
- * structural typing for dsh services).
31
- * @module @xmoon76/dsh-pi-tui/image/types
32
- */
33
- /** Raster media types accepted by the TUI image intake. */
34
- type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
35
- /** Per-TUI draft image identity; only meaningful inside one TUI run. */
36
- type DraftImageId = number;
37
- /** Where a staged image's bytes came from. */
38
- type DraftImageSource = {
39
- readonly type: 'clipboard';
40
- } | {
41
- readonly type: 'path';
42
- readonly path: string;
43
- }
44
- /** The image was pulled back from a queued message: its bytes are ALREADY
45
- * durable with the harness (the recalled ref) — the draft holds no local
46
- * copy and re-submitting reuses the ref instead of re-uploading. */
47
- | {
48
- readonly type: 'recalled';
49
- };
50
- /**
51
- * One image staged in the editor draft. The draft holds the raw bytes so
52
- * clipboard and path entries share one shape and a submit never depends on
53
- * the source file still existing (plan §5.1). A RECALLED draft (pulled
54
- * back from the queue) instead carries the durable `ImageAttachmentRef`
55
- * and NO local bytes — the bytes stay in harness storage and re-submitting
56
- * reuses the ref.
57
- */
58
- interface DraftImage {
59
- /** Per-TUI draft identity (the `#N` of the placeholder). */
60
- readonly id: DraftImageId;
61
- readonly kind: 'image';
62
- readonly source: DraftImageSource;
63
- /** Exact encoded bytes, held only for the draft lifetime. Empty for a
64
- * recalled draft (its bytes live in harness storage). */
65
- readonly bytes: Uint8Array;
66
- readonly mediaType: ImageMediaType;
67
- /** Intrinsic encoded width in pixels. */
68
- readonly width: number;
69
- /** Intrinsic encoded height in pixels. */
70
- readonly height: number;
71
- /** Exact encoded byte length (`bytes.byteLength` for local drafts; the
72
- * durable ref's recorded `bytes` for recalled drafts). */
73
- readonly byteLength: number;
74
- /** Optional display name (basename for path sources), never a path. */
75
- readonly name?: string;
76
- /** The canonical editor placeholder text for this draft. */
77
- readonly placeholder: string;
78
- /** The durable ref this draft reuses on submit; present ONLY for
79
- * recalled drafts (already-durable images are never re-uploaded). */
80
- readonly recalledRef?: ImageAttachmentRefLike;
81
- }
82
- /** The store surface the placeholder expansion needs (structural). */
83
- interface DraftImageStoreLike {
84
- values(): readonly DraftImage[];
85
- }
86
- //#endregion
5
+ import { Agent, ModelSelectionRef } from "@deepseek-ai/dsh-agent";
6
+ import z from "@deepseek-ai/schemastery";
87
7
  //#region src/display-preset.d.ts
88
8
  /**
89
9
  * Canonical transcript display presets and their layered disclosure policy.
@@ -160,36 +80,10 @@ interface HumanSkillCatalog {
160
80
  readonly complete: boolean;
161
81
  }
162
82
  //#endregion
163
- //#region src/tui-app.d.ts
164
- /** The compaction lifecycle phase the working row advertises: idle (no
165
- * compaction), summarizing (compaction/start seen, the summary is being
166
- * generated), or applying (the summary landed, the compacted surface is
167
- * being committed). Derived by the runner from compaction/start →
168
- * compaction/summary → compaction/end (foldCompactionEvent). */
169
- type CompactionPhase = 'idle' | 'summarizing' | 'applying';
170
- /**
171
- * The WEB composer submit gestures (DSH `ComposerSubmitGesture`): plain
172
- * Enter, or the Cmd/Ctrl-accelerated chord. The busy-Enter policy resolves
173
- * each to a delivery mode — plain Enter to the preferred mode, the
174
- * accelerated chord to its OPPOSITE — so the chord is never a fixed mode.
175
- */
176
- type ComposerSubmitGesture = 'enter' | 'accelerated';
177
- /** One semantic queued pending-input row for the queue pane. */
178
- interface QueueItem {
179
- /** The pending message id (agent inbox identity), or a local request id. */
180
- id: string;
181
- /** The message text, single-line display form. */
182
- text: string;
183
- /** next-turn followup vs next-step steer. */
184
- mode: 'followup' | 'steer';
185
- /** The correlation identity (authoritative rpc id or local request id). */
186
- rpcId?: string;
187
- /** A client-local echo not yet backed by an authoritative occurrence. */
188
- local?: boolean;
189
- }
190
- //#endregion
191
83
  //#region src/surface-catalog.d.ts
192
- /** Minimal live-agent face consumed by the effective catalog readers. */
84
+ /** Minimal live-agent face consumed by the effective catalog readers — and by
85
+ * {@link ResolveInitialCatalogOptions}, so the published option type stays
86
+ * structural instead of inlining the Host Agent. */
193
87
  interface SurfaceCatalogAgent {
194
88
  readonly ctx: object;
195
89
  readonly session: {
@@ -256,42 +150,16 @@ interface SurfaceCommandsService {
256
150
  interface SurfaceCatalogContext {
257
151
  get(name: 'commands'): SurfaceCommandsService | undefined;
258
152
  }
153
+ interface InitialCatalogResolution {
154
+ /** The resume prefetch snapshot to install at mount. */
155
+ readonly snapshot?: SurfaceCatalogSnapshot;
156
+ /** The cold standing-scope human skill catalog (deferred start). */
157
+ readonly skills?: HumanSkillCatalog;
158
+ /** A user-facing notice when the prefetch/standing read degraded. */
159
+ readonly notice?: string;
160
+ }
259
161
  //#endregion
260
- //#region src/commands.d.ts
261
- /**
262
- * The effective mode ONE submission resolved at the submit boundary: whether
263
- * an agent-facing delivery steers into the running turn or queues behind it
264
- * (web `ComposerSubmissionPolicy` parity — an idle agent queues, plain Enter
265
- * takes the preference, and the accelerated chord takes its OPPOSITE).
266
- *
267
- * It is a property of the GESTURE, not of the persisted settings: a one-shot
268
- * gesture exists only inside the dispatch that resolved it, so every
269
- * downstream consumer (the TUI skill delivery) accepts this value instead of
270
- * re-deriving the mode from `busyEnter`.
271
- */
272
- type SubmitDelivery = 'steer' | 'queue';
273
- /**
274
- * The CURRENT host catalog's view of ONE parsed line (the DSH client
275
- * `CommandUiRuntime.matchEnter` decision table): whether the host CLAIMS the
276
- * line, and — for a claimed line — the claiming descriptor's attachment
277
- * declaration, so the dispatch can never consult two different catalog views
278
- * for the claim and the declaration.
279
- */
280
- type HostCommandClaim = {
281
- readonly claimed: true;
282
- /** The claiming descriptor's `input.attachments`
283
- * (DSH `CommandInputDescriptor.attachments`): only a declaring command
284
- * may be invoked with composer attachments. */
285
- readonly attachments: boolean;
286
- } | {
287
- readonly claimed: false;
288
- };
289
- //#endregion
290
- //#region src/index.d.ts
291
- /** Stable Cordis plugin name. */
292
- declare const name = "tui-runner";
293
- /** Core services required before the TUI can mount. */
294
- declare const inject: string[];
162
+ //#region src/tui-config.d.ts
295
163
  /** Plugin config: the session to resume, resolved from the startup service,
296
164
  * plus the DSH 0.1.7 profile-owned live TUI preferences. Every preference
297
165
  * field is a schemastery `.volatile()` reference (PR A): the `tui-app`
@@ -365,6 +233,161 @@ interface Config {
365
233
  readonly legacySettingsMigrationVersion: Volatile<number>;
366
234
  }
367
235
  declare const Config: z<Config>;
236
+ //#endregion
237
+ //#region src/image/admission.d.ts
238
+ /** Structural subset of `ImageAttachmentRef`. */
239
+ interface ImageAttachmentRefLike {
240
+ readonly attachmentId: string;
241
+ readonly mediaType: ImageMediaType;
242
+ readonly bytes: number;
243
+ readonly width: number;
244
+ readonly height: number;
245
+ readonly name?: string;
246
+ }
247
+ //#endregion
248
+ //#region src/image/types.d.ts
249
+ /**
250
+ * Image draft vocabulary for the TUI input pipeline (plan M1).
251
+ *
252
+ * The draft layer is TUI-owned: it stages clipboard/file bytes until a
253
+ * submission turns them into durable `ImageAttachmentRef`s through the dsh
254
+ * attachment service. Nothing in this module persists; the durable boundary
255
+ * is the harness's `ctx.attachments.saveImages()`.
256
+ *
257
+ * The media-type union mirrors `@deepseek-ai/dsh-attachment`'s
258
+ * `ImageMediaType` structurally, so drafts flow into the harness without a
259
+ * runtime dependency on the attachment package (AGENTS.md decision 7:
260
+ * structural typing for dsh services).
261
+ * @module @xmoon76/dsh-pi-tui/image/types
262
+ */
263
+ /** Raster media types accepted by the TUI image intake. */
264
+ type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
265
+ /** Per-TUI draft image identity; only meaningful inside one TUI run. */
266
+ type DraftImageId = number;
267
+ /** Where a staged image's bytes came from. */
268
+ type DraftImageSource = {
269
+ readonly type: 'clipboard';
270
+ } | {
271
+ readonly type: 'path';
272
+ readonly path: string;
273
+ }
274
+ /** The image was pulled back from a queued message: its bytes are ALREADY
275
+ * durable with the harness (the recalled ref) — the draft holds no local
276
+ * copy and re-submitting reuses the ref instead of re-uploading. */
277
+ | {
278
+ readonly type: 'recalled';
279
+ };
280
+ /**
281
+ * One image staged in the editor draft. The draft holds the raw bytes so
282
+ * clipboard and path entries share one shape and a submit never depends on
283
+ * the source file still existing (plan §5.1). A RECALLED draft (pulled
284
+ * back from the queue) instead carries the durable `ImageAttachmentRef`
285
+ * and NO local bytes — the bytes stay in harness storage and re-submitting
286
+ * reuses the ref.
287
+ */
288
+ interface DraftImage {
289
+ /** Per-TUI draft identity (the `#N` of the placeholder). */
290
+ readonly id: DraftImageId;
291
+ readonly kind: 'image';
292
+ readonly source: DraftImageSource;
293
+ /** Exact encoded bytes, held only for the draft lifetime. Empty for a
294
+ * recalled draft (its bytes live in harness storage). */
295
+ readonly bytes: Uint8Array;
296
+ readonly mediaType: ImageMediaType;
297
+ /** Intrinsic encoded width in pixels. */
298
+ readonly width: number;
299
+ /** Intrinsic encoded height in pixels. */
300
+ readonly height: number;
301
+ /** Exact encoded byte length (`bytes.byteLength` for local drafts; the
302
+ * durable ref's recorded `bytes` for recalled drafts). */
303
+ readonly byteLength: number;
304
+ /** Optional display name (basename for path sources), never a path. */
305
+ readonly name?: string;
306
+ /** The canonical editor placeholder text for this draft. */
307
+ readonly placeholder: string;
308
+ /** The durable ref this draft reuses on submit; present ONLY for
309
+ * recalled drafts (already-durable images are never re-uploaded). */
310
+ readonly recalledRef?: ImageAttachmentRefLike;
311
+ }
312
+ /** The store surface the placeholder expansion needs (structural). */
313
+ interface DraftImageStoreLike {
314
+ values(): readonly DraftImage[];
315
+ }
316
+ //#endregion
317
+ //#region src/task-presentation.d.ts
318
+ declare function subagentJobTranscriptId(snapshot: unknown): string | undefined;
319
+ /**
320
+ * The Task Center row-selection disposition (plan §4.3/§4.4). A subagent
321
+ * transcript opens a session/viewer surface that REPLACES the browser; a
322
+ * Job row's detail keeps it mounted (the caller passes {@link openJobView}'s
323
+ * disposition). An UNKNOWN row — a stale panel selection after a live
324
+ * re-projection — also keeps the parent usable instead of dismissing it.
325
+ */
326
+ declare function taskRowSelectionDisposition(row: {
327
+ readonly kind: 'job' | 'subagent';
328
+ } | undefined, jobDetail: 'close' | 'keep-open'): 'close' | 'keep-open';
329
+ /** Viewer body for a subagent job with no uniquely matched child. */
330
+ declare function subagentJobViewHint(status: string, detail: string | undefined): string;
331
+ //#endregion
332
+ //#region src/tui-app.d.ts
333
+ /** The compaction lifecycle phase the working row advertises: idle (no
334
+ * compaction), summarizing (compaction/start seen, the summary is being
335
+ * generated), or applying (the summary landed, the compacted surface is
336
+ * being committed). Derived by the runner from compaction/start →
337
+ * compaction/summary → compaction/end (foldCompactionEvent). */
338
+ type CompactionPhase = 'idle' | 'summarizing' | 'applying';
339
+ /**
340
+ * The WEB composer submit gestures (DSH `ComposerSubmitGesture`): plain
341
+ * Enter, or the Cmd/Ctrl-accelerated chord. The busy-Enter policy resolves
342
+ * each to a delivery mode — plain Enter to the preferred mode, the
343
+ * accelerated chord to its OPPOSITE — so the chord is never a fixed mode.
344
+ */
345
+ type ComposerSubmitGesture = 'enter' | 'accelerated';
346
+ /** One semantic queued pending-input row for the queue pane. */
347
+ interface QueueItem {
348
+ /** The pending message id (agent inbox identity), or a local request id. */
349
+ id: string;
350
+ /** The message text, single-line display form. */
351
+ text: string;
352
+ /** next-turn followup vs next-step steer. */
353
+ mode: 'followup' | 'steer';
354
+ /** The correlation identity (authoritative rpc id or local request id). */
355
+ rpcId?: string;
356
+ /** A client-local echo not yet backed by an authoritative occurrence. */
357
+ local?: boolean;
358
+ }
359
+ //#endregion
360
+ //#region src/commands.d.ts
361
+ /**
362
+ * The effective mode ONE submission resolved at the submit boundary: whether
363
+ * an agent-facing delivery steers into the running turn or queues behind it
364
+ * (web `ComposerSubmissionPolicy` parity — an idle agent queues, plain Enter
365
+ * takes the preference, and the accelerated chord takes its OPPOSITE).
366
+ *
367
+ * It is a property of the GESTURE, not of the persisted settings: a one-shot
368
+ * gesture exists only inside the dispatch that resolved it, so every
369
+ * downstream consumer (the TUI skill delivery) accepts this value instead of
370
+ * re-deriving the mode from `busyEnter`.
371
+ */
372
+ type SubmitDelivery = 'steer' | 'queue';
373
+ /**
374
+ * The CURRENT host catalog's view of ONE parsed line (the DSH client
375
+ * `CommandUiRuntime.matchEnter` decision table): whether the host CLAIMS the
376
+ * line, and — for a claimed line — the claiming descriptor's attachment
377
+ * declaration, so the dispatch can never consult two different catalog views
378
+ * for the claim and the declaration.
379
+ */
380
+ type HostCommandClaim = {
381
+ readonly claimed: true;
382
+ /** The claiming descriptor's `input.attachments`
383
+ * (DSH `CommandInputDescriptor.attachments`): only a declaring command
384
+ * may be invoked with composer attachments. */
385
+ readonly attachments: boolean;
386
+ } | {
387
+ readonly claimed: false;
388
+ };
389
+ //#endregion
390
+ //#region src/command-policy.d.ts
368
391
  /**
369
392
  * Slash commands that need no session: before the first user message
370
393
  * (deferred start) they run locally without creating one. Everything else
@@ -529,6 +552,29 @@ declare function normalizeSkillInvocation(text: string): string | undefined;
529
552
  declare function shouldConsumeAdvertisedMiss(execution: {
530
553
  readonly result: unknown;
531
554
  } | undefined, wasAdvertised: boolean): boolean;
555
+ /**
556
+ * Whether a plain submitted draft is the quit word: exactly `exit` (trimmed,
557
+ * lowercase). The runner intercepts this BEFORE any session creation or
558
+ * submission (shell muscle memory); anything else — `exit!`, `Exit`, or a
559
+ * draft with a recalled entry still in it — is an ordinary message.
560
+ * @param text - the submitted draft.
561
+ */
562
+ declare function isPlainExitPrompt(text: string): boolean;
563
+ /**
564
+ * Whether a shell command matches a destructive pattern. `rm` is treated
565
+ * specially: any spelling of recursive + force flags (`rm -rf`, `rm -r -f`,
566
+ * `rm -rf /`) is dangerous; the remaining patterns are verbatim matches.
567
+ */
568
+ declare function dangerCommand(command: string): boolean;
569
+ //#endregion
570
+ //#region src/interrupt.d.ts
571
+ /**
572
+ * The live-turn interrupt helper (web Stop parity): abort the current
573
+ * turn/tool run while PRESERVING the pending queue. Kept out of the
574
+ * composition root so the rule is testable headless, and its structural
575
+ * faces keep the internal runtime port module out of the published entry.
576
+ * @module @xmoon76/dsh-pi-tui/interrupt
577
+ */
532
578
  /** Public settlement shape for the interrupt helper. Kept local so the
533
579
  * entry-point declaration does not expose the internal runtime port module. */
534
580
  type InterruptWriteOutcome = {
@@ -593,6 +639,8 @@ interface InterruptWriterLike {
593
639
  * agreed web-parity behavior until upstream lands the capability.
594
640
  */
595
641
  declare function interruptAgent(agent: InterruptAgentLike | undefined, writer: InterruptWriterLike): Promise<InterruptWriteOutcome>;
642
+ //#endregion
643
+ //#region src/subagent-viewer.d.ts
596
644
  /** One unsettled subagent delegation, in tool/call order. */
597
645
  interface PendingSubagentCall {
598
646
  readonly callId: string;
@@ -664,79 +712,8 @@ declare function viewerActionCapability(action: TuiAction, viewer: {
664
712
  * @returns the matched call, or undefined when nothing matches.
665
713
  */
666
714
  declare function matchPendingSubagentCall(pending: PendingSubagentCall[], label: string | undefined): PendingSubagentCall | undefined;
667
- /**
668
- * The pre-mount surface catalog resolution:
669
- * - an explicit `--session` start PREFETCHES the resumed agent's effective
670
- * catalog (a live read emits no session events);
671
- * - the deferred start (no `--session`) reads the cold HUMAN SKILL catalog
672
- * through the preset's STANDING SCOPE — no Agent, no session, no turn —
673
- * so the first input sees human-invocable skills without any durable
674
- * side effect (the mechanism that avoids the probe dead end: host
675
- * `session/created` observers write durable knob events into every fresh
676
- * session).
677
- *
678
- * The snapshot (resume) or the skill catalog (cold) installs synchronously
679
- * after mount (the ready barrier).
680
- *
681
- * Failure taxonomy (plan appendix B):
682
- * - lifecycle cancellation: nothing installed, no notice;
683
- * - a prefetch/standing read failure degrades to a one-shot notice (the
684
- * TUI mounts with the global view and built-in commands);
685
- * - a missing/unknown preset or a broken standing mount degrades the cold
686
- * target to the global layer with a one-shot notice — never a probe
687
- * Agent, never a startup failure;
688
- * - an ordinary provider read failure never rejects here: it becomes an
689
- * empty field + detached issue inside the catalog.
690
- * @param options - injected dependencies (see {@link ResolveInitialCatalogOptions}).
691
- * @returns the snapshot / skill catalog to install and an optional notice.
692
- */
693
- interface InitialCatalogResolution {
694
- /** The resume prefetch snapshot to install at mount. */
695
- readonly snapshot?: SurfaceCatalogSnapshot;
696
- /** The cold standing-scope human skill catalog (deferred start). */
697
- readonly skills?: HumanSkillCatalog;
698
- /** A user-facing notice when the prefetch/standing read degraded. */
699
- readonly notice?: string;
700
- }
701
- /** Options for {@link resolveInitialCatalog}. */
702
- interface ResolveInitialCatalogOptions {
703
- /** The resumed live agent, if any (prefetch path). */
704
- readonly liveAgent?: Agent;
705
- /** The effective preset id for the cold standing read (undefined = the
706
- * deployment default; only consulted for the deferred start). */
707
- readonly presetId?: string;
708
- readonly signal: AbortSignal;
709
- /** The context surface the collectors read services from. */
710
- readonly ctx: SurfaceCatalogContext;
711
- readonly diag: Diag;
712
- /** Suspend the pre-mount startup status before an ordinary log write
713
- * (the status owns the current terminal line; a TTY shares one cursor
714
- * between stdout and stderr). Called right before every diag.warn this
715
- * function may emit. */
716
- readonly onLog?: () => void;
717
- }
718
- declare function resolveInitialCatalog(options: ResolveInitialCatalogOptions): Promise<InitialCatalogResolution>;
719
- declare function subagentJobTranscriptId(snapshot: unknown): string | undefined;
720
- /**
721
- * The Task Center row-selection disposition (plan §4.3/§4.4). A subagent
722
- * transcript opens a session/viewer surface that REPLACES the browser; a
723
- * Job row's detail keeps it mounted (the caller passes {@link openJobView}'s
724
- * disposition). An UNKNOWN row — a stale panel selection after a live
725
- * re-projection — also keeps the parent usable instead of dismissing it.
726
- */
727
- declare function taskRowSelectionDisposition(row: {
728
- readonly kind: 'job' | 'subagent';
729
- } | undefined, jobDetail: 'close' | 'keep-open'): 'close' | 'keep-open';
730
- /** Viewer body for a subagent job with no uniquely matched child. */
731
- declare function subagentJobViewHint(status: string, detail: string | undefined): string;
732
- /**
733
- * Whether a plain submitted draft is the quit word: exactly `exit` (trimmed,
734
- * lowercase). The runner intercepts this BEFORE any session creation or
735
- * submission (shell muscle memory); anything else — `exit!`, `Exit`, or a
736
- * draft with a recalled entry still in it — is an ordinary message.
737
- * @param text - the submitted draft.
738
- */
739
- declare function isPlainExitPrompt(text: string): boolean;
715
+ //#endregion
716
+ //#region src/pending-presentation.d.ts
740
717
  /** One semantic pending-input item as the queue mirror sees it. */
741
718
  interface QueueInboxMessage {
742
719
  readonly id: string;
@@ -749,35 +726,11 @@ interface QueueFoldResult {
749
726
  /** Build queue-pane rows from semantic pending-input occurrences, preserving
750
727
  * their order and content without inspecting backend-specific metadata. */
751
728
  declare function foldQueueRows(messages: readonly QueueInboxMessage[], mode: 'followup' | 'steer'): QueueFoldResult;
752
- /**
753
- * Whether a shell command matches a destructive pattern. `rm` is treated
754
- * specially: any spelling of recursive + force flags (`rm -rf`, `rm -r -f`,
755
- * `rm -rf /`) is dangerous; the remaining patterns are verbatim matches.
756
- */
757
- declare function dangerCommand(command: string): boolean;
758
- /**
759
- * The dsh profile this process was launched with (the `--profile` flag),
760
- * so the exit-time resume hint names the profile the TUI actually runs
761
- * under. Falls back to `pi-tui` when the flag is absent (the TUI bundle
762
- * cannot load without a profile, so this is defensive only).
763
- * @param argv - the process argument vector.
764
- * @param fallback - the default profile.
765
- */
766
- declare function runningProfile(argv?: readonly string[], fallback?: string): string;
767
- /**
768
- * The interactive-quit resume hint (pi parity): `dsh --profile <p>
769
- * --session <id>`, printed after the terminal restores so the user can
770
- * re-enter the session later. Returns undefined when there is no session
771
- * to resume (deferred start never created one).
772
- * @param profile - the running profile ({@link runningProfile}).
773
- * @param sessionId - the live session id.
774
- * @returns the resume command line, or undefined without a session.
775
- */
776
- declare function resumeCommand(profile: string, sessionId: string): string | undefined;
777
- /** One fold of a compaction lifecycle event over the runner's in-flight
778
- * compaction state. Pure (the firehose applies the returned surface
779
- * effects): dsh-compaction is not a peer, so the event is read
780
- * structurally. */
729
+ //#endregion
730
+ //#region src/compaction-presentation.d.ts
731
+ /** One fold of a compaction lifecycle event over the in-flight compaction
732
+ * state. Pure (the routing applies the returned surface effects):
733
+ * dsh-compaction is not a peer, so the event is read structurally. */
781
734
  interface CompactionFold {
782
735
  /** The updated in-flight compaction id (the newest start wins). */
783
736
  id: string | undefined;
@@ -808,7 +761,7 @@ declare function foldCompactionEvent(state: {
808
761
  error?: unknown;
809
762
  };
810
763
  }): CompactionFold;
811
- /** The minimal compaction-settle surface the runner passes in — STRUCTURAL
764
+ /** The minimal compaction-settle surface the routing passes in — STRUCTURAL
812
765
  * on purpose: referencing the full {@link TuiApp} class from a public
813
766
  * export would inline the whole surface (and its internal registry/
814
767
  * presentation dependencies) into the published declaration bundle. The
@@ -854,6 +807,101 @@ declare function compactingFromLog(events: readonly {
854
807
  active: boolean;
855
808
  id: string | undefined;
856
809
  };
810
+ //#endregion
811
+ //#region src/dsh-profile.d.ts
812
+ /**
813
+ * The DSH launcher PROFILE identity and the resume hint (plan §27).
814
+ *
815
+ * Deliberately NOT part of `src/startup.ts`: the startup row is a
816
+ * zero-dependency island that must not share a bundle chunk with the runner,
817
+ * so these runner-side helpers live in their own module and the entry
818
+ * re-exports them unchanged.
819
+ * @module @xmoon76/dsh-pi-tui/dsh-profile
820
+ */
821
+ /**
822
+ * The dsh profile named by the `--profile` flag in `argv`, in both spellings.
823
+ * This is the ARGV-ONLY fallback: it cannot see the positional `dsh <name>`
824
+ * launch form, because the launcher consumes that bare name by synthesizing
825
+ * `['--profile', ...argv]` for its OWN commander parse and leaves
826
+ * `process.argv` untouched. Prefer {@link hostRunningProfile}, which reads the
827
+ * Host's profile identity instead of scraping the command line.
828
+ * @param argv - the process argument vector.
829
+ * @param fallback - the default profile.
830
+ */
831
+ declare function runningProfile(argv?: readonly string[], fallback?: string): string;
832
+ /** The one context read {@link hostRunningProfile} needs (a cordis Context satisfies it). */
833
+ interface ProfileContextReadLike {
834
+ get(name: string): unknown;
835
+ }
836
+ /**
837
+ * The profile this process actually runs — the official Host
838
+ * `profileContext.name` when it is composed, else {@link runningProfile}'s
839
+ * argv scrape.
840
+ *
841
+ * `profileContext.name` is the launcher's own profile identity, so it is
842
+ * correct for EVERY launch form: `--profile <name>`, `--profile=<name>`, the
843
+ * positional `dsh <name>`, and `--from-default-profile <name>`. The argv
844
+ * scrape only knows the flag form, which is why it is the fallback for a
845
+ * profile-less mount (tests, an embedded surface) rather than the primary
846
+ * source.
847
+ * @param ctx - the plugin context (or any structural `get`-only stand-in).
848
+ * @param argv - the process argument vector for the fallback path.
849
+ * @param fallback - the default profile for the fallback path.
850
+ * @returns the running profile name.
851
+ */
852
+ declare function hostRunningProfile(ctx: ProfileContextReadLike, argv?: readonly string[], fallback?: string): string;
853
+ /**
854
+ * The interactive-quit resume hint (pi parity): `dsh --profile <p>
855
+ * --session <id>`, printed after the terminal restores so the user can
856
+ * re-enter the session later. Returns undefined when there is no session
857
+ * to resume (deferred start never created one).
858
+ * @param profile - the running profile ({@link hostRunningProfile}).
859
+ * @param sessionId - the live session id.
860
+ * @returns the resume command line, or undefined without a session.
861
+ */
862
+ declare function resumeCommand(profile: string, sessionId: string): string | undefined;
863
+ //#endregion
864
+ //#region src/index.d.ts
865
+ /** Stable Cordis plugin name. */
866
+ declare const name = "tui-runner";
867
+ /** Core services required before the TUI can mount. */
868
+ declare const inject: string[];
869
+ /**
870
+ * Options for {@link resolveInitialCatalog}.
871
+ *
872
+ * The public declaration stays here (A5a review P1): `liveAgent` keeps the Host
873
+ * `Agent` type it has always had, so consumers that READ the property keep
874
+ * compiling. The implementation consumes the structural
875
+ * `SurfaceCatalogResolutionOptions` in `surface-catalog.ts`.
876
+ */
877
+ interface ResolveInitialCatalogOptions {
878
+ /** The resumed live agent, if any (prefetch path). */
879
+ readonly liveAgent?: Agent;
880
+ /** The effective preset id for the cold standing read (undefined = the
881
+ * deployment default; only consulted for the deferred start). */
882
+ readonly presetId?: string;
883
+ readonly signal: AbortSignal;
884
+ /** The context surface the collectors read services from. */
885
+ readonly ctx: SurfaceCatalogContext;
886
+ readonly diag: Diag;
887
+ /** Suspend the pre-mount startup status before an ordinary log write
888
+ * (the status owns the current terminal line; a TTY shares one cursor
889
+ * between stdout and stderr). Called right before every diag.warn this
890
+ * function may emit. */
891
+ readonly onLog?: () => void;
892
+ }
893
+ /**
894
+ * The pre-mount surface catalog resolution (plan §27): the published entry for
895
+ * {@link ResolveInitialCatalogOptions}. An explicit `--session` start
896
+ * prefetches the resumed agent's effective catalog; the deferred start reads the
897
+ * cold HUMAN SKILL catalog through the preset's STANDING SCOPE — no Agent, no
898
+ * session, no turn — so the first input sees human-invocable skills without any
899
+ * durable side effect. The implementation and its failure taxonomy live in
900
+ * `surface-catalog.ts`.
901
+ * @param options - injected dependencies (see {@link ResolveInitialCatalogOptions}).
902
+ * @returns the snapshot / skill catalog to install and an optional notice.
903
+ */
904
+ declare function resolveInitialCatalog(options: ResolveInitialCatalogOptions): Promise<InitialCatalogResolution>;
857
905
  /** One agent's preset composition: the id to record and the setup that installs it. */
858
906
  interface AgentComposition {
859
907
  /** Preset id for the session header, absent when the deployment composes no roster. */
@@ -922,4 +970,4 @@ declare function recordedPreset(ctx: Context, sessionId: string): Promise<string
922
970
  */
923
971
  declare function apply(ctx: Context, config: Config): void;
924
972
  //#endregion
925
- export { AgentComposition, CompactionFold, CompactionSettleSurface, Config, HOST_COMMAND_CATALOG, InitialCatalogResolution, InterruptAgentLike, InterruptWriteOutcome, InterruptWriterLike, LOCAL_COMMANDS, PendingSubagentCall, QueueFoldResult, QueueInboxMessage, ResolveInitialCatalogOptions, SESSIONLESS_COMMANDS, ViewerOpenToken, apply, busyAfterTurnBoundary, commandIsLocalForAttachments, commandRejectsImages, compactingFromLog, composeAgent, contextRefreshKind, createViewerOpenToken, dangerCommand, foldCompactionEvent, foldQueueRows, inject, interruptAgent, isBareCommandLine, isLocalCommandLine, isPlainExitPrompt, matchPendingSubagentCall, name, normalizeSkillInvocation, recordedPreset, resolveInitialCatalog, resolveSubmitDelivery, resumeCommand, runningProfile, settleCompactionSurface, shouldConsumeAdvertisedMiss, subagentJobTranscriptId, subagentJobViewHint, taskRowSelectionDisposition, teardownViewerForSessionSwap, viewerActionCapability };
973
+ export { AgentComposition, type CompactionFold, type CompactionSettleSurface, Config, HOST_COMMAND_CATALOG, type InitialCatalogResolution, type InterruptAgentLike, type InterruptWriteOutcome, type InterruptWriterLike, LOCAL_COMMANDS, type PendingSubagentCall, type ProfileContextReadLike, type QueueFoldResult, type QueueInboxMessage, ResolveInitialCatalogOptions, SESSIONLESS_COMMANDS, type ViewerOpenToken, apply, busyAfterTurnBoundary, commandIsLocalForAttachments, commandRejectsImages, compactingFromLog, composeAgent, contextRefreshKind, createViewerOpenToken, dangerCommand, foldCompactionEvent, foldQueueRows, hostRunningProfile, inject, interruptAgent, isBareCommandLine, isLocalCommandLine, isPlainExitPrompt, matchPendingSubagentCall, name, normalizeSkillInvocation, recordedPreset, resolveInitialCatalog, resolveSubmitDelivery, resumeCommand, runningProfile, settleCompactionSurface, shouldConsumeAdvertisedMiss, subagentJobTranscriptId, subagentJobViewHint, taskRowSelectionDisposition, teardownViewerForSessionSwap, viewerActionCapability };