@liberseek/boft-cli-win32-arm64 0.7.8 → 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 +16801 -16440
- package/app/console-web.js +9774 -3685
- package/app/desktop-controller.mjs +16475 -374
- package/app/host-runtime.mjs +9052 -1793
- package/app/plugins/antigravity/manifest.json +18 -1
- package/app/plugins/antigravity/plugin.mjs +357 -42
- package/app/plugins/claude-code/manifest.json +28 -0
- package/app/plugins/claude-code/plugin.mjs +1448 -491
- package/app/plugins/codebuddy/manifest.json +17 -0
- package/app/plugins/codebuddy/plugin.mjs +6589 -5423
- 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 +782 -197
- 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 +879 -242
- package/app/plugins/enabled.json +3 -1
- package/app/plugins/grok/manifest.json +21 -1
- package/app/plugins/grok/plugin.mjs +1274 -241
- package/app/plugins/hermes/assets/icon.png +0 -0
- package/app/plugins/hermes/manifest.json +30 -2
- package/app/plugins/hermes/plugin.mjs +3493 -7686
- 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 +922 -76
- 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 +658 -57
- package/app/plugins/muse/manifest.json +18 -1
- package/app/plugins/muse/plugin.mjs +332 -17
- package/app/plugins/omp/manifest.json +21 -1
- package/app/plugins/omp/plugin.mjs +2320 -1131
- package/app/plugins/opencode/manifest.json +18 -1
- package/app/plugins/opencode/plugin.mjs +979 -184
- package/app/plugins/pi/manifest.json +32 -0
- package/app/plugins/pi/plugin.mjs +2785 -2090
- package/app/plugins/qoder/manifest.json +18 -1
- package/app/plugins/qoder/plugin.mjs +832 -82
- package/app/plugins/qoder-cn/manifest.json +18 -1
- package/app/plugins/qoder-cn/plugin.mjs +832 -82
- package/app/plugins/workbuddy/manifest.json +18 -0
- package/app/plugins/workbuddy/plugin.mjs +6947 -5773
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +32 -0
- package/app/plugins/zcode/plugin.mjs +20110 -0
- package/app/renderer-extension.js +4762 -2470
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/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"
|
|
@@ -27188,6 +27344,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
27188
27344
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27189
27345
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27190
27346
|
|
|
27347
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
27348
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
27349
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
27350
|
+
|
|
27191
27351
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
27192
27352
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27193
27353
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -27195,13 +27355,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
|
|
|
27195
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);
|
|
27196
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");
|
|
27197
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();
|
|
27198
27365
|
var pluginPresentationShape = {
|
|
27199
27366
|
id: harnessPluginIdSchema,
|
|
27200
27367
|
name: external_exports.string().trim().min(1).max(128),
|
|
27201
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(),
|
|
27202
27388
|
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27203
27389
|
launchCommand: external_exports.literal(true).optional(),
|
|
27204
27390
|
links: external_exports.object({
|
|
27391
|
+
website: documentationUrlSchema.optional(),
|
|
27205
27392
|
documentation: documentationUrlSchema.optional(),
|
|
27206
27393
|
installation: documentationUrlSchema.optional()
|
|
27207
27394
|
}).strict().optional()
|
|
@@ -27255,6 +27442,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
27255
27442
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27256
27443
|
});
|
|
27257
27444
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27445
|
+
"codexhost/console/remote-connections",
|
|
27446
|
+
"codexhost/runtime/status",
|
|
27447
|
+
"codexhost/remote/ssh-setup",
|
|
27258
27448
|
"codexhost/harness/plugins/list",
|
|
27259
27449
|
"codexhost/harness/display-settings/get",
|
|
27260
27450
|
"codexhost/harness/display-settings/set",
|
|
@@ -27275,6 +27465,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27275
27465
|
"codexhost/account/list",
|
|
27276
27466
|
"codexhost/account/refresh",
|
|
27277
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",
|
|
27278
27472
|
"codexhost/update/check",
|
|
27279
27473
|
"codexhost/update/start",
|
|
27280
27474
|
"codexhost/update/status"
|
|
@@ -27339,6 +27533,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27339
27533
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27340
27534
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27341
27535
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27536
|
+
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27342
27537
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27343
27538
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27344
27539
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
@@ -27350,7 +27545,11 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27350
27545
|
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27351
27546
|
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27352
27547
|
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27353
|
-
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()
|
|
27354
27553
|
}).strict().superRefine((usage, context) => {
|
|
27355
27554
|
if (Object.keys(usage).length === 0) {
|
|
27356
27555
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -27371,6 +27570,20 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27371
27570
|
path: ["contextWindowTokens"]
|
|
27372
27571
|
});
|
|
27373
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
|
+
}
|
|
27374
27587
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
27375
27588
|
context.addIssue({
|
|
27376
27589
|
code: "custom",
|
|
@@ -27640,27 +27853,27 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
27640
27853
|
}).strict().superRefine((catalog, context) => {
|
|
27641
27854
|
const refs = /* @__PURE__ */ new Set();
|
|
27642
27855
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
27643
|
-
for (const [index,
|
|
27644
|
-
if (refs.has(
|
|
27856
|
+
for (const [index, model2] of catalog.models.entries()) {
|
|
27857
|
+
if (refs.has(model2.ref.id)) {
|
|
27645
27858
|
context.addIssue({
|
|
27646
27859
|
code: "custom",
|
|
27647
27860
|
message: "Model Catalog refs must be unique",
|
|
27648
27861
|
path: ["models", index, "ref", "id"]
|
|
27649
27862
|
});
|
|
27650
27863
|
}
|
|
27651
|
-
refs.add(
|
|
27652
|
-
if (
|
|
27653
|
-
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)) {
|
|
27654
27867
|
context.addIssue({
|
|
27655
27868
|
code: "custom",
|
|
27656
27869
|
message: "Fast Model refs must be distinct and unique",
|
|
27657
27870
|
path: ["models", index, "fastModel"]
|
|
27658
27871
|
});
|
|
27659
27872
|
}
|
|
27660
|
-
refs.add(
|
|
27873
|
+
refs.add(model2.fastModel.id);
|
|
27661
27874
|
}
|
|
27662
27875
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
27663
|
-
for (const [optionIndex, optionId] of (
|
|
27876
|
+
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
27664
27877
|
if (supportedThinkingIds.has(optionId)) {
|
|
27665
27878
|
context.addIssue({
|
|
27666
27879
|
code: "custom",
|
|
@@ -28200,6 +28413,85 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28200
28413
|
status: updateStatusSchema.nullable()
|
|
28201
28414
|
});
|
|
28202
28415
|
|
|
28416
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
28417
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
28418
|
+
"idle",
|
|
28419
|
+
"installing",
|
|
28420
|
+
"restarting",
|
|
28421
|
+
"succeeded",
|
|
28422
|
+
"failed"
|
|
28423
|
+
]);
|
|
28424
|
+
var runtimeStatusSchema = external_exports.object({
|
|
28425
|
+
runningVersion: external_exports.string().nullable(),
|
|
28426
|
+
installedVersion: external_exports.string().nullable(),
|
|
28427
|
+
restartRequired: external_exports.boolean(),
|
|
28428
|
+
remote: external_exports.boolean(),
|
|
28429
|
+
updateSupported: external_exports.boolean(),
|
|
28430
|
+
update: external_exports.object({
|
|
28431
|
+
phase: remoteUpdatePhaseSchema,
|
|
28432
|
+
targetVersion: external_exports.string().nullable(),
|
|
28433
|
+
error: external_exports.string().nullable()
|
|
28434
|
+
})
|
|
28435
|
+
});
|
|
28436
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
28437
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
28438
|
+
}).strict();
|
|
28439
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
28440
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28441
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28442
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28443
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
28444
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
28445
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28446
|
+
}).strict();
|
|
28447
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28448
|
+
|
|
28449
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
28450
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
28451
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
28452
|
+
hostId,
|
|
28453
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28454
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
28455
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
28456
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
28457
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28458
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28459
|
+
autoConnect: external_exports.boolean(),
|
|
28460
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
28461
|
+
});
|
|
28462
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
28463
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28464
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
28465
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28466
|
+
identity: external_exports.string().max(4096).nullable()
|
|
28467
|
+
});
|
|
28468
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
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
|
+
}),
|
|
28475
|
+
external_exports.strictObject({
|
|
28476
|
+
action: external_exports.literal("save"),
|
|
28477
|
+
draft: codexSshDraftSchema,
|
|
28478
|
+
previous: codexSshConnectionSchema.nullable()
|
|
28479
|
+
}),
|
|
28480
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
28481
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
28482
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
28483
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
28484
|
+
external_exports.strictObject({
|
|
28485
|
+
action: external_exports.literal("update"),
|
|
28486
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28487
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
28488
|
+
})
|
|
28489
|
+
]);
|
|
28490
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
28491
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
28492
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
28493
|
+
]);
|
|
28494
|
+
|
|
28203
28495
|
// ../../shared-contracts/dist/index.js
|
|
28204
28496
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28205
28497
|
|
|
@@ -28984,7 +29276,6 @@ var tokenFields = [
|
|
|
28984
29276
|
"cachedInputTokens",
|
|
28985
29277
|
"cacheWriteInputTokens",
|
|
28986
29278
|
"outputTokens",
|
|
28987
|
-
"outputTokensPerSecond",
|
|
28988
29279
|
"reasoningOutputTokens",
|
|
28989
29280
|
"totalTokens",
|
|
28990
29281
|
"contextWindowTokens",
|
|
@@ -28992,10 +29283,12 @@ var tokenFields = [
|
|
|
28992
29283
|
];
|
|
28993
29284
|
var safeIntegerFields = [
|
|
28994
29285
|
"planFiveHourResetsAtUnix",
|
|
28995
|
-
"planSevenDayResetsAtUnix"
|
|
29286
|
+
"planSevenDayResetsAtUnix",
|
|
29287
|
+
"timeToFirstOutputMs"
|
|
28996
29288
|
];
|
|
28997
29289
|
var percentFields = [
|
|
28998
29290
|
"cacheHitRatePercent",
|
|
29291
|
+
"sessionCacheHitRatePercent",
|
|
28999
29292
|
"planFiveHourUsedPercent",
|
|
29000
29293
|
"planSevenDayUsedPercent"
|
|
29001
29294
|
];
|
|
@@ -29003,9 +29296,14 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
29003
29296
|
...tokenFields,
|
|
29004
29297
|
...safeIntegerFields,
|
|
29005
29298
|
...percentFields,
|
|
29299
|
+
"sessionCacheUsage",
|
|
29006
29300
|
"totalCostUsd",
|
|
29007
29301
|
"totalCredits",
|
|
29008
|
-
"contextUsagePercent"
|
|
29302
|
+
"contextUsagePercent",
|
|
29303
|
+
"outputTokensPerSecond",
|
|
29304
|
+
"apiOutputTokensPerSecond",
|
|
29305
|
+
"costSource",
|
|
29306
|
+
"unpricedModels"
|
|
29009
29307
|
]);
|
|
29010
29308
|
function isRecord(value) {
|
|
29011
29309
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29021,7 +29319,11 @@ function parseHostUsage(value) {
|
|
|
29021
29319
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
29022
29320
|
}
|
|
29023
29321
|
}
|
|
29024
|
-
for (const field of [
|
|
29322
|
+
for (const field of [
|
|
29323
|
+
"totalCredits",
|
|
29324
|
+
"contextUsagePercent",
|
|
29325
|
+
"apiOutputTokensPerSecond"
|
|
29326
|
+
]) {
|
|
29025
29327
|
const candidate = value[field];
|
|
29026
29328
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
29027
29329
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
@@ -29057,6 +29359,12 @@ function parseHostUsage(value) {
|
|
|
29057
29359
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
29058
29360
|
}
|
|
29059
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
|
+
}
|
|
29060
29368
|
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
29061
29369
|
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
29062
29370
|
if (hasContextUsed !== hasContextWindow) {
|
|
@@ -29071,8 +29379,43 @@ function parseHostUsage(value) {
|
|
|
29071
29379
|
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
29072
29380
|
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
29073
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
|
+
}
|
|
29074
29400
|
return { ...value };
|
|
29075
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
|
+
]);
|
|
29076
29419
|
|
|
29077
29420
|
// ../../harness-adapter/dist/live-command-catalog.js
|
|
29078
29421
|
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -29727,10 +30070,10 @@ function parseQoderModelCatalog(rawModels) {
|
|
|
29727
30070
|
...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
|
|
29728
30071
|
});
|
|
29729
30072
|
}
|
|
29730
|
-
function qoderAvailableThinkingOptions(catalog,
|
|
29731
|
-
if (!catalog || !
|
|
30073
|
+
function qoderAvailableThinkingOptions(catalog, model2) {
|
|
30074
|
+
if (!catalog || !model2)
|
|
29732
30075
|
return void 0;
|
|
29733
|
-
const supported = catalog.models.find(({ ref }) => ref.id ===
|
|
30076
|
+
const supported = catalog.models.find(({ ref }) => ref.id === model2.id)?.supportedThinkingOptionIds;
|
|
29734
30077
|
if (!supported || supported.length === 0)
|
|
29735
30078
|
return void 0;
|
|
29736
30079
|
const options = supported.flatMap((id) => {
|
|
@@ -30242,8 +30585,8 @@ function getErrorMap2() {
|
|
|
30242
30585
|
|
|
30243
30586
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30244
30587
|
var makeIssue = (params) => {
|
|
30245
|
-
const { data, path:
|
|
30246
|
-
const fullPath = [...
|
|
30588
|
+
const { data, path: path10, errorMaps, issueData } = params;
|
|
30589
|
+
const fullPath = [...path10, ...issueData.path || []];
|
|
30247
30590
|
const fullIssue = {
|
|
30248
30591
|
...issueData,
|
|
30249
30592
|
path: fullPath
|
|
@@ -30358,11 +30701,11 @@ var errorUtil;
|
|
|
30358
30701
|
|
|
30359
30702
|
// ../../../node_modules/zod/v3/types.js
|
|
30360
30703
|
var ParseInputLazyPath = class {
|
|
30361
|
-
constructor(parent, value,
|
|
30704
|
+
constructor(parent, value, path10, key) {
|
|
30362
30705
|
this._cachedPath = [];
|
|
30363
30706
|
this.parent = parent;
|
|
30364
30707
|
this.data = value;
|
|
30365
|
-
this._path =
|
|
30708
|
+
this._path = path10;
|
|
30366
30709
|
this._key = key;
|
|
30367
30710
|
}
|
|
30368
30711
|
get path() {
|
|
@@ -33889,11 +34232,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33889
34232
|
}
|
|
33890
34233
|
return void 0;
|
|
33891
34234
|
}
|
|
33892
|
-
function getDotPath(
|
|
33893
|
-
if (
|
|
34235
|
+
function getDotPath(path10) {
|
|
34236
|
+
if (path10.length === 0) {
|
|
33894
34237
|
return "object root";
|
|
33895
34238
|
}
|
|
33896
|
-
return
|
|
34239
|
+
return path10.reduce((acc, seg, index) => {
|
|
33897
34240
|
if (index === 0) {
|
|
33898
34241
|
return String(seg);
|
|
33899
34242
|
}
|
|
@@ -52464,12 +52807,412 @@ var QoderSession = class {
|
|
|
52464
52807
|
}
|
|
52465
52808
|
};
|
|
52466
52809
|
|
|
52810
|
+
// ../qoder/dist/qoder-session-import.js
|
|
52811
|
+
import { stat } from "node:fs/promises";
|
|
52812
|
+
import path5 from "node:path";
|
|
52813
|
+
|
|
52814
|
+
// ../../harness-adapter/dist/session-import.js
|
|
52815
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
52816
|
+
function isStorageAccessError(error51) {
|
|
52817
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
52818
|
+
}
|
|
52819
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
52820
|
+
if (typeof value !== "string")
|
|
52821
|
+
return null;
|
|
52822
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52823
|
+
if (!normalized)
|
|
52824
|
+
return null;
|
|
52825
|
+
if (normalized.length <= maxLength)
|
|
52826
|
+
return normalized;
|
|
52827
|
+
const characters = [...normalized];
|
|
52828
|
+
if (characters.length <= maxLength)
|
|
52829
|
+
return normalized;
|
|
52830
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
52831
|
+
}
|
|
52832
|
+
function sessionImportCandidate(input) {
|
|
52833
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
52834
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
52835
|
+
nativeSessionId: input.nativeSessionId,
|
|
52836
|
+
cwd: input.cwd,
|
|
52837
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
52838
|
+
updatedAt: Math.floor(time3),
|
|
52839
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
52840
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
52841
|
+
});
|
|
52842
|
+
return parsed.success ? parsed.data : null;
|
|
52843
|
+
}
|
|
52844
|
+
var SessionImportScope = class {
|
|
52845
|
+
#abort = new AbortController();
|
|
52846
|
+
#options;
|
|
52847
|
+
#pending = /* @__PURE__ */ new Set();
|
|
52848
|
+
constructor(options) {
|
|
52849
|
+
this.#options = options;
|
|
52850
|
+
}
|
|
52851
|
+
#closed() {
|
|
52852
|
+
return {
|
|
52853
|
+
ok: false,
|
|
52854
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
52855
|
+
};
|
|
52856
|
+
}
|
|
52857
|
+
read(operation) {
|
|
52858
|
+
const signal = this.#abort.signal;
|
|
52859
|
+
if (signal.aborted)
|
|
52860
|
+
return Promise.resolve(this.#closed());
|
|
52861
|
+
let started;
|
|
52862
|
+
try {
|
|
52863
|
+
started = operation(signal);
|
|
52864
|
+
} catch (error51) {
|
|
52865
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
52866
|
+
}
|
|
52867
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
52868
|
+
ok: false,
|
|
52869
|
+
error: {
|
|
52870
|
+
code: "unavailable",
|
|
52871
|
+
message: this.#options.unavailableMessage,
|
|
52872
|
+
retryable: true
|
|
52873
|
+
}
|
|
52874
|
+
}).finally(() => this.#pending.delete(request));
|
|
52875
|
+
this.#pending.add(request);
|
|
52876
|
+
return request;
|
|
52877
|
+
}
|
|
52878
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
52879
|
+
async resolve(operation) {
|
|
52880
|
+
const result = await this.read(operation);
|
|
52881
|
+
if (!result.ok)
|
|
52882
|
+
return result;
|
|
52883
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
52884
|
+
ok: false,
|
|
52885
|
+
error: {
|
|
52886
|
+
code: "sessionNotFound",
|
|
52887
|
+
message: this.#options.notFoundMessage,
|
|
52888
|
+
retryable: false
|
|
52889
|
+
}
|
|
52890
|
+
};
|
|
52891
|
+
}
|
|
52892
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
52893
|
+
async close() {
|
|
52894
|
+
this.#abort.abort();
|
|
52895
|
+
await Promise.allSettled(this.#pending);
|
|
52896
|
+
}
|
|
52897
|
+
};
|
|
52898
|
+
|
|
52899
|
+
// ../qoder/dist/qoder-session-import.js
|
|
52900
|
+
var QoderSessionImport = class {
|
|
52901
|
+
#dependencies;
|
|
52902
|
+
#scope;
|
|
52903
|
+
constructor(dependencies) {
|
|
52904
|
+
this.#dependencies = dependencies;
|
|
52905
|
+
const name = dependencies.displayName;
|
|
52906
|
+
this.#scope = new SessionImportScope({
|
|
52907
|
+
closedMessage: `${name} Session import is closed`,
|
|
52908
|
+
unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
|
|
52909
|
+
notFoundMessage: `${name} Session is no longer importable`
|
|
52910
|
+
});
|
|
52911
|
+
}
|
|
52912
|
+
listCandidates() {
|
|
52913
|
+
return this.#scope.read(async (signal) => {
|
|
52914
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
52915
|
+
for (const info of await this.#dependencies.listSessions()) {
|
|
52916
|
+
signal.throwIfAborted();
|
|
52917
|
+
const candidate = await this.#candidate(info);
|
|
52918
|
+
if (candidate && !candidates.has(candidate.nativeSessionId))
|
|
52919
|
+
candidates.set(candidate.nativeSessionId, candidate);
|
|
52920
|
+
}
|
|
52921
|
+
return [...candidates.values()];
|
|
52922
|
+
});
|
|
52923
|
+
}
|
|
52924
|
+
resolveCandidate(nativeSessionId) {
|
|
52925
|
+
return this.#scope.resolve(async (signal) => {
|
|
52926
|
+
const info = await this.#dependencies.getSessionInfo(nativeSessionId);
|
|
52927
|
+
signal.throwIfAborted();
|
|
52928
|
+
if (info?.sessionId !== nativeSessionId)
|
|
52929
|
+
return null;
|
|
52930
|
+
const candidate = await this.#candidate(info);
|
|
52931
|
+
if (!candidate)
|
|
52932
|
+
return null;
|
|
52933
|
+
return {
|
|
52934
|
+
candidate,
|
|
52935
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
52936
|
+
harnessId: this.#dependencies.harnessId,
|
|
52937
|
+
nativeSessionId,
|
|
52938
|
+
formatVersion: 1
|
|
52939
|
+
})
|
|
52940
|
+
};
|
|
52941
|
+
});
|
|
52942
|
+
}
|
|
52943
|
+
close() {
|
|
52944
|
+
return this.#scope.close();
|
|
52945
|
+
}
|
|
52946
|
+
async #candidate(info) {
|
|
52947
|
+
if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
|
|
52948
|
+
return null;
|
|
52949
|
+
const cwd = path5.resolve(info.cwd);
|
|
52950
|
+
try {
|
|
52951
|
+
if (!(await stat(cwd)).isDirectory())
|
|
52952
|
+
return null;
|
|
52953
|
+
} catch (error51) {
|
|
52954
|
+
if (isStorageAccessError(error51))
|
|
52955
|
+
throw error51;
|
|
52956
|
+
return null;
|
|
52957
|
+
}
|
|
52958
|
+
return sessionImportCandidate({
|
|
52959
|
+
nativeSessionId: info.sessionId,
|
|
52960
|
+
cwd,
|
|
52961
|
+
title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
|
|
52962
|
+
updatedAt: info.lastModified
|
|
52963
|
+
// The SDK exposes no cross-process activity marker: idleness cannot be established.
|
|
52964
|
+
});
|
|
52965
|
+
}
|
|
52966
|
+
};
|
|
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
|
+
|
|
52467
53208
|
// ../qoder/dist/qoder-adapter.js
|
|
52468
53209
|
var QoderAdapter = class {
|
|
52469
53210
|
harnessId;
|
|
52470
53211
|
#variant;
|
|
52471
53212
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52472
53213
|
liveCommandCatalog = true;
|
|
53214
|
+
sessionImport;
|
|
53215
|
+
usageStatistics;
|
|
52473
53216
|
#commandOverride;
|
|
52474
53217
|
#environment;
|
|
52475
53218
|
#platform;
|
|
@@ -52488,11 +53231,18 @@ var QoderAdapter = class {
|
|
|
52488
53231
|
this.harnessId = harnessIdSchema.parse(runtime.harnessId);
|
|
52489
53232
|
this.#commandOverride = options.commandOverride ?? options.environment?.[runtime.commandEnvironmentVariable];
|
|
52490
53233
|
this.#environment = qoderEnvironment(options.environment);
|
|
53234
|
+
this.usageStatistics = createQoderUsageStatistics({ ...process.env, ...options.environment }, this.#variant);
|
|
52491
53235
|
this.#platform = options.platform ?? process.platform;
|
|
52492
53236
|
this.#queryFactory = options.queryFactory ?? ((input) => runtime.sdk.query(input));
|
|
52493
53237
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
52494
53238
|
this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
|
|
52495
53239
|
this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
|
|
53240
|
+
this.sessionImport = new QoderSessionImport({
|
|
53241
|
+
harnessId: this.harnessId,
|
|
53242
|
+
displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
|
|
53243
|
+
listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
|
|
53244
|
+
getSessionInfo: this.#getSessionInfo
|
|
53245
|
+
});
|
|
52496
53246
|
this.#getAvailableModels = options.getAvailableModels;
|
|
52497
53247
|
this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
|
|
52498
53248
|
}
|
|
@@ -52711,7 +53461,7 @@ var QoderAdapter = class {
|
|
|
52711
53461
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52712
53462
|
} catch {
|
|
52713
53463
|
}
|
|
52714
|
-
if (sourceInfo?.cwd &&
|
|
53464
|
+
if (sourceInfo?.cwd && path9.resolve(sourceInfo.cwd) !== path9.resolve(input.cwd)) {
|
|
52715
53465
|
return {
|
|
52716
53466
|
ok: false,
|
|
52717
53467
|
error: {
|
|
@@ -52861,7 +53611,7 @@ var QoderAdapter = class {
|
|
|
52861
53611
|
this.#sessions.clear();
|
|
52862
53612
|
this.#inspections.clear();
|
|
52863
53613
|
this.#inFlightInspections.clear();
|
|
52864
|
-
await Promise.all(sessions.map((s) => s.close()));
|
|
53614
|
+
await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
|
|
52865
53615
|
}
|
|
52866
53616
|
};
|
|
52867
53617
|
|