@clagentic/console 1.8.0 → 1.9.0-beta.1

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 (35) hide show
  1. package/lib/build-sha.json +2 -2
  2. package/lib/generated/claude-model-catalog.json +180 -0
  3. package/lib/model-catalog.js +202 -0
  4. package/lib/model-context-windows.js +9 -0
  5. package/lib/model-families.js +243 -0
  6. package/lib/project-connection.js +16 -4
  7. package/lib/project-sessions.js +102 -18
  8. package/lib/project.js +4 -0
  9. package/lib/public/css/menus.css +67 -0
  10. package/lib/public/css/server-settings.css +72 -0
  11. package/lib/public/index.html +3 -0
  12. package/lib/public/modules/app-loop-ui.js +4 -0
  13. package/lib/public/modules/app-messages.js +29 -4
  14. package/lib/public/modules/app-panels.js +93 -24
  15. package/lib/public/modules/app-rate-limit.js +1 -1
  16. package/lib/public/modules/model-context-windows.js +9 -0
  17. package/lib/public/modules/model-families.js +230 -0
  18. package/lib/public/modules/project-settings.js +1 -0
  19. package/lib/public/modules/scheduler.js +5 -0
  20. package/lib/public/modules/server-settings.js +14 -12
  21. package/lib/public/modules/settings-defaults.js +151 -41
  22. package/lib/public/modules/tools.js +38 -0
  23. package/lib/sdk-bridge.js +88 -13
  24. package/lib/sdk-message-processor.js +128 -3
  25. package/lib/server.js +55 -0
  26. package/lib/session-activity.js +282 -0
  27. package/lib/sessions.js +58 -3
  28. package/lib/terminal-manager.js +40 -0
  29. package/lib/utils.js +44 -0
  30. package/lib/ws-schema.js +1 -0
  31. package/lib/yoke/adapters/claude-worker.js +6 -2
  32. package/lib/yoke/adapters/claude.js +377 -87
  33. package/lib/yoke/adapters/codex.js +20 -0
  34. package/package.json +1 -1
  35. package/scripts/generate-model-catalog.js +337 -0
@@ -573,6 +573,11 @@ function flattenEvent(notification, state) {
573
573
  // Exported so tests import and call the real function rather than
574
574
  // inlining a copy — reverting the || queryOpts.defaultModel term
575
575
  // in codex.js will break those tests. (lr-a7e7)
576
+ //
577
+ // The "gpt-5.5" literal is a fallback-only last resort (lr-d91ecf): used
578
+ // only when neither the query nor the adapter supplies a model at all,
579
+ // which should not happen in normal operation (the adapter always resolves
580
+ // a default from CODEX_DEFAULT_MODELS or the live model/list response).
576
581
  function _test_resolveModel(queryOpts) {
577
582
  return queryOpts.model || queryOpts.defaultModel || "gpt-5.5";
578
583
  }
@@ -1153,6 +1158,12 @@ function createCodexQueryHandle(appServer, queryOpts) {
1153
1158
  var CODEX_EFFORT_LEVELS = ["minimal", "low", "medium", "high", "xhigh"];
1154
1159
  var CODEX_EFFORT_LEVELS_STANDARD = ["low", "medium", "high"]; // models without xhigh/minimal
1155
1160
 
1161
+ // Fallback table used only when the live "model/list" RPC fails or returns
1162
+ // nothing (see catch block below). This static list carries no "upgrade"
1163
+ // signal from the app-server, so isLatest defaults true for every entry —
1164
+ // nothing is hidden behind the older-models disclosure when we have no basis
1165
+ // to tier it (lr-e03635: absence of signal must never manifest as a hidden
1166
+ // model).
1156
1167
  var CODEX_DEFAULT_MODELS = [
1157
1168
  {
1158
1169
  value: "gpt-5.5",
@@ -1160,6 +1171,7 @@ var CODEX_DEFAULT_MODELS = [
1160
1171
  supportsEffort: true,
1161
1172
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1162
1173
  supportsThinking: false,
1174
+ isLatest: true,
1163
1175
  },
1164
1176
  {
1165
1177
  value: "gpt-5.4",
@@ -1167,6 +1179,7 @@ var CODEX_DEFAULT_MODELS = [
1167
1179
  supportsEffort: true,
1168
1180
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1169
1181
  supportsThinking: false,
1182
+ isLatest: true,
1170
1183
  },
1171
1184
  {
1172
1185
  value: "gpt-5.4-mini",
@@ -1174,6 +1187,7 @@ var CODEX_DEFAULT_MODELS = [
1174
1187
  supportsEffort: true,
1175
1188
  supportedEffortLevels: CODEX_EFFORT_LEVELS_STANDARD,
1176
1189
  supportsThinking: false,
1190
+ isLatest: true,
1177
1191
  },
1178
1192
  {
1179
1193
  value: "gpt-5.3-codex",
@@ -1181,6 +1195,7 @@ var CODEX_DEFAULT_MODELS = [
1181
1195
  supportsEffort: true,
1182
1196
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1183
1197
  supportsThinking: false,
1198
+ isLatest: true,
1184
1199
  },
1185
1200
  {
1186
1201
  value: "gpt-5.3-codex-spark",
@@ -1188,6 +1203,7 @@ var CODEX_DEFAULT_MODELS = [
1188
1203
  supportsEffort: true,
1189
1204
  supportedEffortLevels: CODEX_EFFORT_LEVELS_STANDARD,
1190
1205
  supportsThinking: false,
1206
+ isLatest: true,
1191
1207
  },
1192
1208
  {
1193
1209
  value: "gpt-5.2",
@@ -1195,6 +1211,7 @@ var CODEX_DEFAULT_MODELS = [
1195
1211
  supportsEffort: true,
1196
1212
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1197
1213
  supportsThinking: false,
1214
+ isLatest: true,
1198
1215
  },
1199
1216
  ];
1200
1217
 
@@ -1205,6 +1222,9 @@ function createCodexAdapter(opts) {
1205
1222
  var _slug = (opts && opts.slug) || "";
1206
1223
  var _defaultInitOpts = Object.assign({}, opts || {});
1207
1224
  var _cachedModels = [];
1225
+ // Fallback-only (lr-d91ecf): the initial value before init()/warmup
1226
+ // populates _cachedModels from the live model/list RPC or
1227
+ // CODEX_DEFAULT_MODELS. Overwritten as soon as either succeeds.
1208
1228
  var _defaultModel = "gpt-5.5";
1209
1229
  var _appServer = null;
1210
1230
  var _initPromise = null;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.0",
6
+ "version": "1.9.0-beta.1",
7
7
  "description": "Self-hosted console for Claude Code and Codex. Multi-user, browser-based, persistent AI sessions.",
8
8
  "bin": {
9
9
  "clagentic-console": "./bin/cli.js"
@@ -0,0 +1,337 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // generate-model-catalog.js — release-time generator for
5
+ // lib/generated/claude-model-catalog.json (lr-f22787).
6
+ //
7
+ // Runs ONLY in CI (.github/workflows/release.yml, `stable` job), never at
8
+ // install time or runtime. Calls GET https://api.anthropic.com/v1/models
9
+ // using ANTHROPIC_API_KEY from the environment (injected as a GitHub
10
+ // Actions repo secret — never present on the operator's machine, never read
11
+ // by the daemon). This is NOT an LLM call (workspace CLAUDE.md rule 17 only
12
+ // governs the `claude` CLI invocation path for actual model inference), so
13
+ // using fetch() directly here does not violate the CLI-only rule.
14
+ //
15
+ // DESIGN DECISIONS (see PR body for lr-f22787 for the full write-up):
16
+ //
17
+ // (a) RETIRED MODELS — ADDITIVE, never overwrite. This script unions the
18
+ // freshly-fetched model list with whatever is already committed in
19
+ // lib/generated/claude-model-catalog.json. A model /v1/models stops
20
+ // returning (retired) stays in the catalog rather than disappearing
21
+ // out from under an operator who might still be running it — the
22
+ // picker's "Catalog" badge marks it as unconfirmed-live rather than
23
+ // hiding it.
24
+ //
25
+ // (b) MISSING SECRET / FETCH FAILURE — never fail the build, never emit an
26
+ // empty catalog. If ANTHROPIC_API_KEY is absent, or the API call
27
+ // returns any non-2xx status (401/402/403/429/5xx) or a network error,
28
+ // this script now falls through to the credential-free deprecations-
29
+ // page source (see "FALLBACK SOURCE" below) instead of giving up
30
+ // immediately — this is what lets the very first release (before the
31
+ // operator has wired the secret) still produce a real, non-degenerate
32
+ // catalog rather than shipping only the empty/minimal state. Only if
33
+ // BOTH sources fail does this script log a warning and exit 0 WITHOUT
34
+ // touching the existing committed catalog file — the release proceeds
35
+ // shipping the previously generated catalog. Stale is an acceptable,
36
+ // visible-in-git-history degradation; empty is not.
37
+ //
38
+ // (c) The catalog itself carries no "deprecated" flag from the vendor
39
+ // response (GET /v1/models simply omits retired IDs — see task
40
+ // ground truth). Distinguishing "confirmed still in the vendor's live
41
+ // list" from "carried forward from a previous generation, not
42
+ // reconfirmed this run" is out of scope for the wire format the picker
43
+ // consumes (lib/model-catalog.js's fromCatalog marker already
44
+ // distinguishes catalog-sourced entries from the vendor's live
45
+ // enumeration at runtime, which is the marker that actually matters to
46
+ // an operator deciding whether to trust a row).
47
+ //
48
+ // FALLBACK SOURCE — the public deprecations page (lr-f22787 follow-up,
49
+ // route (a)): if /v1/models is unreachable (missing key, or a non-2xx —
50
+ // 402/403/429/5xx), this script falls back to
51
+ // https://platform.claude.com/docs/en/about-claude/model-deprecations, a
52
+ // credential-free, server-rendered docs page. CONFIRMED against the live
53
+ // raw HTML (not the markdown-converted view a browsing tool would show) —
54
+ // the page has 11 real <table><tr><td> tables. Model IDs are NOT scattered
55
+ // as plain text: they appear ONLY as the text content of two specific
56
+ // widget shapes, both distinguishable from doc-site navigation noise
57
+ // (href="...claude-on-vertex-ai..." style path segments, changelog anchor
58
+ // slugs like "#2026-04-14-claude-sonnet-4-and-claude-opus-4-models", and
59
+ // prose link text like "whats-new-opus-5") by their exact tag/class
60
+ // signature:
61
+ // 1. The MAIN STATUS TABLE (<thead> columns: "API model name", "Current
62
+ // state", "Deprecated", "Tentative retirement date"): each <tr> has
63
+ // the model ID in td[0] as a click-to-copy
64
+ // <span ... data-state="closed" ...>MODEL_ID</span> widget, and the
65
+ // LITERAL STATUS ("Active" / "Deprecated" / "Retired" — confirmed
66
+ // verbatim against the live page, no other values appear in this
67
+ // column) as plain text in td[1]. This table is the authoritative
68
+ // status source (STATUS_TABLE_ROW_RE below).
69
+ // 2. Every per-release DEPRECATION-HISTORY TABLE ("Retirement date" /
70
+ // "Deprecated model" / "Recommended replacement" columns): td[1] and
71
+ // td[2] each hold a
72
+ // <code class="relative inline bg-neutral-30 ...">MODEL_ID</code> tag
73
+ // — td[1]'s ID is, by column meaning, always a deprecated/retired
74
+ // model (these are HISTORICAL superseded IDs, most of which never
75
+ // appear at all in the main status table because they retired before
76
+ // this doc revision); td[2]'s ID is the currently-recommended
77
+ // replacement. HISTORY_ROW_RE below captures both with that positional
78
+ // meaning (fallback status only used for an ID the main table doesn't
79
+ // already cover — see extractModelIdsFromHtml).
80
+ // A naive claude-[\w.-]+ scan over the raw page text (an earlier version of
81
+ // this script) also matched inside href attributes and link prose, pulling
82
+ // in dozens of doc-site slugs that are not model IDs at all (e.g.
83
+ // "claude-api-skill", "claude-on-vertex-ai", "claude-prompting-best-
84
+ // practices"). The row-scoped regexes below match only those two tag/class
85
+ // shapes, and MODEL_ID_VALUE_RE additionally requires the captured text
86
+ // itself to start with "claude-" (the last table on the page reuses the
87
+ // identical <code class="relative inline bg-neutral-30..."> class for
88
+ // non-model parameter names like "temperature"/"top_p"/"top_k", so
89
+ // tag-shape alone is not sufficient). This holds no hardcoded model ID
90
+ // list or status table — it is a structural extraction rule against the
91
+ // page's real, confirmed markup, so a future model release or a newly
92
+ // retired ID requires zero changes here (same discipline as
93
+ // model-families.js's family/version derivation).
94
+ //
95
+ // Row boundaries: the main status table's <span data-state="closed"...>
96
+ // opening tag contains an embedded literal newline in its class attribute
97
+ // (confirmed against the live page), so a per-LINE regex scan misses full
98
+ // rows there. STATUS_TABLE_ROW_RE / HISTORY_ROW_RE both use the `s` (dotall)
99
+ // flag and operate on the whole fetched HTML string, matching <tr>...</tr>
100
+ // boundaries directly rather than splitting into lines first.
101
+ const DEPRECATIONS_PAGE_URL = 'https://platform.claude.com/docs/en/about-claude/model-deprecations';
102
+ const MODEL_ID_VALUE_RE = /^claude-[a-z0-9][a-z0-9.-]*$/;
103
+ // Main status table row: captures the span-wrapped model ID (group 1) and
104
+ // the plain-text "Current state" cell (group 2) from the same <tr>.
105
+ const STATUS_TABLE_ROW_RE = /<tr\b[^>]*>\s*<td\b[^>]*><span\b[^>]*\bdata-state="closed"[^>]*>([^<]+)<\/span><\/td>\s*<td\b[^>]*>([^<]*)<\/td>/gs;
106
+ // Deprecation-history table row: captures the deprecated-model code tag
107
+ // (group 1) and the recommended-replacement code tag (group 2) from the
108
+ // same <tr> — td[0] (the retirement-date cell) is skipped by requiring
109
+ // exactly two <code>...</code> tags to follow it.
110
+ const HISTORY_ROW_RE = /<tr\b[^>]*>\s*<td\b[^>]*>[^<]*<\/td>\s*<td\b[^>]*><code\b[^>]*\bclass="[^"]*\bbg-neutral-30\b[^"]*"[^>]*>([^<]+)<\/code><\/td>\s*<td\b[^>]*><code\b[^>]*\bclass="[^"]*\bbg-neutral-30\b[^"]*"[^>]*>([^<]+)<\/code><\/td>/gs;
111
+ // Normalizes the page's three literal state strings to the catalog's
112
+ // lowercase status vocabulary (see STATUS_VALUES below). Anything else
113
+ // (should not happen against the confirmed page shape, but a doc-site
114
+ // wording change is not this script's business to guess at) falls back to
115
+ // "unknown" rather than silently mislabeling a model as active.
116
+ var STATUS_TABLE_TEXT_TO_STATUS = { Active: 'active', Deprecated: 'deprecated', Retired: 'retired' };
117
+
118
+ const fs = require('fs');
119
+ const path = require('path');
120
+
121
+ const CATALOG_PATH = path.join(__dirname, '..', 'lib', 'generated', 'claude-model-catalog.json');
122
+ const API_BASE = 'https://api.anthropic.com/v1/models';
123
+ const ANTHROPIC_VERSION = '2023-06-01';
124
+ const PAGE_LIMIT = 1000;
125
+
126
+ function readExistingCatalog() {
127
+ try {
128
+ const raw = fs.readFileSync(CATALOG_PATH, 'utf8');
129
+ const parsed = JSON.parse(raw);
130
+ if (parsed && Array.isArray(parsed.models)) return parsed.models;
131
+ } catch (e) {
132
+ // Missing or corrupt — treat as "nothing to union with" rather than failing.
133
+ }
134
+ return [];
135
+ }
136
+
137
+ // Paginate GET /v1/models fully via after_id, per the documented endpoint
138
+ // (supports after_id/before_id, limit up to 1000).
139
+ async function fetchAllModels(apiKey) {
140
+ const collected = [];
141
+ let afterId = null;
142
+ for (;;) {
143
+ const url = new URL(API_BASE);
144
+ url.searchParams.set('limit', String(PAGE_LIMIT));
145
+ if (afterId) url.searchParams.set('after_id', afterId);
146
+
147
+ const res = await fetch(url, {
148
+ headers: {
149
+ 'x-api-key': apiKey,
150
+ 'anthropic-version': ANTHROPIC_VERSION,
151
+ },
152
+ });
153
+
154
+ if (!res.ok) {
155
+ const text = await res.text().catch(() => '');
156
+ throw new Error(`GET /v1/models failed: ${res.status} ${res.statusText} ${text.slice(0, 300)}`);
157
+ }
158
+
159
+ const body = await res.json();
160
+ const page = Array.isArray(body.data) ? body.data : [];
161
+ for (const m of page) {
162
+ if (m && m.id) {
163
+ collected.push({
164
+ id: m.id,
165
+ displayName: m.display_name || m.id,
166
+ createdAt: m.created_at || null,
167
+ // GET /v1/models omits retired IDs outright (per the documented
168
+ // endpoint behavior, and the task's own established ground
169
+ // truth) — every entry it DOES return is, by construction,
170
+ // currently active. There is no separate "deprecated" flag on
171
+ // this endpoint to distinguish "active" from "deprecated but
172
+ // still listed" (unlike the deprecations-page fallback source,
173
+ // which has a real three-state column) — see status handling on
174
+ // the deprecations-page path below for that finer grain.
175
+ status: 'active',
176
+ });
177
+ }
178
+ }
179
+
180
+ if (!body.has_more || page.length === 0) break;
181
+ const last = page[page.length - 1];
182
+ if (!last || !last.id) break;
183
+ afterId = last.id;
184
+ }
185
+ return collected;
186
+ }
187
+
188
+ function unionModels(existing, fresh) {
189
+ const byId = {};
190
+ for (const m of existing) if (m && m.id) byId[m.id] = m;
191
+ for (const m of fresh) if (m && m.id) byId[m.id] = m; // fresh data wins on conflicting fields for the same ID
192
+ return Object.keys(byId).sort().map(function (id) { return byId[id]; });
193
+ }
194
+
195
+ // Extract every model ID from raw deprecations-page HTML, WITH its status
196
+ // (active/deprecated/retired/unknown), keyed by id. Scoped to the row
197
+ // shapes confirmed against the live page (see the header comment above) —
198
+ // never a bare text scan, which would also match navigation hrefs and
199
+ // changelog anchor slugs. Exported separately from the fetch so the
200
+ // extraction logic itself is unit-testable against a fixed HTML fixture
201
+ // without a network call.
202
+ //
203
+ // Precedence: the main status table is authoritative — if an ID appears
204
+ // there, its literal state wins outright. An ID that ONLY appears in a
205
+ // history table (never in the main table — i.e. it retired before this doc
206
+ // revision and dropped out of the main table entirely) is treated as
207
+ // "retired": that is exactly what a "Deprecated model" column entry with no
208
+ // corresponding main-table row means. A history-table "Recommended
209
+ // replacement" ID that doesn't otherwise appear is treated as "active" —
210
+ // the page recommends it as a live replacement.
211
+ function extractModelStatusesFromHtml(html) {
212
+ const statusById = {};
213
+
214
+ STATUS_TABLE_ROW_RE.lastIndex = 0;
215
+ let m;
216
+ while ((m = STATUS_TABLE_ROW_RE.exec(html)) !== null) {
217
+ const id = m[1].trim();
218
+ if (!MODEL_ID_VALUE_RE.test(id)) continue;
219
+ const stateText = m[2].trim();
220
+ statusById[id] = STATUS_TABLE_TEXT_TO_STATUS[stateText] || 'unknown';
221
+ }
222
+
223
+ HISTORY_ROW_RE.lastIndex = 0;
224
+ while ((m = HISTORY_ROW_RE.exec(html)) !== null) {
225
+ const deprecatedId = m[1].trim();
226
+ const replacementId = m[2].trim();
227
+ if (MODEL_ID_VALUE_RE.test(deprecatedId) && !statusById[deprecatedId]) {
228
+ statusById[deprecatedId] = 'retired';
229
+ }
230
+ if (MODEL_ID_VALUE_RE.test(replacementId) && !statusById[replacementId]) {
231
+ statusById[replacementId] = 'active';
232
+ }
233
+ }
234
+
235
+ return statusById;
236
+ }
237
+
238
+ // Backward-compat convenience wrapper: just the sorted id list, no status.
239
+ // Kept because it's a simpler surface for anything that only needs
240
+ // membership, not status (and to avoid breaking any external caller of the
241
+ // original extraction function's name/shape).
242
+ function extractModelIdsFromHtml(html) {
243
+ return Object.keys(extractModelStatusesFromHtml(html)).sort();
244
+ }
245
+
246
+ // Fetch the credential-free deprecations page and extract every model ID it
247
+ // lists, with status, via extractModelStatusesFromHtml.
248
+ async function fetchDeprecationsPageModels() {
249
+ const res = await fetch(DEPRECATIONS_PAGE_URL);
250
+ if (!res.ok) {
251
+ throw new Error(`GET ${DEPRECATIONS_PAGE_URL} failed: ${res.status} ${res.statusText}`);
252
+ }
253
+ const html = await res.text();
254
+ const statusById = extractModelStatusesFromHtml(html);
255
+ return Object.keys(statusById).sort().map(function (id) {
256
+ return { id: id, displayName: id, createdAt: null, status: statusById[id] };
257
+ });
258
+ }
259
+
260
+ // Resolves the freshest model list this run, trying the authoritative API
261
+ // first and falling back to the credential-free deprecations page. Returns
262
+ // { fresh, source } or null when NEITHER source produced anything usable —
263
+ // the caller treats null as "leave the committed catalog untouched."
264
+ async function resolveFreshModels() {
265
+ const apiKey = process.env.ANTHROPIC_API_KEY;
266
+ if (apiKey) {
267
+ try {
268
+ const fresh = await fetchAllModels(apiKey);
269
+ if (fresh.length) return { fresh: fresh, source: 'anthropic-api' };
270
+ console.warn('[generate-model-catalog] GET /v1/models returned zero entries — falling back to the deprecations page.');
271
+ } catch (err) {
272
+ console.warn('[generate-model-catalog] GET /v1/models failed — falling back to the deprecations page: ' + (err.message || err));
273
+ }
274
+ } else {
275
+ console.warn('[generate-model-catalog] ANTHROPIC_API_KEY not set — falling back to the deprecations page.');
276
+ }
277
+
278
+ try {
279
+ const fresh = await fetchDeprecationsPageModels();
280
+ if (fresh.length) return { fresh: fresh, source: 'deprecations-page' };
281
+ console.warn('[generate-model-catalog] deprecations-page fallback returned zero entries.');
282
+ } catch (err) {
283
+ console.warn('[generate-model-catalog] deprecations-page fallback failed: ' + (err.message || err));
284
+ }
285
+
286
+ return null;
287
+ }
288
+
289
+ async function main() {
290
+ const existing = readExistingCatalog();
291
+ const resolved = await resolveFreshModels();
292
+
293
+ if (!resolved) {
294
+ console.warn('[generate-model-catalog] no source produced a model list this run — leaving the committed catalog untouched (never ship an empty catalog).');
295
+ process.exit(0);
296
+ }
297
+
298
+ const merged = unionModels(existing, resolved.fresh);
299
+ const payload = {
300
+ generatedAt: new Date().toISOString(),
301
+ source: resolved.source,
302
+ models: merged,
303
+ };
304
+
305
+ fs.mkdirSync(path.dirname(CATALOG_PATH), { recursive: true });
306
+ fs.writeFileSync(CATALOG_PATH, JSON.stringify(payload, null, 2) + '\n');
307
+ console.log(`[generate-model-catalog] wrote ${CATALOG_PATH} (${merged.length} models, ${resolved.fresh.length} from this run via ${resolved.source}, ${existing.length} previously committed)`);
308
+ }
309
+
310
+ // Only run as a CLI entry point when invoked directly (CI / `node
311
+ // scripts/generate-model-catalog.js`) — requiring this file from a test
312
+ // must not trigger a real network call or process.exit().
313
+ if (require.main === module) {
314
+ main().catch(function (err) {
315
+ // Any unexpected error here is a bug in this script, not a vendor/secret
316
+ // condition — those are already handled above with a graceful exit(0).
317
+ // Fail loudly so it's visible in the workflow run, but this only affects
318
+ // catalog freshness, never the release itself (this script's exit code
319
+ // is not checked by the workflow step that invokes it — see release.yml).
320
+ console.error('[generate-model-catalog] unexpected error: ' + (err && err.stack || err));
321
+ process.exit(1);
322
+ });
323
+ }
324
+
325
+ module.exports = {
326
+ fetchAllModels: fetchAllModels,
327
+ fetchDeprecationsPageModels: fetchDeprecationsPageModels,
328
+ extractModelIdsFromHtml: extractModelIdsFromHtml,
329
+ extractModelStatusesFromHtml: extractModelStatusesFromHtml,
330
+ unionModels: unionModels,
331
+ readExistingCatalog: readExistingCatalog,
332
+ resolveFreshModels: resolveFreshModels,
333
+ CATALOG_PATH: CATALOG_PATH,
334
+ API_BASE: API_BASE,
335
+ DEPRECATIONS_PAGE_URL: DEPRECATIONS_PAGE_URL,
336
+ PAGE_LIMIT: PAGE_LIMIT,
337
+ };