pi-advisor-flow 0.13.1 → 0.13.2
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 +6 -0
- package/dist/index.js +14 -7
- package/extensions/index.ts +6 -0
- package/package.json +9 -9
- package/scripts/check-bun-version.mjs +9 -0
- package/src/attachments.ts +36 -0
- package/src/child-session.ts +1 -0
- package/src/commands/activation-preparation.ts +12 -0
- package/src/commands/activation.ts +43 -0
- package/src/commands/advisor-tools.ts +3 -0
- package/src/commands/lifecycle.ts +15 -0
- package/src/commands/manual-command.ts +19 -0
- package/src/commands/manual-consultation.ts +20 -0
- package/src/commands/manual-progress.ts +13 -0
- package/src/commands/model-commands.ts +4 -0
- package/src/commands/model-options.ts +18 -0
- package/src/commands/model-picker.ts +16 -0
- package/src/commands/outcome-stats.ts +9 -0
- package/src/commands/registration.ts +1 -0
- package/src/commands/renderers.ts +14 -0
- package/src/commands/runtime.ts +5 -0
- package/src/commands/settings-commands.ts +18 -0
- package/src/commands/settings-persistence.ts +2 -0
- package/src/commands.ts +1 -0
- package/src/config/args.ts +7 -0
- package/src/config/defaults.ts +1 -0
- package/src/config/schema.ts +1 -0
- package/src/config/state.ts +64 -1
- package/src/config/storage.ts +37 -0
- package/src/config/types.ts +9 -0
- package/src/config/validation.ts +7 -0
- package/src/config.ts +6 -0
- package/src/content-utils.ts +5 -0
- package/src/conversation.ts +39 -0
- package/src/follow-up.ts +8 -0
- package/src/git.ts +8 -0
- package/src/herdr-block.ts +7 -0
- package/src/herdr-shared.ts +23 -0
- package/src/herdr.ts +18 -0
- package/src/image-attachments.ts +24 -0
- package/src/image-validation.ts +58 -0
- package/src/images.ts +24 -0
- package/src/jev/base-url.ts +14 -0
- package/src/jev/client.ts +49 -0
- package/src/jev/decisions-client.ts +14 -0
- package/src/jev/decisions-response.ts +38 -0
- package/src/jev/endpoint-key-store.ts +18 -0
- package/src/jev/key-store.ts +28 -0
- package/src/jev/ledger.ts +30 -12
- package/src/jev/openai-key-store.ts +17 -0
- package/src/jev/questions.ts +15 -0
- package/src/jev/state.ts +5 -0
- package/src/jev/transport.ts +35 -0
- package/src/model-stream.ts +32 -0
- package/src/outcome-stats.ts +16 -0
- package/src/outcomes.ts +31 -0
- package/src/pi-settings.ts +9 -0
- package/src/preferences.ts +26 -0
- package/src/redaction.ts +8 -0
- package/src/scout-context.ts +17 -0
- package/src/scout-curation.ts +12 -0
- package/src/scout-groups.ts +47 -0
- package/src/scout-protocol.ts +17 -0
- package/src/scout-reconstruct.ts +12 -0
- package/src/scout.ts +47 -0
- package/src/session-context.ts +11 -0
- package/src/session-state.ts +73 -13
- package/src/tool-result-cap.ts +11 -0
- package/src/tools/consult-context.ts +24 -0
- package/src/tools/consultation.ts +43 -0
- package/src/tools/gate-policy.ts +18 -0
- package/src/tools/gate-protocol.ts +22 -0
- package/src/tools/jev-filter.ts +26 -0
- package/src/tools/jev-turn-gate.ts +17 -0
- package/src/tools/loop-gate.ts +25 -0
- package/src/tools/model-access.ts +12 -0
- package/src/tools/outage-notifier.ts +4 -0
- package/src/tools/prompts.ts +17 -0
- package/src/tools/register-ask-advisor.ts +44 -0
- package/src/tools/register-lifecycle.ts +32 -0
- package/src/tools/register-outcome.ts +7 -0
- package/src/tools/register-renderers.ts +14 -0
- package/src/tools/registration.ts +3 -0
- package/src/tools/render-advisor-result.ts +44 -0
- package/src/tools/render-common.ts +10 -0
- package/src/tools/scout-status.ts +34 -0
- package/src/tools/session.ts +3 -0
- package/src/tools.ts +8 -0
- package/src/ui/jev-filter-submenu.ts +21 -0
- package/src/ui/jev-provider-submenu-view.ts +22 -0
- package/src/ui/jev-provider-submenu.ts +81 -0
- package/src/ui/jev-setup-support.ts +26 -0
- package/src/ui/manual-dialog-render.ts +20 -0
- package/src/ui/manual-dialog.ts +38 -0
- package/src/ui/masked-input.ts +2 -0
- package/src/ui/searchable-model-list.ts +28 -0
- package/src/ui/settings-formatting.ts +26 -0
- package/src/ui/settings-items.ts +11 -0
- package/src/ui/settings-list-adapter.ts +13 -0
- package/src/ui/settings-mutations.ts +60 -0
- package/src/ui/settings-selector.ts +30 -0
- package/src/ui/text-setting-submenu.ts +9 -0
- package/src/ui-guard.ts +1 -0
- package/src/ui.ts +3 -0
- package/src/usage.ts +31 -0
|
@@ -20,6 +20,7 @@ export const scoutDetailsFromEvent = (
|
|
|
20
20
|
if (event.type === "call") {
|
|
21
21
|
return { model: event.model, status: "calling" };
|
|
22
22
|
}
|
|
23
|
+
|
|
23
24
|
if (event.type === "chunk") {
|
|
24
25
|
return {
|
|
25
26
|
...previous,
|
|
@@ -29,13 +30,16 @@ export const scoutDetailsFromEvent = (
|
|
|
29
30
|
thinking: event.thinking,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
|
|
32
34
|
if (event.type === "cancelled") {
|
|
33
35
|
return {
|
|
34
36
|
model: previous ? previous.model : executorRef,
|
|
35
37
|
status: "cancelled",
|
|
36
38
|
};
|
|
37
39
|
}
|
|
40
|
+
|
|
38
41
|
const { outcome } = event;
|
|
42
|
+
|
|
39
43
|
return outcome.ok
|
|
40
44
|
? {
|
|
41
45
|
availableCount: outcome.metrics.availableCount,
|
|
@@ -65,6 +69,7 @@ export const appendScoutLifecycleEntry = (
|
|
|
65
69
|
previous?: ScoutToolDetails
|
|
66
70
|
) => {
|
|
67
71
|
const scout = scoutDetailsFromEvent(event, previous);
|
|
72
|
+
|
|
68
73
|
if (
|
|
69
74
|
event.type === "success" ||
|
|
70
75
|
event.type === "fallback" ||
|
|
@@ -72,6 +77,7 @@ export const appendScoutLifecycleEntry = (
|
|
|
72
77
|
) {
|
|
73
78
|
pi.appendEntry?.("advisor-scout-result", scout);
|
|
74
79
|
}
|
|
80
|
+
|
|
75
81
|
return scout;
|
|
76
82
|
};
|
|
77
83
|
|
|
@@ -95,14 +101,19 @@ export class ScoutStatusManager {
|
|
|
95
101
|
if (this.#retired.has(token) || !uiAvailable(ctx)) {
|
|
96
102
|
return;
|
|
97
103
|
}
|
|
104
|
+
|
|
98
105
|
this.#known.add(token);
|
|
106
|
+
|
|
99
107
|
if (event.type === "call" || event.type === "chunk") {
|
|
100
108
|
this.#active.add(token);
|
|
109
|
+
|
|
101
110
|
if (this.showStatus) {
|
|
102
111
|
uiAction(ctx, (ui) => ui.setStatus("advisor-scout", "Scout curating…"));
|
|
103
112
|
}
|
|
113
|
+
|
|
104
114
|
return;
|
|
105
115
|
}
|
|
116
|
+
|
|
106
117
|
this.release(ctx, token);
|
|
107
118
|
}
|
|
108
119
|
|
|
@@ -110,9 +121,11 @@ export class ScoutStatusManager {
|
|
|
110
121
|
this.#active.delete(token);
|
|
111
122
|
this.#known.delete(token);
|
|
112
123
|
this.#retired.add(token);
|
|
124
|
+
|
|
113
125
|
if (!(uiAvailable(ctx) && this.showStatus)) {
|
|
114
126
|
return;
|
|
115
127
|
}
|
|
128
|
+
|
|
116
129
|
uiAction(ctx, (ui) =>
|
|
117
130
|
ui.setStatus(
|
|
118
131
|
"advisor-scout",
|
|
@@ -125,8 +138,10 @@ export class ScoutStatusManager {
|
|
|
125
138
|
for (const token of this.#known) {
|
|
126
139
|
this.#retired.add(token);
|
|
127
140
|
}
|
|
141
|
+
|
|
128
142
|
this.#known.clear();
|
|
129
143
|
this.#active.clear();
|
|
144
|
+
|
|
130
145
|
if (this.showStatus) {
|
|
131
146
|
uiAction(ctx, (ui) => ui.setStatus("advisor-scout", undefined));
|
|
132
147
|
}
|
|
@@ -137,12 +152,15 @@ const scoutTitle = (scout: ScoutToolDetails, frame: string) => {
|
|
|
137
152
|
if (scout.status === "calling" || scout.status === "streaming") {
|
|
138
153
|
return `◆ SCOUT ${frame} · CURATING…`;
|
|
139
154
|
}
|
|
155
|
+
|
|
140
156
|
if (scout.status === "curated") {
|
|
141
157
|
return "◆ SCOUT · CURATED";
|
|
142
158
|
}
|
|
159
|
+
|
|
143
160
|
if (scout.status === "cancelled") {
|
|
144
161
|
return "◆ SCOUT · CANCELLED";
|
|
145
162
|
}
|
|
163
|
+
|
|
146
164
|
return "◆ SCOUT · FALLBACK";
|
|
147
165
|
};
|
|
148
166
|
|
|
@@ -150,9 +168,11 @@ const scoutSelectionSummary = (scout: ScoutToolDetails) => {
|
|
|
150
168
|
if (scout.status === "fallback") {
|
|
151
169
|
return " · original conversation retained";
|
|
152
170
|
}
|
|
171
|
+
|
|
153
172
|
if (scout.status !== "curated" || scout.selectedCount === undefined) {
|
|
154
173
|
return "";
|
|
155
174
|
}
|
|
175
|
+
|
|
156
176
|
return ` · ${scout.selectedCount} kept / ${Math.max(0, (scout.availableCount ?? 0) - scout.selectedCount)} omitted`;
|
|
157
177
|
};
|
|
158
178
|
|
|
@@ -165,11 +185,13 @@ const scoutExpandedLines = (
|
|
|
165
185
|
theme: Theme
|
|
166
186
|
): string[] => {
|
|
167
187
|
const lines: string[] = [];
|
|
188
|
+
|
|
168
189
|
if (expanded && scout.selectedLabels?.length) {
|
|
169
190
|
lines.push(
|
|
170
191
|
theme.fg("dim", ` Selected: ${scout.selectedLabels.join("; ")}`)
|
|
171
192
|
);
|
|
172
193
|
}
|
|
194
|
+
|
|
173
195
|
if (expanded && scout.synthesis) {
|
|
174
196
|
lines.push(
|
|
175
197
|
theme.fg(
|
|
@@ -178,6 +200,7 @@ const scoutExpandedLines = (
|
|
|
178
200
|
)
|
|
179
201
|
);
|
|
180
202
|
}
|
|
203
|
+
|
|
181
204
|
if (expanded && scout.omittedBeforeScout) {
|
|
182
205
|
lines.push(
|
|
183
206
|
theme.fg(
|
|
@@ -186,6 +209,7 @@ const scoutExpandedLines = (
|
|
|
186
209
|
)
|
|
187
210
|
);
|
|
188
211
|
}
|
|
212
|
+
|
|
189
213
|
return lines;
|
|
190
214
|
};
|
|
191
215
|
|
|
@@ -196,9 +220,12 @@ export const renderScoutDetails = (
|
|
|
196
220
|
theme: Theme
|
|
197
221
|
) => {
|
|
198
222
|
const active = scout.status === "calling" || scout.status === "streaming";
|
|
223
|
+
|
|
199
224
|
const frame =
|
|
200
225
|
SPINNER_FRAMES[Math.floor(Date.now() / 80) % SPINNER_FRAMES.length];
|
|
226
|
+
|
|
201
227
|
const title = scoutTitle(scout, frame);
|
|
228
|
+
|
|
202
229
|
const lines = [
|
|
203
230
|
theme.fg(
|
|
204
231
|
scout.status === "fallback" || scout.status === "cancelled"
|
|
@@ -208,21 +235,28 @@ export const renderScoutDetails = (
|
|
|
208
235
|
),
|
|
209
236
|
theme.fg("dim", scoutSummaryLine(scout)),
|
|
210
237
|
];
|
|
238
|
+
|
|
211
239
|
if (getAdvisorSettings().showUsageDetails) {
|
|
212
240
|
const usage = formatAdvisorUsage(scout.usage);
|
|
241
|
+
|
|
213
242
|
if (usage) {
|
|
214
243
|
lines.push(theme.fg("dim", ` Usage: ${usage}`));
|
|
215
244
|
}
|
|
216
245
|
}
|
|
246
|
+
|
|
217
247
|
if (scout.fallbackReason) {
|
|
218
248
|
lines.push(theme.fg("warning", ` ${scout.fallbackReason}`));
|
|
219
249
|
}
|
|
250
|
+
|
|
220
251
|
const thinking = scout.thinking && active ? scout.thinking.slice(-200) : "";
|
|
221
252
|
box.addChild(new Text(lines.join("\n"), 0, 0));
|
|
253
|
+
|
|
222
254
|
if (thinking.trim()) {
|
|
223
255
|
box.addChild(renderThinkingMarkdown(thinking, theme));
|
|
224
256
|
}
|
|
257
|
+
|
|
225
258
|
const expandedLines = scoutExpandedLines(scout, expanded, theme);
|
|
259
|
+
|
|
226
260
|
if (expandedLines.length > 0) {
|
|
227
261
|
box.addChild(new Text(expandedLines.join("\n"), 0, 0));
|
|
228
262
|
}
|
package/src/tools/session.ts
CHANGED
|
@@ -8,10 +8,13 @@ const sessionStates = new WeakMap<object, AdvisorSessionState>();
|
|
|
8
8
|
|
|
9
9
|
export const sessionStateFor = (owner: ExtensionAPI): AdvisorSessionState => {
|
|
10
10
|
const existing = sessionStates.get(owner);
|
|
11
|
+
|
|
11
12
|
if (existing) {
|
|
12
13
|
return existing;
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
const state = new AdvisorSessionState();
|
|
15
17
|
sessionStates.set(owner, state);
|
|
18
|
+
|
|
16
19
|
return state;
|
|
17
20
|
};
|
package/src/tools.ts
CHANGED
|
@@ -3,8 +3,11 @@ export {
|
|
|
3
3
|
curateAdvisorConversation,
|
|
4
4
|
runAdvisorGate,
|
|
5
5
|
} from "./tools/consultation.ts";
|
|
6
|
+
|
|
6
7
|
export { gateFailureEffectForMode } from "./tools/gate-policy.ts";
|
|
8
|
+
|
|
7
9
|
export { parseAutomaticDecision } from "./tools/gate-protocol.ts";
|
|
10
|
+
|
|
8
11
|
export {
|
|
9
12
|
ADVISOR_DECISION_SYSTEM,
|
|
10
13
|
ADVISOR_SYSTEM,
|
|
@@ -15,7 +18,9 @@ export {
|
|
|
15
18
|
advisorRequestConversation,
|
|
16
19
|
gitContextNote,
|
|
17
20
|
} from "./tools/prompts.ts";
|
|
21
|
+
|
|
18
22
|
export { registerAdvisorTool } from "./tools/registration.ts";
|
|
23
|
+
|
|
19
24
|
export {
|
|
20
25
|
adviceForDisplay,
|
|
21
26
|
hasSoundVerdict,
|
|
@@ -25,13 +30,16 @@ export {
|
|
|
25
30
|
resolveAdvisorRequest,
|
|
26
31
|
SPINNER_FRAMES,
|
|
27
32
|
} from "./tools/render-common.ts";
|
|
33
|
+
|
|
28
34
|
export {
|
|
29
35
|
appendScoutLifecycleEntry,
|
|
30
36
|
renderScoutDetails,
|
|
31
37
|
ScoutStatusManager,
|
|
32
38
|
scoutDetailsFromEvent,
|
|
33
39
|
} from "./tools/scout-status.ts";
|
|
40
|
+
|
|
34
41
|
export { advisorSessionState } from "./tools/session.ts";
|
|
42
|
+
|
|
35
43
|
export type {
|
|
36
44
|
AdvisorConsultationResult,
|
|
37
45
|
AdvisorGateFailure,
|
|
@@ -30,6 +30,7 @@ const labelFor = (action: FilterAction): string => {
|
|
|
30
30
|
if (action === "enable") {
|
|
31
31
|
return "Enable the filter";
|
|
32
32
|
}
|
|
33
|
+
|
|
33
34
|
return action === "disable" ? "Disable the filter" : "Done";
|
|
34
35
|
};
|
|
35
36
|
|
|
@@ -64,24 +65,29 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
64
65
|
|
|
65
66
|
render(width: number): string[] {
|
|
66
67
|
const { theme } = this.options;
|
|
68
|
+
|
|
67
69
|
const lines = [
|
|
68
70
|
theme.fg("accent", theme.bold(" Jev/Decisions consultation filter")),
|
|
69
71
|
"",
|
|
70
72
|
` Filter: ${this.enabled ? "On" : "Off"}`,
|
|
71
73
|
` Provider: ${this.options.currentTransport}`,
|
|
72
74
|
];
|
|
75
|
+
|
|
73
76
|
if (this.mode === "resolving") {
|
|
74
77
|
lines.push("", " Checking the selected provider credentials…");
|
|
75
78
|
} else if (this.notice) {
|
|
76
79
|
lines.push("", theme.fg("warning", ` ${this.notice}`));
|
|
77
80
|
}
|
|
81
|
+
|
|
78
82
|
if (this.mode === "menu") {
|
|
79
83
|
lines.push("");
|
|
84
|
+
|
|
80
85
|
for (const [index, action] of actionsFor(this.enabled).entries()) {
|
|
81
86
|
const prefix = index === this.selectedIndex ? "→ " : " ";
|
|
82
87
|
lines.push(`${prefix}${labelFor(action)}`);
|
|
83
88
|
}
|
|
84
89
|
}
|
|
90
|
+
|
|
85
91
|
return lines.map((line) => truncateToWidth(line, width));
|
|
86
92
|
}
|
|
87
93
|
|
|
@@ -89,7 +95,9 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
89
95
|
if (this.mode !== "menu") {
|
|
90
96
|
return;
|
|
91
97
|
}
|
|
98
|
+
|
|
92
99
|
const actions = actionsFor(this.enabled);
|
|
100
|
+
|
|
93
101
|
if (
|
|
94
102
|
matchesKey(keyData, Key.down) ||
|
|
95
103
|
keyData === "\u001B[B" ||
|
|
@@ -108,11 +116,13 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
108
116
|
} else {
|
|
109
117
|
return;
|
|
110
118
|
}
|
|
119
|
+
|
|
111
120
|
this.options.tui.requestRender();
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
private async refresh(): Promise<void> {
|
|
115
124
|
const transport = this.options.currentTransport;
|
|
125
|
+
|
|
116
126
|
try {
|
|
117
127
|
this.credentials = await this.deps.resolveTransport(
|
|
118
128
|
transport === "auto" ? undefined : transport
|
|
@@ -121,9 +131,11 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
121
131
|
this.credentials = undefined;
|
|
122
132
|
this.notice = `Credential lookup failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
123
133
|
}
|
|
134
|
+
|
|
124
135
|
if (!this.credentials && !this.notice) {
|
|
125
136
|
this.notice = `No Jev provider resolves for "${transport}". Open Jev provider to configure one.`;
|
|
126
137
|
}
|
|
138
|
+
|
|
127
139
|
this.mode = "menu";
|
|
128
140
|
this.options.tui.requestRender();
|
|
129
141
|
}
|
|
@@ -137,20 +149,28 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
137
149
|
private activate(action: FilterAction): void {
|
|
138
150
|
if (action === "done") {
|
|
139
151
|
this.options.done();
|
|
152
|
+
|
|
140
153
|
return;
|
|
141
154
|
}
|
|
155
|
+
|
|
142
156
|
const enabled = action === "enable";
|
|
157
|
+
|
|
143
158
|
if (enabled && !this.credentials) {
|
|
144
159
|
// refresh() already explains why nothing resolved.
|
|
145
160
|
this.options.tui.requestRender();
|
|
161
|
+
|
|
146
162
|
return;
|
|
147
163
|
}
|
|
164
|
+
|
|
148
165
|
const saved = this.commit({ enabled });
|
|
166
|
+
|
|
149
167
|
if (!saved) {
|
|
150
168
|
this.notice = "The filter state could not be saved.";
|
|
151
169
|
this.options.tui.requestRender();
|
|
170
|
+
|
|
152
171
|
return;
|
|
153
172
|
}
|
|
173
|
+
|
|
154
174
|
this.enabled = enabled;
|
|
155
175
|
this.notice = undefined;
|
|
156
176
|
this.options.done(enabled ? "On" : "Off");
|
|
@@ -160,6 +180,7 @@ export class JevFilterSubmenu implements Component, Focusable {
|
|
|
160
180
|
if (!this.options.onSelection) {
|
|
161
181
|
return true;
|
|
162
182
|
}
|
|
183
|
+
|
|
163
184
|
return this.options.onSelection(selection);
|
|
164
185
|
}
|
|
165
186
|
}
|
|
@@ -26,16 +26,21 @@ export const setupActions = (
|
|
|
26
26
|
state: JevProviderViewState
|
|
27
27
|
): JevProviderAction[] => {
|
|
28
28
|
const actions = providerActions();
|
|
29
|
+
|
|
29
30
|
if (state.canEnterKey) {
|
|
30
31
|
actions.push("enter-key");
|
|
31
32
|
}
|
|
33
|
+
|
|
32
34
|
if (state.canReuseProviderLogin) {
|
|
33
35
|
actions.push("reuse-provider-login");
|
|
34
36
|
}
|
|
37
|
+
|
|
35
38
|
if (state.credentials && canClearCredential(state.credentials)) {
|
|
36
39
|
actions.push("clear-stored-key");
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
actions.push("done");
|
|
43
|
+
|
|
39
44
|
return actions;
|
|
40
45
|
};
|
|
41
46
|
|
|
@@ -44,18 +49,23 @@ const setupLabels = (state: JevProviderViewState): string[] =>
|
|
|
44
49
|
if (action === "clear-stored-key") {
|
|
45
50
|
return "Clear stored key";
|
|
46
51
|
}
|
|
52
|
+
|
|
47
53
|
if (action === "done") {
|
|
48
54
|
return "Done";
|
|
49
55
|
}
|
|
56
|
+
|
|
50
57
|
if (action === "enter-key") {
|
|
51
58
|
return `Enter an API key for ${providerName(state.selectedTransport ?? "typesafe")}`;
|
|
52
59
|
}
|
|
60
|
+
|
|
53
61
|
if (action === "reuse-provider-login") {
|
|
54
62
|
return "Reuse a Pi provider login";
|
|
55
63
|
}
|
|
64
|
+
|
|
56
65
|
if (action === "typesafe-compatible") {
|
|
57
66
|
return `${providerName(action)}…`;
|
|
58
67
|
}
|
|
68
|
+
|
|
59
69
|
return providerName(action);
|
|
60
70
|
});
|
|
61
71
|
|
|
@@ -66,6 +76,7 @@ const inputLines = (
|
|
|
66
76
|
width: number
|
|
67
77
|
): string[] => {
|
|
68
78
|
const rendered = input.render(Math.max(10, width - 4))[0] ?? "";
|
|
79
|
+
|
|
69
80
|
const titles = {
|
|
70
81
|
"base-url": [
|
|
71
82
|
"Base URL of a System One–compatible endpoint",
|
|
@@ -82,7 +93,9 @@ const inputLines = (
|
|
|
82
93
|
"The Pi provider whose stored login supplies this endpoint's key, for example openrouter.",
|
|
83
94
|
],
|
|
84
95
|
} as const;
|
|
96
|
+
|
|
85
97
|
const [title, description] = titles[key];
|
|
98
|
+
|
|
86
99
|
return [` ${title}`, ` ${description}`, ` ${rendered}`];
|
|
87
100
|
};
|
|
88
101
|
|
|
@@ -94,6 +107,7 @@ export const renderJevProvider = (
|
|
|
94
107
|
): string[] => {
|
|
95
108
|
const { theme } = options;
|
|
96
109
|
const lines = [theme.fg("accent", theme.bold(" Jev provider")), ""];
|
|
110
|
+
|
|
97
111
|
if (state.credentials) {
|
|
98
112
|
lines.push(` Credential: ${transportLabel(state.credentials)}`);
|
|
99
113
|
} else if (state.selectedTransport) {
|
|
@@ -101,16 +115,21 @@ export const renderJevProvider = (
|
|
|
101
115
|
} else {
|
|
102
116
|
lines.push(` Saved transport: ${options.currentTransport}`);
|
|
103
117
|
}
|
|
118
|
+
|
|
104
119
|
if (state.baseUrl) {
|
|
105
120
|
lines.push(` Base URL: ${state.baseUrl}`);
|
|
106
121
|
}
|
|
122
|
+
|
|
107
123
|
if (state.providerId) {
|
|
108
124
|
lines.push(` Pi provider: ${state.providerId}`);
|
|
109
125
|
}
|
|
126
|
+
|
|
110
127
|
if (state.notice) {
|
|
111
128
|
lines.push("", theme.fg("warning", ` ${state.notice}`));
|
|
112
129
|
}
|
|
130
|
+
|
|
113
131
|
lines.push("");
|
|
132
|
+
|
|
114
133
|
if (state.mode === "resolving") {
|
|
115
134
|
lines.push(" Checking the selected provider credentials…");
|
|
116
135
|
} else if (state.mode === "verifying") {
|
|
@@ -123,9 +142,11 @@ export const renderJevProvider = (
|
|
|
123
142
|
state.mode === "provider-id"
|
|
124
143
|
) {
|
|
125
144
|
lines.push(...inputLines(state.mode, state, input, width));
|
|
145
|
+
|
|
126
146
|
if (state.inputError) {
|
|
127
147
|
lines.push(theme.fg("error", ` ${state.inputError}`));
|
|
128
148
|
}
|
|
149
|
+
|
|
129
150
|
lines.push(theme.fg("dim", " Enter: continue · Esc: return"));
|
|
130
151
|
} else {
|
|
131
152
|
for (const [index, label] of setupLabels(state).entries()) {
|
|
@@ -133,5 +154,6 @@ export const renderJevProvider = (
|
|
|
133
154
|
lines.push(`${prefix}${label}`);
|
|
134
155
|
}
|
|
135
156
|
}
|
|
157
|
+
|
|
136
158
|
return lines.map((line) => truncateToWidth(line, width));
|
|
137
159
|
};
|