@liberseek/boft-cli-win32-arm64 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +91 -47
- package/app/console-web.js +3722 -4017
- package/app/desktop-controller.mjs +8 -1
- package/app/host-runtime.mjs +929 -238
- package/app/plugins/antigravity/plugin.mjs +8 -1
- package/app/plugins/claude-code/plugin.mjs +34824 -23963
- package/app/plugins/codebuddy/plugin.mjs +47 -4
- package/app/plugins/codex-usage/plugin.mjs +663 -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/muse/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 +12224 -7940
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +4 -4
|
@@ -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
|
|
@@ -52974,6 +52981,20 @@ import path6 from "node:path";
|
|
|
52974
52981
|
import { createInterface } from "node:readline";
|
|
52975
52982
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
52976
52983
|
var MAX_CWD_LENGTH = 4096;
|
|
52984
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
52985
|
+
function usageSessionTitle(value) {
|
|
52986
|
+
if (typeof value !== "string")
|
|
52987
|
+
return void 0;
|
|
52988
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52989
|
+
if (!normalized)
|
|
52990
|
+
return void 0;
|
|
52991
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52992
|
+
return normalized;
|
|
52993
|
+
const characters = [...normalized];
|
|
52994
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52995
|
+
return normalized;
|
|
52996
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
52997
|
+
}
|
|
52977
52998
|
function sessionIdOk(value) {
|
|
52978
52999
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52979
53000
|
}
|
|
@@ -52983,12 +53004,14 @@ function cwdOk(value) {
|
|
|
52983
53004
|
function withUsageSession(entry, session) {
|
|
52984
53005
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52985
53006
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
53007
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
52986
53008
|
if (sessionId === void 0 && cwd === void 0)
|
|
52987
53009
|
return entry;
|
|
52988
53010
|
return {
|
|
52989
53011
|
...entry,
|
|
52990
53012
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
52991
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
53013
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
53014
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
52992
53015
|
};
|
|
52993
53016
|
}
|
|
52994
53017
|
function tokenCount(value) {
|
|
@@ -53028,6 +53051,12 @@ function parseHarnessUsageEntry(value) {
|
|
|
53028
53051
|
return null;
|
|
53029
53052
|
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
53030
53053
|
return null;
|
|
53054
|
+
if (entry.sessionTitle !== void 0) {
|
|
53055
|
+
const sessionTitle = usageSessionTitle(entry.sessionTitle);
|
|
53056
|
+
if (sessionTitle === void 0)
|
|
53057
|
+
return null;
|
|
53058
|
+
entry.sessionTitle = sessionTitle;
|
|
53059
|
+
}
|
|
53031
53060
|
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
53032
53061
|
return null;
|
|
53033
53062
|
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
@@ -53139,6 +53168,16 @@ function qoderProjectsDirectory(environment, variant) {
|
|
|
53139
53168
|
function isRecord2(value) {
|
|
53140
53169
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53141
53170
|
}
|
|
53171
|
+
function qoderUserText(message) {
|
|
53172
|
+
if (!isRecord2(message))
|
|
53173
|
+
return void 0;
|
|
53174
|
+
const { content } = message;
|
|
53175
|
+
if (typeof content === "string")
|
|
53176
|
+
return content;
|
|
53177
|
+
if (!Array.isArray(content))
|
|
53178
|
+
return void 0;
|
|
53179
|
+
return content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => String(block.text)).join(" ");
|
|
53180
|
+
}
|
|
53142
53181
|
function count2(value) {
|
|
53143
53182
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53144
53183
|
}
|
|
@@ -53146,8 +53185,18 @@ async function readQoderUsage(file2, signal) {
|
|
|
53146
53185
|
const messages = /* @__PURE__ */ new Map();
|
|
53147
53186
|
let sessionId;
|
|
53148
53187
|
let cwd;
|
|
53149
|
-
|
|
53188
|
+
let customTitle;
|
|
53189
|
+
let summary;
|
|
53190
|
+
let firstPrompt;
|
|
53191
|
+
for await (const line of jsonlRecords(file2, '"type"', signal)) {
|
|
53150
53192
|
signal.throwIfAborted();
|
|
53193
|
+
if (line.type === "custom-title")
|
|
53194
|
+
customTitle = usageSessionTitle(line.customTitle);
|
|
53195
|
+
else if (!summary && line.type === "summary")
|
|
53196
|
+
summary = usageSessionTitle(line.summary);
|
|
53197
|
+
else if (!firstPrompt && line.type === "user") {
|
|
53198
|
+
firstPrompt = usageSessionTitle(qoderUserText(line.message));
|
|
53199
|
+
}
|
|
53151
53200
|
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53152
53201
|
continue;
|
|
53153
53202
|
sessionId ??= line.sessionId;
|
|
@@ -53191,7 +53240,8 @@ async function readQoderUsage(file2, signal) {
|
|
|
53191
53240
|
}
|
|
53192
53241
|
const session = {
|
|
53193
53242
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53194
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53243
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
53244
|
+
title: customTitle ?? summary ?? firstPrompt
|
|
53195
53245
|
};
|
|
53196
53246
|
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53197
53247
|
}
|
|
@@ -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
|
|
@@ -52976,6 +52983,20 @@ import path6 from "node:path";
|
|
|
52976
52983
|
import { createInterface } from "node:readline";
|
|
52977
52984
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
52978
52985
|
var MAX_CWD_LENGTH = 4096;
|
|
52986
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
52987
|
+
function usageSessionTitle(value) {
|
|
52988
|
+
if (typeof value !== "string")
|
|
52989
|
+
return void 0;
|
|
52990
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52991
|
+
if (!normalized)
|
|
52992
|
+
return void 0;
|
|
52993
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52994
|
+
return normalized;
|
|
52995
|
+
const characters = [...normalized];
|
|
52996
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
52997
|
+
return normalized;
|
|
52998
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
52999
|
+
}
|
|
52979
53000
|
function sessionIdOk(value) {
|
|
52980
53001
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52981
53002
|
}
|
|
@@ -52985,12 +53006,14 @@ function cwdOk(value) {
|
|
|
52985
53006
|
function withUsageSession(entry, session) {
|
|
52986
53007
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52987
53008
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
53009
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
52988
53010
|
if (sessionId === void 0 && cwd === void 0)
|
|
52989
53011
|
return entry;
|
|
52990
53012
|
return {
|
|
52991
53013
|
...entry,
|
|
52992
53014
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
52993
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
53015
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
53016
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
52994
53017
|
};
|
|
52995
53018
|
}
|
|
52996
53019
|
function tokenCount(value) {
|
|
@@ -53030,6 +53053,12 @@ function parseHarnessUsageEntry(value) {
|
|
|
53030
53053
|
return null;
|
|
53031
53054
|
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
53032
53055
|
return null;
|
|
53056
|
+
if (entry.sessionTitle !== void 0) {
|
|
53057
|
+
const sessionTitle = usageSessionTitle(entry.sessionTitle);
|
|
53058
|
+
if (sessionTitle === void 0)
|
|
53059
|
+
return null;
|
|
53060
|
+
entry.sessionTitle = sessionTitle;
|
|
53061
|
+
}
|
|
53033
53062
|
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
53034
53063
|
return null;
|
|
53035
53064
|
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
@@ -53141,6 +53170,16 @@ function qoderProjectsDirectory(environment, variant) {
|
|
|
53141
53170
|
function isRecord2(value) {
|
|
53142
53171
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53143
53172
|
}
|
|
53173
|
+
function qoderUserText(message) {
|
|
53174
|
+
if (!isRecord2(message))
|
|
53175
|
+
return void 0;
|
|
53176
|
+
const { content } = message;
|
|
53177
|
+
if (typeof content === "string")
|
|
53178
|
+
return content;
|
|
53179
|
+
if (!Array.isArray(content))
|
|
53180
|
+
return void 0;
|
|
53181
|
+
return content.filter((block) => isRecord2(block) && block.type === "text" && typeof block.text === "string").map((block) => String(block.text)).join(" ");
|
|
53182
|
+
}
|
|
53144
53183
|
function count2(value) {
|
|
53145
53184
|
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53146
53185
|
}
|
|
@@ -53148,8 +53187,18 @@ async function readQoderUsage(file2, signal) {
|
|
|
53148
53187
|
const messages = /* @__PURE__ */ new Map();
|
|
53149
53188
|
let sessionId;
|
|
53150
53189
|
let cwd;
|
|
53151
|
-
|
|
53190
|
+
let customTitle;
|
|
53191
|
+
let summary;
|
|
53192
|
+
let firstPrompt;
|
|
53193
|
+
for await (const line of jsonlRecords(file2, '"type"', signal)) {
|
|
53152
53194
|
signal.throwIfAborted();
|
|
53195
|
+
if (line.type === "custom-title")
|
|
53196
|
+
customTitle = usageSessionTitle(line.customTitle);
|
|
53197
|
+
else if (!summary && line.type === "summary")
|
|
53198
|
+
summary = usageSessionTitle(line.summary);
|
|
53199
|
+
else if (!firstPrompt && line.type === "user") {
|
|
53200
|
+
firstPrompt = usageSessionTitle(qoderUserText(line.message));
|
|
53201
|
+
}
|
|
53153
53202
|
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53154
53203
|
continue;
|
|
53155
53204
|
sessionId ??= line.sessionId;
|
|
@@ -53193,7 +53242,8 @@ async function readQoderUsage(file2, signal) {
|
|
|
53193
53242
|
}
|
|
53194
53243
|
const session = {
|
|
53195
53244
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53196
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53245
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
53246
|
+
title: customTitle ?? summary ?? firstPrompt
|
|
53197
53247
|
};
|
|
53198
53248
|
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53199
53249
|
}
|
|
@@ -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
|
|
@@ -17495,6 +17502,20 @@ import path2 from "node:path";
|
|
|
17495
17502
|
import { createInterface } from "node:readline";
|
|
17496
17503
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
17497
17504
|
var MAX_CWD_LENGTH = 4096;
|
|
17505
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
17506
|
+
function usageSessionTitle(value) {
|
|
17507
|
+
if (typeof value !== "string")
|
|
17508
|
+
return void 0;
|
|
17509
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
17510
|
+
if (!normalized)
|
|
17511
|
+
return void 0;
|
|
17512
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17513
|
+
return normalized;
|
|
17514
|
+
const characters = [...normalized];
|
|
17515
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
17516
|
+
return normalized;
|
|
17517
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
17518
|
+
}
|
|
17498
17519
|
function sessionIdOk(value) {
|
|
17499
17520
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
17500
17521
|
}
|
|
@@ -17504,12 +17525,14 @@ function cwdOk(value) {
|
|
|
17504
17525
|
function withUsageSession(entry, session) {
|
|
17505
17526
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
17506
17527
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
17528
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
17507
17529
|
if (sessionId === void 0 && cwd === void 0)
|
|
17508
17530
|
return entry;
|
|
17509
17531
|
return {
|
|
17510
17532
|
...entry,
|
|
17511
17533
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
17512
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
17534
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
17535
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
17513
17536
|
};
|
|
17514
17537
|
}
|
|
17515
17538
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -19008,11 +19031,30 @@ function historyUsage(contents) {
|
|
|
19008
19031
|
function record3(value) {
|
|
19009
19032
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
19010
19033
|
}
|
|
19034
|
+
function codeBuddyUserText(row) {
|
|
19035
|
+
if (row.type !== "message" || row.role !== "user")
|
|
19036
|
+
return void 0;
|
|
19037
|
+
const { content } = row;
|
|
19038
|
+
if (typeof content === "string")
|
|
19039
|
+
return content;
|
|
19040
|
+
if (!Array.isArray(content))
|
|
19041
|
+
return void 0;
|
|
19042
|
+
return content.map((part) => record3(part)).filter((part) => typeof part.text === "string").map((part) => String(part.text)).join(" ");
|
|
19043
|
+
}
|
|
19011
19044
|
async function readCodeBuddyUsage(file2, signal) {
|
|
19012
19045
|
const messages = /* @__PURE__ */ new Map();
|
|
19013
19046
|
let sessionId;
|
|
19014
19047
|
let cwd;
|
|
19015
|
-
|
|
19048
|
+
let customTitle;
|
|
19049
|
+
let generatedTitle;
|
|
19050
|
+
let firstPrompt;
|
|
19051
|
+
for await (const row of jsonlRecords(file2, '"type"', signal)) {
|
|
19052
|
+
if (row.type === "custom-title")
|
|
19053
|
+
customTitle = usageSessionTitle(row.customTitle);
|
|
19054
|
+
else if (row.type === "ai-title")
|
|
19055
|
+
generatedTitle = usageSessionTitle(row.aiTitle);
|
|
19056
|
+
else if (!firstPrompt)
|
|
19057
|
+
firstPrompt = usageSessionTitle(codeBuddyUserText(row));
|
|
19016
19058
|
if (typeof row.type !== "string" || !NATIVE_MESSAGE_TYPES.has(row.type))
|
|
19017
19059
|
continue;
|
|
19018
19060
|
sessionId ??= row.sessionId;
|
|
@@ -19034,7 +19076,8 @@ async function readCodeBuddyUsage(file2, signal) {
|
|
|
19034
19076
|
}
|
|
19035
19077
|
entries.push(withUsageSession(entry, {
|
|
19036
19078
|
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
19037
|
-
cwd: typeof cwd === "string" ? cwd : void 0
|
|
19079
|
+
cwd: typeof cwd === "string" ? cwd : void 0,
|
|
19080
|
+
title: customTitle ?? generatedTitle ?? firstPrompt
|
|
19038
19081
|
}));
|
|
19039
19082
|
}
|
|
19040
19083
|
}
|
|
@@ -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
|
|
@@ -16539,11 +16562,17 @@ async function readZcodeUsage(file2) {
|
|
|
16539
16562
|
try {
|
|
16540
16563
|
const entries = [];
|
|
16541
16564
|
const directories = /* @__PURE__ */ new Map();
|
|
16565
|
+
const titles = /* @__PURE__ */ new Map();
|
|
16542
16566
|
const hasSessions = database.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'session'").get();
|
|
16543
16567
|
if (hasSessions) {
|
|
16544
|
-
|
|
16568
|
+
const columns = new Set(database.prepare("PRAGMA table_info(session)").all().map((row) => String(row.name)));
|
|
16569
|
+
const titleColumn = columns.has("title") ? ", title" : "";
|
|
16570
|
+
for (const row of database.prepare(`SELECT id, directory${titleColumn} FROM session`).iterate()) {
|
|
16545
16571
|
if (typeof row.directory === "string")
|
|
16546
16572
|
directories.set(String(row.id), row.directory);
|
|
16573
|
+
const title = usageSessionTitle(row.title);
|
|
16574
|
+
if (title)
|
|
16575
|
+
titles.set(String(row.id), title);
|
|
16547
16576
|
}
|
|
16548
16577
|
}
|
|
16549
16578
|
for (const row of database.prepare("SELECT id, session_id, data FROM message").iterate()) {
|
|
@@ -16573,7 +16602,11 @@ async function readZcodeUsage(file2) {
|
|
|
16573
16602
|
const entry = usage.kind === "request" && at !== null && usageEntryFromRequest(usage.request, at);
|
|
16574
16603
|
if (entry) {
|
|
16575
16604
|
const sessionId = String(row.session_id);
|
|
16576
|
-
entries.push(withUsageSession(entry, {
|
|
16605
|
+
entries.push(withUsageSession(entry, {
|
|
16606
|
+
sessionId,
|
|
16607
|
+
cwd: directories.get(sessionId),
|
|
16608
|
+
title: titles.get(sessionId)
|
|
16609
|
+
}));
|
|
16577
16610
|
}
|
|
16578
16611
|
}
|
|
16579
16612
|
return entries;
|