@liberseek/boft-cli-linux-x64 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 +0 -0
- package/libexec/boft-shim +0 -0
- package/libexec/boft-updater +0 -0
- package/licenses/Cordis-LICENSE.txt +21 -0
- package/licenses/Cosmokit-LICENSE.txt +21 -0
- package/package.json +1 -1
- package/app/plugins/kiro-cli/assets/icon.svg +0 -5
|
@@ -2220,20 +2220,20 @@ var require_resolve = __commonJS({
|
|
|
2220
2220
|
return false;
|
|
2221
2221
|
}
|
|
2222
2222
|
function countKeys(schema) {
|
|
2223
|
-
let
|
|
2223
|
+
let count3 = 0;
|
|
2224
2224
|
for (const key in schema) {
|
|
2225
2225
|
if (key === "$ref")
|
|
2226
2226
|
return Infinity;
|
|
2227
|
-
|
|
2227
|
+
count3++;
|
|
2228
2228
|
if (SIMPLE_INLINED.has(key))
|
|
2229
2229
|
continue;
|
|
2230
2230
|
if (typeof schema[key] == "object") {
|
|
2231
|
-
(0, util_1.eachItem)(schema[key], (sch) =>
|
|
2231
|
+
(0, util_1.eachItem)(schema[key], (sch) => count3 += countKeys(sch));
|
|
2232
2232
|
}
|
|
2233
|
-
if (
|
|
2233
|
+
if (count3 === Infinity)
|
|
2234
2234
|
return Infinity;
|
|
2235
2235
|
}
|
|
2236
|
-
return
|
|
2236
|
+
return count3;
|
|
2237
2237
|
}
|
|
2238
2238
|
function getFullPath(resolver, id = "", normalize) {
|
|
2239
2239
|
if (normalize !== false)
|
|
@@ -3155,7 +3155,7 @@ var require_utils = __commonJS({
|
|
|
3155
3155
|
return true;
|
|
3156
3156
|
}
|
|
3157
3157
|
function getIPV6(input) {
|
|
3158
|
-
let
|
|
3158
|
+
let tokenCount2 = 0;
|
|
3159
3159
|
const output = { error: false, address: "", zone: "" };
|
|
3160
3160
|
const address = [];
|
|
3161
3161
|
const buffer = [];
|
|
@@ -3174,7 +3174,7 @@ var require_utils = __commonJS({
|
|
|
3174
3174
|
if (!consume(buffer, address, output)) {
|
|
3175
3175
|
break;
|
|
3176
3176
|
}
|
|
3177
|
-
if (++
|
|
3177
|
+
if (++tokenCount2 > 7) {
|
|
3178
3178
|
output.error = true;
|
|
3179
3179
|
break;
|
|
3180
3180
|
}
|
|
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
|
|
|
3229
3229
|
}
|
|
3230
3230
|
return ind;
|
|
3231
3231
|
}
|
|
3232
|
-
function removeDotSegments(
|
|
3233
|
-
let input =
|
|
3232
|
+
function removeDotSegments(path10) {
|
|
3233
|
+
let input = path10;
|
|
3234
3234
|
const output = [];
|
|
3235
3235
|
let nextSlash = -1;
|
|
3236
3236
|
let len = 0;
|
|
@@ -3482,8 +3482,8 @@ var require_schemes = __commonJS({
|
|
|
3482
3482
|
wsComponent.secure = void 0;
|
|
3483
3483
|
}
|
|
3484
3484
|
if (wsComponent.resourceName) {
|
|
3485
|
-
const [
|
|
3486
|
-
wsComponent.path =
|
|
3485
|
+
const [path10, query] = wsComponent.resourceName.split("?");
|
|
3486
|
+
wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
|
|
3487
3487
|
wsComponent.query = query;
|
|
3488
3488
|
wsComponent.resourceName = void 0;
|
|
3489
3489
|
}
|
|
@@ -5411,8 +5411,8 @@ var require_contains = __commonJS({
|
|
|
5411
5411
|
cxt.result(valid, () => cxt.reset());
|
|
5412
5412
|
function validateItemsWithCount() {
|
|
5413
5413
|
const schValid = gen.name("_valid");
|
|
5414
|
-
const
|
|
5415
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
5414
|
+
const count3 = gen.let("count", 0);
|
|
5415
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
|
|
5416
5416
|
}
|
|
5417
5417
|
function validateItems(_valid, block) {
|
|
5418
5418
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -5425,16 +5425,16 @@ var require_contains = __commonJS({
|
|
|
5425
5425
|
block();
|
|
5426
5426
|
});
|
|
5427
5427
|
}
|
|
5428
|
-
function checkLimits(
|
|
5429
|
-
gen.code((0, codegen_1._)`${
|
|
5428
|
+
function checkLimits(count3) {
|
|
5429
|
+
gen.code((0, codegen_1._)`${count3}++`);
|
|
5430
5430
|
if (max === void 0) {
|
|
5431
|
-
gen.if((0, codegen_1._)`${
|
|
5431
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true).break());
|
|
5432
5432
|
} else {
|
|
5433
|
-
gen.if((0, codegen_1._)`${
|
|
5433
|
+
gen.if((0, codegen_1._)`${count3} > ${max}`, () => gen.assign(valid, false).break());
|
|
5434
5434
|
if (min === 1)
|
|
5435
5435
|
gen.assign(valid, true);
|
|
5436
5436
|
else
|
|
5437
|
-
gen.if((0, codegen_1._)`${
|
|
5437
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true));
|
|
5438
5438
|
}
|
|
5439
5439
|
}
|
|
5440
5440
|
}
|
|
@@ -8933,20 +8933,20 @@ var require_resolve2 = __commonJS({
|
|
|
8933
8933
|
return false;
|
|
8934
8934
|
}
|
|
8935
8935
|
function countKeys(schema) {
|
|
8936
|
-
let
|
|
8936
|
+
let count3 = 0;
|
|
8937
8937
|
for (const key in schema) {
|
|
8938
8938
|
if (key === "$ref")
|
|
8939
8939
|
return Infinity;
|
|
8940
|
-
|
|
8940
|
+
count3++;
|
|
8941
8941
|
if (SIMPLE_INLINED.has(key))
|
|
8942
8942
|
continue;
|
|
8943
8943
|
if (typeof schema[key] == "object") {
|
|
8944
|
-
(0, util_1.eachItem)(schema[key], (sch) =>
|
|
8944
|
+
(0, util_1.eachItem)(schema[key], (sch) => count3 += countKeys(sch));
|
|
8945
8945
|
}
|
|
8946
|
-
if (
|
|
8946
|
+
if (count3 === Infinity)
|
|
8947
8947
|
return Infinity;
|
|
8948
8948
|
}
|
|
8949
|
-
return
|
|
8949
|
+
return count3;
|
|
8950
8950
|
}
|
|
8951
8951
|
function getFullPath(resolver, id = "", normalize) {
|
|
8952
8952
|
if (normalize !== false)
|
|
@@ -11309,8 +11309,8 @@ var require_contains2 = __commonJS({
|
|
|
11309
11309
|
cxt.result(valid, () => cxt.reset());
|
|
11310
11310
|
function validateItemsWithCount() {
|
|
11311
11311
|
const schValid = gen.name("_valid");
|
|
11312
|
-
const
|
|
11313
|
-
validateItems(schValid, () => gen.if(schValid, () => checkLimits(
|
|
11312
|
+
const count3 = gen.let("count", 0);
|
|
11313
|
+
validateItems(schValid, () => gen.if(schValid, () => checkLimits(count3)));
|
|
11314
11314
|
}
|
|
11315
11315
|
function validateItems(_valid, block) {
|
|
11316
11316
|
gen.forRange("i", 0, len, (i) => {
|
|
@@ -11323,16 +11323,16 @@ var require_contains2 = __commonJS({
|
|
|
11323
11323
|
block();
|
|
11324
11324
|
});
|
|
11325
11325
|
}
|
|
11326
|
-
function checkLimits(
|
|
11327
|
-
gen.code((0, codegen_1._)`${
|
|
11326
|
+
function checkLimits(count3) {
|
|
11327
|
+
gen.code((0, codegen_1._)`${count3}++`);
|
|
11328
11328
|
if (max === void 0) {
|
|
11329
|
-
gen.if((0, codegen_1._)`${
|
|
11329
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true).break());
|
|
11330
11330
|
} else {
|
|
11331
|
-
gen.if((0, codegen_1._)`${
|
|
11331
|
+
gen.if((0, codegen_1._)`${count3} > ${max}`, () => gen.assign(valid, false).break());
|
|
11332
11332
|
if (min === 1)
|
|
11333
11333
|
gen.assign(valid, true);
|
|
11334
11334
|
else
|
|
11335
|
-
gen.if((0, codegen_1._)`${
|
|
11335
|
+
gen.if((0, codegen_1._)`${count3} >= ${min}`, () => gen.assign(valid, true));
|
|
11336
11336
|
}
|
|
11337
11337
|
}
|
|
11338
11338
|
}
|
|
@@ -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"
|
|
@@ -27591,6 +27747,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
27591
27747
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27592
27748
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27593
27749
|
|
|
27750
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
27751
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
27752
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
27753
|
+
|
|
27594
27754
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
27595
27755
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27596
27756
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -27598,13 +27758,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
|
|
|
27598
27758
|
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);
|
|
27599
27759
|
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");
|
|
27600
27760
|
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
27761
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
27762
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
27763
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
27764
|
+
before: localizedTextSchema.optional(),
|
|
27765
|
+
after: localizedTextSchema.optional(),
|
|
27766
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
27767
|
+
}).strict();
|
|
27601
27768
|
var pluginPresentationShape = {
|
|
27602
27769
|
id: harnessPluginIdSchema,
|
|
27603
27770
|
name: external_exports.string().trim().min(1).max(128),
|
|
27604
27771
|
version: external_exports.string().min(1).max(128),
|
|
27772
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
27773
|
+
kind: external_exports.literal("usage").optional(),
|
|
27774
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
27775
|
+
iconStyle: external_exports.object({
|
|
27776
|
+
vector: external_exports.object({
|
|
27777
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
27778
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
27779
|
+
paths: external_exports.array(external_exports.object({
|
|
27780
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
27781
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
27782
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
27783
|
+
}).strict()).min(1).max(32)
|
|
27784
|
+
}).strict().optional(),
|
|
27785
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
27786
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
27787
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
27788
|
+
}).strict().optional(),
|
|
27789
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
27790
|
+
notice: localizedTextSchema.optional(),
|
|
27605
27791
|
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
27606
27792
|
launchCommand: external_exports.literal(true).optional(),
|
|
27607
27793
|
links: external_exports.object({
|
|
27794
|
+
website: documentationUrlSchema.optional(),
|
|
27608
27795
|
documentation: documentationUrlSchema.optional(),
|
|
27609
27796
|
installation: documentationUrlSchema.optional()
|
|
27610
27797
|
}).strict().optional()
|
|
@@ -27658,6 +27845,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
27658
27845
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27659
27846
|
});
|
|
27660
27847
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27848
|
+
"codexhost/console/remote-connections",
|
|
27849
|
+
"codexhost/runtime/status",
|
|
27850
|
+
"codexhost/remote/ssh-setup",
|
|
27661
27851
|
"codexhost/harness/plugins/list",
|
|
27662
27852
|
"codexhost/harness/display-settings/get",
|
|
27663
27853
|
"codexhost/harness/display-settings/set",
|
|
@@ -27678,6 +27868,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
27678
27868
|
"codexhost/account/list",
|
|
27679
27869
|
"codexhost/account/refresh",
|
|
27680
27870
|
"codexhost/account/usage/inspect",
|
|
27871
|
+
"codexhost/usage/model-prices/get",
|
|
27872
|
+
"codexhost/usage/model-prices/set",
|
|
27873
|
+
"codexhost/usage/model-prices/default",
|
|
27874
|
+
"codexhost/usage/statistics/get",
|
|
27681
27875
|
"codexhost/update/check",
|
|
27682
27876
|
"codexhost/update/start",
|
|
27683
27877
|
"codexhost/update/status"
|
|
@@ -27742,6 +27936,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27742
27936
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27743
27937
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27744
27938
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27939
|
+
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
27745
27940
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27746
27941
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
27747
27942
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
@@ -27753,7 +27948,11 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27753
27948
|
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27754
27949
|
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27755
27950
|
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
27756
|
-
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
|
|
27951
|
+
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
27952
|
+
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
27953
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
27954
|
+
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
27955
|
+
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
27757
27956
|
}).strict().superRefine((usage, context) => {
|
|
27758
27957
|
if (Object.keys(usage).length === 0) {
|
|
27759
27958
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -27774,6 +27973,20 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
27774
27973
|
path: ["contextWindowTokens"]
|
|
27775
27974
|
});
|
|
27776
27975
|
}
|
|
27976
|
+
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
27977
|
+
context.addIssue({
|
|
27978
|
+
code: "custom",
|
|
27979
|
+
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
27980
|
+
path: ["costSource"]
|
|
27981
|
+
});
|
|
27982
|
+
}
|
|
27983
|
+
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
27984
|
+
context.addIssue({
|
|
27985
|
+
code: "custom",
|
|
27986
|
+
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
27987
|
+
path: ["unpricedModels"]
|
|
27988
|
+
});
|
|
27989
|
+
}
|
|
27777
27990
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
27778
27991
|
context.addIssue({
|
|
27779
27992
|
code: "custom",
|
|
@@ -28043,27 +28256,27 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
28043
28256
|
}).strict().superRefine((catalog, context) => {
|
|
28044
28257
|
const refs = /* @__PURE__ */ new Set();
|
|
28045
28258
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
28046
|
-
for (const [index,
|
|
28047
|
-
if (refs.has(
|
|
28259
|
+
for (const [index, model2] of catalog.models.entries()) {
|
|
28260
|
+
if (refs.has(model2.ref.id)) {
|
|
28048
28261
|
context.addIssue({
|
|
28049
28262
|
code: "custom",
|
|
28050
28263
|
message: "Model Catalog refs must be unique",
|
|
28051
28264
|
path: ["models", index, "ref", "id"]
|
|
28052
28265
|
});
|
|
28053
28266
|
}
|
|
28054
|
-
refs.add(
|
|
28055
|
-
if (
|
|
28056
|
-
if (refs.has(
|
|
28267
|
+
refs.add(model2.ref.id);
|
|
28268
|
+
if (model2.fastModel) {
|
|
28269
|
+
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
28057
28270
|
context.addIssue({
|
|
28058
28271
|
code: "custom",
|
|
28059
28272
|
message: "Fast Model refs must be distinct and unique",
|
|
28060
28273
|
path: ["models", index, "fastModel"]
|
|
28061
28274
|
});
|
|
28062
28275
|
}
|
|
28063
|
-
refs.add(
|
|
28276
|
+
refs.add(model2.fastModel.id);
|
|
28064
28277
|
}
|
|
28065
28278
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
28066
|
-
for (const [optionIndex, optionId] of (
|
|
28279
|
+
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
28067
28280
|
if (supportedThinkingIds.has(optionId)) {
|
|
28068
28281
|
context.addIssue({
|
|
28069
28282
|
code: "custom",
|
|
@@ -28603,6 +28816,85 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28603
28816
|
status: updateStatusSchema.nullable()
|
|
28604
28817
|
});
|
|
28605
28818
|
|
|
28819
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
28820
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
28821
|
+
"idle",
|
|
28822
|
+
"installing",
|
|
28823
|
+
"restarting",
|
|
28824
|
+
"succeeded",
|
|
28825
|
+
"failed"
|
|
28826
|
+
]);
|
|
28827
|
+
var runtimeStatusSchema = external_exports.object({
|
|
28828
|
+
runningVersion: external_exports.string().nullable(),
|
|
28829
|
+
installedVersion: external_exports.string().nullable(),
|
|
28830
|
+
restartRequired: external_exports.boolean(),
|
|
28831
|
+
remote: external_exports.boolean(),
|
|
28832
|
+
updateSupported: external_exports.boolean(),
|
|
28833
|
+
update: external_exports.object({
|
|
28834
|
+
phase: remoteUpdatePhaseSchema,
|
|
28835
|
+
targetVersion: external_exports.string().nullable(),
|
|
28836
|
+
error: external_exports.string().nullable()
|
|
28837
|
+
})
|
|
28838
|
+
});
|
|
28839
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
28840
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
28841
|
+
}).strict();
|
|
28842
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
28843
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28844
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28845
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28846
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
28847
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
28848
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28849
|
+
}).strict();
|
|
28850
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28851
|
+
|
|
28852
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
28853
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
28854
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
28855
|
+
hostId,
|
|
28856
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28857
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
28858
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
28859
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
28860
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28861
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28862
|
+
autoConnect: external_exports.boolean(),
|
|
28863
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
28864
|
+
});
|
|
28865
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
28866
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28867
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
28868
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28869
|
+
identity: external_exports.string().max(4096).nullable()
|
|
28870
|
+
});
|
|
28871
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28872
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28873
|
+
external_exports.strictObject({
|
|
28874
|
+
action: external_exports.literal("read-thread"),
|
|
28875
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28876
|
+
input: delegationReadParamsSchema
|
|
28877
|
+
}),
|
|
28878
|
+
external_exports.strictObject({
|
|
28879
|
+
action: external_exports.literal("save"),
|
|
28880
|
+
draft: codexSshDraftSchema,
|
|
28881
|
+
previous: codexSshConnectionSchema.nullable()
|
|
28882
|
+
}),
|
|
28883
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
28884
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
28885
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
28886
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
28887
|
+
external_exports.strictObject({
|
|
28888
|
+
action: external_exports.literal("update"),
|
|
28889
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28890
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
28891
|
+
})
|
|
28892
|
+
]);
|
|
28893
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
28894
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
28895
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
28896
|
+
]);
|
|
28897
|
+
|
|
28606
28898
|
// ../../shared-contracts/dist/index.js
|
|
28607
28899
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28608
28900
|
|
|
@@ -28982,7 +29274,6 @@ var tokenFields = [
|
|
|
28982
29274
|
"cachedInputTokens",
|
|
28983
29275
|
"cacheWriteInputTokens",
|
|
28984
29276
|
"outputTokens",
|
|
28985
|
-
"outputTokensPerSecond",
|
|
28986
29277
|
"reasoningOutputTokens",
|
|
28987
29278
|
"totalTokens",
|
|
28988
29279
|
"contextWindowTokens",
|
|
@@ -28990,10 +29281,12 @@ var tokenFields = [
|
|
|
28990
29281
|
];
|
|
28991
29282
|
var safeIntegerFields = [
|
|
28992
29283
|
"planFiveHourResetsAtUnix",
|
|
28993
|
-
"planSevenDayResetsAtUnix"
|
|
29284
|
+
"planSevenDayResetsAtUnix",
|
|
29285
|
+
"timeToFirstOutputMs"
|
|
28994
29286
|
];
|
|
28995
29287
|
var percentFields = [
|
|
28996
29288
|
"cacheHitRatePercent",
|
|
29289
|
+
"sessionCacheHitRatePercent",
|
|
28997
29290
|
"planFiveHourUsedPercent",
|
|
28998
29291
|
"planSevenDayUsedPercent"
|
|
28999
29292
|
];
|
|
@@ -29001,9 +29294,14 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
29001
29294
|
...tokenFields,
|
|
29002
29295
|
...safeIntegerFields,
|
|
29003
29296
|
...percentFields,
|
|
29297
|
+
"sessionCacheUsage",
|
|
29004
29298
|
"totalCostUsd",
|
|
29005
29299
|
"totalCredits",
|
|
29006
|
-
"contextUsagePercent"
|
|
29300
|
+
"contextUsagePercent",
|
|
29301
|
+
"outputTokensPerSecond",
|
|
29302
|
+
"apiOutputTokensPerSecond",
|
|
29303
|
+
"costSource",
|
|
29304
|
+
"unpricedModels"
|
|
29007
29305
|
]);
|
|
29008
29306
|
function isRecord(value) {
|
|
29009
29307
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29019,7 +29317,11 @@ function parseHostUsage(value) {
|
|
|
29019
29317
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
29020
29318
|
}
|
|
29021
29319
|
}
|
|
29022
|
-
for (const field of [
|
|
29320
|
+
for (const field of [
|
|
29321
|
+
"totalCredits",
|
|
29322
|
+
"contextUsagePercent",
|
|
29323
|
+
"apiOutputTokensPerSecond"
|
|
29324
|
+
]) {
|
|
29023
29325
|
const candidate = value[field];
|
|
29024
29326
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
29025
29327
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
@@ -29055,6 +29357,12 @@ function parseHostUsage(value) {
|
|
|
29055
29357
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
29056
29358
|
}
|
|
29057
29359
|
}
|
|
29360
|
+
if (value.sessionCacheUsage !== void 0) {
|
|
29361
|
+
const totals2 = value.sessionCacheUsage;
|
|
29362
|
+
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) {
|
|
29363
|
+
throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
|
|
29364
|
+
}
|
|
29365
|
+
}
|
|
29058
29366
|
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
29059
29367
|
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
29060
29368
|
if (hasContextUsed !== hasContextWindow) {
|
|
@@ -29069,8 +29377,43 @@ function parseHostUsage(value) {
|
|
|
29069
29377
|
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
29070
29378
|
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
29071
29379
|
}
|
|
29380
|
+
if (value.costSource !== void 0) {
|
|
29381
|
+
if (value.costSource !== "publicPrice" && value.costSource !== "native") {
|
|
29382
|
+
throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
|
|
29383
|
+
}
|
|
29384
|
+
if (value.totalCostUsd === void 0) {
|
|
29385
|
+
throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
|
|
29386
|
+
}
|
|
29387
|
+
}
|
|
29388
|
+
if (value.unpricedModels !== void 0) {
|
|
29389
|
+
const models = value.unpricedModels;
|
|
29390
|
+
if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
|
|
29391
|
+
throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
|
|
29392
|
+
}
|
|
29393
|
+
if (value.costSource !== "publicPrice") {
|
|
29394
|
+
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
29395
|
+
}
|
|
29396
|
+
return { ...value, unpricedModels: [...models] };
|
|
29397
|
+
}
|
|
29072
29398
|
return { ...value };
|
|
29073
29399
|
}
|
|
29400
|
+
var requestTokenFields = [
|
|
29401
|
+
"inputTokens",
|
|
29402
|
+
"cachedInputTokens",
|
|
29403
|
+
"cacheWriteInputTokens",
|
|
29404
|
+
"cacheWrite1hInputTokens",
|
|
29405
|
+
"outputTokens",
|
|
29406
|
+
"reasoningOutputTokens",
|
|
29407
|
+
"startedAtMs",
|
|
29408
|
+
"completedAtMs"
|
|
29409
|
+
];
|
|
29410
|
+
var requestFields = /* @__PURE__ */ new Set([
|
|
29411
|
+
...requestTokenFields,
|
|
29412
|
+
"requestId",
|
|
29413
|
+
"historical",
|
|
29414
|
+
"model",
|
|
29415
|
+
"provider"
|
|
29416
|
+
]);
|
|
29074
29417
|
|
|
29075
29418
|
// ../../harness-adapter/dist/live-command-catalog.js
|
|
29076
29419
|
var COMMON_EXCLUDED_LIVE_COMMANDS = /* @__PURE__ */ new Set([
|
|
@@ -29725,10 +30068,10 @@ function parseQoderModelCatalog(rawModels) {
|
|
|
29725
30068
|
...defaultThinkingOptionId ? { defaultThinkingOptionId } : {}
|
|
29726
30069
|
});
|
|
29727
30070
|
}
|
|
29728
|
-
function qoderAvailableThinkingOptions(catalog,
|
|
29729
|
-
if (!catalog || !
|
|
30071
|
+
function qoderAvailableThinkingOptions(catalog, model2) {
|
|
30072
|
+
if (!catalog || !model2)
|
|
29730
30073
|
return void 0;
|
|
29731
|
-
const supported = catalog.models.find(({ ref }) => ref.id ===
|
|
30074
|
+
const supported = catalog.models.find(({ ref }) => ref.id === model2.id)?.supportedThinkingOptionIds;
|
|
29732
30075
|
if (!supported || supported.length === 0)
|
|
29733
30076
|
return void 0;
|
|
29734
30077
|
const options = supported.flatMap((id) => {
|
|
@@ -30240,8 +30583,8 @@ function getErrorMap2() {
|
|
|
30240
30583
|
|
|
30241
30584
|
// ../../../node_modules/zod/v3/helpers/parseUtil.js
|
|
30242
30585
|
var makeIssue = (params) => {
|
|
30243
|
-
const { data, path:
|
|
30244
|
-
const fullPath = [...
|
|
30586
|
+
const { data, path: path10, errorMaps, issueData } = params;
|
|
30587
|
+
const fullPath = [...path10, ...issueData.path || []];
|
|
30245
30588
|
const fullIssue = {
|
|
30246
30589
|
...issueData,
|
|
30247
30590
|
path: fullPath
|
|
@@ -30356,11 +30699,11 @@ var errorUtil;
|
|
|
30356
30699
|
|
|
30357
30700
|
// ../../../node_modules/zod/v3/types.js
|
|
30358
30701
|
var ParseInputLazyPath = class {
|
|
30359
|
-
constructor(parent, value,
|
|
30702
|
+
constructor(parent, value, path10, key) {
|
|
30360
30703
|
this._cachedPath = [];
|
|
30361
30704
|
this.parent = parent;
|
|
30362
30705
|
this.data = value;
|
|
30363
|
-
this._path =
|
|
30706
|
+
this._path = path10;
|
|
30364
30707
|
this._key = key;
|
|
30365
30708
|
}
|
|
30366
30709
|
get path() {
|
|
@@ -33887,11 +34230,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33887
34230
|
}
|
|
33888
34231
|
return void 0;
|
|
33889
34232
|
}
|
|
33890
|
-
function getDotPath(
|
|
33891
|
-
if (
|
|
34233
|
+
function getDotPath(path10) {
|
|
34234
|
+
if (path10.length === 0) {
|
|
33892
34235
|
return "object root";
|
|
33893
34236
|
}
|
|
33894
|
-
return
|
|
34237
|
+
return path10.reduce((acc, seg, index) => {
|
|
33895
34238
|
if (index === 0) {
|
|
33896
34239
|
return String(seg);
|
|
33897
34240
|
}
|
|
@@ -52462,12 +52805,412 @@ var QoderSession = class {
|
|
|
52462
52805
|
}
|
|
52463
52806
|
};
|
|
52464
52807
|
|
|
52808
|
+
// dist/qoder-session-import.js
|
|
52809
|
+
import { stat } from "node:fs/promises";
|
|
52810
|
+
import path5 from "node:path";
|
|
52811
|
+
|
|
52812
|
+
// ../../harness-adapter/dist/session-import.js
|
|
52813
|
+
var STORAGE_ACCESS_ERRORS = /* @__PURE__ */ new Set(["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"]);
|
|
52814
|
+
function isStorageAccessError(error51) {
|
|
52815
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" && STORAGE_ACCESS_ERRORS.has(error51.code);
|
|
52816
|
+
}
|
|
52817
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
52818
|
+
if (typeof value !== "string")
|
|
52819
|
+
return null;
|
|
52820
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
52821
|
+
if (!normalized)
|
|
52822
|
+
return null;
|
|
52823
|
+
if (normalized.length <= maxLength)
|
|
52824
|
+
return normalized;
|
|
52825
|
+
const characters = [...normalized];
|
|
52826
|
+
if (characters.length <= maxLength)
|
|
52827
|
+
return normalized;
|
|
52828
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
52829
|
+
}
|
|
52830
|
+
function sessionImportCandidate(input) {
|
|
52831
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
52832
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
52833
|
+
nativeSessionId: input.nativeSessionId,
|
|
52834
|
+
cwd: input.cwd,
|
|
52835
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
52836
|
+
updatedAt: Math.floor(time3),
|
|
52837
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
52838
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
52839
|
+
});
|
|
52840
|
+
return parsed.success ? parsed.data : null;
|
|
52841
|
+
}
|
|
52842
|
+
var SessionImportScope = class {
|
|
52843
|
+
#abort = new AbortController();
|
|
52844
|
+
#options;
|
|
52845
|
+
#pending = /* @__PURE__ */ new Set();
|
|
52846
|
+
constructor(options) {
|
|
52847
|
+
this.#options = options;
|
|
52848
|
+
}
|
|
52849
|
+
#closed() {
|
|
52850
|
+
return {
|
|
52851
|
+
ok: false,
|
|
52852
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
52853
|
+
};
|
|
52854
|
+
}
|
|
52855
|
+
read(operation) {
|
|
52856
|
+
const signal = this.#abort.signal;
|
|
52857
|
+
if (signal.aborted)
|
|
52858
|
+
return Promise.resolve(this.#closed());
|
|
52859
|
+
let started;
|
|
52860
|
+
try {
|
|
52861
|
+
started = operation(signal);
|
|
52862
|
+
} catch (error51) {
|
|
52863
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
52864
|
+
}
|
|
52865
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
52866
|
+
ok: false,
|
|
52867
|
+
error: {
|
|
52868
|
+
code: "unavailable",
|
|
52869
|
+
message: this.#options.unavailableMessage,
|
|
52870
|
+
retryable: true
|
|
52871
|
+
}
|
|
52872
|
+
}).finally(() => this.#pending.delete(request));
|
|
52873
|
+
this.#pending.add(request);
|
|
52874
|
+
return request;
|
|
52875
|
+
}
|
|
52876
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
52877
|
+
async resolve(operation) {
|
|
52878
|
+
const result = await this.read(operation);
|
|
52879
|
+
if (!result.ok)
|
|
52880
|
+
return result;
|
|
52881
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
52882
|
+
ok: false,
|
|
52883
|
+
error: {
|
|
52884
|
+
code: "sessionNotFound",
|
|
52885
|
+
message: this.#options.notFoundMessage,
|
|
52886
|
+
retryable: false
|
|
52887
|
+
}
|
|
52888
|
+
};
|
|
52889
|
+
}
|
|
52890
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
52891
|
+
async close() {
|
|
52892
|
+
this.#abort.abort();
|
|
52893
|
+
await Promise.allSettled(this.#pending);
|
|
52894
|
+
}
|
|
52895
|
+
};
|
|
52896
|
+
|
|
52897
|
+
// dist/qoder-session-import.js
|
|
52898
|
+
var QoderSessionImport = class {
|
|
52899
|
+
#dependencies;
|
|
52900
|
+
#scope;
|
|
52901
|
+
constructor(dependencies) {
|
|
52902
|
+
this.#dependencies = dependencies;
|
|
52903
|
+
const name = dependencies.displayName;
|
|
52904
|
+
this.#scope = new SessionImportScope({
|
|
52905
|
+
closedMessage: `${name} Session import is closed`,
|
|
52906
|
+
unavailableMessage: `${name} sessions could not be read; check storage access and retry`,
|
|
52907
|
+
notFoundMessage: `${name} Session is no longer importable`
|
|
52908
|
+
});
|
|
52909
|
+
}
|
|
52910
|
+
listCandidates() {
|
|
52911
|
+
return this.#scope.read(async (signal) => {
|
|
52912
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
52913
|
+
for (const info of await this.#dependencies.listSessions()) {
|
|
52914
|
+
signal.throwIfAborted();
|
|
52915
|
+
const candidate = await this.#candidate(info);
|
|
52916
|
+
if (candidate && !candidates.has(candidate.nativeSessionId))
|
|
52917
|
+
candidates.set(candidate.nativeSessionId, candidate);
|
|
52918
|
+
}
|
|
52919
|
+
return [...candidates.values()];
|
|
52920
|
+
});
|
|
52921
|
+
}
|
|
52922
|
+
resolveCandidate(nativeSessionId) {
|
|
52923
|
+
return this.#scope.resolve(async (signal) => {
|
|
52924
|
+
const info = await this.#dependencies.getSessionInfo(nativeSessionId);
|
|
52925
|
+
signal.throwIfAborted();
|
|
52926
|
+
if (info?.sessionId !== nativeSessionId)
|
|
52927
|
+
return null;
|
|
52928
|
+
const candidate = await this.#candidate(info);
|
|
52929
|
+
if (!candidate)
|
|
52930
|
+
return null;
|
|
52931
|
+
return {
|
|
52932
|
+
candidate,
|
|
52933
|
+
nativeRef: nativeSessionRefSchema.parse({
|
|
52934
|
+
harnessId: this.#dependencies.harnessId,
|
|
52935
|
+
nativeSessionId,
|
|
52936
|
+
formatVersion: 1
|
|
52937
|
+
})
|
|
52938
|
+
};
|
|
52939
|
+
});
|
|
52940
|
+
}
|
|
52941
|
+
close() {
|
|
52942
|
+
return this.#scope.close();
|
|
52943
|
+
}
|
|
52944
|
+
async #candidate(info) {
|
|
52945
|
+
if (typeof info.cwd !== "string" || !path5.isAbsolute(info.cwd))
|
|
52946
|
+
return null;
|
|
52947
|
+
const cwd = path5.resolve(info.cwd);
|
|
52948
|
+
try {
|
|
52949
|
+
if (!(await stat(cwd)).isDirectory())
|
|
52950
|
+
return null;
|
|
52951
|
+
} catch (error51) {
|
|
52952
|
+
if (isStorageAccessError(error51))
|
|
52953
|
+
throw error51;
|
|
52954
|
+
return null;
|
|
52955
|
+
}
|
|
52956
|
+
return sessionImportCandidate({
|
|
52957
|
+
nativeSessionId: info.sessionId,
|
|
52958
|
+
cwd,
|
|
52959
|
+
title: sessionImportTitle(info.customTitle) ?? sessionImportTitle(info.summary) ?? sessionImportTitle(info.firstPrompt),
|
|
52960
|
+
updatedAt: info.lastModified
|
|
52961
|
+
// The SDK exposes no cross-process activity marker: idleness cannot be established.
|
|
52962
|
+
});
|
|
52963
|
+
}
|
|
52964
|
+
};
|
|
52965
|
+
|
|
52966
|
+
// dist/qoder-usage-statistics.js
|
|
52967
|
+
import os4 from "node:os";
|
|
52968
|
+
import path8 from "node:path";
|
|
52969
|
+
|
|
52970
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
52971
|
+
import { createReadStream } from "node:fs";
|
|
52972
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
52973
|
+
import path6 from "node:path";
|
|
52974
|
+
import { createInterface } from "node:readline";
|
|
52975
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
52976
|
+
var MAX_CWD_LENGTH = 4096;
|
|
52977
|
+
function sessionIdOk(value) {
|
|
52978
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
52979
|
+
}
|
|
52980
|
+
function cwdOk(value) {
|
|
52981
|
+
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("\\\\"));
|
|
52982
|
+
}
|
|
52983
|
+
function withUsageSession(entry, session) {
|
|
52984
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
52985
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
52986
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
52987
|
+
return entry;
|
|
52988
|
+
return {
|
|
52989
|
+
...entry,
|
|
52990
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
52991
|
+
...cwd !== void 0 ? { cwd } : {}
|
|
52992
|
+
};
|
|
52993
|
+
}
|
|
52994
|
+
function tokenCount(value) {
|
|
52995
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
52996
|
+
}
|
|
52997
|
+
function parseHarnessUsageEntry(value) {
|
|
52998
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
52999
|
+
return null;
|
|
53000
|
+
const entry = value;
|
|
53001
|
+
if (typeof entry.id !== "string" || entry.id.length === 0 || entry.id.length > 512)
|
|
53002
|
+
return null;
|
|
53003
|
+
if (!tokenCount(entry.occurredAtMs) || entry.occurredAtMs === 0)
|
|
53004
|
+
return null;
|
|
53005
|
+
if (entry.model !== void 0 && (typeof entry.model !== "string" || entry.model.length === 0)) {
|
|
53006
|
+
return null;
|
|
53007
|
+
}
|
|
53008
|
+
if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
|
|
53009
|
+
return null;
|
|
53010
|
+
for (const field of [
|
|
53011
|
+
"cachedInputTokens",
|
|
53012
|
+
"cacheWriteInputTokens",
|
|
53013
|
+
"cacheWrite1hInputTokens",
|
|
53014
|
+
"reasoningOutputTokens"
|
|
53015
|
+
]) {
|
|
53016
|
+
if (entry[field] !== void 0 && !tokenCount(entry[field]))
|
|
53017
|
+
return null;
|
|
53018
|
+
}
|
|
53019
|
+
const cached2 = entry.cachedInputTokens ?? 0;
|
|
53020
|
+
const written = entry.cacheWriteInputTokens ?? 0;
|
|
53021
|
+
if (cached2 + written > entry.inputTokens)
|
|
53022
|
+
return null;
|
|
53023
|
+
if ((entry.cacheWrite1hInputTokens ?? 0) > written)
|
|
53024
|
+
return null;
|
|
53025
|
+
if ((entry.reasoningOutputTokens ?? 0) > entry.outputTokens)
|
|
53026
|
+
return null;
|
|
53027
|
+
if (entry.sessionId !== void 0 && !sessionIdOk(entry.sessionId))
|
|
53028
|
+
return null;
|
|
53029
|
+
if (entry.cwd !== void 0 && !cwdOk(entry.cwd))
|
|
53030
|
+
return null;
|
|
53031
|
+
if (entry.tokensUnknown !== void 0 && entry.tokensUnknown !== true)
|
|
53032
|
+
return null;
|
|
53033
|
+
if (entry.costUsd !== void 0 && (typeof entry.costUsd !== "number" || !Number.isFinite(entry.costUsd) || entry.costUsd < 0)) {
|
|
53034
|
+
return null;
|
|
53035
|
+
}
|
|
53036
|
+
if (entry.credits !== void 0 && (typeof entry.credits !== "number" || !Number.isFinite(entry.credits) || entry.credits < 0)) {
|
|
53037
|
+
return null;
|
|
53038
|
+
}
|
|
53039
|
+
return entry;
|
|
53040
|
+
}
|
|
53041
|
+
async function jsonlUsageSources(root, maxDepth, signal) {
|
|
53042
|
+
const sources = [];
|
|
53043
|
+
const visit = async (directory, depth) => {
|
|
53044
|
+
signal.throwIfAborted();
|
|
53045
|
+
const entries = await opendir(directory).catch((error51) => {
|
|
53046
|
+
if (error51.code === "ENOENT")
|
|
53047
|
+
return null;
|
|
53048
|
+
throw error51;
|
|
53049
|
+
});
|
|
53050
|
+
if (!entries)
|
|
53051
|
+
return;
|
|
53052
|
+
for await (const entry of entries) {
|
|
53053
|
+
signal.throwIfAborted();
|
|
53054
|
+
const file2 = path6.join(directory, entry.name);
|
|
53055
|
+
if (entry.isDirectory()) {
|
|
53056
|
+
if (depth < maxDepth)
|
|
53057
|
+
await visit(file2, depth + 1);
|
|
53058
|
+
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
53059
|
+
const info = await lstat(file2).catch(() => null);
|
|
53060
|
+
if (info?.isFile() && info.size > 0) {
|
|
53061
|
+
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
53062
|
+
}
|
|
53063
|
+
}
|
|
53064
|
+
}
|
|
53065
|
+
};
|
|
53066
|
+
await visit(root, 0);
|
|
53067
|
+
return sources;
|
|
53068
|
+
}
|
|
53069
|
+
async function* jsonlRecords(file2, marker, signal) {
|
|
53070
|
+
const lines = createInterface({
|
|
53071
|
+
input: createReadStream(file2, { encoding: "utf8", signal }),
|
|
53072
|
+
crlfDelay: Infinity
|
|
53073
|
+
});
|
|
53074
|
+
for await (const line of lines) {
|
|
53075
|
+
if (!line.includes(marker))
|
|
53076
|
+
continue;
|
|
53077
|
+
let value;
|
|
53078
|
+
try {
|
|
53079
|
+
value = JSON.parse(line);
|
|
53080
|
+
} catch {
|
|
53081
|
+
continue;
|
|
53082
|
+
}
|
|
53083
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
53084
|
+
yield value;
|
|
53085
|
+
}
|
|
53086
|
+
}
|
|
53087
|
+
}
|
|
53088
|
+
function nativeTimeMs(value) {
|
|
53089
|
+
const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
53090
|
+
return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
|
|
53091
|
+
}
|
|
53092
|
+
|
|
53093
|
+
// dist/qoder-model-labels.js
|
|
53094
|
+
import { readFile, stat as stat2 } from "node:fs/promises";
|
|
53095
|
+
import path7 from "node:path";
|
|
53096
|
+
function record3(value) {
|
|
53097
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53098
|
+
}
|
|
53099
|
+
async function readQoderModelLabels(configDirectory, signal) {
|
|
53100
|
+
signal.throwIfAborted();
|
|
53101
|
+
try {
|
|
53102
|
+
const file2 = path7.join(configDirectory, ".auth", "dynamic-texts.json");
|
|
53103
|
+
if ((await stat2(file2)).size > 1024 * 1024)
|
|
53104
|
+
return {};
|
|
53105
|
+
const data = JSON.parse(await readFile(file2, { encoding: "utf8", signal }));
|
|
53106
|
+
if (!record3(data) || !record3(data.locales))
|
|
53107
|
+
return {};
|
|
53108
|
+
const labels = /* @__PURE__ */ new Map();
|
|
53109
|
+
for (const locale of ["zh-CN", "en"]) {
|
|
53110
|
+
const texts = data.locales[locale];
|
|
53111
|
+
if (!record3(texts))
|
|
53112
|
+
continue;
|
|
53113
|
+
for (const [key, value] of Object.entries(texts)) {
|
|
53114
|
+
const prefix = "modelSelector.item.";
|
|
53115
|
+
if (!key.startsWith(prefix))
|
|
53116
|
+
continue;
|
|
53117
|
+
const id = key.slice(prefix.length);
|
|
53118
|
+
if (!id || id.length > 512 || /\.(description|markdownDescription)(\.|$)/u.test(id))
|
|
53119
|
+
continue;
|
|
53120
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 512)
|
|
53121
|
+
continue;
|
|
53122
|
+
labels.set(id, value.trim());
|
|
53123
|
+
}
|
|
53124
|
+
}
|
|
53125
|
+
return Object.fromEntries(labels);
|
|
53126
|
+
} catch {
|
|
53127
|
+
signal.throwIfAborted();
|
|
53128
|
+
return {};
|
|
53129
|
+
}
|
|
53130
|
+
}
|
|
53131
|
+
|
|
53132
|
+
// dist/qoder-usage-statistics.js
|
|
53133
|
+
function qoderProjectsDirectory(environment, variant) {
|
|
53134
|
+
const cn3 = variant === "cn";
|
|
53135
|
+
const config2 = environment[cn3 ? "QODERCN_CONFIG_DIR" : "QODER_CONFIG_DIR"];
|
|
53136
|
+
const home = environment[cn3 ? "QODERCN_CLI_HOME" : "QODER_CLI_HOME"] || environment.HOME || environment.USERPROFILE || os4.homedir();
|
|
53137
|
+
return path8.resolve(config2 || path8.join(home, cn3 ? ".qoder-cn" : ".qoder"), "projects");
|
|
53138
|
+
}
|
|
53139
|
+
function isRecord2(value) {
|
|
53140
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53141
|
+
}
|
|
53142
|
+
function count2(value) {
|
|
53143
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
53144
|
+
}
|
|
53145
|
+
async function readQoderUsage(file2, signal) {
|
|
53146
|
+
const messages = /* @__PURE__ */ new Map();
|
|
53147
|
+
let sessionId;
|
|
53148
|
+
let cwd;
|
|
53149
|
+
for await (const line of jsonlRecords(file2, '"assistant"', signal)) {
|
|
53150
|
+
signal.throwIfAborted();
|
|
53151
|
+
if (line.type !== "assistant" || !isRecord2(line.message))
|
|
53152
|
+
continue;
|
|
53153
|
+
sessionId ??= line.sessionId;
|
|
53154
|
+
cwd ??= line.cwd;
|
|
53155
|
+
if (isRecord2(line.forkedFrom) || line.isApiErrorMessage === true)
|
|
53156
|
+
continue;
|
|
53157
|
+
const { id, model: model2, usage } = line.message;
|
|
53158
|
+
if (typeof id !== "string" || !id || model2 === "<synthetic>")
|
|
53159
|
+
continue;
|
|
53160
|
+
const message = messages.get(id) ?? { at: null };
|
|
53161
|
+
message.at ??= nativeTimeMs(line.timestamp);
|
|
53162
|
+
messages.set(id, message);
|
|
53163
|
+
if (!isRecord2(usage) || message.at === null)
|
|
53164
|
+
continue;
|
|
53165
|
+
const input = usage.input_tokens;
|
|
53166
|
+
const output = usage.output_tokens;
|
|
53167
|
+
const cached2 = usage.cache_read_input_tokens;
|
|
53168
|
+
const written = usage.cache_creation_input_tokens;
|
|
53169
|
+
if (!count2(input) || !count2(output) || !count2(cached2) || !count2(written))
|
|
53170
|
+
continue;
|
|
53171
|
+
const split = isRecord2(usage.cache_creation) ? usage.cache_creation : null;
|
|
53172
|
+
const oneHour = split?.ephemeral_1h_input_tokens;
|
|
53173
|
+
const details = isRecord2(usage.output_tokens_details) ? usage.output_tokens_details : null;
|
|
53174
|
+
const thinking = details?.thinking_tokens;
|
|
53175
|
+
const unreported = input === 0 && output === 0 && cached2 === 0 && written === 0;
|
|
53176
|
+
const entry = parseHarnessUsageEntry({
|
|
53177
|
+
id,
|
|
53178
|
+
occurredAtMs: message.at,
|
|
53179
|
+
...typeof model2 === "string" && model2 ? { model: model2 } : {},
|
|
53180
|
+
inputTokens: input + cached2 + written,
|
|
53181
|
+
cachedInputTokens: cached2,
|
|
53182
|
+
cacheWriteInputTokens: written,
|
|
53183
|
+
...count2(oneHour) ? { cacheWrite1hInputTokens: oneHour } : {},
|
|
53184
|
+
outputTokens: output,
|
|
53185
|
+
...typeof usage.credits === "number" && Number.isFinite(usage.credits) && usage.credits >= 0 ? { credits: usage.credits } : {},
|
|
53186
|
+
...count2(thinking) ? { reasoningOutputTokens: thinking } : {},
|
|
53187
|
+
...unreported ? { tokensUnknown: true } : {}
|
|
53188
|
+
});
|
|
53189
|
+
if (entry)
|
|
53190
|
+
message.entry = entry;
|
|
53191
|
+
}
|
|
53192
|
+
const session = {
|
|
53193
|
+
sessionId: typeof sessionId === "string" ? sessionId : void 0,
|
|
53194
|
+
cwd: typeof cwd === "string" ? cwd : void 0
|
|
53195
|
+
};
|
|
53196
|
+
return [...messages.values()].flatMap(({ entry }) => entry ? [withUsageSession(entry, session)] : []);
|
|
53197
|
+
}
|
|
53198
|
+
function createQoderUsageStatistics(environment, variant) {
|
|
53199
|
+
return Object.freeze({
|
|
53200
|
+
readModelLabels: (signal) => readQoderModelLabels(path8.dirname(qoderProjectsDirectory(environment, variant)), signal),
|
|
53201
|
+
listSources: (signal) => jsonlUsageSources(qoderProjectsDirectory(environment, variant), 4, signal),
|
|
53202
|
+
readSource: readQoderUsage
|
|
53203
|
+
});
|
|
53204
|
+
}
|
|
53205
|
+
|
|
52465
53206
|
// dist/qoder-adapter.js
|
|
52466
53207
|
var QoderAdapter = class {
|
|
52467
53208
|
harnessId;
|
|
52468
53209
|
#variant;
|
|
52469
53210
|
commandCatalog = QODER_FALLBACK_COMMAND_CATALOG;
|
|
52470
53211
|
liveCommandCatalog = true;
|
|
53212
|
+
sessionImport;
|
|
53213
|
+
usageStatistics;
|
|
52471
53214
|
#commandOverride;
|
|
52472
53215
|
#environment;
|
|
52473
53216
|
#platform;
|
|
@@ -52486,11 +53229,18 @@ var QoderAdapter = class {
|
|
|
52486
53229
|
this.harnessId = harnessIdSchema.parse(runtime.harnessId);
|
|
52487
53230
|
this.#commandOverride = options.commandOverride ?? options.environment?.[runtime.commandEnvironmentVariable];
|
|
52488
53231
|
this.#environment = qoderEnvironment(options.environment);
|
|
53232
|
+
this.usageStatistics = createQoderUsageStatistics({ ...process.env, ...options.environment }, this.#variant);
|
|
52489
53233
|
this.#platform = options.platform ?? process.platform;
|
|
52490
53234
|
this.#queryFactory = options.queryFactory ?? ((input) => runtime.sdk.query(input));
|
|
52491
53235
|
this.#forkSession = options.forkSession ?? runtime.sdk.forkSession;
|
|
52492
53236
|
this.#getSessionMessages = options.getSessionMessages ?? runtime.sdk.getSessionMessages;
|
|
52493
53237
|
this.#getSessionInfo = options.getSessionInfo ?? runtime.sdk.getSessionInfo;
|
|
53238
|
+
this.sessionImport = new QoderSessionImport({
|
|
53239
|
+
harnessId: this.harnessId,
|
|
53240
|
+
displayName: this.#variant === "cn" ? "Qoder CN" : "Qoder",
|
|
53241
|
+
listSessions: options.listSessions ?? (() => runtime.sdk.listSessions()),
|
|
53242
|
+
getSessionInfo: this.#getSessionInfo
|
|
53243
|
+
});
|
|
52494
53244
|
this.#getAvailableModels = options.getAvailableModels;
|
|
52495
53245
|
this.#resolveExecutable = options.resolveExecutable ?? ((input, dependencies) => resolveQoderExecutable({ ...input, variant: this.#variant }, dependencies));
|
|
52496
53246
|
}
|
|
@@ -52709,7 +53459,7 @@ var QoderAdapter = class {
|
|
|
52709
53459
|
sourceInfo = await this.#getSessionInfo(sourceRef.data.nativeSessionId, { dir: input.cwd });
|
|
52710
53460
|
} catch {
|
|
52711
53461
|
}
|
|
52712
|
-
if (sourceInfo?.cwd &&
|
|
53462
|
+
if (sourceInfo?.cwd && path9.resolve(sourceInfo.cwd) !== path9.resolve(input.cwd)) {
|
|
52713
53463
|
return {
|
|
52714
53464
|
ok: false,
|
|
52715
53465
|
error: {
|
|
@@ -52859,7 +53609,7 @@ var QoderAdapter = class {
|
|
|
52859
53609
|
this.#sessions.clear();
|
|
52860
53610
|
this.#inspections.clear();
|
|
52861
53611
|
this.#inFlightInspections.clear();
|
|
52862
|
-
await Promise.all(sessions.map((s) => s.close()));
|
|
53612
|
+
await Promise.all([this.sessionImport.close(), ...sessions.map((s) => s.close())]);
|
|
52863
53613
|
}
|
|
52864
53614
|
};
|
|
52865
53615
|
|