@oh-my-pi/pi-tui 18.8.3 → 18.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/types/apps/git/help.d.ts +3 -1
- package/dist/types/chat/user-message.d.ts +1 -1
- package/dist/types/components/markdown.d.ts +11 -0
- package/dist/types/native/overlay.d.ts +5 -0
- package/dist/types/overlays/agent-hub-projection.d.ts +2 -2
- package/dist/types/overlays/agent-transcript-viewer.d.ts +3 -1
- package/dist/types/overlays/model-browser.d.ts +13 -0
- package/dist/types/overlays/model-hub.d.ts +6 -0
- package/dist/types/overlays/usage-dashboard.d.ts +5 -3
- package/dist/types/prompt/custom-editor.d.ts +2 -2
- package/dist/types/prompt/image-source.d.ts +2 -1
- package/package.json +9 -9
- package/src/apps/autoresearch-dashboard.ts +7 -3
- package/src/apps/git/help.ts +29 -20
- package/src/chat/assistant-message.ts +20 -5
- package/src/chat/user-message.ts +1 -1
- package/src/components/editor.ts +6 -3
- package/src/components/markdown.ts +114 -0
- package/src/native/overlay.ts +13 -0
- package/src/overlays/agent-hub-projection.ts +7 -1
- package/src/overlays/agent-hub.ts +29 -24
- package/src/overlays/agent-transcript-viewer.ts +25 -10
- package/src/overlays/annotation-overlay.ts +25 -3
- package/src/overlays/btw-history-panel.ts +12 -1
- package/src/overlays/model-browser.ts +26 -1
- package/src/overlays/model-hub.ts +133 -17
- package/src/overlays/move-overlay.ts +28 -14
- package/src/overlays/plan-review-overlay.ts +11 -2
- package/src/overlays/usage-dashboard.ts +18 -7
- package/src/prompt/custom-editor.ts +3 -4
- package/src/prompt/image-source.ts +2 -1
|
@@ -15,7 +15,8 @@ import { formatKeyHint } from "../app-keybindings";
|
|
|
15
15
|
import { editorKey, editorKeys } from "../chrome/keybinding-hints";
|
|
16
16
|
import type { NativeNode, NativeUiEvent } from "../native/node";
|
|
17
17
|
import { node, span } from "../native/describe";
|
|
18
|
-
import { actionHint, overlayCard, statusHintsRow } from "../native/overlay";
|
|
18
|
+
import { actionBar, actionButton, actionHint, overlayCard, statusHintsRow } from "../native/overlay";
|
|
19
|
+
import { getKeybindings } from "../keybindings";
|
|
19
20
|
|
|
20
21
|
export interface MoveOverlayResult {
|
|
21
22
|
directory: string;
|
|
@@ -122,12 +123,7 @@ export class MoveOverlay implements Component, Focusable {
|
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
125
|
if (matchesKey(data, Key.tab)) {
|
|
125
|
-
|
|
126
|
-
if (selected) {
|
|
127
|
-
this.#field.setValue(selected.value);
|
|
128
|
-
this.#selectedIndex = 0;
|
|
129
|
-
this.#updateResults();
|
|
130
|
-
}
|
|
126
|
+
this.#accept();
|
|
131
127
|
return;
|
|
132
128
|
}
|
|
133
129
|
const before = this.#field.getValue();
|
|
@@ -192,19 +188,28 @@ export class MoveOverlay implements Component, Focusable {
|
|
|
192
188
|
);
|
|
193
189
|
const hints = statusHintsRow(
|
|
194
190
|
[span("Type to filter", "dim")],
|
|
195
|
-
[
|
|
196
|
-
actionHint(["tui.select.up", "tui.select.down"], "navigate"),
|
|
197
|
-
{ keys: ["tab"], label: "accept" },
|
|
198
|
-
{ keys: ["enter"], label: "confirm" },
|
|
199
|
-
actionHint("tui.select.cancel", "cancel"),
|
|
200
|
-
],
|
|
191
|
+
[actionHint(["tui.select.up", "tui.select.down"], "navigate")],
|
|
201
192
|
);
|
|
202
|
-
|
|
193
|
+
// Accept, Confirm and Cancel run what Tab, Enter and Esc run.
|
|
194
|
+
const actions = actionBar([
|
|
195
|
+
actionButton("Accept", "accept", { keys: "tab" }),
|
|
196
|
+
null,
|
|
197
|
+
// The bound cancel key; Esc also cancels when it is unbound.
|
|
198
|
+
actionButton("Cancel", "cancel", { keys: getKeybindings().getKeys("tui.select.cancel")[0] ?? "escape" }),
|
|
199
|
+
actionButton("Confirm", "confirm", { keys: "enter", tone: "accent" }),
|
|
200
|
+
]);
|
|
201
|
+
const described = overlayCard("omp.dialog.move", "Move to directory", [this.#field, list, hints, actions]);
|
|
203
202
|
this.#native = { revision: this.#revision, node: described };
|
|
204
203
|
return described;
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
handleNativeEvent(event: NativeUiEvent): void {
|
|
207
|
+
if (event.type === "action") {
|
|
208
|
+
if (event.act === "accept") this.#accept();
|
|
209
|
+
else if (event.act === "confirm") this.#field.submit();
|
|
210
|
+
else if (event.act === "cancel") this.#done(undefined);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
208
213
|
if (event.type !== "select" && event.type !== "activate") return;
|
|
209
214
|
const index = this.#results.findIndex(result => result.value === event.item);
|
|
210
215
|
if (index === -1) return;
|
|
@@ -216,6 +221,15 @@ export class MoveOverlay implements Component, Focusable {
|
|
|
216
221
|
if (event.type === "activate") this.#field.submit();
|
|
217
222
|
}
|
|
218
223
|
|
|
224
|
+
/** Tab: fill the field with the highlighted suggestion. */
|
|
225
|
+
#accept(): void {
|
|
226
|
+
const selected = this.#results[this.#selectedIndex];
|
|
227
|
+
if (!selected) return;
|
|
228
|
+
this.#field.setValue(selected.value);
|
|
229
|
+
this.#selectedIndex = 0;
|
|
230
|
+
this.#updateResults();
|
|
231
|
+
}
|
|
232
|
+
|
|
219
233
|
invalidate(): void {
|
|
220
234
|
this.#field.input.prompt = theme.fg("dim", "Path: ");
|
|
221
235
|
this.#field.invalidate();
|
|
@@ -1607,7 +1607,7 @@ export class PlanReviewOverlay implements Component {
|
|
|
1607
1607
|
return this.#nativeRoot;
|
|
1608
1608
|
}
|
|
1609
1609
|
|
|
1610
|
-
/** Head tools: Copy `c
|
|
1610
|
+
/** Head tools: Copy `c`, the external editor and Cancel, mirroring their keys. */
|
|
1611
1611
|
#describeTools(): NativeNode | undefined {
|
|
1612
1612
|
if (this.#committed) return undefined;
|
|
1613
1613
|
const buttons: NativeNode[] = [];
|
|
@@ -1618,6 +1618,12 @@ export class PlanReviewOverlay implements Component {
|
|
|
1618
1618
|
if (this.callbacks.onExternalEditor) {
|
|
1619
1619
|
buttons.push(actionButton("Edit in $EDITOR", "externalEditor", editorKeyId ? { keys: editorKeyId } : {}));
|
|
1620
1620
|
}
|
|
1621
|
+
// Cancel the review the way the cancel key does; while annotating that key
|
|
1622
|
+
// only leaves the draft/chooser, so the button is hidden there.
|
|
1623
|
+
if (!this.#annotating && !this.#annotationChooser) {
|
|
1624
|
+
const cancelKeyId = getKeybindings().getKeys("tui.select.cancel")[0];
|
|
1625
|
+
buttons.push(actionButton("Cancel", "cancel", cancelKeyId ? { keys: cancelKeyId } : {}));
|
|
1626
|
+
}
|
|
1621
1627
|
if (buttons.length === 0) return undefined;
|
|
1622
1628
|
return node("row", { role: "omp.plan.tools", gap: "sm", align: "center", justify: "end" }, buttons, "tools");
|
|
1623
1629
|
}
|
|
@@ -1625,12 +1631,15 @@ export class PlanReviewOverlay implements Component {
|
|
|
1625
1631
|
handleNativeEvent(event: NativeUiEvent): void {
|
|
1626
1632
|
if (this.#committed) return;
|
|
1627
1633
|
if (event.type === "action") {
|
|
1628
|
-
// Head tools run exactly what `c
|
|
1634
|
+
// Head tools run exactly what `c`, the external-editor key and Esc run.
|
|
1629
1635
|
if (this.#annotating || this.#annotationChooser) return;
|
|
1630
1636
|
if (event.act === "copyPlan" && this.callbacks.onCopyPlan) {
|
|
1631
1637
|
void this.callbacks.onCopyPlan(joinPlanSections(this.#sections));
|
|
1632
1638
|
} else if (event.act === "externalEditor") {
|
|
1633
1639
|
this.callbacks.onExternalEditor?.();
|
|
1640
|
+
} else if (event.act === "cancel") {
|
|
1641
|
+
this.#committed = true;
|
|
1642
|
+
this.callbacks.onCancel();
|
|
1634
1643
|
}
|
|
1635
1644
|
return;
|
|
1636
1645
|
}
|
|
@@ -84,7 +84,7 @@ export interface ProviderCard {
|
|
|
84
84
|
/** Number of represented accounts, including unavailable usage lookups. */
|
|
85
85
|
accounts: number;
|
|
86
86
|
unavailableAccounts: string[];
|
|
87
|
-
/** Window rows
|
|
87
|
+
/** Window rows in provider-declared order (e.g. 5h → weekly → monthly); the fullest CARD_MAX_WINDOWS lead. */
|
|
88
88
|
windows: CardWindowRow[];
|
|
89
89
|
/** True when every account reports no limits (e.g. enterprise plans). */
|
|
90
90
|
unlimited: boolean;
|
|
@@ -146,8 +146,10 @@ function compactWindowTag(window: NonNullable<UsageLimit["window"]>): string {
|
|
|
146
146
|
* Collapse usage reports into one compact card per provider: limits grouped by
|
|
147
147
|
* quota bucket (label + window), each bucket showing the mean used fraction
|
|
148
148
|
* across accounts (matching the classic report's aggregate "% free") with the
|
|
149
|
-
* most-used account's reset countdown.
|
|
150
|
-
*
|
|
149
|
+
* most-used account's reset countdown. Rows keep the provider's declared window
|
|
150
|
+
* order so 5h → week → month reads the same every time; cards sort by their
|
|
151
|
+
* fullest window so what's burning is on top-left; fully idle providers
|
|
152
|
+
* collapse into a tick.
|
|
151
153
|
*/
|
|
152
154
|
export function buildProviderCards(
|
|
153
155
|
reports: UsageReport[],
|
|
@@ -181,7 +183,7 @@ export function buildProviderCards(
|
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
|
|
184
|
-
const
|
|
186
|
+
const declared: CardWindowRow[] = [...buckets.values()].map(bucket => {
|
|
185
187
|
const fractions = bucket.limits
|
|
186
188
|
.map(limit => resolveUsedFraction(limit))
|
|
187
189
|
.filter((value): value is number => value !== undefined);
|
|
@@ -200,7 +202,13 @@ export function buildProviderCards(
|
|
|
200
202
|
usedText: fraction === undefined ? formatAbsoluteOnlyAmount(bucket.limits) : undefined,
|
|
201
203
|
};
|
|
202
204
|
});
|
|
203
|
-
|
|
205
|
+
// Cards render at most CARD_MAX_WINDOWS rows; when a provider declares
|
|
206
|
+
// more, keep the fullest ones visible (still in declared order) so an
|
|
207
|
+
// exhausted bucket never hides behind "+N more".
|
|
208
|
+
const visible = new Set(
|
|
209
|
+
[...declared].sort((a, b) => (b.fraction ?? -1) - (a.fraction ?? -1)).slice(0, CARD_MAX_WINDOWS),
|
|
210
|
+
);
|
|
211
|
+
const windows = [...declared.filter(row => visible.has(row)), ...declared.filter(row => !visible.has(row))];
|
|
204
212
|
// The window tag earns its columns only when sibling rows would otherwise
|
|
205
213
|
// be indistinguishable (e.g. Antigravity's daily vs weekly "Usage (Google)").
|
|
206
214
|
for (const window of windows) {
|
|
@@ -264,9 +272,12 @@ export function buildProviderCards(
|
|
|
264
272
|
});
|
|
265
273
|
}
|
|
266
274
|
|
|
275
|
+
const worstFraction = new Map(
|
|
276
|
+
cards.map(card => [card, card.windows.reduce((max, window) => Math.max(max, window.fraction ?? -1), -1)]),
|
|
277
|
+
);
|
|
267
278
|
cards.sort((a, b) => {
|
|
268
|
-
const aWorst = a
|
|
269
|
-
const bWorst = b
|
|
279
|
+
const aWorst = worstFraction.get(a)!;
|
|
280
|
+
const bWorst = worstFraction.get(b)!;
|
|
270
281
|
if (aWorst !== bWorst) return bWorst - aWorst;
|
|
271
282
|
return a.name.localeCompare(b.name);
|
|
272
283
|
});
|
|
@@ -20,7 +20,6 @@ import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node"
|
|
|
20
20
|
import type { ComposerFacts, ComposerFactsSource } from "../status-line/types";
|
|
21
21
|
import { allowsModelMentions, allowsSkillTokens, SKILL_TOKEN_RE } from "./skill-tokens";
|
|
22
22
|
import { expandModelMentionTags, MODEL_MENTION_RE, modelMentionToken } from "./model-mention-syntax";
|
|
23
|
-
import { imageAttachmentSource } from "./image-source";
|
|
24
23
|
import { isVideoPath } from "./video";
|
|
25
24
|
import {
|
|
26
25
|
attachmentSgr,
|
|
@@ -480,8 +479,8 @@ export class CustomEditor extends Editor {
|
|
|
480
479
|
chips: ComposerChipDescriptor[];
|
|
481
480
|
}
|
|
482
481
|
| undefined;
|
|
483
|
-
/** Host-wired producer of per-image
|
|
484
|
-
* chip tokens for restored drafts (esc-esc, `/tree`, branch). */
|
|
482
|
+
/** Host-wired producer of per-image chip targets (a file on disk, or a session blob copy);
|
|
483
|
+
* drives clickable chip tokens for restored drafts (esc-esc, `/tree`, branch). */
|
|
485
484
|
draftImageLinkMaterializer?: (images: readonly ImageContent[]) => Promise<(string | undefined)[] | undefined>;
|
|
486
485
|
|
|
487
486
|
/**
|
|
@@ -791,7 +790,7 @@ export class CustomEditor extends Editor {
|
|
|
791
790
|
if (!materialize || images.length === 0) return;
|
|
792
791
|
const links = await materialize(images);
|
|
793
792
|
if (!links || this.pendingImages !== images) return;
|
|
794
|
-
this.pendingImageLinks =
|
|
793
|
+
this.pendingImageLinks = links;
|
|
795
794
|
this.imageLinks = this.pendingImageLinks;
|
|
796
795
|
this.#requestShimmerRepaint?.();
|
|
797
796
|
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* to the session's `local://` root, and generated video contact-sheet previews.
|
|
5
5
|
* Symbol metadata stays out of serialized/model-bound image data while traveling
|
|
6
6
|
* with the draft object, until AgentSession creates the hidden companion message
|
|
7
|
-
* that tells the model the path
|
|
7
|
+
* that tells the model the path. The model keeps `local://` references across
|
|
8
|
+
* `/move`; chips for internal URLs instead use a stable blob copy.
|
|
8
9
|
*/
|
|
9
10
|
import type { ImageContent } from "@oh-my-pi/pi-ai";
|
|
10
11
|
import { isRecord } from "@oh-my-pi/pi-utils";
|