@xmoon76/dsh-pi-tui 0.1.8 → 0.2.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/config/agent-presets/code/agent.cordis.yml +6 -5
- package/config/agent-presets/cordis/agent.cordis.yml +6 -5
- package/config/agent-presets/cordis/skills/editing-cordis-compositions/SKILL.md +3 -3
- package/config/agent-presets/minimal/agent.cordis.yml +27 -1
- package/config/agent-presets/standard/agent.cordis.yml +6 -5
- package/cordis.patch.yml +14 -1
- package/dist/builtins.d.mts +18 -0
- package/dist/builtins.mjs +75 -0
- package/dist/extension/advanced.d.mts +372 -0
- package/dist/extension/advanced.mjs +46 -0
- package/dist/extension/unstable.d.mts +206 -0
- package/dist/extension/unstable.mjs +30 -0
- package/dist/extensions.d.mts +132 -0
- package/dist/extensions.mjs +3 -0
- package/dist/index.d.mts +63 -3
- package/dist/index.mjs +3 -22739
- package/dist/public-types-2omeXG8d.d.mts +740 -0
- package/dist/src-AgdnRnGA.mjs +30851 -0
- package/dist/theme-registry-CjbtRmhd.d.mts +1 -0
- package/package.json +81 -55
- package/scripts/advanced-plugin-smoke.mjs +314 -0
- package/scripts/bench.mts +40 -5
- package/scripts/examples-plugin-smoke.mjs +320 -0
- package/scripts/extension-fixture-smoke.mjs +219 -0
- package/scripts/phase4-plugin-smoke.mjs +318 -0
- package/scripts/tarball-smoke.mjs +69 -7
- package/scripts/unstable-plugin-smoke.mjs +300 -0
- package/scripts/vim-plugin-smoke.mjs +315 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/extension/advanced-types.ts
|
|
2
|
+
/** API level of the advanced tier. Bumped only on advanced breaking changes. */
|
|
3
|
+
const ADVANCED_API_LEVEL = 1;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/extension/advanced.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build the ADVANCED facade over the shared `piTuiExtensions` service
|
|
8
|
+
* (plan §4). The facade is a thin capability view: every resource it
|
|
9
|
+
* creates is caller-fiber-owned and surface-generation-scoped through the
|
|
10
|
+
* service's shared Extension Runtime — never a second plugin system.
|
|
11
|
+
*
|
|
12
|
+
* The facade is safe to call before any surface exists: registrations
|
|
13
|
+
* (input captures) are service-lifetime and attach later; leases
|
|
14
|
+
* (interactive overlays) and the editor controls are inert until a
|
|
15
|
+
* surface is live.
|
|
16
|
+
*
|
|
17
|
+
* The parameter is the structural {@link AdvancedServiceHost}: a plain
|
|
18
|
+
* `PiTuiExtensionService` value is accepted (the seam members are optional
|
|
19
|
+
* in the type), and the facade throws loudly when the host does not
|
|
20
|
+
* implement the seam (a host/plugin version mismatch).
|
|
21
|
+
* @param service - the `piTuiExtensions` service (from `ctx.get(...)`).
|
|
22
|
+
* @returns the Advanced facade.
|
|
23
|
+
*/
|
|
24
|
+
function advanced(service) {
|
|
25
|
+
const host = service;
|
|
26
|
+
if (host._advancedCaptureInput === void 0 || host._advancedShowInteractiveOverlay === void 0 || host._advancedEditorControls === void 0 || host._advancedUiSelect === void 0 || host._advancedUiConfirm === void 0 || host._advancedUiInput === void 0 || host._advancedUiNotify === void 0 || host._advancedUiCustom === void 0 || host._advancedHostState === void 0) throw new Error("this piTuiExtensions host does not implement the advanced seam (host/plugin version mismatch? upgrade the host bundle)");
|
|
27
|
+
return {
|
|
28
|
+
input: { capture: (spec) => host._advancedCaptureInput(spec) },
|
|
29
|
+
ui: {
|
|
30
|
+
showInteractiveOverlay: (component, options) => host._advancedShowInteractiveOverlay(component, options),
|
|
31
|
+
select: (options) => host._advancedUiSelect(options),
|
|
32
|
+
confirm: (options) => host._advancedUiConfirm(options),
|
|
33
|
+
input: (options) => host._advancedUiInput(options),
|
|
34
|
+
notify: (message, options) => host._advancedUiNotify(message, options),
|
|
35
|
+
custom: (factory, options) => host._advancedUiCustom(factory, options)
|
|
36
|
+
},
|
|
37
|
+
get editor() {
|
|
38
|
+
return host._advancedEditorControls();
|
|
39
|
+
},
|
|
40
|
+
get host() {
|
|
41
|
+
return host._advancedHostState();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ADVANCED_API_LEVEL, advanced };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { E as PiTuiApiInfo, _ as ExtensionTier, at as TuiOverlayOptions } from "../public-types-2omeXG8d.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/extension/unstable-types.d.ts
|
|
4
|
+
/** API level of the unstable tier. Bumped only on unstable breaking changes. */
|
|
5
|
+
declare const UNSTABLE_API_LEVEL: 1;
|
|
6
|
+
/**
|
|
7
|
+
* One raw terminal input chunk (plan §5). The plugin receives the RAW
|
|
8
|
+
* bytes exactly as the terminal delivered them — no decoding, no
|
|
9
|
+
* sanitization. `surfaceId` identifies the surface generation the chunk
|
|
10
|
+
* arrived on.
|
|
11
|
+
*/
|
|
12
|
+
interface UnstableRawInputEvent {
|
|
13
|
+
/** The raw terminal data (a chunk, not necessarily one key). */
|
|
14
|
+
readonly data: string;
|
|
15
|
+
/** The surface generation the chunk arrived on. */
|
|
16
|
+
readonly surfaceId: string;
|
|
17
|
+
}
|
|
18
|
+
/** The outcome of one raw interception (plan §5). */
|
|
19
|
+
type UnstableRawInputResult = /** Pass the chunk through unchanged (the Host continues processing). */{
|
|
20
|
+
readonly action: 'pass';
|
|
21
|
+
} /** Consume the chunk (the Host does nothing further with it). */ | {
|
|
22
|
+
readonly action: 'consume';
|
|
23
|
+
}
|
|
24
|
+
/** Rewrite the chunk: the Host decodes the REPLACEMENT data instead.
|
|
25
|
+
* Each terminal chunk passes the interception chain at most once — the
|
|
26
|
+
* replacement goes straight to the Host decoder, never re-entering the
|
|
27
|
+
* chain (no recursion). */
|
|
28
|
+
| {
|
|
29
|
+
readonly action: 'rewrite';
|
|
30
|
+
readonly data: string;
|
|
31
|
+
};
|
|
32
|
+
/** The raw capture modes (plan §5). */
|
|
33
|
+
type UnstableRawCaptureMode = 'observe' | 'capture' | 'exclusive';
|
|
34
|
+
/**
|
|
35
|
+
* One raw input capture registration (plan §5/§8). The capture is
|
|
36
|
+
* consulted by the Host BEFORE terminal protocol decoding — it can see,
|
|
37
|
+
* consume or rewrite ANY raw chunk, including Enter, Esc, Ctrl+C, paste,
|
|
38
|
+
* CSI-u sequences and terminal-specific protocols. This is the Unstable
|
|
39
|
+
* contract: a broken capture can make Host shortcuts stop working. The
|
|
40
|
+
* ONLY Host-owned recovery is the emergency fail-safe (triple-Esc), which
|
|
41
|
+
* the Unstable API cannot rewrite.
|
|
42
|
+
*
|
|
43
|
+
* Modes:
|
|
44
|
+
* - `observe` — never consumes or rewrites; a pure observer.
|
|
45
|
+
* - `capture` — may consume or rewrite.
|
|
46
|
+
* - `exclusive` — the SOLE capture consumer while live: capture-mode
|
|
47
|
+
* captures are not consulted (observers still run). A second exclusive
|
|
48
|
+
* registration is an explicit error, never a load-order winner.
|
|
49
|
+
*
|
|
50
|
+
* Ordering is deterministic: `priority` ASC, then `id` ASC. A throwing
|
|
51
|
+
* handler is isolated (health ledger) and FAILS OPEN — the chunk passes
|
|
52
|
+
* through, so a broken capture can never stall the TUI.
|
|
53
|
+
*/
|
|
54
|
+
interface UnstableRawInputSpec {
|
|
55
|
+
/** Stable diagnostic identity, unique per owner. */
|
|
56
|
+
readonly id: string;
|
|
57
|
+
/** Deterministic ordering: priority ASC, then id ASC. */
|
|
58
|
+
readonly priority?: number;
|
|
59
|
+
/** observe | capture | exclusive (default: capture). */
|
|
60
|
+
readonly mode?: UnstableRawCaptureMode;
|
|
61
|
+
/** Optional gate: the capture is consulted only while this returns true.
|
|
62
|
+
* A throwing gate is treated as false (the capture is skipped). */
|
|
63
|
+
readonly when?: () => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The raw handler. Return {@link UnstableRawInputResult} to
|
|
66
|
+
* pass/consume/rewrite; return void/undefined to pass. A throwing
|
|
67
|
+
* handler is isolated and fails open.
|
|
68
|
+
*/
|
|
69
|
+
handle(event: UnstableRawInputEvent): UnstableRawInputResult | void;
|
|
70
|
+
}
|
|
71
|
+
/** A live handle on one raw input capture. */
|
|
72
|
+
interface UnstableRawInputHandle {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
/** Remove the capture. Idempotent; owner unload also disposes it. */
|
|
75
|
+
dispose(): void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A low-level mounted component (plan §9, option A): the plugin renders RAW
|
|
79
|
+
* lines (no Host sanitization — the Unstable contract) and receives RAW
|
|
80
|
+
* input. The Host owns the physical mount, focus and teardown; the plugin
|
|
81
|
+
* owns the rendering and input semantics.
|
|
82
|
+
*/
|
|
83
|
+
interface UnstableMountedComponent {
|
|
84
|
+
/** Render the current state as raw terminal lines at the given width. */
|
|
85
|
+
render(width: number): string[];
|
|
86
|
+
/** Receive one raw input chunk while this component owns focus. */
|
|
87
|
+
handleInput?(raw: string): void;
|
|
88
|
+
/** The component was disposed (mount closed / surface died). */
|
|
89
|
+
dispose?(): void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A live lease on one low-level mount (plan §9/§10). The lease is
|
|
93
|
+
* caller-fiber-owned: owner unload closes the mount; a stale lease
|
|
94
|
+
* (surface disposed) is inert.
|
|
95
|
+
*/
|
|
96
|
+
interface UnstableMountLease {
|
|
97
|
+
/** The lease identity (stable diagnostic id). */
|
|
98
|
+
readonly id: string;
|
|
99
|
+
/** Whether the mount is still live (false after close/dispose). */
|
|
100
|
+
readonly active: boolean;
|
|
101
|
+
/** Whether the mount currently owns keyboard focus. */
|
|
102
|
+
readonly focused: boolean;
|
|
103
|
+
/** Request focus for the mount (also shows it if hidden). */
|
|
104
|
+
focus(): void;
|
|
105
|
+
/** Release focus. */
|
|
106
|
+
blur(): void;
|
|
107
|
+
/** Request a repaint of the mount. */
|
|
108
|
+
invalidate(): void;
|
|
109
|
+
/** Close the mount (idempotent; the surface's dispose also closes it). */
|
|
110
|
+
close(): void;
|
|
111
|
+
/** Temporarily hide (the lease stays live). */
|
|
112
|
+
hide(): void;
|
|
113
|
+
/** Show again after hide(). */
|
|
114
|
+
show(): void;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The low-level surface handle (plan §10): a SELECTED set of Host surface
|
|
118
|
+
* capabilities for low-level plugins. It NEVER exposes `TuiApp`,
|
|
119
|
+
* `TuiMainScreen`, `TuiAltScreen` or the terminal object — only the
|
|
120
|
+
* capabilities a low-level plugin genuinely needs. A stale handle
|
|
121
|
+
* (surface disposed) is inert.
|
|
122
|
+
*/
|
|
123
|
+
interface UnstableSurfaceHandle {
|
|
124
|
+
/** The attached surface generation's id. */
|
|
125
|
+
readonly surfaceId: string;
|
|
126
|
+
/** The surface generation (stable across start/stop/fullscreen). */
|
|
127
|
+
readonly generation: number;
|
|
128
|
+
/** The current terminal width in cells. */
|
|
129
|
+
readonly width: number;
|
|
130
|
+
/** The current terminal height in rows. */
|
|
131
|
+
readonly height: number;
|
|
132
|
+
/** Request a repaint of the active screen. */
|
|
133
|
+
requestRender(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Mount a low-level component (plan §9 option A) as a capturing overlay.
|
|
136
|
+
* The plugin renders RAW lines and receives RAW input; the Host owns
|
|
137
|
+
* the physical mount, focus, stacking, fullscreen migration and
|
|
138
|
+
* teardown. Caller-fiber-owned lease.
|
|
139
|
+
*/
|
|
140
|
+
mountComponent(component: UnstableMountedComponent, options?: TuiOverlayOptions): UnstableMountLease;
|
|
141
|
+
}
|
|
142
|
+
/** The unstable input facade (plan §5). */
|
|
143
|
+
interface UnstableInputFacade {
|
|
144
|
+
/**
|
|
145
|
+
* Register a raw input capture. Caller-fiber-owned: owner unload
|
|
146
|
+
* removes it. A duplicate id or a second exclusive capture is an
|
|
147
|
+
* explicit error.
|
|
148
|
+
*/
|
|
149
|
+
captureRaw(spec: UnstableRawInputSpec): UnstableRawInputHandle;
|
|
150
|
+
}
|
|
151
|
+
/** The unstable surface facade (plan §10). */
|
|
152
|
+
interface UnstableSurfaceFacade {
|
|
153
|
+
/** The CURRENT surface's low-level handle (a getter — the handle
|
|
154
|
+
* follows the live surface attachment; inert when no surface is
|
|
155
|
+
* live). */
|
|
156
|
+
readonly handle: UnstableSurfaceHandle;
|
|
157
|
+
}
|
|
158
|
+
/** The full unstable facade (plan §4: `unstable(service)`). */
|
|
159
|
+
interface UnstableFacade {
|
|
160
|
+
/** Raw input interception. */
|
|
161
|
+
readonly input: UnstableInputFacade;
|
|
162
|
+
/** The low-level surface seam. */
|
|
163
|
+
readonly surface: UnstableSurfaceFacade;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The minimal service surface the unstable facade consumes (plan §4:
|
|
167
|
+
* `unstable(service)`). STRUCTURAL and defined here so the packed
|
|
168
|
+
* unstable declarations never reference the internal service module —
|
|
169
|
+
* the concrete `piTuiExtensions` service implements these members, but
|
|
170
|
+
* the public `PiTuiExtensionService` interface does not declare them.
|
|
171
|
+
*
|
|
172
|
+
* `api` is the structural anchor: a plain `PiTuiExtensionService` value
|
|
173
|
+
* satisfies the facade's parameter (the seam members are optional in the
|
|
174
|
+
* type), and the facade throws loudly when the host does not implement
|
|
175
|
+
* the seam (a host/plugin version mismatch).
|
|
176
|
+
*/
|
|
177
|
+
interface UnstableServiceHost {
|
|
178
|
+
/** The public api() surface (the structural anchor — the facade does
|
|
179
|
+
* not consume it; it makes a plain `PiTuiExtensionService` value
|
|
180
|
+
* assignable to the parameter). */
|
|
181
|
+
readonly api: () => PiTuiApiInfo;
|
|
182
|
+
/** The service's internal unstable seam: register a raw input capture
|
|
183
|
+
* (caller-fiber-owned). */
|
|
184
|
+
_unstableCaptureRaw?(spec: UnstableRawInputSpec): UnstableRawInputHandle;
|
|
185
|
+
/** The service's internal unstable seam: the current surface's
|
|
186
|
+
* low-level handle (inert when stale). */
|
|
187
|
+
_unstableSurfaceHandle?(): UnstableSurfaceHandle;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/extension/unstable.d.ts
|
|
191
|
+
/**
|
|
192
|
+
* Build the UNSTABLE facade over the shared `piTuiExtensions` service
|
|
193
|
+
* (plan §4). The facade is a thin capability view: every resource it
|
|
194
|
+
* creates is caller-fiber-owned and surface-generation-scoped through the
|
|
195
|
+
* service's shared Extension Runtime — never a second plugin system.
|
|
196
|
+
*
|
|
197
|
+
* The parameter is the structural {@link UnstableServiceHost}: a plain
|
|
198
|
+
* `PiTuiExtensionService` value is accepted (the seam members are
|
|
199
|
+
* optional in the type), and the facade throws loudly when the host does
|
|
200
|
+
* not implement the seam (a host/plugin version mismatch).
|
|
201
|
+
* @param service - the `piTuiExtensions` service (from `ctx.get(...)`).
|
|
202
|
+
* @returns the Unstable facade.
|
|
203
|
+
*/
|
|
204
|
+
declare function unstable(service: UnstableServiceHost): UnstableFacade;
|
|
205
|
+
//#endregion
|
|
206
|
+
export { type ExtensionTier, UNSTABLE_API_LEVEL, type UnstableFacade, type UnstableInputFacade, type UnstableMountLease, type UnstableMountedComponent, type UnstableRawCaptureMode, type UnstableRawInputEvent, type UnstableRawInputHandle, type UnstableRawInputResult, type UnstableRawInputSpec, type UnstableServiceHost, type UnstableSurfaceFacade, type UnstableSurfaceHandle, unstable };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/extension/unstable-types.ts
|
|
2
|
+
/** API level of the unstable tier. Bumped only on unstable breaking changes. */
|
|
3
|
+
const UNSTABLE_API_LEVEL = 1;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/extension/unstable.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build the UNSTABLE facade over the shared `piTuiExtensions` service
|
|
8
|
+
* (plan §4). The facade is a thin capability view: every resource it
|
|
9
|
+
* creates is caller-fiber-owned and surface-generation-scoped through the
|
|
10
|
+
* service's shared Extension Runtime — never a second plugin system.
|
|
11
|
+
*
|
|
12
|
+
* The parameter is the structural {@link UnstableServiceHost}: a plain
|
|
13
|
+
* `PiTuiExtensionService` value is accepted (the seam members are
|
|
14
|
+
* optional in the type), and the facade throws loudly when the host does
|
|
15
|
+
* not implement the seam (a host/plugin version mismatch).
|
|
16
|
+
* @param service - the `piTuiExtensions` service (from `ctx.get(...)`).
|
|
17
|
+
* @returns the Unstable facade.
|
|
18
|
+
*/
|
|
19
|
+
function unstable(service) {
|
|
20
|
+
const host = service;
|
|
21
|
+
if (host._unstableCaptureRaw === void 0 || host._unstableSurfaceHandle === void 0) throw new Error("this piTuiExtensions host does not implement the unstable seam (host/plugin version mismatch? upgrade the host bundle)");
|
|
22
|
+
return {
|
|
23
|
+
input: { captureRaw: (spec) => host._unstableCaptureRaw(spec) },
|
|
24
|
+
surface: { get handle() {
|
|
25
|
+
return host._unstableSurfaceHandle();
|
|
26
|
+
} }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { UNSTABLE_API_LEVEL, unstable };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { $ as TuiKeybindingHandle, A as RegistrationHandle, B as ToolPresentationSnapshot, C as MarkdownView, D as PiTuiCapability, E as PiTuiApiInfo, F as StackView, G as TuiAutocompleteRegistryView, H as TuiAutocompleteItem, I as StyledSpan, J as TuiCommandBridgeSnapshot, K as TuiAutocompleteSuggestions, L as SurfaceSnapshot, M as RowsView, N as SessionSnapshot, O as PiTuiSlotName, P as SpacerView, Q as TuiKeybindingContribution, R as SurfaceStateValues, S as InputWidget, T as NormalizedKey, U as TuiAutocompleteProvider, V as TuiAction, W as TuiAutocompleteQuery, X as TuiCommandContribution, Y as TuiCommandBridgeView, Z as TuiCommandHandle, _t as TuiThemeRegistryView, a as ContributionHealth, at as TuiOverlayOptions, b as FrameView, c as DockItem, ct as TuiRendererRegistryView, d as EditorHost, dt as TuiSettingsRegistrySnapshot, et as TuiKeybindingRegistrySnapshot, f as EditorHostAction, ft as TuiSettingsRegistryView, g as ExtensionEditor, gt as TuiThemeRegistrySnapshot, h as EditorSnapshot, ht as TuiThemeHandle, i as AutocompleteProviderContribution, it as TuiOverlayHandle, j as RegistrationSpec, k as PiTuiSlotSemantic, l as EditorContribution, lt as TuiSettingContribution, m as EditorInputEvent, mt as TuiThemeContribution, n as ActivitySnapshot, nt as TuiLocalCommandHandler, o as ContributionRecord, ot as TuiRendererHandle, p as EditorHostActionResult, pt as TuiSizeValue, q as TuiColorPalette, r as AutocompleteHandle, rt as TuiMessageRendererContribution, s as ContributionState, st as TuiRendererRegistrySnapshot, t as API_VERSION, tt as TuiKeybindingRegistryView, u as EditorHandle, ut as TuiSettingHandle, v as ExtensionView, vt as TuiToolRendererContribution, w as MessagePresentationSnapshot, x as HeaderBadge, y as FooterSegment, yt as describeKey, z as TextView } from "./public-types-2omeXG8d.mjs";
|
|
2
|
+
import { Context, Service } from "@deepseek-ai/cordis";
|
|
3
|
+
|
|
4
|
+
//#region src/extension/service.d.ts
|
|
5
|
+
/** The service name plugins inject (`piTuiExtensions` in cordis.patch.yml). */
|
|
6
|
+
declare const PI_TUI_EXTENSIONS_SERVICE = "piTuiExtensions";
|
|
7
|
+
/** The public service surface plugins consume. */
|
|
8
|
+
interface PiTuiExtensionService {
|
|
9
|
+
/** Host identity: version + capability set (feature-detect, never parse versions). */
|
|
10
|
+
readonly api: () => PiTuiApiInfo;
|
|
11
|
+
/**
|
|
12
|
+
* Register one contribution under a slot. The registration is owned by the
|
|
13
|
+
* CALLING fiber: it is disposed automatically when that fiber unloads.
|
|
14
|
+
* @param slot - one of the known slot names.
|
|
15
|
+
* @param spec - registration identity + ordering metadata.
|
|
16
|
+
* @param contribution - the contribution value (typed per slot contract).
|
|
17
|
+
*/
|
|
18
|
+
register<T>(slot: string, spec: RegistrationSpec, contribution: T): RegistrationHandle<T>;
|
|
19
|
+
/** The semantic of one slot ('list' | 'single'), or undefined when unknown. */
|
|
20
|
+
slotSemantics(slot: string): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Subscribe to the live surface state snapshots (first-party builtins and
|
|
23
|
+
* state-driven contributions). Fires once synchronously with the current
|
|
24
|
+
* state, then on every change (batched). Returns a disposer.
|
|
25
|
+
* @param listener - receives the immutable snapshot values.
|
|
26
|
+
*/
|
|
27
|
+
subscribeState(listener: (state: SurfaceStateValues) => void): () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Register a TUI command contribution (M5): execution ownership metadata
|
|
30
|
+
* over an existing command. The bridge does NOT execute — actual
|
|
31
|
+
* execution stays in the commands service. Owned by the calling fiber.
|
|
32
|
+
* @param contribution - the command contribution.
|
|
33
|
+
*/
|
|
34
|
+
registerCommand(contribution: TuiCommandContribution): TuiCommandHandle;
|
|
35
|
+
/**
|
|
36
|
+
* Register a named theme palette (M5): selectable from the host's theme
|
|
37
|
+
* picker; owner unload removes it (a selected plugin theme falls back to
|
|
38
|
+
* the built-in palette). Owned by the calling fiber.
|
|
39
|
+
* @param contribution - the theme contribution.
|
|
40
|
+
*/
|
|
41
|
+
registerTheme(contribution: TuiThemeContribution): TuiThemeHandle;
|
|
42
|
+
/**
|
|
43
|
+
* Register an autocomplete provider (M5): consulted after the host's own
|
|
44
|
+
* provider returns null, in registration order. Owned by the calling
|
|
45
|
+
* fiber.
|
|
46
|
+
* @param contribution - the provider contribution.
|
|
47
|
+
*/
|
|
48
|
+
registerAutocomplete(contribution: AutocompleteProviderContribution): AutocompleteHandle;
|
|
49
|
+
/**
|
|
50
|
+
* Register a settings row (M5): appended to the host's /settings panel.
|
|
51
|
+
* Owned by the calling fiber.
|
|
52
|
+
* @param contribution - the row contribution.
|
|
53
|
+
*/
|
|
54
|
+
registerSetting(contribution: TuiSettingContribution): TuiSettingHandle;
|
|
55
|
+
/**
|
|
56
|
+
* Register a keybinding (M5, metadata only): normalized key → semantic
|
|
57
|
+
* action. Routing is Host-owned (the InputRouter lands in M6); until
|
|
58
|
+
* then the binding is recorded and reported. Reserved host keys are
|
|
59
|
+
* rejected. Owned by the calling fiber.
|
|
60
|
+
* @param contribution - the binding contribution.
|
|
61
|
+
*/
|
|
62
|
+
registerKeybinding(contribution: TuiKeybindingContribution): TuiKeybindingHandle;
|
|
63
|
+
/**
|
|
64
|
+
* Register a transcript MESSAGE renderer (M7, chain slot): receives a
|
|
65
|
+
* semantic snapshot; returns an ExtensionView or undefined (abdicate →
|
|
66
|
+
* next renderer → host fallback). A throwing renderer is isolated.
|
|
67
|
+
* Owned by the calling fiber.
|
|
68
|
+
*/
|
|
69
|
+
registerMessageRenderer(contribution: TuiMessageRendererContribution): TuiRendererHandle;
|
|
70
|
+
/**
|
|
71
|
+
* Register a TOOL renderer (M7, keyed slot): presents the tool card for
|
|
72
|
+
* ONE tool name; undefined abdicates. Priority ties on the same tool
|
|
73
|
+
* name are an explicit error. Owned by the calling fiber.
|
|
74
|
+
*/
|
|
75
|
+
registerToolRenderer(contribution: TuiToolRendererContribution): TuiRendererHandle;
|
|
76
|
+
/**
|
|
77
|
+
* Open a MANAGED OVERLAY (M8, plan §13.3): the plugin supplies an
|
|
78
|
+
* ExtensionView + sizing hints; the host mounts it through its overlay
|
|
79
|
+
* broker (modal stacking, focus, fullscreen migration, teardown). The
|
|
80
|
+
* returned lease is generation-scoped (a stale surface's lease closes
|
|
81
|
+
* with the surface) and its close() is idempotent. The overlay content
|
|
82
|
+
* is the M4 component kit — a plugin can never mount a raw component
|
|
83
|
+
* or steal focus.
|
|
84
|
+
* @param view - the ExtensionView to present.
|
|
85
|
+
* @param options - sizing/positioning hints.
|
|
86
|
+
* @returns the overlay lease.
|
|
87
|
+
*/
|
|
88
|
+
showOverlay(view: ExtensionView, options?: TuiOverlayOptions): TuiOverlayHandle;
|
|
89
|
+
/** M5 registries, exposed for the runner's dispatch/pickers (narrow
|
|
90
|
+
* read-side views — the concrete classes are host-internal, so the
|
|
91
|
+
* public declarations stay free of internal modules). */
|
|
92
|
+
readonly commands: TuiCommandBridgeView;
|
|
93
|
+
readonly themes: TuiThemeRegistryView;
|
|
94
|
+
readonly autocomplete: TuiAutocompleteRegistryView;
|
|
95
|
+
readonly settings: TuiSettingsRegistryView;
|
|
96
|
+
readonly keybindings: TuiKeybindingRegistryView;
|
|
97
|
+
/** M7: the transcript/tool renderer registry (the runner wires it into
|
|
98
|
+
* the surface's message cache; the narrow read-side view keeps the
|
|
99
|
+
* public declarations free of internal modules). */
|
|
100
|
+
readonly renderers: TuiRendererRegistryView;
|
|
101
|
+
/** Runner-only: wire the host's managed-overlay mount seam (M8). The
|
|
102
|
+
* seam is SURFACE-scoped (P1-4): it binds to the CURRENT attachment's
|
|
103
|
+
* surfaceId — a later attach replaces it, and a stale old-generation
|
|
104
|
+
* detach never unbinds a newer surface's seam (the detachSurface lease). */
|
|
105
|
+
setOverlayMount(surfaceId: string, mount: (view: ExtensionView, options?: TuiOverlayOptions) => TuiOverlayHandle): void;
|
|
106
|
+
/**
|
|
107
|
+
* Register an EDITOR contribution (M9, plan §14): single-winner by
|
|
108
|
+
* priority; a tie is an explicit error. The winner occupies the editor
|
|
109
|
+
* seat through the host's atomic handoff; the host default editor is
|
|
110
|
+
* the fallback (never a competing registration). Creation is atomic —
|
|
111
|
+
* a throw keeps the current editor working. Owned by the calling fiber.
|
|
112
|
+
*/
|
|
113
|
+
registerEditor(contribution: EditorContribution): EditorHandle;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/extensions.d.ts
|
|
117
|
+
/** Stable Cordis plugin name for the extension host row. */
|
|
118
|
+
declare const name = "pi-tui-extension-host";
|
|
119
|
+
/** The host mounts only when the TUI startup flags were parsed (same gate
|
|
120
|
+
* as the runner row: `dsh --profile pi-tui --help` provides nothing, so no
|
|
121
|
+
* extension host mounts either). */
|
|
122
|
+
declare const inject: string[];
|
|
123
|
+
/**
|
|
124
|
+
* Provide the extension service. The Service base class registers the
|
|
125
|
+
* instance on `ctx` under `piTuiExtensions` and unregisters it when this
|
|
126
|
+
* provider fiber unloads; invalidations coalesce into render requests
|
|
127
|
+
* (until the SurfaceHost attaches in M2 the sink is a no-op).
|
|
128
|
+
* @param ctx - the provider's plugin context.
|
|
129
|
+
*/
|
|
130
|
+
declare function apply(ctx: Context): void;
|
|
131
|
+
//#endregion
|
|
132
|
+
export { API_VERSION, type ActivitySnapshot, type AutocompleteHandle, type AutocompleteProviderContribution, type ContributionHealth, type ContributionRecord, type ContributionState, type DockItem, type EditorContribution, type EditorHandle, type EditorHost, type EditorHostAction, type EditorHostActionResult, type EditorInputEvent, type EditorSnapshot, type ExtensionEditor, type ExtensionView, type FooterSegment, type FrameView, type HeaderBadge, type InputWidget, type MarkdownView, type MessagePresentationSnapshot, type NormalizedKey, PI_TUI_EXTENSIONS_SERVICE, type PiTuiApiInfo, type PiTuiCapability, type PiTuiExtensionService, type PiTuiSlotName, type PiTuiSlotSemantic, type RegistrationHandle, type RegistrationSpec, type RowsView, type SessionSnapshot, type SpacerView, type StackView, type StyledSpan, type SurfaceSnapshot, type SurfaceStateValues, type TextView, type ToolPresentationSnapshot, type TuiAction, type TuiAutocompleteItem, type TuiAutocompleteProvider, type TuiAutocompleteQuery, type TuiAutocompleteRegistryView, type TuiAutocompleteSuggestions, type TuiColorPalette, type TuiCommandBridgeSnapshot, type TuiCommandBridgeView, type TuiCommandContribution, type TuiCommandHandle, type TuiKeybindingContribution, type TuiKeybindingHandle, type TuiKeybindingRegistrySnapshot, type TuiKeybindingRegistryView, type TuiLocalCommandHandler, type TuiMessageRendererContribution, type TuiOverlayHandle, type TuiOverlayOptions, type TuiRendererHandle, type TuiRendererRegistrySnapshot, type TuiSettingContribution, type TuiSettingHandle, type TuiSettingsRegistrySnapshot, type TuiSettingsRegistryView, type TuiSizeValue, type TuiThemeContribution, type TuiThemeHandle, type TuiThemeRegistrySnapshot, type TuiThemeRegistryView, type TuiToolRendererContribution, apply, describeKey, inject, name };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { Agent, ModelSelectionRef } from "@deepseek-ai/dsh-agent";
|
|
|
3
3
|
import { ContentBlock } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { SessionEvent, SessionId } from "@deepseek-ai/dsh-session";
|
|
5
5
|
import { CommandDescriptor } from "@deepseek-ai/dsh-commands";
|
|
6
|
-
import { EventEmitter } from "events";
|
|
7
6
|
import { Context } from "@deepseek-ai/cordis";
|
|
8
7
|
//#region src/diag.d.ts
|
|
9
8
|
interface Diag {
|
|
@@ -150,6 +149,16 @@ declare const SESSIONLESS_COMMANDS: Set<string>;
|
|
|
150
149
|
* body — there is no command-execution wire for skills.
|
|
151
150
|
*/
|
|
152
151
|
declare const LOCAL_COMMANDS: Set<string>;
|
|
152
|
+
/**
|
|
153
|
+
* The AUTHORITATIVE host-owned command catalog (P1-04): every command name
|
|
154
|
+
* the TUI registers itself (registerTuiCommands in commands.ts) plus the
|
|
155
|
+
* ownership sets (LOCAL_COMMANDS and SESSIONLESS_COMMANDS — /kill and
|
|
156
|
+
* other core commands the TUI does not register but dispatches locally).
|
|
157
|
+
* A plugin command contribution is validated against this catalog at
|
|
158
|
+
* register time: an exact or near-synonym collision is rejected loudly,
|
|
159
|
+
* so a plugin can never shadow a built-in command.
|
|
160
|
+
*/
|
|
161
|
+
declare const HOST_COMMAND_CATALOG: ReadonlySet<string>;
|
|
153
162
|
/**
|
|
154
163
|
* Whether one submission steers under the busy-Enter preference: NOT a
|
|
155
164
|
* force-queued chord, NOT a TUI-owned local command, and the agent is
|
|
@@ -159,10 +168,12 @@ declare const LOCAL_COMMANDS: Set<string>;
|
|
|
159
168
|
* @param running - whether the live agent reports running.
|
|
160
169
|
* @param busyEnter - the persisted preference value (''/undefined = queue).
|
|
161
170
|
* @param forceQueue - the Ctrl+Enter chord: always queue, never steer.
|
|
171
|
+
* @param isDynamicLocal - M5: the CommandBridge's effective-local check for
|
|
172
|
+
* plugin-declared local commands (absent = static set only).
|
|
162
173
|
*/
|
|
163
174
|
declare function shouldSteerOnEnter(parsed: {
|
|
164
175
|
name: string;
|
|
165
|
-
} | undefined, running: boolean, busyEnter: string | undefined, forceQueue: boolean): boolean;
|
|
176
|
+
} | undefined, running: boolean, busyEnter: string | undefined, forceQueue: boolean, isDynamicLocal?: (name: string) => boolean): boolean;
|
|
166
177
|
/**
|
|
167
178
|
* The advertised-claim miss decision (pure, exported for the headless
|
|
168
179
|
* suite): a slash input whose name was advertised by the completion list at
|
|
@@ -348,6 +359,55 @@ declare function resumeCommand(profile: string, sessionId: string): string | und
|
|
|
348
359
|
declare class SessionLockRefusedError extends Error {
|
|
349
360
|
constructor(message: string);
|
|
350
361
|
}
|
|
362
|
+
/** One fold of a compaction lifecycle event over the runner's in-flight
|
|
363
|
+
* compaction state. Pure (the firehose applies the returned surface
|
|
364
|
+
* effects): dsh-compaction is not a peer, so the event is read
|
|
365
|
+
* structurally. */
|
|
366
|
+
interface CompactionFold {
|
|
367
|
+
/** The updated in-flight compaction id (the newest start wins). */
|
|
368
|
+
id: string | undefined;
|
|
369
|
+
/** compaction/start: the compacting flag turns ON (footer/working row). */
|
|
370
|
+
active: boolean;
|
|
371
|
+
/** A MATCHED compaction/end: the compacting flag turns OFF and busy is
|
|
372
|
+
* re-derived from the turn log (a stale end never clears a newer
|
|
373
|
+
* compaction's state). */
|
|
374
|
+
clear: boolean;
|
|
375
|
+
/** The settle notification for compaction/end, when one fires. */
|
|
376
|
+
notify: {
|
|
377
|
+
text: string;
|
|
378
|
+
kind: 'info' | 'error';
|
|
379
|
+
} | undefined;
|
|
380
|
+
}
|
|
381
|
+
/** Fold one compaction lifecycle event over the in-flight state. */
|
|
382
|
+
declare function foldCompactionEvent(state: {
|
|
383
|
+
id: string | undefined;
|
|
384
|
+
}, event: {
|
|
385
|
+
type: string;
|
|
386
|
+
data: {
|
|
387
|
+
compactionId?: unknown;
|
|
388
|
+
error?: unknown;
|
|
389
|
+
};
|
|
390
|
+
}): CompactionFold;
|
|
391
|
+
/** The busy flag after a turn-boundary event: a turn end must NOT clear
|
|
392
|
+
* the busy state while a compaction is still in flight — an interrupted
|
|
393
|
+
* turn can close (turn/end) before its compaction settles, and the
|
|
394
|
+
* single-Esc cancel must stay armed until compaction/end. */
|
|
395
|
+
declare function busyAfterTurnBoundary(eventType: 'turn/start' | 'turn/end', compacting: boolean): boolean;
|
|
396
|
+
/**
|
|
397
|
+
* The in-flight compaction state a resumed session log implies: the newest
|
|
398
|
+
* compaction bracket decides. A `session/end-seed` boundary makes any
|
|
399
|
+
* EARLIER unmatched `compaction/start` STALE — the upstream invariant
|
|
400
|
+
* (inheritedOrphanStartSeqs) treats seed compactions that never settled
|
|
401
|
+
* inside the seed as abandoned, so they must not re-arm the compacting
|
|
402
|
+
* surface on resume.
|
|
403
|
+
*/
|
|
404
|
+
declare function compactingFromLog(events: readonly {
|
|
405
|
+
type: unknown;
|
|
406
|
+
data?: unknown;
|
|
407
|
+
}[]): {
|
|
408
|
+
active: boolean;
|
|
409
|
+
id: string | undefined;
|
|
410
|
+
};
|
|
351
411
|
/** One agent's preset composition: the id to record and the setup that installs it. */
|
|
352
412
|
interface AgentComposition {
|
|
353
413
|
/** Preset id for the session header, absent when the deployment composes no roster. */
|
|
@@ -423,4 +483,4 @@ declare function recomposeBlank(ctx: Context, agent: {
|
|
|
423
483
|
*/
|
|
424
484
|
declare function apply(ctx: Context, config: Config): void;
|
|
425
485
|
//#endregion
|
|
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 };
|
|
486
|
+
export { AgentComposition, CompactionFold, Config, HOST_COMMAND_CATALOG, InitialCatalogResolution, LOCAL_COMMANDS, PendingSubagentCall, QueueFoldResult, QueueInboxMessage, QueueNoticeSource, RecomposableSession, RecomposeOutcome, ResolveInitialCatalogOptions, SESSIONLESS_COMMANDS, SessionLockRefusedError, apply, busyAfterTurnBoundary, compactingFromLog, composeAgent, dangerCommand, foldCompactionEvent, foldQueueRows, forkSeed, inject, isPlainExitPrompt, isSubagentSettlementNotice, matchPendingSubagentCall, name, recomposeBlank, recordedPreset, resolveInitialCatalog, resumeCommand, runningProfile, shouldConsumeAdvertisedMiss, shouldSteerOnEnter, subagentJobTranscriptId, subagentJobViewHint, subagentNoticeIsFailure };
|