@clagentic/console 1.8.0 → 1.9.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.
Files changed (64) hide show
  1. package/bin/cli.js +12 -1
  2. package/lib/agents.js +13 -3
  3. package/lib/build-sha.json +2 -2
  4. package/lib/cli/ipc-subcommands.js +40 -4
  5. package/lib/daemon.js +25 -1
  6. package/lib/generated/claude-model-catalog.json +180 -0
  7. package/lib/model-catalog.js +202 -0
  8. package/lib/model-families.js +243 -0
  9. package/lib/project-connection.js +30 -5
  10. package/lib/project-loop.js +46 -2
  11. package/lib/project-sessions.js +133 -21
  12. package/lib/project-user-message.js +70 -3
  13. package/lib/project.js +11 -1
  14. package/lib/public/app.js +14 -4
  15. package/lib/public/css/base.css +14 -0
  16. package/lib/public/css/home-hub.css +28 -8
  17. package/lib/public/css/icon-strip.css +17 -0
  18. package/lib/public/css/menus.css +67 -0
  19. package/lib/public/css/messages.css +11 -0
  20. package/lib/public/css/mobile-nav.css +22 -0
  21. package/lib/public/css/server-settings.css +72 -0
  22. package/lib/public/css/sidebar.css +15 -0
  23. package/lib/public/css/title-bar.css +10 -1
  24. package/lib/public/index.html +4 -0
  25. package/lib/public/modules/activity-latch.js +159 -0
  26. package/lib/public/modules/activity-state.js +157 -0
  27. package/lib/public/modules/app-connection.js +10 -4
  28. package/lib/public/modules/app-favicon.js +88 -1
  29. package/lib/public/modules/app-home-hub.js +14 -11
  30. package/lib/public/modules/app-loop-ui.js +90 -2
  31. package/lib/public/modules/app-messages.js +117 -28
  32. package/lib/public/modules/app-panels.js +184 -56
  33. package/lib/public/modules/app-projects.js +28 -8
  34. package/lib/public/modules/app-rate-limit.js +14 -2
  35. package/lib/public/modules/model-families.js +230 -0
  36. package/lib/public/modules/project-settings.js +1 -0
  37. package/lib/public/modules/scheduler.js +5 -0
  38. package/lib/public/modules/server-settings.js +14 -12
  39. package/lib/public/modules/settings-defaults.js +151 -41
  40. package/lib/public/modules/sidebar-mobile.js +32 -22
  41. package/lib/public/modules/sidebar-projects.js +42 -14
  42. package/lib/public/modules/sidebar-sessions.js +168 -48
  43. package/lib/public/modules/tools.js +22 -12
  44. package/lib/sdk-bridge.js +389 -35
  45. package/lib/sdk-message-processor.js +215 -7
  46. package/lib/sdk-skill-discovery.js +46 -6
  47. package/lib/sdk-slash-enrichment.js +5 -2
  48. package/lib/server-hub-sessions.js +70 -0
  49. package/lib/server.js +79 -22
  50. package/lib/session-activity.js +289 -0
  51. package/lib/sessions.js +104 -3
  52. package/lib/smtp.js +10 -1
  53. package/lib/terminal-manager.js +40 -0
  54. package/lib/utils.js +44 -0
  55. package/lib/ws-schema.js +17 -0
  56. package/lib/yoke/adapters/claude-worker.js +6 -2
  57. package/lib/yoke/adapters/claude.js +384 -88
  58. package/lib/yoke/adapters/codex.js +239 -31
  59. package/package.json +2 -2
  60. package/scripts/check-test-count.js +397 -0
  61. package/scripts/generate-model-catalog.js +337 -0
  62. package/scripts/test-file-completion-reporter.js +43 -0
  63. package/lib/model-context-windows.js +0 -65
  64. package/lib/public/modules/model-context-windows.js +0 -62
@@ -7,29 +7,44 @@ var path = require("path");
7
7
  var fs = require("fs");
8
8
  var { CodexAppServer } = require("../codex-app-server");
9
9
  var { discoverWorkflows } = require("../../sdk-workflow-discovery");
10
- var { discoverSkillsWithMeta } = require("../../sdk-skill-discovery");
10
+ var { discoverSkillsWithMeta, resolveContainedSkillDir } = require("../../sdk-skill-discovery");
11
11
  var codexLocalImage = require("../codex-local-image");
12
12
 
13
13
  // --- Claude skill discovery ---
14
14
  // Finds Claude skills in ~/.claude/skills/ and <cwd>/.claude/skills/
15
15
  // so Codex can recognize $<skill-name> in user input.
16
- function discoverClaudeSkills(cwd) {
16
+ //
17
+ // homeOverride: optional. On a shared multi-user daemon, the caller resolves
18
+ // the SESSION OWNER's home (os-users.getLinuxUserHome(linuxUser)) and passes
19
+ // it here so the global skills dir is the invoking user's own ~/.claude/skills,
20
+ // not the daemon process's REAL_HOME (lr-3ccc78). Falls back to REAL_HOME
21
+ // (config.js) / os.homedir() when absent — single-user case, unchanged.
22
+ function discoverClaudeSkills(cwd, homeOverride) {
17
23
  var skills = {};
18
- var REAL_HOME;
19
- try { REAL_HOME = require("../../config").REAL_HOME; } catch (e) { REAL_HOME = require("os").homedir(); }
24
+ var globalHome = homeOverride;
25
+ if (!globalHome) {
26
+ try { globalHome = require("../../config").REAL_HOME; } catch (e) { globalHome = require("os").homedir(); }
27
+ }
20
28
  var dirs = [
21
- path.join(REAL_HOME, ".claude", "skills"),
29
+ path.join(globalHome, ".claude", "skills"),
22
30
  path.join(cwd || "", ".claude", "skills"),
23
31
  ];
24
32
  for (var d = 0; d < dirs.length; d++) {
25
33
  var base = dirs[d];
26
34
  if (!base) continue;
27
35
  var entries;
28
- try { entries = fs.readdirSync(base, { withFileTypes: true }); } catch (e) { continue; }
36
+ try { entries = fs.readdirSync(path.resolve(base), { withFileTypes: true }); } catch (e) { continue; }
29
37
  for (var i = 0; i < entries.length; i++) {
30
38
  var entry = entries[i];
31
39
  if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
32
- var skillMd = path.join(base, entry.name, "SKILL.md");
40
+ // Two-stage containment (lexical + realpath) — see
41
+ // sdk-skill-discovery.js's resolveContainedSkillDir doc comment.
42
+ // entry.name comes from readdirSync and may be a symlink; a lexical
43
+ // check alone does not stop fs.accessSync below from following a
44
+ // symlinked entry outside base.
45
+ var skillDir = resolveContainedSkillDir(base, entry.name);
46
+ if (!skillDir) continue;
47
+ var skillMd = path.join(skillDir, "SKILL.md");
33
48
  try {
34
49
  fs.accessSync(skillMd, fs.constants.R_OK);
35
50
  // project skills override global skills
@@ -40,6 +55,21 @@ function discoverClaudeSkills(cwd) {
40
55
  return skills;
41
56
  }
42
57
 
58
+ // lr-3ccc78 — resolve a linuxUser into its home directory for skill
59
+ // discovery. Mirrors sdk-bridge.js's resolveEffectiveHome; duplicated here
60
+ // (rather than imported) because the two modules deliberately do not share
61
+ // runtime state — os-users is the only cross-module dependency needed, and
62
+ // it is already a peer-module import pattern used elsewhere in this file.
63
+ function resolveLinuxUserHome(linuxUser) {
64
+ if (!linuxUser) return null;
65
+ try {
66
+ var home = require("../../os-users").getLinuxUserHome(linuxUser);
67
+ return home || null;
68
+ } catch (e) {
69
+ return null;
70
+ }
71
+ }
72
+
43
73
  // Parse user text for $<skill-name> references.
44
74
  // Returns { text, skills: [{ name, path }] }
45
75
  function parseSkillRefs(text, availableSkills) {
@@ -178,6 +208,13 @@ function flattenEvent(notification, state) {
178
208
  }
179
209
 
180
210
  if (method === "turn/completed") {
211
+ // lr-872f94 — schema-verified (`codex app-server generate-json-schema`,
212
+ // codex-cli 0.124.0): TurnCompletedNotification is { threadId, turn },
213
+ // and Turn carries no usage field at all. params.usage/params.status
214
+ // were already always undefined on the real wire protocol; the actual
215
+ // token breakdown and status live on thread/tokenUsage/updated (state.last*)
216
+ // and params.turn.status respectively. Kept the params.usage/params.status
217
+ // reads as a defensive fallback in case a future server version adds them.
181
218
  var usage = params.usage || null;
182
219
  var turnStatus = params.status || (params.turn && params.turn.status) || null;
183
220
  state.lastUsage = usage;
@@ -186,11 +223,19 @@ function flattenEvent(notification, state) {
186
223
  events.push({ yokeType: "interrupted" });
187
224
  }
188
225
  var inputTokens = state.lastInputTokens || (usage ? (usage.input_tokens || 0) + (usage.cached_input_tokens || 0) : 0);
189
- var outputTokens = usage ? (usage.output_tokens || 0) : 0;
190
- var cachedTokens = usage ? (usage.cached_input_tokens || 0) : 0;
226
+ var outputTokens = state.lastOutputTokens || (usage ? (usage.output_tokens || 0) : 0);
227
+ var cachedTokens = state.lastCachedInputTokens || (usage ? (usage.cached_input_tokens || 0) : 0);
228
+ // reasoningOutputTokens has no params.usage fallback -- it's Codex-specific
229
+ // and only ever arrives via thread/tokenUsage/updated.
230
+ var reasoningTokens = state.lastReasoningOutputTokens || 0;
191
231
  var hasTokenData = inputTokens > 0 || outputTokens > 0;
192
232
  var resultModelUsage = {};
193
- resultModelUsage[state.model] = { contextWindow: null };
233
+ // lr-872f94 — vendor-first contract (lr-3af675): state.lastContextWindow
234
+ // is set only from ThreadTokenUsage.modelContextWindow, the vendor's own
235
+ // reported value. Never a hardcoded per-model constant; stays null (=
236
+ // unknown, renders the indeterminate meter state) when the server hasn't
237
+ // reported one yet for this session.
238
+ resultModelUsage[state.model] = { contextWindow: state.lastContextWindow || null };
194
239
  var assistantUuid = generateUuid();
195
240
  events.push({
196
241
  yokeType: "result",
@@ -203,12 +248,16 @@ function flattenEvent(notification, state) {
203
248
  output_tokens: outputTokens,
204
249
  cache_read_input_tokens: cachedTokens,
205
250
  cache_creation_input_tokens: 0,
251
+ reasoning_output_tokens: reasoningTokens,
206
252
  } : null,
207
253
  modelUsage: resultModelUsage,
208
254
  sessionId: state.threadId || null,
209
255
  lastStreamInputTokens: state.lastInputTokens || null,
210
256
  });
211
257
  state.lastInputTokens = null;
258
+ state.lastOutputTokens = null;
259
+ state.lastCachedInputTokens = null;
260
+ state.lastReasoningOutputTokens = null;
212
261
  return events;
213
262
  }
214
263
 
@@ -536,11 +585,21 @@ function flattenEvent(notification, state) {
536
585
  }
537
586
  }
538
587
 
539
- // Token usage update - track input tokens for context bar
588
+ // Token usage update - track input tokens for context bar, plus the
589
+ // previously-discarded breakdown fields and vendor context window
590
+ // (lr-872f94; schema-verified via `codex app-server generate-json-schema`
591
+ // against ThreadTokenUsageUpdatedNotification -> ThreadTokenUsage ->
592
+ // TokenUsageBreakdown, codex-cli 0.124.0).
540
593
  if (method === "thread/tokenUsage/updated") {
541
594
  var tu = params.tokenUsage;
542
595
  if (tu && tu.total) {
543
596
  state.lastInputTokens = tu.total.inputTokens || 0;
597
+ state.lastOutputTokens = tu.total.outputTokens || 0;
598
+ state.lastCachedInputTokens = tu.total.cachedInputTokens || 0;
599
+ state.lastReasoningOutputTokens = tu.total.reasoningOutputTokens || 0;
600
+ }
601
+ if (tu && typeof tu.modelContextWindow === "number" && tu.modelContextWindow > 0) {
602
+ state.lastContextWindow = tu.modelContextWindow;
544
603
  }
545
604
  return events;
546
605
  }
@@ -573,10 +632,36 @@ function flattenEvent(notification, state) {
573
632
  // Exported so tests import and call the real function rather than
574
633
  // inlining a copy — reverting the || queryOpts.defaultModel term
575
634
  // in codex.js will break those tests. (lr-a7e7)
635
+ //
636
+ // The "gpt-5.5" literal is a fallback-only last resort (lr-d91ecf): used
637
+ // only when neither the query nor the adapter supplies a model at all,
638
+ // which should not happen in normal operation (the adapter always resolves
639
+ // a default from CODEX_DEFAULT_MODELS or the live model/list response).
576
640
  function _test_resolveModel(queryOpts) {
577
641
  return queryOpts.model || queryOpts.defaultModel || "gpt-5.5";
578
642
  }
579
643
 
644
+ // Selects the model used for background title generation.
645
+ //
646
+ // The live "model/list" RPC's Model objects (see the model/list handler
647
+ // below, and _cachedModels' shape) carry no cost-tier field — only
648
+ // value/displayName/supportedEffortLevels/isLatest ("isLatest" means "not
649
+ // superseded by an upgrade", not "cheap"). There is no robust signal in the
650
+ // live catalog to identify a mini/small-tier model, and this codebase does
651
+ // not substring-match displayName/value for a tier (that class of fragile
652
+ // string matching was deliberately removed elsewhere — see the Context
653
+ // meter section of docs/guides/architecture.md).
654
+ //
655
+ // So titling — a trivial 3-8 word job — falls back to _defaultModel, the
656
+ // adapter's only non-staling model identifier (refreshed from the live
657
+ // model/list response). This is a deliberate cost/staleness tradeoff: every
658
+ // auto-title now runs on the user's main model instead of a cheaper
659
+ // mini-tier one, in exchange for auto-titling never breaking silently when
660
+ // OpenAI retires a pinned mini snapshot. See PR body for the reasoning.
661
+ function resolveTitleModel(defaultModel) {
662
+ return defaultModel || "gpt-5.5";
663
+ }
664
+
580
665
  function createCodexQueryHandle(appServer, queryOpts) {
581
666
  var abortController = queryOpts.abortController;
582
667
  var systemPrompt = queryOpts.systemPrompt || "";
@@ -595,6 +680,22 @@ function createCodexQueryHandle(appServer, queryOpts) {
595
680
  turnStarted: false,
596
681
  lastUsage: null,
597
682
  lastInputTokens: null, // from thread/tokenUsage/updated
683
+ // lr-872f94 — thread/tokenUsage/updated's TokenUsageBreakdown carries
684
+ // outputTokens/cachedInputTokens/reasoningOutputTokens too (verified
685
+ // against `codex app-server generate-json-schema`, codex-cli 0.124.0);
686
+ // previously only .total.inputTokens was read here, discarding the
687
+ // rest. Captured on state so turn/completed's result event can surface
688
+ // them without re-deriving from the (usage-less) turn/completed params.
689
+ lastOutputTokens: null,
690
+ lastCachedInputTokens: null,
691
+ lastReasoningOutputTokens: null,
692
+ // lr-872f94 — ThreadTokenUsage.modelContextWindow (nullable int64) is the
693
+ // vendor's own per-session context window, schema-verified present on
694
+ // thread/tokenUsage/updated (NOT on turn/started as originally
695
+ // hypothesized from degraded research — see PR body). Feeds
696
+ // modelUsage[model].contextWindow on the next result event, keeping the
697
+ // vendor-first contract from lr-3af675: no hardcoded per-model table.
698
+ lastContextWindow: null,
598
699
  done: false,
599
700
  aborted: false,
600
701
  loopStarted: false,
@@ -737,7 +838,12 @@ function createCodexQueryHandle(appServer, queryOpts) {
737
838
  appServer.respond(msg.id, { decision: "decline" });
738
839
  });
739
840
  } else {
740
- appServer.respond(msg.id, { decision: "accept" });
841
+ // No approval callback wired (e.g. warmup/init queries) — fail
842
+ // closed rather than silently executing an unreviewed command
843
+ // (lr-f969dc: brings this site in line with the Skill injection
844
+ // gate below, which already fails closed in the same situation).
845
+ console.log("[yoke/codex] no canUseTool wired, declining command execution:", cmdParams.command);
846
+ appServer.respond(msg.id, { decision: "decline" });
741
847
  }
742
848
  return;
743
849
  }
@@ -756,7 +862,10 @@ function createCodexQueryHandle(appServer, queryOpts) {
756
862
  appServer.respond(msg.id, { decision: "decline" });
757
863
  });
758
864
  } else {
759
- appServer.respond(msg.id, { decision: "accept" });
865
+ // No approval callback wired — fail closed (lr-f969dc), same as the
866
+ // command-execution site above and the Skill injection gate below.
867
+ console.log("[yoke/codex] no canUseTool wired, declining file change:", fcParams.path);
868
+ appServer.respond(msg.id, { decision: "decline" });
760
869
  }
761
870
  return;
762
871
  }
@@ -812,7 +921,11 @@ function createCodexQueryHandle(appServer, queryOpts) {
812
921
  appServer.respond(msg.id, { action: "decline" });
813
922
  });
814
923
  } else {
815
- appServer.respond(msg.id, { action: "accept" });
924
+ // Neither an elicitation UI nor a canUseTool callback is wired —
925
+ // fail closed (lr-f969dc), same as the command/file approval sites
926
+ // above and the Skill injection gate below.
927
+ console.log("[yoke/codex] no canUseTool/onElicitation wired, declining MCP approval:", (mcpMeta.tool || "?"));
928
+ appServer.respond(msg.id, { action: "decline" });
816
929
  }
817
930
  return;
818
931
  }
@@ -930,19 +1043,65 @@ function createCodexQueryHandle(appServer, queryOpts) {
930
1043
  input = currentMessage;
931
1044
  }
932
1045
 
933
- // Detect $<skill-name> references (Claude skills) and inject skill input items
934
- var availableSkills = discoverClaudeSkills(queryOpts.cwd);
1046
+ // Detect $<skill-name> references (Claude skills) and inject skill input items.
1047
+ //
1048
+ // lr-4a13c3 — this path previously appended matched skills straight
1049
+ // onto the turn/start RPC input with no approval step at all: skill
1050
+ // files carry arbitrary instructions, so injecting one unprompted is
1051
+ // equivalent to injecting arbitrary agent instructions with zero
1052
+ // operator sign-off. Every other Codex approval surface in this file
1053
+ // (command execution, file change, MCP elicitation — see the
1054
+ // item/*/requestApproval and mcpServer/elicitation/request branches
1055
+ // above) already routes through canUseTool; this brings $skill-name
1056
+ // into the same gate using the same vendor-neutral "Skill" tool name
1057
+ // + { skill: <name> } input shape the Claude Skill tool uses
1058
+ // (lib/utils.js permissionGrantKey), so a Codex skill grant behaves
1059
+ // identically to a Claude one — same key shape, same per-skill
1060
+ // session-grant semantics, same persistence round-trip.
1061
+ //
1062
+ // lr-f969dc — at the time this gate was added, the three older sites
1063
+ // above still fell back to auto-accept when no canUseTool callback
1064
+ // was wired (e.g. warmup/init queries), while this newer site failed
1065
+ // closed in the same situation — an inconsistency BOBBIE flagged on
1066
+ // the lr-4a13c3 PR. All four sites now fail closed identically.
1067
+ var availableSkills = discoverClaudeSkills(queryOpts.cwd, queryOpts.homeOverride);
935
1068
  var skillItemsToInject = [];
936
- var injected = {};
1069
+ var candidateSkills = [];
1070
+ var seenSkillNames = {};
937
1071
  for (var ii = 0; ii < input.length; ii++) {
938
1072
  if (input[ii].type === "text" && input[ii].text) {
939
1073
  var parsed = parseSkillRefs(input[ii].text, availableSkills);
940
1074
  for (var si = 0; si < parsed.skills.length; si++) {
941
- if (!injected[parsed.skills[si].name]) {
942
- injected[parsed.skills[si].name] = true;
943
- skillItemsToInject.push({ type: "skill", name: parsed.skills[si].name, path: parsed.skills[si].path });
1075
+ if (!seenSkillNames[parsed.skills[si].name]) {
1076
+ seenSkillNames[parsed.skills[si].name] = true;
1077
+ candidateSkills.push(parsed.skills[si]);
1078
+ }
1079
+ }
1080
+ }
1081
+ }
1082
+ if (candidateSkills.length > 0) {
1083
+ if (state.toolPolicy === "allow-all") {
1084
+ skillItemsToInject = candidateSkills.map(function(s) { return { type: "skill", name: s.name, path: s.path }; });
1085
+ } else if (canUseTool) {
1086
+ for (var ci = 0; ci < candidateSkills.length; ci++) {
1087
+ var candidate = candidateSkills[ci];
1088
+ var decision;
1089
+ try {
1090
+ decision = await canUseTool("Skill", { skill: candidate.name }, {});
1091
+ } catch (err) {
1092
+ console.error("[yoke/codex] Skill canUseTool error:", err.message);
1093
+ decision = null;
1094
+ }
1095
+ if (decision === true || (decision && decision.behavior === "allow")) {
1096
+ skillItemsToInject.push({ type: "skill", name: candidate.name, path: candidate.path });
1097
+ } else {
1098
+ console.log("[yoke/codex] Skill denied, not injected:", candidate.name);
944
1099
  }
945
1100
  }
1101
+ } else {
1102
+ // No approval callback wired (e.g. warmup/init queries) — fail
1103
+ // closed rather than silently injecting ungated instructions.
1104
+ console.log("[yoke/codex] no canUseTool wired, skipping skill injection:", candidateSkills.map(function(s) { return s.name; }).join(", "));
946
1105
  }
947
1106
  }
948
1107
  if (skillItemsToInject.length > 0) {
@@ -1089,7 +1248,21 @@ function createCodexQueryHandle(appServer, queryOpts) {
1089
1248
  },
1090
1249
 
1091
1250
  getContextUsage: function() {
1092
- return Promise.resolve(state.lastUsage);
1251
+ // lr-3af675 / lr-872f94: Codex's app-server has no equivalent of
1252
+ // Claude's rich context-usage API (categories/totalTokens/maxTokens
1253
+ // breakdown) — state.lastUsage is a flat turn-usage object
1254
+ // (input_tokens etc), not that shape. Returning it here used to make
1255
+ // the frontend's richContextUsage truthiness check pass, rendering a
1256
+ // confident "0 / 200K · 0%" popover built from data that was never a
1257
+ // context-window measurement at all. Returning null keeps the
1258
+ // frontend on its per-turn 'result' event fallback instead, which is
1259
+ // honest and (as of lr-872f94) now carries a real vendor context
1260
+ // window via modelUsage[model].contextWindow, sourced from
1261
+ // ThreadTokenUsage.modelContextWindow (thread/tokenUsage/updated) —
1262
+ // schema-verified there is no turn/started model_context_window field
1263
+ // in the installed protocol (codex-cli 0.124.0); that was a research
1264
+ // hypothesis, not a real field. See PR body for the schema dump.
1265
+ return Promise.resolve(null);
1093
1266
  },
1094
1267
 
1095
1268
  abort: function() {
@@ -1153,6 +1326,12 @@ function createCodexQueryHandle(appServer, queryOpts) {
1153
1326
  var CODEX_EFFORT_LEVELS = ["minimal", "low", "medium", "high", "xhigh"];
1154
1327
  var CODEX_EFFORT_LEVELS_STANDARD = ["low", "medium", "high"]; // models without xhigh/minimal
1155
1328
 
1329
+ // Fallback table used only when the live "model/list" RPC fails or returns
1330
+ // nothing (see catch block below). This static list carries no "upgrade"
1331
+ // signal from the app-server, so isLatest defaults true for every entry —
1332
+ // nothing is hidden behind the older-models disclosure when we have no basis
1333
+ // to tier it (lr-e03635: absence of signal must never manifest as a hidden
1334
+ // model).
1156
1335
  var CODEX_DEFAULT_MODELS = [
1157
1336
  {
1158
1337
  value: "gpt-5.5",
@@ -1160,6 +1339,7 @@ var CODEX_DEFAULT_MODELS = [
1160
1339
  supportsEffort: true,
1161
1340
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1162
1341
  supportsThinking: false,
1342
+ isLatest: true,
1163
1343
  },
1164
1344
  {
1165
1345
  value: "gpt-5.4",
@@ -1167,6 +1347,7 @@ var CODEX_DEFAULT_MODELS = [
1167
1347
  supportsEffort: true,
1168
1348
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1169
1349
  supportsThinking: false,
1350
+ isLatest: true,
1170
1351
  },
1171
1352
  {
1172
1353
  value: "gpt-5.4-mini",
@@ -1174,6 +1355,7 @@ var CODEX_DEFAULT_MODELS = [
1174
1355
  supportsEffort: true,
1175
1356
  supportedEffortLevels: CODEX_EFFORT_LEVELS_STANDARD,
1176
1357
  supportsThinking: false,
1358
+ isLatest: true,
1177
1359
  },
1178
1360
  {
1179
1361
  value: "gpt-5.3-codex",
@@ -1181,6 +1363,7 @@ var CODEX_DEFAULT_MODELS = [
1181
1363
  supportsEffort: true,
1182
1364
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1183
1365
  supportsThinking: false,
1366
+ isLatest: true,
1184
1367
  },
1185
1368
  {
1186
1369
  value: "gpt-5.3-codex-spark",
@@ -1188,6 +1371,7 @@ var CODEX_DEFAULT_MODELS = [
1188
1371
  supportsEffort: true,
1189
1372
  supportedEffortLevels: CODEX_EFFORT_LEVELS_STANDARD,
1190
1373
  supportsThinking: false,
1374
+ isLatest: true,
1191
1375
  },
1192
1376
  {
1193
1377
  value: "gpt-5.2",
@@ -1195,6 +1379,7 @@ var CODEX_DEFAULT_MODELS = [
1195
1379
  supportsEffort: true,
1196
1380
  supportedEffortLevels: CODEX_EFFORT_LEVELS,
1197
1381
  supportsThinking: false,
1382
+ isLatest: true,
1198
1383
  },
1199
1384
  ];
1200
1385
 
@@ -1205,6 +1390,9 @@ function createCodexAdapter(opts) {
1205
1390
  var _slug = (opts && opts.slug) || "";
1206
1391
  var _defaultInitOpts = Object.assign({}, opts || {});
1207
1392
  var _cachedModels = [];
1393
+ // Fallback-only (lr-d91ecf): the initial value before init()/warmup
1394
+ // populates _cachedModels from the live model/list RPC or
1395
+ // CODEX_DEFAULT_MODELS. Overwritten as soon as either succeeds.
1208
1396
  var _defaultModel = "gpt-5.5";
1209
1397
  var _appServer = null;
1210
1398
  var _initPromise = null;
@@ -1244,7 +1432,8 @@ function createCodexAdapter(opts) {
1244
1432
  // Returns {name, desc, type}[] with skills first (type:'skill'), then workflows
1245
1433
  // (type:'workflow'), deduplicated by name. This mirrors the enrichment done in
1246
1434
  // sdk-message-processor for the Claude adapter path.
1247
- function buildEnrichedSlashCommands(skillNames, cwd) {
1435
+ // homeOverride (lr-3ccc78): session owner's home, see discoverClaudeSkills doc comment.
1436
+ function buildEnrichedSlashCommands(skillNames, cwd, homeOverride) {
1248
1437
  var effectiveCwd = cwd || _cwd;
1249
1438
  var seen = {};
1250
1439
  var combined = [];
@@ -1252,7 +1441,7 @@ function createCodexAdapter(opts) {
1252
1441
  // Skills: enrich with descriptions from SKILL.md where available
1253
1442
  var fsSkillsMeta;
1254
1443
  try {
1255
- fsSkillsMeta = discoverSkillsWithMeta(effectiveCwd);
1444
+ fsSkillsMeta = discoverSkillsWithMeta(effectiveCwd, homeOverride);
1256
1445
  } catch (e) {
1257
1446
  fsSkillsMeta = [];
1258
1447
  }
@@ -1287,12 +1476,12 @@ function createCodexAdapter(opts) {
1287
1476
  return combined;
1288
1477
  }
1289
1478
 
1290
- function buildReadyResponse(skillNames, cwd) {
1479
+ function buildReadyResponse(skillNames, cwd, homeOverride) {
1291
1480
  return {
1292
1481
  models: _cachedModels,
1293
1482
  defaultModel: _defaultModel,
1294
1483
  skills: skillNames || [],
1295
- slashCommands: buildEnrichedSlashCommands(skillNames, cwd),
1484
+ slashCommands: buildEnrichedSlashCommands(skillNames, cwd, homeOverride),
1296
1485
  fastModeState: null,
1297
1486
  capabilities: {
1298
1487
  thinking: true,
@@ -1546,11 +1735,18 @@ function createCodexAdapter(opts) {
1546
1735
  console.log("[codex] App-server initialized, models: " + _cachedModels.map(function(m) { return m.value; }).join(", "));
1547
1736
 
1548
1737
  // Discover skills: built-in Codex skills + Claude skills
1738
+ // lr-3ccc78 — resolve the session owner's home so a shared
1739
+ // multi-user daemon reports THIS user's skills, not the daemon
1740
+ // operator's. Falls back to REAL_HOME (config.js) when no
1741
+ // linuxUser was passed to init() — the single-user case.
1549
1742
  var skillNames = [];
1550
1743
  try {
1551
- var REAL_HOME;
1552
- try { REAL_HOME = require("../../config").REAL_HOME; } catch (e) { REAL_HOME = require("os").homedir(); }
1553
- var claudeSkillsDir = require("path").join(REAL_HOME, ".claude", "skills");
1744
+ var initHomeOverride = resolveLinuxUserHome(effectiveInitOpts.linuxUser);
1745
+ var claudeSkillsHome = initHomeOverride;
1746
+ if (!claudeSkillsHome) {
1747
+ try { claudeSkillsHome = require("../../config").REAL_HOME; } catch (e) { claudeSkillsHome = require("os").homedir(); }
1748
+ }
1749
+ var claudeSkillsDir = require("path").join(claudeSkillsHome, ".claude", "skills");
1554
1750
  var extraRoots = _cwd ? [{ cwd: _cwd, extraUserRoots: [claudeSkillsDir] }] : [];
1555
1751
  var skillsResult = await _appServer.send("skills/list", {
1556
1752
  cwds: _cwd ? [_cwd] : [],
@@ -1573,7 +1769,7 @@ function createCodexAdapter(opts) {
1573
1769
  }
1574
1770
  }
1575
1771
  // Also discover Claude skills directly as fallback
1576
- var claudeSkills = discoverClaudeSkills(_cwd);
1772
+ var claudeSkills = discoverClaudeSkills(_cwd, initHomeOverride);
1577
1773
  var claudeSkillNames = Object.keys(claudeSkills);
1578
1774
  for (var csn = 0; csn < claudeSkillNames.length; csn++) {
1579
1775
  if (skillNames.indexOf(claudeSkillNames[csn]) === -1) skillNames.push(claudeSkillNames[csn]);
@@ -1591,7 +1787,7 @@ function createCodexAdapter(opts) {
1591
1787
  _initPromise = null;
1592
1788
  updateLastActiveAt();
1593
1789
 
1594
- return buildReadyResponse(skillNames, _cwd);
1790
+ return buildReadyResponse(skillNames, _cwd, initHomeOverride);
1595
1791
  })();
1596
1792
 
1597
1793
  return _initPromise;
@@ -1647,6 +1843,10 @@ function createCodexAdapter(opts) {
1647
1843
  canUseTool: queryOpts.canUseTool || null,
1648
1844
  onElicitation: queryOpts.onElicitation || null,
1649
1845
  resumeSessionId: queryOpts.resumeSessionId || null,
1846
+ // lr-3ccc78 — session owner's home for discoverClaudeSkills below,
1847
+ // resolved once per query so a shared multi-user daemon shows each
1848
+ // user their own ~/.claude/skills, not the daemon operator's.
1849
+ homeOverride: resolveLinuxUserHome(codexOpts.linuxUser),
1650
1850
  };
1651
1851
 
1652
1852
  // Reasoning effort
@@ -1716,7 +1916,7 @@ function createCodexAdapter(opts) {
1716
1916
  var handle = await adapter.createQuery({
1717
1917
  cwd: (opts && opts.cwd) || _cwd,
1718
1918
  systemPrompt: systemPrompt,
1719
- model: "gpt-5.4-mini",
1919
+ model: resolveTitleModel(_defaultModel),
1720
1920
  abortController: ac,
1721
1921
  canUseTool: function() { return Promise.resolve({ behavior: "deny", message: "No tools." }); },
1722
1922
  });
@@ -1790,8 +1990,16 @@ function createCodexAdapter(opts) {
1790
1990
  module.exports = {
1791
1991
  createCodexAdapter: createCodexAdapter,
1792
1992
  _test_resolveModel: _test_resolveModel,
1993
+ // Exported so tests exercise the real title-generation model selection
1994
+ // (including the catalog-unavailable fallback) rather than reimplementing
1995
+ // a copy of it.
1996
+ _test_resolveTitleModel: resolveTitleModel,
1793
1997
  // lr-f7a4 — exported so tests can drive the real approval-routing and
1794
1998
  // setToolPolicy logic against a fake appServer, rather than reimplementing
1795
1999
  // a copy of handleServerEvent's approval branches inline.
1796
2000
  _test_createCodexQueryHandle: createCodexQueryHandle,
2001
+ // lr-3ccc78 — exported so tests can exercise the real per-user home
2002
+ // resolution in discoverClaudeSkills directly, rather than driving it
2003
+ // indirectly through a full query/init round trip.
2004
+ _test_discoverClaudeSkills: discoverClaudeSkills,
1797
2005
  };
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.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"
@@ -12,7 +12,7 @@
12
12
  "dev": "node bin/cli.js --dev",
13
13
  "postinstall": "node scripts/postinstall.js",
14
14
  "prepack": "node scripts/write-build-sha.js",
15
- "test": "node --test --test-force-exit test/*.test.js",
15
+ "test": "node scripts/check-test-count.js test/*.test.js",
16
16
  "install:local-test": "node scripts/install-local-test.js",
17
17
  "verify:installed-build": "node scripts/verify-installed-build.js",
18
18
  "semantic-release": "semantic-release"