instar 0.7.48 → 0.7.50
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/dist/core/AutoUpdater.js
CHANGED
|
@@ -122,7 +122,8 @@ export class AutoUpdater {
|
|
|
122
122
|
if (!this.config.autoApply) {
|
|
123
123
|
// Just notify — don't apply
|
|
124
124
|
await this.notify(`Update available: v${info.currentVersion} → v${info.latestVersion}\n\n` +
|
|
125
|
-
(info.changeSummary ? `
|
|
125
|
+
(info.changeSummary ? `What changed:\n${info.changeSummary}\n\n` : '') +
|
|
126
|
+
`Details: ${info.changelogUrl || 'https://github.com/SageMindAI/instar/releases'}\n\n` +
|
|
126
127
|
`Auto-apply is disabled. Apply manually:\n` +
|
|
127
128
|
`curl -X POST http://localhost:${this.getPort()}/updates/apply`);
|
|
128
129
|
return;
|
|
@@ -147,13 +148,19 @@ export class AutoUpdater {
|
|
|
147
148
|
console.log(`[AutoUpdater] Updated: v${result.previousVersion} → v${result.newVersion}`);
|
|
148
149
|
// Step 5: Notify via Telegram
|
|
149
150
|
const restartNote = result.restartNeeded && this.config.autoRestart
|
|
150
|
-
? '
|
|
151
|
+
? '\nServer is restarting now...'
|
|
151
152
|
: result.restartNeeded
|
|
152
|
-
? '
|
|
153
|
+
? '\nA server restart is needed to use the new version.'
|
|
153
154
|
: '';
|
|
155
|
+
const changeSummary = info.changeSummary
|
|
156
|
+
? `What changed:\n${info.changeSummary}\n`
|
|
157
|
+
: '';
|
|
158
|
+
const detailsUrl = info.changelogUrl || 'https://github.com/SageMindAI/instar/releases';
|
|
154
159
|
await this.notify(`Updated: v${result.previousVersion} → v${result.newVersion}\n\n` +
|
|
155
|
-
|
|
156
|
-
|
|
160
|
+
changeSummary +
|
|
161
|
+
`Details: ${detailsUrl}\n` +
|
|
162
|
+
restartNote +
|
|
163
|
+
`\n\nTo disable auto-updates, set "autoApply": false in .instar/config.json under "updates".`);
|
|
157
164
|
// Step 6: Self-restart if needed and configured
|
|
158
165
|
if (result.restartNeeded && this.config.autoRestart) {
|
|
159
166
|
// Brief delay to let the Telegram notification send
|
|
@@ -60,7 +60,8 @@ export declare class UpdateChecker {
|
|
|
60
60
|
updatedAt: string;
|
|
61
61
|
} | null;
|
|
62
62
|
/**
|
|
63
|
-
* Fetch human-readable changelog from GitHub releases
|
|
63
|
+
* Fetch human-readable changelog from GitHub releases, falling back to
|
|
64
|
+
* recent commit messages if no release exists for this version.
|
|
64
65
|
*/
|
|
65
66
|
fetchChangelog(version: string): Promise<string | undefined>;
|
|
66
67
|
/**
|
|
@@ -226,9 +226,11 @@ export class UpdateChecker {
|
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
|
-
* Fetch human-readable changelog from GitHub releases
|
|
229
|
+
* Fetch human-readable changelog from GitHub releases, falling back to
|
|
230
|
+
* recent commit messages if no release exists for this version.
|
|
230
231
|
*/
|
|
231
232
|
async fetchChangelog(version) {
|
|
233
|
+
// Try GitHub release first
|
|
232
234
|
try {
|
|
233
235
|
const tag = version.startsWith('v') ? version : `v${version}`;
|
|
234
236
|
const response = await fetch(`${GITHUB_RELEASES_URL}/tags/${tag}`, {
|
|
@@ -238,16 +240,41 @@ export class UpdateChecker {
|
|
|
238
240
|
},
|
|
239
241
|
signal: AbortSignal.timeout(10000),
|
|
240
242
|
});
|
|
241
|
-
if (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
if (response.ok) {
|
|
244
|
+
const release = await response.json();
|
|
245
|
+
if (release.body) {
|
|
246
|
+
const summary = release.body.slice(0, 500);
|
|
247
|
+
return summary.length < release.body.length ? summary + '...' : summary;
|
|
248
|
+
}
|
|
249
|
+
if (release.name)
|
|
250
|
+
return release.name;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
// Non-critical — try commit fallback
|
|
255
|
+
}
|
|
256
|
+
// Fallback: fetch recent commits from GitHub
|
|
257
|
+
try {
|
|
258
|
+
const response = await fetch('https://api.github.com/repos/SageMindAI/instar/commits?per_page=5', {
|
|
259
|
+
headers: {
|
|
260
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
261
|
+
'User-Agent': 'instar-update-checker',
|
|
262
|
+
},
|
|
263
|
+
signal: AbortSignal.timeout(10000),
|
|
264
|
+
});
|
|
265
|
+
if (response.ok) {
|
|
266
|
+
const commits = await response.json();
|
|
267
|
+
if (commits.length > 0) {
|
|
268
|
+
const lines = commits
|
|
269
|
+
.map(c => {
|
|
270
|
+
// Take first line of commit message only
|
|
271
|
+
const firstLine = c.commit.message.split('\n')[0];
|
|
272
|
+
return `• ${firstLine}`;
|
|
273
|
+
})
|
|
274
|
+
.join('\n');
|
|
275
|
+
return `Recent changes:\n${lines}`;
|
|
276
|
+
}
|
|
248
277
|
}
|
|
249
|
-
if (release.name)
|
|
250
|
-
return release.name;
|
|
251
278
|
}
|
|
252
279
|
catch {
|
|
253
280
|
// Non-critical
|