@clagentic/console 1.9.0-beta.1 → 1.9.0-beta.3
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/bin/cli.js +23 -1
- package/lib/agents.js +13 -3
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +84 -4
- package/lib/daemon.js +111 -7
- package/lib/effective-protocol.js +82 -0
- package/lib/project-connection.js +21 -8
- package/lib/project-filesystem.js +4 -4
- package/lib/project-http.js +4 -4
- package/lib/project-loop.js +49 -5
- package/lib/project-sessions.js +166 -68
- package/lib/project-user-mention.js +7 -7
- package/lib/project-user-message.js +81 -14
- package/lib/project.js +28 -22
- package/lib/public/app.js +18 -4
- package/lib/public/css/base.css +14 -0
- package/lib/public/css/filebrowser.css +6 -0
- package/lib/public/css/home-hub.css +28 -8
- package/lib/public/css/icon-strip.css +17 -0
- package/lib/public/css/messages.css +11 -0
- package/lib/public/css/mobile-nav.css +22 -0
- package/lib/public/css/server-settings.css +9 -0
- package/lib/public/css/sidebar.css +15 -0
- package/lib/public/css/title-bar.css +10 -1
- package/lib/public/index.html +9 -2
- package/lib/public/modules/activity-latch.js +45 -0
- package/lib/public/modules/activity-state.js +195 -0
- package/lib/public/modules/app-connection.js +31 -6
- package/lib/public/modules/app-favicon.js +75 -1
- package/lib/public/modules/app-home-hub.js +14 -11
- package/lib/public/modules/app-loop-ui.js +86 -2
- package/lib/public/modules/app-messages.js +178 -54
- package/lib/public/modules/app-panels.js +91 -32
- package/lib/public/modules/app-projects.js +46 -9
- package/lib/public/modules/app-rate-limit.js +13 -1
- package/lib/public/modules/server-settings.js +256 -21
- package/lib/public/modules/sidebar-mobile.js +32 -22
- package/lib/public/modules/sidebar-projects.js +42 -14
- package/lib/public/modules/sidebar-sessions.js +168 -48
- package/lib/public/modules/theme.js +2 -2
- package/lib/public/modules/tools.js +11 -39
- package/lib/sdk-bridge.js +375 -33
- package/lib/sdk-message-processor.js +98 -15
- package/lib/sdk-skill-discovery.js +46 -6
- package/lib/sdk-slash-enrichment.js +5 -2
- package/lib/server-dm.js +5 -5
- package/lib/server-hub-sessions.js +70 -0
- package/lib/server.js +78 -43
- package/lib/session-activity.js +9 -2
- package/lib/sessions.js +64 -18
- package/lib/smtp.js +10 -1
- package/lib/terminal-manager.js +6 -6
- package/lib/ws-schema.js +16 -0
- package/lib/yoke/adapters/claude.js +7 -1
- package/lib/yoke/adapters/codex.js +219 -31
- package/package.json +2 -2
- package/scripts/check-test-count.js +397 -0
- package/scripts/test-file-completion-reporter.js +43 -0
- package/scripts/verify-installed-build.js +242 -15
- package/lib/model-context-windows.js +0 -74
- package/lib/public/modules/model-context-windows.js +0 -71
|
@@ -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
|
-
|
|
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
|
|
19
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -582,6 +641,27 @@ function _test_resolveModel(queryOpts) {
|
|
|
582
641
|
return queryOpts.model || queryOpts.defaultModel || "gpt-5.5";
|
|
583
642
|
}
|
|
584
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
|
+
|
|
585
665
|
function createCodexQueryHandle(appServer, queryOpts) {
|
|
586
666
|
var abortController = queryOpts.abortController;
|
|
587
667
|
var systemPrompt = queryOpts.systemPrompt || "";
|
|
@@ -600,6 +680,22 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
600
680
|
turnStarted: false,
|
|
601
681
|
lastUsage: null,
|
|
602
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,
|
|
603
699
|
done: false,
|
|
604
700
|
aborted: false,
|
|
605
701
|
loopStarted: false,
|
|
@@ -742,7 +838,12 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
742
838
|
appServer.respond(msg.id, { decision: "decline" });
|
|
743
839
|
});
|
|
744
840
|
} else {
|
|
745
|
-
|
|
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" });
|
|
746
847
|
}
|
|
747
848
|
return;
|
|
748
849
|
}
|
|
@@ -761,7 +862,10 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
761
862
|
appServer.respond(msg.id, { decision: "decline" });
|
|
762
863
|
});
|
|
763
864
|
} else {
|
|
764
|
-
|
|
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" });
|
|
765
869
|
}
|
|
766
870
|
return;
|
|
767
871
|
}
|
|
@@ -817,7 +921,11 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
817
921
|
appServer.respond(msg.id, { action: "decline" });
|
|
818
922
|
});
|
|
819
923
|
} else {
|
|
820
|
-
|
|
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" });
|
|
821
929
|
}
|
|
822
930
|
return;
|
|
823
931
|
}
|
|
@@ -935,19 +1043,65 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
935
1043
|
input = currentMessage;
|
|
936
1044
|
}
|
|
937
1045
|
|
|
938
|
-
// Detect $<skill-name> references (Claude skills) and inject skill input items
|
|
939
|
-
|
|
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);
|
|
940
1068
|
var skillItemsToInject = [];
|
|
941
|
-
var
|
|
1069
|
+
var candidateSkills = [];
|
|
1070
|
+
var seenSkillNames = {};
|
|
942
1071
|
for (var ii = 0; ii < input.length; ii++) {
|
|
943
1072
|
if (input[ii].type === "text" && input[ii].text) {
|
|
944
1073
|
var parsed = parseSkillRefs(input[ii].text, availableSkills);
|
|
945
1074
|
for (var si = 0; si < parsed.skills.length; si++) {
|
|
946
|
-
if (!
|
|
947
|
-
|
|
948
|
-
|
|
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);
|
|
949
1099
|
}
|
|
950
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(", "));
|
|
951
1105
|
}
|
|
952
1106
|
}
|
|
953
1107
|
if (skillItemsToInject.length > 0) {
|
|
@@ -1094,7 +1248,21 @@ function createCodexQueryHandle(appServer, queryOpts) {
|
|
|
1094
1248
|
},
|
|
1095
1249
|
|
|
1096
1250
|
getContextUsage: function() {
|
|
1097
|
-
|
|
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);
|
|
1098
1266
|
},
|
|
1099
1267
|
|
|
1100
1268
|
abort: function() {
|
|
@@ -1264,7 +1432,8 @@ function createCodexAdapter(opts) {
|
|
|
1264
1432
|
// Returns {name, desc, type}[] with skills first (type:'skill'), then workflows
|
|
1265
1433
|
// (type:'workflow'), deduplicated by name. This mirrors the enrichment done in
|
|
1266
1434
|
// sdk-message-processor for the Claude adapter path.
|
|
1267
|
-
|
|
1435
|
+
// homeOverride (lr-3ccc78): session owner's home, see discoverClaudeSkills doc comment.
|
|
1436
|
+
function buildEnrichedSlashCommands(skillNames, cwd, homeOverride) {
|
|
1268
1437
|
var effectiveCwd = cwd || _cwd;
|
|
1269
1438
|
var seen = {};
|
|
1270
1439
|
var combined = [];
|
|
@@ -1272,7 +1441,7 @@ function createCodexAdapter(opts) {
|
|
|
1272
1441
|
// Skills: enrich with descriptions from SKILL.md where available
|
|
1273
1442
|
var fsSkillsMeta;
|
|
1274
1443
|
try {
|
|
1275
|
-
fsSkillsMeta = discoverSkillsWithMeta(effectiveCwd);
|
|
1444
|
+
fsSkillsMeta = discoverSkillsWithMeta(effectiveCwd, homeOverride);
|
|
1276
1445
|
} catch (e) {
|
|
1277
1446
|
fsSkillsMeta = [];
|
|
1278
1447
|
}
|
|
@@ -1307,12 +1476,12 @@ function createCodexAdapter(opts) {
|
|
|
1307
1476
|
return combined;
|
|
1308
1477
|
}
|
|
1309
1478
|
|
|
1310
|
-
function buildReadyResponse(skillNames, cwd) {
|
|
1479
|
+
function buildReadyResponse(skillNames, cwd, homeOverride) {
|
|
1311
1480
|
return {
|
|
1312
1481
|
models: _cachedModels,
|
|
1313
1482
|
defaultModel: _defaultModel,
|
|
1314
1483
|
skills: skillNames || [],
|
|
1315
|
-
slashCommands: buildEnrichedSlashCommands(skillNames, cwd),
|
|
1484
|
+
slashCommands: buildEnrichedSlashCommands(skillNames, cwd, homeOverride),
|
|
1316
1485
|
fastModeState: null,
|
|
1317
1486
|
capabilities: {
|
|
1318
1487
|
thinking: true,
|
|
@@ -1566,11 +1735,18 @@ function createCodexAdapter(opts) {
|
|
|
1566
1735
|
console.log("[codex] App-server initialized, models: " + _cachedModels.map(function(m) { return m.value; }).join(", "));
|
|
1567
1736
|
|
|
1568
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.
|
|
1569
1742
|
var skillNames = [];
|
|
1570
1743
|
try {
|
|
1571
|
-
var
|
|
1572
|
-
|
|
1573
|
-
|
|
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");
|
|
1574
1750
|
var extraRoots = _cwd ? [{ cwd: _cwd, extraUserRoots: [claudeSkillsDir] }] : [];
|
|
1575
1751
|
var skillsResult = await _appServer.send("skills/list", {
|
|
1576
1752
|
cwds: _cwd ? [_cwd] : [],
|
|
@@ -1593,7 +1769,7 @@ function createCodexAdapter(opts) {
|
|
|
1593
1769
|
}
|
|
1594
1770
|
}
|
|
1595
1771
|
// Also discover Claude skills directly as fallback
|
|
1596
|
-
var claudeSkills = discoverClaudeSkills(_cwd);
|
|
1772
|
+
var claudeSkills = discoverClaudeSkills(_cwd, initHomeOverride);
|
|
1597
1773
|
var claudeSkillNames = Object.keys(claudeSkills);
|
|
1598
1774
|
for (var csn = 0; csn < claudeSkillNames.length; csn++) {
|
|
1599
1775
|
if (skillNames.indexOf(claudeSkillNames[csn]) === -1) skillNames.push(claudeSkillNames[csn]);
|
|
@@ -1611,7 +1787,7 @@ function createCodexAdapter(opts) {
|
|
|
1611
1787
|
_initPromise = null;
|
|
1612
1788
|
updateLastActiveAt();
|
|
1613
1789
|
|
|
1614
|
-
return buildReadyResponse(skillNames, _cwd);
|
|
1790
|
+
return buildReadyResponse(skillNames, _cwd, initHomeOverride);
|
|
1615
1791
|
})();
|
|
1616
1792
|
|
|
1617
1793
|
return _initPromise;
|
|
@@ -1667,6 +1843,10 @@ function createCodexAdapter(opts) {
|
|
|
1667
1843
|
canUseTool: queryOpts.canUseTool || null,
|
|
1668
1844
|
onElicitation: queryOpts.onElicitation || null,
|
|
1669
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),
|
|
1670
1850
|
};
|
|
1671
1851
|
|
|
1672
1852
|
// Reasoning effort
|
|
@@ -1736,7 +1916,7 @@ function createCodexAdapter(opts) {
|
|
|
1736
1916
|
var handle = await adapter.createQuery({
|
|
1737
1917
|
cwd: (opts && opts.cwd) || _cwd,
|
|
1738
1918
|
systemPrompt: systemPrompt,
|
|
1739
|
-
model:
|
|
1919
|
+
model: resolveTitleModel(_defaultModel),
|
|
1740
1920
|
abortController: ac,
|
|
1741
1921
|
canUseTool: function() { return Promise.resolve({ behavior: "deny", message: "No tools." }); },
|
|
1742
1922
|
});
|
|
@@ -1810,8 +1990,16 @@ function createCodexAdapter(opts) {
|
|
|
1810
1990
|
module.exports = {
|
|
1811
1991
|
createCodexAdapter: createCodexAdapter,
|
|
1812
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,
|
|
1813
1997
|
// lr-f7a4 — exported so tests can drive the real approval-routing and
|
|
1814
1998
|
// setToolPolicy logic against a fake appServer, rather than reimplementing
|
|
1815
1999
|
// a copy of handleServerEvent's approval branches inline.
|
|
1816
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,
|
|
1817
2005
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.9.0-beta.
|
|
6
|
+
"version": "1.9.0-beta.3",
|
|
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
|
|
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"
|