@codexhost/cli-darwin-x64 0.14.0 → 0.16.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 +55 -7
- package/app/console-web.js +281 -79
- package/app/desktop-controller.mjs +155 -22
- package/app/host-runtime.mjs +548 -148
- package/app/plugins/antigravity/plugin.mjs +342 -53
- package/app/plugins/claude-code/plugin.mjs +393 -162
- package/app/plugins/codebuddy/plugin.mjs +245 -49
- package/app/plugins/codex-usage/plugin.mjs +75 -28
- package/app/plugins/copilot/plugin.mjs +100 -53
- package/app/plugins/cursor-cli/plugin.mjs +207 -46
- package/app/plugins/deepseek-harness/plugin.mjs +103 -36
- package/app/plugins/grok/plugin.mjs +354 -84
- package/app/plugins/hermes/plugin.mjs +50 -3
- package/app/plugins/kimi-code/plugin.mjs +62 -15
- package/app/plugins/kiro-cli/plugin.mjs +62 -15
- package/app/plugins/omp/plugin.mjs +82 -35
- package/app/plugins/opencode/plugin.mjs +104 -57
- package/app/plugins/pi/plugin.mjs +134 -50
- package/app/plugins/qoder/plugin.mjs +72 -25
- package/app/plugins/qoder-cn/plugin.mjs +72 -25
- package/app/plugins/workbuddy/plugin.mjs +245 -49
- package/app/plugins/zcode/plugin.mjs +101 -29
- package/app/renderer-extension.js +2353 -344
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -3516,10 +3516,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3516
3516
|
const shape = def.shape;
|
|
3517
3517
|
const propValues = {};
|
|
3518
3518
|
for (const key in shape) {
|
|
3519
|
-
const
|
|
3520
|
-
if (
|
|
3519
|
+
const field2 = shape[key]._zod;
|
|
3520
|
+
if (field2.values) {
|
|
3521
3521
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3522
|
-
for (const v of
|
|
3522
|
+
for (const v of field2.values)
|
|
3523
3523
|
propValues[key].add(v);
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
@@ -15159,6 +15159,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
15159
15159
|
cachedInputTokens: count,
|
|
15160
15160
|
cacheWriteInputTokens: count,
|
|
15161
15161
|
cacheKnownInputTokens: count,
|
|
15162
|
+
cacheHitCachedInputTokens: count,
|
|
15163
|
+
cacheHitInputTokens: count,
|
|
15162
15164
|
outputTokens: count,
|
|
15163
15165
|
reasoningOutputTokens: count,
|
|
15164
15166
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -15266,6 +15268,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
15266
15268
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
15267
15269
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
15268
15270
|
|
|
15271
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
15272
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
15273
|
+
external_exports.object({
|
|
15274
|
+
id: external_exports.string().min(1),
|
|
15275
|
+
type: external_exports.literal("choice"),
|
|
15276
|
+
prompt: external_exports.string(),
|
|
15277
|
+
options: external_exports.array(external_exports.object({
|
|
15278
|
+
value: external_exports.string().min(1),
|
|
15279
|
+
label: external_exports.string(),
|
|
15280
|
+
description: external_exports.string().optional()
|
|
15281
|
+
})).min(1),
|
|
15282
|
+
multiple: external_exports.boolean(),
|
|
15283
|
+
allowOther: external_exports.boolean(),
|
|
15284
|
+
optional: external_exports.boolean()
|
|
15285
|
+
}),
|
|
15286
|
+
external_exports.object({
|
|
15287
|
+
id: external_exports.string().min(1),
|
|
15288
|
+
type: external_exports.literal("text"),
|
|
15289
|
+
prompt: external_exports.string(),
|
|
15290
|
+
multiline: external_exports.boolean(),
|
|
15291
|
+
secret: external_exports.literal(false),
|
|
15292
|
+
optional: external_exports.boolean(),
|
|
15293
|
+
placeholder: external_exports.string().optional(),
|
|
15294
|
+
prefill: external_exports.string().optional()
|
|
15295
|
+
})
|
|
15296
|
+
]);
|
|
15297
|
+
var threadQuestionSchema = external_exports.object({
|
|
15298
|
+
interactionId: external_exports.string().min(1),
|
|
15299
|
+
turnId: external_exports.string().min(1),
|
|
15300
|
+
title: external_exports.string().optional(),
|
|
15301
|
+
questions: external_exports.array(field).min(1)
|
|
15302
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
15303
|
+
message: "Shared cards require at least one multi-select question"
|
|
15304
|
+
});
|
|
15305
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
15306
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
15307
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
15308
|
+
threadId: external_exports.string().min(1),
|
|
15309
|
+
turnId: external_exports.string().min(1),
|
|
15310
|
+
interactionId: external_exports.string().min(1),
|
|
15311
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
15312
|
+
cancelled: external_exports.boolean().default(false)
|
|
15313
|
+
});
|
|
15314
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
15315
|
+
|
|
15269
15316
|
// ../../shared-contracts/dist/console.js
|
|
15270
15317
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
15271
15318
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -16616,26 +16663,26 @@ function parseHostUsage(value) {
|
|
|
16616
16663
|
}
|
|
16617
16664
|
}
|
|
16618
16665
|
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16619
|
-
for (const
|
|
16666
|
+
for (const field2 of [
|
|
16620
16667
|
"totalCredits",
|
|
16621
16668
|
"contextUsagePercent",
|
|
16622
16669
|
"apiOutputTokensPerSecond"
|
|
16623
16670
|
]) {
|
|
16624
|
-
const candidate = value[
|
|
16671
|
+
const candidate = value[field2];
|
|
16625
16672
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16626
|
-
throw new Error(`Harness Usage '${
|
|
16673
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16627
16674
|
}
|
|
16628
16675
|
}
|
|
16629
|
-
for (const
|
|
16630
|
-
const candidate = value[
|
|
16676
|
+
for (const field2 of tokenFields) {
|
|
16677
|
+
const candidate = value[field2];
|
|
16631
16678
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16632
|
-
throw new Error(`Harness Usage '${
|
|
16679
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16633
16680
|
}
|
|
16634
16681
|
}
|
|
16635
|
-
for (const
|
|
16636
|
-
const candidate = value[
|
|
16682
|
+
for (const field2 of safeIntegerFields) {
|
|
16683
|
+
const candidate = value[field2];
|
|
16637
16684
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16638
|
-
throw new Error(`Harness Usage '${
|
|
16685
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16639
16686
|
}
|
|
16640
16687
|
}
|
|
16641
16688
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16644,10 +16691,10 @@ function parseHostUsage(value) {
|
|
|
16644
16691
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16645
16692
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16646
16693
|
}
|
|
16647
|
-
for (const
|
|
16648
|
-
const candidate = value[
|
|
16694
|
+
for (const field2 of percentFields) {
|
|
16695
|
+
const candidate = value[field2];
|
|
16649
16696
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16650
|
-
throw new Error(`Harness Usage '${
|
|
16697
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16651
16698
|
}
|
|
16652
16699
|
}
|
|
16653
16700
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16718,19 +16765,19 @@ function parseHostUsageRequest(value) {
|
|
|
16718
16765
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16719
16766
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16720
16767
|
}
|
|
16721
|
-
for (const
|
|
16722
|
-
const candidate = value[
|
|
16768
|
+
for (const field2 of ["model", "provider"]) {
|
|
16769
|
+
const candidate = value[field2];
|
|
16723
16770
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16724
|
-
throw new Error(`Harness Usage request '${
|
|
16771
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16725
16772
|
}
|
|
16726
16773
|
}
|
|
16727
16774
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16728
16775
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16729
16776
|
}
|
|
16730
|
-
for (const
|
|
16731
|
-
const candidate = value[
|
|
16777
|
+
for (const field2 of requestTokenFields) {
|
|
16778
|
+
const candidate = value[field2];
|
|
16732
16779
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16733
|
-
throw new Error(`Harness Usage request '${
|
|
16780
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16734
16781
|
}
|
|
16735
16782
|
}
|
|
16736
16783
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -18195,7 +18242,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18195
18242
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18196
18243
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18197
18244
|
}
|
|
18245
|
+
function isNativeCompactionSummary(row) {
|
|
18246
|
+
const data = record2(row.providerData);
|
|
18247
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
18248
|
+
}
|
|
18198
18249
|
function nativeHistoryRows(contents) {
|
|
18250
|
+
return collectNativeHistoryRows(contents, false);
|
|
18251
|
+
}
|
|
18252
|
+
function nativeDisplayHistoryRows(contents) {
|
|
18253
|
+
return collectNativeHistoryRows(contents, true);
|
|
18254
|
+
}
|
|
18255
|
+
function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
18199
18256
|
const entries = /* @__PURE__ */ new Map();
|
|
18200
18257
|
let leaf = "";
|
|
18201
18258
|
for (const row of parseRows(contents)) {
|
|
@@ -18220,10 +18277,16 @@ function nativeHistoryRows(contents) {
|
|
|
18220
18277
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18221
18278
|
chain.push(row);
|
|
18222
18279
|
leaf = text(row.parentId);
|
|
18280
|
+
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
18281
|
+
const logicalParent = text(row.logicalParentId);
|
|
18282
|
+
if (logicalParent && !entries.has(logicalParent))
|
|
18283
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
18284
|
+
leaf = logicalParent;
|
|
18285
|
+
}
|
|
18223
18286
|
}
|
|
18224
18287
|
return chain.reverse();
|
|
18225
18288
|
}
|
|
18226
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18289
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18227
18290
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18228
18291
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18229
18292
|
const turns = [];
|
|
@@ -18249,7 +18312,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18249
18312
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18250
18313
|
}
|
|
18251
18314
|
};
|
|
18252
|
-
const
|
|
18315
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
18316
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18253
18317
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18254
18318
|
let compactUser;
|
|
18255
18319
|
if (supportsNativeCommands)
|
|
@@ -18283,6 +18347,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18283
18347
|
continue;
|
|
18284
18348
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
18285
18349
|
continue;
|
|
18350
|
+
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
18351
|
+
if (supportsNativeCommands && current) {
|
|
18352
|
+
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
18353
|
+
status: "failed",
|
|
18354
|
+
error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
|
|
18355
|
+
};
|
|
18356
|
+
current.items.push({
|
|
18357
|
+
item: {
|
|
18358
|
+
type: "contextCompaction",
|
|
18359
|
+
itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
|
|
18360
|
+
},
|
|
18361
|
+
outcome
|
|
18362
|
+
});
|
|
18363
|
+
}
|
|
18364
|
+
continue;
|
|
18365
|
+
}
|
|
18286
18366
|
if (row.type === "message" && row.role === "user") {
|
|
18287
18367
|
current = {
|
|
18288
18368
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -23264,7 +23344,9 @@ function commandCaveat(row) {
|
|
|
23264
23344
|
}
|
|
23265
23345
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
23266
23346
|
const rows2 = nativeHistoryRows(contents);
|
|
23267
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
23347
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
23348
|
+
includeCompactionHistory: false
|
|
23349
|
+
}).turns;
|
|
23268
23350
|
let excluded2;
|
|
23269
23351
|
if (input.kind === "rollbackLastTurn") {
|
|
23270
23352
|
if (!turns.length)
|
|
@@ -25264,6 +25346,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
|
|
|
25264
25346
|
var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
25265
25347
|
var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
|
|
25266
25348
|
var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
|
|
25349
|
+
var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
|
|
25267
25350
|
var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
25268
25351
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
25269
25352
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
@@ -25271,6 +25354,8 @@ var harnessBrokerMethodSchema = external_exports.enum([
|
|
|
25271
25354
|
"adapter.inspectAccount",
|
|
25272
25355
|
"adapter.credits",
|
|
25273
25356
|
"adapter.open",
|
|
25357
|
+
"adapter.sessionImport.list",
|
|
25358
|
+
"adapter.sessionImport.resolve",
|
|
25274
25359
|
"adapter.subagent.readSnapshot",
|
|
25275
25360
|
"session.readSnapshot",
|
|
25276
25361
|
"session.readCapabilities",
|
|
@@ -25373,30 +25458,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
25373
25458
|
});
|
|
25374
25459
|
}
|
|
25375
25460
|
|
|
25376
|
-
// ../../harness-broker/dist/paths.js
|
|
25377
|
-
import os2 from "node:os";
|
|
25378
|
-
import path11 from "node:path";
|
|
25379
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
25380
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
25381
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
25382
|
-
const home = environment.HOME || os2.homedir();
|
|
25383
|
-
return path11.join(home, ".codexhost", "harness-broker");
|
|
25384
|
-
}
|
|
25385
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
25386
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25387
|
-
if (harnessId !== "claude-code")
|
|
25388
|
-
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
25389
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
25390
|
-
}
|
|
25391
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
25392
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
25393
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
25394
|
-
}
|
|
25395
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
25396
|
-
const home = environment.HOME || os2.homedir();
|
|
25397
|
-
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
25398
|
-
}
|
|
25399
|
-
|
|
25400
25461
|
// ../../harness-broker/dist/validation.js
|
|
25401
25462
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
25402
25463
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -25447,7 +25508,31 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
25447
25508
|
forkSchema,
|
|
25448
25509
|
rollbackSchema
|
|
25449
25510
|
]);
|
|
25450
|
-
var brokerInspectInputSchema = external_exports.object({
|
|
25511
|
+
var brokerInspectInputSchema = external_exports.object({
|
|
25512
|
+
cwd: cwdSchema.optional(),
|
|
25513
|
+
refresh: external_exports.boolean().optional(),
|
|
25514
|
+
purpose: external_exports.literal("availability").optional()
|
|
25515
|
+
}).strict();
|
|
25516
|
+
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
25517
|
+
offset: external_exports.number().int().nonnegative().safe(),
|
|
25518
|
+
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
25519
|
+
}).strict();
|
|
25520
|
+
var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
|
|
25521
|
+
var brokerSessionImportPageSchema = external_exports.object({
|
|
25522
|
+
candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
|
|
25523
|
+
total: external_exports.number().int().nonnegative().safe()
|
|
25524
|
+
}).strict();
|
|
25525
|
+
var brokerSessionImportSourceSchema = external_exports.object({
|
|
25526
|
+
candidate: harnessSessionImportCandidateSchema,
|
|
25527
|
+
nativeRef: nativeSessionRefSchema
|
|
25528
|
+
}).strict().superRefine((source, context) => {
|
|
25529
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
25530
|
+
context.addIssue({
|
|
25531
|
+
code: "custom",
|
|
25532
|
+
message: "Session import source identity does not match"
|
|
25533
|
+
});
|
|
25534
|
+
}
|
|
25535
|
+
});
|
|
25451
25536
|
var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
|
|
25452
25537
|
var turnStartSchema = external_exports.object({
|
|
25453
25538
|
type: external_exports.literal("turn.start"),
|
|
@@ -25618,6 +25703,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
25618
25703
|
return false;
|
|
25619
25704
|
});
|
|
25620
25705
|
|
|
25706
|
+
// ../../harness-broker/dist/session-import-client.js
|
|
25707
|
+
function createBrokerSessionImportCapability(input) {
|
|
25708
|
+
let listing = null;
|
|
25709
|
+
const closed = () => ({
|
|
25710
|
+
ok: false,
|
|
25711
|
+
error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
|
|
25712
|
+
});
|
|
25713
|
+
const invalid = () => ({
|
|
25714
|
+
ok: false,
|
|
25715
|
+
error: {
|
|
25716
|
+
code: "protocolError",
|
|
25717
|
+
message: "Harness broker returned invalid Session import metadata",
|
|
25718
|
+
retryable: false
|
|
25719
|
+
}
|
|
25720
|
+
});
|
|
25721
|
+
const list = async () => {
|
|
25722
|
+
try {
|
|
25723
|
+
const candidates = [];
|
|
25724
|
+
const identities = /* @__PURE__ */ new Set();
|
|
25725
|
+
let total;
|
|
25726
|
+
for (; ; ) {
|
|
25727
|
+
if (input.isClosed())
|
|
25728
|
+
return closed();
|
|
25729
|
+
const result = await input.request("adapter.sessionImport.list", {
|
|
25730
|
+
offset: candidates.length,
|
|
25731
|
+
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
25732
|
+
});
|
|
25733
|
+
if (input.isClosed())
|
|
25734
|
+
return closed();
|
|
25735
|
+
if (!result.ok)
|
|
25736
|
+
return result;
|
|
25737
|
+
const page = brokerSessionImportPageSchema.safeParse(result.value);
|
|
25738
|
+
if (!page.success || total !== void 0 && total !== page.data.total || page.data.total < candidates.length + page.data.candidates.length || page.data.candidates.length === 0 && candidates.length < page.data.total)
|
|
25739
|
+
return invalid();
|
|
25740
|
+
total = page.data.total;
|
|
25741
|
+
for (const candidate of page.data.candidates) {
|
|
25742
|
+
if (identities.has(candidate.nativeSessionId))
|
|
25743
|
+
return invalid();
|
|
25744
|
+
identities.add(candidate.nativeSessionId);
|
|
25745
|
+
candidates.push(candidate);
|
|
25746
|
+
}
|
|
25747
|
+
if (candidates.length === total)
|
|
25748
|
+
return { ok: true, value: candidates };
|
|
25749
|
+
}
|
|
25750
|
+
} catch (error51) {
|
|
25751
|
+
return { ok: false, error: input.error(error51) };
|
|
25752
|
+
}
|
|
25753
|
+
};
|
|
25754
|
+
return {
|
|
25755
|
+
listCandidates() {
|
|
25756
|
+
if (input.isClosed())
|
|
25757
|
+
return Promise.resolve(closed());
|
|
25758
|
+
listing ??= list().finally(() => {
|
|
25759
|
+
listing = null;
|
|
25760
|
+
});
|
|
25761
|
+
return listing;
|
|
25762
|
+
},
|
|
25763
|
+
async resolveCandidate(nativeSessionId) {
|
|
25764
|
+
if (input.isClosed())
|
|
25765
|
+
return closed();
|
|
25766
|
+
try {
|
|
25767
|
+
const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
25768
|
+
if (input.isClosed())
|
|
25769
|
+
return closed();
|
|
25770
|
+
if (!result.ok)
|
|
25771
|
+
return result;
|
|
25772
|
+
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
25773
|
+
if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
25774
|
+
return invalid();
|
|
25775
|
+
return { ok: true, value: source.data };
|
|
25776
|
+
} catch (error51) {
|
|
25777
|
+
return { ok: false, error: input.error(error51) };
|
|
25778
|
+
}
|
|
25779
|
+
}
|
|
25780
|
+
};
|
|
25781
|
+
}
|
|
25782
|
+
|
|
25783
|
+
// ../../harness-broker/dist/paths.js
|
|
25784
|
+
import os2 from "node:os";
|
|
25785
|
+
import path11 from "node:path";
|
|
25786
|
+
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
25787
|
+
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
25788
|
+
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
25789
|
+
const home = environment.HOME || os2.homedir();
|
|
25790
|
+
return path11.join(home, ".codexhost", "harness-broker");
|
|
25791
|
+
}
|
|
25792
|
+
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
25793
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
25794
|
+
if (harnessId !== "claude-code")
|
|
25795
|
+
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
25796
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
25797
|
+
}
|
|
25798
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
25799
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
25800
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
25801
|
+
}
|
|
25802
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
25803
|
+
const home = environment.HOME || os2.homedir();
|
|
25804
|
+
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
25805
|
+
}
|
|
25806
|
+
|
|
25621
25807
|
// ../../harness-broker/dist/client.js
|
|
25622
25808
|
function unavailable(message, retryable = true) {
|
|
25623
25809
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -26154,6 +26340,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
26154
26340
|
commandCatalog;
|
|
26155
26341
|
liveCommandCatalog;
|
|
26156
26342
|
harnessId;
|
|
26343
|
+
sessionImport;
|
|
26157
26344
|
credits;
|
|
26158
26345
|
refreshCredits;
|
|
26159
26346
|
#descriptorPath;
|
|
@@ -26176,6 +26363,14 @@ var BrokeredHarnessAdapter = class {
|
|
|
26176
26363
|
};
|
|
26177
26364
|
constructor(input = {}) {
|
|
26178
26365
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
26366
|
+
if (input.sessionImport) {
|
|
26367
|
+
this.sessionImport = createBrokerSessionImportCapability({
|
|
26368
|
+
harnessId: this.harnessId,
|
|
26369
|
+
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
26370
|
+
isClosed: () => this.#closed,
|
|
26371
|
+
error: (error51) => this.#error(error51)
|
|
26372
|
+
});
|
|
26373
|
+
}
|
|
26179
26374
|
if (input.accountCredits !== false) {
|
|
26180
26375
|
this.credits = () => this.#credits;
|
|
26181
26376
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -26363,6 +26558,7 @@ function createHarnessAdapter(context) {
|
|
|
26363
26558
|
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
26364
26559
|
const environment2 = { ...context.environment };
|
|
26365
26560
|
return new BrokeredHarnessAdapter({
|
|
26561
|
+
sessionImport: true,
|
|
26366
26562
|
accountCredits: false,
|
|
26367
26563
|
harnessId: "codebuddy",
|
|
26368
26564
|
forwardDelegationEnvironment: true,
|
|
@@ -3034,10 +3034,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3034
3034
|
const shape = def.shape;
|
|
3035
3035
|
const propValues = {};
|
|
3036
3036
|
for (const key2 in shape) {
|
|
3037
|
-
const
|
|
3038
|
-
if (
|
|
3037
|
+
const field2 = shape[key2]._zod;
|
|
3038
|
+
if (field2.values) {
|
|
3039
3039
|
propValues[key2] ?? (propValues[key2] = /* @__PURE__ */ new Set());
|
|
3040
|
-
for (const v of
|
|
3040
|
+
for (const v of field2.values)
|
|
3041
3041
|
propValues[key2].add(v);
|
|
3042
3042
|
}
|
|
3043
3043
|
}
|
|
@@ -14677,6 +14677,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
14677
14677
|
cachedInputTokens: count,
|
|
14678
14678
|
cacheWriteInputTokens: count,
|
|
14679
14679
|
cacheKnownInputTokens: count,
|
|
14680
|
+
cacheHitCachedInputTokens: count,
|
|
14681
|
+
cacheHitInputTokens: count,
|
|
14680
14682
|
outputTokens: count,
|
|
14681
14683
|
reasoningOutputTokens: count,
|
|
14682
14684
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -14784,6 +14786,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
14784
14786
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
14785
14787
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
14786
14788
|
|
|
14789
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
14790
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
14791
|
+
external_exports.object({
|
|
14792
|
+
id: external_exports.string().min(1),
|
|
14793
|
+
type: external_exports.literal("choice"),
|
|
14794
|
+
prompt: external_exports.string(),
|
|
14795
|
+
options: external_exports.array(external_exports.object({
|
|
14796
|
+
value: external_exports.string().min(1),
|
|
14797
|
+
label: external_exports.string(),
|
|
14798
|
+
description: external_exports.string().optional()
|
|
14799
|
+
})).min(1),
|
|
14800
|
+
multiple: external_exports.boolean(),
|
|
14801
|
+
allowOther: external_exports.boolean(),
|
|
14802
|
+
optional: external_exports.boolean()
|
|
14803
|
+
}),
|
|
14804
|
+
external_exports.object({
|
|
14805
|
+
id: external_exports.string().min(1),
|
|
14806
|
+
type: external_exports.literal("text"),
|
|
14807
|
+
prompt: external_exports.string(),
|
|
14808
|
+
multiline: external_exports.boolean(),
|
|
14809
|
+
secret: external_exports.literal(false),
|
|
14810
|
+
optional: external_exports.boolean(),
|
|
14811
|
+
placeholder: external_exports.string().optional(),
|
|
14812
|
+
prefill: external_exports.string().optional()
|
|
14813
|
+
})
|
|
14814
|
+
]);
|
|
14815
|
+
var threadQuestionSchema = external_exports.object({
|
|
14816
|
+
interactionId: external_exports.string().min(1),
|
|
14817
|
+
turnId: external_exports.string().min(1),
|
|
14818
|
+
title: external_exports.string().optional(),
|
|
14819
|
+
questions: external_exports.array(field).min(1)
|
|
14820
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
14821
|
+
message: "Shared cards require at least one multi-select question"
|
|
14822
|
+
});
|
|
14823
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
14824
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
14825
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
14826
|
+
threadId: external_exports.string().min(1),
|
|
14827
|
+
turnId: external_exports.string().min(1),
|
|
14828
|
+
interactionId: external_exports.string().min(1),
|
|
14829
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
14830
|
+
cancelled: external_exports.boolean().default(false)
|
|
14831
|
+
});
|
|
14832
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
14833
|
+
|
|
14787
14834
|
// ../../shared-contracts/dist/console.js
|
|
14788
14835
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14789
14836
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -16018,13 +16065,13 @@ function parseHarnessUsageEntry(value) {
|
|
|
16018
16065
|
}
|
|
16019
16066
|
if (!tokenCount(entry.inputTokens) || !tokenCount(entry.outputTokens))
|
|
16020
16067
|
return null;
|
|
16021
|
-
for (const
|
|
16068
|
+
for (const field2 of [
|
|
16022
16069
|
"cachedInputTokens",
|
|
16023
16070
|
"cacheWriteInputTokens",
|
|
16024
16071
|
"cacheWrite1hInputTokens",
|
|
16025
16072
|
"reasoningOutputTokens"
|
|
16026
16073
|
]) {
|
|
16027
|
-
if (entry[
|
|
16074
|
+
if (entry[field2] !== void 0 && !tokenCount(entry[field2]))
|
|
16028
16075
|
return null;
|
|
16029
16076
|
}
|
|
16030
16077
|
const cached2 = entry.cachedInputTokens ?? 0;
|
|
@@ -16118,8 +16165,8 @@ function usage(value) {
|
|
|
16118
16165
|
if (!row)
|
|
16119
16166
|
return null;
|
|
16120
16167
|
const result = { values: [], known: 0 };
|
|
16121
|
-
for (const [i,
|
|
16122
|
-
const n = row[
|
|
16168
|
+
for (const [i, field2] of fields.entries()) {
|
|
16169
|
+
const n = row[field2];
|
|
16123
16170
|
if (n !== void 0 && n !== null) {
|
|
16124
16171
|
if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 0)
|
|
16125
16172
|
return null;
|
|
@@ -17004,26 +17051,26 @@ function parseHostUsage(value) {
|
|
|
17004
17051
|
}
|
|
17005
17052
|
}
|
|
17006
17053
|
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
17007
|
-
for (const
|
|
17054
|
+
for (const field2 of [
|
|
17008
17055
|
"totalCredits",
|
|
17009
17056
|
"contextUsagePercent",
|
|
17010
17057
|
"apiOutputTokensPerSecond"
|
|
17011
17058
|
]) {
|
|
17012
|
-
const candidate = value[
|
|
17059
|
+
const candidate = value[field2];
|
|
17013
17060
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
17014
|
-
throw new Error(`Harness Usage '${
|
|
17061
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
17015
17062
|
}
|
|
17016
17063
|
}
|
|
17017
|
-
for (const
|
|
17018
|
-
const candidate = value[
|
|
17064
|
+
for (const field2 of tokenFields) {
|
|
17065
|
+
const candidate = value[field2];
|
|
17019
17066
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
17020
|
-
throw new Error(`Harness Usage '${
|
|
17067
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
17021
17068
|
}
|
|
17022
17069
|
}
|
|
17023
|
-
for (const
|
|
17024
|
-
const candidate = value[
|
|
17070
|
+
for (const field2 of safeIntegerFields) {
|
|
17071
|
+
const candidate = value[field2];
|
|
17025
17072
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
17026
|
-
throw new Error(`Harness Usage '${
|
|
17073
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
17027
17074
|
}
|
|
17028
17075
|
}
|
|
17029
17076
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -17032,10 +17079,10 @@ function parseHostUsage(value) {
|
|
|
17032
17079
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
17033
17080
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
17034
17081
|
}
|
|
17035
|
-
for (const
|
|
17036
|
-
const candidate = value[
|
|
17082
|
+
for (const field2 of percentFields) {
|
|
17083
|
+
const candidate = value[field2];
|
|
17037
17084
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
17038
|
-
throw new Error(`Harness Usage '${
|
|
17085
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
17039
17086
|
}
|
|
17040
17087
|
}
|
|
17041
17088
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -17106,19 +17153,19 @@ function parseHostUsageRequest(value) {
|
|
|
17106
17153
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
17107
17154
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
17108
17155
|
}
|
|
17109
|
-
for (const
|
|
17110
|
-
const candidate = value[
|
|
17156
|
+
for (const field2 of ["model", "provider"]) {
|
|
17157
|
+
const candidate = value[field2];
|
|
17111
17158
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
17112
|
-
throw new Error(`Harness Usage request '${
|
|
17159
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
17113
17160
|
}
|
|
17114
17161
|
}
|
|
17115
17162
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
17116
17163
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
17117
17164
|
}
|
|
17118
|
-
for (const
|
|
17119
|
-
const candidate = value[
|
|
17165
|
+
for (const field2 of requestTokenFields) {
|
|
17166
|
+
const candidate = value[field2];
|
|
17120
17167
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
17121
|
-
throw new Error(`Harness Usage request '${
|
|
17168
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
17122
17169
|
}
|
|
17123
17170
|
}
|
|
17124
17171
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -17152,7 +17199,7 @@ function tokenSnapshot(value) {
|
|
|
17152
17199
|
const total = object2(token.total);
|
|
17153
17200
|
const last = object2(token.last);
|
|
17154
17201
|
const result = {};
|
|
17155
|
-
for (const
|
|
17202
|
+
for (const field2 of [
|
|
17156
17203
|
"totalTokens",
|
|
17157
17204
|
"inputTokens",
|
|
17158
17205
|
"cachedInputTokens",
|
|
@@ -17160,9 +17207,9 @@ function tokenSnapshot(value) {
|
|
|
17160
17207
|
"outputTokens",
|
|
17161
17208
|
"reasoningOutputTokens"
|
|
17162
17209
|
]) {
|
|
17163
|
-
const n = integer2(total?.[
|
|
17210
|
+
const n = integer2(total?.[field2]);
|
|
17164
17211
|
if (n !== void 0)
|
|
17165
|
-
result[
|
|
17212
|
+
result[field2] = n;
|
|
17166
17213
|
}
|
|
17167
17214
|
const used = integer2(last?.totalTokens);
|
|
17168
17215
|
const window = integer2(token.modelContextWindow);
|