@narumitw/pi-analytics 0.48.1 → 0.49.0
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/package.json +2 -2
- package/src/menu.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-analytics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "Local-first usage analytics for Pi models, skills, tools, and reliability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@narumitw/pi-tui-kit": "^0.
|
|
32
|
+
"@narumitw/pi-tui-kit": "^0.46.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@earendil-works/pi-coding-agent": "*"
|
package/src/menu.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from "node:util";
|
|
2
2
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import {
|
|
3
|
+
import type { MenuDefinition } from "@narumitw/pi-tui-kit";
|
|
4
4
|
import type { ClearAnalyticsResult } from "./storage/files.js";
|
|
5
5
|
import type {
|
|
6
6
|
AnalyticsSnapshot,
|
|
@@ -50,7 +50,7 @@ export function createAnalyticsMenu(source: AnalyticsMenuDataSource, now: () =>
|
|
|
50
50
|
};
|
|
51
51
|
const getState = ({ signal }: { signal: AbortSignal }): Promise<AnalyticsMenuState> =>
|
|
52
52
|
loadState(signal);
|
|
53
|
-
const menu
|
|
53
|
+
const menu: MenuDefinition<AnalyticsMenuState, Screen, Action> = {
|
|
54
54
|
start: "main",
|
|
55
55
|
screens: {
|
|
56
56
|
main: ({ state }) => ({
|
|
@@ -142,7 +142,7 @@ export function createAnalyticsMenu(source: AnalyticsMenuDataSource, now: () =>
|
|
|
142
142
|
return signal.aborted ? { kind: "close" } : { kind: "to", screen: "main" };
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
|
-
}
|
|
145
|
+
};
|
|
146
146
|
return {
|
|
147
147
|
menu,
|
|
148
148
|
getState,
|
|
@@ -158,6 +158,8 @@ export async function showAnalyticsMenu(
|
|
|
158
158
|
source: AnalyticsMenuDataSource,
|
|
159
159
|
options: { signal: AbortSignal; isCurrent: () => boolean },
|
|
160
160
|
): Promise<void> {
|
|
161
|
+
const { runMenu, runTask } = await import("@narumitw/pi-tui-kit");
|
|
162
|
+
if (options.signal.aborted || !options.isCurrent()) return;
|
|
161
163
|
const controller = createAnalyticsMenu(source);
|
|
162
164
|
const loading = await runTask(ctx, {
|
|
163
165
|
label: "Loading local analytics…",
|