@codexhost/cli-darwin-x64 0.13.0 → 0.13.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 +88 -44
- package/app/console-web.js +3681 -3948
- package/app/desktop-controller.mjs +8 -1
- package/app/host-runtime.mjs +457 -156
- package/app/plugins/antigravity/plugin.mjs +8 -1
- package/app/plugins/claude-code/plugin.mjs +34469 -23777
- package/app/plugins/codebuddy/plugin.mjs +47 -4
- package/app/plugins/codex-usage/plugin.mjs +639 -18
- 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 +8 -1
- 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 +11568 -7287
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -27737,6 +27737,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
27737
27737
|
harness,
|
|
27738
27738
|
sessionId: external_exports.string().min(1).max(512),
|
|
27739
27739
|
project: project.nullable(),
|
|
27740
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
27741
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
27740
27742
|
/** Models the session used, most requests first. */
|
|
27741
27743
|
models: external_exports.array(model).max(16),
|
|
27742
27744
|
firstAtMs: count,
|
|
@@ -27803,7 +27805,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
27803
27805
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
27804
27806
|
* requests without a native session are not listed here but count everywhere else.
|
|
27805
27807
|
*/
|
|
27806
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
27808
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
27809
|
+
/**
|
|
27810
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
27811
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
27812
|
+
*/
|
|
27813
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
27807
27814
|
});
|
|
27808
27815
|
|
|
27809
27816
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -4200,6 +4200,20 @@ import { zstdDecompressSync } from "node:zlib";
|
|
|
4200
4200
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
4201
4201
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
4202
4202
|
var MAX_CWD_LENGTH = 4096;
|
|
4203
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
4204
|
+
function usageSessionTitle(value) {
|
|
4205
|
+
if (typeof value !== "string")
|
|
4206
|
+
return void 0;
|
|
4207
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
4208
|
+
if (!normalized)
|
|
4209
|
+
return void 0;
|
|
4210
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
4211
|
+
return normalized;
|
|
4212
|
+
const characters = [...normalized];
|
|
4213
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
4214
|
+
return normalized;
|
|
4215
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
4216
|
+
}
|
|
4203
4217
|
function sessionIdOk(value) {
|
|
4204
4218
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
4205
4219
|
}
|
|
@@ -4209,12 +4223,14 @@ function cwdOk(value) {
|
|
|
4209
4223
|
function withUsageSession(entry, session) {
|
|
4210
4224
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
4211
4225
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
4226
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
4212
4227
|
if (sessionId === void 0 && cwd === void 0)
|
|
4213
4228
|
return entry;
|
|
4214
4229
|
return {
|
|
4215
4230
|
...entry,
|
|
4216
4231
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
4217
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
4232
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
4233
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
4218
4234
|
};
|
|
4219
4235
|
}
|
|
4220
4236
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -18904,6 +18920,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
18904
18920
|
harness,
|
|
18905
18921
|
sessionId: external_exports.string().min(1).max(512),
|
|
18906
18922
|
project: project.nullable(),
|
|
18923
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
18924
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
18907
18925
|
/** Models the session used, most requests first. */
|
|
18908
18926
|
models: external_exports.array(model).max(16),
|
|
18909
18927
|
firstAtMs: count,
|
|
@@ -18970,7 +18988,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
18970
18988
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
18971
18989
|
* requests without a native session are not listed here but count everywhere else.
|
|
18972
18990
|
*/
|
|
18973
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
18991
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
18992
|
+
/**
|
|
18993
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
18994
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
18995
|
+
*/
|
|
18996
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
18974
18997
|
});
|
|
18975
18998
|
|
|
18976
18999
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -22117,9 +22140,11 @@ async function readDshUsage(file2) {
|
|
|
22117
22140
|
if (entries.length === 0 && line.startsWith('{"type":"session"')) {
|
|
22118
22141
|
try {
|
|
22119
22142
|
const header = JSON.parse(line);
|
|
22143
|
+
const title = usageSessionTitle(header.title ?? header.name);
|
|
22120
22144
|
session = {
|
|
22121
22145
|
...typeof header.id === "string" ? { sessionId: header.id } : {},
|
|
22122
|
-
...typeof header.cwd === "string" ? { cwd: header.cwd } : {}
|
|
22146
|
+
...typeof header.cwd === "string" ? { cwd: header.cwd } : {},
|
|
22147
|
+
...title ? { title } : {}
|
|
22123
22148
|
};
|
|
22124
22149
|
} catch {
|
|
22125
22150
|
}
|
|
@@ -384,6 +384,20 @@ import path4 from "node:path";
|
|
|
384
384
|
import { createInterface } from "node:readline";
|
|
385
385
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
386
386
|
var MAX_CWD_LENGTH = 4096;
|
|
387
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
388
|
+
function usageSessionTitle(value) {
|
|
389
|
+
if (typeof value !== "string")
|
|
390
|
+
return void 0;
|
|
391
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
392
|
+
if (!normalized)
|
|
393
|
+
return void 0;
|
|
394
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
395
|
+
return normalized;
|
|
396
|
+
const characters = [...normalized];
|
|
397
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
398
|
+
return normalized;
|
|
399
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
400
|
+
}
|
|
387
401
|
function sessionIdOk(value) {
|
|
388
402
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
389
403
|
}
|
|
@@ -393,12 +407,14 @@ function cwdOk(value) {
|
|
|
393
407
|
function withUsageSession(entry, session) {
|
|
394
408
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
395
409
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
410
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
396
411
|
if (sessionId === void 0 && cwd === void 0)
|
|
397
412
|
return entry;
|
|
398
413
|
return {
|
|
399
414
|
...entry,
|
|
400
415
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
401
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
416
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
417
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
402
418
|
};
|
|
403
419
|
}
|
|
404
420
|
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
@@ -464,12 +480,18 @@ function count(value) {
|
|
|
464
480
|
function grokHome(environment) {
|
|
465
481
|
return environment.GROK_HOME || path5.join(environment.HOME || os2.homedir(), ".grok");
|
|
466
482
|
}
|
|
467
|
-
async function
|
|
483
|
+
async function grokSummary(directory) {
|
|
468
484
|
try {
|
|
469
485
|
const summary = JSON.parse(await readFile(path5.join(directory, "summary.json"), "utf8"));
|
|
470
|
-
|
|
486
|
+
if (!isRecord(summary))
|
|
487
|
+
return { forkedAt: null };
|
|
488
|
+
const title = usageSessionTitle(summary.generated_title) ?? usageSessionTitle(summary.session_summary);
|
|
489
|
+
return {
|
|
490
|
+
forkedAt: typeof summary.parent_session_id === "string" ? nativeTimeMs(summary.created_at) : null,
|
|
491
|
+
...title ? { title } : {}
|
|
492
|
+
};
|
|
471
493
|
} catch {
|
|
472
|
-
return null;
|
|
494
|
+
return { forkedAt: null };
|
|
473
495
|
}
|
|
474
496
|
}
|
|
475
497
|
function grokSession(file2) {
|
|
@@ -483,12 +505,18 @@ function grokSession(file2) {
|
|
|
483
505
|
return { sessionId: path5.basename(directory), cwd };
|
|
484
506
|
}
|
|
485
507
|
async function readGrokUsage(file2, signal) {
|
|
486
|
-
const
|
|
508
|
+
const summary = await grokSummary(path5.dirname(file2));
|
|
509
|
+
const forkedAt = summary.forkedAt;
|
|
510
|
+
let title = summary.title;
|
|
487
511
|
const session = grokSession(file2);
|
|
488
512
|
const entries = [];
|
|
489
|
-
for await (const line of jsonlRecords(file2, '"
|
|
513
|
+
for await (const line of jsonlRecords(file2, '"sessionUpdate"', signal)) {
|
|
490
514
|
const params = isRecord(line.params) ? line.params : {};
|
|
491
515
|
const update = isRecord(params.update) ? params.update : {};
|
|
516
|
+
if (!title && update.sessionUpdate === "user_message_chunk") {
|
|
517
|
+
title = usageSessionTitle(isRecord(update.content) ? update.content.text : void 0);
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
492
520
|
const usage = isRecord(update.usage) ? update.usage : {};
|
|
493
521
|
if (update.sessionUpdate !== "turn_completed" || typeof update.prompt_id !== "string")
|
|
494
522
|
continue;
|
|
@@ -519,7 +547,7 @@ async function readGrokUsage(file2, signal) {
|
|
|
519
547
|
// A turn Grok marks incomplete has no cost of its own; it counts as free rather
|
|
520
548
|
// than as a model without a price.
|
|
521
549
|
...ticks !== null ? { costUsd: ticks / USD_TICKS } : usage.usageIsIncomplete === true ? { costUsd: 0 } : {}
|
|
522
|
-
}, session));
|
|
550
|
+
}, { ...session, ...title ? { title } : {} }));
|
|
523
551
|
}
|
|
524
552
|
}
|
|
525
553
|
return entries;
|
|
@@ -15245,6 +15273,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15245
15273
|
harness,
|
|
15246
15274
|
sessionId: external_exports.string().min(1).max(512),
|
|
15247
15275
|
project: project.nullable(),
|
|
15276
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15277
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15248
15278
|
/** Models the session used, most requests first. */
|
|
15249
15279
|
models: external_exports.array(model).max(16),
|
|
15250
15280
|
firstAtMs: count2,
|
|
@@ -15311,7 +15341,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15311
15341
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15312
15342
|
* requests without a native session are not listed here but count everywhere else.
|
|
15313
15343
|
*/
|
|
15314
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15344
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15345
|
+
/**
|
|
15346
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15347
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15348
|
+
*/
|
|
15349
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15315
15350
|
});
|
|
15316
15351
|
|
|
15317
15352
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -15043,6 +15043,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15043
15043
|
harness,
|
|
15044
15044
|
sessionId: external_exports.string().min(1).max(512),
|
|
15045
15045
|
project: project.nullable(),
|
|
15046
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15047
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15046
15048
|
/** Models the session used, most requests first. */
|
|
15047
15049
|
models: external_exports.array(model).max(16),
|
|
15048
15050
|
firstAtMs: count,
|
|
@@ -15109,7 +15111,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15109
15111
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15110
15112
|
* requests without a native session are not listed here but count everywhere else.
|
|
15111
15113
|
*/
|
|
15112
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15114
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15115
|
+
/**
|
|
15116
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15117
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15118
|
+
*/
|
|
15119
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15113
15120
|
});
|
|
15114
15121
|
|
|
15115
15122
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -15163,6 +15163,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15163
15163
|
harness,
|
|
15164
15164
|
sessionId: external_exports.string().min(1).max(512),
|
|
15165
15165
|
project: project.nullable(),
|
|
15166
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15167
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15166
15168
|
/** Models the session used, most requests first. */
|
|
15167
15169
|
models: external_exports.array(model).max(16),
|
|
15168
15170
|
firstAtMs: count,
|
|
@@ -15229,7 +15231,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15229
15231
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15230
15232
|
* requests without a native session are not listed here but count everywhere else.
|
|
15231
15233
|
*/
|
|
15232
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15234
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15235
|
+
/**
|
|
15236
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15237
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15238
|
+
*/
|
|
15239
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15233
15240
|
});
|
|
15234
15241
|
|
|
15235
15242
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -15022,6 +15022,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15022
15022
|
harness,
|
|
15023
15023
|
sessionId: external_exports.string().min(1).max(512),
|
|
15024
15024
|
project: project.nullable(),
|
|
15025
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15026
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15025
15027
|
/** Models the session used, most requests first. */
|
|
15026
15028
|
models: external_exports.array(model).max(16),
|
|
15027
15029
|
firstAtMs: count,
|
|
@@ -15088,7 +15090,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15088
15090
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15089
15091
|
* requests without a native session are not listed here but count everywhere else.
|
|
15090
15092
|
*/
|
|
15091
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15093
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15094
|
+
/**
|
|
15095
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15096
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15097
|
+
*/
|
|
15098
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15092
15099
|
});
|
|
15093
15100
|
|
|
15094
15101
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -415,6 +415,20 @@ import path4 from "node:path";
|
|
|
415
415
|
import { createInterface } from "node:readline";
|
|
416
416
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
417
417
|
var MAX_CWD_LENGTH = 4096;
|
|
418
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
419
|
+
function usageSessionTitle(value) {
|
|
420
|
+
if (typeof value !== "string")
|
|
421
|
+
return void 0;
|
|
422
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
423
|
+
if (!normalized)
|
|
424
|
+
return void 0;
|
|
425
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
426
|
+
return normalized;
|
|
427
|
+
const characters = [...normalized];
|
|
428
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
429
|
+
return normalized;
|
|
430
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
431
|
+
}
|
|
418
432
|
function sessionIdOk(value) {
|
|
419
433
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
420
434
|
}
|
|
@@ -424,12 +438,14 @@ function cwdOk(value) {
|
|
|
424
438
|
function withUsageSession(entry, session) {
|
|
425
439
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
426
440
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
441
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
427
442
|
if (sessionId === void 0 && cwd === void 0)
|
|
428
443
|
return entry;
|
|
429
444
|
return {
|
|
430
445
|
...entry,
|
|
431
446
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
432
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
447
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
448
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
433
449
|
};
|
|
434
450
|
}
|
|
435
451
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -15206,6 +15222,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15206
15222
|
harness,
|
|
15207
15223
|
sessionId: external_exports.string().min(1).max(512),
|
|
15208
15224
|
project: project.nullable(),
|
|
15225
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15226
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15209
15227
|
/** Models the session used, most requests first. */
|
|
15210
15228
|
models: external_exports.array(model).max(16),
|
|
15211
15229
|
firstAtMs: count,
|
|
@@ -15272,7 +15290,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15272
15290
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15273
15291
|
* requests without a native session are not listed here but count everywhere else.
|
|
15274
15292
|
*/
|
|
15275
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15293
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15294
|
+
/**
|
|
15295
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15296
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15297
|
+
*/
|
|
15298
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15276
15299
|
});
|
|
15277
15300
|
|
|
15278
15301
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -17621,9 +17644,11 @@ function ompUsageHistory(history) {
|
|
|
17621
17644
|
async function readOmpUsage(file2, signal) {
|
|
17622
17645
|
const entries = [];
|
|
17623
17646
|
const header = await jsonlHeader(file2, (record2) => record2.type === "session", signal);
|
|
17647
|
+
const titled = await jsonlHeader(file2, (record2) => record2.type === "title", signal);
|
|
17624
17648
|
const session = {
|
|
17625
17649
|
sessionId: typeof header?.id === "string" ? header.id : void 0,
|
|
17626
|
-
cwd: typeof header?.cwd === "string" ? header.cwd : void 0
|
|
17650
|
+
cwd: typeof header?.cwd === "string" ? header.cwd : void 0,
|
|
17651
|
+
title: usageSessionTitle(titled?.title)
|
|
17627
17652
|
};
|
|
17628
17653
|
for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
|
|
17629
17654
|
if (line.type !== "message")
|
|
@@ -21306,11 +21331,10 @@ var OmpHarnessSession = class {
|
|
|
21306
21331
|
state = await transport.selectThinkingOption(this.#requestedThinkingOptionId);
|
|
21307
21332
|
thinkingLevels = await transport.getAvailableThinkingLevels();
|
|
21308
21333
|
}
|
|
21309
|
-
} else {
|
|
21310
|
-
const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
|
|
21311
|
-
state = reconciled.state;
|
|
21312
|
-
thinkingLevels = reconciled.thinkingLevels;
|
|
21313
21334
|
}
|
|
21335
|
+
const reconciled = await reconcileThinkingLevel(transport, state, thinkingLevels);
|
|
21336
|
+
state = reconciled.state;
|
|
21337
|
+
thinkingLevels = reconciled.thinkingLevels;
|
|
21314
21338
|
this.#transport = transport;
|
|
21315
21339
|
this.#publishTransportState(state, thinkingLevels);
|
|
21316
21340
|
return transport;
|
|
@@ -495,6 +495,20 @@ import { lstat } from "node:fs/promises";
|
|
|
495
495
|
// ../../harness-adapter/dist/usage-statistics.js
|
|
496
496
|
var MAX_SESSION_ID_LENGTH = 512;
|
|
497
497
|
var MAX_CWD_LENGTH = 4096;
|
|
498
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
499
|
+
function usageSessionTitle(value) {
|
|
500
|
+
if (typeof value !== "string")
|
|
501
|
+
return void 0;
|
|
502
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
503
|
+
if (!normalized)
|
|
504
|
+
return void 0;
|
|
505
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
506
|
+
return normalized;
|
|
507
|
+
const characters = [...normalized];
|
|
508
|
+
if (characters.length <= MAX_SESSION_TITLE_LENGTH)
|
|
509
|
+
return normalized;
|
|
510
|
+
return `${characters.slice(0, MAX_SESSION_TITLE_LENGTH - 1).join("").trimEnd()}…`;
|
|
511
|
+
}
|
|
498
512
|
function sessionIdOk(value) {
|
|
499
513
|
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
500
514
|
}
|
|
@@ -504,12 +518,14 @@ function cwdOk(value) {
|
|
|
504
518
|
function withUsageSession(entry, session) {
|
|
505
519
|
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
506
520
|
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
521
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
507
522
|
if (sessionId === void 0 && cwd === void 0)
|
|
508
523
|
return entry;
|
|
509
524
|
return {
|
|
510
525
|
...entry,
|
|
511
526
|
...sessionId !== void 0 ? { sessionId } : {},
|
|
512
|
-
...cwd !== void 0 ? { cwd } : {}
|
|
527
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
528
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
513
529
|
};
|
|
514
530
|
}
|
|
515
531
|
function usageEntryFromRequest(request, occurredAtMs) {
|
|
@@ -15203,6 +15219,8 @@ var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
|
15203
15219
|
harness,
|
|
15204
15220
|
sessionId: external_exports.string().min(1).max(512),
|
|
15205
15221
|
project: project.nullable(),
|
|
15222
|
+
/** Persisted Desktop title for a mapped Session, otherwise its native name; may be absent. */
|
|
15223
|
+
title: external_exports.string().min(1).max(200).optional(),
|
|
15206
15224
|
/** Models the session used, most requests first. */
|
|
15207
15225
|
models: external_exports.array(model).max(16),
|
|
15208
15226
|
firstAtMs: count,
|
|
@@ -15269,7 +15287,12 @@ var usageStatisticsResultSchema = external_exports.strictObject({
|
|
|
15269
15287
|
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
15270
15288
|
* requests without a native session are not listed here but count everywhere else.
|
|
15271
15289
|
*/
|
|
15272
|
-
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
15290
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100),
|
|
15291
|
+
/**
|
|
15292
|
+
* The sessions last active in the range, newest first, all filters applied. Optional for older
|
|
15293
|
+
* Hosts; missing is treated as no list rather than no sessions.
|
|
15294
|
+
*/
|
|
15295
|
+
recentSessions: external_exports.array(usageStatisticsSessionSchema).max(100).optional()
|
|
15273
15296
|
});
|
|
15274
15297
|
|
|
15275
15298
|
// ../../shared-contracts/dist/ids.js
|
|
@@ -16732,12 +16755,18 @@ async function readOpenCodeUsage(file2) {
|
|
|
16732
16755
|
try {
|
|
16733
16756
|
const tables = new Set(database.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((row) => String(row.name)));
|
|
16734
16757
|
const directories = /* @__PURE__ */ new Map();
|
|
16758
|
+
const titles = /* @__PURE__ */ new Map();
|
|
16735
16759
|
for (const table of ["session", "session_v2"]) {
|
|
16736
16760
|
if (!tables.has(table))
|
|
16737
16761
|
continue;
|
|
16738
|
-
|
|
16762
|
+
const columns = new Set(database.prepare(`PRAGMA table_info(${table})`).all().map((row) => String(row.name)));
|
|
16763
|
+
const titleColumn = columns.has("title") ? ", title" : "";
|
|
16764
|
+
for (const row of database.prepare(`SELECT id, directory${titleColumn} FROM ${table}`).iterate()) {
|
|
16739
16765
|
if (typeof row.directory === "string")
|
|
16740
16766
|
directories.set(String(row.id), row.directory);
|
|
16767
|
+
const title = usageSessionTitle(row.title);
|
|
16768
|
+
if (title)
|
|
16769
|
+
titles.set(String(row.id), title);
|
|
16741
16770
|
}
|
|
16742
16771
|
}
|
|
16743
16772
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -16754,7 +16783,8 @@ async function readOpenCodeUsage(file2) {
|
|
|
16754
16783
|
const sessionId = typeof session === "string" ? session : void 0;
|
|
16755
16784
|
entries.set(entry.id, withUsageSession(entry, {
|
|
16756
16785
|
sessionId,
|
|
16757
|
-
cwd: sessionId === void 0 ? void 0 : directories.get(sessionId)
|
|
16786
|
+
cwd: sessionId === void 0 ? void 0 : directories.get(sessionId),
|
|
16787
|
+
title: sessionId === void 0 ? void 0 : titles.get(sessionId)
|
|
16758
16788
|
}));
|
|
16759
16789
|
}
|
|
16760
16790
|
};
|