@chrysb/alphaclaw 0.7.1 → 0.7.2-beta.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.
@@ -1158,6 +1158,18 @@
1158
1158
  background: rgba(255, 255, 255, 0.04);
1159
1159
  }
1160
1160
 
1161
+ .release-notes-preview {
1162
+ padding: 8px 12px 24px 14px;
1163
+ }
1164
+
1165
+ .release-notes-preview > :first-child {
1166
+ margin-top: 0;
1167
+ }
1168
+
1169
+ .release-notes-preview > :last-child {
1170
+ margin-bottom: 0;
1171
+ }
1172
+
1161
1173
  .file-viewer-editor-highlight-line-content .hl-comment {
1162
1174
  color: var(--comment);
1163
1175
  font-style: italic;
@@ -16,7 +16,7 @@ import { ErrorWarningLineIcon } from "../icons.js";
16
16
  const html = htm.bind(h);
17
17
  const kRecentRunFetchLimit = 100;
18
18
  const kRecentRunRowsLimit = 20;
19
- const kRecentRunCollapseThreshold = 5;
19
+ const kRecentRunCollapseThreshold = 2;
20
20
  const kTrendRange24h = "24h";
21
21
  const kTrendRange7d = "7d";
22
22
  const kTrendRange30d = "30d";
@@ -107,6 +107,7 @@ const buildCollapsedRunRows = (recentRuns = []) => {
107
107
  newestTs: Number(streak[0]?.ts || 0),
108
108
  oldestTs: Number(streak[streak.length - 1]?.ts || 0),
109
109
  statusCounts,
110
+ entries: streak,
110
111
  });
111
112
  index = streakEnd;
112
113
  continue;
@@ -41,6 +41,52 @@ const formatRowTimestamp = (timestampMs, variant = "overview") =>
41
41
  variant === "detail"
42
42
  ? formatDetailTimestamp(timestampMs)
43
43
  : formatOverviewTimestamp(timestampMs);
44
+ const renderEntrySummaryRow = ({ runEntry = {}, variant = "overview" }) => {
45
+ const runStatus = String(runEntry?.status || "unknown");
46
+ const runTokens = getCronRunTotalTokens(runEntry);
47
+ const runEstimatedCost = getCronRunEstimatedCost(runEntry);
48
+ const runTitle = String(runEntry?.jobName || "").trim();
49
+ const hasRunTitle = runTitle.length > 0;
50
+ const isDetail = variant === "detail";
51
+ return html`
52
+ <div class="ac-history-summary-row">
53
+ <span class="inline-flex items-center gap-2 min-w-0">
54
+ ${isDetail
55
+ ? html`
56
+ <span class="truncate text-xs text-gray-300">
57
+ ${formatRowTimestamp(runEntry.ts, variant)}
58
+ </span>
59
+ `
60
+ : hasRunTitle
61
+ ? html`
62
+ <span class="inline-flex items-center gap-2 min-w-0">
63
+ <span class="truncate text-xs text-gray-300">${runTitle}</span>
64
+ <span class="text-xs text-gray-500 shrink-0">
65
+ ${formatRowTimestamp(runEntry.ts, variant)}
66
+ </span>
67
+ </span>
68
+ `
69
+ : html`
70
+ <span class="truncate text-xs text-gray-300">
71
+ ${runEntry.jobId} - ${formatRowTimestamp(runEntry.ts, variant)}
72
+ </span>
73
+ `}
74
+ </span>
75
+ <span class="inline-flex items-center gap-3 shrink-0 text-xs">
76
+ <span class=${runStatusClassName(runStatus)}>${runStatus}</span>
77
+ <span class="text-gray-400">${formatDurationCompactMs(runEntry.durationMs)}</span>
78
+ <span class="text-gray-400">${formatTokenCount(runTokens)} tk</span>
79
+ ${isDetail
80
+ ? html`<span class="text-gray-500">${runDeliveryLabel(runEntry)}</span>`
81
+ : html`
82
+ <span class="text-gray-500">
83
+ ${runEstimatedCost == null ? "—" : `~${formatCost(runEstimatedCost)}`}
84
+ </span>
85
+ `}
86
+ </span>
87
+ </div>
88
+ `;
89
+ };
44
90
  const renderCollapsedGroupRow = ({ row, rowIndex, onSelectJob = () => {} }) => {
45
91
  const statusSummary = Object.entries(row.statusCounts || {})
46
92
  .map(([status, count]) => `${status}: ${count}`)
@@ -68,6 +114,20 @@ const renderCollapsedGroupRow = ({ row, rowIndex, onSelectJob = () => {} }) => {
68
114
  (${timeRangeLabel})
69
115
  </div>
70
116
  <div class="text-gray-500">Statuses: ${statusSummary}</div>
117
+ ${Array.isArray(row?.entries) && row.entries.length > 0
118
+ ? html`
119
+ <div class="ac-surface-inset rounded-lg px-2.5 py-1">
120
+ ${row.entries.map((runEntry, entryIndex) => html`
121
+ <div
122
+ key=${`collapsed-entry:${rowIndex}:${entryIndex}:${runEntry?.ts || 0}`}
123
+ class=${entryIndex > 0 ? "border-t border-border py-1.5" : "py-1.5"}
124
+ >
125
+ ${renderEntrySummaryRow({ runEntry, variant: "overview" })}
126
+ </div>
127
+ `)}
128
+ </div>
129
+ `
130
+ : null}
71
131
  ${row?.jobId
72
132
  ? html`
73
133
  <div>
@@ -94,7 +154,6 @@ const renderEntryRow = ({
94
154
  }) => {
95
155
  const runEntry = row?.entry || row || {};
96
156
  const runUsage = runEntry?.usage || {};
97
- const runStatus = String(runEntry?.status || "unknown");
98
157
  const runInputTokens = Number(
99
158
  runUsage?.input_tokens ?? runUsage?.inputTokens ?? 0,
100
159
  );
@@ -103,60 +162,17 @@ const renderEntryRow = ({
103
162
  );
104
163
  const runTokens = getCronRunTotalTokens(runEntry);
105
164
  const runEstimatedCost = getCronRunEstimatedCost(runEntry);
106
- const runTitle = String(runEntry?.jobName || "").trim();
107
- const hasRunTitle = runTitle.length > 0;
108
- const isDetail = variant === "detail";
109
165
  return html`
110
166
  <details
111
167
  key=${`entry:${rowIndex}:${runEntry.ts}:${runEntry.jobId || ""}`}
112
168
  class="ac-history-item"
113
169
  >
114
170
  <summary class="ac-history-summary">
115
- <div class="ac-history-summary-row">
116
- <span class="inline-flex items-center gap-2 min-w-0">
117
- <span class="ac-history-toggle shrink-0" aria-hidden="true">▸</span>
118
- ${isDetail
119
- ? html`
120
- <span class="truncate text-xs text-gray-300">
121
- ${formatRowTimestamp(runEntry.ts, variant)}
122
- </span>
123
- `
124
- : hasRunTitle
125
- ? html`
126
- <span class="inline-flex items-center gap-2 min-w-0">
127
- <span class="truncate text-xs text-gray-300"
128
- >${runTitle}</span
129
- >
130
- <span class="text-xs text-gray-500 shrink-0">
131
- ${formatRowTimestamp(runEntry.ts, variant)}
132
- </span>
133
- </span>
134
- `
135
- : html`
136
- <span class="truncate text-xs text-gray-300">
137
- ${runEntry.jobId} -
138
- ${formatRowTimestamp(runEntry.ts, variant)}
139
- </span>
140
- `}
141
- </span>
142
- <span class="inline-flex items-center gap-3 shrink-0 text-xs">
143
- <span class=${runStatusClassName(runStatus)}>${runStatus}</span>
144
- <span class="text-gray-400"
145
- >${formatDurationCompactMs(runEntry.durationMs)}</span
146
- >
147
- <span class="text-gray-400">${formatTokenCount(runTokens)} tk</span>
148
- ${isDetail
149
- ? html`<span class="text-gray-500"
150
- >${runDeliveryLabel(runEntry)}</span
151
- >`
152
- : html`
153
- <span class="text-gray-500"
154
- >${runEstimatedCost == null
155
- ? "—"
156
- : `~${formatCost(runEstimatedCost)}`}</span
157
- >
158
- `}
159
- </span>
171
+ <div class="inline-flex items-center gap-2 min-w-0 w-full">
172
+ <span class="ac-history-toggle shrink-0" aria-hidden="true">▸</span>
173
+ <div class="min-w-0 flex-1">
174
+ ${renderEntrySummaryRow({ runEntry, variant })}
175
+ </div>
160
176
  </div>
161
177
  </summary>
162
178
  <div class="ac-history-body space-y-2 text-xs">
@@ -6,6 +6,7 @@ import { FileTree } from "./file-tree.js";
6
6
  import { OverflowMenu, OverflowMenuItem } from "./overflow-menu.js";
7
7
  import { UpdateActionButton } from "./update-action-button.js";
8
8
  import { SidebarGitPanel } from "./sidebar-git-panel.js";
9
+ import { UpdateModal } from "./update-modal.js";
9
10
  import { readUiSettings, writeUiSettings } from "../lib/ui-settings.js";
10
11
 
11
12
  const html = htm.bind(h);
@@ -62,6 +63,7 @@ export const AppSidebar = ({
62
63
  readStoredBrowseBottomPanelHeight,
63
64
  );
64
65
  const [isResizingBrowsePanels, setIsResizingBrowsePanels] = useState(false);
66
+ const [updateModalOpen, setUpdateModalOpen] = useState(false);
65
67
 
66
68
  useEffect(() => {
67
69
  const settings = readUiSettings();
@@ -237,10 +239,10 @@ export const AppSidebar = ({
237
239
  `,
238
240
  )}
239
241
  <div class="sidebar-footer">
240
- ${acHasUpdate && acLatest && selectedNavId === "general"
242
+ ${acHasUpdate && acLatest
241
243
  ? html`
242
244
  <${UpdateActionButton}
243
- onClick=${onAcUpdate}
245
+ onClick=${() => setUpdateModalOpen(true)}
244
246
  loading=${acUpdating}
245
247
  warning=${true}
246
248
  idleLabel=${`Update to v${acLatest}`}
@@ -292,6 +294,16 @@ export const AppSidebar = ({
292
294
  </div>
293
295
  </div>
294
296
  </div>
297
+ <${UpdateModal}
298
+ visible=${updateModalOpen}
299
+ onClose=${() => {
300
+ if (acUpdating) return;
301
+ setUpdateModalOpen(false);
302
+ }}
303
+ version=${acLatest}
304
+ onUpdate=${onAcUpdate}
305
+ updating=${acUpdating}
306
+ />
295
307
  </div>
296
308
  `;
297
309
  };
@@ -0,0 +1,173 @@
1
+ import { h } from "https://esm.sh/preact";
2
+ import { useEffect, useMemo, useState } from "https://esm.sh/preact/hooks";
3
+ import htm from "https://esm.sh/htm";
4
+ import { marked } from "https://esm.sh/marked";
5
+ import { fetchAlphaclawReleaseNotes } from "../lib/api.js";
6
+ import { ModalShell } from "./modal-shell.js";
7
+ import { ActionButton } from "./action-button.js";
8
+ import { LoadingSpinner } from "./loading-spinner.js";
9
+ import { CloseIcon } from "./icons.js";
10
+
11
+ const html = htm.bind(h);
12
+
13
+ const getReleaseTagFromVersion = (version) => {
14
+ const rawVersion = String(version || "").trim();
15
+ if (!rawVersion) return "";
16
+ return rawVersion.startsWith("v") ? rawVersion : `v${rawVersion}`;
17
+ };
18
+
19
+ const formatPublishedAt = (value) => {
20
+ const dateMs = Date.parse(String(value || ""));
21
+ if (!Number.isFinite(dateMs)) return "";
22
+ try {
23
+ return new Intl.DateTimeFormat(undefined, {
24
+ dateStyle: "medium",
25
+ timeStyle: "short",
26
+ }).format(new Date(dateMs));
27
+ } catch {
28
+ return "";
29
+ }
30
+ };
31
+
32
+ const getReleaseUrl = (tag) =>
33
+ tag
34
+ ? `https://github.com/chrysb/alphaclaw/releases/tag/${encodeURIComponent(tag)}`
35
+ : "https://github.com/chrysb/alphaclaw/releases";
36
+
37
+ export const UpdateModal = ({
38
+ visible = false,
39
+ onClose = () => {},
40
+ version = "",
41
+ onUpdate = () => {},
42
+ updating = false,
43
+ }) => {
44
+ const requestedTag = useMemo(() => getReleaseTagFromVersion(version), [version]);
45
+ const [loadingNotes, setLoadingNotes] = useState(false);
46
+ const [notesError, setNotesError] = useState("");
47
+ const [notesData, setNotesData] = useState(null);
48
+
49
+ useEffect(() => {
50
+ if (!visible) return;
51
+ let isActive = true;
52
+ const loadNotes = async () => {
53
+ setLoadingNotes(true);
54
+ setNotesError("");
55
+ try {
56
+ const data = await fetchAlphaclawReleaseNotes(requestedTag);
57
+ if (!isActive) return;
58
+ if (!data?.ok) {
59
+ setNotesError(data?.error || "Could not load release notes");
60
+ setNotesData(null);
61
+ return;
62
+ }
63
+ setNotesData(data);
64
+ } catch (err) {
65
+ if (!isActive) return;
66
+ setNotesError(err?.message || "Could not load release notes");
67
+ setNotesData(null);
68
+ } finally {
69
+ if (!isActive) return;
70
+ setLoadingNotes(false);
71
+ }
72
+ };
73
+ loadNotes();
74
+ return () => {
75
+ isActive = false;
76
+ };
77
+ }, [visible, requestedTag]);
78
+
79
+ const effectiveTag = String(notesData?.tag || requestedTag || "").trim();
80
+ const effectiveReleaseUrl =
81
+ String(notesData?.htmlUrl || "").trim() || getReleaseUrl(effectiveTag);
82
+ const updateLabel = effectiveTag ? `Update to ${effectiveTag}` : "Update now";
83
+ const publishedAtLabel = formatPublishedAt(notesData?.publishedAt);
84
+ const releaseBody = String(notesData?.body || "").trim();
85
+ const releasePreviewHtml = useMemo(
86
+ () =>
87
+ marked.parse(releaseBody, {
88
+ gfm: true,
89
+ breaks: true,
90
+ }),
91
+ [releaseBody],
92
+ );
93
+
94
+ return html`
95
+ <${ModalShell}
96
+ visible=${visible}
97
+ onClose=${onClose}
98
+ panelClassName="relative bg-modal border border-border rounded-xl p-5 w-full max-w-3xl max-h-[92vh] overflow-hidden flex flex-col gap-4"
99
+ >
100
+ <button
101
+ type="button"
102
+ onclick=${onClose}
103
+ class="absolute top-5 right-5 h-8 w-8 inline-flex items-center justify-center rounded-lg ac-btn-secondary"
104
+ aria-label="Close modal"
105
+ >
106
+ <${CloseIcon} className="w-3.5 h-3.5 text-gray-300" />
107
+ </button>
108
+ <div class="space-y-1 pr-10">
109
+ <h3 class="text-sm font-semibold">AlphaClaw release notes</h3>
110
+ ${publishedAtLabel
111
+ ? html`<p class="text-xs text-gray-500">Published ${publishedAtLabel}</p>`
112
+ : null}
113
+ </div>
114
+ <div class="ac-surface-inset border border-border rounded-lg p-2 overflow-auto min-h-[220px] max-h-[66vh]">
115
+ ${loadingNotes
116
+ ? html`
117
+ <div class="min-h-[200px] flex items-center justify-center text-gray-400">
118
+ <span class="inline-flex items-center gap-2 text-sm">
119
+ <${LoadingSpinner} className="h-4 w-4" />
120
+ Loading release notes...
121
+ </span>
122
+ </div>
123
+ `
124
+ : notesError
125
+ ? html`
126
+ <div class="space-y-2">
127
+ <p class="text-sm text-red-300">${notesError}</p>
128
+ <a
129
+ class="ac-tip-link text-xs"
130
+ href=${effectiveReleaseUrl}
131
+ target="_blank"
132
+ rel="noreferrer"
133
+ >View release on GitHub</a
134
+ >
135
+ </div>
136
+ `
137
+ : releaseBody
138
+ ? html`<div
139
+ class="file-viewer-preview release-notes-preview"
140
+ dangerouslySetInnerHTML=${{ __html: releasePreviewHtml }}
141
+ ></div>`
142
+ : html`
143
+ <div class="space-y-2">
144
+ <p class="text-sm text-gray-300">No release notes were published for this tag.</p>
145
+ <a
146
+ class="ac-tip-link text-xs"
147
+ href=${effectiveReleaseUrl}
148
+ target="_blank"
149
+ rel="noreferrer"
150
+ >Open release on GitHub</a
151
+ >
152
+ </div>
153
+ `}
154
+ </div>
155
+ <div class="flex items-center justify-end gap-2 pt-1">
156
+ <${ActionButton}
157
+ onClick=${onClose}
158
+ tone="ghost"
159
+ idleLabel="Later"
160
+ disabled=${updating}
161
+ />
162
+ <${ActionButton}
163
+ onClick=${onUpdate}
164
+ tone="warning"
165
+ idleLabel=${updateLabel}
166
+ loadingLabel="Updating..."
167
+ loading=${updating}
168
+ disabled=${loadingNotes}
169
+ />
170
+ </div>
171
+ </${ModalShell}>
172
+ `;
173
+ };
@@ -450,6 +450,42 @@ export async function fetchAlphaclawVersion(refresh = false) {
450
450
  return res.json();
451
451
  }
452
452
 
453
+ export async function fetchAlphaclawReleaseNotes(tag = "") {
454
+ const normalizedTag = String(tag || "").trim();
455
+ const query = normalizedTag
456
+ ? `?${new URLSearchParams({ tag: normalizedTag }).toString()}`
457
+ : "";
458
+ try {
459
+ const res = await authFetch(`/api/alphaclaw/release-notes${query}`);
460
+ return await parseJsonOrThrow(res, "Could not load release notes");
461
+ } catch {
462
+ const endpoint = normalizedTag
463
+ ? `https://api.github.com/repos/chrysb/alphaclaw/releases/tags/${encodeURIComponent(normalizedTag)}`
464
+ : "https://api.github.com/repos/chrysb/alphaclaw/releases/latest";
465
+ const res = await fetch(endpoint, {
466
+ headers: { Accept: "application/vnd.github+json" },
467
+ });
468
+ const text = await res.text();
469
+ let data = null;
470
+ try {
471
+ data = text ? JSON.parse(text) : null;
472
+ } catch {
473
+ throw new Error(text || "Could not load release notes");
474
+ }
475
+ if (!res.ok) {
476
+ throw new Error(data?.message || text || "Could not load release notes");
477
+ }
478
+ return {
479
+ ok: true,
480
+ tag: String(data?.tag_name || normalizedTag || ""),
481
+ name: String(data?.name || ""),
482
+ body: String(data?.body || ""),
483
+ htmlUrl: String(data?.html_url || ""),
484
+ publishedAt: String(data?.published_at || ""),
485
+ };
486
+ }
487
+ }
488
+
453
489
  export async function updateAlphaclaw() {
454
490
  const res = await authFetch("/api/alphaclaw/update", { method: "POST" });
455
491
  return res.json();
@@ -137,6 +137,8 @@ const kVersionCacheTtlMs = 60 * 1000;
137
137
  const kLatestVersionCacheTtlMs = 10 * 60 * 1000;
138
138
  const kOpenclawRegistryUrl = "https://registry.npmjs.org/openclaw";
139
139
  const kAlphaclawRegistryUrl = "https://registry.npmjs.org/@chrysb%2falphaclaw";
140
+ const kAlphaclawGithubReleasesBaseUrl =
141
+ "https://api.github.com/repos/chrysb/alphaclaw/releases";
140
142
  const kAppDir = kNpmPackageRoot;
141
143
  const kMaxPayloadBytes = parsePositiveInt(process.env.WEBHOOK_LOG_MAX_BYTES, 50 * 1024);
142
144
  const kWebhookPruneDays = parsePositiveInt(process.env.WEBHOOK_LOG_RETENTION_DAYS, 30);
@@ -424,6 +426,7 @@ module.exports = {
424
426
  kLatestVersionCacheTtlMs,
425
427
  kOpenclawRegistryUrl,
426
428
  kAlphaclawRegistryUrl,
429
+ kAlphaclawGithubReleasesBaseUrl,
427
430
  kAppDir,
428
431
  kMaxPayloadBytes,
429
432
  kWebhookPruneDays,
@@ -124,6 +124,7 @@ const registerServerRoutes = ({
124
124
  getChannelStatus,
125
125
  openclawVersionService,
126
126
  alphaclawVersionService,
127
+ kAlphaclawGithubReleasesBaseUrl: constants.kAlphaclawGithubReleasesBaseUrl,
127
128
  clawCmd,
128
129
  restartGateway,
129
130
  OPENCLAW_DIR: constants.OPENCLAW_DIR,
@@ -1,6 +1,7 @@
1
1
  const { buildManagedPaths } = require("../internal-files-migration");
2
2
  const { readOpenclawConfig } = require("../openclaw-config");
3
3
  const { hasScopedBindingFields } = require("../utils/channels");
4
+ const https = require("https");
4
5
 
5
6
  const registerSystemRoutes = ({
6
7
  app,
@@ -17,6 +18,7 @@ const registerSystemRoutes = ({
17
18
  getChannelStatus,
18
19
  openclawVersionService,
19
20
  alphaclawVersionService,
21
+ kAlphaclawGithubReleasesBaseUrl,
20
22
  clawCmd,
21
23
  restartGateway,
22
24
  OPENCLAW_DIR,
@@ -289,6 +291,71 @@ const registerSystemRoutes = ({
289
291
  return getSystemCronStatus();
290
292
  };
291
293
  const isVisibleInEnvars = (def) => def?.visibleInEnvars !== false;
294
+ const kReleaseNotesCacheTtlMs = 5 * 60 * 1000;
295
+ let kReleaseNotesCache = {
296
+ key: "",
297
+ fetchedAt: 0,
298
+ payload: null,
299
+ };
300
+ const isValidReleaseTag = (value) =>
301
+ /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(String(value || ""));
302
+ const fetchGitHubRelease = (tag = "") =>
303
+ new Promise((resolve, reject) => {
304
+ const normalizedTag = String(tag || "").trim();
305
+ const endpointPath = normalizedTag
306
+ ? `/tags/${encodeURIComponent(normalizedTag)}`
307
+ : "/latest";
308
+ const requestUrl = `${kAlphaclawGithubReleasesBaseUrl}${endpointPath}`;
309
+ const token = String(process.env.GITHUB_TOKEN || "").trim();
310
+ const headers = {
311
+ Accept: "application/vnd.github+json",
312
+ "User-Agent": "alphaclaw-release-notes",
313
+ };
314
+ if (token) headers.Authorization = `Bearer ${token}`;
315
+ const request = https.get(
316
+ requestUrl,
317
+ { headers, timeout: 7000 },
318
+ (response) => {
319
+ let raw = "";
320
+ response.setEncoding("utf8");
321
+ response.on("data", (chunk) => {
322
+ raw += chunk;
323
+ });
324
+ response.on("end", () => {
325
+ let parsed = null;
326
+ try {
327
+ parsed = raw ? JSON.parse(raw) : null;
328
+ } catch {
329
+ parsed = null;
330
+ }
331
+ const statusCode = Number(response.statusCode) || 500;
332
+ if (statusCode >= 400) {
333
+ const message =
334
+ parsed?.message ||
335
+ `GitHub release lookup failed with status ${statusCode}`;
336
+ return reject(
337
+ Object.assign(new Error(message), {
338
+ statusCode,
339
+ }),
340
+ );
341
+ }
342
+ resolve({
343
+ tag: String(parsed?.tag_name || normalizedTag || ""),
344
+ name: String(parsed?.name || "").trim(),
345
+ body: String(parsed?.body || ""),
346
+ htmlUrl: String(parsed?.html_url || "").trim(),
347
+ publishedAt: String(parsed?.published_at || "").trim(),
348
+ });
349
+ });
350
+ },
351
+ );
352
+ request.on("timeout", () => {
353
+ request.destroy(new Error("GitHub release request timed out"));
354
+ });
355
+ request.on("error", (error) => {
356
+ reject(error);
357
+ });
358
+ });
292
359
 
293
360
  app.get("/api/env", (req, res) => {
294
361
  const fileVars = readEnvFile();
@@ -466,6 +533,37 @@ const registerSystemRoutes = ({
466
533
  res.json(status);
467
534
  });
468
535
 
536
+ app.get("/api/alphaclaw/release-notes", async (req, res) => {
537
+ const requestedTag = String(req.query.tag || "").trim();
538
+ if (requestedTag && !isValidReleaseTag(requestedTag)) {
539
+ return res.status(400).json({ ok: false, error: "Invalid release tag" });
540
+ }
541
+ const cacheKey = requestedTag || "latest";
542
+ const now = Date.now();
543
+ if (
544
+ kReleaseNotesCache.payload &&
545
+ kReleaseNotesCache.key === cacheKey &&
546
+ now - kReleaseNotesCache.fetchedAt < kReleaseNotesCacheTtlMs
547
+ ) {
548
+ return res.json({ ok: true, ...kReleaseNotesCache.payload });
549
+ }
550
+ try {
551
+ const payload = await fetchGitHubRelease(requestedTag);
552
+ kReleaseNotesCache = {
553
+ key: cacheKey,
554
+ fetchedAt: Date.now(),
555
+ payload,
556
+ };
557
+ return res.json({ ok: true, ...payload });
558
+ } catch (err) {
559
+ const statusCode = Number(err?.statusCode) || 502;
560
+ return res.status(statusCode).json({
561
+ ok: false,
562
+ error: err?.message || "Could not fetch release notes",
563
+ });
564
+ }
565
+ });
566
+
469
567
  app.post("/api/alphaclaw/update", async (req, res) => {
470
568
  console.log("[alphaclaw] /api/alphaclaw/update requested");
471
569
  const result = await alphaclawVersionService.updateAlphaclaw();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrysb/alphaclaw",
3
- "version": "0.7.1",
3
+ "version": "0.7.2-beta.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },