@danypops/jittor 0.1.0 → 0.1.1
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/extension/src/footer.ts +38 -29
- package/package.json +1 -1
- package/src/constants.ts +1 -1
package/extension/src/footer.ts
CHANGED
|
@@ -150,39 +150,33 @@ function usageSegment(context: FooterContext): string {
|
|
|
150
150
|
return parts.join(" ");
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
function
|
|
153
|
+
function repositorySegment(context: FooterContext, footerData: FooterData, theme: FooterTheme): string {
|
|
154
154
|
let cwd = footerCwd(context.sessionManager.getCwd(), process.env.HOME ?? process.env.USERPROFILE);
|
|
155
155
|
const branch = footerData.getGitBranch();
|
|
156
156
|
if (branch) cwd += ` (${branch})`;
|
|
157
157
|
const sessionName = context.sessionManager.getSessionName();
|
|
158
158
|
if (sessionName) cwd += ` · ${sessionName}`;
|
|
159
|
-
|
|
159
|
+
return theme.fg("dim", cwd);
|
|
160
|
+
}
|
|
160
161
|
|
|
162
|
+
function modelSegments(context: FooterContext, footerData: FooterData, theme: FooterTheme, thinkingLevel: string): { full: string; compact: string } {
|
|
161
163
|
const model = context.model;
|
|
164
|
+
const modelName = theme.bold(model?.id ?? "no-model");
|
|
162
165
|
const provider = model && footerData.getAvailableProviderCount() > 1 ? `(${model.provider}) ` : "";
|
|
163
166
|
const thinking = model?.reasoning ? ` · ${thinkingLevel === "off" ? "thinking off" : thinkingLevel}` : "";
|
|
164
|
-
|
|
165
|
-
const gap = width - visibleWidth(repo) - visibleWidth(ai);
|
|
166
|
-
if (gap >= 2) return [`${repo}${" ".repeat(gap)}${ai}`];
|
|
167
|
-
return [truncateToWidth(repo, width, "…"), truncateToWidth(ai, width, "…")];
|
|
167
|
+
return { full: `${provider}${modelName}${thinking}`, compact: modelName };
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const compact = `${theme.bold("LLM")} ${compactContext} · ${compactBudget}`;
|
|
181
|
-
if (visibleWidth(compact) <= width) return [compact];
|
|
182
|
-
return [
|
|
183
|
-
truncateToWidth(`${theme.bold("LLM")} ${compactContext}`, width, ""),
|
|
184
|
-
truncateToWidth(`${theme.bold("LLM")} ${compactBudget}`, width, ""),
|
|
185
|
-
];
|
|
170
|
+
function compactUsageSegment(context: FooterContext): string {
|
|
171
|
+
const totals = usageTotals(context);
|
|
172
|
+
const parts: string[] = [];
|
|
173
|
+
if (totals.input) parts.push(`↑${formatTokens(totals.input)}`);
|
|
174
|
+
if (totals.output) parts.push(`↓${formatTokens(totals.output)}`);
|
|
175
|
+
return parts.join(" ");
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function joinSegments(segments: Array<string | undefined>): string {
|
|
179
|
+
return segments.filter((segment): segment is string => Boolean(segment)).join(" · ");
|
|
186
180
|
}
|
|
187
181
|
|
|
188
182
|
export function renderFooterLines(
|
|
@@ -195,16 +189,31 @@ export function renderFooterLines(
|
|
|
195
189
|
now = Date.now(),
|
|
196
190
|
): string[] {
|
|
197
191
|
const safeWidth = Math.max(1, width);
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
192
|
+
const repository = repositorySegment(context, footerData, theme);
|
|
193
|
+
const model = modelSegments(context, footerData, theme, thinkingLevel);
|
|
194
|
+
const usage = usageSegment(context);
|
|
195
|
+
const compactUsage = compactUsageSegment(context);
|
|
196
|
+
const fullContext = contextSegment(context, theme, safeWidth, false);
|
|
197
|
+
const compactContext = contextSegment(context, theme, safeWidth, true);
|
|
198
|
+
const fullBudget = budgetSegment(providerBudget, theme, safeWidth, false, now);
|
|
199
|
+
const compactBudget = budgetSegment(providerBudget, theme, safeWidth, true, now);
|
|
202
200
|
const statuses = [...footerData.getExtensionStatuses().entries()]
|
|
203
201
|
.filter(([key]) => key !== "jittor")
|
|
204
202
|
.sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))
|
|
205
|
-
.map(([, text]) => sanitize(text))
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
.map(([, text]) => sanitize(text))
|
|
204
|
+
.join(" ");
|
|
205
|
+
|
|
206
|
+
const candidates = [
|
|
207
|
+
joinSegments([repository, model.full, usage, fullContext, fullBudget, statuses]),
|
|
208
|
+
joinSegments([repository, model.full, usage, fullContext, fullBudget]),
|
|
209
|
+
joinSegments([model.full, usage, compactContext, compactBudget, statuses]),
|
|
210
|
+
joinSegments([model.full, usage, compactContext, compactBudget]),
|
|
211
|
+
joinSegments([model.full, compactUsage, compactContext, compactBudget]),
|
|
212
|
+
joinSegments([model.compact, compactUsage, compactContext, compactBudget]),
|
|
213
|
+
joinSegments([model.compact, compactContext, compactBudget]),
|
|
214
|
+
];
|
|
215
|
+
const line = candidates.find((candidate) => visibleWidth(candidate) <= safeWidth) ?? candidates.at(-1) ?? "";
|
|
216
|
+
return [truncateToWidth(line, safeWidth, "")];
|
|
208
217
|
}
|
|
209
218
|
|
|
210
219
|
export interface IntegratedFooterState {
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED