@codexhost/cli-darwin-x64 0.12.1 → 0.13.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 +5434 -1092
- package/app/desktop-controller.mjs +252 -41
- package/app/host-runtime.mjs +5318 -1448
- 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 +1049 -359
- 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 +16703 -0
- package/app/plugins/cursor-cli/manifest.json +17 -0
- 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 +884 -259
- 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/omp/manifest.json +21 -1
- package/app/plugins/omp/plugin.mjs +2737 -1956
- 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 +2809 -2254
- 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 +1999 -1686
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-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
|
}
|
|
@@ -12995,7 +12995,7 @@ function createHarnessInstaller(environment, source) {
|
|
|
12995
12995
|
|
|
12996
12996
|
// dist/qoder-adapter.js
|
|
12997
12997
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12998
|
-
import
|
|
12998
|
+
import path9 from "node:path";
|
|
12999
12999
|
|
|
13000
13000
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
13001
13001
|
var external_exports = {};
|
|
@@ -13763,10 +13763,10 @@ function mergeDefs(...defs) {
|
|
|
13763
13763
|
function cloneDef(schema) {
|
|
13764
13764
|
return mergeDefs(schema._zod.def);
|
|
13765
13765
|
}
|
|
13766
|
-
function getElementAtPath(obj,
|
|
13767
|
-
if (!
|
|
13766
|
+
function getElementAtPath(obj, path10) {
|
|
13767
|
+
if (!path10)
|
|
13768
13768
|
return obj;
|
|
13769
|
-
return
|
|
13769
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
13770
13770
|
}
|
|
13771
13771
|
function promiseAllObject(promisesObj) {
|
|
13772
13772
|
const keys = Object.keys(promisesObj);
|
|
@@ -14175,11 +14175,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
14175
14175
|
}
|
|
14176
14176
|
return false;
|
|
14177
14177
|
}
|
|
14178
|
-
function prefixIssues(
|
|
14178
|
+
function prefixIssues(path10, issues) {
|
|
14179
14179
|
return issues.map((iss) => {
|
|
14180
14180
|
var _a5;
|
|
14181
14181
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
14182
|
-
iss.path.unshift(
|
|
14182
|
+
iss.path.unshift(path10);
|
|
14183
14183
|
return iss;
|
|
14184
14184
|
});
|
|
14185
14185
|
}
|
|
@@ -14326,16 +14326,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14326
14326
|
}
|
|
14327
14327
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
14328
14328
|
const fieldErrors = { _errors: [] };
|
|
14329
|
-
const processError = (error52,
|
|
14329
|
+
const processError = (error52, path10 = []) => {
|
|
14330
14330
|
for (const issue2 of error52.issues) {
|
|
14331
14331
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14332
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14332
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
14333
14333
|
} else if (issue2.code === "invalid_key") {
|
|
14334
|
-
processError({ issues: issue2.issues }, [...
|
|
14334
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
14335
14335
|
} else if (issue2.code === "invalid_element") {
|
|
14336
|
-
processError({ issues: issue2.issues }, [...
|
|
14336
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
14337
14337
|
} else {
|
|
14338
|
-
const fullpath = [...
|
|
14338
|
+
const fullpath = [...path10, ...issue2.path];
|
|
14339
14339
|
if (fullpath.length === 0) {
|
|
14340
14340
|
fieldErrors._errors.push(mapper(issue2));
|
|
14341
14341
|
} else {
|
|
@@ -14362,17 +14362,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14362
14362
|
}
|
|
14363
14363
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
14364
14364
|
const result = { errors: [] };
|
|
14365
|
-
const processError = (error52,
|
|
14365
|
+
const processError = (error52, path10 = []) => {
|
|
14366
14366
|
var _a5, _b;
|
|
14367
14367
|
for (const issue2 of error52.issues) {
|
|
14368
14368
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
14369
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
14369
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
14370
14370
|
} else if (issue2.code === "invalid_key") {
|
|
14371
|
-
processError({ issues: issue2.issues }, [...
|
|
14371
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
14372
14372
|
} else if (issue2.code === "invalid_element") {
|
|
14373
|
-
processError({ issues: issue2.issues }, [...
|
|
14373
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
14374
14374
|
} else {
|
|
14375
|
-
const fullpath = [...
|
|
14375
|
+
const fullpath = [...path10, ...issue2.path];
|
|
14376
14376
|
if (fullpath.length === 0) {
|
|
14377
14377
|
result.errors.push(mapper(issue2));
|
|
14378
14378
|
continue;
|
|
@@ -14404,8 +14404,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
14404
14404
|
}
|
|
14405
14405
|
function toDotPath(_path) {
|
|
14406
14406
|
const segs = [];
|
|
14407
|
-
const
|
|
14408
|
-
for (const seg of
|
|
14407
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
14408
|
+
for (const seg of path10) {
|
|
14409
14409
|
if (typeof seg === "number")
|
|
14410
14410
|
segs.push(`[${seg}]`);
|
|
14411
14411
|
else if (typeof seg === "symbol")
|
|
@@ -17633,8 +17633,8 @@ function az_default() {
|
|
|
17633
17633
|
}
|
|
17634
17634
|
|
|
17635
17635
|
// ../../../node_modules/zod/v4/locales/be.js
|
|
17636
|
-
function getBelarusianPlural(
|
|
17637
|
-
const absCount = Math.abs(
|
|
17636
|
+
function getBelarusianPlural(count3, one, few, many) {
|
|
17637
|
+
const absCount = Math.abs(count3);
|
|
17638
17638
|
const lastDigit = absCount % 10;
|
|
17639
17639
|
const lastTwoDigits = absCount % 100;
|
|
17640
17640
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -19712,8 +19712,8 @@ function hu_default() {
|
|
|
19712
19712
|
}
|
|
19713
19713
|
|
|
19714
19714
|
// ../../../node_modules/zod/v4/locales/hy.js
|
|
19715
|
-
function getArmenianPlural(
|
|
19716
|
-
return Math.abs(
|
|
19715
|
+
function getArmenianPlural(count3, one, many) {
|
|
19716
|
+
return Math.abs(count3) === 1 ? one : many;
|
|
19717
19717
|
}
|
|
19718
19718
|
function withDefiniteArticle(word) {
|
|
19719
19719
|
if (!word)
|
|
@@ -21841,8 +21841,8 @@ function ro_default() {
|
|
|
21841
21841
|
}
|
|
21842
21842
|
|
|
21843
21843
|
// ../../../node_modules/zod/v4/locales/ru.js
|
|
21844
|
-
function getRussianPlural(
|
|
21845
|
-
const absCount = Math.abs(
|
|
21844
|
+
function getRussianPlural(count3, one, few, many) {
|
|
21845
|
+
const absCount = Math.abs(count3);
|
|
21846
21846
|
const lastDigit = absCount % 10;
|
|
21847
21847
|
const lastTwoDigits = absCount % 100;
|
|
21848
21848
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -27097,13 +27097,13 @@ function resolveRef(ref, ctx) {
|
|
|
27097
27097
|
if (!ref.startsWith("#")) {
|
|
27098
27098
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
27099
27099
|
}
|
|
27100
|
-
const
|
|
27101
|
-
if (
|
|
27100
|
+
const path10 = ref.slice(1).split("/").filter(Boolean);
|
|
27101
|
+
if (path10.length === 0) {
|
|
27102
27102
|
return ctx.rootSchema;
|
|
27103
27103
|
}
|
|
27104
27104
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
27105
|
-
if (
|
|
27106
|
-
const key =
|
|
27105
|
+
if (path10[0] === defsKey) {
|
|
27106
|
+
const key = path10[1];
|
|
27107
27107
|
if (!key || !ctx.defs[key]) {
|
|
27108
27108
|
throw new Error(`Reference not found: ${ref}`);
|
|
27109
27109
|
}
|
|
@@ -27511,6 +27511,15 @@ function date4(params) {
|
|
|
27511
27511
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
27512
27512
|
config(en_default());
|
|
27513
27513
|
|
|
27514
|
+
// ../../shared-contracts/dist/delegation-read.js
|
|
27515
|
+
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
27516
|
+
var delegationReadParamsSchema = external_exports.strictObject({
|
|
27517
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
27518
|
+
view: external_exports.enum(["result", "messages"]),
|
|
27519
|
+
cursor: external_exports.string().min(1).max(8192).optional(),
|
|
27520
|
+
limit: external_exports.number().int().min(1).max(100).optional()
|
|
27521
|
+
});
|
|
27522
|
+
|
|
27514
27523
|
// ../../shared-contracts/dist/credential-imports.js
|
|
27515
27524
|
var credentialSourceSchema = external_exports.object({
|
|
27516
27525
|
id: external_exports.string().min(1).max(256),
|
|
@@ -27581,6 +27590,153 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
27581
27590
|
initializeOnly: external_exports.boolean().optional()
|
|
27582
27591
|
});
|
|
27583
27592
|
|
|
27593
|
+
// ../../shared-contracts/dist/model-price-overrides.js
|
|
27594
|
+
var usdPerMillionTokens = external_exports.number().finite().nonnegative();
|
|
27595
|
+
var modelPriceOverrideSchema = external_exports.strictObject({
|
|
27596
|
+
input: usdPerMillionTokens,
|
|
27597
|
+
output: usdPerMillionTokens,
|
|
27598
|
+
cacheRead: usdPerMillionTokens.optional(),
|
|
27599
|
+
cacheWrite: usdPerMillionTokens.optional(),
|
|
27600
|
+
cacheWrite1h: usdPerMillionTokens.optional()
|
|
27601
|
+
});
|
|
27602
|
+
var modelPriceKeySchema = external_exports.string().max(512).refine((key) => key.trim() === key && key.length > 0, "Model ID is required");
|
|
27603
|
+
var modelPriceOverridesSchema = external_exports.strictObject({
|
|
27604
|
+
/** Absolute path of the Host's `pricing.json`. */
|
|
27605
|
+
path: external_exports.string(),
|
|
27606
|
+
entries: external_exports.array(external_exports.strictObject({ key: external_exports.string(), price: modelPriceOverrideSchema })),
|
|
27607
|
+
/** Why the existing file is unusable; the Host then ignores it and refuses to overwrite it. */
|
|
27608
|
+
error: external_exports.string().nullable()
|
|
27609
|
+
});
|
|
27610
|
+
var modelPriceOverridesGetSchema = external_exports.strictObject({});
|
|
27611
|
+
var modelPriceOverridesSetSchema = external_exports.strictObject({
|
|
27612
|
+
key: modelPriceKeySchema,
|
|
27613
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
27614
|
+
previousKey: modelPriceKeySchema.optional()
|
|
27615
|
+
});
|
|
27616
|
+
var modelPriceDefaultParamsSchema = external_exports.strictObject({
|
|
27617
|
+
model: modelPriceKeySchema
|
|
27618
|
+
});
|
|
27619
|
+
var modelPriceSuggestionSchema = external_exports.strictObject({
|
|
27620
|
+
/** Verified from catalog canonical links, not inferred from names or equal prices. */
|
|
27621
|
+
official: external_exports.boolean().optional(),
|
|
27622
|
+
canonicalModelId: external_exports.string().min(1).optional(),
|
|
27623
|
+
provider: external_exports.string().min(1).max(512),
|
|
27624
|
+
model: external_exports.string().min(1).max(512),
|
|
27625
|
+
price: modelPriceOverrideSchema
|
|
27626
|
+
});
|
|
27627
|
+
var modelPriceDefaultResultSchema = external_exports.strictObject({
|
|
27628
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
27629
|
+
/** Local catalog suggestions only; never used automatically for pricing. */
|
|
27630
|
+
suggestions: external_exports.array(modelPriceSuggestionSchema).max(6).optional()
|
|
27631
|
+
});
|
|
27632
|
+
|
|
27633
|
+
// ../../shared-contracts/dist/usage-statistics.js
|
|
27634
|
+
var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
|
|
27635
|
+
var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
27636
|
+
var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
|
|
27637
|
+
var harness = external_exports.string().min(1).max(128);
|
|
27638
|
+
var model = external_exports.string().min(1).max(512);
|
|
27639
|
+
var project = external_exports.string().min(1).max(4096);
|
|
27640
|
+
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
27641
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
27642
|
+
harness: harness.optional(),
|
|
27643
|
+
model: model.nullable().optional(),
|
|
27644
|
+
project: project.nullable().optional(),
|
|
27645
|
+
/** One local date inside the range. */
|
|
27646
|
+
date: localDate.optional()
|
|
27647
|
+
});
|
|
27648
|
+
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
27649
|
+
requests: count,
|
|
27650
|
+
inputTokens: count,
|
|
27651
|
+
cachedInputTokens: count,
|
|
27652
|
+
cacheWriteInputTokens: count,
|
|
27653
|
+
cacheKnownInputTokens: count,
|
|
27654
|
+
outputTokens: count,
|
|
27655
|
+
reasoningOutputTokens: count,
|
|
27656
|
+
/** USD at the public price, summed over the priced requests only. */
|
|
27657
|
+
costUsd: external_exports.number().finite().min(0),
|
|
27658
|
+
/** Requests without a price (or the cache data the price needs); not in `costUsd`. */
|
|
27659
|
+
unpricedRequests: count,
|
|
27660
|
+
/**
|
|
27661
|
+
* Requests whose storage gave no token counts: counted as requests, with neither tokens nor
|
|
27662
|
+
* cost, and not as unpriced.
|
|
27663
|
+
*/
|
|
27664
|
+
unmeteredRequests: count
|
|
27665
|
+
});
|
|
27666
|
+
var totals = usageStatisticsTotalsSchema.shape;
|
|
27667
|
+
var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
27668
|
+
harness,
|
|
27669
|
+
sessionId: external_exports.string().min(1).max(512),
|
|
27670
|
+
project: project.nullable(),
|
|
27671
|
+
/** Models the session used, most requests first. */
|
|
27672
|
+
models: external_exports.array(model).max(16),
|
|
27673
|
+
firstAtMs: count,
|
|
27674
|
+
lastAtMs: count,
|
|
27675
|
+
...totals
|
|
27676
|
+
});
|
|
27677
|
+
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
27678
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
27679
|
+
/** First local date of the range; null for all time. */
|
|
27680
|
+
from: localDate.nullable(),
|
|
27681
|
+
to: localDate,
|
|
27682
|
+
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
27683
|
+
filters: external_exports.strictObject({
|
|
27684
|
+
harness: harness.nullable(),
|
|
27685
|
+
model: model.nullable(),
|
|
27686
|
+
unknownModel: external_exports.boolean(),
|
|
27687
|
+
project: project.nullable(),
|
|
27688
|
+
unknownProject: external_exports.boolean(),
|
|
27689
|
+
date: localDate.nullable()
|
|
27690
|
+
}),
|
|
27691
|
+
/** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
|
|
27692
|
+
reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
|
|
27693
|
+
/** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
|
|
27694
|
+
failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
|
|
27695
|
+
/** Every value seen in the range, ignoring the filters, to choose filters from. */
|
|
27696
|
+
options: external_exports.strictObject({
|
|
27697
|
+
harnesses: external_exports.array(harness).max(256),
|
|
27698
|
+
models: external_exports.array(model.nullable()).max(4096),
|
|
27699
|
+
projects: external_exports.array(project.nullable()).max(4096)
|
|
27700
|
+
}),
|
|
27701
|
+
/** Current display metadata, scoped by Harness. Never a pricing or filter identity.
|
|
27702
|
+
* Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
|
|
27703
|
+
*/
|
|
27704
|
+
modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
|
|
27705
|
+
/** Native credits, all filters applied, never combined across Harnesses or treated as USD.
|
|
27706
|
+
* Only groups with at least one reported value appear; reportedRequests exposes partial data.
|
|
27707
|
+
*/
|
|
27708
|
+
credits: external_exports.array(external_exports.strictObject({
|
|
27709
|
+
harness,
|
|
27710
|
+
model: model.nullable(),
|
|
27711
|
+
credits: external_exports.number().finite().min(0),
|
|
27712
|
+
reportedRequests: count,
|
|
27713
|
+
requests: count
|
|
27714
|
+
})).max(4096).optional(),
|
|
27715
|
+
/** All filters applied. */
|
|
27716
|
+
totals: usageStatisticsTotalsSchema,
|
|
27717
|
+
/** Each date and Harness of the range: every filter except the day. */
|
|
27718
|
+
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
27719
|
+
/** Local weekday (0 = Sunday) and hour, all filters applied. */
|
|
27720
|
+
hourly: external_exports.array(external_exports.strictObject({
|
|
27721
|
+
weekday: external_exports.number().int().min(0).max(6),
|
|
27722
|
+
hour: external_exports.number().int().min(0).max(23),
|
|
27723
|
+
...totals
|
|
27724
|
+
})).max(168),
|
|
27725
|
+
byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
|
|
27726
|
+
byModel: external_exports.array(external_exports.strictObject({
|
|
27727
|
+
model: model.nullable(),
|
|
27728
|
+
...totals,
|
|
27729
|
+
/** Requests priced by what the Harness recorded they cost, not by a price list. */
|
|
27730
|
+
harnessPricedRequests: count
|
|
27731
|
+
})).max(4096),
|
|
27732
|
+
byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
|
|
27733
|
+
/**
|
|
27734
|
+
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
27735
|
+
* requests without a native session are not listed here but count everywhere else.
|
|
27736
|
+
*/
|
|
27737
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
27738
|
+
});
|
|
27739
|
+
|
|
27584
27740
|
// ../../shared-contracts/dist/ids.js
|
|
27585
27741
|
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27586
27742
|
message: "Identifier must not be empty or whitespace"
|
|
@@ -27628,6 +27784,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27628
27784
|
"codexhost/account/list",
|
|
27629
27785
|
"codexhost/account/refresh",
|
|
27630
27786
|
"codexhost/account/usage/inspect",
|
|
27787
|
+
"codexhost/usage/model-prices/get",
|
|
27788
|
+
"codexhost/usage/model-prices/set",
|
|
27789
|
+
"codexhost/usage/model-prices/default",
|
|
27790
|
+
"codexhost/usage/statistics/get",
|
|
27631
27791
|
"codexhost/update/check",
|
|
27632
27792
|
"codexhost/update/start",
|
|
27633
27793
|
"codexhost/update/status"
|
|
@@ -27692,6 +27852,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27692
27852
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27693
27853
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27694
27854
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27855
|
+
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27695
27856
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27696
27857
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27697
27858
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
@@ -27703,7 +27864,11 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27703
27864
|
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27704
27865
|
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27705
27866
|
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27706
|
-
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
|
|
27867
|
+
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27868
|
+
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
27869
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
27870
|
+
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
27871
|
+
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
27707
27872
|
}).strict().superRefine((usage, context) => {
|
|
27708
27873
|
if (Object.keys(usage).length === 0) {
|
|
27709
27874
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -27724,6 +27889,20 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27724
27889
|
path: ["contextWindowTokens"]
|
|
27725
27890
|
});
|
|
27726
27891
|
}
|
|
27892
|
+
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
27893
|
+
context.addIssue({
|
|
27894
|
+
code: "custom",
|
|
27895
|
+
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
27896
|
+
path: ["costSource"]
|
|
27897
|
+
});
|
|
27898
|
+
}
|
|
27899
|
+
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
27900
|
+
context.addIssue({
|
|
27901
|
+
code: "custom",
|
|
27902
|
+
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
27903
|
+
path: ["unpricedModels"]
|
|
27904
|
+
});
|
|
27905
|
+
}
|
|
27727
27906
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
27728
27907
|
context.addIssue({
|
|
27729
27908
|
code: "custom",
|
|
@@ -27978,27 +28157,27 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
27978
28157
|
}).strict().superRefine((catalog, context) => {
|
|
27979
28158
|
const refs = /* @__PURE__ */ new Set();
|
|
27980
28159
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
27981
|
-
for (const [index,
|
|
27982
|
-
if (refs.has(
|
|
28160
|
+
for (const [index, model2] of catalog.models.entries()) {
|
|
28161
|
+
if (refs.has(model2.ref.id)) {
|
|
27983
28162
|
context.addIssue({
|
|
27984
28163
|
code: "custom",
|
|
27985
28164
|
message: "Model Catalog refs must be unique",
|
|
27986
28165
|
path: ["models", index, "ref", "id"]
|
|
27987
28166
|
});
|
|
27988
28167
|
}
|
|
27989
|
-
refs.add(
|
|
27990
|
-
if (
|
|
27991
|
-
if (refs.has(
|
|
28168
|
+
refs.add(model2.ref.id);
|
|
28169
|
+
if (model2.fastModel) {
|
|
28170
|
+
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
27992
28171
|
context.addIssue({
|
|
27993
28172
|
code: "custom",
|
|
27994
28173
|
message: "Fast Model refs must be distinct and unique",
|
|
27995
28174
|
path: ["models", index, "fastModel"]
|
|
27996
28175
|
});
|
|
27997
28176
|
}
|
|
27998
|
-
refs.add(
|
|
28177
|
+
refs.add(model2.fastModel.id);
|
|
27999
28178
|
}
|
|
28000
28179
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
28001
|
-
for (const [optionIndex, optionId] of (
|
|
28180
|
+
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
28002
28181
|
if (supportedThinkingIds.has(optionId)) {
|
|
28003
28182
|
context.addIssue({
|
|
28004
28183
|
code: "custom",
|
|
@@ -28192,13 +28371,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
|
|
|
28192
28371
|
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);
|
|
28193
28372
|
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");
|
|
28194
28373
|
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
28374
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
28375
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
28376
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
28377
|
+
before: localizedTextSchema.optional(),
|
|
28378
|
+
after: localizedTextSchema.optional(),
|
|
28379
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
28380
|
+
}).strict();
|
|
28195
28381
|
var pluginPresentationShape = {
|
|
28196
28382
|
id: harnessPluginIdSchema,
|
|
28197
28383
|
name: external_exports.string().trim().min(1).max(128),
|
|
28198
28384
|
version: external_exports.string().min(1).max(128),
|
|
28385
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
28386
|
+
kind: external_exports.literal("usage").optional(),
|
|
28387
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
28388
|
+
iconStyle: external_exports.object({
|
|
28389
|
+
vector: external_exports.object({
|
|
28390
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
28391
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
28392
|
+
paths: external_exports.array(external_exports.object({
|
|
28393
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
28394
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
28395
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
28396
|
+
}).strict()).min(1).max(32)
|
|
28397
|
+
}).strict().optional(),
|
|
28398
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
28399
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
28400
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
28401
|
+
}).strict().optional(),
|
|
28402
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
28403
|
+
notice: localizedTextSchema.optional(),
|
|
28199
28404
|
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
28200
28405
|
launchCommand: external_exports.literal(true).optional(),
|
|
28201
28406
|
links: external_exports.object({
|
|
28407
|
+
website: documentationUrlSchema.optional(),
|
|
28202
28408
|
documentation: documentationUrlSchema.optional(),
|
|
28203
28409
|
installation: documentationUrlSchema.optional()
|
|
28204
28410
|
}).strict().optional()
|
|
@@ -28617,6 +28823,11 @@ var codexSshDraftSchema = external_exports.strictObject({
|
|
|
28617
28823
|
});
|
|
28618
28824
|
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28619
28825
|
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28826
|
+
external_exports.strictObject({
|
|
28827
|
+
action: external_exports.literal("read-thread"),
|
|
28828
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28829
|
+
input: delegationReadParamsSchema
|
|
28830
|
+
}),
|
|
28620
28831
|
external_exports.strictObject({
|
|
28621
28832
|
action: external_exports.literal("save"),
|
|
28622
28833
|
draft: codexSshDraftSchema,
|
|
@@ -29016,7 +29227,6 @@ var tokenFields = [
|
|
|
29016
29227
|
"cachedInputTokens",
|
|
29017
29228
|
"cacheWriteInputTokens",
|
|
29018
29229
|
"outputTokens",
|
|
29019
|
-
"outputTokensPerSecond",
|
|
29020
29230
|
"reasoningOutputTokens",
|
|
29021
29231
|
"totalTokens",
|
|
29022
29232
|
"contextWindowTokens",
|
|
@@ -29024,10 +29234,12 @@ var tokenFields = [
|
|
|
29024
29234
|
];
|
|
29025
29235
|
var safeIntegerFields = [
|
|
29026
29236
|
"planFiveHourResetsAtUnix",
|
|
29027
|
-
"planSevenDayResetsAtUnix"
|
|
29237
|
+
"planSevenDayResetsAtUnix",
|
|
29238
|
+
"timeToFirstOutputMs"
|
|
29028
29239
|
];
|
|
29029
29240
|
var percentFields = [
|
|
29030
29241
|
"cacheHitRatePercent",
|
|
29242
|
+
"sessionCacheHitRatePercent",
|
|
29031
29243
|
"planFiveHourUsedPercent",
|
|
29032
29244
|
"planSevenDayUsedPercent"
|
|
29033
29245
|
];
|
|
@@ -29035,9 +29247,14 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
29035
29247
|
...tokenFields,
|
|
29036
29248
|
...safeIntegerFields,
|
|
29037
29249
|
...percentFields,
|
|
29250
|
+
"sessionCacheUsage",
|
|
29038
29251
|
"totalCostUsd",
|
|
29039
29252
|
"totalCredits",
|
|
29040
|
-
"contextUsagePercent"
|
|
29253
|
+
"contextUsagePercent",
|
|
29254
|
+
"outputTokensPerSecond",
|
|
29255
|
+
"apiOutputTokensPerSecond",
|
|
29256
|
+
"costSource",
|
|
29257
|
+
"unpricedModels"
|
|
29041
29258
|
]);
|
|
29042
29259
|
function isRecord(value) {
|
|
29043
29260
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29053,7 +29270,11 @@ function parseHostUsage(value) {
|
|
|
29053
29270
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
29054
29271
|
}
|
|
29055
29272
|
}
|
|
29056
|
-
for (const field of [
|
|
29273
|
+
for (const field of [
|
|
29274
|
+
"totalCredits",
|
|
29275
|
+
"contextUsagePercent",
|
|
29276
|
+
"apiOutputTokensPerSecond"
|
|
29277
|
+
]) {
|
|
29057
29278
|
const candidate = value[field];
|
|
29058
29279
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
29059
29280
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
@@ -29083,6 +29304,12 @@ function parseHostUsage(value) {
|
|
|
29083
29304
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
29084
29305
|
}
|
|
29085
29306
|
}
|
|
29307
|
+
if (value.sessionCacheUsage !== void 0) {
|
|
29308
|
+
const totals2 = value.sessionCacheUsage;
|
|
29309
|
+
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) {
|
|
29310
|
+
throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
|
|
29311
|
+
}
|
|
29312
|
+
}
|
|
29086
29313
|
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
29087
29314
|
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
29088
29315
|
if (hasContextUsed !== hasContextWindow) {
|
|
@@ -29097,8 +29324,43 @@ function parseHostUsage(value) {
|
|
|
29097
29324
|
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
29098
29325
|
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
29099
29326
|
}
|
|
29327
|
+
if (value.costSource !== void 0) {
|
|
29328
|
+
if (value.costSource !== "publicPrice" && value.costSource !== "native") {
|
|
29329
|
+
throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
|
|
29330
|
+
}
|
|
29331
|
+
if (value.totalCostUsd === void 0) {
|
|
29332
|
+
throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
|
|
29333
|
+
}
|
|
29334
|
+
}
|
|
29335
|
+
if (value.unpricedModels !== void 0) {
|
|
29336
|
+
const models = value.unpricedModels;
|
|
29337
|
+
if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
|
|
29338
|
+
throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
|
|
29339
|
+
}
|
|
29340
|
+
if (value.costSource !== "publicPrice") {
|
|
29341
|
+
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
29342
|
+
}
|
|
29343
|
+
return { ...value, unpricedModels: [...models] };
|
|
29344
|
+
}
|
|
29100
29345
|
return { ...value };
|
|
29101
29346
|
}
|
|
29347
|
+
var requestTokenFields = [
|
|
29348
|
+
"inputTokens",
|
|
29349
|
+
"cachedInputTokens",
|
|
29350
|
+
"cacheWriteInputTokens",
|
|
29351
|
+
"cacheWrite1hInputTokens",
|
|
29352
|
+
"outputTokens",
|
|
29353
|
+
"reasoningOutputTokens",
|
|
29354
|
+
"startedAtMs",
|
|
29355
|
+
"completedAtMs"
|
|
29356
|
+
];
|
|
29357
|
+
var requestFields = /* @__PURE__ */ new Set([
|
|
29358
|
+
...requestTokenFields,
|
|
29359
|
+
"requestId",
|
|
29360
|
+
"historical",
|
|
29361
|
+
"model",
|
|
29362
|
+
"provider"
|
|
29363
|
+
]);
|
|
29102
29364
|
|
|
29103
29365
|
// ../../harness-adapter/dist/live-command-catalog.js
|
|
29104
29366
|
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -29753,10 +30015,10 @@ function parseQoderModelCatalog(rawModels) {
|
|
|
29753
30015
|
...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
|
|
29754
30016
|
});
|
|
29755
30017
|
}
|
|
29756
|
-
function qoderAvailableThinkingOptions(catalog,
|
|
29757
|
-
if (!catalog || !
|
|
30018
|
+
function qoderAvailableThinkingOptions(catalog, model2) {
|
|
30019
|
+
if (!catalog || !model2)
|
|
29758
30020
|
return void 0;
|
|
29759
|
-
const supported = catalog.models.find(({ ref }) => ref.id ===
|
|
30021
|
+
const supported = catalog.models.find(({ ref }) => ref.id === model2.id)?.supportedThinkingOptionIds;
|
|
29760
30022
|
if (!supported || supported.length === 0)
|
|
29761
30023
|
return void 0;
|
|
29762
30024
|
const options = supported.flatMap((id) => {
|
|
@@ -30268,8 +30530,8 @@ function getErrorMap2() {
|
|
|
30268
30530
|
|
|
30269
30531
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30270
30532
|
var makeIssue = (params) => {
|
|
30271
|
-
const { data, path:
|
|
30272
|
-
const fullPath = [...
|
|
30533
|
+
const { data, path: path10, errorMaps, issueData } = params;
|
|
30534
|
+
const fullPath = [...path10, ...issueData.path || []];
|
|
30273
30535
|
const fullIssue = {
|
|
30274
30536
|
...issueData,
|
|
30275
30537
|
path: fullPath
|
|
@@ -30384,11 +30646,11 @@ var errorUtil;
|
|
|
30384
30646
|
|
|
30385
30647
|
// ../../../node_modules/zod/v3/types.js
|
|
30386
30648
|
var ParseInputLazyPath = class {
|
|
30387
|
-
constructor(parent, value,
|
|
30649
|
+
constructor(parent, value, path10, key) {
|
|
30388
30650
|
this._cachedPath = [];
|
|
30389
30651
|
this.parent = parent;
|
|
30390
30652
|
this.data = value;
|
|
30391
|
-
this._path =
|
|
30653
|
+
this._path = path10;
|
|
30392
30654
|
this._key = key;
|
|
30393
30655
|
}
|
|
30394
30656
|
get path() {
|
|
@@ -33915,11 +34177,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33915
34177
|
}
|
|
33916
34178
|
return void 0;
|
|
33917
34179
|
}
|
|
33918
|
-
function getDotPath(
|
|
33919
|
-
if (
|
|
34180
|
+
function getDotPath(path10) {
|
|
34181
|
+
if (path10.length === 0) {
|
|
33920
34182
|
return "object root";
|
|
33921
34183
|
}
|
|
33922
|
-
return
|
|
34184
|
+
return path10.reduce((acc, seg, index) => {
|
|
33923
34185
|
if (index === 0) {
|
|
33924
34186
|
return String(seg);
|
|
33925
34187
|
}
|
|
@@ -52648,6 +52910,246 @@ var QoderSessionImport = class {
|
|
|
52648
52910
|
}
|
|
52649
52911
|
};
|
|
52650
52912
|
|
|
52913
|
+
// dist/qoder-usage-statistics.js
|
|
52914
|
+
import os4 from "node:os";
|
|
52915
|
+
import path8 from "node:path";
|
|
52916
|
+
|
|
52917
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
52918
|
+
import { createReadStream } from "node:fs";
|
|
52919
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
52920
|
+
import path6 from "node:path";
|
|
52921
|
+
import { createInterface } from "node:readline";
|
|
52922
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
52923
|
+
var MAX_CWD_LENGTH = 4096;
|
|
52924
|
+
function sessionIdOk(value) {
|
|
52925
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52926
|
+
}
|
|
52927
|
+
function cwdOk(value) {
|
|
52928
|
+
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("\\\\"));
|
|
52929
|
+
}
|
|
52930
|
+
function withUsageSession(entry, session) {
|
|
52931
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52932
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
52933
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
52934
|
+
return entry;
|
|
52935
|
+
return {
|
|
52936
|
+
...entry,
|
|
52937
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
52938
|
+
...cwd !== void 0 ? { cwd } : {}
|
|
52939
|
+
};
|
|
52940
|
+
}
|
|
52941
|
+
function tokenCount(value) {
|
|
52942
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
52943
|
+
}
|
|
52944
|
+
function parseHarnessUsageEntry(value) {
|
|
52945
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
52946
|
+
return null;
|
|
52947
|
+
const entry = value;
|
|
52948
|
+
if (typeof entry.id !== "string" || entry.id.length === 0 || entry.id.length > 512)
|
|
52949
|
+
return null;
|
|
52950
|
+
if (!tokenCount(entry.occurredAtMs) || entry.occurredAtMs === 0)
|
|
52951
|
+
return null;
|
|
52952
|
+
if (entry.model !== void 0 && (typeof entry.model !== "string" || entry.model.length === 0)) {
|
|
52953
|
+
return null;
|
|
52954
|
+
}
|
|
52955
|
+
if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
|
|
52956
|
+
return null;
|
|
52957
|
+
for (const field of [
|
|
52958
|
+
"cachedInputTokens",
|
|
52959
|
+
"cacheWriteInputTokens",
|
|
52960
|
+
"cacheWrite1hInputTokens",
|
|
52961
|
+
"reasoningOutputTokens"
|
|
52962
|
+
]) {
|
|
52963
|
+
if (entry[field] !== void 0 && !tokenCount(entry[field]))
|
|
52964
|
+
return null;
|
|
52965
|
+
}
|
|
52966
|
+
const cached2 = entry.cachedInputTokens ?? 0;
|
|
52967
|
+
const written = entry.cacheWriteInputTokens ?? 0;
|
|
52968
|
+
if (cached2 + written > entry.inputTokens)
|
|
52969
|
+
return null;
|
|
52970
|
+
if ((entry.cacheWrite1hInputTokens ?? 0) > written)
|
|
52971
|
+
return null;
|
|
52972
|
+
if ((entry.reasoningOutputTokens ?? 0) > entry.outputTokens)
|
|
52973
|
+
return null;
|
|
52974
|
+
if (entry.sessionId !== void 0 && !sessionIdOk(entry.sessionId))
|
|
52975
|
+
return null;
|
|
52976
|
+
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
52977
|
+
return null;
|
|
52978
|
+
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
52979
|
+
return null;
|
|
52980
|
+
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
52981
|
+
return null;
|
|
52982
|
+
}
|
|
52983
|
+
if (entry.credits !== void 0 && (typeof entry.credits !== "number" || !Number.isFinite(entry.credits) || entry.credits < 0)) {
|
|
52984
|
+
return null;
|
|
52985
|
+
}
|
|
52986
|
+
return entry;
|
|
52987
|
+
}
|
|
52988
|
+
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
52989
|
+
const sources = [];
|
|
52990
|
+
const visit = async (directory, depth) => {
|
|
52991
|
+
signal.throwIfAborted();
|
|
52992
|
+
const entries = await opendir(directory).catch((error51) => {
|
|
52993
|
+
if (error51.code === "ENOENT")
|
|
52994
|
+
return null;
|
|
52995
|
+
throw error51;
|
|
52996
|
+
});
|
|
52997
|
+
if (!entries)
|
|
52998
|
+
return;
|
|
52999
|
+
for await (const entry of entries) {
|
|
53000
|
+
signal.throwIfAborted();
|
|
53001
|
+
const file2 = path6.join(directory, entry.name);
|
|
53002
|
+
if (entry.isDirectory()) {
|
|
53003
|
+
if (depth < maxDepth)
|
|
53004
|
+
await visit(file2, depth + 1);
|
|
53005
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
53006
|
+
const info = await lstat(file2).catch(() => null);
|
|
53007
|
+
if (info?.isFile() && info.size > 0) {
|
|
53008
|
+
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
53009
|
+
}
|
|
53010
|
+
}
|
|
53011
|
+
}
|
|
53012
|
+
};
|
|
53013
|
+
await visit(root, 0);
|
|
53014
|
+
return sources;
|
|
53015
|
+
}
|
|
53016
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
53017
|
+
const lines = createInterface({
|
|
53018
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
53019
|
+
crlfDelay: Infinity
|
|
53020
|
+
});
|
|
53021
|
+
for await (const line of lines) {
|
|
53022
|
+
if (!line.includes(marker))
|
|
53023
|
+
continue;
|
|
53024
|
+
let value;
|
|
53025
|
+
try {
|
|
53026
|
+
value = JSON.parse(line);
|
|
53027
|
+
} catch {
|
|
53028
|
+
continue;
|
|
53029
|
+
}
|
|
53030
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
53031
|
+
yield value;
|
|
53032
|
+
}
|
|
53033
|
+
}
|
|
53034
|
+
}
|
|
53035
|
+
function nativeTimeMs(value) {
|
|
53036
|
+
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
53037
|
+
return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
|
|
53038
|
+
}
|
|
53039
|
+
|
|
53040
|
+
// dist/qoder-model-labels.js
|
|
53041
|
+
import { readFile, stat as stat2 } from "node:fs/promises";
|
|
53042
|
+
import path7 from "node:path";
|
|
53043
|
+
function record3(value) {
|
|
53044
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53045
|
+
}
|
|
53046
|
+
async function readQoderModelLabels(configDirectory, signal) {
|
|
53047
|
+
signal.throwIfAborted();
|
|
53048
|
+
try {
|
|
53049
|
+
const file2 = path7.join(configDirectory, ".auth", "dynamic-texts.json");
|
|
53050
|
+
if ((await stat2(file2)).size > 1024 * 1024)
|
|
53051
|
+
return {};
|
|
53052
|
+
const data = JSON.parse(await readFile(file2, { encoding: "utf8", signal }));
|
|
53053
|
+
if (!record3(data) || !record3(data.locales))
|
|
53054
|
+
return {};
|
|
53055
|
+
const labels = /* @__PURE__ */ new Map();
|
|
53056
|
+
for (const locale of ["zh-CN", "en"]) {
|
|
53057
|
+
const texts = data.locales[locale];
|
|
53058
|
+
if (!record3(texts))
|
|
53059
|
+
continue;
|
|
53060
|
+
for (const [key, value] of Object.entries(texts)) {
|
|
53061
|
+
const prefix = "modelSelector.item.";
|
|
53062
|
+
if (!key.startsWith(prefix))
|
|
53063
|
+
continue;
|
|
53064
|
+
const id = key.slice(prefix.length);
|
|
53065
|
+
if (!id || id.length > 512 || /\.(description|markdownDescription)(\.|$)/u.test(id))
|
|
53066
|
+
continue;
|
|
53067
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 512)
|
|
53068
|
+
continue;
|
|
53069
|
+
labels.set(id, value.trim());
|
|
53070
|
+
}
|
|
53071
|
+
}
|
|
53072
|
+
return Object.fromEntries(labels);
|
|
53073
|
+
} catch {
|
|
53074
|
+
signal.throwIfAborted();
|
|
53075
|
+
return {};
|
|
53076
|
+
}
|
|
53077
|
+
}
|
|
53078
|
+
|
|
53079
|
+
// dist/qoder-usage-statistics.js
|
|
53080
|
+
function qoderProjectsDirectory(environment, variant) {
|
|
53081
|
+
const cn3 = variant === "cn";
|
|
53082
|
+
const config2 = environment[cn3 ? "QODERCN_CONFIG_DIR" : "QODER_CONFIG_DIR"];
|
|
53083
|
+
const home = environment[cn3 ? "QODERCN_CLI_HOME" : "QODER_CLI_HOME"] || environment.HOME || environment.USERPROFILE || os4.homedir();
|
|
53084
|
+
return path8.resolve(config2 || path8.join(home, cn3 ? ".qoder-cn" : ".qoder"), "projects");
|
|
53085
|
+
}
|
|
53086
|
+
function isRecord2(value) {
|
|
53087
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53088
|
+
}
|
|
53089
|
+
function count2(value) {
|
|
53090
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53091
|
+
}
|
|
53092
|
+
async function readQoderUsage(file2, signal) {
|
|
53093
|
+
const messages = /* @__PURE__ */ new Map();
|
|
53094
|
+
let sessionId;
|
|
53095
|
+
let cwd;
|
|
53096
|
+
for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
|
|
53097
|
+
signal.throwIfAborted();
|
|
53098
|
+
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53099
|
+
continue;
|
|
53100
|
+
sessionId ??= line.sessionId;
|
|
53101
|
+
cwd ??= line.cwd;
|
|
53102
|
+
if (isRecord2(line.forkedFrom) || line.isApiErrorMessage === true)
|
|
53103
|
+
continue;
|
|
53104
|
+
const { id, model: model2, usage } = line.message;
|
|
53105
|
+
if (typeof id !== "string" || !id || model2 === "<synthetic>")
|
|
53106
|
+
continue;
|
|
53107
|
+
const message = messages.get(id) ?? { at: null };
|
|
53108
|
+
message.at ??= nativeTimeMs(line.timestamp);
|
|
53109
|
+
messages.set(id, message);
|
|
53110
|
+
if (!isRecord2(usage) || message.at === null)
|
|
53111
|
+
continue;
|
|
53112
|
+
const input = usage.input_tokens;
|
|
53113
|
+
const output = usage.output_tokens;
|
|
53114
|
+
const cached2 = usage.cache_read_input_tokens;
|
|
53115
|
+
const written = usage.cache_creation_input_tokens;
|
|
53116
|
+
if (!count2(input) || !count2(output) || !count2(cached2) || !count2(written))
|
|
53117
|
+
continue;
|
|
53118
|
+
const split = isRecord2(usage.cache_creation) ? usage.cache_creation : null;
|
|
53119
|
+
const oneHour = split?.ephemeral_1h_input_tokens;
|
|
53120
|
+
const details = isRecord2(usage.output_tokens_details) ? usage.output_tokens_details : null;
|
|
53121
|
+
const thinking = details?.thinking_tokens;
|
|
53122
|
+
const unreported = input === 0 && output === 0 && cached2 === 0 && written === 0;
|
|
53123
|
+
const entry = parseHarnessUsageEntry({
|
|
53124
|
+
id,
|
|
53125
|
+
occurredAtMs: message.at,
|
|
53126
|
+
...typeof model2 === "string" && model2 ? { model: model2 } : {},
|
|
53127
|
+
inputTokens: input + cached2 + written,
|
|
53128
|
+
cachedInputTokens: cached2,
|
|
53129
|
+
cacheWriteInputTokens: written,
|
|
53130
|
+
...count2(oneHour) ? { cacheWrite1hInputTokens: oneHour } : {},
|
|
53131
|
+
outputTokens: output,
|
|
53132
|
+
...typeof usage.credits === "number" && Number.isFinite(usage.credits) && usage.credits >= 0 ? { credits: usage.credits } : {},
|
|
53133
|
+
...count2(thinking) ? { reasoningOutputTokens: thinking } : {},
|
|
53134
|
+
...unreported ? { tokensUnknown: true } : {}
|
|
53135
|
+
});
|
|
53136
|
+
if (entry)
|
|
53137
|
+
message.entry = entry;
|
|
53138
|
+
}
|
|
53139
|
+
const session = {
|
|
53140
|
+
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53141
|
+
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53142
|
+
};
|
|
53143
|
+
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53144
|
+
}
|
|
53145
|
+
function createQoderUsageStatistics(environment, variant) {
|
|
53146
|
+
return Object.freeze({
|
|
53147
|
+
readModelLabels: (signal) => readQoderModelLabels(path8.dirname(qoderProjectsDirectory(environment, variant)), signal),
|
|
53148
|
+
listSources: (signal) => jsonlUsageSources(qoderProjectsDirectory(environment, variant), 4, signal),
|
|
53149
|
+
readSource: readQoderUsage
|
|
53150
|
+
});
|
|
53151
|
+
}
|
|
53152
|
+
|
|
52651
53153
|
// dist/qoder-adapter.js
|
|
52652
53154
|
var QoderAdapter = class {
|
|
52653
53155
|
harnessId;
|
|
@@ -52655,6 +53157,7 @@ var QoderAdapter = class {
|
|
|
52655
53157
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52656
53158
|
liveCommandCatalog = true;
|
|
52657
53159
|
sessionImport;
|
|
53160
|
+
usageStatistics;
|
|
52658
53161
|
#commandOverride;
|
|
52659
53162
|
#environment;
|
|
52660
53163
|
#platform;
|
|
@@ -52673,6 +53176,7 @@ var QoderAdapter = class {
|
|
|
52673
53176
|
this.harnessId = harnessIdSchema.parse(runtime.harnessId);
|
|
52674
53177
|
this.#commandOverride = options.commandOverride ?? options.environment?.[runtime.commandEnvironmentVariable];
|
|
52675
53178
|
this.#environment = qoderEnvironment(options.environment);
|
|
53179
|
+
this.usageStatistics = createQoderUsageStatistics({ ...process.env, ...options.environment }, this.#variant);
|
|
52676
53180
|
this.#platform = options.platform ?? process.platform;
|
|
52677
53181
|
this.#queryFactory = options.queryFactory ?? ((input) => runtime.sdk.query(input));
|
|
52678
53182
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
@@ -52902,7 +53406,7 @@ var QoderAdapter = class {
|
|
|
52902
53406
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52903
53407
|
} catch {
|
|
52904
53408
|
}
|
|
52905
|
-
if (sourceInfo?.cwd &&
|
|
53409
|
+
if (sourceInfo?.cwd && path9.resolve(sourceInfo.cwd) !== path9.resolve(input.cwd)) {
|
|
52906
53410
|
return {
|
|
52907
53411
|
ok: false,
|
|
52908
53412
|
error: {
|