@liberseek/boft-cli-linux-x64 0.7.9 → 0.8.0
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 +8 -0
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +232 -21
- package/app/console-web.js +9669 -5390
- package/app/desktop-controller.mjs +252 -42
- package/app/host-runtime.mjs +5361 -1491
- package/app/plugins/antigravity/manifest.json +18 -1
- package/app/plugins/antigravity/plugin.mjs +276 -42
- package/app/plugins/claude-code/manifest.json +28 -0
- package/app/plugins/claude-code/plugin.mjs +1055 -391
- package/app/plugins/codebuddy/manifest.json +17 -0
- package/app/plugins/codebuddy/plugin.mjs +5931 -5358
- package/app/plugins/codex-usage/manifest.json +9 -0
- package/app/plugins/codex-usage/plugin.mjs +16750 -0
- package/app/plugins/cursor-cli/manifest.json +18 -1
- package/app/plugins/cursor-cli/plugin.mjs +351 -77
- package/app/plugins/deepseek-harness/assets/icon.svg +1 -0
- package/app/plugins/deepseek-harness/manifest.json +35 -2
- package/app/plugins/deepseek-harness/plugin.mjs +798 -242
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/manifest.json +21 -1
- package/app/plugins/grok/plugin.mjs +898 -268
- package/app/plugins/hermes/assets/icon.png +0 -0
- package/app/plugins/hermes/manifest.json +30 -2
- package/app/plugins/hermes/plugin.mjs +278 -33
- package/app/plugins/kimi-code/assets/icon.svg +5 -0
- package/app/plugins/kimi-code/manifest.json +25 -2
- package/app/plugins/kimi-code/plugin.mjs +555 -36
- package/app/plugins/kiro-cli/assets/kiro-agent.svg +11 -0
- package/app/plugins/kiro-cli/manifest.json +18 -1
- package/app/plugins/kiro-cli/plugin.mjs +284 -22
- package/app/plugins/muse/manifest.json +18 -1
- package/app/plugins/muse/plugin.mjs +251 -17
- package/app/plugins/omp/manifest.json +21 -1
- package/app/plugins/omp/plugin.mjs +2741 -1960
- package/app/plugins/opencode/manifest.json +18 -1
- package/app/plugins/opencode/plugin.mjs +694 -147
- package/app/plugins/pi/manifest.json +32 -0
- package/app/plugins/pi/plugin.mjs +3396 -2841
- package/app/plugins/qoder/manifest.json +18 -1
- package/app/plugins/qoder/plugin.mjs +585 -81
- package/app/plugins/qoder-cn/manifest.json +18 -1
- package/app/plugins/qoder-cn/plugin.mjs +585 -81
- package/app/plugins/workbuddy/manifest.json +18 -0
- package/app/plugins/workbuddy/plugin.mjs +6317 -5746
- package/app/plugins/zcode/manifest.json +19 -1
- package/app/plugins/zcode/plugin.mjs +1066 -260
- package/app/renderer-extension.js +2731 -2427
- package/bin/boft +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/licenses/Cordis-LICENSE.txt +21 -0
- package/licenses/Cosmokit-LICENSE.txt +21 -0
- package/package.json +1 -1
- package/app/plugins/kiro-cli/assets/icon.svg +0 -5
|
@@ -2220,20 +2220,20 @@ var require_resolve = __commonJS({
|
|
|
2220
2220
|
return false;
|
|
2221
2221
|
}
|
|
2222
2222
|
function countKeys(schema) {
|
|
2223
|
-
let
|
|
2223
|
+
let count3 = 0;
|
|
2224
2224
|
for (const key in schema) {
|
|
2225
2225
|
if (key === "$ref")
|
|
2226
2226
|
return Infinity;
|
|
2227
|
-
|
|
2227
|
+
count3++;
|
|
2228
2228
|
if (SIMPLE_INLINED.has(key))
|
|
2229
2229
|
continue;
|
|
2230
2230
|
if (typeof schema[key] == "object") {
|
|
2231
|
-
(0, util_1.eachItem)(schema[key], (sch) =>
|
|
2231
|
+
(0, util_1.eachItem)(schema[key], (sch) => count3 += countKeys(sch));
|
|
2232
2232
|
}
|
|
2233
|
-
if (
|
|
2233
|
+
if (count3 === Infinity)
|
|
2234
2234
|
return Infinity;
|
|
2235
2235
|
}
|
|
2236
|
-
return
|
|
2236
|
+
return count3;
|
|
2237
2237
|
}
|
|
2238
2238
|
function getFullPath(resolver, id = "", normalize) {
|
|
2239
2239
|
if (normalize !== false)
|
|
@@ -3155,7 +3155,7 @@ var require_utils = __commonJS({
|
|
|
3155
3155
|
return true;
|
|
3156
3156
|
}
|
|
3157
3157
|
function getIPV6(input) {
|
|
3158
|
-
let
|
|
3158
|
+
let tokenCount2 = 0;
|
|
3159
3159
|
const output = { error: false, address: "", zone: "" };
|
|
3160
3160
|
const address = [];
|
|
3161
3161
|
const buffer = [];
|
|
@@ -3174,7 +3174,7 @@ var require_utils = __commonJS({
|
|
|
3174
3174
|
if (!consume(buffer, address, output)) {
|
|
3175
3175
|
break;
|
|
3176
3176
|
}
|
|
3177
|
-
if (++
|
|
3177
|
+
if (++tokenCount2 > 7) {
|
|
3178
3178
|
output.error = true;
|
|
3179
3179
|
break;
|
|
3180
3180
|
}
|
|
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
|
|
|
3229
3229
|
}
|
|
3230
3230
|
return ind;
|
|
3231
3231
|
}
|
|
3232
|
-
function removeDotSegments(
|
|
3233
|
-
let input =
|
|
3232
|
+
function removeDotSegments(path10) {
|
|
3233
|
+
let input = path10;
|
|
3234
3234
|
const output = [];
|
|
3235
3235
|
let nextSlash = -1;
|
|
3236
3236
|
let len = 0;
|
|
@@ -3482,8 +3482,8 @@ var require_schemes = __commonJS({
|
|
|
3482
3482
|
wsComponent.secure = void 0;
|
|
3483
3483
|
}
|
|
3484
3484
|
if (wsComponent.resourceName) {
|
|
3485
|
-
const [
|
|
3486
|
-
wsComponent.path =
|
|
3485
|
+
const [path10, query] = wsComponent.resourceName.split("?");
|
|
3486
|
+
wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
|
|
3487
3487
|
wsComponent.query = query;
|
|
3488
3488
|
wsComponent.resourceName = void 0;
|
|
3489
3489
|
}
|
|
@@ -5411,8 +5411,8 @@ var require_contains = __commonJS({
|
|
|
5411
5411
|
cxt.result(valid, () => cxt.reset());
|
|
5412
5412
|
function validateItemsWithCount() {
|
|
5413
5413
|
const schValid = gen.name("_valid");
|
|
5414
|
-
const
|
|
5415
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
5414
|
+
const count3 = gen.let("count", 0);
|
|
5415
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
|
|
5416
5416
|
}
|
|
5417
5417
|
function validateItems(_valid, block) {
|
|
5418
5418
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -5425,16 +5425,16 @@ var require_contains = __commonJS({
|
|
|
5425
5425
|
block();
|
|
5426
5426
|
});
|
|
5427
5427
|
}
|
|
5428
|
-
function checkLimits(
|
|
5429
|
-
gen.code((0, codegen_1._)`${
|
|
5428
|
+
function checkLimits(count3) {
|
|
5429
|
+
gen.code((0, codegen_1._)`${count3}++`);
|
|
5430
5430
|
if (max === void 0) {
|
|
5431
|
-
gen.if((0, codegen_1._)`${
|
|
5431
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true).break());
|
|
5432
5432
|
} else {
|
|
5433
|
-
gen.if((0, codegen_1._)`${
|
|
5433
|
+
gen.if((0, codegen_1._)`${count3} > ${max}`, () => gen.assign(valid, false).break());
|
|
5434
5434
|
if (min === 1)
|
|
5435
5435
|
gen.assign(valid, true);
|
|
5436
5436
|
else
|
|
5437
|
-
gen.if((0, codegen_1._)`${
|
|
5437
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true));
|
|
5438
5438
|
}
|
|
5439
5439
|
}
|
|
5440
5440
|
}
|
|
@@ -8933,20 +8933,20 @@ var require_resolve2 = __commonJS({
|
|
|
8933
8933
|
return false;
|
|
8934
8934
|
}
|
|
8935
8935
|
function countKeys(schema) {
|
|
8936
|
-
let
|
|
8936
|
+
let count3 = 0;
|
|
8937
8937
|
for (const key in schema) {
|
|
8938
8938
|
if (key === "$ref")
|
|
8939
8939
|
return Infinity;
|
|
8940
|
-
|
|
8940
|
+
count3++;
|
|
8941
8941
|
if (SIMPLE_INLINED.has(key))
|
|
8942
8942
|
continue;
|
|
8943
8943
|
if (typeof schema[key] == "object") {
|
|
8944
|
-
(0, util_1.eachItem)(schema[key], (sch) =>
|
|
8944
|
+
(0, util_1.eachItem)(schema[key], (sch) => count3 += countKeys(sch));
|
|
8945
8945
|
}
|
|
8946
|
-
if (
|
|
8946
|
+
if (count3 === Infinity)
|
|
8947
8947
|
return Infinity;
|
|
8948
8948
|
}
|
|
8949
|
-
return
|
|
8949
|
+
return count3;
|
|
8950
8950
|
}
|
|
8951
8951
|
function getFullPath(resolver, id = "", normalize) {
|
|
8952
8952
|
if (normalize !== false)
|
|
@@ -11309,8 +11309,8 @@ var require_contains2 = __commonJS({
|
|
|
11309
11309
|
cxt.result(valid, () => cxt.reset());
|
|
11310
11310
|
function validateItemsWithCount() {
|
|
11311
11311
|
const schValid = gen.name("_valid");
|
|
11312
|
-
const
|
|
11313
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
11312
|
+
const count3 = gen.let("count", 0);
|
|
11313
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
|
|
11314
11314
|
}
|
|
11315
11315
|
function validateItems(_valid, block) {
|
|
11316
11316
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -11323,16 +11323,16 @@ var require_contains2 = __commonJS({
|
|
|
11323
11323
|
block();
|
|
11324
11324
|
});
|
|
11325
11325
|
}
|
|
11326
|
-
function checkLimits(
|
|
11327
|
-
gen.code((0, codegen_1._)`${
|
|
11326
|
+
function checkLimits(count3) {
|
|
11327
|
+
gen.code((0, codegen_1._)`${count3}++`);
|
|
11328
11328
|
if (max === void 0) {
|
|
11329
|
-
gen.if((0, codegen_1._)`${
|
|
11329
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true).break());
|
|
11330
11330
|
} else {
|
|
11331
|
-
gen.if((0, codegen_1._)`${
|
|
11331
|
+
gen.if((0, codegen_1._)`${count3} > ${max}`, () => gen.assign(valid, false).break());
|
|
11332
11332
|
if (min === 1)
|
|
11333
11333
|
gen.assign(valid, true);
|
|
11334
11334
|
else
|
|
11335
|
-
gen.if((0, codegen_1._)`${
|
|
11335
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true));
|
|
11336
11336
|
}
|
|
11337
11337
|
}
|
|
11338
11338
|
}
|
|
@@ -12592,7 +12592,7 @@ var require_dist = __commonJS({
|
|
|
12592
12592
|
|
|
12593
12593
|
// ../qoder/dist/qoder-adapter.js
|
|
12594
12594
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12595
|
-
import
|
|
12595
|
+
import path9 from "node:path";
|
|
12596
12596
|
|
|
12597
12597
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
12598
12598
|
var external_exports = {};
|
|
@@ -13360,10 +13360,10 @@ function mergeDefs(...defs) {
|
|
|
13360
13360
|
function cloneDef(schema) {
|
|
13361
13361
|
return mergeDefs(schema._zod.def);
|
|
13362
13362
|
}
|
|
13363
|
-
function getElementAtPath(obj,
|
|
13364
|
-
if (!
|
|
13363
|
+
function getElementAtPath(obj, path10) {
|
|
13364
|
+
if (!path10)
|
|
13365
13365
|
return obj;
|
|
13366
|
-
return
|
|
13366
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
13367
13367
|
}
|
|
13368
13368
|
function promiseAllObject(promisesObj) {
|
|
13369
13369
|
const keys = Object.keys(promisesObj);
|
|
@@ -13772,11 +13772,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
13772
13772
|
}
|
|
13773
13773
|
return false;
|
|
13774
13774
|
}
|
|
13775
|
-
function prefixIssues(
|
|
13775
|
+
function prefixIssues(path10, issues) {
|
|
13776
13776
|
return issues.map((iss) => {
|
|
13777
13777
|
var _a5;
|
|
13778
13778
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
13779
|
-
iss.path.unshift(
|
|
13779
|
+
iss.path.unshift(path10);
|
|
13780
13780
|
return iss;
|
|
13781
13781
|
});
|
|
13782
13782
|
}
|
|
@@ -13923,16 +13923,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13923
13923
|
}
|
|
13924
13924
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
13925
13925
|
const fieldErrors = { _errors: [] };
|
|
13926
|
-
const processError = (error52,
|
|
13926
|
+
const processError = (error52, path10 = []) => {
|
|
13927
13927
|
for (const issue2 of error52.issues) {
|
|
13928
13928
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13929
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
13929
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
13930
13930
|
} else if (issue2.code === "invalid_key") {
|
|
13931
|
-
processError({ issues: issue2.issues }, [...
|
|
13931
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
13932
13932
|
} else if (issue2.code === "invalid_element") {
|
|
13933
|
-
processError({ issues: issue2.issues }, [...
|
|
13933
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
13934
13934
|
} else {
|
|
13935
|
-
const fullpath = [...
|
|
13935
|
+
const fullpath = [...path10, ...issue2.path];
|
|
13936
13936
|
if (fullpath.length === 0) {
|
|
13937
13937
|
fieldErrors._errors.push(mapper(issue2));
|
|
13938
13938
|
} else {
|
|
@@ -13959,17 +13959,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
13959
13959
|
}
|
|
13960
13960
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
13961
13961
|
const result = { errors: [] };
|
|
13962
|
-
const processError = (error52,
|
|
13962
|
+
const processError = (error52, path10 = []) => {
|
|
13963
13963
|
var _a5, _b;
|
|
13964
13964
|
for (const issue2 of error52.issues) {
|
|
13965
13965
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
13966
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
13966
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
13967
13967
|
} else if (issue2.code === "invalid_key") {
|
|
13968
|
-
processError({ issues: issue2.issues }, [...
|
|
13968
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
13969
13969
|
} else if (issue2.code === "invalid_element") {
|
|
13970
|
-
processError({ issues: issue2.issues }, [...
|
|
13970
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
13971
13971
|
} else {
|
|
13972
|
-
const fullpath = [...
|
|
13972
|
+
const fullpath = [...path10, ...issue2.path];
|
|
13973
13973
|
if (fullpath.length === 0) {
|
|
13974
13974
|
result.errors.push(mapper(issue2));
|
|
13975
13975
|
continue;
|
|
@@ -14001,8 +14001,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14001
14001
|
}
|
|
14002
14002
|
function toDotPath(_path) {
|
|
14003
14003
|
const segs = [];
|
|
14004
|
-
const
|
|
14005
|
-
for (const seg of
|
|
14004
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14005
|
+
for (const seg of path10) {
|
|
14006
14006
|
if (typeof seg === "number")
|
|
14007
14007
|
segs.push(`[${seg}]`);
|
|
14008
14008
|
else if (typeof seg === "symbol")
|
|
@@ -17230,8 +17230,8 @@ function az_default() {
|
|
|
17230
17230
|
}
|
|
17231
17231
|
|
|
17232
17232
|
// ../../../node_modules/zod/v4/locales/be.js
|
|
17233
|
-
function getBelarusianPlural(
|
|
17234
|
-
const absCount = Math.abs(
|
|
17233
|
+
function getBelarusianPlural(count3, one, few, many) {
|
|
17234
|
+
const absCount = Math.abs(count3);
|
|
17235
17235
|
const lastDigit = absCount % 10;
|
|
17236
17236
|
const lastTwoDigits = absCount % 100;
|
|
17237
17237
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -19309,8 +19309,8 @@ function hu_default() {
|
|
|
19309
19309
|
}
|
|
19310
19310
|
|
|
19311
19311
|
// ../../../node_modules/zod/v4/locales/hy.js
|
|
19312
|
-
function getArmenianPlural(
|
|
19313
|
-
return Math.abs(
|
|
19312
|
+
function getArmenianPlural(count3, one, many) {
|
|
19313
|
+
return Math.abs(count3) === 1 ? one : many;
|
|
19314
19314
|
}
|
|
19315
19315
|
function withDefiniteArticle(word) {
|
|
19316
19316
|
if (!word)
|
|
@@ -21438,8 +21438,8 @@ function ro_default() {
|
|
|
21438
21438
|
}
|
|
21439
21439
|
|
|
21440
21440
|
// ../../../node_modules/zod/v4/locales/ru.js
|
|
21441
|
-
function getRussianPlural(
|
|
21442
|
-
const absCount = Math.abs(
|
|
21441
|
+
function getRussianPlural(count3, one, few, many) {
|
|
21442
|
+
const absCount = Math.abs(count3);
|
|
21443
21443
|
const lastDigit = absCount % 10;
|
|
21444
21444
|
const lastTwoDigits = absCount % 100;
|
|
21445
21445
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -26694,13 +26694,13 @@ function resolveRef(ref, ctx) {
|
|
|
26694
26694
|
if (!ref.startsWith("#")) {
|
|
26695
26695
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
26696
26696
|
}
|
|
26697
|
-
const
|
|
26698
|
-
if (
|
|
26697
|
+
const path10 = ref.slice(1).split("/").filter(Boolean);
|
|
26698
|
+
if (path10.length === 0) {
|
|
26699
26699
|
return ctx.rootSchema;
|
|
26700
26700
|
}
|
|
26701
26701
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
26702
|
-
if (
|
|
26703
|
-
const key =
|
|
26702
|
+
if (path10[0] === defsKey) {
|
|
26703
|
+
const key = path10[1];
|
|
26704
26704
|
if (!key || !ctx.defs[key]) {
|
|
26705
26705
|
throw new Error(`Reference not found: ${ref}`);
|
|
26706
26706
|
}
|
|
@@ -27108,6 +27108,15 @@ function date4(params) {
|
|
|
27108
27108
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
27109
27109
|
config(en_default());
|
|
27110
27110
|
|
|
27111
|
+
// ../../shared-contracts/dist/delegation-read.js
|
|
27112
|
+
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
27113
|
+
var delegationReadParamsSchema = external_exports.strictObject({
|
|
27114
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
27115
|
+
view: external_exports.enum(["result", "messages"]),
|
|
27116
|
+
cursor: external_exports.string().min(1).max(8192).optional(),
|
|
27117
|
+
limit: external_exports.number().int().min(1).max(100).optional()
|
|
27118
|
+
});
|
|
27119
|
+
|
|
27111
27120
|
// ../../shared-contracts/dist/credential-imports.js
|
|
27112
27121
|
var credentialSourceSchema = external_exports.object({
|
|
27113
27122
|
id: external_exports.string().min(1).max(256),
|
|
@@ -27178,6 +27187,153 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
27178
27187
|
initializeOnly: external_exports.boolean().optional()
|
|
27179
27188
|
});
|
|
27180
27189
|
|
|
27190
|
+
// ../../shared-contracts/dist/model-price-overrides.js
|
|
27191
|
+
var usdPerMillionTokens = external_exports.number().finite().nonnegative();
|
|
27192
|
+
var modelPriceOverrideSchema = external_exports.strictObject({
|
|
27193
|
+
input: usdPerMillionTokens,
|
|
27194
|
+
output: usdPerMillionTokens,
|
|
27195
|
+
cacheRead: usdPerMillionTokens.optional(),
|
|
27196
|
+
cacheWrite: usdPerMillionTokens.optional(),
|
|
27197
|
+
cacheWrite1h: usdPerMillionTokens.optional()
|
|
27198
|
+
});
|
|
27199
|
+
var modelPriceKeySchema = external_exports.string().max(512).refine((key) => key.trim() === key && key.length > 0, "Model ID is required");
|
|
27200
|
+
var modelPriceOverridesSchema = external_exports.strictObject({
|
|
27201
|
+
/** Absolute path of the Host's `pricing.json`. */
|
|
27202
|
+
path: external_exports.string(),
|
|
27203
|
+
entries: external_exports.array(external_exports.strictObject({ key: external_exports.string(), price: modelPriceOverrideSchema })),
|
|
27204
|
+
/** Why the existing file is unusable; the Host then ignores it and refuses to overwrite it. */
|
|
27205
|
+
error: external_exports.string().nullable()
|
|
27206
|
+
});
|
|
27207
|
+
var modelPriceOverridesGetSchema = external_exports.strictObject({});
|
|
27208
|
+
var modelPriceOverridesSetSchema = external_exports.strictObject({
|
|
27209
|
+
key: modelPriceKeySchema,
|
|
27210
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
27211
|
+
previousKey: modelPriceKeySchema.optional()
|
|
27212
|
+
});
|
|
27213
|
+
var modelPriceDefaultParamsSchema = external_exports.strictObject({
|
|
27214
|
+
model: modelPriceKeySchema
|
|
27215
|
+
});
|
|
27216
|
+
var modelPriceSuggestionSchema = external_exports.strictObject({
|
|
27217
|
+
/** Verified from catalog canonical links, not inferred from names or equal prices. */
|
|
27218
|
+
official: external_exports.boolean().optional(),
|
|
27219
|
+
canonicalModelId: external_exports.string().min(1).optional(),
|
|
27220
|
+
provider: external_exports.string().min(1).max(512),
|
|
27221
|
+
model: external_exports.string().min(1).max(512),
|
|
27222
|
+
price: modelPriceOverrideSchema
|
|
27223
|
+
});
|
|
27224
|
+
var modelPriceDefaultResultSchema = external_exports.strictObject({
|
|
27225
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
27226
|
+
/** Local catalog suggestions only; never used automatically for pricing. */
|
|
27227
|
+
suggestions: external_exports.array(modelPriceSuggestionSchema).max(6).optional()
|
|
27228
|
+
});
|
|
27229
|
+
|
|
27230
|
+
// ../../shared-contracts/dist/usage-statistics.js
|
|
27231
|
+
var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
|
|
27232
|
+
var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
27233
|
+
var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
|
|
27234
|
+
var harness = external_exports.string().min(1).max(128);
|
|
27235
|
+
var model = external_exports.string().min(1).max(512);
|
|
27236
|
+
var project = external_exports.string().min(1).max(4096);
|
|
27237
|
+
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
27238
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
27239
|
+
harness: harness.optional(),
|
|
27240
|
+
model: model.nullable().optional(),
|
|
27241
|
+
project: project.nullable().optional(),
|
|
27242
|
+
/** One local date inside the range. */
|
|
27243
|
+
date: localDate.optional()
|
|
27244
|
+
});
|
|
27245
|
+
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
27246
|
+
requests: count,
|
|
27247
|
+
inputTokens: count,
|
|
27248
|
+
cachedInputTokens: count,
|
|
27249
|
+
cacheWriteInputTokens: count,
|
|
27250
|
+
cacheKnownInputTokens: count,
|
|
27251
|
+
outputTokens: count,
|
|
27252
|
+
reasoningOutputTokens: count,
|
|
27253
|
+
/** USD at the public price, summed over the priced requests only. */
|
|
27254
|
+
costUsd: external_exports.number().finite().min(0),
|
|
27255
|
+
/** Requests without a price (or the cache data the price needs); not in `costUsd`. */
|
|
27256
|
+
unpricedRequests: count,
|
|
27257
|
+
/**
|
|
27258
|
+
* Requests whose storage gave no token counts: counted as requests, with neither tokens nor
|
|
27259
|
+
* cost, and not as unpriced.
|
|
27260
|
+
*/
|
|
27261
|
+
unmeteredRequests: count
|
|
27262
|
+
});
|
|
27263
|
+
var totals = usageStatisticsTotalsSchema.shape;
|
|
27264
|
+
var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
27265
|
+
harness,
|
|
27266
|
+
sessionId: external_exports.string().min(1).max(512),
|
|
27267
|
+
project: project.nullable(),
|
|
27268
|
+
/** Models the session used, most requests first. */
|
|
27269
|
+
models: external_exports.array(model).max(16),
|
|
27270
|
+
firstAtMs: count,
|
|
27271
|
+
lastAtMs: count,
|
|
27272
|
+
...totals
|
|
27273
|
+
});
|
|
27274
|
+
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
27275
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
27276
|
+
/** First local date of the range; null for all time. */
|
|
27277
|
+
from: localDate.nullable(),
|
|
27278
|
+
to: localDate,
|
|
27279
|
+
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
27280
|
+
filters: external_exports.strictObject({
|
|
27281
|
+
harness: harness.nullable(),
|
|
27282
|
+
model: model.nullable(),
|
|
27283
|
+
unknownModel: external_exports.boolean(),
|
|
27284
|
+
project: project.nullable(),
|
|
27285
|
+
unknownProject: external_exports.boolean(),
|
|
27286
|
+
date: localDate.nullable()
|
|
27287
|
+
}),
|
|
27288
|
+
/** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
|
|
27289
|
+
reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
|
|
27290
|
+
/** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
|
|
27291
|
+
failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
|
|
27292
|
+
/** Every value seen in the range, ignoring the filters, to choose filters from. */
|
|
27293
|
+
options: external_exports.strictObject({
|
|
27294
|
+
harnesses: external_exports.array(harness).max(256),
|
|
27295
|
+
models: external_exports.array(model.nullable()).max(4096),
|
|
27296
|
+
projects: external_exports.array(project.nullable()).max(4096)
|
|
27297
|
+
}),
|
|
27298
|
+
/** Current display metadata, scoped by Harness. Never a pricing or filter identity.
|
|
27299
|
+
* Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
|
|
27300
|
+
*/
|
|
27301
|
+
modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
|
|
27302
|
+
/** Native credits, all filters applied, never combined across Harnesses or treated as USD.
|
|
27303
|
+
* Only groups with at least one reported value appear; reportedRequests exposes partial data.
|
|
27304
|
+
*/
|
|
27305
|
+
credits: external_exports.array(external_exports.strictObject({
|
|
27306
|
+
harness,
|
|
27307
|
+
model: model.nullable(),
|
|
27308
|
+
credits: external_exports.number().finite().min(0),
|
|
27309
|
+
reportedRequests: count,
|
|
27310
|
+
requests: count
|
|
27311
|
+
})).max(4096).optional(),
|
|
27312
|
+
/** All filters applied. */
|
|
27313
|
+
totals: usageStatisticsTotalsSchema,
|
|
27314
|
+
/** Each date and Harness of the range: every filter except the day. */
|
|
27315
|
+
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
27316
|
+
/** Local weekday (0 = Sunday) and hour, all filters applied. */
|
|
27317
|
+
hourly: external_exports.array(external_exports.strictObject({
|
|
27318
|
+
weekday: external_exports.number().int().min(0).max(6),
|
|
27319
|
+
hour: external_exports.number().int().min(0).max(23),
|
|
27320
|
+
...totals
|
|
27321
|
+
})).max(168),
|
|
27322
|
+
byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
|
|
27323
|
+
byModel: external_exports.array(external_exports.strictObject({
|
|
27324
|
+
model: model.nullable(),
|
|
27325
|
+
...totals,
|
|
27326
|
+
/** Requests priced by what the Harness recorded they cost, not by a price list. */
|
|
27327
|
+
harnessPricedRequests: count
|
|
27328
|
+
})).max(4096),
|
|
27329
|
+
byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
|
|
27330
|
+
/**
|
|
27331
|
+
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
27332
|
+
* requests without a native session are not listed here but count everywhere else.
|
|
27333
|
+
*/
|
|
27334
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
27335
|
+
});
|
|
27336
|
+
|
|
27181
27337
|
// ../../shared-contracts/dist/ids.js
|
|
27182
27338
|
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27183
27339
|
message: "Identifier must not be empty or whitespace"
|
|
@@ -27199,13 +27355,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
|
|
|
27199
27355
|
var harnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).refine((id) => id !== "codex", "The official Codex identity is reserved").pipe(harnessIdSchema);
|
|
27200
27356
|
var relativeResourceSchema = external_exports.string().min(1).max(512).refine((value) => !/[\\\u0000:#?]/u.test(value) && !value.startsWith("/") && !value.split("/").some((part) => part === ".." || part === ""), "Plugin resources must be relative paths inside the plugin");
|
|
27201
27357
|
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
27358
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
27359
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
27360
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
27361
|
+
before: localizedTextSchema.optional(),
|
|
27362
|
+
after: localizedTextSchema.optional(),
|
|
27363
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
27364
|
+
}).strict();
|
|
27202
27365
|
var pluginPresentationShape = {
|
|
27203
27366
|
id: harnessPluginIdSchema,
|
|
27204
27367
|
name: external_exports.string().trim().min(1).max(128),
|
|
27205
27368
|
version: external_exports.string().min(1).max(128),
|
|
27369
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
27370
|
+
kind: external_exports.literal("usage").optional(),
|
|
27371
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
27372
|
+
iconStyle: external_exports.object({
|
|
27373
|
+
vector: external_exports.object({
|
|
27374
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
27375
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
27376
|
+
paths: external_exports.array(external_exports.object({
|
|
27377
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
27378
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
27379
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
27380
|
+
}).strict()).min(1).max(32)
|
|
27381
|
+
}).strict().optional(),
|
|
27382
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
27383
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
27384
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
27385
|
+
}).strict().optional(),
|
|
27386
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
27387
|
+
notice: localizedTextSchema.optional(),
|
|
27206
27388
|
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27207
27389
|
launchCommand: external_exports.literal(true).optional(),
|
|
27208
27390
|
links: external_exports.object({
|
|
27391
|
+
website: documentationUrlSchema.optional(),
|
|
27209
27392
|
documentation: documentationUrlSchema.optional(),
|
|
27210
27393
|
installation: documentationUrlSchema.optional()
|
|
27211
27394
|
}).strict().optional()
|
|
@@ -27282,6 +27465,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27282
27465
|
"codexhost/account/list",
|
|
27283
27466
|
"codexhost/account/refresh",
|
|
27284
27467
|
"codexhost/account/usage/inspect",
|
|
27468
|
+
"codexhost/usage/model-prices/get",
|
|
27469
|
+
"codexhost/usage/model-prices/set",
|
|
27470
|
+
"codexhost/usage/model-prices/default",
|
|
27471
|
+
"codexhost/usage/statistics/get",
|
|
27285
27472
|
"codexhost/update/check",
|
|
27286
27473
|
"codexhost/update/start",
|
|
27287
27474
|
"codexhost/update/status"
|
|
@@ -27346,6 +27533,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27346
27533
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27347
27534
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27348
27535
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27536
|
+
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27349
27537
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27350
27538
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27351
27539
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
@@ -27357,7 +27545,11 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27357
27545
|
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27358
27546
|
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27359
27547
|
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27360
|
-
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
|
|
27548
|
+
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27549
|
+
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
27550
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
27551
|
+
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
27552
|
+
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
27361
27553
|
}).strict().superRefine((usage, context) => {
|
|
27362
27554
|
if (Object.keys(usage).length === 0) {
|
|
27363
27555
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -27378,6 +27570,20 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27378
27570
|
path: ["contextWindowTokens"]
|
|
27379
27571
|
});
|
|
27380
27572
|
}
|
|
27573
|
+
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
27574
|
+
context.addIssue({
|
|
27575
|
+
code: "custom",
|
|
27576
|
+
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
27577
|
+
path: ["costSource"]
|
|
27578
|
+
});
|
|
27579
|
+
}
|
|
27580
|
+
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
27581
|
+
context.addIssue({
|
|
27582
|
+
code: "custom",
|
|
27583
|
+
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
27584
|
+
path: ["unpricedModels"]
|
|
27585
|
+
});
|
|
27586
|
+
}
|
|
27381
27587
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
27382
27588
|
context.addIssue({
|
|
27383
27589
|
code: "custom",
|
|
@@ -27647,27 +27853,27 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
27647
27853
|
}).strict().superRefine((catalog, context) => {
|
|
27648
27854
|
const refs = /* @__PURE__ */ new Set();
|
|
27649
27855
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
27650
|
-
for (const [index,
|
|
27651
|
-
if (refs.has(
|
|
27856
|
+
for (const [index, model2] of catalog.models.entries()) {
|
|
27857
|
+
if (refs.has(model2.ref.id)) {
|
|
27652
27858
|
context.addIssue({
|
|
27653
27859
|
code: "custom",
|
|
27654
27860
|
message: "Model Catalog refs must be unique",
|
|
27655
27861
|
path: ["models", index, "ref", "id"]
|
|
27656
27862
|
});
|
|
27657
27863
|
}
|
|
27658
|
-
refs.add(
|
|
27659
|
-
if (
|
|
27660
|
-
if (refs.has(
|
|
27864
|
+
refs.add(model2.ref.id);
|
|
27865
|
+
if (model2.fastModel) {
|
|
27866
|
+
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
27661
27867
|
context.addIssue({
|
|
27662
27868
|
code: "custom",
|
|
27663
27869
|
message: "Fast Model refs must be distinct and unique",
|
|
27664
27870
|
path: ["models", index, "fastModel"]
|
|
27665
27871
|
});
|
|
27666
27872
|
}
|
|
27667
|
-
refs.add(
|
|
27873
|
+
refs.add(model2.fastModel.id);
|
|
27668
27874
|
}
|
|
27669
27875
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
27670
|
-
for (const [optionIndex, optionId] of (
|
|
27876
|
+
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
27671
27877
|
if (supportedThinkingIds.has(optionId)) {
|
|
27672
27878
|
context.addIssue({
|
|
27673
27879
|
code: "custom",
|
|
@@ -28261,6 +28467,11 @@ var codexSshDraftSchema = external_exports.strictObject({
|
|
|
28261
28467
|
});
|
|
28262
28468
|
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28263
28469
|
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28470
|
+
external_exports.strictObject({
|
|
28471
|
+
action: external_exports.literal("read-thread"),
|
|
28472
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28473
|
+
input: delegationReadParamsSchema
|
|
28474
|
+
}),
|
|
28264
28475
|
external_exports.strictObject({
|
|
28265
28476
|
action: external_exports.literal("save"),
|
|
28266
28477
|
draft: codexSshDraftSchema,
|
|
@@ -29065,7 +29276,6 @@ var tokenFields = [
|
|
|
29065
29276
|
"cachedInputTokens",
|
|
29066
29277
|
"cacheWriteInputTokens",
|
|
29067
29278
|
"outputTokens",
|
|
29068
|
-
"outputTokensPerSecond",
|
|
29069
29279
|
"reasoningOutputTokens",
|
|
29070
29280
|
"totalTokens",
|
|
29071
29281
|
"contextWindowTokens",
|
|
@@ -29073,10 +29283,12 @@ var tokenFields = [
|
|
|
29073
29283
|
];
|
|
29074
29284
|
var safeIntegerFields = [
|
|
29075
29285
|
"planFiveHourResetsAtUnix",
|
|
29076
|
-
"planSevenDayResetsAtUnix"
|
|
29286
|
+
"planSevenDayResetsAtUnix",
|
|
29287
|
+
"timeToFirstOutputMs"
|
|
29077
29288
|
];
|
|
29078
29289
|
var percentFields = [
|
|
29079
29290
|
"cacheHitRatePercent",
|
|
29291
|
+
"sessionCacheHitRatePercent",
|
|
29080
29292
|
"planFiveHourUsedPercent",
|
|
29081
29293
|
"planSevenDayUsedPercent"
|
|
29082
29294
|
];
|
|
@@ -29084,9 +29296,14 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
29084
29296
|
...tokenFields,
|
|
29085
29297
|
...safeIntegerFields,
|
|
29086
29298
|
...percentFields,
|
|
29299
|
+
"sessionCacheUsage",
|
|
29087
29300
|
"totalCostUsd",
|
|
29088
29301
|
"totalCredits",
|
|
29089
|
-
"contextUsagePercent"
|
|
29302
|
+
"contextUsagePercent",
|
|
29303
|
+
"outputTokensPerSecond",
|
|
29304
|
+
"apiOutputTokensPerSecond",
|
|
29305
|
+
"costSource",
|
|
29306
|
+
"unpricedModels"
|
|
29090
29307
|
]);
|
|
29091
29308
|
function isRecord(value) {
|
|
29092
29309
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29102,7 +29319,11 @@ function parseHostUsage(value) {
|
|
|
29102
29319
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
29103
29320
|
}
|
|
29104
29321
|
}
|
|
29105
|
-
for (const field of [
|
|
29322
|
+
for (const field of [
|
|
29323
|
+
"totalCredits",
|
|
29324
|
+
"contextUsagePercent",
|
|
29325
|
+
"apiOutputTokensPerSecond"
|
|
29326
|
+
]) {
|
|
29106
29327
|
const candidate = value[field];
|
|
29107
29328
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
29108
29329
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
@@ -29138,6 +29359,12 @@ function parseHostUsage(value) {
|
|
|
29138
29359
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
29139
29360
|
}
|
|
29140
29361
|
}
|
|
29362
|
+
if (value.sessionCacheUsage !== void 0) {
|
|
29363
|
+
const totals2 = value.sessionCacheUsage;
|
|
29364
|
+
if (!isRecord(totals2) || Object.keys(totals2).some((key) => key !== "inputTokens" && key !== "cachedInputTokens") || typeof totals2.inputTokens !== "number" || !Number.isSafeInteger(totals2.inputTokens) || totals2.inputTokens < 0 || typeof totals2.cachedInputTokens !== "number" || !Number.isSafeInteger(totals2.cachedInputTokens) || totals2.cachedInputTokens < 0 || totals2.cachedInputTokens > totals2.inputTokens) {
|
|
29365
|
+
throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
|
|
29366
|
+
}
|
|
29367
|
+
}
|
|
29141
29368
|
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
29142
29369
|
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
29143
29370
|
if (hasContextUsed !== hasContextWindow) {
|
|
@@ -29152,8 +29379,43 @@ function parseHostUsage(value) {
|
|
|
29152
29379
|
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
29153
29380
|
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
29154
29381
|
}
|
|
29382
|
+
if (value.costSource !== void 0) {
|
|
29383
|
+
if (value.costSource !== "publicPrice" && value.costSource !== "native") {
|
|
29384
|
+
throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
|
|
29385
|
+
}
|
|
29386
|
+
if (value.totalCostUsd === void 0) {
|
|
29387
|
+
throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
|
|
29388
|
+
}
|
|
29389
|
+
}
|
|
29390
|
+
if (value.unpricedModels !== void 0) {
|
|
29391
|
+
const models = value.unpricedModels;
|
|
29392
|
+
if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
|
|
29393
|
+
throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
|
|
29394
|
+
}
|
|
29395
|
+
if (value.costSource !== "publicPrice") {
|
|
29396
|
+
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
29397
|
+
}
|
|
29398
|
+
return { ...value, unpricedModels: [...models] };
|
|
29399
|
+
}
|
|
29155
29400
|
return { ...value };
|
|
29156
29401
|
}
|
|
29402
|
+
var requestTokenFields = [
|
|
29403
|
+
"inputTokens",
|
|
29404
|
+
"cachedInputTokens",
|
|
29405
|
+
"cacheWriteInputTokens",
|
|
29406
|
+
"cacheWrite1hInputTokens",
|
|
29407
|
+
"outputTokens",
|
|
29408
|
+
"reasoningOutputTokens",
|
|
29409
|
+
"startedAtMs",
|
|
29410
|
+
"completedAtMs"
|
|
29411
|
+
];
|
|
29412
|
+
var requestFields = /* @__PURE__ */ new Set([
|
|
29413
|
+
...requestTokenFields,
|
|
29414
|
+
"requestId",
|
|
29415
|
+
"historical",
|
|
29416
|
+
"model",
|
|
29417
|
+
"provider"
|
|
29418
|
+
]);
|
|
29157
29419
|
|
|
29158
29420
|
// ../../harness-adapter/dist/live-command-catalog.js
|
|
29159
29421
|
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -29808,10 +30070,10 @@ function parseQoderModelCatalog(rawModels) {
|
|
|
29808
30070
|
...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
|
|
29809
30071
|
});
|
|
29810
30072
|
}
|
|
29811
|
-
function qoderAvailableThinkingOptions(catalog,
|
|
29812
|
-
if (!catalog || !
|
|
30073
|
+
function qoderAvailableThinkingOptions(catalog, model2) {
|
|
30074
|
+
if (!catalog || !model2)
|
|
29813
30075
|
return void 0;
|
|
29814
|
-
const supported = catalog.models.find(({ ref }) => ref.id ===
|
|
30076
|
+
const supported = catalog.models.find(({ ref }) => ref.id === model2.id)?.supportedThinkingOptionIds;
|
|
29815
30077
|
if (!supported || supported.length === 0)
|
|
29816
30078
|
return void 0;
|
|
29817
30079
|
const options = supported.flatMap((id) => {
|
|
@@ -30323,8 +30585,8 @@ function getErrorMap2() {
|
|
|
30323
30585
|
|
|
30324
30586
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30325
30587
|
var makeIssue = (params) => {
|
|
30326
|
-
const { data, path:
|
|
30327
|
-
const fullPath = [...
|
|
30588
|
+
const { data, path: path10, errorMaps, issueData } = params;
|
|
30589
|
+
const fullPath = [...path10, ...issueData.path || []];
|
|
30328
30590
|
const fullIssue = {
|
|
30329
30591
|
...issueData,
|
|
30330
30592
|
path: fullPath
|
|
@@ -30439,11 +30701,11 @@ var errorUtil;
|
|
|
30439
30701
|
|
|
30440
30702
|
// ../../../node_modules/zod/v3/types.js
|
|
30441
30703
|
var ParseInputLazyPath = class {
|
|
30442
|
-
constructor(parent, value,
|
|
30704
|
+
constructor(parent, value, path10, key) {
|
|
30443
30705
|
this._cachedPath = [];
|
|
30444
30706
|
this.parent = parent;
|
|
30445
30707
|
this.data = value;
|
|
30446
|
-
this._path =
|
|
30708
|
+
this._path = path10;
|
|
30447
30709
|
this._key = key;
|
|
30448
30710
|
}
|
|
30449
30711
|
get path() {
|
|
@@ -33970,11 +34232,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33970
34232
|
}
|
|
33971
34233
|
return void 0;
|
|
33972
34234
|
}
|
|
33973
|
-
function getDotPath(
|
|
33974
|
-
if (
|
|
34235
|
+
function getDotPath(path10) {
|
|
34236
|
+
if (path10.length === 0) {
|
|
33975
34237
|
return "object root";
|
|
33976
34238
|
}
|
|
33977
|
-
return
|
|
34239
|
+
return path10.reduce((acc, seg, index) => {
|
|
33978
34240
|
if (index === 0) {
|
|
33979
34241
|
return String(seg);
|
|
33980
34242
|
}
|
|
@@ -52703,6 +52965,246 @@ var QoderSessionImport = class {
|
|
|
52703
52965
|
}
|
|
52704
52966
|
};
|
|
52705
52967
|
|
|
52968
|
+
// ../qoder/dist/qoder-usage-statistics.js
|
|
52969
|
+
import os4 from "node:os";
|
|
52970
|
+
import path8 from "node:path";
|
|
52971
|
+
|
|
52972
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
52973
|
+
import { createReadStream } from "node:fs";
|
|
52974
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
52975
|
+
import path6 from "node:path";
|
|
52976
|
+
import { createInterface } from "node:readline";
|
|
52977
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
52978
|
+
var MAX_CWD_LENGTH = 4096;
|
|
52979
|
+
function sessionIdOk(value) {
|
|
52980
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52981
|
+
}
|
|
52982
|
+
function cwdOk(value) {
|
|
52983
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_CWD_LENGTH && !value.includes("\0") && (value.startsWith("/") || /^[A-Za-z]:[\\/]/u.test(value) || value.startsWith("\\\\"));
|
|
52984
|
+
}
|
|
52985
|
+
function withUsageSession(entry, session) {
|
|
52986
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52987
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
52988
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
52989
|
+
return entry;
|
|
52990
|
+
return {
|
|
52991
|
+
...entry,
|
|
52992
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
52993
|
+
...cwd !== void 0 ? { cwd } : {}
|
|
52994
|
+
};
|
|
52995
|
+
}
|
|
52996
|
+
function tokenCount(value) {
|
|
52997
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
52998
|
+
}
|
|
52999
|
+
function parseHarnessUsageEntry(value) {
|
|
53000
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
53001
|
+
return null;
|
|
53002
|
+
const entry = value;
|
|
53003
|
+
if (typeof entry.id !== "string" || entry.id.length === 0 || entry.id.length > 512)
|
|
53004
|
+
return null;
|
|
53005
|
+
if (!tokenCount(entry.occurredAtMs) || entry.occurredAtMs === 0)
|
|
53006
|
+
return null;
|
|
53007
|
+
if (entry.model !== void 0 && (typeof entry.model !== "string" || entry.model.length === 0)) {
|
|
53008
|
+
return null;
|
|
53009
|
+
}
|
|
53010
|
+
if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
|
|
53011
|
+
return null;
|
|
53012
|
+
for (const field of [
|
|
53013
|
+
"cachedInputTokens",
|
|
53014
|
+
"cacheWriteInputTokens",
|
|
53015
|
+
"cacheWrite1hInputTokens",
|
|
53016
|
+
"reasoningOutputTokens"
|
|
53017
|
+
]) {
|
|
53018
|
+
if (entry[field] !== void 0 && !tokenCount(entry[field]))
|
|
53019
|
+
return null;
|
|
53020
|
+
}
|
|
53021
|
+
const cached2 = entry.cachedInputTokens ?? 0;
|
|
53022
|
+
const written = entry.cacheWriteInputTokens ?? 0;
|
|
53023
|
+
if (cached2 + written > entry.inputTokens)
|
|
53024
|
+
return null;
|
|
53025
|
+
if ((entry.cacheWrite1hInputTokens ?? 0) > written)
|
|
53026
|
+
return null;
|
|
53027
|
+
if ((entry.reasoningOutputTokens ?? 0) > entry.outputTokens)
|
|
53028
|
+
return null;
|
|
53029
|
+
if (entry.sessionId !== void 0 && !sessionIdOk(entry.sessionId))
|
|
53030
|
+
return null;
|
|
53031
|
+
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
53032
|
+
return null;
|
|
53033
|
+
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
53034
|
+
return null;
|
|
53035
|
+
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
53036
|
+
return null;
|
|
53037
|
+
}
|
|
53038
|
+
if (entry.credits !== void 0 && (typeof entry.credits !== "number" || !Number.isFinite(entry.credits) || entry.credits < 0)) {
|
|
53039
|
+
return null;
|
|
53040
|
+
}
|
|
53041
|
+
return entry;
|
|
53042
|
+
}
|
|
53043
|
+
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
53044
|
+
const sources = [];
|
|
53045
|
+
const visit = async (directory, depth) => {
|
|
53046
|
+
signal.throwIfAborted();
|
|
53047
|
+
const entries = await opendir(directory).catch((error51) => {
|
|
53048
|
+
if (error51.code === "ENOENT")
|
|
53049
|
+
return null;
|
|
53050
|
+
throw error51;
|
|
53051
|
+
});
|
|
53052
|
+
if (!entries)
|
|
53053
|
+
return;
|
|
53054
|
+
for await (const entry of entries) {
|
|
53055
|
+
signal.throwIfAborted();
|
|
53056
|
+
const file2 = path6.join(directory, entry.name);
|
|
53057
|
+
if (entry.isDirectory()) {
|
|
53058
|
+
if (depth < maxDepth)
|
|
53059
|
+
await visit(file2, depth + 1);
|
|
53060
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
53061
|
+
const info = await lstat(file2).catch(() => null);
|
|
53062
|
+
if (info?.isFile() && info.size > 0) {
|
|
53063
|
+
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
53064
|
+
}
|
|
53065
|
+
}
|
|
53066
|
+
}
|
|
53067
|
+
};
|
|
53068
|
+
await visit(root, 0);
|
|
53069
|
+
return sources;
|
|
53070
|
+
}
|
|
53071
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
53072
|
+
const lines = createInterface({
|
|
53073
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
53074
|
+
crlfDelay: Infinity
|
|
53075
|
+
});
|
|
53076
|
+
for await (const line of lines) {
|
|
53077
|
+
if (!line.includes(marker))
|
|
53078
|
+
continue;
|
|
53079
|
+
let value;
|
|
53080
|
+
try {
|
|
53081
|
+
value = JSON.parse(line);
|
|
53082
|
+
} catch {
|
|
53083
|
+
continue;
|
|
53084
|
+
}
|
|
53085
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
53086
|
+
yield value;
|
|
53087
|
+
}
|
|
53088
|
+
}
|
|
53089
|
+
}
|
|
53090
|
+
function nativeTimeMs(value) {
|
|
53091
|
+
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
53092
|
+
return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
|
|
53093
|
+
}
|
|
53094
|
+
|
|
53095
|
+
// ../qoder/dist/qoder-model-labels.js
|
|
53096
|
+
import { readFile, stat as stat2 } from "node:fs/promises";
|
|
53097
|
+
import path7 from "node:path";
|
|
53098
|
+
function record3(value) {
|
|
53099
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53100
|
+
}
|
|
53101
|
+
async function readQoderModelLabels(configDirectory, signal) {
|
|
53102
|
+
signal.throwIfAborted();
|
|
53103
|
+
try {
|
|
53104
|
+
const file2 = path7.join(configDirectory, ".auth", "dynamic-texts.json");
|
|
53105
|
+
if ((await stat2(file2)).size > 1024 * 1024)
|
|
53106
|
+
return {};
|
|
53107
|
+
const data = JSON.parse(await readFile(file2, { encoding: "utf8", signal }));
|
|
53108
|
+
if (!record3(data) || !record3(data.locales))
|
|
53109
|
+
return {};
|
|
53110
|
+
const labels = /* @__PURE__ */ new Map();
|
|
53111
|
+
for (const locale of ["zh-CN", "en"]) {
|
|
53112
|
+
const texts = data.locales[locale];
|
|
53113
|
+
if (!record3(texts))
|
|
53114
|
+
continue;
|
|
53115
|
+
for (const [key, value] of Object.entries(texts)) {
|
|
53116
|
+
const prefix = "modelSelector.item.";
|
|
53117
|
+
if (!key.startsWith(prefix))
|
|
53118
|
+
continue;
|
|
53119
|
+
const id = key.slice(prefix.length);
|
|
53120
|
+
if (!id || id.length > 512 || /\.(description|markdownDescription)(\.|$)/u.test(id))
|
|
53121
|
+
continue;
|
|
53122
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 512)
|
|
53123
|
+
continue;
|
|
53124
|
+
labels.set(id, value.trim());
|
|
53125
|
+
}
|
|
53126
|
+
}
|
|
53127
|
+
return Object.fromEntries(labels);
|
|
53128
|
+
} catch {
|
|
53129
|
+
signal.throwIfAborted();
|
|
53130
|
+
return {};
|
|
53131
|
+
}
|
|
53132
|
+
}
|
|
53133
|
+
|
|
53134
|
+
// ../qoder/dist/qoder-usage-statistics.js
|
|
53135
|
+
function qoderProjectsDirectory(environment, variant) {
|
|
53136
|
+
const cn3 = variant === "cn";
|
|
53137
|
+
const config2 = environment[cn3 ? "QODERCN_CONFIG_DIR" : "QODER_CONFIG_DIR"];
|
|
53138
|
+
const home = environment[cn3 ? "QODERCN_CLI_HOME" : "QODER_CLI_HOME"] || environment.HOME || environment.USERPROFILE || os4.homedir();
|
|
53139
|
+
return path8.resolve(config2 || path8.join(home, cn3 ? ".qoder-cn" : ".qoder"), "projects");
|
|
53140
|
+
}
|
|
53141
|
+
function isRecord2(value) {
|
|
53142
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53143
|
+
}
|
|
53144
|
+
function count2(value) {
|
|
53145
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53146
|
+
}
|
|
53147
|
+
async function readQoderUsage(file2, signal) {
|
|
53148
|
+
const messages = /* @__PURE__ */ new Map();
|
|
53149
|
+
let sessionId;
|
|
53150
|
+
let cwd;
|
|
53151
|
+
for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
|
|
53152
|
+
signal.throwIfAborted();
|
|
53153
|
+
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53154
|
+
continue;
|
|
53155
|
+
sessionId ??= line.sessionId;
|
|
53156
|
+
cwd ??= line.cwd;
|
|
53157
|
+
if (isRecord2(line.forkedFrom) || line.isApiErrorMessage === true)
|
|
53158
|
+
continue;
|
|
53159
|
+
const { id, model: model2, usage } = line.message;
|
|
53160
|
+
if (typeof id !== "string" || !id || model2 === "<synthetic>")
|
|
53161
|
+
continue;
|
|
53162
|
+
const message = messages.get(id) ?? { at: null };
|
|
53163
|
+
message.at ??= nativeTimeMs(line.timestamp);
|
|
53164
|
+
messages.set(id, message);
|
|
53165
|
+
if (!isRecord2(usage) || message.at === null)
|
|
53166
|
+
continue;
|
|
53167
|
+
const input = usage.input_tokens;
|
|
53168
|
+
const output = usage.output_tokens;
|
|
53169
|
+
const cached2 = usage.cache_read_input_tokens;
|
|
53170
|
+
const written = usage.cache_creation_input_tokens;
|
|
53171
|
+
if (!count2(input) || !count2(output) || !count2(cached2) || !count2(written))
|
|
53172
|
+
continue;
|
|
53173
|
+
const split = isRecord2(usage.cache_creation) ? usage.cache_creation : null;
|
|
53174
|
+
const oneHour = split?.ephemeral_1h_input_tokens;
|
|
53175
|
+
const details = isRecord2(usage.output_tokens_details) ? usage.output_tokens_details : null;
|
|
53176
|
+
const thinking = details?.thinking_tokens;
|
|
53177
|
+
const unreported = input === 0 && output === 0 && cached2 === 0 && written === 0;
|
|
53178
|
+
const entry = parseHarnessUsageEntry({
|
|
53179
|
+
id,
|
|
53180
|
+
occurredAtMs: message.at,
|
|
53181
|
+
...typeof model2 === "string" && model2 ? { model: model2 } : {},
|
|
53182
|
+
inputTokens: input + cached2 + written,
|
|
53183
|
+
cachedInputTokens: cached2,
|
|
53184
|
+
cacheWriteInputTokens: written,
|
|
53185
|
+
...count2(oneHour) ? { cacheWrite1hInputTokens: oneHour } : {},
|
|
53186
|
+
outputTokens: output,
|
|
53187
|
+
...typeof usage.credits === "number" && Number.isFinite(usage.credits) && usage.credits >= 0 ? { credits: usage.credits } : {},
|
|
53188
|
+
...count2(thinking) ? { reasoningOutputTokens: thinking } : {},
|
|
53189
|
+
...unreported ? { tokensUnknown: true } : {}
|
|
53190
|
+
});
|
|
53191
|
+
if (entry)
|
|
53192
|
+
message.entry = entry;
|
|
53193
|
+
}
|
|
53194
|
+
const session = {
|
|
53195
|
+
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53196
|
+
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53197
|
+
};
|
|
53198
|
+
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53199
|
+
}
|
|
53200
|
+
function createQoderUsageStatistics(environment, variant) {
|
|
53201
|
+
return Object.freeze({
|
|
53202
|
+
readModelLabels: (signal) => readQoderModelLabels(path8.dirname(qoderProjectsDirectory(environment, variant)), signal),
|
|
53203
|
+
listSources: (signal) => jsonlUsageSources(qoderProjectsDirectory(environment, variant), 4, signal),
|
|
53204
|
+
readSource: readQoderUsage
|
|
53205
|
+
});
|
|
53206
|
+
}
|
|
53207
|
+
|
|
52706
53208
|
// ../qoder/dist/qoder-adapter.js
|
|
52707
53209
|
var QoderAdapter = class {
|
|
52708
53210
|
harnessId;
|
|
@@ -52710,6 +53212,7 @@ var QoderAdapter = class {
|
|
|
52710
53212
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52711
53213
|
liveCommandCatalog = true;
|
|
52712
53214
|
sessionImport;
|
|
53215
|
+
usageStatistics;
|
|
52713
53216
|
#commandOverride;
|
|
52714
53217
|
#environment;
|
|
52715
53218
|
#platform;
|
|
@@ -52728,6 +53231,7 @@ var QoderAdapter = class {
|
|
|
52728
53231
|
this.harnessId = harnessIdSchema.parse(runtime.harnessId);
|
|
52729
53232
|
this.#commandOverride = options.commandOverride ?? options.environment?.[runtime.commandEnvironmentVariable];
|
|
52730
53233
|
this.#environment = qoderEnvironment(options.environment);
|
|
53234
|
+
this.usageStatistics = createQoderUsageStatistics({ ...process.env, ...options.environment }, this.#variant);
|
|
52731
53235
|
this.#platform = options.platform ?? process.platform;
|
|
52732
53236
|
this.#queryFactory = options.queryFactory ?? ((input) => runtime.sdk.query(input));
|
|
52733
53237
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
@@ -52957,7 +53461,7 @@ var QoderAdapter = class {
|
|
|
52957
53461
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52958
53462
|
} catch {
|
|
52959
53463
|
}
|
|
52960
|
-
if (sourceInfo?.cwd &&
|
|
53464
|
+
if (sourceInfo?.cwd && path9.resolve(sourceInfo.cwd) !== path9.resolve(input.cwd)) {
|
|
52961
53465
|
return {
|
|
52962
53466
|
ok: false,
|
|
52963
53467
|
error: {
|