pi-ui-extend 0.1.13 → 0.1.17
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/README.md +1 -1
- package/dist/app/app.d.ts +7 -0
- package/dist/app/app.js +102 -17
- package/dist/app/commands/command-controller.js +2 -0
- package/dist/app/commands/command-host.d.ts +5 -0
- package/dist/app/commands/command-model-actions.d.ts +2 -0
- package/dist/app/commands/command-model-actions.js +40 -4
- package/dist/app/commands/command-navigation-actions.d.ts +9 -0
- package/dist/app/commands/command-navigation-actions.js +62 -0
- package/dist/app/commands/command-registry.d.ts +2 -0
- package/dist/app/commands/command-registry.js +16 -0
- package/dist/app/constants.d.ts +0 -1
- package/dist/app/constants.js +0 -1
- package/dist/app/extensions/extension-ui-controller.d.ts +16 -5
- package/dist/app/extensions/extension-ui-controller.js +99 -61
- package/dist/app/icons.d.ts +1 -0
- package/dist/app/icons.js +2 -0
- package/dist/app/input/input-action-controller.d.ts +2 -0
- package/dist/app/input/input-action-controller.js +8 -1
- package/dist/app/logger.d.ts +25 -0
- package/dist/app/logger.js +90 -0
- package/dist/app/model/model-usage-status.js +30 -15
- package/dist/app/popup/menu-items-controller.d.ts +4 -0
- package/dist/app/popup/menu-items-controller.js +68 -6
- package/dist/app/popup/popup-action-controller.d.ts +2 -1
- package/dist/app/popup/popup-action-controller.js +7 -4
- package/dist/app/popup/popup-menu-controller.d.ts +36 -23
- package/dist/app/popup/popup-menu-controller.js +97 -326
- package/dist/app/rendering/conversation-entry-renderer.js +3 -3
- package/dist/app/rendering/conversation-viewport.d.ts +10 -2
- package/dist/app/rendering/conversation-viewport.js +157 -16
- package/dist/app/rendering/editor-panels.js +22 -9
- package/dist/app/rendering/popup-menu-renderer.d.ts +62 -0
- package/dist/app/rendering/popup-menu-renderer.js +405 -0
- package/dist/app/rendering/render-controller.js +30 -28
- package/dist/app/rendering/render-text.js +5 -2
- package/dist/app/rendering/status-line-renderer.d.ts +8 -1
- package/dist/app/rendering/status-line-renderer.js +217 -117
- package/dist/app/rendering/toast-controller.d.ts +12 -3
- package/dist/app/rendering/toast-controller.js +70 -12
- package/dist/app/runtime.d.ts +2 -1
- package/dist/app/runtime.js +20 -10
- package/dist/app/screen/mouse-controller.d.ts +2 -2
- package/dist/app/screen/mouse-controller.js +27 -48
- package/dist/app/screen/screen-styler.d.ts +1 -1
- package/dist/app/screen/screen-styler.js +9 -7
- package/dist/app/screen/scroll-controller.d.ts +12 -9
- package/dist/app/screen/scroll-controller.js +56 -45
- package/dist/app/screen/status-controller.js +2 -1
- package/dist/app/session/lazy-session-manager.d.ts +11 -0
- package/dist/app/session/lazy-session-manager.js +539 -0
- package/dist/app/session/pix-system-message.d.ts +16 -0
- package/dist/app/session/pix-system-message.js +64 -0
- package/dist/app/session/request-history.d.ts +4 -0
- package/dist/app/session/request-history.js +11 -0
- package/dist/app/session/session-event-controller.d.ts +11 -0
- package/dist/app/session/session-event-controller.js +58 -2
- package/dist/app/session/session-history.d.ts +18 -0
- package/dist/app/session/session-history.js +72 -3
- package/dist/app/session/session-lifecycle-controller.d.ts +6 -2
- package/dist/app/session/session-lifecycle-controller.js +7 -2
- package/dist/app/session/session-search.js +10 -0
- package/dist/app/session/tabs-controller.d.ts +17 -5
- package/dist/app/session/tabs-controller.js +308 -29
- package/dist/app/todo/todo-model.d.ts +4 -2
- package/dist/app/todo/todo-model.js +23 -13
- package/dist/app/types.d.ts +17 -6
- package/dist/app/workspace/workspace-actions-controller.d.ts +2 -0
- package/dist/app/workspace/workspace-actions-controller.js +12 -0
- package/dist/config.d.ts +6 -1
- package/dist/config.js +82 -25
- package/dist/default-pix-config.js +4 -0
- package/dist/fuzzy.d.ts +2 -0
- package/dist/fuzzy.js +27 -7
- package/dist/input-editor.d.ts +9 -0
- package/dist/input-editor.js +52 -0
- package/dist/schemas/pi-tools-suite-schema.d.ts +1 -0
- package/dist/schemas/pi-tools-suite-schema.js +1 -0
- package/dist/schemas/pix-schema.d.ts +3 -1
- package/dist/schemas/pix-schema.js +6 -4
- package/dist/terminal-width.d.ts +2 -0
- package/dist/terminal-width.js +64 -3
- package/dist/theme.js +6 -6
- package/dist/ui.d.ts +8 -0
- package/external/pi-tools-suite/README.md +3 -2
- package/external/pi-tools-suite/src/antigravity-auth/auth-store.ts +52 -8
- package/external/pi-tools-suite/src/antigravity-auth/commands.ts +3 -41
- package/external/pi-tools-suite/src/antigravity-auth/constants.ts +0 -2
- package/external/pi-tools-suite/src/antigravity-auth/index.ts +11 -18
- package/external/pi-tools-suite/src/antigravity-auth/oauth.ts +129 -61
- package/external/pi-tools-suite/src/antigravity-auth/status.ts +82 -3
- package/external/pi-tools-suite/src/antigravity-auth/stream.ts +20 -7
- package/external/pi-tools-suite/src/antigravity-auth/types.ts +21 -0
- package/external/pi-tools-suite/src/config.ts +8 -0
- package/external/pi-tools-suite/src/dcp/index.ts +16 -1
- package/external/pi-tools-suite/src/dcp/state.ts +35 -0
- package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +3 -0
- package/external/pi-tools-suite/src/todo/index.ts +123 -14
- package/external/pi-tools-suite/src/todo/state/persistence.ts +0 -1
- package/external/pi-tools-suite/src/todo/state/state-reducer.ts +26 -43
- package/external/pi-tools-suite/src/todo/todo.ts +12 -23
- package/external/pi-tools-suite/src/todo/tool/response-envelope.ts +34 -16
- package/external/pi-tools-suite/src/todo/tool/types.ts +7 -28
- package/external/pi-tools-suite/src/todo/view/format.ts +2 -3
- package/external/pi-tools-suite/src/tool-descriptions.ts +6 -4
- package/external/pi-tools-suite/src/usage/index.ts +5 -2
- package/external/pi-tools-suite/src/usage/lib/google.ts +53 -40
- package/external/pi-tools-suite/src/usage/lib/types.ts +12 -2
- package/package.json +1 -1
- package/schemas/pi-tools-suite.json +4 -0
- package/schemas/pix.json +11 -2
|
@@ -3,7 +3,6 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { join } from "node:path";
|
|
6
|
-
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
7
6
|
import { formatCompactProgressBar } from "../../context-progress-bar.js";
|
|
8
7
|
const OPENAI_USAGE_URL = "https://chatgpt.com/backend-api/wham/usage";
|
|
9
8
|
const ZAI_QUOTA_URL = "https://api.z.ai/api/monitor/usage/quota/limit";
|
|
@@ -12,7 +11,13 @@ const GOOGLE_QUOTA_API_URL = "https://cloudcode-pa.googleapis.com/v1internal:fet
|
|
|
12
11
|
const REQUEST_TIMEOUT_MS = 10_000;
|
|
13
12
|
const DAY_SECONDS = 86_400;
|
|
14
13
|
const HOUR_SECONDS = 3_600;
|
|
14
|
+
const PI_AUTH_PATH = join(homedir(), ".pi", "agent", "auth.json");
|
|
15
15
|
const DEFAULT_ANTIGRAVITY_PROJECT_ID = "rising-fact-p41fc";
|
|
16
|
+
function getPiAuthPath() {
|
|
17
|
+
return process.env.NODE_ENV === "test" && process.env.PI_TOOLS_SUITE_TEST_AUTH_PATH
|
|
18
|
+
? process.env.PI_TOOLS_SUITE_TEST_AUTH_PATH
|
|
19
|
+
: PI_AUTH_PATH;
|
|
20
|
+
}
|
|
16
21
|
const OPENAI_QUOTA_PROVIDERS = new Set(["openai", "openai-codex"]);
|
|
17
22
|
const ZHIPU_QUOTA_PROVIDERS = new Set(["zai", "zhipuai-coding-plan"]);
|
|
18
23
|
const ANTIGRAVITY_QUOTA_PROVIDERS = new Set(["antigravity", "google-antigravity"]);
|
|
@@ -245,7 +250,7 @@ async function readOpenCodeAuth() {
|
|
|
245
250
|
}
|
|
246
251
|
async function readPiAuth() {
|
|
247
252
|
try {
|
|
248
|
-
const content = await readFile(
|
|
253
|
+
const content = await readFile(getPiAuthPath(), "utf8");
|
|
249
254
|
return JSON.parse(content);
|
|
250
255
|
}
|
|
251
256
|
catch {
|
|
@@ -472,7 +477,7 @@ function readAllAntigravityQuotaAccounts() {
|
|
|
472
477
|
}
|
|
473
478
|
function readPiAuthSync() {
|
|
474
479
|
try {
|
|
475
|
-
return JSON.parse(readFileSync(
|
|
480
|
+
return JSON.parse(readFileSync(getPiAuthPath(), "utf8"));
|
|
476
481
|
}
|
|
477
482
|
catch {
|
|
478
483
|
return {};
|
|
@@ -821,19 +826,29 @@ function maskCredential(value) {
|
|
|
821
826
|
return visible ? "****" : "unknown";
|
|
822
827
|
return `${visible.slice(0, 4)}****${visible.slice(-4)}`;
|
|
823
828
|
}
|
|
824
|
-
function formatUsageWindow(
|
|
825
|
-
|
|
829
|
+
function formatUsageWindow(prefix, window, now) {
|
|
830
|
+
const resetLabel = prefix === "H" ? formatResetTime(window.resetAt, now) : formatGlobalResetLabel(window.resetAt, now);
|
|
831
|
+
return `${window.remainingPercent}% ${formatCompactProgressBar(window.remainingPercent)} ${resetLabel}`;
|
|
826
832
|
}
|
|
827
|
-
function
|
|
833
|
+
function formatGlobalResetLabel(resetAt, now) {
|
|
828
834
|
if (resetAt <= now)
|
|
829
835
|
return "reset";
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
836
|
+
return resetAt - now <= DAY_SECONDS * 1000 ? formatResetTime(resetAt, now) : formatResetDate(resetAt, now);
|
|
837
|
+
}
|
|
838
|
+
function formatResetTime(resetAt, now) {
|
|
839
|
+
if (resetAt <= now)
|
|
840
|
+
return "reset";
|
|
841
|
+
return new Date(resetAt).toLocaleTimeString("ru-RU", {
|
|
842
|
+
hour: "2-digit",
|
|
843
|
+
minute: "2-digit",
|
|
844
|
+
hourCycle: "h23",
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
function formatResetDate(resetAt, now) {
|
|
848
|
+
if (resetAt <= now)
|
|
849
|
+
return "reset";
|
|
850
|
+
return new Date(resetAt).toLocaleDateString("ru-RU", {
|
|
851
|
+
day: "2-digit",
|
|
852
|
+
month: "2-digit",
|
|
853
|
+
});
|
|
839
854
|
}
|
|
@@ -10,6 +10,8 @@ export type AppMenuItemsControllerHost = {
|
|
|
10
10
|
export declare class AppMenuItemsController {
|
|
11
11
|
private readonly host;
|
|
12
12
|
private resumeMenuLoaderCache;
|
|
13
|
+
private userMessageJumpItems;
|
|
14
|
+
private userMessageJumpLoading;
|
|
13
15
|
constructor(host: AppMenuItemsControllerHost);
|
|
14
16
|
parseSlashInput(text: string): import("../types.js").ParsedSlashInput | undefined;
|
|
15
17
|
getResourceSlashCommands(): SlashCommand[];
|
|
@@ -21,6 +23,8 @@ export declare class AppMenuItemsController {
|
|
|
21
23
|
getThinkingMenuItems(query: string): PopupMenuItem<ThinkingMenuValue>[];
|
|
22
24
|
getUserMessageMenuItems(): PopupMenuItem<UserMessageMenuValue>[];
|
|
23
25
|
getUserMessageJumpMenuItems(query: string): PopupMenuItem<UserMessageJumpMenuValue>[];
|
|
26
|
+
isUserMessageJumpLoading(): boolean;
|
|
27
|
+
refreshUserMessageJumpMenuItems(): Promise<void>;
|
|
24
28
|
getQueueMessageMenuItems(): PopupMenuItem<QueueMessageMenuValue>[];
|
|
25
29
|
getResumeMenuItems(query: string, limit?: number): PopupMenuItem<ResumeMenuValue>[];
|
|
26
30
|
private getResumeMenuItemsLoader;
|
|
@@ -3,11 +3,16 @@ import { fuzzySearch } from "../../fuzzy.js";
|
|
|
3
3
|
import { PI_FAVORITE_MODEL_REFS, THINKING_LEVELS } from "../constants.js";
|
|
4
4
|
import { APP_ICONS } from "../icons.js";
|
|
5
5
|
import { parseScopedModelRef } from "../model/model-ref.js";
|
|
6
|
-
import { buildUserMessageJumpItems, createSessionInfoMenuItemsLoader } from "./popup-menu-controller.js";
|
|
6
|
+
import { buildUserMessageJumpItems, createSessionInfoMenuItemsLoader, filterUserMessageJumpItems } from "./popup-menu-controller.js";
|
|
7
7
|
import { getResourceSlashCommands, getSlashCommandMatches, parseSlashInput } from "../commands/slash-commands.js";
|
|
8
|
+
import { isRecord } from "../guards.js";
|
|
9
|
+
import { renderUserMessageContent } from "../rendering/message-content.js";
|
|
10
|
+
import { sessionHistoryFullBranchEntries } from "../session/pix-system-message.js";
|
|
8
11
|
export class AppMenuItemsController {
|
|
9
12
|
host;
|
|
10
13
|
resumeMenuLoaderCache;
|
|
14
|
+
userMessageJumpItems;
|
|
15
|
+
userMessageJumpLoading = false;
|
|
11
16
|
constructor(host) {
|
|
12
17
|
this.host = host;
|
|
13
18
|
}
|
|
@@ -25,6 +30,9 @@ export class AppMenuItemsController {
|
|
|
25
30
|
value: match.value,
|
|
26
31
|
label: `/${match.value.name}`,
|
|
27
32
|
description: match.value.description,
|
|
33
|
+
labelHighlightRanges: match.matchedText === match.label
|
|
34
|
+
? match.matchedRanges.map((range) => ({ start: range.start + 1, end: range.end + 1 }))
|
|
35
|
+
: [],
|
|
28
36
|
}));
|
|
29
37
|
}
|
|
30
38
|
modelRef(model) {
|
|
@@ -60,13 +68,13 @@ export class AppMenuItemsController {
|
|
|
60
68
|
value: match.value,
|
|
61
69
|
label: `${match.value.ref}${match.value.current ? ` ${APP_ICONS.check}` : ""}`,
|
|
62
70
|
description: match.value.model.name,
|
|
71
|
+
labelHighlightRanges: labelHighlightRangesFromMatch(match.matchedText, match.matchedRanges, match.label),
|
|
63
72
|
}));
|
|
64
73
|
}
|
|
65
74
|
getThinkingMenuItems(query) {
|
|
66
75
|
const session = this.host.runtime()?.session;
|
|
67
76
|
const currentLevel = session?.thinkingLevel ?? "off";
|
|
68
|
-
const
|
|
69
|
-
const levels = availableLevels.includes("off") ? availableLevels : ["off", ...availableLevels];
|
|
77
|
+
const levels = session ? normalizeAvailableThinkingLevels(session.getAvailableThinkingLevels()) : [...THINKING_LEVELS];
|
|
70
78
|
const items = levels.map((level) => ({
|
|
71
79
|
value: { level, current: level === currentLevel },
|
|
72
80
|
label: level,
|
|
@@ -79,18 +87,50 @@ export class AppMenuItemsController {
|
|
|
79
87
|
return fuzzySearch(items, query).map((match) => ({
|
|
80
88
|
value: match.value,
|
|
81
89
|
label: `${match.value.level}${match.value.current ? ` ${APP_ICONS.check}` : ""}`,
|
|
82
|
-
description: this.thinkingLevelDescription(match.value.level),
|
|
90
|
+
description: this.thinkingLevelDescription(match.value.level, levels),
|
|
83
91
|
}));
|
|
84
92
|
}
|
|
85
93
|
getUserMessageMenuItems() {
|
|
86
94
|
return [
|
|
87
95
|
{ value: "copy", label: "Copy message", description: "Copy the full user message" },
|
|
88
96
|
{ value: "fork", label: "Fork", description: "Create a new session before this message" },
|
|
97
|
+
{ value: "fork-new-tab", label: "Fork in new tab", description: "Create a fork in a new tab" },
|
|
89
98
|
{ value: "undo", label: "Undo changes", description: "Revert recorded commands and cut session here" },
|
|
90
99
|
];
|
|
91
100
|
}
|
|
92
101
|
getUserMessageJumpMenuItems(query) {
|
|
93
|
-
return buildUserMessageJumpItems(this.host.getEntries(), query);
|
|
102
|
+
return filterUserMessageJumpItems(this.userMessageJumpItems ?? buildUserMessageJumpItems(this.host.getEntries()), query);
|
|
103
|
+
}
|
|
104
|
+
isUserMessageJumpLoading() {
|
|
105
|
+
return this.userMessageJumpLoading;
|
|
106
|
+
}
|
|
107
|
+
async refreshUserMessageJumpMenuItems() {
|
|
108
|
+
const runtime = this.host.runtime();
|
|
109
|
+
if (!runtime) {
|
|
110
|
+
this.userMessageJumpItems = undefined;
|
|
111
|
+
this.userMessageJumpLoading = false;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.userMessageJumpLoading = true;
|
|
115
|
+
try {
|
|
116
|
+
const entries = await sessionHistoryFullBranchEntries(runtime.session);
|
|
117
|
+
const loadedBySessionEntryId = new Map(this.host.getEntries()
|
|
118
|
+
.filter((entry) => entry.kind === "user" && typeof entry.sessionEntryId === "string")
|
|
119
|
+
.map((entry) => [entry.sessionEntryId, entry]));
|
|
120
|
+
const sources = entries.flatMap((entry) => {
|
|
121
|
+
if (entry.type !== "message" || !isRecord(entry.message) || entry.message.role !== "user")
|
|
122
|
+
return [];
|
|
123
|
+
const text = renderUserMessageContent(entry.message.content);
|
|
124
|
+
if (!text)
|
|
125
|
+
return [];
|
|
126
|
+
const loaded = loadedBySessionEntryId.get(entry.id);
|
|
127
|
+
return [{ text, ...(loaded ? { entryId: loaded.id } : {}), sessionEntryId: entry.id }];
|
|
128
|
+
});
|
|
129
|
+
this.userMessageJumpItems = buildUserMessageJumpItems(sources);
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
this.userMessageJumpLoading = false;
|
|
133
|
+
}
|
|
94
134
|
}
|
|
95
135
|
getQueueMessageMenuItems() {
|
|
96
136
|
return [
|
|
@@ -163,7 +203,7 @@ export class AppMenuItemsController {
|
|
|
163
203
|
return (refreshed ?? scoped.model);
|
|
164
204
|
});
|
|
165
205
|
}
|
|
166
|
-
thinkingLevelDescription(level) {
|
|
206
|
+
thinkingLevelDescription(level, _availableLevels) {
|
|
167
207
|
switch (level) {
|
|
168
208
|
case "off":
|
|
169
209
|
return "No reasoning/thinking";
|
|
@@ -180,3 +220,25 @@ export class AppMenuItemsController {
|
|
|
180
220
|
}
|
|
181
221
|
}
|
|
182
222
|
}
|
|
223
|
+
function labelHighlightRangesFromMatch(matchedText, matchedRanges, label) {
|
|
224
|
+
if (matchedText === label)
|
|
225
|
+
return matchedRanges;
|
|
226
|
+
const offset = label.toLocaleLowerCase().indexOf(matchedText.toLocaleLowerCase());
|
|
227
|
+
if (offset < 0)
|
|
228
|
+
return [];
|
|
229
|
+
return matchedRanges.map((range) => ({ start: offset + range.start, end: offset + range.end }));
|
|
230
|
+
}
|
|
231
|
+
function normalizeAvailableThinkingLevels(levels) {
|
|
232
|
+
const seen = new Set();
|
|
233
|
+
const normalized = [];
|
|
234
|
+
for (const level of levels ?? THINKING_LEVELS) {
|
|
235
|
+
if (!isAvailableThinkingLevel(level) || seen.has(level))
|
|
236
|
+
continue;
|
|
237
|
+
seen.add(level);
|
|
238
|
+
normalized.push(level);
|
|
239
|
+
}
|
|
240
|
+
return normalized.length > 0 ? normalized : ["off"];
|
|
241
|
+
}
|
|
242
|
+
function isAvailableThinkingLevel(value) {
|
|
243
|
+
return THINKING_LEVELS.includes(value);
|
|
244
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { AppCommandController } from "../commands/command-controller.js";
|
|
|
3
3
|
import type { AppMenuItemsController } from "./menu-items-controller.js";
|
|
4
4
|
import type { AppPopupMenuController } from "./popup-menu-controller.js";
|
|
5
5
|
import type { AppQueuedMessageController } from "../session/queued-message-controller.js";
|
|
6
|
-
import type { Entry, SlashCommand } from "../types.js";
|
|
6
|
+
import type { Entry, SlashCommand, UserMessageJumpMenuValue } from "../types.js";
|
|
7
7
|
import type { AppWorkspaceActionsController } from "../workspace/workspace-actions-controller.js";
|
|
8
8
|
export type AppPopupActionControllerHost = {
|
|
9
9
|
runtime(): AgentSessionRuntime | undefined;
|
|
@@ -19,6 +19,7 @@ export type AppPopupActionControllerHost = {
|
|
|
19
19
|
bindCurrentSession(): Promise<void>;
|
|
20
20
|
loadSessionHistory(): void;
|
|
21
21
|
scrollToConversationEntry(entryId: string): boolean;
|
|
22
|
+
scrollToUserMessageJumpTarget(target: UserMessageJumpMenuValue): Promise<boolean>;
|
|
22
23
|
};
|
|
23
24
|
export declare class AppPopupActionController {
|
|
24
25
|
private readonly host;
|
|
@@ -24,7 +24,7 @@ export class AppPopupActionController {
|
|
|
24
24
|
if (active === "user-message")
|
|
25
25
|
return await this.submitSelectedUserMessageAction();
|
|
26
26
|
if (active === "user-message-jump")
|
|
27
|
-
return this.submitSelectedUserMessageJump();
|
|
27
|
+
return await this.submitSelectedUserMessageJump();
|
|
28
28
|
if (active === "resume")
|
|
29
29
|
return await this.submitSelectedResume();
|
|
30
30
|
if (active === "model")
|
|
@@ -155,6 +155,10 @@ export class AppPopupActionController {
|
|
|
155
155
|
await this.workspaceActions.forkFromUserMessage(selected.entryId);
|
|
156
156
|
return true;
|
|
157
157
|
}
|
|
158
|
+
if (selected.value === "fork-new-tab") {
|
|
159
|
+
await this.workspaceActions.forkFromUserMessageInNewTab(selected.entryId);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
158
162
|
await this.workspaceActions.undoChangesFromUserMessage(selected.entryId);
|
|
159
163
|
return true;
|
|
160
164
|
}
|
|
@@ -165,13 +169,12 @@ export class AppPopupActionController {
|
|
|
165
169
|
return true;
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
|
-
submitSelectedUserMessageJump() {
|
|
172
|
+
async submitSelectedUserMessageJump() {
|
|
169
173
|
const selected = this.popupMenus.selectedUserMessageJump();
|
|
170
174
|
if (!selected)
|
|
171
175
|
return false;
|
|
172
|
-
const entryId = selected.entryId;
|
|
173
176
|
this.popupMenus.closeUserMessageJumpMenu();
|
|
174
|
-
if (!this.host.
|
|
177
|
+
if (!await this.host.scrollToUserMessageJumpTarget(selected)) {
|
|
175
178
|
this.host.showToast("User message not found", "error");
|
|
176
179
|
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
177
180
|
return true;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type Theme } from "../../theme.js";
|
|
2
1
|
import { PopupMenu, type PopupMenuItem } from "../../ui.js";
|
|
3
|
-
import type { ScreenStyler } from "../screen/screen-styler.js";
|
|
4
2
|
import type { ActivePopupMenu, Entry, ModelMenuValue, ParsedSlashInput, PixMenuController, PixMenuItem, PixMenuOptions, PixMenuSelectOptions, PopupMenuPlacement, QueueMessageMenuValue, RenderedLine, ResumeMenuValue, SlashCommand, ThinkingMenuValue, UserMessageJumpMenuValue, UserMessageMenuValue } from "../types.js";
|
|
5
3
|
import type { AgentSession, SessionInfo } from "@earendil-works/pi-coding-agent";
|
|
6
4
|
type SlashCommandMenuValue = SlashCommand;
|
|
@@ -10,10 +8,34 @@ type ResumePopupMenuValue = ResumeMenuValue;
|
|
|
10
8
|
type UserMessagePopupMenuValue = UserMessageMenuValue;
|
|
11
9
|
type UserMessageJumpPopupMenuValue = UserMessageJumpMenuValue;
|
|
12
10
|
type QueueMessagePopupMenuValue = QueueMessageMenuValue;
|
|
11
|
+
type SdkPopupMenuValue = PixMenuItem<unknown>;
|
|
12
|
+
type PopupMenuRendererPort = {
|
|
13
|
+
popupMenuWidth(columns: number): number;
|
|
14
|
+
popupMenuMargin(columns: number): number;
|
|
15
|
+
effectivePopupMenuWidth(columns: number): number;
|
|
16
|
+
styleOverlayLine(row: number, line: RenderedLine, width: number, activeMenu: PopupMenu<unknown>): string;
|
|
17
|
+
overlayPlainText(line: RenderedLine, width: number): string;
|
|
18
|
+
renderInlineUserMessageMenu(options: {
|
|
19
|
+
userContentWidth: number;
|
|
20
|
+
userContentLeft: number;
|
|
21
|
+
userLine: (text: string, entryId?: string, syntaxHighlight?: RenderedLine["syntaxHighlight"]) => RenderedLine;
|
|
22
|
+
}, menu: PopupMenu<UserMessagePopupMenuValue>): RenderedLine[];
|
|
23
|
+
renderSlashCommandMenu(width: number, menu: PopupMenu<SlashCommandMenuValue>): RenderedLine[];
|
|
24
|
+
renderModelMenu(width: number, menu: PopupMenu<ModelPopupMenuValue>): RenderedLine[];
|
|
25
|
+
renderThinkingMenu(width: number, menu: PopupMenu<ThinkingPopupMenuValue>): RenderedLine[];
|
|
26
|
+
renderResumeMenu(width: number, menu: PopupMenu<ResumePopupMenuValue>, state: {
|
|
27
|
+
directQuery: string;
|
|
28
|
+
allSessionsLoaded: boolean;
|
|
29
|
+
loadedSessionCount: number;
|
|
30
|
+
}): RenderedLine[];
|
|
31
|
+
renderUserMessageJumpMenu(width: number, menu: PopupMenu<UserMessageJumpPopupMenuValue>, directQuery: string): RenderedLine[];
|
|
32
|
+
renderQueueMessageMenu(width: number, menu: PopupMenu<QueueMessagePopupMenuValue>): RenderedLine[];
|
|
33
|
+
renderSdkMenu(width: number, menu: PopupMenu<SdkPopupMenuValue>, request: {
|
|
34
|
+
options: PixMenuOptions;
|
|
35
|
+
} | undefined, directQuery: string): RenderedLine[];
|
|
36
|
+
};
|
|
13
37
|
export type DirectPopupMenu = Exclude<ActivePopupMenu, "slash">;
|
|
14
38
|
export type AppPopupMenuControllerHost = {
|
|
15
|
-
readonly theme: Theme;
|
|
16
|
-
readonly screenStyler: ScreenStyler;
|
|
17
39
|
readonly entries: readonly Entry[];
|
|
18
40
|
readonly session: AgentSession | undefined;
|
|
19
41
|
readonly resumeLoading: boolean;
|
|
@@ -37,6 +59,7 @@ export type AppPopupMenuControllerHost = {
|
|
|
37
59
|
};
|
|
38
60
|
export declare class AppPopupMenuController {
|
|
39
61
|
private readonly host;
|
|
62
|
+
private readonly renderer;
|
|
40
63
|
readonly menuController: PixMenuController;
|
|
41
64
|
private readonly slashCommandMenu;
|
|
42
65
|
private readonly modelMenu;
|
|
@@ -62,7 +85,7 @@ export declare class AppPopupMenuController {
|
|
|
62
85
|
private resumeMenuAllSessionsLoaded;
|
|
63
86
|
private activeUserMessageEntryId;
|
|
64
87
|
private activeQueuedMessageEntryId;
|
|
65
|
-
constructor(host: AppPopupMenuControllerHost);
|
|
88
|
+
constructor(host: AppPopupMenuControllerHost, renderer: PopupMenuRendererPort);
|
|
66
89
|
get directMenu(): DirectPopupMenu | undefined;
|
|
67
90
|
get directQuery(): string;
|
|
68
91
|
setDirectMenu(menu: DirectPopupMenu | undefined): void;
|
|
@@ -95,6 +118,7 @@ export declare class AppPopupMenuController {
|
|
|
95
118
|
closeModelSelection(): void;
|
|
96
119
|
closeThinkingSelection(): void;
|
|
97
120
|
closeSlashCommandSelection(): void;
|
|
121
|
+
closeMenusForTabSwitch(): void;
|
|
98
122
|
cancelActivePopupMenu(): void;
|
|
99
123
|
autocompleteSlashCommand(): void;
|
|
100
124
|
autocompleteModel(): boolean;
|
|
@@ -137,19 +161,12 @@ export declare class AppPopupMenuController {
|
|
|
137
161
|
userContentLeft: number;
|
|
138
162
|
userLine: (text: string, entryId?: string, syntaxHighlight?: RenderedLine["syntaxHighlight"]) => RenderedLine;
|
|
139
163
|
}): RenderedLine[];
|
|
140
|
-
private hasPopupActionItems;
|
|
141
164
|
private withoutCloseMenuItems;
|
|
142
165
|
private resetPopupMenuSelection;
|
|
143
166
|
private resetResumeMenuLazyState;
|
|
144
167
|
private maybeGrowResumeMenuWindow;
|
|
145
168
|
private updateResumeMenuLoadedState;
|
|
146
169
|
private resumeMenuLoadedSessionCount;
|
|
147
|
-
private userMessageActionForeground;
|
|
148
|
-
private selectableItemVariant;
|
|
149
|
-
private queueMessageItemVariant;
|
|
150
|
-
private sdkItemVariant;
|
|
151
|
-
private resumeMenuItemSegments;
|
|
152
|
-
private popupMenuHeader;
|
|
153
170
|
private syncModelMenu;
|
|
154
171
|
private syncThinkingMenu;
|
|
155
172
|
private syncResumeMenu;
|
|
@@ -160,17 +177,7 @@ export declare class AppPopupMenuController {
|
|
|
160
177
|
private syncSlashCommandMenu;
|
|
161
178
|
private closeMenusExcept;
|
|
162
179
|
private getSdkMenuItems;
|
|
163
|
-
private renderSlashCommandMenu;
|
|
164
|
-
private renderModelMenu;
|
|
165
|
-
private renderThinkingMenu;
|
|
166
|
-
private renderResumeMenu;
|
|
167
|
-
private renderUserMessageJumpMenu;
|
|
168
|
-
private renderQueueMessageMenu;
|
|
169
|
-
private renderSdkMenu;
|
|
170
|
-
private popupLineForeground;
|
|
171
|
-
private popupLineBackground;
|
|
172
180
|
}
|
|
173
|
-
export declare function formatPopupMenuHeader(title: string, width: number): string;
|
|
174
181
|
export type SessionInfoMenuItemsLoader = {
|
|
175
182
|
readonly total: number;
|
|
176
183
|
items(limit?: number): PopupMenuItem<SessionInfo>[];
|
|
@@ -179,5 +186,11 @@ export declare function createSessionInfoMenuItemsLoader(sessions: readonly Sess
|
|
|
179
186
|
export declare function formatSessionInfoMenuItems(sessions: readonly SessionInfo[], currentSessionFile: string | undefined, query: string, options?: {
|
|
180
187
|
limit?: number;
|
|
181
188
|
}): PopupMenuItem<SessionInfo>[];
|
|
182
|
-
export
|
|
189
|
+
export type UserMessageJumpSourceItem = {
|
|
190
|
+
text: string;
|
|
191
|
+
entryId?: string;
|
|
192
|
+
sessionEntryId?: string;
|
|
193
|
+
};
|
|
194
|
+
export declare function buildUserMessageJumpItems(entries: readonly Entry[] | readonly UserMessageJumpSourceItem[]): PopupMenuItem<UserMessageJumpMenuValue>[];
|
|
195
|
+
export declare function filterUserMessageJumpItems(items: readonly PopupMenuItem<UserMessageJumpMenuValue>[], query: string): PopupMenuItem<UserMessageJumpMenuValue>[];
|
|
183
196
|
export type { ModelPopupMenuValue, QueueMessagePopupMenuValue, ResumePopupMenuValue, SlashCommandMenuValue, ThinkingPopupMenuValue, UserMessageJumpPopupMenuValue, UserMessagePopupMenuValue, };
|