@pi-unipi/updater 3.0.0-alpha.24 → 3.0.0-alpha.25

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.ts +22 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/updater",
3
- "version": "3.0.0-alpha.24",
3
+ "version": "3.0.0-alpha.25",
4
4
  "description": "Auto-updater, changelog browser, and readme browser for Unipi — checks npm registry, renders CHANGELOG.md and README.md files in TUI overlays",
5
5
  "type": "module",
6
6
  "main": "index.ts",
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@pi-unipi/core": "3.0.0-alpha.24"
37
+ "@pi-unipi/core": "3.0.0-alpha.25"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@earendil-works/pi-coding-agent": "^0.87.1",
package/src/index.ts CHANGED
@@ -49,7 +49,7 @@ export default function updaterExtension(pi: ExtensionAPI): void {
49
49
  // Register info-screen group
50
50
  const infoRegistry = globalThis.__unipi_info_registry;
51
51
  if (infoRegistry) {
52
- let cachedResult: { currentVersion: string; latestVersion: string; updateAvailable: boolean; lastCheck: string } | null = null;
52
+ let cachedResult: { currentVersion: string; latestVersion: string; updateAvailable: boolean; lastCheck: string; checkedAt: number } | null = null;
53
53
 
54
54
  infoRegistry.registerGroup({
55
55
  id: "updater",
@@ -66,19 +66,31 @@ export default function updaterExtension(pi: ExtensionAPI): void {
66
66
  ],
67
67
  },
68
68
  dataProvider: async () => {
69
+ const cfg = loadConfig();
69
70
  if (!cachedResult) {
70
71
  return {
71
- current: VERSION,
72
- latest: "checking...",
73
- status: "⏳ Checking",
74
- lastCheck: "never",
72
+ current: { value: VERSION },
73
+ latest: { value: "checking…" },
74
+ status: { value: "checking" },
75
+ lastCheck: { value: "never" },
76
+ raw: { value: "", raw: { current: VERSION, latest: null, available: false, checkedAt: 0, mode: cfg.autoUpdate } },
75
77
  };
76
78
  }
77
79
  return {
78
- current: cachedResult.currentVersion,
79
- latest: cachedResult.latestVersion,
80
- status: cachedResult.updateAvailable ? "↑ Update available" : "✓ Up to date",
81
- lastCheck: cachedResult.lastCheck || "never",
80
+ current: { value: cachedResult.currentVersion },
81
+ latest: { value: cachedResult.latestVersion },
82
+ status: { value: cachedResult.updateAvailable ? "update available" : "up to date" },
83
+ lastCheck: { value: cachedResult.lastCheck || "never" },
84
+ raw: {
85
+ value: "",
86
+ raw: {
87
+ current: cachedResult.currentVersion,
88
+ latest: cachedResult.latestVersion,
89
+ available: cachedResult.updateAvailable,
90
+ checkedAt: cachedResult.checkedAt,
91
+ mode: cfg.autoUpdate,
92
+ },
93
+ },
82
94
  };
83
95
  },
84
96
  });
@@ -91,6 +103,7 @@ export default function updaterExtension(pi: ExtensionAPI): void {
91
103
  latestVersion: payload.latestVersion,
92
104
  updateAvailable: payload.updateAvailable,
93
105
  lastCheck: new Date().toLocaleTimeString(),
106
+ checkedAt: Date.now(),
94
107
  };
95
108
  emitEvent(pi, UNIPI_EVENTS.INFO_DATA_UPDATED, {
96
109
  groupId: "updater",