pi-mega-compact 0.4.3 → 0.4.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/extensions/mega-compact.ts +19 -10
- package/package.json +1 -1
|
@@ -333,19 +333,22 @@ export default function (pi: ExtensionAPI) {
|
|
|
333
333
|
const dedupStr = storageRate * 100 >= 10
|
|
334
334
|
? `${Math.round(storageRate * 100)}%`
|
|
335
335
|
: `${(storageRate * 100).toFixed(1)}%`;
|
|
336
|
-
// saved = cumulative original − stored
|
|
337
|
-
//
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
336
|
+
// saved = tokens removed from context (cumulative original − stored).
|
|
337
|
+
// Show BOTH this-session (rt.tokensSaved) and repo-wide-total
|
|
338
|
+
// (repo.tokensSaved) so the user sees per-session progress vs the running
|
|
339
|
+
// repo total. "used" = stored checkpoint tokens (repo.totalTokenEstimate
|
|
340
|
+
// vs st.totalTokenEstimate). Use "k" only at/above 1000 so small-but-real
|
|
341
|
+
// numbers stay visible (previously Math.round(x/1000) zeroed <1000).
|
|
342
|
+
const fmt = (x: number) => (x >= 1000 ? `${(x / 1000).toFixed(1)}k` : `${x}`);
|
|
343
|
+
const savedStr = `${fmt(rt.tokensSaved)} sess / ${fmt(repo.tokensSaved)} repo`;
|
|
344
|
+
const usedStr = `${fmt(st.totalTokenEstimate)} sess / ${fmt(repo.totalTokenEstimate)} repo`;
|
|
342
345
|
const agentStr = activeAgents > 0 ? ` │ 🤖 ${activeAgents} agent${activeAgents === 1 ? "" : "s"}` : "";
|
|
343
346
|
const turnStr = currentTurn > 0 ? ` │ turn ${currentTurn}` : "";
|
|
344
347
|
ctx.ui.setWidget(
|
|
345
348
|
WIDGET_KEY,
|
|
346
349
|
[
|
|
347
350
|
` ⚡ ${config.tier} │ ${tokStr}/${maxStr} tokens (${pctStr}) │ ${st.checkpointCount} chkpt${st.checkpointCount === 1 ? "" : "s"}${agentStr}${turnStr}`,
|
|
348
|
-
` ${triggerLabel} │ dedup: ${dedupStr} │ saved: ${savedStr}
|
|
351
|
+
` ${triggerLabel} │ dedup: ${dedupStr} │ used: ${usedStr} │ saved: ${savedStr}`,
|
|
349
352
|
],
|
|
350
353
|
{ placement: "aboveEditor" },
|
|
351
354
|
);
|
|
@@ -771,9 +774,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
771
774
|
|
|
772
775
|
/** Write a small ESM runner script that imports and launches the dashboard server. */
|
|
773
776
|
function writeRunnerScript(): void {
|
|
774
|
-
|
|
777
|
+
// The npm package ships SOURCE only (no dist/), so the launchable entry is
|
|
778
|
+
// the .ts file — not dashboard-server.js (which only exists after a local
|
|
779
|
+
// build). dashboard-server.ts imports only Node built-ins, so it loads under
|
|
780
|
+
// node's --experimental-strip-types without any other compiled code. The
|
|
781
|
+
// child is spawned with that flag (see the spawn below) so the import below
|
|
782
|
+
// resolves from the source install path.
|
|
783
|
+
const sourceServer = join(dirname(fileURLToPath(import.meta.url)), "dashboard-server.ts");
|
|
775
784
|
const script = [
|
|
776
|
-
`import { launchDashboardServer } from ${JSON.stringify(
|
|
785
|
+
`import { launchDashboardServer } from ${JSON.stringify(sourceServer)};`,
|
|
777
786
|
`launchDashboardServer(${JSON.stringify(currentStateDir)}).catch(err => {`,
|
|
778
787
|
` console.error("[mega-compact] dashboard failed:", err);`,
|
|
779
788
|
` process.exit(1);`,
|
|
@@ -812,7 +821,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
812
821
|
ctx.ui.notify("[mega-compact] starting dashboard server…");
|
|
813
822
|
writeRunnerScript();
|
|
814
823
|
|
|
815
|
-
const child = spawn(process.execPath, [runnerFile], {
|
|
824
|
+
const child = spawn(process.execPath, ["--experimental-strip-types", runnerFile], {
|
|
816
825
|
detached: true,
|
|
817
826
|
stdio: "ignore",
|
|
818
827
|
});
|
package/package.json
CHANGED