@pi-unipi/web-api 0.1.2 → 0.1.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/web-api",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Web search, read, and summarize tools with provider-based backend selection for Pi coding agent",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/commands.ts CHANGED
@@ -23,7 +23,7 @@ export function registerWebCommands(pi: ExtensionAPI): void {
23
23
  pi.registerCommand({
24
24
  name: `${UNIPI_PREFIX}${WEB_COMMANDS.SETTINGS}`,
25
25
  description: "Configure web API providers and API keys",
26
- async execute(_args, _ctx) {
26
+ handler: async (_args, _ctx) => {
27
27
  await showSettingsDialog(pi);
28
28
  },
29
29
  });
@@ -32,7 +32,7 @@ export function registerWebCommands(pi: ExtensionAPI): void {
32
32
  pi.registerCommand({
33
33
  name: `${UNIPI_PREFIX}${WEB_COMMANDS.CACHE_CLEAR}`,
34
34
  description: "Clear all cached web content",
35
- async execute(_args, _ctx) {
35
+ handler: async (_args, _ctx) => {
36
36
  const stats = webCache.getStats();
37
37
  const cleared = webCache.clear();
38
38
 
package/src/index.ts CHANGED
@@ -75,7 +75,16 @@ export default function (pi: ExtensionAPI) {
75
75
  name: "Web API",
76
76
  icon: "🌐",
77
77
  priority: 50,
78
- getData: async () => {
78
+ config: {
79
+ showByDefault: true,
80
+ stats: [
81
+ { id: "providers", label: "Enabled Providers", show: true },
82
+ { id: "cacheEntries", label: "Cache Entries", show: true },
83
+ { id: "cacheSize", label: "Cache Size", show: true },
84
+ { id: "expired", label: "Expired Entries", show: true },
85
+ ],
86
+ },
87
+ dataProvider: async () => {
79
88
  const config = loadConfig();
80
89
  const stats = webCache.getStats();
81
90
  const enabledCount = Object.values(config.providers).filter(
@@ -83,10 +92,10 @@ export default function (pi: ExtensionAPI) {
83
92
  ).length;
84
93
 
85
94
  return {
86
- "Enabled Providers": enabledCount,
87
- "Cache Entries": stats.totalEntries,
88
- "Cache Size": `${(stats.totalSizeBytes / 1024).toFixed(1)} KB`,
89
- "Expired Entries": stats.expiredEntries,
95
+ providers: { value: String(enabledCount) },
96
+ cacheEntries: { value: String(stats.totalEntries) },
97
+ cacheSize: { value: `${(stats.totalSizeBytes / 1024).toFixed(1)} KB` },
98
+ expired: { value: String(stats.expiredEntries) },
90
99
  };
91
100
  },
92
101
  });