@openeryc/pi-coding-agent 0.75.9 → 0.75.10
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/core/agent-session.d.ts +2 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/session-manager.d.ts +25 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +156 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +45 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -2013,6 +2013,11 @@ export class InteractiveMode {
|
|
|
2013
2013
|
this.editor.setText("");
|
|
2014
2014
|
return;
|
|
2015
2015
|
}
|
|
2016
|
+
if (text === "/usage") {
|
|
2017
|
+
this.editor.setText("");
|
|
2018
|
+
await this.handleUsageCommand();
|
|
2019
|
+
return;
|
|
2020
|
+
}
|
|
2016
2021
|
if (text === "/memory") {
|
|
2017
2022
|
this.handleMemoryCommand();
|
|
2018
2023
|
this.editor.setText("");
|
|
@@ -4374,6 +4379,46 @@ export class InteractiveMode {
|
|
|
4374
4379
|
this.chatContainer.addChild(new Text(info, 1, 0));
|
|
4375
4380
|
this.ui.requestRender();
|
|
4376
4381
|
}
|
|
4382
|
+
async handleUsageCommand() {
|
|
4383
|
+
this.showStatus("Loading usage stats...");
|
|
4384
|
+
this.ui.requestRender();
|
|
4385
|
+
const stats = await this.session.getUsageStats();
|
|
4386
|
+
if (stats.sessions === 0) {
|
|
4387
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
4388
|
+
this.chatContainer.addChild(new Text(theme.fg("dim", "No session data found."), 1, 0));
|
|
4389
|
+
this.ui.requestRender();
|
|
4390
|
+
return;
|
|
4391
|
+
}
|
|
4392
|
+
let info = `${theme.bold("Usage Across All Sessions")}\n\n`;
|
|
4393
|
+
info += `${theme.fg("dim", "Sessions:")} ${stats.sessions}\n`;
|
|
4394
|
+
info += `${theme.fg("dim", "Input:")} ${stats.input.toLocaleString()}\n`;
|
|
4395
|
+
info += `${theme.fg("dim", "Output:")} ${stats.output.toLocaleString()}\n`;
|
|
4396
|
+
if (stats.cacheRead > 0) {
|
|
4397
|
+
info += `${theme.fg("dim", "Cache Read:")} ${stats.cacheRead.toLocaleString()}\n`;
|
|
4398
|
+
}
|
|
4399
|
+
if (stats.cacheWrite > 0) {
|
|
4400
|
+
info += `${theme.fg("dim", "Cache Write:")} ${stats.cacheWrite.toLocaleString()}\n`;
|
|
4401
|
+
}
|
|
4402
|
+
const totalTokens = stats.input + stats.output + stats.cacheRead + stats.cacheWrite;
|
|
4403
|
+
info += `${theme.fg("dim", "Total Tokens:")} ${totalTokens.toLocaleString()}\n`;
|
|
4404
|
+
if (stats.cost > 0) {
|
|
4405
|
+
info += `${theme.fg("dim", "Cost:")} $${stats.cost.toFixed(4)}\n`;
|
|
4406
|
+
}
|
|
4407
|
+
// Show top sessions by cost
|
|
4408
|
+
const topN = Math.min(stats.bySession.length, 5);
|
|
4409
|
+
info += `\n${theme.bold(`Top ${topN} Sessions`)}\n`;
|
|
4410
|
+
for (let i = 0; i < topN; i++) {
|
|
4411
|
+
const s = stats.bySession[i];
|
|
4412
|
+
if (!s || s.cost <= 0)
|
|
4413
|
+
continue;
|
|
4414
|
+
const label = s.name ?? s.cwd ?? s.id.slice(0, 8);
|
|
4415
|
+
const shortLabel = label.length > 30 ? `${label.slice(0, 28)}...` : label;
|
|
4416
|
+
info += `${theme.fg("dim", `${shortLabel}:`)} $${s.cost.toFixed(4)}\n`;
|
|
4417
|
+
}
|
|
4418
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
4419
|
+
this.chatContainer.addChild(new Text(info, 1, 0));
|
|
4420
|
+
this.ui.requestRender();
|
|
4421
|
+
}
|
|
4377
4422
|
handleMemoryCommand() {
|
|
4378
4423
|
const memory = this.session.resourceLoader.getMemory();
|
|
4379
4424
|
const memoryPath = path.join(this.sessionManager.getCwd(), ".pi", "memory", "MEMORY.md");
|