@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
|
@@ -4100,7 +4100,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
4100
4100
|
const npm = resolveHarnessExecutable({ id: "npm", command: "npm", installRoots: { posix: [], windows: [] } }, { environment: env });
|
|
4101
4101
|
let globalInstall = modules === globalRoot;
|
|
4102
4102
|
if (process.platform === "win32") {
|
|
4103
|
-
const
|
|
4103
|
+
const project2 = (await Promise.all(["package.json", "package-lock.json", "npm-shrinkwrap.json"].map((file2) => readFile(path4.join(prefix, file2), "utf8").then(() => true, (error51) => error51.code !== "ENOENT")))).some(Boolean);
|
|
4104
4104
|
const bins = typeof metadata.bin === "string" ? { [name.split("/").at(-1) ?? name]: metadata.bin } : metadata.bin ?? {};
|
|
4105
4105
|
const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
|
|
4106
4106
|
if (path4.basename(bin) !== bin || entry.includes(".."))
|
|
@@ -4111,7 +4111,7 @@ async function npmInstallation(command, packages, environment) {
|
|
|
4111
4111
|
const shim = await readFile(path4.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
|
|
4112
4112
|
return referencesNpmBin(shim, name, entry);
|
|
4113
4113
|
}));
|
|
4114
|
-
globalInstall = globalInstall && !
|
|
4114
|
+
globalInstall = globalInstall && !project2 && launchers.some(Boolean);
|
|
4115
4115
|
}
|
|
4116
4116
|
const canUpdate = globalInstall && !!npm;
|
|
4117
4117
|
return {
|
|
@@ -4191,6 +4191,48 @@ function createHarnessInstaller(environment, source) {
|
|
|
4191
4191
|
};
|
|
4192
4192
|
}
|
|
4193
4193
|
|
|
4194
|
+
// dist/modern/usage-statistics.js
|
|
4195
|
+
import os2 from "node:os";
|
|
4196
|
+
import path5 from "node:path";
|
|
4197
|
+
import { lstat, readFile as readFile2, readdir } from "node:fs/promises";
|
|
4198
|
+
import { zstdDecompressSync } from "node:zlib";
|
|
4199
|
+
|
|
4200
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
4201
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
4202
|
+
var MAX_CWD_LENGTH = 4096;
|
|
4203
|
+
function sessionIdOk(value) {
|
|
4204
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
4205
|
+
}
|
|
4206
|
+
function cwdOk(value) {
|
|
4207
|
+
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("\\\\"));
|
|
4208
|
+
}
|
|
4209
|
+
function withUsageSession(entry, session) {
|
|
4210
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
4211
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
4212
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
4213
|
+
return entry;
|
|
4214
|
+
return {
|
|
4215
|
+
...entry,
|
|
4216
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
4217
|
+
...cwd !== void 0 ? { cwd } : {}
|
|
4218
|
+
};
|
|
4219
|
+
}
|
|
4220
|
+
function usageEntryFromRequest(request, occurredAtMs) {
|
|
4221
|
+
if (!Number.isSafeInteger(occurredAtMs) || occurredAtMs <= 0)
|
|
4222
|
+
return null;
|
|
4223
|
+
return {
|
|
4224
|
+
id: request.requestId,
|
|
4225
|
+
occurredAtMs,
|
|
4226
|
+
...request.model !== void 0 ? { model: request.model } : {},
|
|
4227
|
+
inputTokens: request.inputTokens,
|
|
4228
|
+
...request.cachedInputTokens !== void 0 ? { cachedInputTokens: request.cachedInputTokens } : {},
|
|
4229
|
+
...request.cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens: request.cacheWriteInputTokens } : {},
|
|
4230
|
+
...request.cacheWrite1hInputTokens !== void 0 ? { cacheWrite1hInputTokens: request.cacheWrite1hInputTokens } : {},
|
|
4231
|
+
outputTokens: request.outputTokens,
|
|
4232
|
+
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
4233
|
+
};
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4194
4236
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
4195
4237
|
var external_exports = {};
|
|
4196
4238
|
__export(external_exports, {
|
|
@@ -4957,10 +4999,10 @@ function mergeDefs(...defs) {
|
|
|
4957
4999
|
function cloneDef(schema) {
|
|
4958
5000
|
return mergeDefs(schema._zod.def);
|
|
4959
5001
|
}
|
|
4960
|
-
function getElementAtPath(obj,
|
|
4961
|
-
if (!
|
|
5002
|
+
function getElementAtPath(obj, path9) {
|
|
5003
|
+
if (!path9)
|
|
4962
5004
|
return obj;
|
|
4963
|
-
return
|
|
5005
|
+
return path9.reduce((acc, key) => acc?.[key], obj);
|
|
4964
5006
|
}
|
|
4965
5007
|
function promiseAllObject(promisesObj) {
|
|
4966
5008
|
const keys = Object.keys(promisesObj);
|
|
@@ -5369,11 +5411,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5369
5411
|
}
|
|
5370
5412
|
return false;
|
|
5371
5413
|
}
|
|
5372
|
-
function prefixIssues(
|
|
5414
|
+
function prefixIssues(path9, issues) {
|
|
5373
5415
|
return issues.map((iss) => {
|
|
5374
5416
|
var _a3;
|
|
5375
5417
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5376
|
-
iss.path.unshift(
|
|
5418
|
+
iss.path.unshift(path9);
|
|
5377
5419
|
return iss;
|
|
5378
5420
|
});
|
|
5379
5421
|
}
|
|
@@ -5520,16 +5562,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5520
5562
|
}
|
|
5521
5563
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
5522
5564
|
const fieldErrors = { _errors: [] };
|
|
5523
|
-
const processError = (error52,
|
|
5565
|
+
const processError = (error52, path9 = []) => {
|
|
5524
5566
|
for (const issue2 of error52.issues) {
|
|
5525
5567
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5526
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5568
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
5527
5569
|
} else if (issue2.code === "invalid_key") {
|
|
5528
|
-
processError({ issues: issue2.issues }, [...
|
|
5570
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
5529
5571
|
} else if (issue2.code === "invalid_element") {
|
|
5530
|
-
processError({ issues: issue2.issues }, [...
|
|
5572
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
5531
5573
|
} else {
|
|
5532
|
-
const fullpath = [...
|
|
5574
|
+
const fullpath = [...path9, ...issue2.path];
|
|
5533
5575
|
if (fullpath.length === 0) {
|
|
5534
5576
|
fieldErrors._errors.push(mapper(issue2));
|
|
5535
5577
|
} else {
|
|
@@ -5556,17 +5598,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5556
5598
|
}
|
|
5557
5599
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
5558
5600
|
const result = { errors: [] };
|
|
5559
|
-
const processError = (error52,
|
|
5601
|
+
const processError = (error52, path9 = []) => {
|
|
5560
5602
|
var _a3, _b;
|
|
5561
5603
|
for (const issue2 of error52.issues) {
|
|
5562
5604
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5563
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5605
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
5564
5606
|
} else if (issue2.code === "invalid_key") {
|
|
5565
|
-
processError({ issues: issue2.issues }, [...
|
|
5607
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
5566
5608
|
} else if (issue2.code === "invalid_element") {
|
|
5567
|
-
processError({ issues: issue2.issues }, [...
|
|
5609
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
5568
5610
|
} else {
|
|
5569
|
-
const fullpath = [...
|
|
5611
|
+
const fullpath = [...path9, ...issue2.path];
|
|
5570
5612
|
if (fullpath.length === 0) {
|
|
5571
5613
|
result.errors.push(mapper(issue2));
|
|
5572
5614
|
continue;
|
|
@@ -5598,8 +5640,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5598
5640
|
}
|
|
5599
5641
|
function toDotPath(_path) {
|
|
5600
5642
|
const segs = [];
|
|
5601
|
-
const
|
|
5602
|
-
for (const seg of
|
|
5643
|
+
const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5644
|
+
for (const seg of path9) {
|
|
5603
5645
|
if (typeof seg === "number")
|
|
5604
5646
|
segs.push(`[${seg}]`);
|
|
5605
5647
|
else if (typeof seg === "symbol")
|
|
@@ -8827,8 +8869,8 @@ function az_default() {
|
|
|
8827
8869
|
}
|
|
8828
8870
|
|
|
8829
8871
|
// ../../../node_modules/zod/v4/locales/be.js
|
|
8830
|
-
function getBelarusianPlural(
|
|
8831
|
-
const absCount = Math.abs(
|
|
8872
|
+
function getBelarusianPlural(count3, one, few, many) {
|
|
8873
|
+
const absCount = Math.abs(count3);
|
|
8832
8874
|
const lastDigit = absCount % 10;
|
|
8833
8875
|
const lastTwoDigits = absCount % 100;
|
|
8834
8876
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -10906,8 +10948,8 @@ function hu_default() {
|
|
|
10906
10948
|
}
|
|
10907
10949
|
|
|
10908
10950
|
// ../../../node_modules/zod/v4/locales/hy.js
|
|
10909
|
-
function getArmenianPlural(
|
|
10910
|
-
return Math.abs(
|
|
10951
|
+
function getArmenianPlural(count3, one, many) {
|
|
10952
|
+
return Math.abs(count3) === 1 ? one : many;
|
|
10911
10953
|
}
|
|
10912
10954
|
function withDefiniteArticle(word) {
|
|
10913
10955
|
if (!word)
|
|
@@ -13035,8 +13077,8 @@ function ro_default() {
|
|
|
13035
13077
|
}
|
|
13036
13078
|
|
|
13037
13079
|
// ../../../node_modules/zod/v4/locales/ru.js
|
|
13038
|
-
function getRussianPlural(
|
|
13039
|
-
const absCount = Math.abs(
|
|
13080
|
+
function getRussianPlural(count3, one, few, many) {
|
|
13081
|
+
const absCount = Math.abs(count3);
|
|
13040
13082
|
const lastDigit = absCount % 10;
|
|
13041
13083
|
const lastTwoDigits = absCount % 100;
|
|
13042
13084
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -18291,13 +18333,13 @@ function resolveRef(ref, ctx) {
|
|
|
18291
18333
|
if (!ref.startsWith("#")) {
|
|
18292
18334
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18293
18335
|
}
|
|
18294
|
-
const
|
|
18295
|
-
if (
|
|
18336
|
+
const path9 = ref.slice(1).split("/").filter(Boolean);
|
|
18337
|
+
if (path9.length === 0) {
|
|
18296
18338
|
return ctx.rootSchema;
|
|
18297
18339
|
}
|
|
18298
18340
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18299
|
-
if (
|
|
18300
|
-
const key =
|
|
18341
|
+
if (path9[0] === defsKey) {
|
|
18342
|
+
const key = path9[1];
|
|
18301
18343
|
if (!key || !ctx.defs[key]) {
|
|
18302
18344
|
throw new Error(`Reference not found: ${ref}`);
|
|
18303
18345
|
}
|
|
@@ -18705,6 +18747,15 @@ function date4(params) {
|
|
|
18705
18747
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
18706
18748
|
config(en_default());
|
|
18707
18749
|
|
|
18750
|
+
// ../../shared-contracts/dist/delegation-read.js
|
|
18751
|
+
var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
|
|
18752
|
+
var delegationReadParamsSchema = external_exports.strictObject({
|
|
18753
|
+
threadId: external_exports.string().min(1).max(1024),
|
|
18754
|
+
view: external_exports.enum(["result", "messages"]),
|
|
18755
|
+
cursor: external_exports.string().min(1).max(8192).optional(),
|
|
18756
|
+
limit: external_exports.number().int().min(1).max(100).optional()
|
|
18757
|
+
});
|
|
18758
|
+
|
|
18708
18759
|
// ../../shared-contracts/dist/credential-imports.js
|
|
18709
18760
|
var credentialSourceSchema = external_exports.object({
|
|
18710
18761
|
id: external_exports.string().min(1).max(256),
|
|
@@ -18775,6 +18826,153 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
18775
18826
|
initializeOnly: external_exports.boolean().optional()
|
|
18776
18827
|
});
|
|
18777
18828
|
|
|
18829
|
+
// ../../shared-contracts/dist/model-price-overrides.js
|
|
18830
|
+
var usdPerMillionTokens = external_exports.number().finite().nonnegative();
|
|
18831
|
+
var modelPriceOverrideSchema = external_exports.strictObject({
|
|
18832
|
+
input: usdPerMillionTokens,
|
|
18833
|
+
output: usdPerMillionTokens,
|
|
18834
|
+
cacheRead: usdPerMillionTokens.optional(),
|
|
18835
|
+
cacheWrite: usdPerMillionTokens.optional(),
|
|
18836
|
+
cacheWrite1h: usdPerMillionTokens.optional()
|
|
18837
|
+
});
|
|
18838
|
+
var modelPriceKeySchema = external_exports.string().max(512).refine((key) => key.trim() === key && key.length > 0, "Model ID is required");
|
|
18839
|
+
var modelPriceOverridesSchema = external_exports.strictObject({
|
|
18840
|
+
/** Absolute path of the Host's `pricing.json`. */
|
|
18841
|
+
path: external_exports.string(),
|
|
18842
|
+
entries: external_exports.array(external_exports.strictObject({ key: external_exports.string(), price: modelPriceOverrideSchema })),
|
|
18843
|
+
/** Why the existing file is unusable; the Host then ignores it and refuses to overwrite it. */
|
|
18844
|
+
error: external_exports.string().nullable()
|
|
18845
|
+
});
|
|
18846
|
+
var modelPriceOverridesGetSchema = external_exports.strictObject({});
|
|
18847
|
+
var modelPriceOverridesSetSchema = external_exports.strictObject({
|
|
18848
|
+
key: modelPriceKeySchema,
|
|
18849
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
18850
|
+
previousKey: modelPriceKeySchema.optional()
|
|
18851
|
+
});
|
|
18852
|
+
var modelPriceDefaultParamsSchema = external_exports.strictObject({
|
|
18853
|
+
model: modelPriceKeySchema
|
|
18854
|
+
});
|
|
18855
|
+
var modelPriceSuggestionSchema = external_exports.strictObject({
|
|
18856
|
+
/** Verified from catalog canonical links, not inferred from names or equal prices. */
|
|
18857
|
+
official: external_exports.boolean().optional(),
|
|
18858
|
+
canonicalModelId: external_exports.string().min(1).optional(),
|
|
18859
|
+
provider: external_exports.string().min(1).max(512),
|
|
18860
|
+
model: external_exports.string().min(1).max(512),
|
|
18861
|
+
price: modelPriceOverrideSchema
|
|
18862
|
+
});
|
|
18863
|
+
var modelPriceDefaultResultSchema = external_exports.strictObject({
|
|
18864
|
+
price: modelPriceOverrideSchema.nullable(),
|
|
18865
|
+
/** Local catalog suggestions only; never used automatically for pricing. */
|
|
18866
|
+
suggestions: external_exports.array(modelPriceSuggestionSchema).max(6).optional()
|
|
18867
|
+
});
|
|
18868
|
+
|
|
18869
|
+
// ../../shared-contracts/dist/usage-statistics.js
|
|
18870
|
+
var USAGE_STATISTICS_RANGES = ["today", "7d", "30d", "90d", "all"];
|
|
18871
|
+
var count = external_exports.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
18872
|
+
var localDate = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/u);
|
|
18873
|
+
var harness = external_exports.string().min(1).max(128);
|
|
18874
|
+
var model = external_exports.string().min(1).max(512);
|
|
18875
|
+
var project = external_exports.string().min(1).max(4096);
|
|
18876
|
+
var usageStatisticsParamsSchema = external_exports.strictObject({
|
|
18877
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
18878
|
+
harness: harness.optional(),
|
|
18879
|
+
model: model.nullable().optional(),
|
|
18880
|
+
project: project.nullable().optional(),
|
|
18881
|
+
/** One local date inside the range. */
|
|
18882
|
+
date: localDate.optional()
|
|
18883
|
+
});
|
|
18884
|
+
var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
18885
|
+
requests: count,
|
|
18886
|
+
inputTokens: count,
|
|
18887
|
+
cachedInputTokens: count,
|
|
18888
|
+
cacheWriteInputTokens: count,
|
|
18889
|
+
cacheKnownInputTokens: count,
|
|
18890
|
+
outputTokens: count,
|
|
18891
|
+
reasoningOutputTokens: count,
|
|
18892
|
+
/** USD at the public price, summed over the priced requests only. */
|
|
18893
|
+
costUsd: external_exports.number().finite().min(0),
|
|
18894
|
+
/** Requests without a price (or the cache data the price needs); not in `costUsd`. */
|
|
18895
|
+
unpricedRequests: count,
|
|
18896
|
+
/**
|
|
18897
|
+
* Requests whose storage gave no token counts: counted as requests, with neither tokens nor
|
|
18898
|
+
* cost, and not as unpriced.
|
|
18899
|
+
*/
|
|
18900
|
+
unmeteredRequests: count
|
|
18901
|
+
});
|
|
18902
|
+
var totals = usageStatisticsTotalsSchema.shape;
|
|
18903
|
+
var usageStatisticsSessionSchema = external_exports.strictObject({
|
|
18904
|
+
harness,
|
|
18905
|
+
sessionId: external_exports.string().min(1).max(512),
|
|
18906
|
+
project: project.nullable(),
|
|
18907
|
+
/** Models the session used, most requests first. */
|
|
18908
|
+
models: external_exports.array(model).max(16),
|
|
18909
|
+
firstAtMs: count,
|
|
18910
|
+
lastAtMs: count,
|
|
18911
|
+
...totals
|
|
18912
|
+
});
|
|
18913
|
+
var usageStatisticsResultSchema = external_exports.strictObject({
|
|
18914
|
+
range: external_exports.enum(USAGE_STATISTICS_RANGES),
|
|
18915
|
+
/** First local date of the range; null for all time. */
|
|
18916
|
+
from: localDate.nullable(),
|
|
18917
|
+
to: localDate,
|
|
18918
|
+
/** The filters these figures apply, echoed so a late answer to older filters is recognised. */
|
|
18919
|
+
filters: external_exports.strictObject({
|
|
18920
|
+
harness: harness.nullable(),
|
|
18921
|
+
model: model.nullable(),
|
|
18922
|
+
unknownModel: external_exports.boolean(),
|
|
18923
|
+
project: project.nullable(),
|
|
18924
|
+
unknownProject: external_exports.boolean(),
|
|
18925
|
+
date: localDate.nullable()
|
|
18926
|
+
}),
|
|
18927
|
+
/** Reading of native storage: incomplete while the first read, or a refresh, is under way. */
|
|
18928
|
+
reading: external_exports.strictObject({ complete: external_exports.boolean(), sources: count, read: count }),
|
|
18929
|
+
/** Harnesses whose storage could not be read; their part is missing, the rest is complete. */
|
|
18930
|
+
failures: external_exports.array(external_exports.strictObject({ harness, message: external_exports.string().max(2048) })).max(256),
|
|
18931
|
+
/** Every value seen in the range, ignoring the filters, to choose filters from. */
|
|
18932
|
+
options: external_exports.strictObject({
|
|
18933
|
+
harnesses: external_exports.array(harness).max(256),
|
|
18934
|
+
models: external_exports.array(model.nullable()).max(4096),
|
|
18935
|
+
projects: external_exports.array(project.nullable()).max(4096)
|
|
18936
|
+
}),
|
|
18937
|
+
/** Current display metadata, scoped by Harness. Never a pricing or filter identity.
|
|
18938
|
+
* Optional for older Hosts; missing/conflicting labels fall back to the native model ID.
|
|
18939
|
+
*/
|
|
18940
|
+
modelLabels: external_exports.array(external_exports.strictObject({ harness, model, label: model })).max(4096).optional(),
|
|
18941
|
+
/** Native credits, all filters applied, never combined across Harnesses or treated as USD.
|
|
18942
|
+
* Only groups with at least one reported value appear; reportedRequests exposes partial data.
|
|
18943
|
+
*/
|
|
18944
|
+
credits: external_exports.array(external_exports.strictObject({
|
|
18945
|
+
harness,
|
|
18946
|
+
model: model.nullable(),
|
|
18947
|
+
credits: external_exports.number().finite().min(0),
|
|
18948
|
+
reportedRequests: count,
|
|
18949
|
+
requests: count
|
|
18950
|
+
})).max(4096).optional(),
|
|
18951
|
+
/** All filters applied. */
|
|
18952
|
+
totals: usageStatisticsTotalsSchema,
|
|
18953
|
+
/** Each date and Harness of the range: every filter except the day. */
|
|
18954
|
+
daily: external_exports.array(external_exports.strictObject({ date: localDate, harness, ...totals })).max(2e5),
|
|
18955
|
+
/** Local weekday (0 = Sunday) and hour, all filters applied. */
|
|
18956
|
+
hourly: external_exports.array(external_exports.strictObject({
|
|
18957
|
+
weekday: external_exports.number().int().min(0).max(6),
|
|
18958
|
+
hour: external_exports.number().int().min(0).max(23),
|
|
18959
|
+
...totals
|
|
18960
|
+
})).max(168),
|
|
18961
|
+
byHarness: external_exports.array(external_exports.strictObject({ harness, ...totals })).max(256),
|
|
18962
|
+
byModel: external_exports.array(external_exports.strictObject({
|
|
18963
|
+
model: model.nullable(),
|
|
18964
|
+
...totals,
|
|
18965
|
+
/** Requests priced by what the Harness recorded they cost, not by a price list. */
|
|
18966
|
+
harnessPricedRequests: count
|
|
18967
|
+
})).max(4096),
|
|
18968
|
+
byProject: external_exports.array(external_exports.strictObject({ project: project.nullable(), ...totals })).max(4096),
|
|
18969
|
+
/**
|
|
18970
|
+
* The sessions that spent the most, by cost and by tokens without cache, all filters applied;
|
|
18971
|
+
* requests without a native session are not listed here but count everywhere else.
|
|
18972
|
+
*/
|
|
18973
|
+
sessions: external_exports.array(usageStatisticsSessionSchema).max(100)
|
|
18974
|
+
});
|
|
18975
|
+
|
|
18778
18976
|
// ../../shared-contracts/dist/ids.js
|
|
18779
18977
|
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18780
18978
|
message: "Identifier must not be empty or whitespace"
|
|
@@ -18785,6 +18983,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
18785
18983
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18786
18984
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18787
18985
|
|
|
18986
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
18987
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
18988
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
18989
|
+
|
|
18788
18990
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
18789
18991
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
18790
18992
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -18792,13 +18994,40 @@ var HARNESS_PLUGIN_LIMIT = 128;
|
|
|
18792
18994
|
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);
|
|
18793
18995
|
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");
|
|
18794
18996
|
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
18997
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
18998
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
18999
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
19000
|
+
before: localizedTextSchema.optional(),
|
|
19001
|
+
after: localizedTextSchema.optional(),
|
|
19002
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
19003
|
+
}).strict();
|
|
18795
19004
|
var pluginPresentationShape = {
|
|
18796
19005
|
id: harnessPluginIdSchema,
|
|
18797
19006
|
name: external_exports.string().trim().min(1).max(128),
|
|
18798
19007
|
version: external_exports.string().min(1).max(128),
|
|
19008
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
19009
|
+
kind: external_exports.literal("usage").optional(),
|
|
19010
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
19011
|
+
iconStyle: external_exports.object({
|
|
19012
|
+
vector: external_exports.object({
|
|
19013
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
19014
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
19015
|
+
paths: external_exports.array(external_exports.object({
|
|
19016
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
19017
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
19018
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
19019
|
+
}).strict()).min(1).max(32)
|
|
19020
|
+
}).strict().optional(),
|
|
19021
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
19022
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
19023
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
19024
|
+
}).strict().optional(),
|
|
19025
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
19026
|
+
notice: localizedTextSchema.optional(),
|
|
18799
19027
|
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
18800
19028
|
launchCommand: external_exports.literal(true).optional(),
|
|
18801
19029
|
links: external_exports.object({
|
|
19030
|
+
website: documentationUrlSchema.optional(),
|
|
18802
19031
|
documentation: documentationUrlSchema.optional(),
|
|
18803
19032
|
installation: documentationUrlSchema.optional()
|
|
18804
19033
|
}).strict().optional()
|
|
@@ -18852,6 +19081,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
18852
19081
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
18853
19082
|
});
|
|
18854
19083
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
19084
|
+
"codexhost/console/remote-connections",
|
|
19085
|
+
"codexhost/runtime/status",
|
|
19086
|
+
"codexhost/remote/ssh-setup",
|
|
18855
19087
|
"codexhost/harness/plugins/list",
|
|
18856
19088
|
"codexhost/harness/display-settings/get",
|
|
18857
19089
|
"codexhost/harness/display-settings/set",
|
|
@@ -18872,6 +19104,10 @@ var CONSOLE_HOST_METHODS = Object.freeze([
|
|
|
18872
19104
|
"codexhost/account/list",
|
|
18873
19105
|
"codexhost/account/refresh",
|
|
18874
19106
|
"codexhost/account/usage/inspect",
|
|
19107
|
+
"codexhost/usage/model-prices/get",
|
|
19108
|
+
"codexhost/usage/model-prices/set",
|
|
19109
|
+
"codexhost/usage/model-prices/default",
|
|
19110
|
+
"codexhost/usage/statistics/get",
|
|
18875
19111
|
"codexhost/update/check",
|
|
18876
19112
|
"codexhost/update/start",
|
|
18877
19113
|
"codexhost/update/status"
|
|
@@ -18936,6 +19172,7 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
18936
19172
|
cacheWriteInputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
18937
19173
|
outputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
18938
19174
|
outputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
19175
|
+
apiOutputTokensPerSecond: finiteNonNegativeNumberSchema.optional(),
|
|
18939
19176
|
reasoningOutputTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
18940
19177
|
totalTokens: nonNegativeSafeIntegerSchema.optional(),
|
|
18941
19178
|
totalCostUsd: finiteNonNegativeNumberSchema.optional(),
|
|
@@ -18947,7 +19184,11 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
18947
19184
|
planFiveHourUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
18948
19185
|
planFiveHourResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
18949
19186
|
planSevenDayUsedPercent: cacheHitRatePercentSchema.optional(),
|
|
18950
|
-
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional()
|
|
19187
|
+
planSevenDayResetsAtUnix: nonNegativeSafeIntegerSchema.optional(),
|
|
19188
|
+
sessionCacheHitRatePercent: cacheHitRatePercentSchema.optional(),
|
|
19189
|
+
timeToFirstOutputMs: nonNegativeSafeIntegerSchema.optional(),
|
|
19190
|
+
costSource: external_exports.enum(["publicPrice", "native"]).optional(),
|
|
19191
|
+
unpricedModels: external_exports.array(external_exports.string().min(1)).min(1).optional()
|
|
18951
19192
|
}).strict().superRefine((usage, context) => {
|
|
18952
19193
|
if (Object.keys(usage).length === 0) {
|
|
18953
19194
|
context.addIssue({ code: "custom", message: "Thread Usage must contain a reliable field" });
|
|
@@ -18968,6 +19209,20 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
18968
19209
|
path: ["contextWindowTokens"]
|
|
18969
19210
|
});
|
|
18970
19211
|
}
|
|
19212
|
+
if (usage.costSource !== void 0 && usage.totalCostUsd === void 0) {
|
|
19213
|
+
context.addIssue({
|
|
19214
|
+
code: "custom",
|
|
19215
|
+
message: "Thread Usage costSource must be provided with totalCostUsd",
|
|
19216
|
+
path: ["costSource"]
|
|
19217
|
+
});
|
|
19218
|
+
}
|
|
19219
|
+
if (usage.unpricedModels !== void 0 && usage.costSource !== "publicPrice") {
|
|
19220
|
+
context.addIssue({
|
|
19221
|
+
code: "custom",
|
|
19222
|
+
message: "Thread Usage unpricedModels must be provided with a publicPrice cost",
|
|
19223
|
+
path: ["unpricedModels"]
|
|
19224
|
+
});
|
|
19225
|
+
}
|
|
18971
19226
|
if (usage.planFiveHourResetsAtUnix !== void 0 && usage.planFiveHourUsedPercent === void 0) {
|
|
18972
19227
|
context.addIssue({
|
|
18973
19228
|
code: "custom",
|
|
@@ -19237,27 +19492,27 @@ var harnessModelCatalogSchema = external_exports.object({
|
|
|
19237
19492
|
}).strict().superRefine((catalog, context) => {
|
|
19238
19493
|
const refs = /* @__PURE__ */ new Set();
|
|
19239
19494
|
const thinkingIds = new Set(catalog.thinkingOptions.map(({ id }) => id));
|
|
19240
|
-
for (const [index,
|
|
19241
|
-
if (refs.has(
|
|
19495
|
+
for (const [index, model2] of catalog.models.entries()) {
|
|
19496
|
+
if (refs.has(model2.ref.id)) {
|
|
19242
19497
|
context.addIssue({
|
|
19243
19498
|
code: "custom",
|
|
19244
19499
|
message: "Model Catalog refs must be unique",
|
|
19245
19500
|
path: ["models", index, "ref", "id"]
|
|
19246
19501
|
});
|
|
19247
19502
|
}
|
|
19248
|
-
refs.add(
|
|
19249
|
-
if (
|
|
19250
|
-
if (refs.has(
|
|
19503
|
+
refs.add(model2.ref.id);
|
|
19504
|
+
if (model2.fastModel) {
|
|
19505
|
+
if (refs.has(model2.fastModel.id) || catalog.models.some((entry) => entry.ref.id === model2.fastModel?.id)) {
|
|
19251
19506
|
context.addIssue({
|
|
19252
19507
|
code: "custom",
|
|
19253
19508
|
message: "Fast Model refs must be distinct and unique",
|
|
19254
19509
|
path: ["models", index, "fastModel"]
|
|
19255
19510
|
});
|
|
19256
19511
|
}
|
|
19257
|
-
refs.add(
|
|
19512
|
+
refs.add(model2.fastModel.id);
|
|
19258
19513
|
}
|
|
19259
19514
|
const supportedThinkingIds = /* @__PURE__ */ new Set();
|
|
19260
|
-
for (const [optionIndex, optionId] of (
|
|
19515
|
+
for (const [optionIndex, optionId] of (model2.supportedThinkingOptionIds ?? []).entries()) {
|
|
19261
19516
|
if (supportedThinkingIds.has(optionId)) {
|
|
19262
19517
|
context.addIssue({
|
|
19263
19518
|
code: "custom",
|
|
@@ -19801,6 +20056,85 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
19801
20056
|
status: updateStatusSchema.nullable()
|
|
19802
20057
|
});
|
|
19803
20058
|
|
|
20059
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
20060
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
20061
|
+
"idle",
|
|
20062
|
+
"installing",
|
|
20063
|
+
"restarting",
|
|
20064
|
+
"succeeded",
|
|
20065
|
+
"failed"
|
|
20066
|
+
]);
|
|
20067
|
+
var runtimeStatusSchema = external_exports.object({
|
|
20068
|
+
runningVersion: external_exports.string().nullable(),
|
|
20069
|
+
installedVersion: external_exports.string().nullable(),
|
|
20070
|
+
restartRequired: external_exports.boolean(),
|
|
20071
|
+
remote: external_exports.boolean(),
|
|
20072
|
+
updateSupported: external_exports.boolean(),
|
|
20073
|
+
update: external_exports.object({
|
|
20074
|
+
phase: remoteUpdatePhaseSchema,
|
|
20075
|
+
targetVersion: external_exports.string().nullable(),
|
|
20076
|
+
error: external_exports.string().nullable()
|
|
20077
|
+
})
|
|
20078
|
+
});
|
|
20079
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
20080
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
20081
|
+
}).strict();
|
|
20082
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
20083
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
20084
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
20085
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
20086
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
20087
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
20088
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
20089
|
+
}).strict();
|
|
20090
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
20091
|
+
|
|
20092
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
20093
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
20094
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
20095
|
+
hostId,
|
|
20096
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
20097
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
20098
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
20099
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
20100
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
20101
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
20102
|
+
autoConnect: external_exports.boolean(),
|
|
20103
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
20104
|
+
});
|
|
20105
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
20106
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
20107
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
20108
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
20109
|
+
identity: external_exports.string().max(4096).nullable()
|
|
20110
|
+
});
|
|
20111
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
20112
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
20113
|
+
external_exports.strictObject({
|
|
20114
|
+
action: external_exports.literal("read-thread"),
|
|
20115
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
20116
|
+
input: delegationReadParamsSchema
|
|
20117
|
+
}),
|
|
20118
|
+
external_exports.strictObject({
|
|
20119
|
+
action: external_exports.literal("save"),
|
|
20120
|
+
draft: codexSshDraftSchema,
|
|
20121
|
+
previous: codexSshConnectionSchema.nullable()
|
|
20122
|
+
}),
|
|
20123
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
20124
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
20125
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
20126
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
20127
|
+
external_exports.strictObject({
|
|
20128
|
+
action: external_exports.literal("update"),
|
|
20129
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
20130
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
20131
|
+
})
|
|
20132
|
+
]);
|
|
20133
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
20134
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
20135
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
20136
|
+
]);
|
|
20137
|
+
|
|
19804
20138
|
// ../../shared-contracts/dist/index.js
|
|
19805
20139
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
19806
20140
|
|
|
@@ -19934,7 +20268,6 @@ var tokenFields = [
|
|
|
19934
20268
|
"cachedInputTokens",
|
|
19935
20269
|
"cacheWriteInputTokens",
|
|
19936
20270
|
"outputTokens",
|
|
19937
|
-
"outputTokensPerSecond",
|
|
19938
20271
|
"reasoningOutputTokens",
|
|
19939
20272
|
"totalTokens",
|
|
19940
20273
|
"contextWindowTokens",
|
|
@@ -19942,10 +20275,12 @@ var tokenFields = [
|
|
|
19942
20275
|
];
|
|
19943
20276
|
var safeIntegerFields = [
|
|
19944
20277
|
"planFiveHourResetsAtUnix",
|
|
19945
|
-
"planSevenDayResetsAtUnix"
|
|
20278
|
+
"planSevenDayResetsAtUnix",
|
|
20279
|
+
"timeToFirstOutputMs"
|
|
19946
20280
|
];
|
|
19947
20281
|
var percentFields = [
|
|
19948
20282
|
"cacheHitRatePercent",
|
|
20283
|
+
"sessionCacheHitRatePercent",
|
|
19949
20284
|
"planFiveHourUsedPercent",
|
|
19950
20285
|
"planSevenDayUsedPercent"
|
|
19951
20286
|
];
|
|
@@ -19953,9 +20288,14 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
19953
20288
|
...tokenFields,
|
|
19954
20289
|
...safeIntegerFields,
|
|
19955
20290
|
...percentFields,
|
|
20291
|
+
"sessionCacheUsage",
|
|
19956
20292
|
"totalCostUsd",
|
|
19957
20293
|
"totalCredits",
|
|
19958
|
-
"contextUsagePercent"
|
|
20294
|
+
"contextUsagePercent",
|
|
20295
|
+
"outputTokensPerSecond",
|
|
20296
|
+
"apiOutputTokensPerSecond",
|
|
20297
|
+
"costSource",
|
|
20298
|
+
"unpricedModels"
|
|
19959
20299
|
]);
|
|
19960
20300
|
function isRecord(value) {
|
|
19961
20301
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -19971,7 +20311,11 @@ function parseHostUsage(value) {
|
|
|
19971
20311
|
throw new Error(`Harness Usage contains unknown field '${key}'`);
|
|
19972
20312
|
}
|
|
19973
20313
|
}
|
|
19974
|
-
for (const field of [
|
|
20314
|
+
for (const field of [
|
|
20315
|
+
"totalCredits",
|
|
20316
|
+
"contextUsagePercent",
|
|
20317
|
+
"apiOutputTokensPerSecond"
|
|
20318
|
+
]) {
|
|
19975
20319
|
const candidate = value[field];
|
|
19976
20320
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
19977
20321
|
throw new Error(`Harness Usage '${field}' must be a finite non-negative number`);
|
|
@@ -20007,6 +20351,12 @@ function parseHostUsage(value) {
|
|
|
20007
20351
|
throw new Error(`Harness Usage '${field}' must be between 0 and 100`);
|
|
20008
20352
|
}
|
|
20009
20353
|
}
|
|
20354
|
+
if (value.sessionCacheUsage !== void 0) {
|
|
20355
|
+
const totals2 = value.sessionCacheUsage;
|
|
20356
|
+
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) {
|
|
20357
|
+
throw new Error("Harness Usage 'sessionCacheUsage' must contain complete bounded token totals");
|
|
20358
|
+
}
|
|
20359
|
+
}
|
|
20010
20360
|
const hasContextUsed = value.contextUsedTokens !== void 0;
|
|
20011
20361
|
const hasContextWindow = value.contextWindowTokens !== void 0;
|
|
20012
20362
|
if (hasContextUsed !== hasContextWindow) {
|
|
@@ -20021,168 +20371,89 @@ function parseHostUsage(value) {
|
|
|
20021
20371
|
if (value.planSevenDayResetsAtUnix !== void 0 && value.planSevenDayUsedPercent === void 0) {
|
|
20022
20372
|
throw new Error("Harness Usage 'planSevenDayResetsAtUnix' must be provided with 'planSevenDayUsedPercent'");
|
|
20023
20373
|
}
|
|
20374
|
+
if (value.costSource !== void 0) {
|
|
20375
|
+
if (value.costSource !== "publicPrice" && value.costSource !== "native") {
|
|
20376
|
+
throw new Error("Harness Usage 'costSource' must be 'publicPrice' or 'native'");
|
|
20377
|
+
}
|
|
20378
|
+
if (value.totalCostUsd === void 0) {
|
|
20379
|
+
throw new Error("Harness Usage 'costSource' must be provided with 'totalCostUsd'");
|
|
20380
|
+
}
|
|
20381
|
+
}
|
|
20382
|
+
if (value.unpricedModels !== void 0) {
|
|
20383
|
+
const models = value.unpricedModels;
|
|
20384
|
+
if (!Array.isArray(models) || models.length === 0 || !models.every((model2) => typeof model2 === "string" && model2.length > 0)) {
|
|
20385
|
+
throw new Error("Harness Usage 'unpricedModels' must be a non-empty list of Model IDs");
|
|
20386
|
+
}
|
|
20387
|
+
if (value.costSource !== "publicPrice") {
|
|
20388
|
+
throw new Error("Harness Usage 'unpricedModels' must be provided with a 'publicPrice' cost");
|
|
20389
|
+
}
|
|
20390
|
+
return { ...value, unpricedModels: [...models] };
|
|
20391
|
+
}
|
|
20024
20392
|
return { ...value };
|
|
20025
20393
|
}
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
},
|
|
20036
|
-
{
|
|
20037
|
-
id: "dsh.goal",
|
|
20038
|
-
invocation: "/dsh-goal",
|
|
20039
|
-
label: "Goal",
|
|
20040
|
-
description: "Set or view the goal for a long-running task",
|
|
20041
|
-
argumentMode: "text"
|
|
20042
|
-
},
|
|
20043
|
-
{
|
|
20044
|
-
id: "dsh.plan",
|
|
20045
|
-
invocation: "/plan",
|
|
20046
|
-
label: "Plan mode",
|
|
20047
|
-
description: "Enter or leave plan mode",
|
|
20048
|
-
argumentMode: "text"
|
|
20049
|
-
}
|
|
20394
|
+
var requestTokenFields = [
|
|
20395
|
+
"inputTokens",
|
|
20396
|
+
"cachedInputTokens",
|
|
20397
|
+
"cacheWriteInputTokens",
|
|
20398
|
+
"cacheWrite1hInputTokens",
|
|
20399
|
+
"outputTokens",
|
|
20400
|
+
"reasoningOutputTokens",
|
|
20401
|
+
"startedAtMs",
|
|
20402
|
+
"completedAtMs"
|
|
20050
20403
|
];
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
|
|
20054
|
-
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
return {
|
|
20066
|
-
ok: false,
|
|
20067
|
-
error: {
|
|
20068
|
-
code: "unsupported",
|
|
20069
|
-
message: `DeepSeek Harness does not expose command '${command.commandId}'`,
|
|
20070
|
-
retryable: false
|
|
20071
|
-
}
|
|
20072
|
-
};
|
|
20073
|
-
}
|
|
20074
|
-
const nativeInvocation = definition.id === "dsh.goal" ? "/goal" : definition.invocation;
|
|
20075
|
-
const arguments_ = command.arguments;
|
|
20076
|
-
if (definition.argumentMode === "none") {
|
|
20077
|
-
return arguments_ && Object.keys(arguments_).length > 0 ? invalidArguments(`DeepSeek Harness ${nativeInvocation} command does not accept arguments`) : { ok: true, value: { commandId: definition.id, line: nativeInvocation } };
|
|
20404
|
+
var requestFields = /* @__PURE__ */ new Set([
|
|
20405
|
+
...requestTokenFields,
|
|
20406
|
+
"requestId",
|
|
20407
|
+
"historical",
|
|
20408
|
+
"model",
|
|
20409
|
+
"provider"
|
|
20410
|
+
]);
|
|
20411
|
+
function parseHostUsageRequest(value) {
|
|
20412
|
+
if (!isRecord(value))
|
|
20413
|
+
throw new Error("Harness Usage request must be an object");
|
|
20414
|
+
for (const key of Object.keys(value)) {
|
|
20415
|
+
if (!requestFields.has(key)) {
|
|
20416
|
+
throw new Error(`Harness Usage request contains unknown field '${key}'`);
|
|
20417
|
+
}
|
|
20078
20418
|
}
|
|
20079
|
-
if (
|
|
20080
|
-
|
|
20419
|
+
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
20420
|
+
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
20081
20421
|
}
|
|
20082
|
-
|
|
20083
|
-
|
|
20422
|
+
for (const field of ["model", "provider"]) {
|
|
20423
|
+
const candidate = value[field];
|
|
20424
|
+
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
20425
|
+
throw new Error(`Harness Usage request '${field}' must be a non-empty string`);
|
|
20426
|
+
}
|
|
20084
20427
|
}
|
|
20085
|
-
|
|
20086
|
-
|
|
20087
|
-
return invalidArguments("DeepSeek Harness /goal edit command requires a replacement objective");
|
|
20428
|
+
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
20429
|
+
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
20088
20430
|
}
|
|
20089
|
-
|
|
20090
|
-
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
line: text.length > 0 ? `${nativeInvocation} ${text}` : nativeInvocation
|
|
20431
|
+
for (const field of requestTokenFields) {
|
|
20432
|
+
const candidate = value[field];
|
|
20433
|
+
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
20434
|
+
throw new Error(`Harness Usage request '${field}' must be a non-negative safe integer`);
|
|
20094
20435
|
}
|
|
20095
|
-
};
|
|
20096
|
-
}
|
|
20097
|
-
|
|
20098
|
-
// dist/generation-selector.js
|
|
20099
|
-
import { spawn } from "node:child_process";
|
|
20100
|
-
|
|
20101
|
-
// dist/executable.js
|
|
20102
|
-
import { spawnSync } from "node:child_process";
|
|
20103
|
-
import { accessSync, constants, statSync } from "node:fs";
|
|
20104
|
-
import path5 from "node:path";
|
|
20105
|
-
function environmentValue2(environment, name) {
|
|
20106
|
-
return Object.entries(environment).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
20107
|
-
}
|
|
20108
|
-
function executableCandidates(command, environment) {
|
|
20109
|
-
const targetPath2 = process.platform === "win32" ? path5.win32 : path5.posix;
|
|
20110
|
-
if (targetPath2.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
20111
|
-
return [command];
|
|
20112
20436
|
}
|
|
20113
|
-
|
|
20114
|
-
|
|
20115
|
-
}
|
|
20116
|
-
function resolveExecutable(command, environment) {
|
|
20117
|
-
const accessMode = process.platform === "win32" ? constants.F_OK : constants.X_OK;
|
|
20118
|
-
for (const candidate of executableCandidates(command, environment)) {
|
|
20119
|
-
try {
|
|
20120
|
-
accessSync(candidate, accessMode);
|
|
20121
|
-
if (statSync(candidate).isFile())
|
|
20122
|
-
return candidate;
|
|
20123
|
-
} catch {
|
|
20124
|
-
}
|
|
20437
|
+
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
20438
|
+
throw new Error("Harness Usage request must contain 'inputTokens' and 'outputTokens'");
|
|
20125
20439
|
}
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
if (configured) {
|
|
20130
|
-
const command = resolveExecutable(configured, environment);
|
|
20131
|
-
return command ? { command, arguments: [], kind: "configured" } : null;
|
|
20440
|
+
const request = value;
|
|
20441
|
+
if ((request.cachedInputTokens ?? 0) + (request.cacheWriteInputTokens ?? 0) > request.inputTokens) {
|
|
20442
|
+
throw new Error("Harness Usage request cache Tokens must not exceed 'inputTokens'");
|
|
20132
20443
|
}
|
|
20133
|
-
|
|
20134
|
-
|
|
20135
|
-
return { command: dsh, arguments: [], kind: "dsh" };
|
|
20136
|
-
const npx = resolveExecutable(process.platform === "win32" ? "npx.cmd" : "npx", environment);
|
|
20137
|
-
return npx ? {
|
|
20138
|
-
command: npx,
|
|
20139
|
-
arguments: ["--offline", "--no-install", "@deepseek-ai/dsh"],
|
|
20140
|
-
kind: "npx"
|
|
20141
|
-
} : null;
|
|
20142
|
-
}
|
|
20143
|
-
function deepSeekProcessInvocation(command, arguments_, environment, platform = process.platform) {
|
|
20144
|
-
const extension2 = path5.win32.extname(command).toLowerCase();
|
|
20145
|
-
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension2)) {
|
|
20146
|
-
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
20444
|
+
if ((request.reasoningOutputTokens ?? 0) > request.outputTokens) {
|
|
20445
|
+
throw new Error("Harness Usage request 'reasoningOutputTokens' must not exceed 'outputTokens'");
|
|
20147
20446
|
}
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
return {
|
|
20151
|
-
command: environmentValue2(environment, "ComSpec") ?? "cmd.exe",
|
|
20152
|
-
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
20153
|
-
windowsVerbatimArguments: true
|
|
20154
|
-
};
|
|
20155
|
-
}
|
|
20156
|
-
function resolveWindowsTaskkillPath(environment) {
|
|
20157
|
-
const systemRoot = environmentValue2(environment, "SystemRoot") ?? environmentValue2(environment, "windir");
|
|
20158
|
-
if (!systemRoot || !/^[A-Za-z]:[\\/]/u.test(systemRoot)) {
|
|
20159
|
-
throw new Error("Windows SystemRoot is unavailable or invalid");
|
|
20447
|
+
if (request.cacheWrite1hInputTokens !== void 0 && request.cacheWrite1hInputTokens > (request.cacheWriteInputTokens ?? -1)) {
|
|
20448
|
+
throw new Error("Harness Usage request 'cacheWrite1hInputTokens' must not exceed 'cacheWriteInputTokens'");
|
|
20160
20449
|
}
|
|
20161
|
-
|
|
20162
|
-
|
|
20163
|
-
function killDeepSeekProcessTree(child, platform, timeoutMs) {
|
|
20164
|
-
if (!child.pid) {
|
|
20165
|
-
if (child.exitCode === null && child.signalCode === null)
|
|
20166
|
-
child.kill("SIGKILL");
|
|
20167
|
-
return;
|
|
20450
|
+
if (request.startedAtMs === void 0 !== (request.completedAtMs === void 0)) {
|
|
20451
|
+
throw new Error("Harness Usage request timing fields must be provided together");
|
|
20168
20452
|
}
|
|
20169
|
-
if (
|
|
20170
|
-
|
|
20171
|
-
stdio: "ignore",
|
|
20172
|
-
windowsHide: true,
|
|
20173
|
-
timeout: timeoutMs
|
|
20174
|
-
});
|
|
20175
|
-
if (result.error)
|
|
20176
|
-
throw result.error;
|
|
20177
|
-
return;
|
|
20178
|
-
}
|
|
20179
|
-
try {
|
|
20180
|
-
process.kill(-child.pid, "SIGKILL");
|
|
20181
|
-
} catch (error51) {
|
|
20182
|
-
if (typeof error51 !== "object" || error51 === null || Reflect.get(error51, "code") !== "ESRCH") {
|
|
20183
|
-
throw error51;
|
|
20184
|
-
}
|
|
20453
|
+
if (request.startedAtMs !== void 0 && request.completedAtMs !== void 0 && request.completedAtMs < request.startedAtMs) {
|
|
20454
|
+
throw new Error("Harness Usage request 'completedAtMs' must not precede 'startedAtMs'");
|
|
20185
20455
|
}
|
|
20456
|
+
return { ...request };
|
|
20186
20457
|
}
|
|
20187
20458
|
|
|
20188
20459
|
// dist/profiles/v4.js
|
|
@@ -20559,16 +20830,16 @@ var Diff = class {
|
|
|
20559
20830
|
}
|
|
20560
20831
|
}
|
|
20561
20832
|
}
|
|
20562
|
-
addToPath(
|
|
20563
|
-
const last =
|
|
20833
|
+
addToPath(path9, added, removed, oldPosInc, options) {
|
|
20834
|
+
const last = path9.lastComponent;
|
|
20564
20835
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
20565
20836
|
return {
|
|
20566
|
-
oldPos:
|
|
20837
|
+
oldPos: path9.oldPos + oldPosInc,
|
|
20567
20838
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
20568
20839
|
};
|
|
20569
20840
|
} else {
|
|
20570
20841
|
return {
|
|
20571
|
-
oldPos:
|
|
20842
|
+
oldPos: path9.oldPos + oldPosInc,
|
|
20572
20843
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
20573
20844
|
};
|
|
20574
20845
|
}
|
|
@@ -21765,6 +22036,349 @@ var DEEPSEEK_V4_PROFILE = Object.freeze({
|
|
|
21765
22036
|
settlementUsage
|
|
21766
22037
|
});
|
|
21767
22038
|
|
|
22039
|
+
// dist/modern/usage-metering.js
|
|
22040
|
+
function isRecord5(value) {
|
|
22041
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22042
|
+
}
|
|
22043
|
+
function count2(value) {
|
|
22044
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
22045
|
+
}
|
|
22046
|
+
function firstTokenTime(chunks) {
|
|
22047
|
+
for (const { time: time3, chunk } of chunks) {
|
|
22048
|
+
if ((chunk.type === "reasoning-delta" || chunk.type === "text-delta") && typeof chunk.text === "string" && chunk.text.length > 0 || chunk.type === "tool-call-delta" && typeof chunk.name === "string" && chunk.name.length > 0) {
|
|
22049
|
+
return time3;
|
|
22050
|
+
}
|
|
22051
|
+
}
|
|
22052
|
+
return null;
|
|
22053
|
+
}
|
|
22054
|
+
function deepSeekUsageRecord(event, historical) {
|
|
22055
|
+
if (event.type !== "assistant/message" || event.surfaceOp !== "append")
|
|
22056
|
+
return { kind: "none" };
|
|
22057
|
+
const data = isRecord5(event.data) ? event.data : null;
|
|
22058
|
+
const message = data && isRecord5(data.message) ? data.message : null;
|
|
22059
|
+
const source = message && isRecord5(message.source) ? message.source : null;
|
|
22060
|
+
if (!data || !message || source?.kind !== "model")
|
|
22061
|
+
return { kind: "none" };
|
|
22062
|
+
if (typeof message.id !== "string" || message.id.length === 0)
|
|
22063
|
+
return { kind: "missing" };
|
|
22064
|
+
if (typeof source.model !== "string" || source.model.length === 0)
|
|
22065
|
+
return { kind: "missing" };
|
|
22066
|
+
let chunks;
|
|
22067
|
+
try {
|
|
22068
|
+
chunks = expandAssistantStream(data.stream);
|
|
22069
|
+
} catch {
|
|
22070
|
+
return { kind: "missing" };
|
|
22071
|
+
}
|
|
22072
|
+
let usage = data.usage;
|
|
22073
|
+
for (const { chunk } of chunks)
|
|
22074
|
+
if (chunk.type === "usage")
|
|
22075
|
+
usage = chunk.usage;
|
|
22076
|
+
if (usage === void 0)
|
|
22077
|
+
return data.interrupted === true ? { kind: "none" } : { kind: "missing" };
|
|
22078
|
+
if (!isRecord5(usage))
|
|
22079
|
+
return { kind: "missing" };
|
|
22080
|
+
const input = count2(usage.inputTokens);
|
|
22081
|
+
const output = count2(usage.outputTokens);
|
|
22082
|
+
const cacheRead = count2(usage.cacheReadTokens ?? 0);
|
|
22083
|
+
const cacheWrite = count2(usage.cacheWriteTokens ?? 0);
|
|
22084
|
+
const reasoning2 = usage.reasoningTokens === void 0 ? null : count2(usage.reasoningTokens);
|
|
22085
|
+
if (input === null || output === null || cacheRead === null || cacheWrite === null) {
|
|
22086
|
+
return { kind: "missing" };
|
|
22087
|
+
}
|
|
22088
|
+
const startedAtMs = historical ? null : firstTokenTime(chunks);
|
|
22089
|
+
const completedAtMs = typeof event.time === "number" ? event.time : null;
|
|
22090
|
+
try {
|
|
22091
|
+
return {
|
|
22092
|
+
kind: "request",
|
|
22093
|
+
request: parseHostUsageRequest({
|
|
22094
|
+
requestId: message.id,
|
|
22095
|
+
...historical ? { historical: true } : {},
|
|
22096
|
+
model: source.model,
|
|
22097
|
+
inputTokens: input + cacheRead + cacheWrite,
|
|
22098
|
+
cachedInputTokens: cacheRead,
|
|
22099
|
+
cacheWriteInputTokens: cacheWrite,
|
|
22100
|
+
outputTokens: output,
|
|
22101
|
+
...reasoning2 !== null && reasoning2 <= output ? { reasoningOutputTokens: reasoning2 } : {},
|
|
22102
|
+
...startedAtMs !== null && completedAtMs !== null && completedAtMs >= startedAtMs ? { startedAtMs, completedAtMs } : {}
|
|
22103
|
+
})
|
|
22104
|
+
};
|
|
22105
|
+
} catch {
|
|
22106
|
+
return { kind: "missing" };
|
|
22107
|
+
}
|
|
22108
|
+
}
|
|
22109
|
+
function deepSeekUsageHistory(events) {
|
|
22110
|
+
const requests = /* @__PURE__ */ new Map();
|
|
22111
|
+
let complete = true;
|
|
22112
|
+
for (const event of events) {
|
|
22113
|
+
const record2 = deepSeekUsageRecord(event, true);
|
|
22114
|
+
if (record2.kind === "request")
|
|
22115
|
+
requests.set(record2.request.requestId, record2.request);
|
|
22116
|
+
else if (record2.kind === "missing")
|
|
22117
|
+
complete = false;
|
|
22118
|
+
}
|
|
22119
|
+
return { requests: [...requests.values()], complete };
|
|
22120
|
+
}
|
|
22121
|
+
|
|
22122
|
+
// dist/modern/usage-statistics.js
|
|
22123
|
+
var SESSION_FILE = /^session(?:\.v(\d+))?\.jsonl(\.zstd)?$/u;
|
|
22124
|
+
var ZSTD_MAGIC = 4247762216;
|
|
22125
|
+
function dshHome(environment) {
|
|
22126
|
+
return environment.DSH_HOME || path5.join(environment.HOME || os2.homedir(), ".dsh");
|
|
22127
|
+
}
|
|
22128
|
+
function zstdFrames(buffer) {
|
|
22129
|
+
const frames = [];
|
|
22130
|
+
let offset = 0;
|
|
22131
|
+
while (offset + 8 <= buffer.length) {
|
|
22132
|
+
const magic = buffer.readUInt32LE(offset);
|
|
22133
|
+
if ((magic & 4294967280) === 407710288) {
|
|
22134
|
+
offset += 8 + buffer.readUInt32LE(offset + 4);
|
|
22135
|
+
continue;
|
|
22136
|
+
}
|
|
22137
|
+
if (magic !== ZSTD_MAGIC)
|
|
22138
|
+
throw new Error("dsh session file is not zstd");
|
|
22139
|
+
const start = offset;
|
|
22140
|
+
const descriptor = buffer[offset + 4] ?? 0;
|
|
22141
|
+
const single = descriptor >> 5 & 1;
|
|
22142
|
+
offset += 5 + (single ? 0 : 1);
|
|
22143
|
+
offset += [0, 1, 2, 4][descriptor & 3] ?? 0;
|
|
22144
|
+
offset += [single, 2, 4, 8][descriptor >> 6] ?? 0;
|
|
22145
|
+
for (; ; ) {
|
|
22146
|
+
if (offset + 3 > buffer.length)
|
|
22147
|
+
return frames;
|
|
22148
|
+
const header = buffer.readUIntLE(offset, 3);
|
|
22149
|
+
const type = header >> 1 & 3;
|
|
22150
|
+
if (type === 3)
|
|
22151
|
+
throw new Error("dsh session file has a reserved zstd block");
|
|
22152
|
+
offset += 3 + (type === 1 ? 1 : header >>> 3);
|
|
22153
|
+
if (header & 1)
|
|
22154
|
+
break;
|
|
22155
|
+
}
|
|
22156
|
+
if (descriptor >> 2 & 1)
|
|
22157
|
+
offset += 4;
|
|
22158
|
+
if (offset > buffer.length)
|
|
22159
|
+
return frames;
|
|
22160
|
+
frames.push(buffer.subarray(start, offset));
|
|
22161
|
+
}
|
|
22162
|
+
return frames;
|
|
22163
|
+
}
|
|
22164
|
+
async function readDshUsage(file2) {
|
|
22165
|
+
const buffer = await readFile2(file2);
|
|
22166
|
+
const text = file2.endsWith(".zstd") ? zstdFrames(buffer).map((frame) => zstdDecompressSync(frame).toString("utf8")).join("") : buffer.toString("utf8");
|
|
22167
|
+
const entries = [];
|
|
22168
|
+
let session = {};
|
|
22169
|
+
for (const line of text.split("\n")) {
|
|
22170
|
+
if (entries.length === 0 && line.startsWith('{"type":"session"')) {
|
|
22171
|
+
try {
|
|
22172
|
+
const header = JSON.parse(line);
|
|
22173
|
+
session = {
|
|
22174
|
+
...typeof header.id === "string" ? { sessionId: header.id } : {},
|
|
22175
|
+
...typeof header.cwd === "string" ? { cwd: header.cwd } : {}
|
|
22176
|
+
};
|
|
22177
|
+
} catch {
|
|
22178
|
+
}
|
|
22179
|
+
continue;
|
|
22180
|
+
}
|
|
22181
|
+
if (!line.includes('"assistant/message"'))
|
|
22182
|
+
continue;
|
|
22183
|
+
let event;
|
|
22184
|
+
try {
|
|
22185
|
+
event = JSON.parse(line);
|
|
22186
|
+
} catch {
|
|
22187
|
+
continue;
|
|
22188
|
+
}
|
|
22189
|
+
const record2 = deepSeekUsageRecord(event, true);
|
|
22190
|
+
const entry = record2.kind === "request" && usageEntryFromRequest(record2.request, event.time);
|
|
22191
|
+
if (entry)
|
|
22192
|
+
entries.push(withUsageSession(entry, session));
|
|
22193
|
+
}
|
|
22194
|
+
return entries;
|
|
22195
|
+
}
|
|
22196
|
+
function createDshUsageStatistics(environment) {
|
|
22197
|
+
return Object.freeze({
|
|
22198
|
+
async listSources(signal) {
|
|
22199
|
+
const root = path5.join(dshHome(environment), "sessions");
|
|
22200
|
+
const sources = [];
|
|
22201
|
+
for (const project2 of await readdir(root).catch(() => [])) {
|
|
22202
|
+
for (const session of await readdir(path5.join(root, project2)).catch(() => [])) {
|
|
22203
|
+
signal.throwIfAborted();
|
|
22204
|
+
const directory = path5.join(root, project2, session);
|
|
22205
|
+
const latest = (await readdir(directory).catch(() => [])).map((name) => ({ name, version: Number(SESSION_FILE.exec(name)?.[1] ?? 1) })).filter(({ name }) => SESSION_FILE.test(name)).sort((left, right) => right.version - left.version)[0];
|
|
22206
|
+
if (!latest)
|
|
22207
|
+
continue;
|
|
22208
|
+
const file2 = path5.join(directory, latest.name);
|
|
22209
|
+
const info = await lstat(file2).catch(() => null);
|
|
22210
|
+
if (info?.isFile() && info.size > 0) {
|
|
22211
|
+
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
22212
|
+
}
|
|
22213
|
+
}
|
|
22214
|
+
}
|
|
22215
|
+
return sources;
|
|
22216
|
+
},
|
|
22217
|
+
readSource: (id) => readDshUsage(id)
|
|
22218
|
+
});
|
|
22219
|
+
}
|
|
22220
|
+
|
|
22221
|
+
// dist/harness-commands.js
|
|
22222
|
+
var commandDefinitions = [
|
|
22223
|
+
{
|
|
22224
|
+
id: "dsh.compact",
|
|
22225
|
+
invocation: "/compact",
|
|
22226
|
+
label: "Compact context",
|
|
22227
|
+
description: "Compact the current conversation context",
|
|
22228
|
+
argumentMode: "none"
|
|
22229
|
+
},
|
|
22230
|
+
{
|
|
22231
|
+
id: "dsh.goal",
|
|
22232
|
+
invocation: "/dsh-goal",
|
|
22233
|
+
label: "Goal",
|
|
22234
|
+
description: "Set or view the goal for a long-running task",
|
|
22235
|
+
argumentMode: "text"
|
|
22236
|
+
},
|
|
22237
|
+
{
|
|
22238
|
+
id: "dsh.plan",
|
|
22239
|
+
invocation: "/plan",
|
|
22240
|
+
label: "Plan mode",
|
|
22241
|
+
description: "Enter or leave plan mode",
|
|
22242
|
+
argumentMode: "text"
|
|
22243
|
+
}
|
|
22244
|
+
];
|
|
22245
|
+
function invalidArguments(message) {
|
|
22246
|
+
return {
|
|
22247
|
+
ok: false,
|
|
22248
|
+
error: { code: "invalidRequest", message, retryable: false }
|
|
22249
|
+
};
|
|
22250
|
+
}
|
|
22251
|
+
function deepSeekHarnessCommandCatalog() {
|
|
22252
|
+
return harnessCommandCatalogSchema.parse({
|
|
22253
|
+
commands: commandDefinitions
|
|
22254
|
+
});
|
|
22255
|
+
}
|
|
22256
|
+
function parseDeepSeekHarnessCommand(command) {
|
|
22257
|
+
const definition = commandDefinitions.find(({ id }) => id === command.commandId);
|
|
22258
|
+
if (!definition) {
|
|
22259
|
+
return {
|
|
22260
|
+
ok: false,
|
|
22261
|
+
error: {
|
|
22262
|
+
code: "unsupported",
|
|
22263
|
+
message: `DeepSeek Harness does not expose command '${command.commandId}'`,
|
|
22264
|
+
retryable: false
|
|
22265
|
+
}
|
|
22266
|
+
};
|
|
22267
|
+
}
|
|
22268
|
+
const nativeInvocation = definition.id === "dsh.goal" ? "/goal" : definition.invocation;
|
|
22269
|
+
const arguments_ = command.arguments;
|
|
22270
|
+
if (definition.argumentMode === "none") {
|
|
22271
|
+
return arguments_ && Object.keys(arguments_).length > 0 ? invalidArguments(`DeepSeek Harness ${nativeInvocation} command does not accept arguments`) : { ok: true, value: { commandId: definition.id, line: nativeInvocation } };
|
|
22272
|
+
}
|
|
22273
|
+
if (arguments_?.text !== void 0 && typeof arguments_.text !== "string") {
|
|
22274
|
+
return invalidArguments(`DeepSeek Harness ${nativeInvocation} command argument 'text' must be a string`);
|
|
22275
|
+
}
|
|
22276
|
+
if (arguments_ && Object.keys(arguments_).some((key) => key !== "text")) {
|
|
22277
|
+
return invalidArguments(`DeepSeek Harness ${nativeInvocation} command has an unknown argument`);
|
|
22278
|
+
}
|
|
22279
|
+
const text = arguments_?.text?.trim() ?? "";
|
|
22280
|
+
if (definition.id === "dsh.goal" && text.toLowerCase() === "edit") {
|
|
22281
|
+
return invalidArguments("DeepSeek Harness /goal edit command requires a replacement objective");
|
|
22282
|
+
}
|
|
22283
|
+
return {
|
|
22284
|
+
ok: true,
|
|
22285
|
+
value: {
|
|
22286
|
+
commandId: definition.id,
|
|
22287
|
+
line: text.length > 0 ? `${nativeInvocation} ${text}` : nativeInvocation
|
|
22288
|
+
}
|
|
22289
|
+
};
|
|
22290
|
+
}
|
|
22291
|
+
|
|
22292
|
+
// dist/generation-selector.js
|
|
22293
|
+
import { spawn } from "node:child_process";
|
|
22294
|
+
|
|
22295
|
+
// dist/executable.js
|
|
22296
|
+
import { spawnSync } from "node:child_process";
|
|
22297
|
+
import { accessSync, constants, statSync } from "node:fs";
|
|
22298
|
+
import path6 from "node:path";
|
|
22299
|
+
function environmentValue2(environment, name) {
|
|
22300
|
+
return Object.entries(environment).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
22301
|
+
}
|
|
22302
|
+
function executableCandidates(command, environment) {
|
|
22303
|
+
const targetPath2 = process.platform === "win32" ? path6.win32 : path6.posix;
|
|
22304
|
+
if (targetPath2.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
22305
|
+
return [command];
|
|
22306
|
+
}
|
|
22307
|
+
const extensions = process.platform === "win32" && targetPath2.extname(command) === "" ? (environmentValue2(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension2) => extension2.trim()).filter(Boolean) : [""];
|
|
22308
|
+
return (environmentValue2(environment, "PATH") ?? "").split(targetPath2.delimiter).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean).flatMap((directory) => extensions.map((extension2) => targetPath2.join(directory, command + extension2)));
|
|
22309
|
+
}
|
|
22310
|
+
function resolveExecutable(command, environment) {
|
|
22311
|
+
const accessMode = process.platform === "win32" ? constants.F_OK : constants.X_OK;
|
|
22312
|
+
for (const candidate of executableCandidates(command, environment)) {
|
|
22313
|
+
try {
|
|
22314
|
+
accessSync(candidate, accessMode);
|
|
22315
|
+
if (statSync(candidate).isFile())
|
|
22316
|
+
return candidate;
|
|
22317
|
+
} catch {
|
|
22318
|
+
}
|
|
22319
|
+
}
|
|
22320
|
+
return null;
|
|
22321
|
+
}
|
|
22322
|
+
function resolveDeepSeekCommand(configured, environment) {
|
|
22323
|
+
if (configured) {
|
|
22324
|
+
const command = resolveExecutable(configured, environment);
|
|
22325
|
+
return command ? { command, arguments: [], kind: "configured" } : null;
|
|
22326
|
+
}
|
|
22327
|
+
const dsh = resolveExecutable("dsh", environment);
|
|
22328
|
+
if (dsh)
|
|
22329
|
+
return { command: dsh, arguments: [], kind: "dsh" };
|
|
22330
|
+
const npx = resolveExecutable(process.platform === "win32" ? "npx.cmd" : "npx", environment);
|
|
22331
|
+
return npx ? {
|
|
22332
|
+
command: npx,
|
|
22333
|
+
arguments: ["--offline", "--no-install", "@deepseek-ai/dsh"],
|
|
22334
|
+
kind: "npx"
|
|
22335
|
+
} : null;
|
|
22336
|
+
}
|
|
22337
|
+
function deepSeekProcessInvocation(command, arguments_, environment, platform = process.platform) {
|
|
22338
|
+
const extension2 = path6.win32.extname(command).toLowerCase();
|
|
22339
|
+
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension2)) {
|
|
22340
|
+
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
22341
|
+
}
|
|
22342
|
+
const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
|
|
22343
|
+
const commandLine = [command, ...arguments_].map(quote).join(" ");
|
|
22344
|
+
return {
|
|
22345
|
+
command: environmentValue2(environment, "ComSpec") ?? "cmd.exe",
|
|
22346
|
+
arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
|
|
22347
|
+
windowsVerbatimArguments: true
|
|
22348
|
+
};
|
|
22349
|
+
}
|
|
22350
|
+
function resolveWindowsTaskkillPath(environment) {
|
|
22351
|
+
const systemRoot = environmentValue2(environment, "SystemRoot") ?? environmentValue2(environment, "windir");
|
|
22352
|
+
if (!systemRoot || !/^[A-Za-z]:[\\/]/u.test(systemRoot)) {
|
|
22353
|
+
throw new Error("Windows SystemRoot is unavailable or invalid");
|
|
22354
|
+
}
|
|
22355
|
+
return path6.win32.join(systemRoot, "System32", "taskkill.exe");
|
|
22356
|
+
}
|
|
22357
|
+
function killDeepSeekProcessTree(child, platform, timeoutMs) {
|
|
22358
|
+
if (!child.pid) {
|
|
22359
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
22360
|
+
child.kill("SIGKILL");
|
|
22361
|
+
return;
|
|
22362
|
+
}
|
|
22363
|
+
if (platform === "win32") {
|
|
22364
|
+
const result = spawnSync(resolveWindowsTaskkillPath(process.env), ["/pid", String(child.pid), "/t", "/f"], {
|
|
22365
|
+
stdio: "ignore",
|
|
22366
|
+
windowsHide: true,
|
|
22367
|
+
timeout: timeoutMs
|
|
22368
|
+
});
|
|
22369
|
+
if (result.error)
|
|
22370
|
+
throw result.error;
|
|
22371
|
+
return;
|
|
22372
|
+
}
|
|
22373
|
+
try {
|
|
22374
|
+
process.kill(-child.pid, "SIGKILL");
|
|
22375
|
+
} catch (error51) {
|
|
22376
|
+
if (typeof error51 !== "object" || error51 === null || Reflect.get(error51, "code") !== "ESRCH") {
|
|
22377
|
+
throw error51;
|
|
22378
|
+
}
|
|
22379
|
+
}
|
|
22380
|
+
}
|
|
22381
|
+
|
|
21768
22382
|
// dist/profiles/profile.js
|
|
21769
22383
|
var DEEPSEEK_MINIMUM_VERSION = DEEPSEEK_V4_FIRST_VERSION;
|
|
21770
22384
|
var MINIMUM = parseSemVer(DEEPSEEK_MINIMUM_VERSION);
|
|
@@ -22137,7 +22751,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
22137
22751
|
|
|
22138
22752
|
// dist/modern/deepseek-harness-adapter.js
|
|
22139
22753
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
22140
|
-
import
|
|
22754
|
+
import path8 from "node:path";
|
|
22141
22755
|
|
|
22142
22756
|
// dist/modern/catalog.js
|
|
22143
22757
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
@@ -22145,9 +22759,9 @@ import { Buffer as Buffer3 } from "node:buffer";
|
|
|
22145
22759
|
// dist/model-catalog.js
|
|
22146
22760
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
22147
22761
|
var MODEL_REF_PREFIX = "deepseek-harness-model-v2.";
|
|
22148
|
-
function encodeDeepSeekHarnessModelRef(
|
|
22149
|
-
const provider =
|
|
22150
|
-
const modelId =
|
|
22762
|
+
function encodeDeepSeekHarnessModelRef(model2) {
|
|
22763
|
+
const provider = model2.provider.trim();
|
|
22764
|
+
const modelId = model2.model.trim();
|
|
22151
22765
|
if (!provider || !modelId)
|
|
22152
22766
|
throw new Error("DeepSeek Harness Model identity must not be empty");
|
|
22153
22767
|
const encoded = Buffer2.from(JSON.stringify([provider, modelId]), "utf8").toString("base64url");
|
|
@@ -22186,8 +22800,8 @@ function parseDeepSeekThinkingOptionId(value) {
|
|
|
22186
22800
|
}
|
|
22187
22801
|
function normalizeDeepSeekThinkingOptions(models) {
|
|
22188
22802
|
const group = models.groups.find((candidate) => candidate.id === models.current.provider);
|
|
22189
|
-
const
|
|
22190
|
-
return (
|
|
22803
|
+
const model2 = group?.models.find((candidate) => candidate.id === models.current.model);
|
|
22804
|
+
return (model2?.reasoning?.efforts ?? []).flatMap((effort) => {
|
|
22191
22805
|
const parsedId = harnessThinkingOptionIdSchema.safeParse(effort.id);
|
|
22192
22806
|
return parsedId.success ? [{ id: parsedId.data, label: effort.name }] : [];
|
|
22193
22807
|
});
|
|
@@ -22196,8 +22810,8 @@ function normalizeDeepSeekModelCatalog(groups2, selection2) {
|
|
|
22196
22810
|
const thinkingOptions = [];
|
|
22197
22811
|
const knownEffortIds = /* @__PURE__ */ new Set();
|
|
22198
22812
|
for (const group of groups2) {
|
|
22199
|
-
for (const
|
|
22200
|
-
for (const effort of
|
|
22813
|
+
for (const model2 of group.models) {
|
|
22814
|
+
for (const effort of model2.reasoning?.efforts ?? []) {
|
|
22201
22815
|
if (knownEffortIds.has(effort.id))
|
|
22202
22816
|
continue;
|
|
22203
22817
|
const parsedId = harnessThinkingOptionIdSchema.safeParse(effort.id);
|
|
@@ -22208,16 +22822,16 @@ function normalizeDeepSeekModelCatalog(groups2, selection2) {
|
|
|
22208
22822
|
}
|
|
22209
22823
|
}
|
|
22210
22824
|
}
|
|
22211
|
-
const models = groups2.flatMap((group) => group.models.map((
|
|
22212
|
-
ref: encodeDeepSeekHarnessModelRef({ provider: group.id, model:
|
|
22213
|
-
label: `${group.name} / ${
|
|
22214
|
-
...
|
|
22825
|
+
const models = groups2.flatMap((group) => group.models.map((model2) => ({
|
|
22826
|
+
ref: encodeDeepSeekHarnessModelRef({ provider: group.id, model: model2.id }),
|
|
22827
|
+
label: `${group.name} / ${model2.name}`,
|
|
22828
|
+
...model2.reasoning && model2.reasoning.efforts.length > 0 ? { supportedThinkingOptionIds: model2.reasoning.efforts.map((effort) => effort.id) } : {}
|
|
22215
22829
|
})));
|
|
22216
22830
|
const defaultModel = selection2 ? encodeDeepSeekHarnessModelRef(selection2) : void 0;
|
|
22217
|
-
if (selection2 && defaultModel && !models.some((
|
|
22831
|
+
if (selection2 && defaultModel && !models.some((model2) => model2.ref.id === defaultModel.id)) {
|
|
22218
22832
|
models.unshift({ ref: defaultModel, label: `${selection2.provider} / ${selection2.model}` });
|
|
22219
22833
|
}
|
|
22220
|
-
const defaultReasoning = selection2 ? groups2.find((group) => group.id === selection2.provider)?.models.find((
|
|
22834
|
+
const defaultReasoning = selection2 ? groups2.find((group) => group.id === selection2.provider)?.models.find((model2) => model2.id === selection2.model)?.reasoning : void 0;
|
|
22221
22835
|
const defaultThinkingOptionId = parseDeepSeekThinkingOptionId(selection2?.reasoningEffort ?? defaultReasoning?.defaultEffort);
|
|
22222
22836
|
return harnessModelCatalogSchema.parse({
|
|
22223
22837
|
models,
|
|
@@ -23402,32 +24016,32 @@ function groups(value, routable) {
|
|
|
23402
24016
|
throw catalogError("protocolError", "DeepSeek Harness returned a non-routable Model group");
|
|
23403
24017
|
}
|
|
23404
24018
|
const name = boundedString(candidate.name, MAX_NAME_LENGTH, "Model provider name");
|
|
23405
|
-
const models = array2(candidate.models, MAX_MODELS, "Model list").map((
|
|
24019
|
+
const models = array2(candidate.models, MAX_MODELS, "Model list").map((model2) => {
|
|
23406
24020
|
modelCount += 1;
|
|
23407
24021
|
if (modelCount > MAX_MODELS) {
|
|
23408
24022
|
throw catalogError("limitExceeded", "DeepSeek Harness Model list exceeded its item bound");
|
|
23409
24023
|
}
|
|
23410
|
-
if (!isPlainRecord(
|
|
24024
|
+
if (!isPlainRecord(model2) || !exactKeys2(model2, ["id", "name"], ["description", "reasoning"])) {
|
|
23411
24025
|
throw catalogError("protocolError", "DeepSeek Harness returned an invalid Model");
|
|
23412
24026
|
}
|
|
23413
|
-
const modelId = boundedString(
|
|
23414
|
-
const modelName = boundedString(
|
|
24027
|
+
const modelId = boundedString(model2.id, MAX_ID_LENGTH, "Model id");
|
|
24028
|
+
const modelName = boundedString(model2.name, MAX_NAME_LENGTH, "Model name");
|
|
23415
24029
|
if (`${name} / ${modelName}`.length > HARNESS_MODEL_LABEL_MAX_LENGTH) {
|
|
23416
24030
|
throw catalogError("protocolError", "DeepSeek Harness returned a Model label that is too long");
|
|
23417
24031
|
}
|
|
23418
24032
|
return {
|
|
23419
24033
|
id: modelId,
|
|
23420
24034
|
name: modelName,
|
|
23421
|
-
...
|
|
23422
|
-
description: boundedString(
|
|
24035
|
+
...model2.description === void 0 ? {} : {
|
|
24036
|
+
description: boundedString(model2.description, MAX_DESCRIPTION_LENGTH, "Model description", true)
|
|
23423
24037
|
},
|
|
23424
|
-
...
|
|
24038
|
+
...model2.reasoning === void 0 ? {} : { reasoning: reasoning(model2.reasoning) }
|
|
23425
24039
|
};
|
|
23426
24040
|
});
|
|
23427
24041
|
if (models.length === 0) {
|
|
23428
24042
|
throw catalogError("protocolError", "DeepSeek Harness returned an empty Model provider group");
|
|
23429
24043
|
}
|
|
23430
|
-
const modelIds = models.map((
|
|
24044
|
+
const modelIds = models.map((model2) => model2.id);
|
|
23431
24045
|
if (new Set(modelIds).size !== modelIds.length) {
|
|
23432
24046
|
throw catalogError("protocolError", "DeepSeek Harness returned duplicate Model ids");
|
|
23433
24047
|
}
|
|
@@ -23638,11 +24252,11 @@ function sanitizedError(error51, fallback) {
|
|
|
23638
24252
|
failure.name = redactModernCredential(error51 instanceof Error ? error51.name : "Error");
|
|
23639
24253
|
return failure;
|
|
23640
24254
|
}
|
|
23641
|
-
function
|
|
24255
|
+
function isRecord6(value) {
|
|
23642
24256
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23643
24257
|
}
|
|
23644
24258
|
function isPlainRecord3(value) {
|
|
23645
|
-
if (!
|
|
24259
|
+
if (!isRecord6(value))
|
|
23646
24260
|
return false;
|
|
23647
24261
|
const prototype = Object.getPrototypeOf(value);
|
|
23648
24262
|
return prototype === Object.prototype || prototype === null;
|
|
@@ -23792,7 +24406,7 @@ function projectionRow(value, seq) {
|
|
|
23792
24406
|
return Object.freeze({ value: detachedJson(value), seq });
|
|
23793
24407
|
}
|
|
23794
24408
|
function parseProjectionBaseline(value, maxKeys) {
|
|
23795
|
-
if (!
|
|
24409
|
+
if (!isRecord6(value) || !hasExactKeys4(value, ["asOfSeq", "values"])) {
|
|
23796
24410
|
throw storeError("protocolError", "DeepSeek Harness control baseline has invalid projections");
|
|
23797
24411
|
}
|
|
23798
24412
|
if (!validCursor(value.asOfSeq) || !isPlainRecord3(value.values)) {
|
|
@@ -23818,7 +24432,7 @@ function parseProjectionBaseline(value, maxKeys) {
|
|
|
23818
24432
|
return { asOfSeq: value.asOfSeq, values, rowBytes };
|
|
23819
24433
|
}
|
|
23820
24434
|
function parseBaseline(value, maxSessions, maxKeys) {
|
|
23821
|
-
if (!
|
|
24435
|
+
if (!isRecord6(value) || !hasExactKeys4(value, ["projections"]) || !isPlainRecord3(value.projections)) {
|
|
23822
24436
|
throw storeError("protocolError", "DeepSeek Harness control stream emitted an invalid baseline");
|
|
23823
24437
|
}
|
|
23824
24438
|
const sessions = /* @__PURE__ */ new Set();
|
|
@@ -23836,7 +24450,7 @@ function parseBaseline(value, maxSessions, maxKeys) {
|
|
|
23836
24450
|
return { projections };
|
|
23837
24451
|
}
|
|
23838
24452
|
function parseControlFrame(value, maxSessions, maxKeys) {
|
|
23839
|
-
if (!
|
|
24453
|
+
if (!isRecord6(value) || typeof value.type !== "string") {
|
|
23840
24454
|
throw storeError("protocolError", "DeepSeek Harness control stream emitted an invalid frame");
|
|
23841
24455
|
}
|
|
23842
24456
|
if (value.type === "baseline" && hasExactKeys4(value, ["type", "value"])) {
|
|
@@ -24561,14 +25175,14 @@ function parseSelection(value, area) {
|
|
|
24561
25175
|
throw configurationError("protocolError", `DeepSeek Harness returned an invalid ${area}`);
|
|
24562
25176
|
}
|
|
24563
25177
|
const provider = boundedSelectionString(value.provider, `${area} provider`);
|
|
24564
|
-
const
|
|
25178
|
+
const model2 = boundedSelectionString(value.model, `${area} Model`);
|
|
24565
25179
|
if (value.reasoningEffort === void 0)
|
|
24566
|
-
return { provider, model };
|
|
25180
|
+
return { provider, model: model2 };
|
|
24567
25181
|
const effort = harnessThinkingOptionIdSchema.safeParse(value.reasoningEffort);
|
|
24568
25182
|
if (!effort.success) {
|
|
24569
25183
|
throw configurationError("protocolError", `DeepSeek Harness returned an invalid ${area} reasoning effort`);
|
|
24570
25184
|
}
|
|
24571
|
-
return { provider, model, reasoningEffort: effort.data };
|
|
25185
|
+
return { provider, model: model2, reasoningEffort: effort.data };
|
|
24572
25186
|
}
|
|
24573
25187
|
function parseOptionalSelection(value, area) {
|
|
24574
25188
|
return value === null ? null : parseSelection(value, area);
|
|
@@ -24631,22 +25245,22 @@ function readModernConfigurationSnapshot(input) {
|
|
|
24631
25245
|
if (!rows) {
|
|
24632
25246
|
throw configurationError("protocolError", "DeepSeek Harness control state is detached");
|
|
24633
25247
|
}
|
|
24634
|
-
const
|
|
25248
|
+
const model2 = readModernModelSelectionState(rows[MODERN_MODEL_SELECTION_PROJECTION_KEY], input.modelCatalog);
|
|
24635
25249
|
const permission = readModernPermissionModeState(rows[MODERN_PERMISSION_PROJECTION_KEY], input.permissionModes);
|
|
24636
25250
|
return {
|
|
24637
|
-
model,
|
|
24638
|
-
state: stateForSelection(input.nativeRef,
|
|
25251
|
+
model: model2,
|
|
25252
|
+
state: stateForSelection(input.nativeRef, model2.selection, input.modelCatalog, permission?.permissionModeId),
|
|
24639
25253
|
...permission ? { permissionProjectionSeq: permission.projectionSeq } : {}
|
|
24640
25254
|
};
|
|
24641
25255
|
}
|
|
24642
|
-
function modernSelectionForModel(catalog,
|
|
25256
|
+
function modernSelectionForModel(catalog, model2, thinkingOptionId) {
|
|
24643
25257
|
let native;
|
|
24644
25258
|
try {
|
|
24645
|
-
native = decodeDeepSeekHarnessModelRef(
|
|
25259
|
+
native = decodeDeepSeekHarnessModelRef(model2);
|
|
24646
25260
|
} catch (error51) {
|
|
24647
25261
|
throw configurationError("invalidRequest", error51 instanceof Error ? error51.message : "DeepSeek Harness Model is invalid");
|
|
24648
25262
|
}
|
|
24649
|
-
const catalogModel = catalog.catalog.models.find(({ ref }) => ref.id ===
|
|
25263
|
+
const catalogModel = catalog.catalog.models.find(({ ref }) => ref.id === model2.id);
|
|
24650
25264
|
if (!catalogModel) {
|
|
24651
25265
|
throw configurationError("invalidRequest", "DeepSeek Harness Model is unavailable");
|
|
24652
25266
|
}
|
|
@@ -25725,11 +26339,11 @@ function malformedOutcome(event) {
|
|
|
25725
26339
|
function isApprovalOutcome(value) {
|
|
25726
26340
|
return value === "allowed-once" || value === "rejected" || value === "cancelled" || value === "unavailable";
|
|
25727
26341
|
}
|
|
25728
|
-
function
|
|
26342
|
+
function isRecord7(value) {
|
|
25729
26343
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25730
26344
|
}
|
|
25731
26345
|
function isPlainRecord6(value) {
|
|
25732
|
-
if (!
|
|
26346
|
+
if (!isRecord7(value))
|
|
25733
26347
|
return false;
|
|
25734
26348
|
const prototype = Object.getPrototypeOf(value);
|
|
25735
26349
|
return prototype === Object.prototype || prototype === null;
|
|
@@ -28006,6 +28620,10 @@ var ModernHarnessSession = class {
|
|
|
28006
28620
|
this.#fallbackThinkingOptionId = configuration.state.effectiveThinkingOptionId;
|
|
28007
28621
|
this.capabilities = modernSessionCapabilities(this.#permissionModes);
|
|
28008
28622
|
this.outputs = this.#channel.outputs;
|
|
28623
|
+
const usageHistory = deepSeekUsageHistory(this.#events);
|
|
28624
|
+
for (const request of usageHistory.requests)
|
|
28625
|
+
this.#emit({ type: "usage.request", request });
|
|
28626
|
+
this.#emit({ type: "usage.history", complete: usageHistory.complete });
|
|
28009
28627
|
this.commands = {
|
|
28010
28628
|
list: () => this.#listHarnessCommands(),
|
|
28011
28629
|
execute: (command) => this.#executeHarnessCommand(command)
|
|
@@ -28995,6 +29613,7 @@ ${question.detail}` : question.question;
|
|
|
28995
29613
|
this.#validator.accept(event);
|
|
28996
29614
|
this.#observeAssistantSettlement(event);
|
|
28997
29615
|
this.#events.push(event);
|
|
29616
|
+
this.#meterUsage(event);
|
|
28998
29617
|
this.#historyBytes += bytes;
|
|
28999
29618
|
this.#receive(event);
|
|
29000
29619
|
}
|
|
@@ -30070,6 +30689,14 @@ ${question.detail}` : question.question;
|
|
|
30070
30689
|
#emit(event) {
|
|
30071
30690
|
this.#channel.emit({ kind: "event", event });
|
|
30072
30691
|
}
|
|
30692
|
+
/** Publishes a live model request settled in the journal to Host usage metering. */
|
|
30693
|
+
#meterUsage(event) {
|
|
30694
|
+
const record2 = deepSeekUsageRecord(event, false);
|
|
30695
|
+
if (record2.kind === "request")
|
|
30696
|
+
this.#emit({ type: "usage.request", request: record2.request });
|
|
30697
|
+
else if (record2.kind === "missing")
|
|
30698
|
+
this.#emit({ type: "usage.history", complete: false });
|
|
30699
|
+
}
|
|
30073
30700
|
};
|
|
30074
30701
|
var OperationAborted = class extends Error {
|
|
30075
30702
|
constructor() {
|
|
@@ -30400,7 +31027,7 @@ function safeTimerDelay(value, name) {
|
|
|
30400
31027
|
|
|
30401
31028
|
// dist/modern/session-list.js
|
|
30402
31029
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
30403
|
-
import
|
|
31030
|
+
import path7 from "node:path";
|
|
30404
31031
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
30405
31032
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
30406
31033
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -30519,7 +31146,7 @@ function parseSummary(value) {
|
|
|
30519
31146
|
};
|
|
30520
31147
|
}
|
|
30521
31148
|
function isCanonicalAbsoluteCwd(value) {
|
|
30522
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
31149
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path7.isAbsolute(value) && path7.resolve(value) === value;
|
|
30523
31150
|
}
|
|
30524
31151
|
function parseModernSessionCandidates(value) {
|
|
30525
31152
|
assertBoundedJson4(value);
|
|
@@ -30717,7 +31344,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
30717
31344
|
let session;
|
|
30718
31345
|
let forkExpectation;
|
|
30719
31346
|
try {
|
|
30720
|
-
const cwd =
|
|
31347
|
+
const cwd = path8.resolve(input.cwd);
|
|
30721
31348
|
let forkInput = input.kind === "fork" ? parseModernForkInput(input, this.#profile) : void 0;
|
|
30722
31349
|
const rollbackSourceSessionId = input.kind === "rollbackLastTurn" ? modernSessionId(input.sourceRef, "roll back") : void 0;
|
|
30723
31350
|
let rollbackPlan;
|
|
@@ -30878,6 +31505,14 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
30878
31505
|
this.#sessions.add(openedSession);
|
|
30879
31506
|
await this.#startEvents();
|
|
30880
31507
|
this.#assertAccepting();
|
|
31508
|
+
if (input.kind === "resume" && input.permissionModeId) {
|
|
31509
|
+
const restored = await openedSession.execute({
|
|
31510
|
+
type: "permissionMode.select",
|
|
31511
|
+
permissionModeId: input.permissionModeId
|
|
31512
|
+
});
|
|
31513
|
+
if (!restored.ok)
|
|
31514
|
+
throw new AdapterOperationError(restored.error);
|
|
31515
|
+
}
|
|
30881
31516
|
return { ok: true, value: openedSession };
|
|
30882
31517
|
} catch (error51) {
|
|
30883
31518
|
await session?.close().catch(() => void 0);
|
|
@@ -30920,7 +31555,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
30920
31555
|
});
|
|
30921
31556
|
if (!result.ok)
|
|
30922
31557
|
throw new AdapterOperationError(remoteFailure2("session/create", result.error));
|
|
30923
|
-
if (!
|
|
31558
|
+
if (!isRecord8(result.value) || !hasExactOptionalKeys(result.value, ["sessionId"], ["agentPreset"]) || result.value.sessionId !== requestedSessionId || Object.hasOwn(result.value, "agentPreset") && typeof result.value.agentPreset !== "string" || agentPreset !== void 0 && result.value.agentPreset !== agentPreset) {
|
|
30924
31559
|
throw new AdapterOperationError({
|
|
30925
31560
|
code: "protocolError",
|
|
30926
31561
|
message: "DeepSeek Harness session/create returned an invalid Session identity",
|
|
@@ -31004,7 +31639,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
31004
31639
|
const result = await this.#connection.call("session/fork", { request: { sessionId: input.sourceSessionId, atSeq } }, this.#lifetime.signal);
|
|
31005
31640
|
if (!result.ok)
|
|
31006
31641
|
throw new AdapterOperationError(forkRemoteFailure(result.error));
|
|
31007
|
-
if (!
|
|
31642
|
+
if (!isRecord8(result.value) || !hasExactOptionalKeys(result.value, ["sessionId"], []) || typeof result.value.sessionId !== "string" || result.value.sessionId.trim() === "" || result.value.sessionId === input.sourceSessionId) {
|
|
31008
31643
|
throw forkProtocolError();
|
|
31009
31644
|
}
|
|
31010
31645
|
return {
|
|
@@ -31238,7 +31873,7 @@ function verifyCreateConfiguration(requested, observed) {
|
|
|
31238
31873
|
}
|
|
31239
31874
|
}
|
|
31240
31875
|
function resolveCreateConfiguration(input, modelCatalog, permissionModes) {
|
|
31241
|
-
let
|
|
31876
|
+
let model2;
|
|
31242
31877
|
if (input.model || input.thinkingOptionId) {
|
|
31243
31878
|
const requestedModel = input.model ?? modelCatalog.catalog.defaultModel;
|
|
31244
31879
|
if (!requestedModel) {
|
|
@@ -31248,7 +31883,7 @@ function resolveCreateConfiguration(input, modelCatalog, permissionModes) {
|
|
|
31248
31883
|
retryable: false
|
|
31249
31884
|
});
|
|
31250
31885
|
}
|
|
31251
|
-
|
|
31886
|
+
model2 = modernSelectionForModel(modelCatalog, requestedModel, input.thinkingOptionId);
|
|
31252
31887
|
}
|
|
31253
31888
|
const unattended = input.executionPolicy === "unattended-full-access";
|
|
31254
31889
|
const permissionModeId = input.permissionModeId ?? (unattended ? harnessPermissionModeIdSchema.parse(DELEGATION_PERMISSION_PRESET) : void 0);
|
|
@@ -31260,7 +31895,7 @@ function resolveCreateConfiguration(input, modelCatalog, permissionModes) {
|
|
|
31260
31895
|
});
|
|
31261
31896
|
}
|
|
31262
31897
|
return {
|
|
31263
|
-
...
|
|
31898
|
+
...model2 ? { model: model2 } : {},
|
|
31264
31899
|
...permissionModeId ? { permissionModeId } : {},
|
|
31265
31900
|
unattended
|
|
31266
31901
|
};
|
|
@@ -31270,7 +31905,7 @@ function delegationPermissionIsApplied(events) {
|
|
|
31270
31905
|
let sandboxMode;
|
|
31271
31906
|
let approvalPolicy;
|
|
31272
31907
|
for (const event of events) {
|
|
31273
|
-
if (!
|
|
31908
|
+
if (!isRecord8(event.data))
|
|
31274
31909
|
continue;
|
|
31275
31910
|
if (event.type === "permission/preset" && typeof event.data.preset === "string") {
|
|
31276
31911
|
preset = event.data.preset;
|
|
@@ -31309,10 +31944,10 @@ function parseModernForkInput(input, profile) {
|
|
|
31309
31944
|
};
|
|
31310
31945
|
}
|
|
31311
31946
|
function sessionLocatorMatches(locator) {
|
|
31312
|
-
return locator === void 0 ||
|
|
31947
|
+
return locator === void 0 || isRecord8(locator) && Reflect.ownKeys(locator).length === 1 && typeof locator.dshVersion === "string" && isDeepSeekSemVer(locator.dshVersion);
|
|
31313
31948
|
}
|
|
31314
31949
|
function checkpointLocatorMatches(locator, profile) {
|
|
31315
|
-
return
|
|
31950
|
+
return isRecord8(locator) && Reflect.ownKeys(locator).length === 1 && locator.dshVersion === profile.version;
|
|
31316
31951
|
}
|
|
31317
31952
|
function forkCheckpointError() {
|
|
31318
31953
|
return new AdapterOperationError({
|
|
@@ -31474,7 +32109,7 @@ function sanitizedHarnessError2(error51) {
|
|
|
31474
32109
|
...error51.stderrTail ? { stderrTail: sanitizeDiagnosticTail(redactModernCredential(error51.stderrTail)) } : {}
|
|
31475
32110
|
};
|
|
31476
32111
|
}
|
|
31477
|
-
function
|
|
32112
|
+
function isRecord8(value) {
|
|
31478
32113
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31479
32114
|
}
|
|
31480
32115
|
function hasExactOptionalKeys(value, required2, optional2) {
|
|
@@ -31496,6 +32131,7 @@ var DelegateSelectionError = class extends Error {
|
|
|
31496
32131
|
var DeepSeekHarnessAdapter = class {
|
|
31497
32132
|
commandCatalog = deepSeekHarnessCommandCatalog();
|
|
31498
32133
|
harnessId = DEEPSEEK_HARNESS_ID4;
|
|
32134
|
+
usageStatistics;
|
|
31499
32135
|
sessionImport = Object.freeze({
|
|
31500
32136
|
listCandidates: () => this.#listSessionImportCandidates(),
|
|
31501
32137
|
resolveCandidate: async (nativeSessionId) => {
|
|
@@ -31542,6 +32178,7 @@ var DeepSeekHarnessAdapter = class {
|
|
|
31542
32178
|
#terminalFailure;
|
|
31543
32179
|
constructor(options = {}, dependencies = {}) {
|
|
31544
32180
|
this.#options = options;
|
|
32181
|
+
this.usageStatistics = createDshUsageStatistics(options.environment ?? process.env);
|
|
31545
32182
|
this.#probeExecutable = dependencies.probeExecutable ?? ((input) => probeDeepSeekExecutableGeneration(input));
|
|
31546
32183
|
this.#createModernAdapter = dependencies.createModernAdapter ?? ((modernOptions2) => new ModernDeepSeekHarnessAdapter(modernOptions2));
|
|
31547
32184
|
}
|