@narumitw/pi-starship 0.52.3 → 0.54.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/README.md +93 -68
- package/dist/chunks/{chunk-6D6VEVE5.js → chunk-OZDBEKV2.js} +124 -25
- package/dist/chunks/chunk-OZDBEKV2.js.map +7 -0
- package/dist/chunks/{commands-T73QN435.js → commands-Z3V7LRUY.js} +3 -2
- package/dist/chunks/{commands-T73QN435.js.map → commands-Z3V7LRUY.js.map} +2 -2
- package/dist/index.ts +27 -6
- package/dist/index.ts.map +3 -3
- package/package.json +5 -8
- package/src/config.ts +9 -0
- package/src/effective-config.ts +1 -0
- package/src/format/style.ts +14 -6
- package/src/modules/activity.ts +57 -4
- package/src/modules/catalog.ts +1 -1
- package/src/modules/provider.ts +19 -1
- package/src/modules/render.ts +2 -1
- package/src/modules/thinking.ts +24 -0
- package/src/modules/types.ts +3 -0
- package/src/pi-starship.ts +24 -3
- package/src/runtime/github-pr.ts +2 -1
- package/dist/chunks/chunk-6D6VEVE5.js.map +0 -7
package/src/config.ts
CHANGED
|
@@ -279,6 +279,9 @@ export function normalizeConfig(value: unknown): {
|
|
|
279
279
|
);
|
|
280
280
|
validateLiteralStyles(module.formatAst, palette, `${name}.format`, diagnostics);
|
|
281
281
|
if (definition.styleDefaults) {
|
|
282
|
+
if (definition.fallbackStyle) {
|
|
283
|
+
validateModuleStyleField(name, "style", module, palette, diagnostics);
|
|
284
|
+
}
|
|
282
285
|
for (const field of Object.keys(definition.styleDefaults)) {
|
|
283
286
|
validateModuleStyleField(name, field, module, palette, diagnostics);
|
|
284
287
|
}
|
|
@@ -301,6 +304,7 @@ function normalizeModule(
|
|
|
301
304
|
const optionSchemas: Readonly<Record<string, ModuleOptionSchema>> = definition.options ?? {};
|
|
302
305
|
const known = new Set(["format", "symbol", "disabled", ...Object.keys(optionSchemas)]);
|
|
303
306
|
if (definition.styleDefaults) {
|
|
307
|
+
if (definition.fallbackStyle) known.add("style");
|
|
304
308
|
for (const field of Object.keys(definition.styleDefaults)) known.add(field);
|
|
305
309
|
} else if (!definition.displayDefaults) known.add("style");
|
|
306
310
|
if (definition.displayDefaults) known.add("display");
|
|
@@ -336,6 +340,11 @@ function normalizeModule(
|
|
|
336
340
|
diagnostics.push(typeDiagnostic(`${name}.symbol`, "string"));
|
|
337
341
|
} else module.symbol = value.symbol;
|
|
338
342
|
}
|
|
343
|
+
if (definition.styleDefaults && definition.fallbackStyle && value.style !== undefined) {
|
|
344
|
+
if (typeof value.style !== "string") {
|
|
345
|
+
diagnostics.push(typeDiagnostic(`${name}.style`, "string"));
|
|
346
|
+
} else module.style = value.style;
|
|
347
|
+
}
|
|
339
348
|
if (definition.styleDefaults) {
|
|
340
349
|
for (const field of Object.keys(definition.styleDefaults)) {
|
|
341
350
|
if (value[field] === undefined) continue;
|
package/src/effective-config.ts
CHANGED
|
@@ -18,6 +18,7 @@ export function projectEffectiveConfig(config: StarshipConfig): TomlTable {
|
|
|
18
18
|
symbol: module.symbol,
|
|
19
19
|
};
|
|
20
20
|
if (definition.styleDefaults) {
|
|
21
|
+
if (definition.fallbackStyle) table.style = module.style;
|
|
21
22
|
for (const field of Object.keys(definition.styleDefaults)) {
|
|
22
23
|
table[field] = module.styles[field] ?? "";
|
|
23
24
|
}
|
package/src/format/style.ts
CHANGED
|
@@ -208,7 +208,7 @@ interface ResolvedStyle
|
|
|
208
208
|
background?: ColorSpec;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
export function renderChunksToAnsi(chunks: readonly LayoutChunk[]): string {
|
|
211
|
+
export function renderChunksToAnsi(chunks: readonly LayoutChunk[], trueColor = true): string {
|
|
212
212
|
const runs: Array<{ text: string; style: ResolvedStyle }> = [];
|
|
213
213
|
let previous: ResolvedStyle | undefined;
|
|
214
214
|
for (const chunk of chunks) {
|
|
@@ -221,7 +221,7 @@ export function renderChunksToAnsi(chunks: readonly LayoutChunk[]): string {
|
|
|
221
221
|
}
|
|
222
222
|
return runs
|
|
223
223
|
.map(({ text, style }) => {
|
|
224
|
-
const codes = ansiCodes(style);
|
|
224
|
+
const codes = ansiCodes(style, trueColor);
|
|
225
225
|
return codes.length > 0 ? `\u001b[${codes.join(";")}m${text}\u001b[0m` : text;
|
|
226
226
|
})
|
|
227
227
|
.join("");
|
|
@@ -253,10 +253,10 @@ function resolveColor(
|
|
|
253
253
|
return source === "foreground" ? previous.foreground : previous.background;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
function ansiCodes(style: ResolvedStyle): string[] {
|
|
256
|
+
function ansiCodes(style: ResolvedStyle, trueColor: boolean): string[] {
|
|
257
257
|
const codes: string[] = [];
|
|
258
|
-
if (style.foreground) codes.push(...colorCodes(style.foreground, false));
|
|
259
|
-
if (style.background) codes.push(...colorCodes(style.background, true));
|
|
258
|
+
if (style.foreground) codes.push(...colorCodes(style.foreground, false, trueColor));
|
|
259
|
+
if (style.background) codes.push(...colorCodes(style.background, true, trueColor));
|
|
260
260
|
if (style.bold) codes.push("1");
|
|
261
261
|
if (style.dimmed) codes.push("2");
|
|
262
262
|
if (style.italic) codes.push("3");
|
|
@@ -268,11 +268,19 @@ function ansiCodes(style: ResolvedStyle): string[] {
|
|
|
268
268
|
return codes;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
function colorCodes(color: ColorSpec, background: boolean): string[] {
|
|
271
|
+
function colorCodes(color: ColorSpec, background: boolean, trueColor: boolean): string[] {
|
|
272
272
|
if (color.kind === "named") {
|
|
273
273
|
const foreground = FOREGROUND_CODES[color.name];
|
|
274
274
|
return [`${background ? foreground + 10 : foreground}`];
|
|
275
275
|
}
|
|
276
276
|
if (color.kind === "fixed") return [background ? "48" : "38", "5", `${color.value}`];
|
|
277
|
+
if (!trueColor) {
|
|
278
|
+
return [background ? "48" : "38", "5", `${rgbToAnsi256(color.red, color.green, color.blue)}`];
|
|
279
|
+
}
|
|
277
280
|
return [background ? "48" : "38", "2", `${color.red}`, `${color.green}`, `${color.blue}`];
|
|
278
281
|
}
|
|
282
|
+
|
|
283
|
+
function rgbToAnsi256(red: number, green: number, blue: number): number {
|
|
284
|
+
const channels = [red, green, blue].map((value) => Math.round((value / 255) * 5));
|
|
285
|
+
return 16 + 36 * (channels[0] ?? 0) + 6 * (channels[1] ?? 0) + (channels[2] ?? 0);
|
|
286
|
+
}
|
package/src/modules/activity.ts
CHANGED
|
@@ -1,15 +1,54 @@
|
|
|
1
|
+
import { sliceByColumn, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { sanitizeTerminalText } from "@narumitw/pi-tui-kit/terminal-text";
|
|
1
3
|
import { defineModule } from "./types.js";
|
|
2
4
|
|
|
5
|
+
const MAX_UI_PROMPT_TITLE_CODE_POINTS = 256;
|
|
6
|
+
const MAX_UI_PROMPT_TITLE_WIDTH = 40;
|
|
7
|
+
const EMPTY_PROMPT_VALUES = { kind: "", title: "" } as const;
|
|
8
|
+
|
|
9
|
+
function boundUIPromptTitleLength(title: string): string {
|
|
10
|
+
let end = 0;
|
|
11
|
+
let ellipsisEnd = 0;
|
|
12
|
+
let codePoints = 0;
|
|
13
|
+
while (end < title.length && codePoints < MAX_UI_PROMPT_TITLE_CODE_POINTS) {
|
|
14
|
+
const codePoint = title.codePointAt(end) ?? 0;
|
|
15
|
+
end += codePoint > 0xffff ? 2 : 1;
|
|
16
|
+
codePoints += 1;
|
|
17
|
+
if (codePoints < MAX_UI_PROMPT_TITLE_CODE_POINTS) ellipsisEnd = end;
|
|
18
|
+
}
|
|
19
|
+
return end < title.length ? `${title.slice(0, ellipsisEnd)}…` : title;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function formatUIPromptTitle(title: string | undefined): string {
|
|
23
|
+
const safeTitle = title ? sanitizeTerminalText(title).trim() : "";
|
|
24
|
+
const boundedTitle = boundUIPromptTitleLength(safeTitle);
|
|
25
|
+
if (visibleWidth(boundedTitle) <= MAX_UI_PROMPT_TITLE_WIDTH) return boundedTitle;
|
|
26
|
+
return `${sliceByColumn(boundedTitle, 0, MAX_UI_PROMPT_TITLE_WIDTH - 1, true)}…`;
|
|
27
|
+
}
|
|
28
|
+
|
|
3
29
|
export const activityModule = defineModule({
|
|
4
30
|
name: "activity",
|
|
5
|
-
variables: ["symbol", "state", "tool", "count", "text"],
|
|
31
|
+
variables: ["symbol", "state", "tool", "count", "kind", "title", "text"],
|
|
6
32
|
defaults: {
|
|
7
33
|
format: "[ $text ]($style)",
|
|
8
|
-
symbol: "
|
|
34
|
+
symbol: "⚙️",
|
|
9
35
|
style: "bold yellow",
|
|
10
36
|
disabled: false,
|
|
11
37
|
},
|
|
12
38
|
values: ({ runtime, symbol }) => {
|
|
39
|
+
if (runtime.uiPrompt) {
|
|
40
|
+
const title = formatUIPromptTitle(runtime.uiPrompt.title);
|
|
41
|
+
const waiting = `waiting for ${runtime.uiPrompt.kind}${title ? ` · ${title}` : ""}`;
|
|
42
|
+
return {
|
|
43
|
+
state: "waiting",
|
|
44
|
+
tool: "",
|
|
45
|
+
count: "0",
|
|
46
|
+
kind: runtime.uiPrompt.kind,
|
|
47
|
+
title,
|
|
48
|
+
text: `${symbol} ${waiting}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
13
52
|
const active = [...runtime.activeTools.entries()];
|
|
14
53
|
if (active.length > 0) {
|
|
15
54
|
const [tool = "tool", count = 1] = active[0] ?? [];
|
|
@@ -19,20 +58,34 @@ export const activityModule = defineModule({
|
|
|
19
58
|
state: "active",
|
|
20
59
|
tool,
|
|
21
60
|
count: `${count}`,
|
|
61
|
+
...EMPTY_PROMPT_VALUES,
|
|
22
62
|
text: `${symbol} ${tool}${suffix}${more}`,
|
|
23
63
|
};
|
|
24
64
|
}
|
|
25
65
|
if (runtime.isStreaming) {
|
|
26
|
-
return {
|
|
66
|
+
return {
|
|
67
|
+
state: "thinking",
|
|
68
|
+
tool: "",
|
|
69
|
+
count: "0",
|
|
70
|
+
...EMPTY_PROMPT_VALUES,
|
|
71
|
+
text: `${symbol} thinking`,
|
|
72
|
+
};
|
|
27
73
|
}
|
|
28
74
|
if (runtime.lastCompletedTool) {
|
|
29
75
|
return {
|
|
30
76
|
state: "completed",
|
|
31
77
|
tool: runtime.lastCompletedTool,
|
|
32
78
|
count: "0",
|
|
79
|
+
...EMPTY_PROMPT_VALUES,
|
|
33
80
|
text: `${symbol} completed ${runtime.lastCompletedTool}`,
|
|
34
81
|
};
|
|
35
82
|
}
|
|
36
|
-
return {
|
|
83
|
+
return {
|
|
84
|
+
state: "idle",
|
|
85
|
+
tool: "",
|
|
86
|
+
count: "0",
|
|
87
|
+
...EMPTY_PROMPT_VALUES,
|
|
88
|
+
text: `${symbol} idle`,
|
|
89
|
+
};
|
|
37
90
|
},
|
|
38
91
|
});
|
package/src/modules/catalog.ts
CHANGED
|
@@ -61,7 +61,7 @@ const MODULE_IMPLEMENTATIONS = [
|
|
|
61
61
|
export type ModuleName = (typeof MODULE_IMPLEMENTATIONS)[number]["name"];
|
|
62
62
|
|
|
63
63
|
const MODULE_DESCRIPTIONS = {
|
|
64
|
-
activity: "Current Pi activity or most recently completed tool.",
|
|
64
|
+
activity: "Current Pi activity, extension UI wait, or most recently completed tool.",
|
|
65
65
|
aws: "Active AWS profile and region.",
|
|
66
66
|
azure: "Active Azure subscription and optional username.",
|
|
67
67
|
brand: "pi-starship brand mark.",
|
package/src/modules/provider.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { sanitizeTerminalText } from "@narumitw/pi-tui-kit/terminal-text";
|
|
1
2
|
import { defineModule } from "./types.js";
|
|
2
3
|
|
|
4
|
+
const PROVIDER_ALIASES_KEY = "provider_aliases";
|
|
5
|
+
|
|
3
6
|
export const providerModule = defineModule({
|
|
4
7
|
name: "provider",
|
|
5
8
|
variables: ["symbol", "provider"],
|
|
@@ -9,5 +12,20 @@ export const providerModule = defineModule({
|
|
|
9
12
|
style: "bold blue",
|
|
10
13
|
disabled: false,
|
|
11
14
|
},
|
|
12
|
-
|
|
15
|
+
options: {
|
|
16
|
+
[PROVIDER_ALIASES_KEY]: { kind: "string-map", default: {} },
|
|
17
|
+
},
|
|
18
|
+
values: ({ runtime, options }) => {
|
|
19
|
+
if (!runtime.model) return undefined;
|
|
20
|
+
const aliases = options[PROVIDER_ALIASES_KEY];
|
|
21
|
+
const aliasMap =
|
|
22
|
+
aliases && typeof aliases === "object" && !Array.isArray(aliases)
|
|
23
|
+
? (aliases as Readonly<Record<string, string>>)
|
|
24
|
+
: undefined;
|
|
25
|
+
const alias =
|
|
26
|
+
aliasMap && Object.hasOwn(aliasMap, runtime.model.provider)
|
|
27
|
+
? aliasMap[runtime.model.provider]
|
|
28
|
+
: undefined;
|
|
29
|
+
return { provider: sanitizeTerminalText(alias ?? runtime.model.provider) };
|
|
30
|
+
},
|
|
13
31
|
});
|
package/src/modules/render.ts
CHANGED
|
@@ -14,6 +14,7 @@ export function renderStatusline(
|
|
|
14
14
|
config: StarshipConfig,
|
|
15
15
|
runtime: StarshipRuntimeSnapshot,
|
|
16
16
|
width = 80,
|
|
17
|
+
trueColor = true,
|
|
17
18
|
): RenderedStatusline<ModuleName> {
|
|
18
19
|
const palette = activePalette(config);
|
|
19
20
|
const modules = {} as Record<ModuleName, StyledChunk[]>;
|
|
@@ -61,7 +62,7 @@ export function renderStatusline(
|
|
|
61
62
|
const layout = renderFormat(config.formatAst, { variables: rootVariables, palette });
|
|
62
63
|
const chunks = resolveFillLayout(layout, width);
|
|
63
64
|
return {
|
|
64
|
-
ansi: renderChunksToAnsi(chunks),
|
|
65
|
+
ansi: renderChunksToAnsi(chunks, trueColor),
|
|
65
66
|
chunks,
|
|
66
67
|
modules,
|
|
67
68
|
};
|
package/src/modules/thinking.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
1
2
|
import { defineModule } from "./types.js";
|
|
2
3
|
|
|
4
|
+
const THINKING_LEVELS = [
|
|
5
|
+
"off",
|
|
6
|
+
"minimal",
|
|
7
|
+
"low",
|
|
8
|
+
"medium",
|
|
9
|
+
"high",
|
|
10
|
+
"xhigh",
|
|
11
|
+
"max",
|
|
12
|
+
] as const satisfies readonly ThinkingLevel[];
|
|
13
|
+
|
|
14
|
+
function thinkingLevelOf(value: string): ThinkingLevel | undefined {
|
|
15
|
+
return THINKING_LEVELS.find((level) => level === value);
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
export const thinkingModule = defineModule({
|
|
4
19
|
name: "thinking",
|
|
5
20
|
variables: ["symbol", "level"],
|
|
@@ -9,5 +24,14 @@ export const thinkingModule = defineModule({
|
|
|
9
24
|
style: "bold purple",
|
|
10
25
|
disabled: false,
|
|
11
26
|
},
|
|
27
|
+
styleDefaults: Object.fromEntries(
|
|
28
|
+
THINKING_LEVELS.map((level) => [`style_${level}`, ""]),
|
|
29
|
+
) as Record<`style_${ThinkingLevel}`, string>,
|
|
30
|
+
fallbackStyle: true,
|
|
31
|
+
styleVariables: ["style"],
|
|
32
|
+
resolveStyleVariables: ({ runtime, styles, style }) => {
|
|
33
|
+
const level = thinkingLevelOf(runtime.thinkingLevel);
|
|
34
|
+
return { style: (level && styles[`style_${level}`]) || style };
|
|
35
|
+
},
|
|
12
36
|
values: ({ runtime }) => ({ level: runtime.thinkingLevel }),
|
|
13
37
|
});
|
package/src/modules/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UIPromptKind } from "@earendil-works/pi-coding-agent";
|
|
1
2
|
import type { StyledChunk } from "../format/style.js";
|
|
2
3
|
|
|
3
4
|
export interface GitBranchSnapshot {
|
|
@@ -86,6 +87,7 @@ export interface StarshipRuntimeSnapshot {
|
|
|
86
87
|
turnCount: number;
|
|
87
88
|
activeTools: ReadonlyMap<string, number>;
|
|
88
89
|
isStreaming: boolean;
|
|
90
|
+
uiPrompt?: { kind: UIPromptKind; title?: string };
|
|
89
91
|
lastCompletedTool?: string;
|
|
90
92
|
contextUsage?: {
|
|
91
93
|
percent?: number | null;
|
|
@@ -168,6 +170,7 @@ export interface ModuleDefinition<Name extends string> {
|
|
|
168
170
|
variables: readonly string[];
|
|
169
171
|
defaults: ModuleDefaults;
|
|
170
172
|
styleDefaults?: Readonly<Record<string, string>>;
|
|
173
|
+
fallbackStyle?: boolean;
|
|
171
174
|
displayDefaults?: readonly ModuleDisplayConfig[];
|
|
172
175
|
styleVariables?: readonly string[];
|
|
173
176
|
resolveStyleVariables?(context: ModuleStyleContext): Readonly<Record<string, string>> | undefined;
|
package/src/pi-starship.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getAgentDir,
|
|
6
6
|
type ReadonlyFooterDataProvider,
|
|
7
7
|
} from "@earendil-works/pi-coding-agent";
|
|
8
|
-
import { wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
8
|
+
import { getCapabilities, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
9
9
|
import { completeStarshipArguments } from "./command-contract.js";
|
|
10
10
|
import type { StarshipCommandOptions } from "./commands.js";
|
|
11
11
|
import {
|
|
@@ -57,6 +57,7 @@ function loadStarshipCommands(): Promise<StarshipCommands> {
|
|
|
57
57
|
interface RuntimeState {
|
|
58
58
|
activeTools: Map<string, number>;
|
|
59
59
|
isStreaming: boolean;
|
|
60
|
+
uiPrompt?: NonNullable<StarshipRuntimeSnapshot["uiPrompt"]>;
|
|
60
61
|
thinkingLevel: string;
|
|
61
62
|
lastCompletedTool?: string;
|
|
62
63
|
git?: GitSnapshot;
|
|
@@ -102,6 +103,7 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
102
103
|
let githubPrGeneration = 0;
|
|
103
104
|
|
|
104
105
|
const refresh = () => runtime.requestRender?.();
|
|
106
|
+
const ownsRuntime = (ctx: ExtensionContext) => sessionOwner === ctx.sessionManager;
|
|
105
107
|
const githubPrExec = options.githubPrExec ?? execWorkspaceCommand;
|
|
106
108
|
const gitController = new AsyncRefreshController<GitRefreshInput, GitSnapshot | undefined>({
|
|
107
109
|
async read(input, signal) {
|
|
@@ -280,7 +282,7 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
280
282
|
runtime.renderPreview = (preview, width) => {
|
|
281
283
|
const snapshot = runtimeSnapshot(ctx, footerData, runtime);
|
|
282
284
|
return wrapFormattedStatusline(
|
|
283
|
-
renderStatusline(preview.config, snapshot, width).ansi,
|
|
285
|
+
renderStatusline(preview.config, snapshot, width, getCapabilities().trueColor).ansi,
|
|
284
286
|
width,
|
|
285
287
|
);
|
|
286
288
|
};
|
|
@@ -335,7 +337,7 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
335
337
|
if (!current) return [];
|
|
336
338
|
const snapshot = runtimeSnapshot(ctx, footerData, runtime);
|
|
337
339
|
return wrapFormattedStatusline(
|
|
338
|
-
renderStatusline(current.config, snapshot, width).ansi,
|
|
340
|
+
renderStatusline(current.config, snapshot, width, getCapabilities().trueColor).ansi,
|
|
339
341
|
width,
|
|
340
342
|
);
|
|
341
343
|
},
|
|
@@ -401,6 +403,10 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
401
403
|
});
|
|
402
404
|
|
|
403
405
|
pi.on("session_start", (_event, ctx) => {
|
|
406
|
+
runtime.activeTools.clear();
|
|
407
|
+
runtime.isStreaming = false;
|
|
408
|
+
runtime.uiPrompt = undefined;
|
|
409
|
+
runtime.lastCompletedTool = undefined;
|
|
404
410
|
loaded = loadStarshipConfig(configPath);
|
|
405
411
|
loadedRevision += 1;
|
|
406
412
|
if (loaded.diagnostics.length > 0 && (ctx.mode === "tui" || ctx.hasUI)) {
|
|
@@ -428,6 +434,10 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
428
434
|
stopGithubPr();
|
|
429
435
|
runtime.git = undefined;
|
|
430
436
|
runtime.workspace = undefined;
|
|
437
|
+
runtime.activeTools.clear();
|
|
438
|
+
runtime.isStreaming = false;
|
|
439
|
+
runtime.uiPrompt = undefined;
|
|
440
|
+
runtime.lastCompletedTool = undefined;
|
|
431
441
|
runtime.requestRender = undefined;
|
|
432
442
|
runtime.renderPreview = undefined;
|
|
433
443
|
runtime.inspect = undefined;
|
|
@@ -452,6 +462,16 @@ export default function piStarship(pi: ExtensionAPI, options: PiStarshipOptions
|
|
|
452
462
|
if (target?.sessionManager === ctx.sessionManager) requestGithubPr(target);
|
|
453
463
|
refresh();
|
|
454
464
|
});
|
|
465
|
+
pi.on("ui_prompt_start", (event, ctx) => {
|
|
466
|
+
if (!ownsRuntime(ctx)) return;
|
|
467
|
+
runtime.uiPrompt = { kind: event.kind, title: event.title };
|
|
468
|
+
refresh();
|
|
469
|
+
});
|
|
470
|
+
pi.on("ui_prompt_end", (_event, ctx) => {
|
|
471
|
+
if (!ownsRuntime(ctx)) return;
|
|
472
|
+
runtime.uiPrompt = undefined;
|
|
473
|
+
refresh();
|
|
474
|
+
});
|
|
455
475
|
pi.on("turn_start", () => {
|
|
456
476
|
runtime.isStreaming = true;
|
|
457
477
|
refresh();
|
|
@@ -568,6 +588,7 @@ function runtimeSnapshot(
|
|
|
568
588
|
turnCount: userTurnCount(ctx),
|
|
569
589
|
activeTools: runtime.activeTools,
|
|
570
590
|
isStreaming: runtime.isStreaming,
|
|
591
|
+
uiPrompt: runtime.uiPrompt,
|
|
571
592
|
lastCompletedTool: runtime.lastCompletedTool,
|
|
572
593
|
contextUsage: ctx.getContextUsage() ?? undefined,
|
|
573
594
|
tokenTotals: summarizeFooterUsage(ctx.sessionManager.getEntries()),
|
package/src/runtime/github-pr.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getCapabilities } from "@earendil-works/pi-tui";
|
|
1
2
|
import type { GithubPrSnapshot, GithubPrState } from "../modules/types.js";
|
|
2
3
|
import type { WorkspaceExec } from "./types.js";
|
|
3
4
|
|
|
@@ -219,7 +220,7 @@ function compactStatus(
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
function osc8Link(value: string, label: string): string {
|
|
222
|
-
if (hasTerminalControls(value)) return label;
|
|
223
|
+
if (!getCapabilities().hyperlinks || hasTerminalControls(value)) return label;
|
|
223
224
|
try {
|
|
224
225
|
const url = new URL(value);
|
|
225
226
|
if ((url.protocol !== "http:" && url.protocol !== "https:") || url.username || url.password) {
|