@codexhost/cli-win32-arm64 0.13.0 → 0.13.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/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +88 -44
- package/app/console-web.js +3681 -3948
- package/app/desktop-controller.mjs +8 -1
- package/app/host-runtime.mjs +927 -236
- package/app/plugins/antigravity/plugin.mjs +8 -1
- package/app/plugins/claude-code/plugin.mjs +33031 -22328
- package/app/plugins/codebuddy/plugin.mjs +47 -4
- package/app/plugins/codex-usage/plugin.mjs +657 -27
- package/app/plugins/cursor-cli/plugin.mjs +8 -1
- package/app/plugins/deepseek-harness/plugin.mjs +28 -3
- package/app/plugins/grok/plugin.mjs +43 -8
- package/app/plugins/hermes/plugin.mjs +192 -41
- package/app/plugins/kimi-code/plugin.mjs +8 -1
- package/app/plugins/kiro-cli/plugin.mjs +8 -1
- package/app/plugins/omp/plugin.mjs +31 -7
- package/app/plugins/opencode/plugin.mjs +34 -4
- package/app/plugins/pi/plugin.mjs +84 -43
- package/app/plugins/qoder/plugin.mjs +54 -4
- package/app/plugins/qoder-cn/plugin.mjs +54 -4
- package/app/plugins/workbuddy/plugin.mjs +47 -4
- package/app/plugins/zcode/plugin.mjs +37 -4
- package/app/renderer-extension.js +11574 -7264
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -27668,6 +27668,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
27668
27668
|
harness,
|
|
27669
27669
|
sessionId: external_exports.string().min(1).max(512),
|
|
27670
27670
|
project: project.nullable(),
|
|
27671
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
27672
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
27671
27673
|
/** Models the session used, most requests first. */
|
|
27672
27674
|
models: external_exports.array(model).max(16),
|
|
27673
27675
|
firstAtMs: count,
|
|
@@ -27734,7 +27736,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
27734
27736
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
27735
27737
|
* requests without a native session are not listed here but count everywhere else.
|
|
27736
27738
|
*/
|
|
27737
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
27739
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
27740
|
+
/**
|
|
27741
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
27742
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
27743
|
+
*/
|
|
27744
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
27738
27745
|
});
|
|
27739
27746
|
|
|
27740
27747
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -52921,6 +52928,20 @@ import path6 from "node:path";
|
|
|
52921
52928
|
import { createInterface } from "node:readline";
|
|
52922
52929
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
52923
52930
|
var MAX_CWD_LENGTH = 4096;
|
|
52931
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
52932
|
+
function usageSessionTitle(value) {
|
|
52933
|
+
if (typeof value !== "string")
|
|
52934
|
+
return void 0;
|
|
52935
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52936
|
+
if (!normalized)
|
|
52937
|
+
return void 0;
|
|
52938
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52939
|
+
return normalized;
|
|
52940
|
+
const characters = [...normalized];
|
|
52941
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52942
|
+
return normalized;
|
|
52943
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
52944
|
+
}
|
|
52924
52945
|
function sessionIdOk(value) {
|
|
52925
52946
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52926
52947
|
}
|
|
@@ -52930,12 +52951,14 @@ function cwdOk(value) {
|
|
|
52930
52951
|
function withUsageSession(entry, session) {
|
|
52931
52952
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52932
52953
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
52954
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
52933
52955
|
if (sessionId === void 0 && cwd === void 0)
|
|
52934
52956
|
return entry;
|
|
52935
52957
|
return {
|
|
52936
52958
|
...entry,
|
|
52937
52959
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
52938
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
52960
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
52961
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
52939
52962
|
};
|
|
52940
52963
|
}
|
|
52941
52964
|
function tokenCount(value) {
|
|
@@ -52975,6 +52998,12 @@ function parseHarnessUsageEntry(value) {
|
|
|
52975
52998
|
return null;
|
|
52976
52999
|
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
52977
53000
|
return null;
|
|
53001
|
+
if (entry.sessionTitle !== void 0) {
|
|
53002
|
+
const sessionTitle = usageSessionTitle(entry.sessionTitle);
|
|
53003
|
+
if (sessionTitle === void 0)
|
|
53004
|
+
return null;
|
|
53005
|
+
entry.sessionTitle = sessionTitle;
|
|
53006
|
+
}
|
|
52978
53007
|
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
52979
53008
|
return null;
|
|
52980
53009
|
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
@@ -53086,6 +53115,16 @@ function qoderProjectsDirectory(environment, variant) {
|
|
|
53086
53115
|
function isRecord2(value) {
|
|
53087
53116
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53088
53117
|
}
|
|
53118
|
+
function qoderUserText(message) {
|
|
53119
|
+
if (!isRecord2(message))
|
|
53120
|
+
return void 0;
|
|
53121
|
+
const { content } = message;
|
|
53122
|
+
if (typeof content === "string")
|
|
53123
|
+
return content;
|
|
53124
|
+
if (!Array.isArray(content))
|
|
53125
|
+
return void 0;
|
|
53126
|
+
return content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => String(block.text)).join(" ");
|
|
53127
|
+
}
|
|
53089
53128
|
function count2(value) {
|
|
53090
53129
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53091
53130
|
}
|
|
@@ -53093,8 +53132,18 @@ async function readQoderUsage(file2, signal) {
|
|
|
53093
53132
|
const messages = /* @__PURE__ */ new Map();
|
|
53094
53133
|
let sessionId;
|
|
53095
53134
|
let cwd;
|
|
53096
|
-
|
|
53135
|
+
let customTitle;
|
|
53136
|
+
let summary;
|
|
53137
|
+
let firstPrompt;
|
|
53138
|
+
for await (const line of jsonlRecords(file2, '"type"', signal)) {
|
|
53097
53139
|
signal.throwIfAborted();
|
|
53140
|
+
if (line.type === "custom-title")
|
|
53141
|
+
customTitle = usageSessionTitle(line.customTitle);
|
|
53142
|
+
else if (!summary && line.type === "summary")
|
|
53143
|
+
summary = usageSessionTitle(line.summary);
|
|
53144
|
+
else if (!firstPrompt && line.type === "user") {
|
|
53145
|
+
firstPrompt = usageSessionTitle(qoderUserText(line.message));
|
|
53146
|
+
}
|
|
53098
53147
|
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53099
53148
|
continue;
|
|
53100
53149
|
sessionId ??= line.sessionId;
|
|
@@ -53138,7 +53187,8 @@ async function readQoderUsage(file2, signal) {
|
|
|
53138
53187
|
}
|
|
53139
53188
|
const session = {
|
|
53140
53189
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53141
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53190
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
53191
|
+
title: customTitle ?? summary ?? firstPrompt
|
|
53142
53192
|
};
|
|
53143
53193
|
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53144
53194
|
}
|
|
@@ -27265,6 +27265,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
27265
27265
|
harness,
|
|
27266
27266
|
sessionId: external_exports.string().min(1).max(512),
|
|
27267
27267
|
project: project.nullable(),
|
|
27268
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
27269
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
27268
27270
|
/** Models the session used, most requests first. */
|
|
27269
27271
|
models: external_exports.array(model).max(16),
|
|
27270
27272
|
firstAtMs: count,
|
|
@@ -27331,7 +27333,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
27331
27333
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
27332
27334
|
* requests without a native session are not listed here but count everywhere else.
|
|
27333
27335
|
*/
|
|
27334
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
27336
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
27337
|
+
/**
|
|
27338
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
27339
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
27340
|
+
*/
|
|
27341
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
27335
27342
|
});
|
|
27336
27343
|
|
|
27337
27344
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -52923,6 +52930,20 @@ import path6 from "node:path";
|
|
|
52923
52930
|
import { createInterface } from "node:readline";
|
|
52924
52931
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
52925
52932
|
var MAX_CWD_LENGTH = 4096;
|
|
52933
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
52934
|
+
function usageSessionTitle(value) {
|
|
52935
|
+
if (typeof value !== "string")
|
|
52936
|
+
return void 0;
|
|
52937
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52938
|
+
if (!normalized)
|
|
52939
|
+
return void 0;
|
|
52940
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52941
|
+
return normalized;
|
|
52942
|
+
const characters = [...normalized];
|
|
52943
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52944
|
+
return normalized;
|
|
52945
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
52946
|
+
}
|
|
52926
52947
|
function sessionIdOk(value) {
|
|
52927
52948
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52928
52949
|
}
|
|
@@ -52932,12 +52953,14 @@ function cwdOk(value) {
|
|
|
52932
52953
|
function withUsageSession(entry, session) {
|
|
52933
52954
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52934
52955
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
52956
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
52935
52957
|
if (sessionId === void 0 && cwd === void 0)
|
|
52936
52958
|
return entry;
|
|
52937
52959
|
return {
|
|
52938
52960
|
...entry,
|
|
52939
52961
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
52940
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
52962
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
52963
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
52941
52964
|
};
|
|
52942
52965
|
}
|
|
52943
52966
|
function tokenCount(value) {
|
|
@@ -52977,6 +53000,12 @@ function parseHarnessUsageEntry(value) {
|
|
|
52977
53000
|
return null;
|
|
52978
53001
|
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
52979
53002
|
return null;
|
|
53003
|
+
if (entry.sessionTitle !== void 0) {
|
|
53004
|
+
const sessionTitle = usageSessionTitle(entry.sessionTitle);
|
|
53005
|
+
if (sessionTitle === void 0)
|
|
53006
|
+
return null;
|
|
53007
|
+
entry.sessionTitle = sessionTitle;
|
|
53008
|
+
}
|
|
52980
53009
|
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
52981
53010
|
return null;
|
|
52982
53011
|
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
@@ -53088,6 +53117,16 @@ function qoderProjectsDirectory(environment, variant) {
|
|
|
53088
53117
|
function isRecord2(value) {
|
|
53089
53118
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53090
53119
|
}
|
|
53120
|
+
function qoderUserText(message) {
|
|
53121
|
+
if (!isRecord2(message))
|
|
53122
|
+
return void 0;
|
|
53123
|
+
const { content } = message;
|
|
53124
|
+
if (typeof content === "string")
|
|
53125
|
+
return content;
|
|
53126
|
+
if (!Array.isArray(content))
|
|
53127
|
+
return void 0;
|
|
53128
|
+
return content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => String(block.text)).join(" ");
|
|
53129
|
+
}
|
|
53091
53130
|
function count2(value) {
|
|
53092
53131
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53093
53132
|
}
|
|
@@ -53095,8 +53134,18 @@ async function readQoderUsage(file2, signal) {
|
|
|
53095
53134
|
const messages = /* @__PURE__ */ new Map();
|
|
53096
53135
|
let sessionId;
|
|
53097
53136
|
let cwd;
|
|
53098
|
-
|
|
53137
|
+
let customTitle;
|
|
53138
|
+
let summary;
|
|
53139
|
+
let firstPrompt;
|
|
53140
|
+
for await (const line of jsonlRecords(file2, '"type"', signal)) {
|
|
53099
53141
|
signal.throwIfAborted();
|
|
53142
|
+
if (line.type === "custom-title")
|
|
53143
|
+
customTitle = usageSessionTitle(line.customTitle);
|
|
53144
|
+
else if (!summary && line.type === "summary")
|
|
53145
|
+
summary = usageSessionTitle(line.summary);
|
|
53146
|
+
else if (!firstPrompt && line.type === "user") {
|
|
53147
|
+
firstPrompt = usageSessionTitle(qoderUserText(line.message));
|
|
53148
|
+
}
|
|
53100
53149
|
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53101
53150
|
continue;
|
|
53102
53151
|
sessionId ??= line.sessionId;
|
|
@@ -53140,7 +53189,8 @@ async function readQoderUsage(file2, signal) {
|
|
|
53140
53189
|
}
|
|
53141
53190
|
const session = {
|
|
53142
53191
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53143
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53192
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
53193
|
+
title: customTitle ?? summary ?? firstPrompt
|
|
53144
53194
|
};
|
|
53145
53195
|
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53146
53196
|
}
|
|
@@ -14682,6 +14682,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
14682
14682
|
harness,
|
|
14683
14683
|
sessionId: external_exports.string().min(1).max(512),
|
|
14684
14684
|
project: project.nullable(),
|
|
14685
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
14686
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
14685
14687
|
/** Models the session used, most requests first. */
|
|
14686
14688
|
models: external_exports.array(model).max(16),
|
|
14687
14689
|
firstAtMs: count,
|
|
@@ -14748,7 +14750,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
14748
14750
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
14749
14751
|
* requests without a native session are not listed here but count everywhere else.
|
|
14750
14752
|
*/
|
|
14751
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
14753
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
14754
|
+
/**
|
|
14755
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
14756
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
14757
|
+
*/
|
|
14758
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
14752
14759
|
});
|
|
14753
14760
|
|
|
14754
14761
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -17339,6 +17346,20 @@ import path2 from "node:path";
|
|
|
17339
17346
|
import { createInterface } from "node:readline";
|
|
17340
17347
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
17341
17348
|
var MAX_CWD_LENGTH = 4096;
|
|
17349
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
17350
|
+
function usageSessionTitle(value) {
|
|
17351
|
+
if (typeof value !== "string")
|
|
17352
|
+
return void 0;
|
|
17353
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
17354
|
+
if (!normalized)
|
|
17355
|
+
return void 0;
|
|
17356
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17357
|
+
return normalized;
|
|
17358
|
+
const characters = [...normalized];
|
|
17359
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17360
|
+
return normalized;
|
|
17361
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
17362
|
+
}
|
|
17342
17363
|
function sessionIdOk(value) {
|
|
17343
17364
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
17344
17365
|
}
|
|
@@ -17348,12 +17369,14 @@ function cwdOk(value) {
|
|
|
17348
17369
|
function withUsageSession(entry, session) {
|
|
17349
17370
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
17350
17371
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
17372
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
17351
17373
|
if (sessionId === void 0 && cwd === void 0)
|
|
17352
17374
|
return entry;
|
|
17353
17375
|
return {
|
|
17354
17376
|
...entry,
|
|
17355
17377
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
17356
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
17378
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
17379
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
17357
17380
|
};
|
|
17358
17381
|
}
|
|
17359
17382
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -18852,11 +18875,30 @@ function historyUsage(contents) {
|
|
|
18852
18875
|
function record3(value) {
|
|
18853
18876
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
18854
18877
|
}
|
|
18878
|
+
function codeBuddyUserText(row) {
|
|
18879
|
+
if (row.type !== "message" || row.role !== "user")
|
|
18880
|
+
return void 0;
|
|
18881
|
+
const { content } = row;
|
|
18882
|
+
if (typeof content === "string")
|
|
18883
|
+
return content;
|
|
18884
|
+
if (!Array.isArray(content))
|
|
18885
|
+
return void 0;
|
|
18886
|
+
return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
|
|
18887
|
+
}
|
|
18855
18888
|
async function readCodeBuddyUsage(file2, signal) {
|
|
18856
18889
|
const messages = /* @__PURE__ */ new Map();
|
|
18857
18890
|
let sessionId;
|
|
18858
18891
|
let cwd;
|
|
18859
|
-
|
|
18892
|
+
let customTitle;
|
|
18893
|
+
let generatedTitle;
|
|
18894
|
+
let firstPrompt;
|
|
18895
|
+
for await (const row of jsonlRecords(file2, '"type"', signal)) {
|
|
18896
|
+
if (row.type === "custom-title")
|
|
18897
|
+
customTitle = usageSessionTitle(row.customTitle);
|
|
18898
|
+
else if (row.type === "ai-title")
|
|
18899
|
+
generatedTitle = usageSessionTitle(row.aiTitle);
|
|
18900
|
+
else if (!firstPrompt)
|
|
18901
|
+
firstPrompt = usageSessionTitle(codeBuddyUserText(row));
|
|
18860
18902
|
if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
|
|
18861
18903
|
continue;
|
|
18862
18904
|
sessionId ??= row.sessionId;
|
|
@@ -18878,7 +18920,8 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
18878
18920
|
}
|
|
18879
18921
|
entries.push(withUsageSession(entry, {
|
|
18880
18922
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
18881
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
18923
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
18924
|
+
title: customTitle ?? generatedTitle ?? firstPrompt
|
|
18882
18925
|
}));
|
|
18883
18926
|
}
|
|
18884
18927
|
}
|
|
@@ -13,6 +13,20 @@ import { lstat } from "node:fs/promises";
|
|
|
13
13
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
14
14
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
15
15
|
var MAX_CWD_LENGTH = 4096;
|
|
16
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
17
|
+
function usageSessionTitle(value) {
|
|
18
|
+
if (typeof value !== "string")
|
|
19
|
+
return void 0;
|
|
20
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
21
|
+
if (!normalized)
|
|
22
|
+
return void 0;
|
|
23
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
24
|
+
return normalized;
|
|
25
|
+
const characters = [...normalized];
|
|
26
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
27
|
+
return normalized;
|
|
28
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
29
|
+
}
|
|
16
30
|
function sessionIdOk(value) {
|
|
17
31
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
18
32
|
}
|
|
@@ -22,12 +36,14 @@ function cwdOk(value) {
|
|
|
22
36
|
function withUsageSession(entry, session) {
|
|
23
37
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
24
38
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
39
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
25
40
|
if (sessionId === void 0 && cwd === void 0)
|
|
26
41
|
return entry;
|
|
27
42
|
return {
|
|
28
43
|
...entry,
|
|
29
44
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
30
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
45
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
46
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
31
47
|
};
|
|
32
48
|
}
|
|
33
49
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -14849,6 +14865,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
14849
14865
|
harness,
|
|
14850
14866
|
sessionId: external_exports.string().min(1).max(512),
|
|
14851
14867
|
project: project.nullable(),
|
|
14868
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
14869
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
14852
14870
|
/** Models the session used, most requests first. */
|
|
14853
14871
|
models: external_exports.array(model).max(16),
|
|
14854
14872
|
firstAtMs: count,
|
|
@@ -14915,7 +14933,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
14915
14933
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
14916
14934
|
* requests without a native session are not listed here but count everywhere else.
|
|
14917
14935
|
*/
|
|
14918
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
14936
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
14937
|
+
/**
|
|
14938
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
14939
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
14940
|
+
*/
|
|
14941
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
14919
14942
|
});
|
|
14920
14943
|
|
|
14921
14944
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -16486,11 +16509,17 @@ async function readZcodeUsage(file2) {
|
|
|
16486
16509
|
try {
|
|
16487
16510
|
const entries = [];
|
|
16488
16511
|
const directories = /* @__PURE__ */ new Map();
|
|
16512
|
+
const titles = /* @__PURE__ */ new Map();
|
|
16489
16513
|
const hasSessions = database.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'session'").get();
|
|
16490
16514
|
if (hasSessions) {
|
|
16491
|
-
|
|
16515
|
+
const columns = new Set(database.prepare("PRAGMA table_info(session)").all().map((row) => String(row.name)));
|
|
16516
|
+
const titleColumn = columns.has("title") ? ", title" : "";
|
|
16517
|
+
for (const row of database.prepare(`SELECT id, directory${titleColumn} FROM session`).iterate()) {
|
|
16492
16518
|
if (typeof row.directory === "string")
|
|
16493
16519
|
directories.set(String(row.id), row.directory);
|
|
16520
|
+
const title = usageSessionTitle(row.title);
|
|
16521
|
+
if (title)
|
|
16522
|
+
titles.set(String(row.id), title);
|
|
16494
16523
|
}
|
|
16495
16524
|
}
|
|
16496
16525
|
for (const row of database.prepare("SELECT id, session_id, data FROM message").iterate()) {
|
|
@@ -16520,7 +16549,11 @@ async function readZcodeUsage(file2) {
|
|
|
16520
16549
|
const entry = usage.kind === "request" && at !== null && usageEntryFromRequest(usage.request, at);
|
|
16521
16550
|
if (entry) {
|
|
16522
16551
|
const sessionId = String(row.session_id);
|
|
16523
|
-
entries.push(withUsageSession(entry, {
|
|
16552
|
+
entries.push(withUsageSession(entry, {
|
|
16553
|
+
sessionId,
|
|
16554
|
+
cwd: directories.get(sessionId),
|
|
16555
|
+
title: titles.get(sessionId)
|
|
16556
|
+
}));
|
|
16524
16557
|
}
|
|
16525
16558
|
}
|
|
16526
16559
|
return entries;
|