@mariozechner/pi-coding-agent 0.12.3 → 0.12.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 +26 -1
- package/README.md +38 -1
- package/dist/changelog.d.ts +1 -1
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changelog.js +1 -1
- package/dist/changelog.js.map +1 -1
- package/dist/config.d.ts +48 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +109 -0
- package/dist/config.js.map +1 -0
- package/dist/export-html.d.ts.map +1 -1
- package/dist/export-html.js +1 -4
- package/dist/export-html.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +23 -27
- package/dist/main.js.map +1 -1
- package/dist/model-config.d.ts.map +1 -1
- package/dist/model-config.js +3 -4
- package/dist/model-config.js.map +1 -1
- package/dist/oauth/storage.d.ts.map +1 -1
- package/dist/oauth/storage.js +4 -12
- package/dist/oauth/storage.js.map +1 -1
- package/dist/session-manager.d.ts +2 -2
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +2 -2
- package/dist/session-manager.js.map +1 -1
- package/dist/settings-manager.d.ts.map +1 -1
- package/dist/settings-manager.js +2 -2
- package/dist/settings-manager.js.map +1 -1
- package/dist/slash-commands.d.ts +2 -2
- package/dist/slash-commands.d.ts.map +1 -1
- package/dist/slash-commands.js +7 -8
- package/dist/slash-commands.js.map +1 -1
- package/dist/theme/theme.d.ts.map +1 -1
- package/dist/theme/theme.js +11 -15
- package/dist/theme/theme.js.map +1 -1
- package/dist/tools-manager.d.ts.map +1 -1
- package/dist/tools-manager.js +3 -2
- package/dist/tools-manager.js.map +1 -1
- package/dist/tui/model-selector.d.ts.map +1 -1
- package/dist/tui/model-selector.js +1 -1
- package/dist/tui/model-selector.js.map +1 -1
- package/dist/tui/tool-execution.d.ts.map +1 -1
- package/dist/tui/tool-execution.js +3 -2
- package/dist/tui/tool-execution.js.map +1 -1
- package/dist/tui/tui-renderer.d.ts +1 -0
- package/dist/tui/tui-renderer.d.ts.map +1 -1
- package/dist/tui/tui-renderer.js +40 -6
- package/dist/tui/tui-renderer.js.map +1 -1
- package/package.json +8 -4
- package/dist/paths.d.ts +0 -32
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -60
- package/dist/paths.js.map +0 -1
package/dist/tui/tui-renderer.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { CombinedAutocompleteProvider, Container, Input, Loader, Markdown, ProcessTerminal, Spacer, Text, TruncatedText, TUI, visibleWidth, } from "@mariozechner/pi-tui";
|
|
2
4
|
import { exec } from "child_process";
|
|
3
5
|
import { getChangelogPath, parseChangelog } from "../changelog.js";
|
|
6
|
+
import { APP_NAME, getDebugLogPath, getModelsPath, getOAuthPath } from "../config.js";
|
|
4
7
|
import { exportSessionToHtml } from "../export-html.js";
|
|
5
8
|
import { getApiKeyForModel, getAvailableModels, invalidateOAuthCache } from "../model-config.js";
|
|
6
9
|
import { listOAuthProviders, login, logout } from "../oauth/index.js";
|
|
@@ -156,7 +159,7 @@ export class TuiRenderer {
|
|
|
156
159
|
if (this.isInitialized)
|
|
157
160
|
return;
|
|
158
161
|
// Add header with logo and instructions
|
|
159
|
-
const logo = theme.bold(theme.fg("accent",
|
|
162
|
+
const logo = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${this.version}`);
|
|
160
163
|
const instructions = theme.fg("dim", "esc") +
|
|
161
164
|
theme.fg("muted", " to interrupt") +
|
|
162
165
|
"\n" +
|
|
@@ -319,6 +322,12 @@ export class TuiRenderer {
|
|
|
319
322
|
this.editor.setText("");
|
|
320
323
|
return;
|
|
321
324
|
}
|
|
325
|
+
// Check for /debug command
|
|
326
|
+
if (text === "/debug") {
|
|
327
|
+
this.handleDebugCommand();
|
|
328
|
+
this.editor.setText("");
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
322
331
|
// Check for file-based slash commands
|
|
323
332
|
text = expandSlashCommand(text, this.fileCommands);
|
|
324
333
|
// Normal message submission - validate model and API key first
|
|
@@ -326,7 +335,7 @@ export class TuiRenderer {
|
|
|
326
335
|
if (!currentModel) {
|
|
327
336
|
this.showError("No model selected.\n\n" +
|
|
328
337
|
"Set an API key (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.)\n" +
|
|
329
|
-
|
|
338
|
+
`or create ${getModelsPath()}\n\n` +
|
|
330
339
|
"Then use /model to select a model.");
|
|
331
340
|
return;
|
|
332
341
|
}
|
|
@@ -334,7 +343,7 @@ export class TuiRenderer {
|
|
|
334
343
|
const apiKey = await getApiKeyForModel(currentModel);
|
|
335
344
|
if (!apiKey) {
|
|
336
345
|
this.showError(`No API key found for ${currentModel.provider}.\n\n` +
|
|
337
|
-
`Set the appropriate environment variable or update
|
|
346
|
+
`Set the appropriate environment variable or update ${getModelsPath()}`);
|
|
338
347
|
this.editor.setText(text);
|
|
339
348
|
return;
|
|
340
349
|
}
|
|
@@ -1056,7 +1065,7 @@ export class TuiRenderer {
|
|
|
1056
1065
|
invalidateOAuthCache();
|
|
1057
1066
|
this.chatContainer.addChild(new Spacer(1));
|
|
1058
1067
|
this.chatContainer.addChild(new Text(theme.fg("success", `✓ Successfully logged in to ${providerId}`), 1, 0));
|
|
1059
|
-
this.chatContainer.addChild(new Text(theme.fg("dim", `Tokens saved to
|
|
1068
|
+
this.chatContainer.addChild(new Text(theme.fg("dim", `Tokens saved to ${getOAuthPath()}`), 1, 0));
|
|
1060
1069
|
this.ui.requestRender();
|
|
1061
1070
|
}
|
|
1062
1071
|
catch (error) {
|
|
@@ -1071,7 +1080,7 @@ export class TuiRenderer {
|
|
|
1071
1080
|
invalidateOAuthCache();
|
|
1072
1081
|
this.chatContainer.addChild(new Spacer(1));
|
|
1073
1082
|
this.chatContainer.addChild(new Text(theme.fg("success", `✓ Successfully logged out of ${providerId}`), 1, 0));
|
|
1074
|
-
this.chatContainer.addChild(new Text(theme.fg("dim", `Credentials removed from
|
|
1083
|
+
this.chatContainer.addChild(new Text(theme.fg("dim", `Credentials removed from ${getOAuthPath()}`), 1, 0));
|
|
1075
1084
|
this.ui.requestRender();
|
|
1076
1085
|
}
|
|
1077
1086
|
catch (error) {
|
|
@@ -1226,6 +1235,31 @@ export class TuiRenderer {
|
|
|
1226
1235
|
this.chatContainer.addChild(new Text(theme.fg("accent", "✓ Context cleared") + "\n" + theme.fg("muted", "Started fresh session"), 1, 1));
|
|
1227
1236
|
this.ui.requestRender();
|
|
1228
1237
|
}
|
|
1238
|
+
handleDebugCommand() {
|
|
1239
|
+
// Force a render and capture all lines with their widths
|
|
1240
|
+
const width = this.ui.terminal.columns;
|
|
1241
|
+
const allLines = this.ui.render(width);
|
|
1242
|
+
const debugLogPath = getDebugLogPath();
|
|
1243
|
+
const debugData = [
|
|
1244
|
+
`Debug output at ${new Date().toISOString()}`,
|
|
1245
|
+
`Terminal width: ${width}`,
|
|
1246
|
+
`Total lines: ${allLines.length}`,
|
|
1247
|
+
"",
|
|
1248
|
+
"=== All rendered lines with visible widths ===",
|
|
1249
|
+
...allLines.map((line, idx) => {
|
|
1250
|
+
const vw = visibleWidth(line);
|
|
1251
|
+
const escaped = JSON.stringify(line);
|
|
1252
|
+
return `[${idx}] (w=${vw}) ${escaped}`;
|
|
1253
|
+
}),
|
|
1254
|
+
"",
|
|
1255
|
+
].join("\n");
|
|
1256
|
+
fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });
|
|
1257
|
+
fs.writeFileSync(debugLogPath, debugData);
|
|
1258
|
+
// Show confirmation
|
|
1259
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
1260
|
+
this.chatContainer.addChild(new Text(theme.fg("accent", "✓ Debug log written") + "\n" + theme.fg("muted", debugLogPath), 1, 1));
|
|
1261
|
+
this.ui.requestRender();
|
|
1262
|
+
}
|
|
1229
1263
|
updatePendingMessagesDisplay() {
|
|
1230
1264
|
this.pendingMessagesContainer.clear();
|
|
1231
1265
|
if (this.queuedMessages.length > 0) {
|