@codexhost/cli-darwin-x64 0.22.0 → 0.23.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/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +3332 -249
- package/app/console-web.js +9883 -2837
- package/app/desktop-controller.mjs +3135 -309
- package/app/host-runtime.mjs +6571 -2095
- package/app/plugins/antigravity/plugin.mjs +682 -114
- package/app/plugins/claude-code/plugin.mjs +883 -154
- package/app/plugins/codebuddy/plugin.mjs +587 -109
- package/app/plugins/codex-usage/plugin.mjs +532 -88
- package/app/plugins/copilot/plugin.mjs +532 -88
- package/app/plugins/cursor-cli/plugin.mjs +587 -109
- package/app/plugins/deepseek-harness/plugin.mjs +874 -218
- package/app/plugins/devin/plugin.mjs +532 -88
- package/app/plugins/grok/plugin.mjs +596 -105
- package/app/plugins/hermes/plugin.mjs +532 -88
- package/app/plugins/kimi-code/plugin.mjs +532 -88
- package/app/plugins/kiro-cli/plugin.mjs +532 -88
- package/app/plugins/omp/plugin.mjs +532 -88
- package/app/plugins/opencode/plugin.mjs +532 -88
- package/app/plugins/pi/plugin.mjs +538 -93
- package/app/plugins/qoder/plugin.mjs +532 -88
- package/app/plugins/qoder-cn/plugin.mjs +532 -88
- package/app/plugins/qwen-code/plugin.mjs +532 -88
- package/app/plugins/workbuddy/plugin.mjs +645 -120
- package/app/plugins/zcode/plugin.mjs +539 -95
- package/app/renderer-extension.js +12946 -4450
- package/app/web/assets/index-Dyh1KzAB.js +201 -0
- package/app/web/codexhost-settings.js +9793 -2934
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +90 -90
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-browser/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
- package/app/web-modules/licenses/werift-NOTICES.txt +123 -0
- package/app/web-modules/licenses/werift-libwebrtc-NOTICES.txt +58 -0
- package/app/web-modules/server.mjs +34991 -3000
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-CN4a4sj0.js +0 -201
|
@@ -2131,7 +2131,7 @@ var require_extension = __commonJS({
|
|
|
2131
2131
|
let mustUnescape = false;
|
|
2132
2132
|
let isEscaping = false;
|
|
2133
2133
|
let inQuotes = false;
|
|
2134
|
-
let
|
|
2134
|
+
let extensionName2;
|
|
2135
2135
|
let paramName;
|
|
2136
2136
|
let start = -1;
|
|
2137
2137
|
let code = -1;
|
|
@@ -2139,7 +2139,7 @@ var require_extension = __commonJS({
|
|
|
2139
2139
|
let i = 0;
|
|
2140
2140
|
for (; i < header.length; i++) {
|
|
2141
2141
|
code = header.charCodeAt(i);
|
|
2142
|
-
if (
|
|
2142
|
+
if (extensionName2 === void 0) {
|
|
2143
2143
|
if (end === -1 && tokenChars[code] === 1) {
|
|
2144
2144
|
if (start === -1) start = i;
|
|
2145
2145
|
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
@@ -2154,7 +2154,7 @@ var require_extension = __commonJS({
|
|
|
2154
2154
|
push(offers, name, params);
|
|
2155
2155
|
params = /* @__PURE__ */ Object.create(null);
|
|
2156
2156
|
} else {
|
|
2157
|
-
|
|
2157
|
+
extensionName2 = name;
|
|
2158
2158
|
}
|
|
2159
2159
|
start = end = -1;
|
|
2160
2160
|
} else {
|
|
@@ -2172,9 +2172,9 @@ var require_extension = __commonJS({
|
|
|
2172
2172
|
if (end === -1) end = i;
|
|
2173
2173
|
push(params, header.slice(start, end), true);
|
|
2174
2174
|
if (code === 44) {
|
|
2175
|
-
push(offers,
|
|
2175
|
+
push(offers, extensionName2, params);
|
|
2176
2176
|
params = /* @__PURE__ */ Object.create(null);
|
|
2177
|
-
|
|
2177
|
+
extensionName2 = void 0;
|
|
2178
2178
|
}
|
|
2179
2179
|
start = end = -1;
|
|
2180
2180
|
} else if (code === 61 && start !== -1 && end === -1) {
|
|
@@ -2220,9 +2220,9 @@ var require_extension = __commonJS({
|
|
|
2220
2220
|
}
|
|
2221
2221
|
push(params, paramName, value);
|
|
2222
2222
|
if (code === 44) {
|
|
2223
|
-
push(offers,
|
|
2223
|
+
push(offers, extensionName2, params);
|
|
2224
2224
|
params = /* @__PURE__ */ Object.create(null);
|
|
2225
|
-
|
|
2225
|
+
extensionName2 = void 0;
|
|
2226
2226
|
}
|
|
2227
2227
|
paramName = void 0;
|
|
2228
2228
|
start = end = -1;
|
|
@@ -2236,7 +2236,7 @@ var require_extension = __commonJS({
|
|
|
2236
2236
|
}
|
|
2237
2237
|
if (end === -1) end = i;
|
|
2238
2238
|
const token = header.slice(start, end);
|
|
2239
|
-
if (
|
|
2239
|
+
if (extensionName2 === void 0) {
|
|
2240
2240
|
push(offers, token, params);
|
|
2241
2241
|
} else {
|
|
2242
2242
|
if (paramName === void 0) {
|
|
@@ -2246,7 +2246,7 @@ var require_extension = __commonJS({
|
|
|
2246
2246
|
} else {
|
|
2247
2247
|
push(params, paramName, token);
|
|
2248
2248
|
}
|
|
2249
|
-
push(offers,
|
|
2249
|
+
push(offers, extensionName2, params);
|
|
2250
2250
|
}
|
|
2251
2251
|
return offers;
|
|
2252
2252
|
}
|
|
@@ -4191,66 +4191,11 @@ function createHarnessInstaller(environment, source) {
|
|
|
4191
4191
|
};
|
|
4192
4192
|
}
|
|
4193
4193
|
|
|
4194
|
-
// dist/
|
|
4194
|
+
// dist/account-balance.js
|
|
4195
|
+
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
4195
4196
|
import os2 from "node:os";
|
|
4196
4197
|
import path5 from "node:path";
|
|
4197
|
-
import {
|
|
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
|
-
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
4204
|
-
function usageSessionTitle(value) {
|
|
4205
|
-
if (typeof value !== "string")
|
|
4206
|
-
return void 0;
|
|
4207
|
-
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
4208
|
-
if (!normalized)
|
|
4209
|
-
return void 0;
|
|
4210
|
-
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
4211
|
-
return normalized;
|
|
4212
|
-
let title = "";
|
|
4213
|
-
for (const character of normalized) {
|
|
4214
|
-
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
4215
|
-
break;
|
|
4216
|
-
title += character;
|
|
4217
|
-
}
|
|
4218
|
-
return `${title.trimEnd()}…`;
|
|
4219
|
-
}
|
|
4220
|
-
function sessionIdOk(value) {
|
|
4221
|
-
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
4222
|
-
}
|
|
4223
|
-
function cwdOk(value) {
|
|
4224
|
-
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("\\\\"));
|
|
4225
|
-
}
|
|
4226
|
-
function withUsageSession(entry, session) {
|
|
4227
|
-
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
4228
|
-
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
4229
|
-
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
4230
|
-
if (sessionId === void 0 && cwd === void 0)
|
|
4231
|
-
return entry;
|
|
4232
|
-
return {
|
|
4233
|
-
...entry,
|
|
4234
|
-
...sessionId !== void 0 ? { sessionId } : {},
|
|
4235
|
-
...cwd !== void 0 ? { cwd } : {},
|
|
4236
|
-
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
4237
|
-
};
|
|
4238
|
-
}
|
|
4239
|
-
function usageEntryFromRequest(request, occurredAtMs) {
|
|
4240
|
-
if (!Number.isSafeInteger(occurredAtMs) || occurredAtMs <= 0)
|
|
4241
|
-
return null;
|
|
4242
|
-
return {
|
|
4243
|
-
id: request.requestId,
|
|
4244
|
-
occurredAtMs,
|
|
4245
|
-
...request.model !== void 0 ? { model: request.model } : {},
|
|
4246
|
-
inputTokens: request.inputTokens,
|
|
4247
|
-
...request.cachedInputTokens !== void 0 ? { cachedInputTokens: request.cachedInputTokens } : {},
|
|
4248
|
-
...request.cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens: request.cacheWriteInputTokens } : {},
|
|
4249
|
-
...request.cacheWrite1hInputTokens !== void 0 ? { cacheWrite1hInputTokens: request.cacheWrite1hInputTokens } : {},
|
|
4250
|
-
outputTokens: request.outputTokens,
|
|
4251
|
-
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
4252
|
-
};
|
|
4253
|
-
}
|
|
4198
|
+
import { parseEnv } from "node:util";
|
|
4254
4199
|
|
|
4255
4200
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
4256
4201
|
var external_exports = {};
|
|
@@ -5018,10 +4963,10 @@ function mergeDefs(...defs) {
|
|
|
5018
4963
|
function cloneDef(schema) {
|
|
5019
4964
|
return mergeDefs(schema._zod.def);
|
|
5020
4965
|
}
|
|
5021
|
-
function getElementAtPath(obj,
|
|
5022
|
-
if (!
|
|
4966
|
+
function getElementAtPath(obj, path12) {
|
|
4967
|
+
if (!path12)
|
|
5023
4968
|
return obj;
|
|
5024
|
-
return
|
|
4969
|
+
return path12.reduce((acc, key) => acc?.[key], obj);
|
|
5025
4970
|
}
|
|
5026
4971
|
function promiseAllObject(promisesObj) {
|
|
5027
4972
|
const keys = Object.keys(promisesObj);
|
|
@@ -5430,11 +5375,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
5430
5375
|
}
|
|
5431
5376
|
return false;
|
|
5432
5377
|
}
|
|
5433
|
-
function prefixIssues(
|
|
5378
|
+
function prefixIssues(path12, issues) {
|
|
5434
5379
|
return issues.map((iss) => {
|
|
5435
5380
|
var _a3;
|
|
5436
5381
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
5437
|
-
iss.path.unshift(
|
|
5382
|
+
iss.path.unshift(path12);
|
|
5438
5383
|
return iss;
|
|
5439
5384
|
});
|
|
5440
5385
|
}
|
|
@@ -5581,16 +5526,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5581
5526
|
}
|
|
5582
5527
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
5583
5528
|
const fieldErrors = { _errors: [] };
|
|
5584
|
-
const processError = (error52,
|
|
5529
|
+
const processError = (error52, path12 = []) => {
|
|
5585
5530
|
for (const issue2 of error52.issues) {
|
|
5586
5531
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5587
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5532
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
5588
5533
|
} else if (issue2.code === "invalid_key") {
|
|
5589
|
-
processError({ issues: issue2.issues }, [...
|
|
5534
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5590
5535
|
} else if (issue2.code === "invalid_element") {
|
|
5591
|
-
processError({ issues: issue2.issues }, [...
|
|
5536
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5592
5537
|
} else {
|
|
5593
|
-
const fullpath = [...
|
|
5538
|
+
const fullpath = [...path12, ...issue2.path];
|
|
5594
5539
|
if (fullpath.length === 0) {
|
|
5595
5540
|
fieldErrors._errors.push(mapper(issue2));
|
|
5596
5541
|
} else {
|
|
@@ -5617,17 +5562,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5617
5562
|
}
|
|
5618
5563
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
5619
5564
|
const result = { errors: [] };
|
|
5620
|
-
const processError = (error52,
|
|
5565
|
+
const processError = (error52, path12 = []) => {
|
|
5621
5566
|
var _a3, _b;
|
|
5622
5567
|
for (const issue2 of error52.issues) {
|
|
5623
5568
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
5624
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
5569
|
+
issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
|
|
5625
5570
|
} else if (issue2.code === "invalid_key") {
|
|
5626
|
-
processError({ issues: issue2.issues }, [...
|
|
5571
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5627
5572
|
} else if (issue2.code === "invalid_element") {
|
|
5628
|
-
processError({ issues: issue2.issues }, [...
|
|
5573
|
+
processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
|
|
5629
5574
|
} else {
|
|
5630
|
-
const fullpath = [...
|
|
5575
|
+
const fullpath = [...path12, ...issue2.path];
|
|
5631
5576
|
if (fullpath.length === 0) {
|
|
5632
5577
|
result.errors.push(mapper(issue2));
|
|
5633
5578
|
continue;
|
|
@@ -5659,8 +5604,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
5659
5604
|
}
|
|
5660
5605
|
function toDotPath(_path) {
|
|
5661
5606
|
const segs = [];
|
|
5662
|
-
const
|
|
5663
|
-
for (const seg of
|
|
5607
|
+
const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
5608
|
+
for (const seg of path12) {
|
|
5664
5609
|
if (typeof seg === "number")
|
|
5665
5610
|
segs.push(`[${seg}]`);
|
|
5666
5611
|
else if (typeof seg === "symbol")
|
|
@@ -18352,13 +18297,13 @@ function resolveRef(ref, ctx) {
|
|
|
18352
18297
|
if (!ref.startsWith("#")) {
|
|
18353
18298
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
18354
18299
|
}
|
|
18355
|
-
const
|
|
18356
|
-
if (
|
|
18300
|
+
const path12 = ref.slice(1).split("/").filter(Boolean);
|
|
18301
|
+
if (path12.length === 0) {
|
|
18357
18302
|
return ctx.rootSchema;
|
|
18358
18303
|
}
|
|
18359
18304
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
18360
|
-
if (
|
|
18361
|
-
const key =
|
|
18305
|
+
if (path12[0] === defsKey) {
|
|
18306
|
+
const key = path12[1];
|
|
18362
18307
|
if (!key || !ctx.defs[key]) {
|
|
18363
18308
|
throw new Error(`Reference not found: ${ref}`);
|
|
18364
18309
|
}
|
|
@@ -18766,6 +18711,87 @@ function date4(params) {
|
|
|
18766
18711
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
18767
18712
|
config(en_default());
|
|
18768
18713
|
|
|
18714
|
+
// ../../shared-contracts/dist/ids.js
|
|
18715
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18716
|
+
message: "Identifier must not be empty or whitespace"
|
|
18717
|
+
});
|
|
18718
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
18719
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
18720
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
18721
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18722
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18723
|
+
|
|
18724
|
+
// ../../shared-contracts/dist/harness-plugins.js
|
|
18725
|
+
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
18726
|
+
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
18727
|
+
var HARNESS_PLUGIN_LIMIT = 128;
|
|
18728
|
+
var installedPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u);
|
|
18729
|
+
var installedHarnessPluginIdSchema = installedPluginIdSchema.pipe(harnessIdSchema);
|
|
18730
|
+
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
18731
|
+
var pluginRelativeResourceSchema = 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");
|
|
18732
|
+
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
18733
|
+
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
18734
|
+
var harnessInstallationGuideSchema = external_exports.object({
|
|
18735
|
+
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
18736
|
+
before: localizedTextSchema.optional(),
|
|
18737
|
+
after: localizedTextSchema.optional(),
|
|
18738
|
+
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
18739
|
+
}).strict();
|
|
18740
|
+
var pluginPresentationShape = {
|
|
18741
|
+
id: installedHarnessPluginIdSchema,
|
|
18742
|
+
name: external_exports.string().trim().min(1).max(128),
|
|
18743
|
+
version: external_exports.string().min(1).max(128),
|
|
18744
|
+
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
18745
|
+
kind: external_exports.literal("usage").optional(),
|
|
18746
|
+
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
18747
|
+
iconStyle: external_exports.object({
|
|
18748
|
+
vector: external_exports.object({
|
|
18749
|
+
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
18750
|
+
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
18751
|
+
paths: external_exports.array(external_exports.object({
|
|
18752
|
+
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
18753
|
+
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
18754
|
+
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
18755
|
+
}).strict()).min(1).max(32)
|
|
18756
|
+
}).strict().optional(),
|
|
18757
|
+
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
18758
|
+
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
18759
|
+
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
18760
|
+
}).strict().optional(),
|
|
18761
|
+
installation: harnessInstallationGuideSchema.optional(),
|
|
18762
|
+
notice: localizedTextSchema.optional(),
|
|
18763
|
+
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
18764
|
+
launchCommand: external_exports.literal(true).optional(),
|
|
18765
|
+
links: external_exports.object({
|
|
18766
|
+
website: documentationUrlSchema.optional(),
|
|
18767
|
+
documentation: documentationUrlSchema.optional(),
|
|
18768
|
+
installation: documentationUrlSchema.optional()
|
|
18769
|
+
}).strict().optional()
|
|
18770
|
+
};
|
|
18771
|
+
var harnessPluginManifestSchema = external_exports.object({
|
|
18772
|
+
manifestVersion: external_exports.literal(1),
|
|
18773
|
+
...pluginPresentationShape,
|
|
18774
|
+
adapterApiVersion: external_exports.number().int().positive(),
|
|
18775
|
+
entry: pluginRelativeResourceSchema,
|
|
18776
|
+
icon: pluginRelativeResourceSchema.optional()
|
|
18777
|
+
}).strict();
|
|
18778
|
+
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
18779
|
+
var harnessPluginDescriptorSchema = external_exports.object({
|
|
18780
|
+
...pluginPresentationShape,
|
|
18781
|
+
icon: harnessPluginIconSchema.optional()
|
|
18782
|
+
}).strict();
|
|
18783
|
+
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
18784
|
+
var harnessPluginListResultSchema = external_exports.object({
|
|
18785
|
+
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
18786
|
+
}).strict();
|
|
18787
|
+
var harnessPluginConfigurationSchema = external_exports.object({
|
|
18788
|
+
version: external_exports.literal(1),
|
|
18789
|
+
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
18790
|
+
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
18791
|
+
message: "Enabled plugin IDs must be unique",
|
|
18792
|
+
path: ["enabled"]
|
|
18793
|
+
});
|
|
18794
|
+
|
|
18769
18795
|
// ../../shared-contracts/dist/json-value.js
|
|
18770
18796
|
function rejectExplicitUndefined(keys) {
|
|
18771
18797
|
return (value, context) => {
|
|
@@ -18825,6 +18851,346 @@ var jsonValueSchema = nonCircularSchema.pipe(recursiveJsonValueSchema);
|
|
|
18825
18851
|
var jsonArraySchema = nonCircularSchema.pipe(external_exports.array(recursiveJsonValueSchema));
|
|
18826
18852
|
var jsonObjectSchema = nonCircularSchema.pipe(external_exports.record(external_exports.string(), recursiveJsonValueSchema));
|
|
18827
18853
|
|
|
18854
|
+
// ../../shared-contracts/dist/desktop-extensions.js
|
|
18855
|
+
var DESKTOP_EXTENSION_API_VERSION = 1;
|
|
18856
|
+
var DESKTOP_EXTENSION_LIMIT = 64;
|
|
18857
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BYTES = 64 * 1024 * 1024;
|
|
18858
|
+
var DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH = 4 * Math.ceil(DESKTOP_EXTENSION_ZIP_MAX_BYTES / 3);
|
|
18859
|
+
var DESKTOP_EXTENSION_MANIFEST_MAX_BYTES = 128 * 1024;
|
|
18860
|
+
var DESKTOP_EXTENSION_SCRIPT_MAX_BYTES = 2 * 1024 * 1024;
|
|
18861
|
+
var DESKTOP_EXTENSION_STYLE_MAX_BYTES = 256 * 1024;
|
|
18862
|
+
var DESKTOP_EXTENSION_ICON_MAX_BYTES = 128 * 1024;
|
|
18863
|
+
var DESKTOP_EXTENSION_SCREENSHOT_LIMIT = 4;
|
|
18864
|
+
var DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES = 512 * 1024;
|
|
18865
|
+
var DESKTOP_EXTENSION_LIST_SCREENSHOTS_MAX_BYTES = 8 * 1024 * 1024;
|
|
18866
|
+
var DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES = 8 * 1024 * 1024;
|
|
18867
|
+
var DESKTOP_EXTENSION_ASSET_MAX_BYTES = 16 * 1024 * 1024;
|
|
18868
|
+
var DESKTOP_EXTENSION_SETTINGS_MAX_BYTES = 1024 * 1024;
|
|
18869
|
+
var desktopExtensionIdSchema = installedPluginIdSchema;
|
|
18870
|
+
var desktopExtensionSlotSchema = external_exports.enum([
|
|
18871
|
+
"sidebar.thread-layout",
|
|
18872
|
+
"sidebar.thread-badge",
|
|
18873
|
+
"appearance.theme"
|
|
18874
|
+
]);
|
|
18875
|
+
var desktopExtensionCategorySchema = external_exports.enum([
|
|
18876
|
+
"appearance",
|
|
18877
|
+
"interface",
|
|
18878
|
+
"workflow",
|
|
18879
|
+
"analytics",
|
|
18880
|
+
"integrations",
|
|
18881
|
+
"tools"
|
|
18882
|
+
]);
|
|
18883
|
+
var extensionName = external_exports.string().trim().min(1).max(128);
|
|
18884
|
+
function desktopExtensionScreenshotMimeType(resource) {
|
|
18885
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
18886
|
+
case "png":
|
|
18887
|
+
return "image/png";
|
|
18888
|
+
case "jpg":
|
|
18889
|
+
case "jpeg":
|
|
18890
|
+
return "image/jpeg";
|
|
18891
|
+
case "webp":
|
|
18892
|
+
return "image/webp";
|
|
18893
|
+
default:
|
|
18894
|
+
return void 0;
|
|
18895
|
+
}
|
|
18896
|
+
}
|
|
18897
|
+
function desktopExtensionAssetMimeType(resource) {
|
|
18898
|
+
switch (resource.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()) {
|
|
18899
|
+
case "gif":
|
|
18900
|
+
return "image/gif";
|
|
18901
|
+
case "svg":
|
|
18902
|
+
return "image/svg+xml";
|
|
18903
|
+
case "woff2":
|
|
18904
|
+
return "font/woff2";
|
|
18905
|
+
case "json":
|
|
18906
|
+
return "application/json";
|
|
18907
|
+
case "css":
|
|
18908
|
+
return "text/css";
|
|
18909
|
+
default:
|
|
18910
|
+
return desktopExtensionScreenshotMimeType(resource);
|
|
18911
|
+
}
|
|
18912
|
+
}
|
|
18913
|
+
var hasPortableSegments = (resource) => resource.split("/").every((segment) => !/[. ]$/u.test(segment));
|
|
18914
|
+
var desktopExtensionAssetPathSchema = pluginRelativeResourceSchema.refine((resource) => hasPortableSegments(resource) && desktopExtensionAssetMimeType(resource) !== void 0, "Expected a relative Desktop extension asset path with a supported suffix");
|
|
18915
|
+
var imagePathSchema = pluginRelativeResourceSchema.refine((resource) => desktopExtensionScreenshotMimeType(resource) !== void 0 && hasPortableSegments(resource), "Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space");
|
|
18916
|
+
var desktopExtensionHttpUrlSchema = external_exports.string().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu, "Expected an HTTP(S) URL").pipe(external_exports.url({ protocol: /^https?$/u })).refine((value) => {
|
|
18917
|
+
const { username, password } = new URL(value);
|
|
18918
|
+
return !username && !password && !/[\\\s]/u.test(value);
|
|
18919
|
+
}, "URL must not contain credentials, backslashes, or whitespace");
|
|
18920
|
+
function localizedText(text) {
|
|
18921
|
+
return external_exports.strictObject({ en: text, "zh-CN": text });
|
|
18922
|
+
}
|
|
18923
|
+
var desktopExtensionLocalizedTextSchema = localizedText(external_exports.string().trim().min(1));
|
|
18924
|
+
var categoriesSchema = external_exports.array(desktopExtensionCategorySchema).max(desktopExtensionCategorySchema.options.length).refine((categories) => new Set(categories).size === categories.length, "Duplicate categories");
|
|
18925
|
+
var slotsSchema = external_exports.array(desktopExtensionSlotSchema).max(desktopExtensionSlotSchema.options.length).refine((slots) => new Set(slots).size === slots.length, "Duplicate slots");
|
|
18926
|
+
var settingField = {
|
|
18927
|
+
key: external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),
|
|
18928
|
+
label: desktopExtensionLocalizedTextSchema,
|
|
18929
|
+
description: desktopExtensionLocalizedTextSchema.optional()
|
|
18930
|
+
};
|
|
18931
|
+
var numericSetting = {
|
|
18932
|
+
...settingField,
|
|
18933
|
+
step: external_exports.number().positive().optional(),
|
|
18934
|
+
default: external_exports.number().optional()
|
|
18935
|
+
};
|
|
18936
|
+
var settingOption = external_exports.strictObject({
|
|
18937
|
+
value: external_exports.string(),
|
|
18938
|
+
label: desktopExtensionLocalizedTextSchema
|
|
18939
|
+
});
|
|
18940
|
+
var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("type", [
|
|
18941
|
+
external_exports.strictObject({
|
|
18942
|
+
...settingField,
|
|
18943
|
+
type: external_exports.literal("boolean"),
|
|
18944
|
+
default: external_exports.boolean().optional()
|
|
18945
|
+
}),
|
|
18946
|
+
external_exports.strictObject({
|
|
18947
|
+
...settingField,
|
|
18948
|
+
type: external_exports.literal("string"),
|
|
18949
|
+
placeholder: desktopExtensionLocalizedTextSchema.optional(),
|
|
18950
|
+
default: external_exports.string().optional()
|
|
18951
|
+
}),
|
|
18952
|
+
external_exports.strictObject({
|
|
18953
|
+
...numericSetting,
|
|
18954
|
+
type: external_exports.literal("number"),
|
|
18955
|
+
min: external_exports.number().optional(),
|
|
18956
|
+
max: external_exports.number().optional()
|
|
18957
|
+
}),
|
|
18958
|
+
external_exports.strictObject({
|
|
18959
|
+
...numericSetting,
|
|
18960
|
+
type: external_exports.literal("range"),
|
|
18961
|
+
min: external_exports.number(),
|
|
18962
|
+
max: external_exports.number()
|
|
18963
|
+
}),
|
|
18964
|
+
external_exports.strictObject({
|
|
18965
|
+
...settingField,
|
|
18966
|
+
type: external_exports.literal("select"),
|
|
18967
|
+
options: external_exports.array(settingOption).min(1),
|
|
18968
|
+
default: external_exports.string().optional()
|
|
18969
|
+
})
|
|
18970
|
+
]).superRefine((field2, ctx) => {
|
|
18971
|
+
const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
|
|
18972
|
+
if (field2.type === "number" || field2.type === "range") {
|
|
18973
|
+
const { min = -Infinity, max = Infinity, default: value } = field2;
|
|
18974
|
+
if (min > max)
|
|
18975
|
+
issue2("max", "Must be at least min");
|
|
18976
|
+
if (value !== void 0 && (value < min || value > max))
|
|
18977
|
+
issue2("default", "Must be within min and max");
|
|
18978
|
+
} else if (field2.type === "select") {
|
|
18979
|
+
const values = new Set(field2.options.map(({ value }) => value));
|
|
18980
|
+
if (values.size !== field2.options.length)
|
|
18981
|
+
issue2("options", "Duplicate option values");
|
|
18982
|
+
if (field2.default !== void 0 && !values.has(field2.default))
|
|
18983
|
+
issue2("default", "Must match an option value");
|
|
18984
|
+
}
|
|
18985
|
+
});
|
|
18986
|
+
var manifestHeader = external_exports.object({
|
|
18987
|
+
manifestVersion: external_exports.int().positive(),
|
|
18988
|
+
id: desktopExtensionIdSchema,
|
|
18989
|
+
name: external_exports.union([extensionName, localizedText(extensionName)]),
|
|
18990
|
+
version: external_exports.string().min(1).max(128),
|
|
18991
|
+
desktopApi: external_exports.int().positive()
|
|
18992
|
+
}).passthrough();
|
|
18993
|
+
var desktopExtensionManifestSchema = manifestHeader.extend({
|
|
18994
|
+
manifestVersion: external_exports.literal(1),
|
|
18995
|
+
desktopApi: external_exports.literal(DESKTOP_EXTENSION_API_VERSION),
|
|
18996
|
+
description: external_exports.strictObject({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).optional(),
|
|
18997
|
+
author: external_exports.string().trim().min(1).max(128).optional(),
|
|
18998
|
+
repository: desktopExtensionHttpUrlSchema.optional(),
|
|
18999
|
+
details: external_exports.strictObject({ en: external_exports.string().max(16384), "zh-CN": external_exports.string().max(16384).optional() }).optional(),
|
|
19000
|
+
icon: imagePathSchema.optional(),
|
|
19001
|
+
screenshots: external_exports.array(imagePathSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).refine((screenshots) => new Set(screenshots).size === screenshots.length, "Duplicate screenshots").optional(),
|
|
19002
|
+
desktop: external_exports.strictObject({
|
|
19003
|
+
script: pluginRelativeResourceSchema,
|
|
19004
|
+
style: pluginRelativeResourceSchema.optional()
|
|
19005
|
+
}).optional(),
|
|
19006
|
+
backend: external_exports.strictObject({ script: pluginRelativeResourceSchema.refine(hasPortableSegments) }).optional(),
|
|
19007
|
+
slots: slotsSchema.default(() => []),
|
|
19008
|
+
settingsSchema: external_exports.array(desktopExtensionSettingFieldSchema).max(32).refine((fields) => new Set(fields.map(({ key }) => key)).size === fields.length, "Duplicate setting keys").optional(),
|
|
19009
|
+
categories: categoriesSchema.optional()
|
|
19010
|
+
}).strict().refine((manifest) => manifest.desktop !== void 0 || manifest.backend !== void 0, "Expected at least one desktop or backend entry");
|
|
19011
|
+
var desktopExtensionConfigurationSchema = external_exports.strictObject({
|
|
19012
|
+
version: external_exports.literal(1),
|
|
19013
|
+
revision: external_exports.int().nonnegative(),
|
|
19014
|
+
enabled: external_exports.array(desktopExtensionIdSchema).max(DESKTOP_EXTENSION_LIMIT).refine((ids) => new Set(ids).size === ids.length, "Duplicate extension IDs"),
|
|
19015
|
+
reloadToken: external_exports.uuid().optional()
|
|
19016
|
+
});
|
|
19017
|
+
var desktopExtensionHashSchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
19018
|
+
var desktopExtensionStatusSchema = external_exports.strictObject({
|
|
19019
|
+
state: external_exports.enum([
|
|
19020
|
+
"running",
|
|
19021
|
+
"disabled",
|
|
19022
|
+
"invalid",
|
|
19023
|
+
"incompatible",
|
|
19024
|
+
"conflict",
|
|
19025
|
+
"failed",
|
|
19026
|
+
"waiting"
|
|
19027
|
+
]),
|
|
19028
|
+
hash: desktopExtensionHashSchema.optional(),
|
|
19029
|
+
error: external_exports.string().optional(),
|
|
19030
|
+
conflictWith: desktopExtensionIdSchema.optional()
|
|
19031
|
+
});
|
|
19032
|
+
var desktopExtensionsDiagnosticSchema = external_exports.strictObject({
|
|
19033
|
+
controllerPid: external_exports.int().positive(),
|
|
19034
|
+
targetId: external_exports.string().nullable(),
|
|
19035
|
+
updatedAt: external_exports.iso.datetime(),
|
|
19036
|
+
handledReloadToken: external_exports.uuid().optional(),
|
|
19037
|
+
extensions: external_exports.record(external_exports.string(), desktopExtensionStatusSchema)
|
|
19038
|
+
});
|
|
19039
|
+
var desktopExtensionTrustTierSchema = external_exports.enum(["official", "community"]);
|
|
19040
|
+
function isGitHubDesktopExtensionZipballUrl(url2) {
|
|
19041
|
+
return url2.origin === "https://api.github.com" && /^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(url2.pathname);
|
|
19042
|
+
}
|
|
19043
|
+
var desktopExtensionZipUrlSchema = desktopExtensionHttpUrlSchema.refine((input) => {
|
|
19044
|
+
const url2 = new URL(input);
|
|
19045
|
+
return /\.zip$/iu.test(url2.pathname) || isGitHubDesktopExtensionZipballUrl(url2) || url2.origin === "https://github.com" && /^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(url2.pathname) || url2.origin === "https://codeload.github.com" && /^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(url2.pathname);
|
|
19046
|
+
}, "Expected a .zip download URL or a GitHub zipball URL");
|
|
19047
|
+
var desktopExtensionCatalogEntrySchema = external_exports.strictObject({
|
|
19048
|
+
id: desktopExtensionIdSchema,
|
|
19049
|
+
version: external_exports.string().trim().min(1).max(128),
|
|
19050
|
+
name: desktopExtensionLocalizedTextSchema.extend({ en: extensionName, "zh-CN": extensionName }),
|
|
19051
|
+
description: localizedText(external_exports.string().trim().min(1).max(4096)),
|
|
19052
|
+
details: localizedText(external_exports.string().trim().min(1).max(16384)).optional(),
|
|
19053
|
+
author: external_exports.string().trim().min(1).max(128),
|
|
19054
|
+
repository: desktopExtensionHttpUrlSchema,
|
|
19055
|
+
stars: external_exports.number().int().min(0).optional(),
|
|
19056
|
+
downloads: external_exports.number().int().min(0).optional(),
|
|
19057
|
+
categories: categoriesSchema.optional(),
|
|
19058
|
+
trustTier: desktopExtensionTrustTierSchema.default("community"),
|
|
19059
|
+
icon: desktopExtensionHttpUrlSchema.optional(),
|
|
19060
|
+
screenshots: external_exports.array(desktopExtensionHttpUrlSchema).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
19061
|
+
downloadUrl: desktopExtensionZipUrlSchema,
|
|
19062
|
+
sha256: desktopExtensionHashSchema,
|
|
19063
|
+
slots: slotsSchema.optional(),
|
|
19064
|
+
publishedAt: external_exports.string().optional(),
|
|
19065
|
+
updatedAt: external_exports.string().optional(),
|
|
19066
|
+
minCodexHostVersion: external_exports.string().optional()
|
|
19067
|
+
});
|
|
19068
|
+
var desktopExtensionCatalogSchema = external_exports.strictObject({
|
|
19069
|
+
schemaVersion: external_exports.literal(1),
|
|
19070
|
+
generatedAt: external_exports.string(),
|
|
19071
|
+
extensions: external_exports.array(desktopExtensionCatalogEntrySchema).refine((entries) => new Set(entries.map(({ id }) => id)).size === entries.length, "Duplicate extension IDs")
|
|
19072
|
+
});
|
|
19073
|
+
var DESKTOP_EXTENSIONS_ASSET_METHOD = "codexhost/desktop/extensions/asset";
|
|
19074
|
+
var DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD = "codexhost/desktop/extensions/settings/get";
|
|
19075
|
+
var DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD = "codexhost/desktop/extensions/settings/set";
|
|
19076
|
+
var DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD = "codexhost/desktop/extensions/backend/invoke";
|
|
19077
|
+
var extensionIdParams = { id: desktopExtensionIdSchema };
|
|
19078
|
+
var desktopExtensionsAssetParamsSchema = external_exports.strictObject({
|
|
19079
|
+
...extensionIdParams,
|
|
19080
|
+
path: desktopExtensionAssetPathSchema
|
|
19081
|
+
});
|
|
19082
|
+
var desktopExtensionsAssetResultSchema = external_exports.strictObject({
|
|
19083
|
+
mimeType: external_exports.string(),
|
|
19084
|
+
dataUrl: external_exports.string()
|
|
19085
|
+
});
|
|
19086
|
+
var desktopExtensionsSettingsGetParamsSchema = external_exports.strictObject(extensionIdParams);
|
|
19087
|
+
var desktopExtensionsSettingsSetParamsSchema = external_exports.strictObject({
|
|
19088
|
+
...extensionIdParams,
|
|
19089
|
+
values: jsonObjectSchema
|
|
19090
|
+
});
|
|
19091
|
+
var desktopExtensionsSettingsResultSchema = external_exports.strictObject({ values: jsonObjectSchema });
|
|
19092
|
+
var desktopExtensionBackendMethodSchema = external_exports.string().trim().min(1).max(128);
|
|
19093
|
+
var desktopExtensionsBackendInvokeParamsSchema = external_exports.strictObject({
|
|
19094
|
+
...extensionIdParams,
|
|
19095
|
+
method: desktopExtensionBackendMethodSchema,
|
|
19096
|
+
params: jsonValueSchema.optional()
|
|
19097
|
+
});
|
|
19098
|
+
var desktopExtensionsBackendInvokeResultSchema = external_exports.strictObject({
|
|
19099
|
+
result: jsonValueSchema
|
|
19100
|
+
});
|
|
19101
|
+
|
|
19102
|
+
// ../../shared-contracts/dist/desktop-extension-management.js
|
|
19103
|
+
var DESKTOP_EXTENSIONS_LIST_METHOD = "codexhost/desktop/extensions/list";
|
|
19104
|
+
var DESKTOP_EXTENSIONS_ENABLE_METHOD = "codexhost/desktop/extensions/enable";
|
|
19105
|
+
var DESKTOP_EXTENSIONS_DISABLE_METHOD = "codexhost/desktop/extensions/disable";
|
|
19106
|
+
var DESKTOP_EXTENSIONS_CATALOG_METHOD = "codexhost/desktop/extensions/catalog";
|
|
19107
|
+
var DESKTOP_EXTENSIONS_INSTALL_METHOD = "codexhost/desktop/extensions/install";
|
|
19108
|
+
var DESKTOP_EXTENSIONS_UNINSTALL_METHOD = "codexhost/desktop/extensions/uninstall";
|
|
19109
|
+
var DESKTOP_EXTENSIONS_RECOVER_METHOD = "codexhost/desktop/extensions/disable-all-and-reload";
|
|
19110
|
+
var DESKTOP_EXTENSION_MANAGEMENT_METHODS = [
|
|
19111
|
+
DESKTOP_EXTENSIONS_LIST_METHOD,
|
|
19112
|
+
DESKTOP_EXTENSIONS_ENABLE_METHOD,
|
|
19113
|
+
DESKTOP_EXTENSIONS_DISABLE_METHOD,
|
|
19114
|
+
DESKTOP_EXTENSIONS_RECOVER_METHOD,
|
|
19115
|
+
DESKTOP_EXTENSIONS_CATALOG_METHOD,
|
|
19116
|
+
DESKTOP_EXTENSIONS_INSTALL_METHOD,
|
|
19117
|
+
DESKTOP_EXTENSIONS_UNINSTALL_METHOD,
|
|
19118
|
+
DESKTOP_EXTENSIONS_ASSET_METHOD,
|
|
19119
|
+
DESKTOP_EXTENSIONS_SETTINGS_GET_METHOD,
|
|
19120
|
+
DESKTOP_EXTENSIONS_SETTINGS_SET_METHOD,
|
|
19121
|
+
DESKTOP_EXTENSIONS_BACKEND_INVOKE_METHOD
|
|
19122
|
+
];
|
|
19123
|
+
var revisionSchema = external_exports.int().nonnegative();
|
|
19124
|
+
var desktopExtensionsListParamsSchema = external_exports.strictObject({});
|
|
19125
|
+
var desktopExtensionSelectionParamsSchema = external_exports.strictObject({
|
|
19126
|
+
id: desktopExtensionIdSchema,
|
|
19127
|
+
expectedRevision: revisionSchema
|
|
19128
|
+
});
|
|
19129
|
+
var desktopExtensionsRecoveryParamsSchema = external_exports.strictObject({
|
|
19130
|
+
expectedRevision: revisionSchema.optional()
|
|
19131
|
+
});
|
|
19132
|
+
var rasterDataUrlSchema = (maxBytes) => external_exports.string().max("data:image/jpeg;base64,".length + 4 * Math.ceil(maxBytes / 3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
19133
|
+
var desktopExtensionListItemSchema = external_exports.strictObject({
|
|
19134
|
+
// An invalid discovery can have a directory name that isn't a valid extension ID.
|
|
19135
|
+
id: external_exports.string().min(1),
|
|
19136
|
+
manifest: desktopExtensionManifestSchema.optional(),
|
|
19137
|
+
iconDataUrl: rasterDataUrlSchema(DESKTOP_EXTENSION_ICON_MAX_BYTES).optional(),
|
|
19138
|
+
screenshotDataUrls: external_exports.array(rasterDataUrlSchema(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT).optional(),
|
|
19139
|
+
enabled: external_exports.boolean(),
|
|
19140
|
+
status: desktopExtensionStatusSchema
|
|
19141
|
+
});
|
|
19142
|
+
var desktopExtensionsListResultSchema = external_exports.strictObject({
|
|
19143
|
+
configuration: desktopExtensionConfigurationSchema,
|
|
19144
|
+
desktopConnected: external_exports.boolean(),
|
|
19145
|
+
diagnostics: external_exports.array(external_exports.string()),
|
|
19146
|
+
extensions: external_exports.array(desktopExtensionListItemSchema)
|
|
19147
|
+
});
|
|
19148
|
+
var desktopExtensionsCatalogParamsSchema = external_exports.strictObject({
|
|
19149
|
+
forceRefresh: external_exports.boolean().optional()
|
|
19150
|
+
});
|
|
19151
|
+
var desktopExtensionsCatalogResultSchema = external_exports.strictObject({
|
|
19152
|
+
catalogUrl: external_exports.string(),
|
|
19153
|
+
source: external_exports.enum(["remote", "fallback"]),
|
|
19154
|
+
fetchedAt: external_exports.string(),
|
|
19155
|
+
cached: external_exports.boolean(),
|
|
19156
|
+
extensions: desktopExtensionCatalogSchema.shape.extensions,
|
|
19157
|
+
error: external_exports.string().optional()
|
|
19158
|
+
});
|
|
19159
|
+
var desktopExtensionsInstallParamsSchema = external_exports.strictObject({
|
|
19160
|
+
source: external_exports.discriminatedUnion("type", [
|
|
19161
|
+
external_exports.strictObject({ type: external_exports.literal("catalog"), id: desktopExtensionIdSchema }),
|
|
19162
|
+
external_exports.strictObject({
|
|
19163
|
+
type: external_exports.literal("url"),
|
|
19164
|
+
url: desktopExtensionHttpUrlSchema,
|
|
19165
|
+
expectedSha256: desktopExtensionHashSchema.optional()
|
|
19166
|
+
}),
|
|
19167
|
+
external_exports.strictObject({
|
|
19168
|
+
type: external_exports.literal("zip-base64"),
|
|
19169
|
+
fileName: external_exports.string().trim().min(1).max(255),
|
|
19170
|
+
contentBase64: external_exports.string().min(4).max(DESKTOP_EXTENSION_ZIP_MAX_BASE64_LENGTH).refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/u.test(value), "Expected standard padded base64")
|
|
19171
|
+
})
|
|
19172
|
+
])
|
|
19173
|
+
});
|
|
19174
|
+
var desktopExtensionsInstallResultSchema = external_exports.strictObject({
|
|
19175
|
+
extensionId: desktopExtensionIdSchema,
|
|
19176
|
+
version: external_exports.string().min(1),
|
|
19177
|
+
replaced: external_exports.boolean(),
|
|
19178
|
+
installedPath: external_exports.string(),
|
|
19179
|
+
list: desktopExtensionsListResultSchema
|
|
19180
|
+
});
|
|
19181
|
+
var desktopExtensionsUninstallParamsSchema = external_exports.strictObject({
|
|
19182
|
+
id: desktopExtensionIdSchema
|
|
19183
|
+
});
|
|
19184
|
+
var desktopExtensionsUninstallResultSchema = external_exports.strictObject({
|
|
19185
|
+
removedId: desktopExtensionIdSchema,
|
|
19186
|
+
list: desktopExtensionsListResultSchema
|
|
19187
|
+
});
|
|
19188
|
+
var desktopExtensionMutationResultSchema = external_exports.discriminatedUnion("state", [
|
|
19189
|
+
external_exports.strictObject({ state: external_exports.literal("saved"), configuration: desktopExtensionConfigurationSchema }),
|
|
19190
|
+
external_exports.strictObject({ state: external_exports.literal("slot-conflict"), conflictWith: desktopExtensionIdSchema }),
|
|
19191
|
+
external_exports.strictObject({ state: external_exports.literal("revision-conflict"), revision: revisionSchema })
|
|
19192
|
+
]);
|
|
19193
|
+
|
|
18828
19194
|
// ../../shared-contracts/dist/errors.js
|
|
18829
19195
|
var codexhostErrorSchema = external_exports.strictObject({
|
|
18830
19196
|
code: external_exports.string().min(1),
|
|
@@ -18845,16 +19211,6 @@ var harnessLocalizationsSchema = external_exports.record(localeSchema, external_
|
|
|
18845
19211
|
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
18846
19212
|
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
18847
19213
|
|
|
18848
|
-
// ../../shared-contracts/dist/ids.js
|
|
18849
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18850
|
-
message: "Identifier must not be empty or whitespace"
|
|
18851
|
-
});
|
|
18852
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
18853
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
18854
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
18855
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18856
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18857
|
-
|
|
18858
19214
|
// ../../shared-contracts/dist/harness-permission-modes.js
|
|
18859
19215
|
var HARNESS_PERMISSION_MODE_ID_MAX_LENGTH = 128;
|
|
18860
19216
|
var HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH = 256;
|
|
@@ -19054,6 +19410,13 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
19054
19410
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
19055
19411
|
resetCredits: accountResetCreditsSchema.optional()
|
|
19056
19412
|
}).strict();
|
|
19413
|
+
var accountBalanceSnapshotSchema = external_exports.object({
|
|
19414
|
+
amount: external_exports.number().finite().nonnegative(),
|
|
19415
|
+
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
19416
|
+
currency: external_exports.string().trim().min(1).max(8),
|
|
19417
|
+
/** Native label when the Harness exposes several Billing Sources. */
|
|
19418
|
+
label: external_exports.string().trim().min(1).max(128).optional()
|
|
19419
|
+
}).strict();
|
|
19057
19420
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
19058
19421
|
threadId: hostThreadIdSchema,
|
|
19059
19422
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -19062,7 +19425,10 @@ var threadUsageInspectionSchema = external_exports.object({
|
|
|
19062
19425
|
threadId: hostThreadIdSchema,
|
|
19063
19426
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
19064
19427
|
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
19065
|
-
/**
|
|
19428
|
+
/** Prepaid funds for the Thread's Billing Source; shown only when no percentage quota exists. */
|
|
19429
|
+
accountBalance: accountBalanceSnapshotSchema.optional(),
|
|
19430
|
+
/** Whether this source can provide cached account quota (credits or a prepaid balance)
|
|
19431
|
+
* independently of usage. */
|
|
19066
19432
|
accountCreditsSupported: external_exports.boolean().optional()
|
|
19067
19433
|
}).strict();
|
|
19068
19434
|
|
|
@@ -19354,12 +19720,89 @@ var threadSteeringInspectResultSchema = external_exports.object({
|
|
|
19354
19720
|
}).strict();
|
|
19355
19721
|
|
|
19356
19722
|
// ../../shared-contracts/dist/thread-archive-confirm.js
|
|
19723
|
+
var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
|
|
19357
19724
|
var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
|
|
19358
19725
|
var threadArchiveConfirmResultSchema = external_exports.object({ confirmed: external_exports.boolean() }).strict();
|
|
19359
19726
|
|
|
19360
19727
|
// ../../shared-contracts/dist/client-channel.js
|
|
19361
19728
|
var CLIENT_CHANNEL_VERSION = 1;
|
|
19362
19729
|
var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
|
|
19730
|
+
var CLIENT_CHANNEL_METHODS = [
|
|
19731
|
+
"codexhost/skills/list",
|
|
19732
|
+
"codexhost/voice/status",
|
|
19733
|
+
"codexhost/voice/transcribe",
|
|
19734
|
+
"codexhost/harness/display-settings/get",
|
|
19735
|
+
"codexhost/harness/display-settings/set",
|
|
19736
|
+
"codexhost/harness/display-settings/capabilities",
|
|
19737
|
+
"codexhost/harness/preferences/get",
|
|
19738
|
+
"codexhost/harness/preferences/patch",
|
|
19739
|
+
"thread/list",
|
|
19740
|
+
"codexhost/thread/catalog/read",
|
|
19741
|
+
"thread/read",
|
|
19742
|
+
"thread/resume",
|
|
19743
|
+
"thread/fork",
|
|
19744
|
+
"thread/turns/list",
|
|
19745
|
+
"thread/revert",
|
|
19746
|
+
"thread/items/list",
|
|
19747
|
+
"thread/start",
|
|
19748
|
+
"thread/name/set",
|
|
19749
|
+
"codexhost/thread/title/generate",
|
|
19750
|
+
"thread/archive",
|
|
19751
|
+
THREAD_ARCHIVE_CONFIRM_METHOD,
|
|
19752
|
+
"thread/unarchive",
|
|
19753
|
+
"turn/start",
|
|
19754
|
+
"turn/interrupt",
|
|
19755
|
+
"turn/steer",
|
|
19756
|
+
"thread/queue/list",
|
|
19757
|
+
"thread/queue/add",
|
|
19758
|
+
"thread/queue/update",
|
|
19759
|
+
"thread/queue/delete",
|
|
19760
|
+
"thread/queue/reorder",
|
|
19761
|
+
"thread/queue/start",
|
|
19762
|
+
"codexhost/thread/queue/send-now",
|
|
19763
|
+
"codexhost/workspace/read",
|
|
19764
|
+
"codexhost/thread/tree/read",
|
|
19765
|
+
"codexhost/thread/pins/list",
|
|
19766
|
+
"codexhost/thread/pins/set",
|
|
19767
|
+
"codexhost/harness/plugins/list",
|
|
19768
|
+
"codexhost/harness/inspect",
|
|
19769
|
+
"codexhost/thread/inspect",
|
|
19770
|
+
"codexhost/thread/usage/inspect",
|
|
19771
|
+
"codexhost/thread/ownership/list",
|
|
19772
|
+
"codexhost/thread/model/select",
|
|
19773
|
+
"codexhost/thread/thinking/select",
|
|
19774
|
+
"codexhost/thread/permission-mode/select",
|
|
19775
|
+
"codexhost/thread/commands/inspect",
|
|
19776
|
+
"codexhost/harness/commands/inspect",
|
|
19777
|
+
"codexhost/thread/command/execute",
|
|
19778
|
+
"codexhost/thread/fork",
|
|
19779
|
+
"codexhost/harness/session-import/sources",
|
|
19780
|
+
"codexhost/harness/session-import/list",
|
|
19781
|
+
"codexhost/harness/session-import/import",
|
|
19782
|
+
// Host settings shared across Desktop and Web.
|
|
19783
|
+
...DESKTOP_EXTENSION_MANAGEMENT_METHODS,
|
|
19784
|
+
"codexhost/harness/installation",
|
|
19785
|
+
"codexhost/harness/installation/start",
|
|
19786
|
+
"codexhost/harness/installation/status",
|
|
19787
|
+
"codexhost/harness/launch-settings/get",
|
|
19788
|
+
"codexhost/harness/launch-settings/set",
|
|
19789
|
+
"codexhost/harness/web-ui/open",
|
|
19790
|
+
"codexhost/harness/accounts/sources",
|
|
19791
|
+
"codexhost/harness/accounts/list",
|
|
19792
|
+
"codexhost/harness/accounts/inspect",
|
|
19793
|
+
"codexhost/harness/credential-imports",
|
|
19794
|
+
"codexhost/account/list",
|
|
19795
|
+
"codexhost/account/refresh",
|
|
19796
|
+
"codexhost/account/usage/inspect",
|
|
19797
|
+
"codexhost/usage/model-prices/get",
|
|
19798
|
+
"codexhost/usage/model-prices/set",
|
|
19799
|
+
"codexhost/usage/model-prices/default",
|
|
19800
|
+
"codexhost/usage/statistics/get",
|
|
19801
|
+
"codexhost/update/check",
|
|
19802
|
+
"codexhost/update/start",
|
|
19803
|
+
"codexhost/update/status",
|
|
19804
|
+
"codexhost/sessions/loaded/list"
|
|
19805
|
+
];
|
|
19363
19806
|
var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
|
|
19364
19807
|
var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
|
|
19365
19808
|
var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
|
|
@@ -19573,6 +20016,29 @@ var threadCatalogReadResultSchema = external_exports.object({
|
|
|
19573
20016
|
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
19574
20017
|
}).strict();
|
|
19575
20018
|
|
|
20019
|
+
// ../../shared-contracts/dist/thread-tree-watch.js
|
|
20020
|
+
var THREAD_TREE_MAX_NODES = 5e3;
|
|
20021
|
+
var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
|
|
20022
|
+
var threadTreeNodeSchema = external_exports.strictObject({
|
|
20023
|
+
harnessId: harnessIdSchema,
|
|
20024
|
+
title: external_exports.string().optional(),
|
|
20025
|
+
status: threadTreeStatusSchema,
|
|
20026
|
+
archived: external_exports.boolean()
|
|
20027
|
+
});
|
|
20028
|
+
var threadTreeSnapshotSchema = external_exports.strictObject({
|
|
20029
|
+
revision: external_exports.int().nonnegative(),
|
|
20030
|
+
parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
|
|
20031
|
+
nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
|
|
20032
|
+
truncated: external_exports.boolean()
|
|
20033
|
+
}).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)), "Missing Thread tree node");
|
|
20034
|
+
var subscriptionId = external_exports.string().min(1).max(128);
|
|
20035
|
+
var threadTreeWatchParamsSchema = external_exports.strictObject({});
|
|
20036
|
+
var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
|
|
20037
|
+
var threadTreeUnwatchResultSchema = external_exports.strictObject({});
|
|
20038
|
+
var threadTreeWatchResultSchema = threadTreeUnwatchParamsSchema.extend({
|
|
20039
|
+
snapshot: threadTreeSnapshotSchema
|
|
20040
|
+
});
|
|
20041
|
+
|
|
19576
20042
|
// ../../shared-contracts/dist/voice.js
|
|
19577
20043
|
var VOICE_AUDIO_MAX_BYTES = 10 * 1024 * 1024;
|
|
19578
20044
|
var voiceAudioMimeTypeSchema = external_exports.string().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);
|
|
@@ -20203,13 +20669,6 @@ var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
|
20203
20669
|
});
|
|
20204
20670
|
|
|
20205
20671
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
20206
|
-
var accountBalanceSnapshotSchema = external_exports.object({
|
|
20207
|
-
amount: external_exports.number().finite().nonnegative(),
|
|
20208
|
-
/** ISO 4217 code as reported by the Provider, for example `CNY`. */
|
|
20209
|
-
currency: external_exports.string().trim().min(1).max(8),
|
|
20210
|
-
/** Native label when the Harness exposes several Billing Sources. */
|
|
20211
|
-
label: external_exports.string().trim().min(1).max(128).optional()
|
|
20212
|
-
}).strict();
|
|
20213
20672
|
var harnessAccountSnapshotObject = external_exports.object({
|
|
20214
20673
|
email: external_exports.string().trim().min(1).max(320).optional(),
|
|
20215
20674
|
label: external_exports.string().trim().min(1).max(256).optional(),
|
|
@@ -20243,76 +20702,6 @@ var harnessAccountListResultSchema = external_exports.object({
|
|
|
20243
20702
|
accounts: external_exports.array(requireReportedQuota(harnessAccountSnapshotObject.extend(harnessAccountIdentityShape))).max(128)
|
|
20244
20703
|
}).strict();
|
|
20245
20704
|
|
|
20246
|
-
// ../../shared-contracts/dist/harness-plugins.js
|
|
20247
|
-
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
20248
|
-
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
20249
|
-
var HARNESS_PLUGIN_LIMIT = 128;
|
|
20250
|
-
var installedHarnessPluginIdSchema = external_exports.string().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u).pipe(harnessIdSchema);
|
|
20251
|
-
var harnessPluginIdSchema = installedHarnessPluginIdSchema.refine((id) => id !== "codex", "The official Codex identity is reserved");
|
|
20252
|
-
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");
|
|
20253
|
-
var documentationUrlSchema = external_exports.url().refine((value) => /^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(value), "Plugin documentation links must be credential-free HTTPS URLs");
|
|
20254
|
-
var localizedTextSchema = external_exports.object({ en: external_exports.string().max(4096), "zh-CN": external_exports.string().max(4096).optional() }).strict();
|
|
20255
|
-
var harnessInstallationGuideSchema = external_exports.object({
|
|
20256
|
-
commands: external_exports.array(external_exports.object({ terminal: external_exports.string().max(256), command: external_exports.string().max(4096) }).strict()).max(8),
|
|
20257
|
-
before: localizedTextSchema.optional(),
|
|
20258
|
-
after: localizedTextSchema.optional(),
|
|
20259
|
-
downloads: external_exports.array(external_exports.object({ label: external_exports.string().max(128), url: documentationUrlSchema }).strict()).max(8).optional()
|
|
20260
|
-
}).strict();
|
|
20261
|
-
var pluginPresentationShape = {
|
|
20262
|
-
id: installedHarnessPluginIdSchema,
|
|
20263
|
-
name: external_exports.string().trim().min(1).max(128),
|
|
20264
|
-
version: external_exports.string().min(1).max(128),
|
|
20265
|
-
/** Capability-only plugin; omitted for existing session-capable plugins. */
|
|
20266
|
-
kind: external_exports.literal("usage").optional(),
|
|
20267
|
-
/** Original image styling or bounded vector paths; never arbitrary CSS/SVG markup. */
|
|
20268
|
-
iconStyle: external_exports.object({
|
|
20269
|
-
vector: external_exports.object({
|
|
20270
|
-
viewBox: external_exports.string().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),
|
|
20271
|
-
color: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),
|
|
20272
|
-
paths: external_exports.array(external_exports.object({
|
|
20273
|
-
d: external_exports.string().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),
|
|
20274
|
-
fillRule: external_exports.enum(["evenodd", "nonzero"]).optional(),
|
|
20275
|
-
fill: external_exports.string().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()
|
|
20276
|
-
}).strict()).min(1).max(32)
|
|
20277
|
-
}).strict().optional(),
|
|
20278
|
-
background: external_exports.string().regex(/^#[a-f0-9]{6}$/iu).optional(),
|
|
20279
|
-
borderRadius: external_exports.number().min(0).max(50).optional(),
|
|
20280
|
-
paddingRatio: external_exports.number().min(0).max(0.25).optional()
|
|
20281
|
-
}).strict().optional(),
|
|
20282
|
-
installation: harnessInstallationGuideSchema.optional(),
|
|
20283
|
-
notice: localizedTextSchema.optional(),
|
|
20284
|
-
/** The factory accepts a persisted local entrypoint through its construction context. */
|
|
20285
|
-
launchCommand: external_exports.literal(true).optional(),
|
|
20286
|
-
links: external_exports.object({
|
|
20287
|
-
website: documentationUrlSchema.optional(),
|
|
20288
|
-
documentation: documentationUrlSchema.optional(),
|
|
20289
|
-
installation: documentationUrlSchema.optional()
|
|
20290
|
-
}).strict().optional()
|
|
20291
|
-
};
|
|
20292
|
-
var harnessPluginManifestSchema = external_exports.object({
|
|
20293
|
-
manifestVersion: external_exports.literal(1),
|
|
20294
|
-
...pluginPresentationShape,
|
|
20295
|
-
adapterApiVersion: external_exports.number().int().positive(),
|
|
20296
|
-
entry: relativeResourceSchema,
|
|
20297
|
-
icon: relativeResourceSchema.optional()
|
|
20298
|
-
}).strict();
|
|
20299
|
-
var harnessPluginIconSchema = external_exports.string().max(Math.ceil(HARNESS_PLUGIN_ICON_MAX_BYTES / 3) * 4 + 64).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u);
|
|
20300
|
-
var harnessPluginDescriptorSchema = external_exports.object({
|
|
20301
|
-
...pluginPresentationShape,
|
|
20302
|
-
icon: harnessPluginIconSchema.optional()
|
|
20303
|
-
}).strict();
|
|
20304
|
-
var harnessPluginListParamsSchema = external_exports.object({}).strict();
|
|
20305
|
-
var harnessPluginListResultSchema = external_exports.object({
|
|
20306
|
-
plugins: external_exports.array(harnessPluginDescriptorSchema.extend({ id: harnessPluginIdSchema })).max(HARNESS_PLUGIN_LIMIT)
|
|
20307
|
-
}).strict();
|
|
20308
|
-
var harnessPluginConfigurationSchema = external_exports.object({
|
|
20309
|
-
version: external_exports.literal(1),
|
|
20310
|
-
enabled: external_exports.array(installedHarnessPluginIdSchema).max(HARNESS_PLUGIN_LIMIT)
|
|
20311
|
-
}).strict().refine((value) => new Set(value.enabled).size === value.enabled.length, {
|
|
20312
|
-
message: "Enabled plugin IDs must be unique",
|
|
20313
|
-
path: ["enabled"]
|
|
20314
|
-
});
|
|
20315
|
-
|
|
20316
20705
|
// ../../shared-contracts/dist/harness-route.js
|
|
20317
20706
|
var harnessPluginRouteSchema = external_exports.object({
|
|
20318
20707
|
harnessId: harnessPluginIdSchema,
|
|
@@ -20882,6 +21271,248 @@ var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdS
|
|
|
20882
21271
|
// ../../shared-contracts/dist/index.js
|
|
20883
21272
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
20884
21273
|
|
|
21274
|
+
// dist/account-balance.js
|
|
21275
|
+
var DEEPSEEK_BALANCE_ENDPOINT = "https://api.deepseek.com/user/balance";
|
|
21276
|
+
var DEEPSEEK_API_KEY_REF = "DEEPSEEK_API_KEY";
|
|
21277
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
21278
|
+
var MAX_BALANCE_ACCOUNTS = 4;
|
|
21279
|
+
function dshHome(environment) {
|
|
21280
|
+
const configured = environment.DSH_HOME?.trim();
|
|
21281
|
+
if (configured)
|
|
21282
|
+
return configured;
|
|
21283
|
+
return path5.join(environment.HOME || environment.USERPROFILE || os2.homedir(), ".dsh");
|
|
21284
|
+
}
|
|
21285
|
+
function unquote(value) {
|
|
21286
|
+
const trimmed = value.trim();
|
|
21287
|
+
const quoted = /^(["'])(.*?)\1\s*(?:#.*)?$/u.exec(trimmed);
|
|
21288
|
+
if (quoted)
|
|
21289
|
+
return (quoted[2] ?? "").trim();
|
|
21290
|
+
return trimmed.replace(/(?:^|\s+)#.*$/u, "").trim();
|
|
21291
|
+
}
|
|
21292
|
+
function readCredentialRef(text, name) {
|
|
21293
|
+
const lines = text.split(/\r?\n/u);
|
|
21294
|
+
const entry = new RegExp(`^(\\s*)${name}\\s*:(.*)$`, "u");
|
|
21295
|
+
let inRefs = false;
|
|
21296
|
+
let refsIndent = -1;
|
|
21297
|
+
const versioned = lines.some((line) => /^version\s*:/u.test(line));
|
|
21298
|
+
for (const line of lines) {
|
|
21299
|
+
if (!line.trim() || line.trimStart().startsWith("#"))
|
|
21300
|
+
continue;
|
|
21301
|
+
const indent = line.length - line.trimStart().length;
|
|
21302
|
+
if (indent === 0) {
|
|
21303
|
+
inRefs = /^refs\s*:\s*(?:#.*)?$/u.test(line);
|
|
21304
|
+
refsIndent = -1;
|
|
21305
|
+
if (!versioned) {
|
|
21306
|
+
const flat = entry.exec(line);
|
|
21307
|
+
if (flat)
|
|
21308
|
+
return unquote(flat[2] ?? "") || void 0;
|
|
21309
|
+
}
|
|
21310
|
+
continue;
|
|
21311
|
+
}
|
|
21312
|
+
if (!inRefs)
|
|
21313
|
+
continue;
|
|
21314
|
+
if (refsIndent === -1)
|
|
21315
|
+
refsIndent = indent;
|
|
21316
|
+
if (indent !== refsIndent)
|
|
21317
|
+
continue;
|
|
21318
|
+
const match = entry.exec(line);
|
|
21319
|
+
if (match)
|
|
21320
|
+
return unquote(match[2] ?? "") || void 0;
|
|
21321
|
+
}
|
|
21322
|
+
return void 0;
|
|
21323
|
+
}
|
|
21324
|
+
async function readOptional(file2, signal) {
|
|
21325
|
+
try {
|
|
21326
|
+
signal?.throwIfAborted();
|
|
21327
|
+
if (!(await stat(file2)).isFile())
|
|
21328
|
+
throw new Error("Expected a regular DSH configuration file");
|
|
21329
|
+
return await readFile2(file2, { encoding: "utf8", ...signal ? { signal } : {} });
|
|
21330
|
+
} catch (error51) {
|
|
21331
|
+
if (error51.code === "ENOENT")
|
|
21332
|
+
return void 0;
|
|
21333
|
+
throw error51;
|
|
21334
|
+
}
|
|
21335
|
+
}
|
|
21336
|
+
async function readDeepSeekApiKey(environment, signal) {
|
|
21337
|
+
const home = dshHome(environment);
|
|
21338
|
+
const dotEnv = parseEnv(await readOptional(path5.join(home, ".env"), signal) ?? "");
|
|
21339
|
+
const baseUrl = environment.DEEPSEEK_BASE_URL ?? dotEnv.DEEPSEEK_BASE_URL;
|
|
21340
|
+
if (baseUrl !== void 0) {
|
|
21341
|
+
const endpoint = URL.parse(baseUrl);
|
|
21342
|
+
if (endpoint?.protocol !== "https:" || endpoint.origin !== new URL(DEEPSEEK_BALANCE_ENDPOINT).origin) {
|
|
21343
|
+
return void 0;
|
|
21344
|
+
}
|
|
21345
|
+
}
|
|
21346
|
+
for (const directory of [home, path5.join(home, "profiles", "web")]) {
|
|
21347
|
+
const patch = await readOptional(path5.join(directory, "cordis.patch.yml"), signal);
|
|
21348
|
+
if (patch !== void 0 && patch.trim() !== "[]")
|
|
21349
|
+
return void 0;
|
|
21350
|
+
}
|
|
21351
|
+
const credentials = await readOptional(path5.join(home, ".credentials.yaml"), signal);
|
|
21352
|
+
const fromCredentials = credentials ? readCredentialRef(credentials, DEEPSEEK_API_KEY_REF) : void 0;
|
|
21353
|
+
return fromCredentials || environment[DEEPSEEK_API_KEY_REF]?.trim() || dotEnv[DEEPSEEK_API_KEY_REF]?.trim() || void 0;
|
|
21354
|
+
}
|
|
21355
|
+
function record3(value) {
|
|
21356
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
21357
|
+
}
|
|
21358
|
+
function finiteAmount(value) {
|
|
21359
|
+
const amount = typeof value === "number" ? value : typeof value === "string" && value.trim() ? Number(value) : Number.NaN;
|
|
21360
|
+
return Number.isFinite(amount) && amount >= 0 ? amount : null;
|
|
21361
|
+
}
|
|
21362
|
+
function projectDeepSeekBalances(payload) {
|
|
21363
|
+
const data = record3(payload);
|
|
21364
|
+
if (!Array.isArray(data.balance_infos))
|
|
21365
|
+
return [];
|
|
21366
|
+
const entries = data.balance_infos.flatMap((value) => {
|
|
21367
|
+
const info = record3(value);
|
|
21368
|
+
const amount = finiteAmount(info.total_balance);
|
|
21369
|
+
const currency = typeof info.currency === "string" ? info.currency.trim() : "";
|
|
21370
|
+
return amount === null || !currency ? [] : [{ amount, currency }];
|
|
21371
|
+
});
|
|
21372
|
+
const funded = entries.filter((entry) => entry.amount > 0);
|
|
21373
|
+
const shown = (funded.length > 0 ? funded : entries.slice(0, 1)).slice(0, MAX_BALANCE_ACCOUNTS);
|
|
21374
|
+
return shown.flatMap(({ amount, currency }) => {
|
|
21375
|
+
const parsed = harnessAccountSnapshotSchema.safeParse({
|
|
21376
|
+
label: shown.length > 1 ? `DeepSeek API (${currency})` : "DeepSeek API",
|
|
21377
|
+
balance: { amount, currency, label: "DeepSeek API" }
|
|
21378
|
+
});
|
|
21379
|
+
return parsed.success ? [parsed.data] : [];
|
|
21380
|
+
});
|
|
21381
|
+
}
|
|
21382
|
+
async function fetchDeepSeekBalances(input = {}) {
|
|
21383
|
+
try {
|
|
21384
|
+
const timeout = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
21385
|
+
const signal = input.signal ? AbortSignal.any([input.signal, timeout]) : timeout;
|
|
21386
|
+
signal.throwIfAborted();
|
|
21387
|
+
const environment = input.environment ?? process.env;
|
|
21388
|
+
const key = await (input.readApiKey ? input.readApiKey() : readDeepSeekApiKey(environment, signal));
|
|
21389
|
+
if (!key)
|
|
21390
|
+
return [];
|
|
21391
|
+
signal.throwIfAborted();
|
|
21392
|
+
const response = await (input.fetch ?? fetch)(DEEPSEEK_BALANCE_ENDPOINT, {
|
|
21393
|
+
headers: { Authorization: `Bearer ${key}`, Accept: "application/json" },
|
|
21394
|
+
redirect: "error",
|
|
21395
|
+
signal
|
|
21396
|
+
});
|
|
21397
|
+
if (!response.ok) {
|
|
21398
|
+
void response.body?.cancel().catch(() => {
|
|
21399
|
+
});
|
|
21400
|
+
return [];
|
|
21401
|
+
}
|
|
21402
|
+
const payload = await response.json();
|
|
21403
|
+
signal.throwIfAborted();
|
|
21404
|
+
return projectDeepSeekBalances(payload);
|
|
21405
|
+
} catch {
|
|
21406
|
+
return [];
|
|
21407
|
+
}
|
|
21408
|
+
}
|
|
21409
|
+
var BALANCE_REFRESH_INTERVAL_MS = 3e4;
|
|
21410
|
+
var DeepSeekBalanceCache = class {
|
|
21411
|
+
fetchBalances;
|
|
21412
|
+
now;
|
|
21413
|
+
intervalMs;
|
|
21414
|
+
#value = null;
|
|
21415
|
+
#fetchedAt = Number.NEGATIVE_INFINITY;
|
|
21416
|
+
#flight;
|
|
21417
|
+
#closed = false;
|
|
21418
|
+
constructor(fetchBalances, now = Date.now, intervalMs = BALANCE_REFRESH_INTERVAL_MS) {
|
|
21419
|
+
this.fetchBalances = fetchBalances;
|
|
21420
|
+
this.now = now;
|
|
21421
|
+
this.intervalMs = intervalMs;
|
|
21422
|
+
}
|
|
21423
|
+
read() {
|
|
21424
|
+
return this.#closed ? null : this.#value;
|
|
21425
|
+
}
|
|
21426
|
+
/** Fresh rows for the settings page; also updates the composer value. */
|
|
21427
|
+
inspect() {
|
|
21428
|
+
if (this.#closed)
|
|
21429
|
+
return Promise.resolve([]);
|
|
21430
|
+
this.#flight ??= this.fetchBalances().catch(() => []).then((accounts) => {
|
|
21431
|
+
if (this.#closed)
|
|
21432
|
+
return [];
|
|
21433
|
+
this.#value = accounts[0]?.balance ?? null;
|
|
21434
|
+
this.#fetchedAt = this.now();
|
|
21435
|
+
return accounts;
|
|
21436
|
+
}).finally(() => {
|
|
21437
|
+
this.#flight = void 0;
|
|
21438
|
+
});
|
|
21439
|
+
return this.#flight;
|
|
21440
|
+
}
|
|
21441
|
+
async refresh() {
|
|
21442
|
+
if (this.#closed)
|
|
21443
|
+
return null;
|
|
21444
|
+
if (!this.#flight && this.now() - this.#fetchedAt < this.intervalMs)
|
|
21445
|
+
return this.#value;
|
|
21446
|
+
await this.inspect();
|
|
21447
|
+
return this.read();
|
|
21448
|
+
}
|
|
21449
|
+
close() {
|
|
21450
|
+
this.#closed = true;
|
|
21451
|
+
this.#value = null;
|
|
21452
|
+
}
|
|
21453
|
+
};
|
|
21454
|
+
|
|
21455
|
+
// dist/modern/usage-statistics.js
|
|
21456
|
+
import os3 from "node:os";
|
|
21457
|
+
import path6 from "node:path";
|
|
21458
|
+
import { lstat, readFile as readFile3, readdir } from "node:fs/promises";
|
|
21459
|
+
import { zstdDecompressSync } from "node:zlib";
|
|
21460
|
+
|
|
21461
|
+
// ../../harness-adapter/dist/usage-statistics.js
|
|
21462
|
+
var MAX_SESSION_ID_LENGTH = 512;
|
|
21463
|
+
var MAX_CWD_LENGTH = 4096;
|
|
21464
|
+
var MAX_SESSION_TITLE_LENGTH = 200;
|
|
21465
|
+
function usageSessionTitle(value) {
|
|
21466
|
+
if (typeof value !== "string")
|
|
21467
|
+
return void 0;
|
|
21468
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
21469
|
+
if (!normalized)
|
|
21470
|
+
return void 0;
|
|
21471
|
+
if (normalized.length <= MAX_SESSION_TITLE_LENGTH)
|
|
21472
|
+
return normalized;
|
|
21473
|
+
let title = "";
|
|
21474
|
+
for (const character of normalized) {
|
|
21475
|
+
if (title.length + character.length >= MAX_SESSION_TITLE_LENGTH)
|
|
21476
|
+
break;
|
|
21477
|
+
title += character;
|
|
21478
|
+
}
|
|
21479
|
+
return `${title.trimEnd()}…`;
|
|
21480
|
+
}
|
|
21481
|
+
function sessionIdOk(value) {
|
|
21482
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_SESSION_ID_LENGTH;
|
|
21483
|
+
}
|
|
21484
|
+
function cwdOk(value) {
|
|
21485
|
+
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("\\\\"));
|
|
21486
|
+
}
|
|
21487
|
+
function withUsageSession(entry, session) {
|
|
21488
|
+
const sessionId = sessionIdOk(session.sessionId) ? session.sessionId : void 0;
|
|
21489
|
+
const cwd = cwdOk(session.cwd) ? session.cwd : void 0;
|
|
21490
|
+
const sessionTitle = sessionId !== void 0 ? usageSessionTitle(session.title) : void 0;
|
|
21491
|
+
if (sessionId === void 0 && cwd === void 0)
|
|
21492
|
+
return entry;
|
|
21493
|
+
return {
|
|
21494
|
+
...entry,
|
|
21495
|
+
...sessionId !== void 0 ? { sessionId } : {},
|
|
21496
|
+
...cwd !== void 0 ? { cwd } : {},
|
|
21497
|
+
...sessionTitle !== void 0 ? { sessionTitle } : {}
|
|
21498
|
+
};
|
|
21499
|
+
}
|
|
21500
|
+
function usageEntryFromRequest(request, occurredAtMs) {
|
|
21501
|
+
if (!Number.isSafeInteger(occurredAtMs) || occurredAtMs <= 0)
|
|
21502
|
+
return null;
|
|
21503
|
+
return {
|
|
21504
|
+
id: request.requestId,
|
|
21505
|
+
occurredAtMs,
|
|
21506
|
+
...request.model !== void 0 ? { model: request.model } : {},
|
|
21507
|
+
inputTokens: request.inputTokens,
|
|
21508
|
+
...request.cachedInputTokens !== void 0 ? { cachedInputTokens: request.cachedInputTokens } : {},
|
|
21509
|
+
...request.cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens: request.cacheWriteInputTokens } : {},
|
|
21510
|
+
...request.cacheWrite1hInputTokens !== void 0 ? { cacheWrite1hInputTokens: request.cacheWrite1hInputTokens } : {},
|
|
21511
|
+
outputTokens: request.outputTokens,
|
|
21512
|
+
...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
|
|
21513
|
+
};
|
|
21514
|
+
}
|
|
21515
|
+
|
|
20885
21516
|
// ../../harness-adapter/dist/approval.js
|
|
20886
21517
|
function invalidRequest(message) {
|
|
20887
21518
|
return { code: "invalidRequest", message, retryable: false };
|
|
@@ -21593,16 +22224,16 @@ var Diff = class {
|
|
|
21593
22224
|
}
|
|
21594
22225
|
}
|
|
21595
22226
|
}
|
|
21596
|
-
addToPath(
|
|
21597
|
-
const last =
|
|
22227
|
+
addToPath(path12, added, removed, oldPosInc, options) {
|
|
22228
|
+
const last = path12.lastComponent;
|
|
21598
22229
|
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
21599
22230
|
return {
|
|
21600
|
-
oldPos:
|
|
22231
|
+
oldPos: path12.oldPos + oldPosInc,
|
|
21601
22232
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
21602
22233
|
};
|
|
21603
22234
|
} else {
|
|
21604
22235
|
return {
|
|
21605
|
-
oldPos:
|
|
22236
|
+
oldPos: path12.oldPos + oldPosInc,
|
|
21606
22237
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
21607
22238
|
};
|
|
21608
22239
|
}
|
|
@@ -22899,10 +23530,10 @@ function deepSeekUsageHistory(events) {
|
|
|
22899
23530
|
const requests = /* @__PURE__ */ new Map();
|
|
22900
23531
|
let complete = true;
|
|
22901
23532
|
for (const event of events) {
|
|
22902
|
-
const
|
|
22903
|
-
if (
|
|
22904
|
-
requests.set(
|
|
22905
|
-
else if (
|
|
23533
|
+
const record4 = deepSeekUsageRecord(event, true);
|
|
23534
|
+
if (record4.kind === "request")
|
|
23535
|
+
requests.set(record4.request.requestId, record4.request);
|
|
23536
|
+
else if (record4.kind === "missing")
|
|
22906
23537
|
complete = false;
|
|
22907
23538
|
}
|
|
22908
23539
|
return { requests: [...requests.values()], complete };
|
|
@@ -22911,8 +23542,8 @@ function deepSeekUsageHistory(events) {
|
|
|
22911
23542
|
// dist/modern/usage-statistics.js
|
|
22912
23543
|
var SESSION_FILE = /^session(?:\.v(\d+))?\.jsonl(\.zstd)?$/u;
|
|
22913
23544
|
var ZSTD_MAGIC = 4247762216;
|
|
22914
|
-
function
|
|
22915
|
-
return environment.DSH_HOME ||
|
|
23545
|
+
function dshHome2(environment) {
|
|
23546
|
+
return environment.DSH_HOME || path6.join(environment.HOME || os3.homedir(), ".dsh");
|
|
22916
23547
|
}
|
|
22917
23548
|
function zstdFrames(buffer) {
|
|
22918
23549
|
const frames = [];
|
|
@@ -22951,7 +23582,7 @@ function zstdFrames(buffer) {
|
|
|
22951
23582
|
return frames;
|
|
22952
23583
|
}
|
|
22953
23584
|
async function readDshUsage(file2) {
|
|
22954
|
-
const buffer = await
|
|
23585
|
+
const buffer = await readFile3(file2);
|
|
22955
23586
|
const text = file2.endsWith(".zstd") ? zstdFrames(buffer).map((frame) => zstdDecompressSync(frame).toString("utf8")).join("") : buffer.toString("utf8");
|
|
22956
23587
|
const entries = [];
|
|
22957
23588
|
let session = {};
|
|
@@ -22977,8 +23608,8 @@ async function readDshUsage(file2) {
|
|
|
22977
23608
|
} catch {
|
|
22978
23609
|
continue;
|
|
22979
23610
|
}
|
|
22980
|
-
const
|
|
22981
|
-
const entry =
|
|
23611
|
+
const record4 = deepSeekUsageRecord(event, true);
|
|
23612
|
+
const entry = record4.kind === "request" && usageEntryFromRequest(record4.request, event.time);
|
|
22982
23613
|
if (entry)
|
|
22983
23614
|
entries.push(withUsageSession(entry, session));
|
|
22984
23615
|
}
|
|
@@ -22987,16 +23618,16 @@ async function readDshUsage(file2) {
|
|
|
22987
23618
|
function createDshUsageStatistics(environment) {
|
|
22988
23619
|
return Object.freeze({
|
|
22989
23620
|
async listSources(signal) {
|
|
22990
|
-
const root =
|
|
23621
|
+
const root = path6.join(dshHome2(environment), "sessions");
|
|
22991
23622
|
const sources = [];
|
|
22992
23623
|
for (const project2 of await readdir(root).catch(() => [])) {
|
|
22993
|
-
for (const session of await readdir(
|
|
23624
|
+
for (const session of await readdir(path6.join(root, project2)).catch(() => [])) {
|
|
22994
23625
|
signal.throwIfAborted();
|
|
22995
|
-
const directory =
|
|
23626
|
+
const directory = path6.join(root, project2, session);
|
|
22996
23627
|
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];
|
|
22997
23628
|
if (!latest)
|
|
22998
23629
|
continue;
|
|
22999
|
-
const file2 =
|
|
23630
|
+
const file2 = path6.join(directory, latest.name);
|
|
23000
23631
|
const info = await lstat(file2).catch(() => null);
|
|
23001
23632
|
if (info?.isFile() && info.size > 0) {
|
|
23002
23633
|
sources.push({ id: file2, fingerprint: `${info.ino}:${info.size}:${info.mtimeMs}` });
|
|
@@ -23087,12 +23718,12 @@ import { spawn } from "node:child_process";
|
|
|
23087
23718
|
// dist/executable.js
|
|
23088
23719
|
import { spawnSync } from "node:child_process";
|
|
23089
23720
|
import { accessSync, constants, statSync } from "node:fs";
|
|
23090
|
-
import
|
|
23721
|
+
import path7 from "node:path";
|
|
23091
23722
|
function environmentValue2(environment, name) {
|
|
23092
23723
|
return Object.entries(environment).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
23093
23724
|
}
|
|
23094
23725
|
function executableCandidates(command, environment) {
|
|
23095
|
-
const targetPath2 = process.platform === "win32" ?
|
|
23726
|
+
const targetPath2 = process.platform === "win32" ? path7.win32 : path7.posix;
|
|
23096
23727
|
if (targetPath2.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
|
|
23097
23728
|
return [command];
|
|
23098
23729
|
}
|
|
@@ -23127,7 +23758,7 @@ function resolveDeepSeekCommand(configured, environment) {
|
|
|
23127
23758
|
} : null;
|
|
23128
23759
|
}
|
|
23129
23760
|
function deepSeekProcessInvocation(command, arguments_, environment, platform = process.platform) {
|
|
23130
|
-
const extension2 =
|
|
23761
|
+
const extension2 = path7.win32.extname(command).toLowerCase();
|
|
23131
23762
|
if (platform !== "win32" || ![".cmd", ".bat"].includes(extension2)) {
|
|
23132
23763
|
return { command, arguments: arguments_, windowsVerbatimArguments: false };
|
|
23133
23764
|
}
|
|
@@ -23144,7 +23775,7 @@ function resolveWindowsTaskkillPath(environment) {
|
|
|
23144
23775
|
if (!systemRoot || !/^[A-Za-z]:[\\/]/u.test(systemRoot)) {
|
|
23145
23776
|
throw new Error("Windows SystemRoot is unavailable or invalid");
|
|
23146
23777
|
}
|
|
23147
|
-
return
|
|
23778
|
+
return path7.win32.join(systemRoot, "System32", "taskkill.exe");
|
|
23148
23779
|
}
|
|
23149
23780
|
function killDeepSeekProcessTree(child, platform, timeoutMs) {
|
|
23150
23781
|
if (!child.pid) {
|
|
@@ -23550,7 +24181,7 @@ async function probeDeepSeekExecutableGeneration(options = {}, dependencies = {
|
|
|
23550
24181
|
|
|
23551
24182
|
// dist/modern/deepseek-harness-adapter.js
|
|
23552
24183
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
23553
|
-
import
|
|
24184
|
+
import path11 from "node:path";
|
|
23554
24185
|
|
|
23555
24186
|
// dist/modern/catalog.js
|
|
23556
24187
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
@@ -27578,10 +28209,10 @@ function parseWindow(records, hasMore, expectedLastSeq, label, limits, profile)
|
|
|
27578
28209
|
const events = [];
|
|
27579
28210
|
let retainedBytes = 0;
|
|
27580
28211
|
const logicalLimit = expectedLastSeq < 0 ? 0 : expectedLastSeq + 1;
|
|
27581
|
-
for (const
|
|
27582
|
-
assertWireBytes(
|
|
28212
|
+
for (const record4 of records) {
|
|
28213
|
+
assertWireBytes(record4, limits.maxRecordBytes, `${label} record`);
|
|
27583
28214
|
const remaining = Math.min(limits.maxEvents, logicalLimit) - events.length;
|
|
27584
|
-
const expanded = profile.parseHistoryRecord(
|
|
28215
|
+
const expanded = profile.parseHistoryRecord(record4, remaining);
|
|
27585
28216
|
const expandedBytes = expanded.reduce((total, event) => total + Buffer.byteLength(JSON.stringify(event), "utf8"), 0);
|
|
27586
28217
|
if (expandedBytes > limits.maxHistoryBytes - retainedBytes) {
|
|
27587
28218
|
throw limitError("journal history exceeded maxHistoryBytes");
|
|
@@ -27840,12 +28471,12 @@ function invalidInbox() {
|
|
|
27840
28471
|
}
|
|
27841
28472
|
|
|
27842
28473
|
// dist/modern/history.js
|
|
27843
|
-
import
|
|
28474
|
+
import path9 from "node:path";
|
|
27844
28475
|
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
27845
28476
|
|
|
27846
28477
|
// ../../harness-adapter/dist/local-media-markdown.js
|
|
27847
28478
|
import { existsSync, statSync as statSync2 } from "node:fs";
|
|
27848
|
-
import
|
|
28479
|
+
import path8 from "node:path";
|
|
27849
28480
|
import { fileURLToPath } from "node:url";
|
|
27850
28481
|
var MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
27851
28482
|
".aac",
|
|
@@ -28148,7 +28779,7 @@ function skipBlanks(text, start) {
|
|
|
28148
28779
|
return index;
|
|
28149
28780
|
}
|
|
28150
28781
|
function mediaMarkdownImage(absolutePath) {
|
|
28151
|
-
const name =
|
|
28782
|
+
const name = path8.basename(absolutePath).replaceAll("]", "\\]");
|
|
28152
28783
|
return `})`;
|
|
28153
28784
|
}
|
|
28154
28785
|
function markdownDestination(absolutePath, bracketed) {
|
|
@@ -28167,11 +28798,11 @@ function resolveLocalMediaPath(raw, roots, exists = mediaFileExists) {
|
|
|
28167
28798
|
if (stripped === null)
|
|
28168
28799
|
return null;
|
|
28169
28800
|
if (isAbsoluteMediaPath(stripped)) {
|
|
28170
|
-
const absolute =
|
|
28801
|
+
const absolute = path8.resolve(stripped);
|
|
28171
28802
|
return hasMediaExtension(absolute) && exists(absolute) ? absolute : null;
|
|
28172
28803
|
}
|
|
28173
28804
|
for (const root of roots) {
|
|
28174
|
-
const absolute =
|
|
28805
|
+
const absolute = path8.resolve(root, stripped);
|
|
28175
28806
|
if (hasMediaExtension(absolute) && exists(absolute))
|
|
28176
28807
|
return absolute;
|
|
28177
28808
|
}
|
|
@@ -28190,10 +28821,10 @@ function stripFileUrl(value) {
|
|
|
28190
28821
|
}
|
|
28191
28822
|
}
|
|
28192
28823
|
function isAbsoluteMediaPath(value) {
|
|
28193
|
-
return
|
|
28824
|
+
return path8.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value);
|
|
28194
28825
|
}
|
|
28195
28826
|
function hasMediaExtension(value) {
|
|
28196
|
-
return MEDIA_EXTENSIONS.has(
|
|
28827
|
+
return MEDIA_EXTENSIONS.has(path8.extname(value).toLowerCase());
|
|
28197
28828
|
}
|
|
28198
28829
|
function mediaFileExists(absolutePath) {
|
|
28199
28830
|
try {
|
|
@@ -29023,9 +29654,9 @@ function modernWorkingDirectory(current, event) {
|
|
|
29023
29654
|
return current;
|
|
29024
29655
|
}
|
|
29025
29656
|
const next = event.data.cwd;
|
|
29026
|
-
if (
|
|
29027
|
-
return
|
|
29028
|
-
return current === void 0 ? void 0 :
|
|
29657
|
+
if (path9.isAbsolute(next))
|
|
29658
|
+
return path9.resolve(next);
|
|
29659
|
+
return current === void 0 ? void 0 : path9.resolve(current, next);
|
|
29029
29660
|
}
|
|
29030
29661
|
function modernMediaRoots(workingDirectory, sessionDirectory) {
|
|
29031
29662
|
return [
|
|
@@ -32043,10 +32674,10 @@ ${question.detail}` : question.question;
|
|
|
32043
32674
|
}
|
|
32044
32675
|
/** Publishes a live model request settled in the journal to Host usage metering. */
|
|
32045
32676
|
#meterUsage(event) {
|
|
32046
|
-
const
|
|
32047
|
-
if (
|
|
32048
|
-
this.#emit({ type: "usage.request", request:
|
|
32049
|
-
else if (
|
|
32677
|
+
const record4 = deepSeekUsageRecord(event, false);
|
|
32678
|
+
if (record4.kind === "request")
|
|
32679
|
+
this.#emit({ type: "usage.request", request: record4.request });
|
|
32680
|
+
else if (record4.kind === "missing")
|
|
32050
32681
|
this.#emit({ type: "usage.history", complete: false });
|
|
32051
32682
|
}
|
|
32052
32683
|
};
|
|
@@ -32373,7 +33004,7 @@ function safeTimerDelay(value, name) {
|
|
|
32373
33004
|
|
|
32374
33005
|
// dist/modern/session-list.js
|
|
32375
33006
|
import { Buffer as Buffer5 } from "node:buffer";
|
|
32376
|
-
import
|
|
33007
|
+
import path10 from "node:path";
|
|
32377
33008
|
var MAX_SESSION_LIST_BYTES = 32 * 1024 * 1024;
|
|
32378
33009
|
var MAX_SESSION_LIST_DEPTH = 64;
|
|
32379
33010
|
var MAX_SESSION_LIST_NODES = 2e5;
|
|
@@ -32493,7 +33124,7 @@ function parseSummary(value) {
|
|
|
32493
33124
|
};
|
|
32494
33125
|
}
|
|
32495
33126
|
function isCanonicalAbsoluteCwd(value) {
|
|
32496
|
-
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") &&
|
|
33127
|
+
return value !== void 0 && value.trim().length > 0 && !value.includes("\0") && path10.isAbsolute(value) && path10.resolve(value) === value;
|
|
32497
33128
|
}
|
|
32498
33129
|
function parseModernSessionCandidates(value) {
|
|
32499
33130
|
assertBoundedJson4(value);
|
|
@@ -32691,7 +33322,7 @@ var ModernDeepSeekHarnessAdapter = class {
|
|
|
32691
33322
|
let session;
|
|
32692
33323
|
let forkExpectation;
|
|
32693
33324
|
try {
|
|
32694
|
-
const cwd =
|
|
33325
|
+
const cwd = path11.resolve(input.cwd);
|
|
32695
33326
|
let forkInput = input.kind === "fork" ? parseModernForkInput(input, this.#profile) : void 0;
|
|
32696
33327
|
const rollbackSourceSessionId = input.kind === "rollbackLastTurn" ? modernSessionId(input.sourceRef, "roll back") : void 0;
|
|
32697
33328
|
let rollbackPlan;
|
|
@@ -33517,8 +34148,11 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33517
34148
|
open: () => this.#openWebUi()
|
|
33518
34149
|
});
|
|
33519
34150
|
#options;
|
|
34151
|
+
#balance;
|
|
33520
34152
|
#probeExecutable;
|
|
33521
34153
|
#createModernAdapter;
|
|
34154
|
+
/** Aborted by close() so a balance request in flight does not outlive the Adapter. */
|
|
34155
|
+
#accountInspection = new AbortController();
|
|
33522
34156
|
#candidate;
|
|
33523
34157
|
#cleanupFailedDuringClose = false;
|
|
33524
34158
|
#closePromise;
|
|
@@ -33529,6 +34163,10 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33529
34163
|
#terminalFailure;
|
|
33530
34164
|
constructor(options = {}, dependencies = {}) {
|
|
33531
34165
|
this.#options = options;
|
|
34166
|
+
this.#balance = new DeepSeekBalanceCache(() => fetchDeepSeekBalances({
|
|
34167
|
+
environment: options.environment ?? process.env,
|
|
34168
|
+
signal: this.#accountInspection.signal
|
|
34169
|
+
}));
|
|
33532
34170
|
this.usageStatistics = createDshUsageStatistics(options.environment ?? process.env);
|
|
33533
34171
|
this.#probeExecutable = dependencies.probeExecutable ?? ((input) => probeDeepSeekExecutableGeneration(input));
|
|
33534
34172
|
this.#createModernAdapter = dependencies.createModernAdapter ?? ((modernOptions2) => new ModernDeepSeekHarnessAdapter(modernOptions2));
|
|
@@ -33562,6 +34200,22 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33562
34200
|
this.#closePromise ??= this.#performClose();
|
|
33563
34201
|
return this.#closePromise;
|
|
33564
34202
|
}
|
|
34203
|
+
/** Report the official DeepSeek API key's prepaid balance, not the DSH sign-in account. */
|
|
34204
|
+
async inspectAccounts() {
|
|
34205
|
+
if (this.#closed)
|
|
34206
|
+
return [];
|
|
34207
|
+
return this.#balance.inspect();
|
|
34208
|
+
}
|
|
34209
|
+
/** Cached balance for the Composer; refreshed by {@link refreshBalance}. */
|
|
34210
|
+
balance() {
|
|
34211
|
+
return this.#balance.read();
|
|
34212
|
+
}
|
|
34213
|
+
refreshBalance() {
|
|
34214
|
+
return this.#balance.refresh();
|
|
34215
|
+
}
|
|
34216
|
+
async inspectAccount() {
|
|
34217
|
+
return (await this.inspectAccounts())[0] ?? null;
|
|
34218
|
+
}
|
|
33565
34219
|
async #listSessionImportCandidates() {
|
|
33566
34220
|
try {
|
|
33567
34221
|
const selected = await this.#select(false);
|
|
@@ -33715,6 +34369,8 @@ var DeepSeekHarnessAdapter = class {
|
|
|
33715
34369
|
}
|
|
33716
34370
|
async #performClose() {
|
|
33717
34371
|
this.#closed = true;
|
|
34372
|
+
this.#accountInspection.abort(new Error("DeepSeek Harness account inspection closed"));
|
|
34373
|
+
this.#balance.close();
|
|
33718
34374
|
let cleanupFailed = false;
|
|
33719
34375
|
const selection2 = this.#selection;
|
|
33720
34376
|
selection2?.abort.abort(new Error("DeepSeek Harness generation selection closed"));
|