@liberseek/boft-cli-win32-arm64 0.6.0 → 0.6.2
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/host-runtime.mjs +315 -175
- package/app/plugins/antigravity/plugin.mjs +18 -2
- package/app/plugins/claude-code/plugin.mjs +239 -37
- package/app/plugins/deepseek-harness/plugin.mjs +18 -2
- package/app/plugins/grok/plugin.mjs +1982 -1602
- package/app/plugins/omp/plugin.mjs +18 -2
- package/app/plugins/opencode/plugin.mjs +18 -2
- package/app/plugins/pi/plugin.mjs +18 -2
- package/app/renderer-extension.js +87 -6
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -14610,12 +14610,28 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
14610
14610
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
14611
14611
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14612
14612
|
label: external_exports.string().min(1).optional(),
|
|
14613
|
-
usedPercent: usagePercentSchema,
|
|
14613
|
+
usedPercent: usagePercentSchema.optional(),
|
|
14614
|
+
remaining: external_exports.number().finite().optional(),
|
|
14615
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
14614
14616
|
resetsAt: external_exports.string().min(1).optional(),
|
|
14615
14617
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
14616
14618
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
14617
14619
|
resetCredits: accountResetCreditsSchema.optional()
|
|
14618
|
-
}).strict()
|
|
14620
|
+
}).strict().superRefine((credits, context) => {
|
|
14621
|
+
if (credits.usedPercent === void 0 && credits.remaining === void 0) {
|
|
14622
|
+
context.addIssue({
|
|
14623
|
+
code: "custom",
|
|
14624
|
+
message: "Account credits must include usedPercent or remaining"
|
|
14625
|
+
});
|
|
14626
|
+
}
|
|
14627
|
+
if (credits.remaining !== void 0 && !credits.unit) {
|
|
14628
|
+
context.addIssue({
|
|
14629
|
+
code: "custom",
|
|
14630
|
+
message: "Account remaining credits require a unit",
|
|
14631
|
+
path: ["unit"]
|
|
14632
|
+
});
|
|
14633
|
+
}
|
|
14634
|
+
});
|
|
14619
14635
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
14620
14636
|
threadId: hostThreadIdSchema,
|
|
14621
14637
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -776,10 +776,10 @@ function mergeDefs(...defs) {
|
|
|
776
776
|
function cloneDef(schema) {
|
|
777
777
|
return mergeDefs(schema._zod.def);
|
|
778
778
|
}
|
|
779
|
-
function getElementAtPath(obj,
|
|
780
|
-
if (!
|
|
779
|
+
function getElementAtPath(obj, path11) {
|
|
780
|
+
if (!path11)
|
|
781
781
|
return obj;
|
|
782
|
-
return
|
|
782
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
783
783
|
}
|
|
784
784
|
function promiseAllObject(promisesObj) {
|
|
785
785
|
const keys = Object.keys(promisesObj);
|
|
@@ -1188,11 +1188,11 @@ function explicitlyAborted(x2, startIndex = 0) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
return false;
|
|
1190
1190
|
}
|
|
1191
|
-
function prefixIssues(
|
|
1191
|
+
function prefixIssues(path11, issues) {
|
|
1192
1192
|
return issues.map((iss) => {
|
|
1193
1193
|
var _a4;
|
|
1194
1194
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
1195
|
-
iss.path.unshift(
|
|
1195
|
+
iss.path.unshift(path11);
|
|
1196
1196
|
return iss;
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
@@ -1339,16 +1339,16 @@ function flattenError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
1341
1341
|
const fieldErrors = { _errors: [] };
|
|
1342
|
-
const processError = (error53,
|
|
1342
|
+
const processError = (error53, path11 = []) => {
|
|
1343
1343
|
for (const issue2 of error53.issues) {
|
|
1344
1344
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1345
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1345
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
1346
1346
|
} else if (issue2.code === "invalid_key") {
|
|
1347
|
-
processError({ issues: issue2.issues }, [...
|
|
1347
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
1348
1348
|
} else if (issue2.code === "invalid_element") {
|
|
1349
|
-
processError({ issues: issue2.issues }, [...
|
|
1349
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
1350
1350
|
} else {
|
|
1351
|
-
const fullpath = [...
|
|
1351
|
+
const fullpath = [...path11, ...issue2.path];
|
|
1352
1352
|
if (fullpath.length === 0) {
|
|
1353
1353
|
fieldErrors._errors.push(mapper(issue2));
|
|
1354
1354
|
} else {
|
|
@@ -1375,17 +1375,17 @@ function formatError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
1377
1377
|
const result = { errors: [] };
|
|
1378
|
-
const processError = (error53,
|
|
1378
|
+
const processError = (error53, path11 = []) => {
|
|
1379
1379
|
var _a4, _b2;
|
|
1380
1380
|
for (const issue2 of error53.issues) {
|
|
1381
1381
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1382
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1382
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
1383
1383
|
} else if (issue2.code === "invalid_key") {
|
|
1384
|
-
processError({ issues: issue2.issues }, [...
|
|
1384
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
1385
1385
|
} else if (issue2.code === "invalid_element") {
|
|
1386
|
-
processError({ issues: issue2.issues }, [...
|
|
1386
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
1387
1387
|
} else {
|
|
1388
|
-
const fullpath = [...
|
|
1388
|
+
const fullpath = [...path11, ...issue2.path];
|
|
1389
1389
|
if (fullpath.length === 0) {
|
|
1390
1390
|
result.errors.push(mapper(issue2));
|
|
1391
1391
|
continue;
|
|
@@ -1417,8 +1417,8 @@ function treeifyError(error52, mapper = (issue2) => issue2.message) {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
function toDotPath(_path) {
|
|
1419
1419
|
const segs = [];
|
|
1420
|
-
const
|
|
1421
|
-
for (const seg of
|
|
1420
|
+
const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1421
|
+
for (const seg of path11) {
|
|
1422
1422
|
if (typeof seg === "number")
|
|
1423
1423
|
segs.push(`[${seg}]`);
|
|
1424
1424
|
else if (typeof seg === "symbol")
|
|
@@ -14110,13 +14110,13 @@ function resolveRef(ref, ctx) {
|
|
|
14110
14110
|
if (!ref.startsWith("#")) {
|
|
14111
14111
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14112
14112
|
}
|
|
14113
|
-
const
|
|
14114
|
-
if (
|
|
14113
|
+
const path11 = ref.slice(1).split("/").filter(Boolean);
|
|
14114
|
+
if (path11.length === 0) {
|
|
14115
14115
|
return ctx.rootSchema;
|
|
14116
14116
|
}
|
|
14117
14117
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14118
|
-
if (
|
|
14119
|
-
const key =
|
|
14118
|
+
if (path11[0] === defsKey) {
|
|
14119
|
+
const key = path11[1];
|
|
14120
14120
|
if (!key || !ctx.defs[key]) {
|
|
14121
14121
|
throw new Error(`Reference not found: ${ref}`);
|
|
14122
14122
|
}
|
|
@@ -14606,12 +14606,28 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
14606
14606
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
14607
14607
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14608
14608
|
label: external_exports.string().min(1).optional(),
|
|
14609
|
-
usedPercent: usagePercentSchema,
|
|
14609
|
+
usedPercent: usagePercentSchema.optional(),
|
|
14610
|
+
remaining: external_exports.number().finite().optional(),
|
|
14611
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
14610
14612
|
resetsAt: external_exports.string().min(1).optional(),
|
|
14611
14613
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
14612
14614
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
14613
14615
|
resetCredits: accountResetCreditsSchema.optional()
|
|
14614
|
-
}).strict()
|
|
14616
|
+
}).strict().superRefine((credits, context) => {
|
|
14617
|
+
if (credits.usedPercent === void 0 && credits.remaining === void 0) {
|
|
14618
|
+
context.addIssue({
|
|
14619
|
+
code: "custom",
|
|
14620
|
+
message: "Account credits must include usedPercent or remaining"
|
|
14621
|
+
});
|
|
14622
|
+
}
|
|
14623
|
+
if (credits.remaining !== void 0 && !credits.unit) {
|
|
14624
|
+
context.addIssue({
|
|
14625
|
+
code: "custom",
|
|
14626
|
+
message: "Account remaining credits require a unit",
|
|
14627
|
+
path: ["unit"]
|
|
14628
|
+
});
|
|
14629
|
+
}
|
|
14630
|
+
});
|
|
14615
14631
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
14616
14632
|
threadId: hostThreadIdSchema,
|
|
14617
14633
|
refresh: external_exports.literal("exact").optional()
|
|
@@ -16303,7 +16319,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
16303
16319
|
|
|
16304
16320
|
// dist/claude-code-adapter.js
|
|
16305
16321
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
16306
|
-
import
|
|
16322
|
+
import path9 from "node:path";
|
|
16307
16323
|
|
|
16308
16324
|
// ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
|
16309
16325
|
import { createRequire as DW } from "node:module";
|
|
@@ -43241,8 +43257,190 @@ function projectClaudeAccountUsage(usage, account) {
|
|
|
43241
43257
|
};
|
|
43242
43258
|
}
|
|
43243
43259
|
|
|
43244
|
-
// dist/
|
|
43260
|
+
// dist/gateway-models.js
|
|
43261
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
43245
43262
|
import path7 from "node:path";
|
|
43263
|
+
var GATEWAY_MODELS_TIMEOUT_MS = 3e3;
|
|
43264
|
+
var GATEWAY_MODELS_MAX_BYTES = 2 * 1024 * 1024;
|
|
43265
|
+
var OFFICIAL_ANTHROPIC_HOST = "api.anthropic.com";
|
|
43266
|
+
var SETTINGS_ENV_KEYS = [
|
|
43267
|
+
"ANTHROPIC_BASE_URL",
|
|
43268
|
+
"ANTHROPIC_AUTH_TOKEN",
|
|
43269
|
+
"ANTHROPIC_API_KEY"
|
|
43270
|
+
];
|
|
43271
|
+
function trimmedEnv(environment, name) {
|
|
43272
|
+
const value = environment[name]?.trim();
|
|
43273
|
+
return value && value.length > 0 ? value : void 0;
|
|
43274
|
+
}
|
|
43275
|
+
function officialAnthropicHost(hostname3) {
|
|
43276
|
+
return hostname3.replace(/\.$/u, "").toLowerCase() === OFFICIAL_ANTHROPIC_HOST;
|
|
43277
|
+
}
|
|
43278
|
+
function customAnthropicBaseUrl(environment) {
|
|
43279
|
+
const raw = trimmedEnv(environment, "ANTHROPIC_BASE_URL");
|
|
43280
|
+
if (!raw)
|
|
43281
|
+
return void 0;
|
|
43282
|
+
let url2;
|
|
43283
|
+
try {
|
|
43284
|
+
url2 = new URL(raw);
|
|
43285
|
+
} catch {
|
|
43286
|
+
return void 0;
|
|
43287
|
+
}
|
|
43288
|
+
if (url2.protocol !== "http:" && url2.protocol !== "https:")
|
|
43289
|
+
return void 0;
|
|
43290
|
+
if (officialAnthropicHost(url2.hostname))
|
|
43291
|
+
return void 0;
|
|
43292
|
+
return raw.replace(/\/+$/u, "");
|
|
43293
|
+
}
|
|
43294
|
+
function gatewayModelsUrl(baseUrl) {
|
|
43295
|
+
const trimmed = baseUrl.replace(/\/+$/u, "");
|
|
43296
|
+
const prefix = /\/v1$/iu.test(trimmed) ? trimmed : `${trimmed}/v1`;
|
|
43297
|
+
return `${prefix}/models?limit=1000`;
|
|
43298
|
+
}
|
|
43299
|
+
function claudeConfigDirectory(environment) {
|
|
43300
|
+
const configured = trimmedEnv(environment, "CLAUDE_CONFIG_DIR");
|
|
43301
|
+
if (configured)
|
|
43302
|
+
return configured;
|
|
43303
|
+
const home = trimmedEnv(environment, "HOME") ?? trimmedEnv(environment, "USERPROFILE");
|
|
43304
|
+
return home ? path7.join(home, ".claude") : void 0;
|
|
43305
|
+
}
|
|
43306
|
+
async function readClaudeUserSettingsEnv(environment) {
|
|
43307
|
+
const configDir = claudeConfigDirectory(environment);
|
|
43308
|
+
if (!configDir)
|
|
43309
|
+
return {};
|
|
43310
|
+
try {
|
|
43311
|
+
const raw = await readFile3(path7.join(configDir, "settings.json"), "utf8");
|
|
43312
|
+
const parsed = JSON.parse(raw);
|
|
43313
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
43314
|
+
return {};
|
|
43315
|
+
const env = parsed.env;
|
|
43316
|
+
if (env === null || typeof env !== "object" || Array.isArray(env))
|
|
43317
|
+
return {};
|
|
43318
|
+
const overlay = {};
|
|
43319
|
+
for (const key of SETTINGS_ENV_KEYS) {
|
|
43320
|
+
const value = env[key];
|
|
43321
|
+
if (typeof value === "string" && value.trim().length > 0)
|
|
43322
|
+
overlay[key] = value;
|
|
43323
|
+
}
|
|
43324
|
+
return overlay;
|
|
43325
|
+
} catch {
|
|
43326
|
+
return {};
|
|
43327
|
+
}
|
|
43328
|
+
}
|
|
43329
|
+
async function withClaudeGatewayEnvironment(environment, readUserSettingsEnv = readClaudeUserSettingsEnv) {
|
|
43330
|
+
const overlay = await readUserSettingsEnv(environment);
|
|
43331
|
+
const merged = { ...environment };
|
|
43332
|
+
for (const [name, value] of Object.entries(overlay)) {
|
|
43333
|
+
if (merged[name] === void 0)
|
|
43334
|
+
merged[name] = value;
|
|
43335
|
+
}
|
|
43336
|
+
return merged;
|
|
43337
|
+
}
|
|
43338
|
+
function boundedLabel(value) {
|
|
43339
|
+
const trimmed = value.trim();
|
|
43340
|
+
if (trimmed.length === 0)
|
|
43341
|
+
return trimmed;
|
|
43342
|
+
return trimmed.length <= HARNESS_MODEL_LABEL_MAX_LENGTH ? trimmed : trimmed.slice(0, HARNESS_MODEL_LABEL_MAX_LENGTH);
|
|
43343
|
+
}
|
|
43344
|
+
function gatewayRow(value) {
|
|
43345
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
43346
|
+
if (typeof value !== "string")
|
|
43347
|
+
return void 0;
|
|
43348
|
+
const id2 = value.trim();
|
|
43349
|
+
if (id2.length === 0 || id2.length > CLAUDE_MODEL_VALUE_MAX_LENGTH)
|
|
43350
|
+
return void 0;
|
|
43351
|
+
const label2 = boundedLabel(id2);
|
|
43352
|
+
return label2.length === 0 ? void 0 : { value: id2, displayName: label2 };
|
|
43353
|
+
}
|
|
43354
|
+
const record2 = value;
|
|
43355
|
+
const idCandidate = record2.id ?? record2.value;
|
|
43356
|
+
if (typeof idCandidate !== "string")
|
|
43357
|
+
return void 0;
|
|
43358
|
+
const id = idCandidate.trim();
|
|
43359
|
+
if (id.length === 0 || id.length > CLAUDE_MODEL_VALUE_MAX_LENGTH)
|
|
43360
|
+
return void 0;
|
|
43361
|
+
const labelCandidate = typeof record2.display_name === "string" && record2.display_name || typeof record2.displayName === "string" && record2.displayName || typeof record2.name === "string" && record2.name || id;
|
|
43362
|
+
const label = boundedLabel(labelCandidate);
|
|
43363
|
+
return label.length === 0 ? void 0 : { value: id, displayName: label };
|
|
43364
|
+
}
|
|
43365
|
+
function nativeDefaultRow(models) {
|
|
43366
|
+
if (Array.isArray(models)) {
|
|
43367
|
+
for (const row of models) {
|
|
43368
|
+
if (row === null || typeof row !== "object" || Array.isArray(row))
|
|
43369
|
+
continue;
|
|
43370
|
+
const record2 = row;
|
|
43371
|
+
if (typeof record2.value === "string" && record2.value.trim() === "default") {
|
|
43372
|
+
return { ...record2 };
|
|
43373
|
+
}
|
|
43374
|
+
}
|
|
43375
|
+
}
|
|
43376
|
+
return { value: "default", displayName: "Default" };
|
|
43377
|
+
}
|
|
43378
|
+
function nativeSupportsAutoMode(models) {
|
|
43379
|
+
if (!Array.isArray(models))
|
|
43380
|
+
return false;
|
|
43381
|
+
return models.some((row) => row !== null && typeof row === "object" && !Array.isArray(row) && row.supportsAutoMode === true);
|
|
43382
|
+
}
|
|
43383
|
+
function parseGatewayModels(payload) {
|
|
43384
|
+
const list = Array.isArray(payload) ? payload : payload !== null && typeof payload === "object" && !Array.isArray(payload) ? payload.data ?? payload.models : void 0;
|
|
43385
|
+
if (!Array.isArray(list))
|
|
43386
|
+
return [];
|
|
43387
|
+
const rows = [];
|
|
43388
|
+
const seen = /* @__PURE__ */ new Set();
|
|
43389
|
+
for (const candidate of list) {
|
|
43390
|
+
const row = gatewayRow(candidate);
|
|
43391
|
+
if (!row || row.value === "default" || seen.has(row.value))
|
|
43392
|
+
continue;
|
|
43393
|
+
seen.add(row.value);
|
|
43394
|
+
rows.push(row);
|
|
43395
|
+
}
|
|
43396
|
+
return rows;
|
|
43397
|
+
}
|
|
43398
|
+
async function applyGatewayModelCatalog(snapshot, environment, dependencies = {}) {
|
|
43399
|
+
const resolved = await withClaudeGatewayEnvironment(environment, dependencies.readUserSettingsEnv);
|
|
43400
|
+
const baseUrl = customAnthropicBaseUrl(resolved);
|
|
43401
|
+
if (!baseUrl)
|
|
43402
|
+
return snapshot;
|
|
43403
|
+
const timeoutMs = dependencies.timeoutMs ?? GATEWAY_MODELS_TIMEOUT_MS;
|
|
43404
|
+
const fetchImpl = dependencies.fetch ?? globalThis.fetch;
|
|
43405
|
+
const headers = { Accept: "application/json" };
|
|
43406
|
+
const token = trimmedEnv(resolved, "ANTHROPIC_AUTH_TOKEN");
|
|
43407
|
+
const apiKey = trimmedEnv(resolved, "ANTHROPIC_API_KEY");
|
|
43408
|
+
if (token)
|
|
43409
|
+
headers.Authorization = `Bearer ${token}`;
|
|
43410
|
+
if (apiKey)
|
|
43411
|
+
headers["x-api-key"] = apiKey;
|
|
43412
|
+
let payload;
|
|
43413
|
+
try {
|
|
43414
|
+
const response = await fetchImpl(gatewayModelsUrl(baseUrl), {
|
|
43415
|
+
method: "GET",
|
|
43416
|
+
headers,
|
|
43417
|
+
credentials: "omit",
|
|
43418
|
+
redirect: "error",
|
|
43419
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
43420
|
+
});
|
|
43421
|
+
if (!response.ok)
|
|
43422
|
+
return snapshot;
|
|
43423
|
+
const body = await response.text();
|
|
43424
|
+
if (body.length > GATEWAY_MODELS_MAX_BYTES)
|
|
43425
|
+
return snapshot;
|
|
43426
|
+
payload = JSON.parse(body);
|
|
43427
|
+
} catch {
|
|
43428
|
+
return snapshot;
|
|
43429
|
+
}
|
|
43430
|
+
const gatewayRows = parseGatewayModels(payload);
|
|
43431
|
+
if (gatewayRows.length === 0)
|
|
43432
|
+
return snapshot;
|
|
43433
|
+
const defaultRow = nativeDefaultRow(snapshot.models);
|
|
43434
|
+
if (nativeSupportsAutoMode(snapshot.models))
|
|
43435
|
+
defaultRow.supportsAutoMode = true;
|
|
43436
|
+
return {
|
|
43437
|
+
...snapshot,
|
|
43438
|
+
models: [defaultRow, ...gatewayRows]
|
|
43439
|
+
};
|
|
43440
|
+
}
|
|
43441
|
+
|
|
43442
|
+
// dist/file-change.js
|
|
43443
|
+
import path8 from "node:path";
|
|
43246
43444
|
var hunkSchema = external_exports.object({
|
|
43247
43445
|
oldStart: external_exports.number().int().nonnegative(),
|
|
43248
43446
|
oldLines: external_exports.number().int().nonnegative(),
|
|
@@ -43290,10 +43488,10 @@ function parseClaudeNativeFileChange(toolName, value) {
|
|
|
43290
43488
|
};
|
|
43291
43489
|
}
|
|
43292
43490
|
function displayPath(nativePath, cwd) {
|
|
43293
|
-
const resolvedCwd =
|
|
43294
|
-
const resolvedPath =
|
|
43295
|
-
const relative =
|
|
43296
|
-
const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${
|
|
43491
|
+
const resolvedCwd = path8.resolve(cwd);
|
|
43492
|
+
const resolvedPath = path8.isAbsolute(nativePath) ? path8.resolve(nativePath) : path8.resolve(cwd, nativePath);
|
|
43493
|
+
const relative = path8.relative(resolvedCwd, resolvedPath);
|
|
43494
|
+
const selected = relative.length > 0 && relative !== ".." && !relative.startsWith(`..${path8.sep}`) ? relative : resolvedPath;
|
|
43297
43495
|
const normalized = selected.replaceAll("\\", "/");
|
|
43298
43496
|
return validNativePath(normalized) && normalized !== "." ? normalized : null;
|
|
43299
43497
|
}
|
|
@@ -43305,7 +43503,7 @@ function projectClaudeFileChange(value, cwd) {
|
|
|
43305
43503
|
`@@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`,
|
|
43306
43504
|
...hunk.lines
|
|
43307
43505
|
]);
|
|
43308
|
-
const absoluteDisplayPath =
|
|
43506
|
+
const absoluteDisplayPath = path8.posix.isAbsolute(normalizedPath);
|
|
43309
43507
|
const oldHeader = value.kind === "add" ? "/dev/null" : absoluteDisplayPath ? normalizedPath : `a/${normalizedPath}`;
|
|
43310
43508
|
const newHeader = absoluteDisplayPath ? normalizedPath : `b/${normalizedPath}`;
|
|
43311
43509
|
const unifiedDiff = [`--- ${oldHeader}`, `+++ ${newHeader}`, ...body, ""].join("\n");
|
|
@@ -44720,12 +44918,13 @@ var ClaudeSdkModelInspector = class {
|
|
|
44720
44918
|
}
|
|
44721
44919
|
async inspect() {
|
|
44722
44920
|
const activeQuery = this.#createQuery();
|
|
44921
|
+
let snapshot;
|
|
44723
44922
|
try {
|
|
44724
44923
|
const initialized = await activeQuery.initializationResult();
|
|
44725
44924
|
const candidate = activeQuery;
|
|
44726
44925
|
const canSelectModel = Array.isArray(initialized.models) && typeof candidate.setModel === "function";
|
|
44727
44926
|
const canSelectPermissionMode = typeof candidate.setPermissionMode === "function";
|
|
44728
|
-
|
|
44927
|
+
snapshot = {
|
|
44729
44928
|
models: initialized.models,
|
|
44730
44929
|
canSelectModel,
|
|
44731
44930
|
canSelectPermissionMode
|
|
@@ -44733,6 +44932,9 @@ var ClaudeSdkModelInspector = class {
|
|
|
44733
44932
|
} finally {
|
|
44734
44933
|
await this.close();
|
|
44735
44934
|
}
|
|
44935
|
+
if (!snapshot)
|
|
44936
|
+
throw new Error("Claude Code Model inspection did not complete");
|
|
44937
|
+
return applyGatewayModelCatalog(snapshot, this.#environment);
|
|
44736
44938
|
}
|
|
44737
44939
|
close() {
|
|
44738
44940
|
if (!this.#closePromise)
|
|
@@ -47214,7 +47416,7 @@ var ClaudeCodeAdapter = class {
|
|
|
47214
47416
|
error: invalidState("Claude Code Adapter is closing")
|
|
47215
47417
|
};
|
|
47216
47418
|
}
|
|
47217
|
-
const cwd =
|
|
47419
|
+
const cwd = path9.resolve(input.cwd ?? process.cwd());
|
|
47218
47420
|
if (!input.refresh) {
|
|
47219
47421
|
const cached2 = this.#inspectionCache.get(cwd);
|
|
47220
47422
|
if (cached2)
|
|
@@ -47360,7 +47562,7 @@ var ClaudeCodeAdapter = class {
|
|
|
47360
47562
|
let sourceSnapshot;
|
|
47361
47563
|
try {
|
|
47362
47564
|
const messages = await this.#dependencies.readSessionMessages({
|
|
47363
|
-
cwd:
|
|
47565
|
+
cwd: path9.resolve(input.cwd),
|
|
47364
47566
|
sessionId: sourceRef.data.nativeSessionId
|
|
47365
47567
|
});
|
|
47366
47568
|
sourceSnapshot = mapClaudeSnapshot(messages, sourceRef.data.nativeSessionId);
|
|
@@ -47402,7 +47604,7 @@ var ClaudeCodeAdapter = class {
|
|
|
47402
47604
|
} else {
|
|
47403
47605
|
const forked2 = await forkClaudeSession({
|
|
47404
47606
|
checkpoint: retained.checkpoint,
|
|
47405
|
-
cwd:
|
|
47607
|
+
cwd: path9.resolve(input.cwd),
|
|
47406
47608
|
dependencies: this.#dependencies,
|
|
47407
47609
|
harnessId: this.harnessId,
|
|
47408
47610
|
sourceRef: sourceRef.data
|
|
@@ -47457,7 +47659,7 @@ var ClaudeCodeAdapter = class {
|
|
|
47457
47659
|
}
|
|
47458
47660
|
};
|
|
47459
47661
|
}
|
|
47460
|
-
const cwd =
|
|
47662
|
+
const cwd = path9.resolve(input.cwd);
|
|
47461
47663
|
const nativeRef = input.kind === "resume" ? nativeSessionRefSchema.safeParse(input.nativeRef) : null;
|
|
47462
47664
|
if (nativeRef && (!nativeRef.success || nativeRef.data.harnessId !== this.harnessId)) {
|
|
47463
47665
|
return {
|
|
@@ -47525,7 +47727,7 @@ var ClaudeCodeAdapter = class {
|
|
|
47525
47727
|
};
|
|
47526
47728
|
|
|
47527
47729
|
// dist/user-shell-environment.js
|
|
47528
|
-
import
|
|
47730
|
+
import path10 from "node:path";
|
|
47529
47731
|
import { spawnSync } from "node:child_process";
|
|
47530
47732
|
var ENVIRONMENT_MARKER = Buffer.from("\0CODEXHOST_USER_SHELL_ENV_V1\0");
|
|
47531
47733
|
var ENVIRONMENT_COMMAND = "printf '\\0CODEXHOST_USER_SHELL_ENV_V1\\0'; /usr/bin/env -0";
|
|
@@ -47568,7 +47770,7 @@ function withUserShellEnvironment(environment, dependencies) {
|
|
|
47568
47770
|
if (platform === "win32" || !environment.HOME)
|
|
47569
47771
|
return environment;
|
|
47570
47772
|
const shell = environment.SHELL?.trim() || defaultShell(platform);
|
|
47571
|
-
if (!shell || !SUPPORTED_SHELLS.has(
|
|
47773
|
+
if (!shell || !SUPPORTED_SHELLS.has(path10.basename(shell)))
|
|
47572
47774
|
return environment;
|
|
47573
47775
|
const cacheKey = `${platform}\0${shell}\0${environment.HOME}`;
|
|
47574
47776
|
const cached2 = dependencies ? void 0 : shellEnvironmentCache.get(cacheKey);
|
|
@@ -18308,12 +18308,28 @@ var accountResetCreditsSchema = external_exports.object({
|
|
|
18308
18308
|
var accountCreditsSnapshotSchema = external_exports.object({
|
|
18309
18309
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
18310
18310
|
label: external_exports.string().min(1).optional(),
|
|
18311
|
-
usedPercent: usagePercentSchema,
|
|
18311
|
+
usedPercent: usagePercentSchema.optional(),
|
|
18312
|
+
remaining: external_exports.number().finite().optional(),
|
|
18313
|
+
unit: external_exports.string().trim().min(1).max(32).optional(),
|
|
18312
18314
|
resetsAt: external_exports.string().min(1).optional(),
|
|
18313
18315
|
periodType: external_exports.enum(["weekly", "monthly", "five_hour", "seven_day", "unknown"]),
|
|
18314
18316
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
18315
18317
|
resetCredits: accountResetCreditsSchema.optional()
|
|
18316
|
-
}).strict()
|
|
18318
|
+
}).strict().superRefine((credits, context) => {
|
|
18319
|
+
if (credits.usedPercent === void 0 && credits.remaining === void 0) {
|
|
18320
|
+
context.addIssue({
|
|
18321
|
+
code: "custom",
|
|
18322
|
+
message: "Account credits must include usedPercent or remaining"
|
|
18323
|
+
});
|
|
18324
|
+
}
|
|
18325
|
+
if (credits.remaining !== void 0 && !credits.unit) {
|
|
18326
|
+
context.addIssue({
|
|
18327
|
+
code: "custom",
|
|
18328
|
+
message: "Account remaining credits require a unit",
|
|
18329
|
+
path: ["unit"]
|
|
18330
|
+
});
|
|
18331
|
+
}
|
|
18332
|
+
});
|
|
18317
18333
|
var threadUsageInspectionParamsSchema = external_exports.object({
|
|
18318
18334
|
threadId: hostThreadIdSchema,
|
|
18319
18335
|
refresh: external_exports.literal("exact").optional()
|