@chrysb/alphaclaw 0.8.5 → 0.8.6

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 (30) hide show
  1. package/lib/public/css/explorer.css +48 -0
  2. package/lib/public/css/shell.css +149 -0
  3. package/lib/public/css/tailwind.generated.css +1 -1
  4. package/lib/public/css/theme.css +265 -0
  5. package/lib/public/dist/app.bundle.js +2269 -2200
  6. package/lib/public/js/app.js +4 -0
  7. package/lib/public/js/components/icons.js +38 -0
  8. package/lib/public/js/components/models-tab/provider-auth-card.js +60 -49
  9. package/lib/public/js/components/models-tab/use-models.js +74 -9
  10. package/lib/public/js/components/models.js +52 -37
  11. package/lib/public/js/components/onboarding/use-welcome-codex.js +34 -24
  12. package/lib/public/js/components/onboarding/welcome-config.js +76 -10
  13. package/lib/public/js/components/onboarding/welcome-form-step.js +2 -7
  14. package/lib/public/js/components/onboarding/welcome-header.js +12 -14
  15. package/lib/public/js/components/onboarding/welcome-setup-step.js +3 -3
  16. package/lib/public/js/components/providers.js +53 -42
  17. package/lib/public/js/components/sidebar.js +9 -1
  18. package/lib/public/js/components/theme-toggle.js +113 -0
  19. package/lib/public/js/components/welcome/index.js +0 -2
  20. package/lib/public/js/components/welcome/use-welcome.js +101 -36
  21. package/lib/public/js/lib/codex-oauth-window.js +22 -0
  22. package/lib/public/js/lib/model-catalog.js +20 -0
  23. package/lib/public/js/lib/storage-keys.js +1 -1
  24. package/lib/public/login.html +8 -4
  25. package/lib/public/setup.html +9 -0
  26. package/lib/server/db/webhooks/index.js +48 -8
  27. package/lib/server/model-catalog-cache.js +251 -0
  28. package/lib/server/routes/models.js +14 -23
  29. package/lib/server/routes/webhooks.js +12 -1
  30. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  const { kFallbackOnboardingModels } = require("../constants");
2
+ const { createModelCatalogCache } = require("../model-catalog-cache");
2
3
 
3
4
  const runModelsGitSync = async (shellCmd) => {
4
5
  if (typeof shellCmd !== "function") return null;
@@ -22,6 +23,13 @@ const registerModelRoutes = ({
22
23
  readEnvFile,
23
24
  writeEnvFile,
24
25
  reloadEnv,
26
+ modelCatalogCache = createModelCatalogCache({
27
+ shellCmd,
28
+ gatewayEnv,
29
+ parseJsonFromNoisyOutput,
30
+ normalizeOnboardingModels,
31
+ fallbackModels: kFallbackOnboardingModels,
32
+ }),
25
33
  }) => {
26
34
  const upsertEnvVar = (items, key, value) => {
27
35
  const next = Array.isArray(items) ? [...items] : [];
@@ -154,29 +162,8 @@ const registerModelRoutes = ({
154
162
  // ── Existing CLI-backed catalog/status routes ──
155
163
 
156
164
  app.get("/api/models", async (req, res) => {
157
- try {
158
- const output = await shellCmd("openclaw models list --all --json", {
159
- env: gatewayEnv(),
160
- timeout: 20000,
161
- });
162
- const parsed = parseJsonFromNoisyOutput(output);
163
- const models = normalizeOnboardingModels(parsed?.models || []);
164
- if (models.length > 0) {
165
- return res.json({ ok: true, source: "openclaw", models });
166
- }
167
- return res.json({
168
- ok: true,
169
- source: "fallback",
170
- models: kFallbackOnboardingModels,
171
- });
172
- } catch (err) {
173
- console.error("[models] Failed to load dynamic models:", err.message);
174
- return res.json({
175
- ok: true,
176
- source: "fallback",
177
- models: kFallbackOnboardingModels,
178
- });
179
- }
165
+ const response = await modelCatalogCache.getCatalogResponse();
166
+ return res.json(response);
180
167
  });
181
168
 
182
169
  app.get("/api/models/status", async (req, res) => {
@@ -210,6 +197,7 @@ const registerModelRoutes = ({
210
197
  env: gatewayEnv(),
211
198
  timeout: 30000,
212
199
  });
200
+ modelCatalogCache.markStale();
213
201
  res.json({ ok: true });
214
202
  } catch (err) {
215
203
  res
@@ -286,6 +274,7 @@ const registerModelRoutes = ({
286
274
  authProfiles.syncConfigAuthReferencesForAgent(agentId);
287
275
 
288
276
  const syncWarning = await runModelsGitSync(shellCmd);
277
+ modelCatalogCache.markStale();
289
278
  res.json({
290
279
  ok: true,
291
280
  ...(syncWarning ? { syncWarning } : {}),
@@ -338,6 +327,7 @@ const registerModelRoutes = ({
338
327
  const agentId = req.query.agentId || undefined;
339
328
  authProfiles.upsertProfile(profileId, credential, agentId);
340
329
  syncEnvVarsForProfiles([{ id: profileId, ...credential }]);
330
+ modelCatalogCache.markStale();
341
331
  res.json({ ok: true });
342
332
  } catch (err) {
343
333
  res
@@ -359,6 +349,7 @@ const registerModelRoutes = ({
359
349
  try {
360
350
  const agentId = req.query.agentId || undefined;
361
351
  const removed = authProfiles.removeProfile(profileId, agentId);
352
+ modelCatalogCache.markStale();
362
353
  res.json({ ok: true, removed });
363
354
  } catch (err) {
364
355
  res
@@ -29,13 +29,24 @@ const mergeWebhookAndSummary = ({ webhook, summary }) => {
29
29
  const totalCount = Number(summary?.totalCount || 0);
30
30
  const errorCount = Number(summary?.errorCount || 0);
31
31
  const successCount = Number(summary?.successCount || 0);
32
+ const recentTotalCount = Number(summary?.recentTotalCount || 0);
33
+ const recentErrorCount = Number(summary?.recentErrorCount || 0);
34
+ const recentSuccessCount = Number(summary?.recentSuccessCount || 0);
35
+ const healthWindowSize = Number(summary?.healthWindowSize || 0);
32
36
  return {
33
37
  ...webhook,
34
38
  lastReceived: summary?.lastReceived || null,
35
39
  totalCount,
36
40
  successCount,
37
41
  errorCount,
38
- health: buildHealth({ totalCount, errorCount }),
42
+ recentTotalCount,
43
+ recentSuccessCount,
44
+ recentErrorCount,
45
+ healthWindowSize,
46
+ health: buildHealth({
47
+ totalCount: recentTotalCount || totalCount,
48
+ errorCount: recentTotalCount > 0 ? recentErrorCount : errorCount,
49
+ }),
39
50
  };
40
51
  };
41
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrysb/alphaclaw",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },