@clagentic/console 1.3.1-beta.1 → 1.4.0-beta.2

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/lib/daemon.js CHANGED
@@ -1325,28 +1325,57 @@ var ipc = createIPCServer(socketPath(), function (msg) {
1325
1325
  // This is the only reliable path — npx installs to a cache location that the
1326
1326
  // restart wrapper does not consult, so npx-spawned daemons get replaced by the
1327
1327
  // old global version on the next supervised restart.
1328
- var { execFileSync: execFileUpd } = require("child_process");
1329
- var updTag = config.updateChannel === "beta" ? "beta" : "latest";
1330
- var updOk = false;
1331
- try {
1332
- console.log("[daemon] Installing @clagentic/console@" + updTag + " globally...");
1333
- execFileUpd("npm", ["install", "-g", "@clagentic/console@" + updTag], {
1334
- stdio: ["ignore", "pipe", "pipe"],
1335
- timeout: 120000,
1336
- encoding: "utf8",
1337
- });
1338
- console.log("[daemon] Global install complete. Shutting down for supervised restart.");
1339
- updOk = true;
1340
- } catch (updErr) {
1341
- console.log("[daemon] Global install failed:", updErr.message);
1342
- relay.broadcastAll({ type: "update_failed", error: updErr.message });
1343
- return { ok: false, error: updErr.message };
1344
- }
1345
- if (updOk) {
1346
- updateHandoff = true;
1347
- setTimeout(function () { gracefulShutdown(); }, 100);
1348
- }
1349
- return { ok: true };
1328
+ // Resolve + install asynchronously. ipc.js awaits a returned Promise, so
1329
+ // returning an async IIFE here is safe without changing the outer handler.
1330
+ return (async function () {
1331
+ var { execFileSync: execFileUpd } = require("child_process");
1332
+ var updater = require("./updater");
1333
+
1334
+ // Resolve the target version the same way the startup updater does, then
1335
+ // install that EXACT version — never a bare dist-tag. Installing @latest/
1336
+ // @beta is unsafe: the tag can point at an older version than what is
1337
+ // running (e.g. a beta machine whose @latest resolves to an older stable),
1338
+ // which silently downgrades the daemon. We mirror checkAndUpdate: on the
1339
+ // beta channel (or a pre-release current version) consider both beta and
1340
+ // latest and take the newest; on stable consider latest only. Then guard
1341
+ // with isNewer so a downgrade is impossible.
1342
+ var isBetaCh = config.updateChannel === "beta" || (daemonVersion && daemonVersion.includes("-"));
1343
+ var updTags = isBetaCh ? ["beta", "latest"] : ["latest"];
1344
+ var updTarget = null;
1345
+ for (var _ut = 0; _ut < updTags.length; _ut++) {
1346
+ var _cand = await updater.fetchVersion(updTags[_ut] === "beta" ? "beta" : "stable");
1347
+ if (_cand && (!updTarget || updater.isNewer(_cand, updTarget))) {
1348
+ updTarget = _cand;
1349
+ }
1350
+ }
1351
+
1352
+ if (!updTarget || !updater.isNewer(updTarget, daemonVersion)) {
1353
+ console.log("[daemon] No newer version available (current " + daemonVersion + ", best candidate " + (updTarget || "none") + "). Skipping update.");
1354
+ relay.broadcastAll({ type: "update_failed", error: "Already on the latest available version (" + daemonVersion + ")" });
1355
+ return { ok: false, error: "Already up to date (" + daemonVersion + ")" };
1356
+ }
1357
+
1358
+ var updOk = false;
1359
+ try {
1360
+ console.log("[daemon] Installing @clagentic/console@" + updTarget + " globally (current " + daemonVersion + ")...");
1361
+ execFileUpd("npm", ["install", "-g", "@clagentic/console@" + updTarget], {
1362
+ stdio: ["ignore", "pipe", "pipe"],
1363
+ timeout: 120000,
1364
+ encoding: "utf8",
1365
+ });
1366
+ console.log("[daemon] Global install complete. Shutting down for supervised restart.");
1367
+ updOk = true;
1368
+ } catch (updErr) {
1369
+ console.log("[daemon] Global install failed:", updErr.message);
1370
+ relay.broadcastAll({ type: "update_failed", error: updErr.message });
1371
+ return { ok: false, error: updErr.message };
1372
+ }
1373
+ if (updOk) {
1374
+ updateHandoff = true;
1375
+ setTimeout(function () { gracefulShutdown(); }, 100);
1376
+ }
1377
+ return { ok: true };
1378
+ })();
1350
1379
  }
1351
1380
 
1352
1381
  default:
@@ -901,9 +901,9 @@ function attachLoop(ctx) {
901
901
  loopState.phase = "crafting";
902
902
  saveLoopState();
903
903
 
904
- var judgeCraftPrompt = "Use the /clay-ralph skill to design ONLY a JUDGE.md for an existing Ralph Loop. " +
904
+ var judgeCraftPrompt = "Use the /ralph-loop skill to design ONLY a JUDGE.md for an existing Ralph Loop. " +
905
905
  "The user has already provided PROMPT.md, so do NOT create or modify PROMPT.md. " +
906
- "You MUST invoke the clay-ralph skill — do NOT execute the task yourself. " +
906
+ "You MUST invoke the ralph-loop skill — do NOT execute the task yourself. " +
907
907
  "Your job is to read the existing PROMPT.md and create a JUDGE.md " +
908
908
  "that will evaluate whether the coder session completed the task successfully.\n\n" +
909
909
  "## Task\n" + (wData.task || "") +
@@ -944,26 +944,26 @@ function attachLoop(ctx) {
944
944
  return true;
945
945
  }
946
946
 
947
- // Default: "draft" mode — crafts files via the clay-ralph skill
947
+ // Default: "draft" mode — crafts files via the ralph-loop skill
948
948
  var _draftIsSimple = wData.loopMode === "simple";
949
949
  var craftingPrompt;
950
950
  if (_draftIsSimple) {
951
- craftingPrompt = "Use the /clay-ralph skill to design a Ralph Loop for the following task. " +
952
- "You MUST invoke the clay-ralph skill — do NOT execute the task yourself. " +
951
+ craftingPrompt = "Use the /ralph-loop skill to design a Ralph Loop for the following task. " +
952
+ "You MUST invoke the ralph-loop skill — do NOT execute the task yourself. " +
953
953
  "This is a Simple Loop (no judge). Your job is to create ONLY a PROMPT.md file " +
954
954
  "that a future autonomous session will execute. Do NOT create a JUDGE.md file.\n\n" +
955
955
  "## Task\n" + (wData.task || "") +
956
956
  "\n\n## Loop Directory\n" + lDir;
957
957
  } else if (wData.judgeAuthor === "me") {
958
- craftingPrompt = "Use the /clay-ralph skill to design a Ralph Loop for the following task. " +
959
- "You MUST invoke the clay-ralph skill — do NOT execute the task yourself. " +
958
+ craftingPrompt = "Use the /ralph-loop skill to design a Ralph Loop for the following task. " +
959
+ "You MUST invoke the ralph-loop skill — do NOT execute the task yourself. " +
960
960
  "The user will provide their own JUDGE.md, so create ONLY a PROMPT.md file " +
961
961
  "that a future autonomous session will execute. Do NOT create a JUDGE.md file.\n\n" +
962
962
  "## Task\n" + (wData.task || "") +
963
963
  "\n\n## Loop Directory\n" + lDir;
964
964
  } else {
965
- craftingPrompt = "Use the /clay-ralph skill to design a Ralph Loop for the following task. " +
966
- "You MUST invoke the clay-ralph skill — do NOT execute the task yourself. " +
965
+ craftingPrompt = "Use the /ralph-loop skill to design a Ralph Loop for the following task. " +
966
+ "You MUST invoke the ralph-loop skill — do NOT execute the task yourself. " +
967
967
  "Your job is to interview me, then create PROMPT.md and JUDGE.md files " +
968
968
  "that a future autonomous session will execute.\n\n" +
969
969
  "## Task\n" + (wData.task || "") +
@@ -1144,37 +1144,31 @@ function attachLoop(ctx) {
1144
1144
 
1145
1145
  // --- Hub: cross-project recent sessions ---
1146
1146
  if (msg.type === "hub_recent_sessions_list") {
1147
- // Other-project sessions (already have _projectTitle set by getAllProjectSessions)
1148
- // getAllProjectSessions returns annotated shallow copies (not live objects).
1149
- // Each copy carries _projectTitle, _projectSlug, _projectIcon from server.js.
1150
- // We then append the current project's own sessions below with self metadata.
1151
- var otherSessions = getAllProjectSessions ? getAllProjectSessions() : [];
1152
- var selfStatus = getStatus ? getStatus() : {};
1153
- var selfSlug = selfStatus.slug || slug;
1154
- var selfTitle = selfStatus.title || selfStatus.project || selfSlug;
1155
- var selfIcon = selfStatus.icon || null;
1156
- var allSessions = otherSessions.slice();
1157
- sm.sessions.forEach(function (s) {
1158
- if (!s.hidden) {
1159
- allSessions.push(Object.assign({}, s, {
1160
- _projectSlug: selfSlug,
1161
- _projectTitle: selfTitle,
1162
- _projectIcon: selfIcon,
1163
- }));
1164
- }
1165
- });
1147
+ // Gather EVERY project uniformly (includeSelf=true) so the global recency
1148
+ // sort is honest. Previously self was special-cased: other projects came
1149
+ // through getAllProjectSessions() and self's sessions were appended
1150
+ // separately. Combined with a too-small top-10 slice, the currently
1151
+ // connected (most-recently-active) project crowded out the genuinely most
1152
+ // recent sessions overall. getAllProjectSessions returns annotated shallow
1153
+ // copies carrying _projectSlug/_projectTitle/_projectIcon for every project.
1154
+ var allSessions = getAllProjectSessions ? getAllProjectSessions(true) : [];
1166
1155
  // Sort newest-first by lastActivity
1167
1156
  allSessions.sort(function (a, b) {
1168
1157
  return (b.lastActivity || b.createdAt || 0) - (a.lastActivity || a.createdAt || 0);
1169
1158
  });
1170
- var top10 = allSessions.slice(0, 10);
1171
- var mapped = top10.map(function (s) {
1159
+ // The global sort above is the actual fix: every project is gathered
1160
+ // uniformly, so the top-N is the genuinely most-recent overall rather
1161
+ // than whatever the connected project happened to touch. The Hub card
1162
+ // shows 10; selection is now honest, so 10 is a display cap, not a
1163
+ // project-biased pool.
1164
+ var top = allSessions.slice(0, 10);
1165
+ var mapped = top.map(function (s) {
1172
1166
  return {
1173
1167
  id: s.localId,
1174
1168
  title: s.title || "New Session",
1175
1169
  lastActivity: s.lastActivity || s.createdAt || 0,
1176
- projectSlug: s._projectSlug || selfSlug,
1177
- projectTitle: s._projectTitle || selfTitle,
1170
+ projectSlug: s._projectSlug || slug,
1171
+ projectTitle: s._projectTitle || slug,
1178
1172
  projectIcon: s._projectIcon || null,
1179
1173
  vendor: s.vendor || null,
1180
1174
  agentName: s.agentName || null,
@@ -15,7 +15,10 @@ agentsModule.refresh().catch(function (e) {
15
15
 
16
16
  // Format a user's answer to an ask_user_questions card as a plain user
17
17
  // message so the MCP path can feed it back to the agent on the next turn.
18
- // The agent sees: its own question text, then the selected answer(s).
18
+ // Always use "- Q → A" form and prefix with a header so the model can
19
+ // connect the answer to its earlier AskUserQuestion call even across a
20
+ // turn break. A bare answer with no context reads as a non-sequitur and
21
+ // triggers "I don't see an answer" responses from the model.
19
22
  function formatAskUserAnswerAsMessage(input, answers) {
20
23
  var questions = (input && Array.isArray(input.questions)) ? input.questions : [];
21
24
  if (questions.length === 0) {
@@ -29,15 +32,12 @@ function formatAskUserAnswerAsMessage(input, answers) {
29
32
  var qText = (q && q.question) ? q.question : ("Question " + (i + 1));
30
33
  var ans = (answers && answers[i] != null) ? String(answers[i]) : "";
31
34
  if (!ans) continue;
32
- if (questions.length === 1) {
33
- // Single question: keep it tight.
34
- lines.push(ans);
35
- } else {
36
- lines.push("- " + qText + " → " + ans);
37
- }
35
+ lines.push("- " + qText + " → " + ans);
38
36
  }
39
37
  if (lines.length === 0) return "(no answer provided)";
40
- return lines.join("\n");
38
+ // Prefix tells the model this is a structured answer to its previous
39
+ // AskUserQuestion call — unambiguous even when read out of turn context.
40
+ return "[Answer to your AskUserQuestion]\n" + lines.join("\n");
41
41
  }
42
42
 
43
43
  /**
@@ -441,6 +441,20 @@
441
441
  .hub-recent-item:hover {
442
442
  background: rgba(var(--overlay-rgb), 0.06);
443
443
  }
444
+ .hub-recent-dot {
445
+ width: 7px;
446
+ height: 7px;
447
+ border-radius: 50%;
448
+ flex-shrink: 0;
449
+ background: var(--text-dimmer);
450
+ opacity: 0.35;
451
+ transition: background 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
452
+ }
453
+ .hub-recent-dot.processing {
454
+ background: var(--success);
455
+ opacity: 1;
456
+ box-shadow: 0 0 6px rgba(80, 250, 123, 0.4);
457
+ }
444
458
  .hub-recent-project-icon {
445
459
  font-size: 14px;
446
460
  width: 20px;
@@ -198,6 +198,11 @@ export function connect() {
198
198
  closeDmUserPicker();
199
199
  setStatus("disconnected");
200
200
  setActivity(null);
201
+ // lr-0446: Discard any pending cross-project session switch. If the WS
202
+ // closed before the target project's session_list fired, the key is now
203
+ // stale — leaving it would cause the *next* successful session_list (on
204
+ // any project reconnect) to switch to a wrong session.
205
+ try { sessionStorage.removeItem("pending-hub-session"); } catch (e) {}
201
206
  scheduleReconnect();
202
207
  };
203
208
 
@@ -423,7 +423,9 @@ export function handleHubRecentSessions(msg) {
423
423
  var agentBadge = sess.agentName
424
424
  ? '<span class="hub-recent-agent">' + escapeHtml(sess.agentName) + '</span>'
425
425
  : '';
426
+ var dotClass = "hub-recent-dot" + (sess.isProcessing ? " processing" : "");
426
427
  item.innerHTML =
428
+ '<span class="' + dotClass + '"></span>' +
427
429
  iconHtml +
428
430
  '<span class="hub-recent-title">' + escapeHtml(sess.title) + '</span>' +
429
431
  agentBadge +
@@ -120,7 +120,7 @@ function requireClayRalph(cb) {
120
120
  requireSkills({
121
121
  title: "Skill Installation Required",
122
122
  reason: "This feature requires the following skill to be installed.",
123
- skills: [{ name: "clay-ralph", scope: "global" }]
123
+ skills: [{ name: "ralph-loop", scope: "global" }]
124
124
  }, cb);
125
125
  }
126
126
 
@@ -109,6 +109,7 @@ var CODEX_WEBSEARCH_OPTIONS = [
109
109
  var KNOWN_CONTEXT_WINDOWS = {
110
110
  "opus-4-6": 1000000,
111
111
  "claude-sonnet-4": 1000000,
112
+ "gpt-5.5": 1048576,
112
113
  "gpt-5.4": 1048576,
113
114
  "gpt-5.3": 1048576,
114
115
  "gpt-5.2": 1048576,
@@ -27,7 +27,8 @@ export var MODEL_DESCRIPTIONS = {
27
27
  "haiku": "Fastest model. Best for quick tasks and simple questions.",
28
28
  "opus": "Most powerful model. Best for complex reasoning and analysis.",
29
29
  // Codex/OpenAI families
30
- "gpt-5.4": "Latest GPT-5.4. Highest capability and reasoning.",
30
+ "gpt-5.5": "Latest GPT-5.5. Frontier model for complex coding and agentic workflows.",
31
+ "gpt-5.4": "GPT-5.4. Strong reasoning and agentic coding.",
31
32
  "gpt-5.4-mini": "Faster, lighter GPT-5.4 variant. Great for most coding tasks.",
32
33
  "gpt-5.3-codex": "GPT-5.3 Codex. Strong at agentic coding and tool use.",
33
34
  "gpt-5.3-codex-spark": "Lean GPT-5.3 Codex. Optimized for speed.",
package/lib/scheduler.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Loop Registry — unified storage for all Ralph Loops (one-off + scheduled).
3
3
  *
4
4
  * Stores loop records in ~/.clay/loops/{encodedCwd}.jsonl
5
- * Each record represents a job defined via clay-ralph (PROMPT.md + JUDGE.md).
5
+ * Each record represents a job defined via ralph-loop (PROMPT.md + JUDGE.md).
6
6
  * Records with a `cron` field are checked every 30s and auto-triggered.
7
7
  * Records without cron are one-off (standard Ralph Loop behavior).
8
8
  */
package/lib/sdk-bridge.js CHANGED
@@ -940,7 +940,19 @@ function createSDKBridge(opts) {
940
940
  }
941
941
  session.taskStopRequested = false;
942
942
  session.pendingPermissions = {};
943
- session.pendingAskUser = {};
943
+ // Preserve MCP-mode AskUserQuestion entries across turn boundaries.
944
+ // The MCP path is intentionally stateless: ask_user returns immediately
945
+ // ("card posted, end your turn") and the answer arrives as a new
946
+ // user_message on the next turn. Those entries MUST survive this finally
947
+ // block so ask_user_response can find the toolId and inject the answer.
948
+ // canUseTool-mode entries hold an open SDK callback that dies with the
949
+ // query anyway, so those are correctly cleared here.
950
+ var _keepAskUser = {};
951
+ for (var _tid in session.pendingAskUser) {
952
+ var _pau = session.pendingAskUser[_tid];
953
+ if (_pau && _pau.mode === "mcp") _keepAskUser[_tid] = _pau;
954
+ }
955
+ session.pendingAskUser = _keepAskUser;
944
956
  session.pendingElicitations = {};
945
957
 
946
958
  // Auto-continue on rate limit (scheduler sessions, or user setting)
package/lib/server.js CHANGED
@@ -946,10 +946,15 @@ function createServer(opts) {
946
946
  });
947
947
  return list;
948
948
  },
949
- getAllProjectSessions: function () {
949
+ // includeSelf: when true, the calling project's own sessions are included
950
+ // in the uniform pass (so callers need not special-case self). The Hub
951
+ // recent-sessions list uses this to gather every project identically —
952
+ // matching the palette's behavior — so the global recency sort is honest
953
+ // and the currently-connected project doesn't dominate the result.
954
+ getAllProjectSessions: function (includeSelf) {
950
955
  var allSessions = [];
951
956
  projects.forEach(function (pCtx, pSlug) {
952
- if (pSlug === slug) return; // skip self
957
+ if (!includeSelf && pSlug === slug) return; // skip self unless asked
953
958
  var status = pCtx.getStatus();
954
959
  if (status.isWorktree) return;
955
960
  var pSm = pCtx.getSessionManager();
@@ -957,7 +962,7 @@ function createServer(opts) {
957
962
  var projectTitle = status.title || status.project || pSlug;
958
963
  var projectIcon = status.icon || null;
959
964
  pSm.sessions.forEach(function (s) {
960
- if (!s.hidden && s.history && s.history.length > 0) {
965
+ if (!s.hidden) {
961
966
  // Push a shallow copy annotated with project metadata rather than
962
967
  // mutating the live session object with transient UI fields.
963
968
  allSessions.push(Object.assign({}, s, {
package/lib/updater.js CHANGED
@@ -81,10 +81,15 @@ function isNewer(latest, current) {
81
81
  return false;
82
82
  }
83
83
 
84
- function performUpdate(channel) {
85
- var tag = channel === "beta" ? "beta" : "latest";
84
+ // Install an EXACT version, never a dist-tag. Installing a tag (@latest/@beta)
85
+ // is unsafe: the tag can resolve to a different — even older — version than the
86
+ // one isNewer() approved, which is how a beta machine got silently downgraded to
87
+ // whatever @latest happened to point at. Pinning the resolved version makes a
88
+ // downgrade structurally impossible.
89
+ function performUpdate(version) {
90
+ if (!version) return false;
86
91
  try {
87
- execFileSync("npm", ["install", "-g", "@clagentic/console@" + tag], { stdio: "pipe" });
92
+ execFileSync("npm", ["install", "-g", "@clagentic/console@" + version], { stdio: "pipe" });
88
93
  return true;
89
94
  } catch (e) {
90
95
  return false;
@@ -116,13 +121,17 @@ async function checkAndUpdate(currentVersion, skipUpdate, channel) {
116
121
  }
117
122
  }
118
123
 
124
+ // Guard: only ever install something strictly newer than what is running.
125
+ // isNewer treats a same-base stable as newer than a pre-release, so this also
126
+ // never trades a beta down to an equal-or-older stable.
119
127
  if (!latest || !isNewer(latest, currentVersion)) return false;
120
128
 
121
- var tag = (isBeta && latest.includes("-")) ? "beta" : "latest";
122
129
  log(sym.pointer + " " + a.bold + "Update available" + a.reset + " " + a.dim + currentVersion + " -> " + latest + a.reset);
123
130
  log(sym.bar + " Installing...");
124
131
 
125
- if (performUpdate(tag === "beta" ? "beta" : "stable")) {
132
+ // Install the exact resolved version, not a dist-tag — the announced version
133
+ // and the installed version are then guaranteed identical.
134
+ if (performUpdate(latest)) {
126
135
  log(sym.done + " Updated to " + a.green + latest + a.reset);
127
136
  log("");
128
137
  reExec();
@@ -130,7 +139,7 @@ async function checkAndUpdate(currentVersion, skipUpdate, channel) {
130
139
  }
131
140
 
132
141
  log(sym.warn + " " + a.yellow + "Update failed" + a.reset + a.dim + " (permission denied?)" + a.reset);
133
- log(sym.bar + " " + a.dim + "Run manually: npm install -g @clagentic/console@" + tag + a.reset);
142
+ log(sym.bar + " " + a.dim + "Run manually: npm install -g @clagentic/console@" + latest + a.reset);
134
143
  log("");
135
144
  return false;
136
145
  }
@@ -586,7 +586,7 @@ function createCodexQueryHandle(appServer, queryOpts) {
586
586
  done: false,
587
587
  aborted: false,
588
588
  loopStarted: false,
589
- model: queryOpts.model || "gpt-5.4",
589
+ model: queryOpts.model || _defaultModel,
590
590
  // Track incremental text deltas
591
591
  textBlocks: {}, // itemId -> true (text_start sent)
592
592
  textLengths: {}, // itemId -> last sent length
@@ -834,7 +834,7 @@ function createCodexQueryHandle(appServer, queryOpts) {
834
834
  try {
835
835
  // Start or resume thread
836
836
  var threadParams = {
837
- model: queryOpts.model || "gpt-5.4",
837
+ model: queryOpts.model || _defaultModel,
838
838
  sandbox: queryOpts.sandboxMode || "workspace-write",
839
839
  approvalPolicy: queryOpts.approvalPolicy || "on-failure",
840
840
  cwd: queryOpts.cwd,
@@ -1065,6 +1065,13 @@ var CODEX_EFFORT_LEVELS = ["minimal", "low", "medium", "high", "xhigh"];
1065
1065
  var CODEX_EFFORT_LEVELS_STANDARD = ["low", "medium", "high"]; // models without xhigh/minimal
1066
1066
 
1067
1067
  var CODEX_DEFAULT_MODELS = [
1068
+ {
1069
+ value: "gpt-5.5",
1070
+ displayName: "GPT-5.5",
1071
+ supportsEffort: true,
1072
+ supportedEffortLevels: CODEX_EFFORT_LEVELS,
1073
+ supportsThinking: false,
1074
+ },
1068
1075
  {
1069
1076
  value: "gpt-5.4",
1070
1077
  displayName: "GPT-5.4",
@@ -1109,6 +1116,7 @@ function createCodexAdapter(opts) {
1109
1116
  var _slug = (opts && opts.slug) || "";
1110
1117
  var _defaultInitOpts = Object.assign({}, opts || {});
1111
1118
  var _cachedModels = [];
1119
+ var _defaultModel = "gpt-5.5";
1112
1120
  var _appServer = null;
1113
1121
  var _initPromise = null;
1114
1122
  var _shutdownPromise = null;
@@ -1146,7 +1154,7 @@ function createCodexAdapter(opts) {
1146
1154
  function buildReadyResponse(skillNames) {
1147
1155
  return {
1148
1156
  models: _cachedModels,
1149
- defaultModel: "gpt-5.4",
1157
+ defaultModel: _defaultModel,
1150
1158
  skills: skillNames || [],
1151
1159
  slashCommands: skillNames || [],
1152
1160
  fastModeState: null,
@@ -1358,9 +1366,47 @@ function createCodexAdapter(opts) {
1358
1366
  throw createShutdownError();
1359
1367
  }
1360
1368
 
1361
- // Use curated default model list. CODEX_DEFAULT_MODELS entries are already
1362
- // rich descriptor objects with capability flags; no further enrichment needed.
1363
- _cachedModels = CODEX_DEFAULT_MODELS.slice();
1369
+ // Query the app-server for the live model list. The v2 protocol exposes
1370
+ // "model/list" which returns rich Model objects with displayName, isDefault,
1371
+ // supportedReasoningEfforts, and upgrade (non-null when a newer model exists).
1372
+ // Fall back to CODEX_DEFAULT_MODELS if the call fails or returns nothing.
1373
+ try {
1374
+ var modelListResult = await _appServer.send("model/list", {}, 10000);
1375
+ // Response shape: { data: [Model, ...], nextCursor }
1376
+ if (modelListResult && Array.isArray(modelListResult.data) && modelListResult.data.length > 0) {
1377
+ _cachedModels = modelListResult.data
1378
+ .filter(function(m) { return !m.hidden; })
1379
+ .map(function(m) {
1380
+ var efforts = Array.isArray(m.supportedReasoningEfforts)
1381
+ ? m.supportedReasoningEfforts.map(function(r) { return r.reasoningEffort; })
1382
+ : CODEX_EFFORT_LEVELS;
1383
+ return {
1384
+ value: m.model || m.id,
1385
+ displayName: m.displayName || m.model || m.id,
1386
+ supportsEffort: efforts.length > 0,
1387
+ supportedEffortLevels: efforts,
1388
+ supportsThinking: false,
1389
+ isLatest: !m.upgrade,
1390
+ };
1391
+ });
1392
+ // Derive default model: first isDefault entry, or first non-hidden entry
1393
+ var defaultEntry = null;
1394
+ for (var mi = 0; mi < modelListResult.data.length; mi++) {
1395
+ if (!modelListResult.data[mi].hidden && modelListResult.data[mi].isDefault) {
1396
+ defaultEntry = modelListResult.data[mi];
1397
+ break;
1398
+ }
1399
+ }
1400
+ _defaultModel = (defaultEntry && (defaultEntry.model || defaultEntry.id)) || _defaultModel;
1401
+ console.log("[codex] model/list: " + _cachedModels.length + " models, default=" + _defaultModel);
1402
+ } else {
1403
+ throw new Error("empty or missing data");
1404
+ }
1405
+ } catch (e) {
1406
+ console.warn("[codex] model/list failed (" + e.message + "); using built-in model table");
1407
+ _cachedModels = CODEX_DEFAULT_MODELS.slice();
1408
+ // _defaultModel stays "gpt-5.5" (set at init)
1409
+ }
1364
1410
  console.log("[codex] App-server initialized, models: " + _cachedModels.map(function(m) { return m.value; }).join(", "));
1365
1411
 
1366
1412
  // Discover skills: built-in Codex skills + Claude skills
@@ -1443,7 +1489,7 @@ function createCodexAdapter(opts) {
1443
1489
  throw new Error("[yoke/codex] Adapter not initialized. Call init() first.");
1444
1490
  }
1445
1491
 
1446
- var model = queryOpts.model || "gpt-5.4";
1492
+ var model = queryOpts.model || _defaultModel;
1447
1493
  var ac = queryOpts.abortController || new AbortController();
1448
1494
  var activeEntry = {
1449
1495
  abort: function() {
package/package.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.1-beta.1",
6
+ "version": "1.4.0-beta.2",
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"
10
10
  },
11
11
  "scripts": {
12
12
  "dev": "node bin/cli.js --dev",
13
- "test": "node --test test/*.test.js",
13
+ "test": "node --test --test-force-exit test/*.test.js",
14
14
  "semantic-release": "semantic-release"
15
15
  },
16
16
  "files": [