@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
|
@@ -3040,10 +3040,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3040
3040
|
const shape = def.shape;
|
|
3041
3041
|
const propValues = {};
|
|
3042
3042
|
for (const key in shape) {
|
|
3043
|
-
const
|
|
3044
|
-
if (
|
|
3043
|
+
const field2 = shape[key]._zod;
|
|
3044
|
+
if (field2.values) {
|
|
3045
3045
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
3046
|
-
for (const v of
|
|
3046
|
+
for (const v of field2.values)
|
|
3047
3047
|
propValues[key].add(v);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
@@ -14683,6 +14683,8 @@ var usageStatisticsTotalsSchema = external_exports.strictObject({
|
|
|
14683
14683
|
cachedInputTokens: count,
|
|
14684
14684
|
cacheWriteInputTokens: count,
|
|
14685
14685
|
cacheKnownInputTokens: count,
|
|
14686
|
+
cacheHitCachedInputTokens: count,
|
|
14687
|
+
cacheHitInputTokens: count,
|
|
14686
14688
|
outputTokens: count,
|
|
14687
14689
|
reasoningOutputTokens: count,
|
|
14688
14690
|
/** USD at the public price, summed over the priced requests only. */
|
|
@@ -14790,6 +14792,51 @@ var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
|
14790
14792
|
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
14791
14793
|
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
14792
14794
|
|
|
14795
|
+
// ../../shared-contracts/dist/thread-questions.js
|
|
14796
|
+
var field = external_exports.discriminatedUnion("type", [
|
|
14797
|
+
external_exports.object({
|
|
14798
|
+
id: external_exports.string().min(1),
|
|
14799
|
+
type: external_exports.literal("choice"),
|
|
14800
|
+
prompt: external_exports.string(),
|
|
14801
|
+
options: external_exports.array(external_exports.object({
|
|
14802
|
+
value: external_exports.string().min(1),
|
|
14803
|
+
label: external_exports.string(),
|
|
14804
|
+
description: external_exports.string().optional()
|
|
14805
|
+
})).min(1),
|
|
14806
|
+
multiple: external_exports.boolean(),
|
|
14807
|
+
allowOther: external_exports.boolean(),
|
|
14808
|
+
optional: external_exports.boolean()
|
|
14809
|
+
}),
|
|
14810
|
+
external_exports.object({
|
|
14811
|
+
id: external_exports.string().min(1),
|
|
14812
|
+
type: external_exports.literal("text"),
|
|
14813
|
+
prompt: external_exports.string(),
|
|
14814
|
+
multiline: external_exports.boolean(),
|
|
14815
|
+
secret: external_exports.literal(false),
|
|
14816
|
+
optional: external_exports.boolean(),
|
|
14817
|
+
placeholder: external_exports.string().optional(),
|
|
14818
|
+
prefill: external_exports.string().optional()
|
|
14819
|
+
})
|
|
14820
|
+
]);
|
|
14821
|
+
var threadQuestionSchema = external_exports.object({
|
|
14822
|
+
interactionId: external_exports.string().min(1),
|
|
14823
|
+
turnId: external_exports.string().min(1),
|
|
14824
|
+
title: external_exports.string().optional(),
|
|
14825
|
+
questions: external_exports.array(field).min(1)
|
|
14826
|
+
}).refine(({ questions }) => questions.some((q) => q.type === "choice" && q.multiple), {
|
|
14827
|
+
message: "Shared cards require at least one multi-select question"
|
|
14828
|
+
});
|
|
14829
|
+
var threadQuestionsListParamsSchema = external_exports.strictObject({ threadId: external_exports.string().min(1) });
|
|
14830
|
+
var threadQuestionsResultSchema = external_exports.object({ questions: external_exports.array(threadQuestionSchema) });
|
|
14831
|
+
var threadQuestionRespondParamsSchema = external_exports.strictObject({
|
|
14832
|
+
threadId: external_exports.string().min(1),
|
|
14833
|
+
turnId: external_exports.string().min(1),
|
|
14834
|
+
interactionId: external_exports.string().min(1),
|
|
14835
|
+
answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
|
|
14836
|
+
cancelled: external_exports.boolean().default(false)
|
|
14837
|
+
});
|
|
14838
|
+
var threadQuestionRespondResultSchema = external_exports.object({ accepted: external_exports.literal(true) });
|
|
14839
|
+
|
|
14793
14840
|
// ../../shared-contracts/dist/console.js
|
|
14794
14841
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
14795
14842
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -16140,26 +16187,26 @@ function parseHostUsage(value) {
|
|
|
16140
16187
|
}
|
|
16141
16188
|
}
|
|
16142
16189
|
const indicators = value.composerIndicators === void 0 ? {} : { composerIndicators: composerIndicatorsSchema.parse(value.composerIndicators) };
|
|
16143
|
-
for (const
|
|
16190
|
+
for (const field2 of [
|
|
16144
16191
|
"totalCredits",
|
|
16145
16192
|
"contextUsagePercent",
|
|
16146
16193
|
"apiOutputTokensPerSecond"
|
|
16147
16194
|
]) {
|
|
16148
|
-
const candidate = value[
|
|
16195
|
+
const candidate = value[field2];
|
|
16149
16196
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0)) {
|
|
16150
|
-
throw new Error(`Harness Usage '${
|
|
16197
|
+
throw new Error(`Harness Usage '${field2}' must be a finite non-negative number`);
|
|
16151
16198
|
}
|
|
16152
16199
|
}
|
|
16153
|
-
for (const
|
|
16154
|
-
const candidate = value[
|
|
16200
|
+
for (const field2 of tokenFields) {
|
|
16201
|
+
const candidate = value[field2];
|
|
16155
16202
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16156
|
-
throw new Error(`Harness Usage '${
|
|
16203
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16157
16204
|
}
|
|
16158
16205
|
}
|
|
16159
|
-
for (const
|
|
16160
|
-
const candidate = value[
|
|
16206
|
+
for (const field2 of safeIntegerFields) {
|
|
16207
|
+
const candidate = value[field2];
|
|
16161
16208
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16162
|
-
throw new Error(`Harness Usage '${
|
|
16209
|
+
throw new Error(`Harness Usage '${field2}' must be a non-negative safe integer`);
|
|
16163
16210
|
}
|
|
16164
16211
|
}
|
|
16165
16212
|
if (value.outputTokensPerSecond !== void 0 && (typeof value.outputTokensPerSecond !== "number" || !Number.isFinite(value.outputTokensPerSecond) || value.outputTokensPerSecond < 0)) {
|
|
@@ -16168,10 +16215,10 @@ function parseHostUsage(value) {
|
|
|
16168
16215
|
if (value.totalCostUsd !== void 0 && (typeof value.totalCostUsd !== "number" || !Number.isFinite(value.totalCostUsd) || value.totalCostUsd < 0)) {
|
|
16169
16216
|
throw new Error("Harness Usage 'totalCostUsd' must be a finite non-negative number");
|
|
16170
16217
|
}
|
|
16171
|
-
for (const
|
|
16172
|
-
const candidate = value[
|
|
16218
|
+
for (const field2 of percentFields) {
|
|
16219
|
+
const candidate = value[field2];
|
|
16173
16220
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isFinite(candidate) || candidate < 0 || candidate > 100)) {
|
|
16174
|
-
throw new Error(`Harness Usage '${
|
|
16221
|
+
throw new Error(`Harness Usage '${field2}' must be between 0 and 100`);
|
|
16175
16222
|
}
|
|
16176
16223
|
}
|
|
16177
16224
|
if (value.sessionCacheUsage !== void 0) {
|
|
@@ -16242,19 +16289,19 @@ function parseHostUsageRequest(value) {
|
|
|
16242
16289
|
if (typeof value.requestId !== "string" || value.requestId.length === 0) {
|
|
16243
16290
|
throw new Error("Harness Usage request 'requestId' must be a non-empty string");
|
|
16244
16291
|
}
|
|
16245
|
-
for (const
|
|
16246
|
-
const candidate = value[
|
|
16292
|
+
for (const field2 of ["model", "provider"]) {
|
|
16293
|
+
const candidate = value[field2];
|
|
16247
16294
|
if (candidate !== void 0 && (typeof candidate !== "string" || candidate.length === 0)) {
|
|
16248
|
-
throw new Error(`Harness Usage request '${
|
|
16295
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-empty string`);
|
|
16249
16296
|
}
|
|
16250
16297
|
}
|
|
16251
16298
|
if (value.historical !== void 0 && typeof value.historical !== "boolean") {
|
|
16252
16299
|
throw new Error("Harness Usage request 'historical' must be a boolean");
|
|
16253
16300
|
}
|
|
16254
|
-
for (const
|
|
16255
|
-
const candidate = value[
|
|
16301
|
+
for (const field2 of requestTokenFields) {
|
|
16302
|
+
const candidate = value[field2];
|
|
16256
16303
|
if (candidate !== void 0 && (typeof candidate !== "number" || !Number.isSafeInteger(candidate) || candidate < 0)) {
|
|
16257
|
-
throw new Error(`Harness Usage request '${
|
|
16304
|
+
throw new Error(`Harness Usage request '${field2}' must be a non-negative safe integer`);
|
|
16258
16305
|
}
|
|
16259
16306
|
}
|
|
16260
16307
|
if (value.inputTokens === void 0 || value.outputTokens === void 0) {
|
|
@@ -16360,6 +16407,7 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
|
|
|
16360
16407
|
var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
16361
16408
|
var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
|
|
16362
16409
|
var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
|
|
16410
|
+
var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
|
|
16363
16411
|
var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
16364
16412
|
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
16365
16413
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
@@ -16367,6 +16415,8 @@ var harnessBrokerMethodSchema = external_exports.enum([
|
|
|
16367
16415
|
"adapter.inspectAccount",
|
|
16368
16416
|
"adapter.credits",
|
|
16369
16417
|
"adapter.open",
|
|
16418
|
+
"adapter.sessionImport.list",
|
|
16419
|
+
"adapter.sessionImport.resolve",
|
|
16370
16420
|
"adapter.subagent.readSnapshot",
|
|
16371
16421
|
"session.readSnapshot",
|
|
16372
16422
|
"session.readCapabilities",
|
|
@@ -16469,30 +16519,6 @@ function consumeBrokerFrames(socket, onFrame, onError) {
|
|
|
16469
16519
|
});
|
|
16470
16520
|
}
|
|
16471
16521
|
|
|
16472
|
-
// ../../harness-broker/dist/paths.js
|
|
16473
|
-
import os from "node:os";
|
|
16474
|
-
import path from "node:path";
|
|
16475
|
-
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16476
|
-
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16477
|
-
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16478
|
-
const home = environment.HOME || os.homedir();
|
|
16479
|
-
return path.join(home, ".codexhost", "harness-broker");
|
|
16480
|
-
}
|
|
16481
|
-
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16482
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16483
|
-
if (harnessId !== "claude-code")
|
|
16484
|
-
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16485
|
-
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16486
|
-
}
|
|
16487
|
-
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16488
|
-
harnessPluginIdSchema.parse(harnessId);
|
|
16489
|
-
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16490
|
-
}
|
|
16491
|
-
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16492
|
-
const home = environment.HOME || os.homedir();
|
|
16493
|
-
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16494
|
-
}
|
|
16495
|
-
|
|
16496
16522
|
// ../../harness-broker/dist/validation.js
|
|
16497
16523
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
16498
16524
|
var brokerEnvironmentSchema = external_exports.object({
|
|
@@ -16543,7 +16569,31 @@ var brokerOpenInputSchema = external_exports.discriminatedUnion("kind", [
|
|
|
16543
16569
|
forkSchema,
|
|
16544
16570
|
rollbackSchema
|
|
16545
16571
|
]);
|
|
16546
|
-
var brokerInspectInputSchema = external_exports.object({
|
|
16572
|
+
var brokerInspectInputSchema = external_exports.object({
|
|
16573
|
+
cwd: cwdSchema.optional(),
|
|
16574
|
+
refresh: external_exports.boolean().optional(),
|
|
16575
|
+
purpose: external_exports.literal("availability").optional()
|
|
16576
|
+
}).strict();
|
|
16577
|
+
var brokerSessionImportListParamsSchema = external_exports.object({
|
|
16578
|
+
offset: external_exports.number().int().nonnegative().safe(),
|
|
16579
|
+
limit: external_exports.number().int().min(1).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE)
|
|
16580
|
+
}).strict();
|
|
16581
|
+
var brokerSessionImportResolveParamsSchema = external_exports.object({ nativeSessionId: harnessSessionImportIdSchema }).strict();
|
|
16582
|
+
var brokerSessionImportPageSchema = external_exports.object({
|
|
16583
|
+
candidates: external_exports.array(harnessSessionImportCandidateSchema).max(HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE),
|
|
16584
|
+
total: external_exports.number().int().nonnegative().safe()
|
|
16585
|
+
}).strict();
|
|
16586
|
+
var brokerSessionImportSourceSchema = external_exports.object({
|
|
16587
|
+
candidate: harnessSessionImportCandidateSchema,
|
|
16588
|
+
nativeRef: nativeSessionRefSchema
|
|
16589
|
+
}).strict().superRefine((source, context) => {
|
|
16590
|
+
if (source.nativeRef.nativeSessionId !== source.candidate.nativeSessionId) {
|
|
16591
|
+
context.addIssue({
|
|
16592
|
+
code: "custom",
|
|
16593
|
+
message: "Session import source identity does not match"
|
|
16594
|
+
});
|
|
16595
|
+
}
|
|
16596
|
+
});
|
|
16547
16597
|
var textInputSchema = external_exports.object({ type: external_exports.literal("text"), text: external_exports.string().max(4e6) }).strict();
|
|
16548
16598
|
var turnStartSchema = external_exports.object({
|
|
16549
16599
|
type: external_exports.literal("turn.start"),
|
|
@@ -16714,6 +16764,107 @@ var harnessOutputSchema = external_exports.custom((value) => {
|
|
|
16714
16764
|
return false;
|
|
16715
16765
|
});
|
|
16716
16766
|
|
|
16767
|
+
// ../../harness-broker/dist/session-import-client.js
|
|
16768
|
+
function createBrokerSessionImportCapability(input) {
|
|
16769
|
+
let listing = null;
|
|
16770
|
+
const closed = () => ({
|
|
16771
|
+
ok: false,
|
|
16772
|
+
error: { code: "invalidState", message: "Harness broker adapter is closed", retryable: false }
|
|
16773
|
+
});
|
|
16774
|
+
const invalid = () => ({
|
|
16775
|
+
ok: false,
|
|
16776
|
+
error: {
|
|
16777
|
+
code: "protocolError",
|
|
16778
|
+
message: "Harness broker returned invalid Session import metadata",
|
|
16779
|
+
retryable: false
|
|
16780
|
+
}
|
|
16781
|
+
});
|
|
16782
|
+
const list = async () => {
|
|
16783
|
+
try {
|
|
16784
|
+
const candidates = [];
|
|
16785
|
+
const identities = /* @__PURE__ */ new Set();
|
|
16786
|
+
let total;
|
|
16787
|
+
for (; ; ) {
|
|
16788
|
+
if (input.isClosed())
|
|
16789
|
+
return closed();
|
|
16790
|
+
const result = await input.request("adapter.sessionImport.list", {
|
|
16791
|
+
offset: candidates.length,
|
|
16792
|
+
limit: HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE
|
|
16793
|
+
});
|
|
16794
|
+
if (input.isClosed())
|
|
16795
|
+
return closed();
|
|
16796
|
+
if (!result.ok)
|
|
16797
|
+
return result;
|
|
16798
|
+
const page = brokerSessionImportPageSchema.safeParse(result.value);
|
|
16799
|
+
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)
|
|
16800
|
+
return invalid();
|
|
16801
|
+
total = page.data.total;
|
|
16802
|
+
for (const candidate of page.data.candidates) {
|
|
16803
|
+
if (identities.has(candidate.nativeSessionId))
|
|
16804
|
+
return invalid();
|
|
16805
|
+
identities.add(candidate.nativeSessionId);
|
|
16806
|
+
candidates.push(candidate);
|
|
16807
|
+
}
|
|
16808
|
+
if (candidates.length === total)
|
|
16809
|
+
return { ok: true, value: candidates };
|
|
16810
|
+
}
|
|
16811
|
+
} catch (error51) {
|
|
16812
|
+
return { ok: false, error: input.error(error51) };
|
|
16813
|
+
}
|
|
16814
|
+
};
|
|
16815
|
+
return {
|
|
16816
|
+
listCandidates() {
|
|
16817
|
+
if (input.isClosed())
|
|
16818
|
+
return Promise.resolve(closed());
|
|
16819
|
+
listing ??= list().finally(() => {
|
|
16820
|
+
listing = null;
|
|
16821
|
+
});
|
|
16822
|
+
return listing;
|
|
16823
|
+
},
|
|
16824
|
+
async resolveCandidate(nativeSessionId) {
|
|
16825
|
+
if (input.isClosed())
|
|
16826
|
+
return closed();
|
|
16827
|
+
try {
|
|
16828
|
+
const result = await input.request("adapter.sessionImport.resolve", { nativeSessionId });
|
|
16829
|
+
if (input.isClosed())
|
|
16830
|
+
return closed();
|
|
16831
|
+
if (!result.ok)
|
|
16832
|
+
return result;
|
|
16833
|
+
const source = brokerSessionImportSourceSchema.safeParse(result.value);
|
|
16834
|
+
if (!source.success || source.data.nativeRef.harnessId !== input.harnessId || source.data.candidate.nativeSessionId !== nativeSessionId)
|
|
16835
|
+
return invalid();
|
|
16836
|
+
return { ok: true, value: source.data };
|
|
16837
|
+
} catch (error51) {
|
|
16838
|
+
return { ok: false, error: input.error(error51) };
|
|
16839
|
+
}
|
|
16840
|
+
}
|
|
16841
|
+
};
|
|
16842
|
+
}
|
|
16843
|
+
|
|
16844
|
+
// ../../harness-broker/dist/paths.js
|
|
16845
|
+
import os from "node:os";
|
|
16846
|
+
import path from "node:path";
|
|
16847
|
+
var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
|
|
16848
|
+
var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
|
|
16849
|
+
function defaultHarnessBrokerDirectory(environment = process.env) {
|
|
16850
|
+
const home = environment.HOME || os.homedir();
|
|
16851
|
+
return path.join(home, ".codexhost", "harness-broker");
|
|
16852
|
+
}
|
|
16853
|
+
function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
|
|
16854
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16855
|
+
if (harnessId !== "claude-code")
|
|
16856
|
+
return path.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
16857
|
+
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
16858
|
+
}
|
|
16859
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
16860
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
16861
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
16862
|
+
}
|
|
16863
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
16864
|
+
const home = environment.HOME || os.homedir();
|
|
16865
|
+
return path.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
16866
|
+
}
|
|
16867
|
+
|
|
16717
16868
|
// ../../harness-broker/dist/client.js
|
|
16718
16869
|
function unavailable(message, retryable = true) {
|
|
16719
16870
|
return { code: "unavailable", message, retryable, stage: "harnessBroker" };
|
|
@@ -17250,6 +17401,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
17250
17401
|
commandCatalog;
|
|
17251
17402
|
liveCommandCatalog;
|
|
17252
17403
|
harnessId;
|
|
17404
|
+
sessionImport;
|
|
17253
17405
|
credits;
|
|
17254
17406
|
refreshCredits;
|
|
17255
17407
|
#descriptorPath;
|
|
@@ -17272,6 +17424,14 @@ var BrokeredHarnessAdapter = class {
|
|
|
17272
17424
|
};
|
|
17273
17425
|
constructor(input = {}) {
|
|
17274
17426
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
17427
|
+
if (input.sessionImport) {
|
|
17428
|
+
this.sessionImport = createBrokerSessionImportCapability({
|
|
17429
|
+
harnessId: this.harnessId,
|
|
17430
|
+
request: async (method, params) => parseHarnessResult(await this.#request(method, params, method === "adapter.sessionImport.resolve")),
|
|
17431
|
+
isClosed: () => this.#closed,
|
|
17432
|
+
error: (error51) => this.#error(error51)
|
|
17433
|
+
});
|
|
17434
|
+
}
|
|
17275
17435
|
if (input.accountCredits !== false) {
|
|
17276
17436
|
this.credits = () => this.#credits;
|
|
17277
17437
|
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
@@ -18780,7 +18940,17 @@ function pendingNativeHistoryRewind(contents) {
|
|
|
18780
18940
|
const last = parseRows(contents).findLast((row) => row.type === "resend-fork-notice" || NATIVE_MESSAGE_TYPES.has(text(row.type)));
|
|
18781
18941
|
return last?.type === "resend-fork-notice" ? { forkPointId: text(last.parentId) || null } : void 0;
|
|
18782
18942
|
}
|
|
18943
|
+
function isNativeCompactionSummary(row) {
|
|
18944
|
+
const data = record2(row.providerData);
|
|
18945
|
+
return row.type === "message" && row.role === "user" && data.isCompactInternal === true;
|
|
18946
|
+
}
|
|
18783
18947
|
function nativeHistoryRows(contents) {
|
|
18948
|
+
return collectNativeHistoryRows(contents, false);
|
|
18949
|
+
}
|
|
18950
|
+
function nativeDisplayHistoryRows(contents) {
|
|
18951
|
+
return collectNativeHistoryRows(contents, true);
|
|
18952
|
+
}
|
|
18953
|
+
function collectNativeHistoryRows(contents, followCompactionParent) {
|
|
18784
18954
|
const entries = /* @__PURE__ */ new Map();
|
|
18785
18955
|
let leaf = "";
|
|
18786
18956
|
for (const row of parseRows(contents)) {
|
|
@@ -18805,10 +18975,16 @@ function nativeHistoryRows(contents) {
|
|
|
18805
18975
|
throw new CodeBuddyError("protocolError", "Native history parent is missing");
|
|
18806
18976
|
chain.push(row);
|
|
18807
18977
|
leaf = text(row.parentId);
|
|
18978
|
+
if (!leaf && followCompactionParent && isNativeCompactionSummary(row)) {
|
|
18979
|
+
const logicalParent = text(row.logicalParentId);
|
|
18980
|
+
if (logicalParent && !entries.has(logicalParent))
|
|
18981
|
+
throw new CodeBuddyError("protocolError", "Native compaction parent is missing");
|
|
18982
|
+
leaf = logicalParent;
|
|
18983
|
+
}
|
|
18808
18984
|
}
|
|
18809
18985
|
return chain.reverse();
|
|
18810
18986
|
}
|
|
18811
|
-
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
18987
|
+
function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PROFILE, options = {}) {
|
|
18812
18988
|
const supportsNativeCommands = nativeCommandsEnabled(profile);
|
|
18813
18989
|
const supportsFork = capabilitiesForProfile(profile).history.fork;
|
|
18814
18990
|
const turns = [];
|
|
@@ -18834,7 +19010,8 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18834
19010
|
snapshot.item.outputTruncated = Boolean(output.truncated);
|
|
18835
19011
|
}
|
|
18836
19012
|
};
|
|
18837
|
-
const
|
|
19013
|
+
const includeCompactionHistory = options.includeCompactionHistory !== false;
|
|
19014
|
+
const history = includeCompactionHistory ? nativeDisplayHistoryRows(contents) : nativeHistoryRows(contents);
|
|
18838
19015
|
const manualCompactions = /* @__PURE__ */ new Set();
|
|
18839
19016
|
let compactUser;
|
|
18840
19017
|
if (supportsNativeCommands)
|
|
@@ -18868,6 +19045,22 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
18868
19045
|
continue;
|
|
18869
19046
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
18870
19047
|
continue;
|
|
19048
|
+
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
19049
|
+
if (supportsNativeCommands && current) {
|
|
19050
|
+
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
19051
|
+
status: "failed",
|
|
19052
|
+
error: nativeError(new CodeBuddyError("nativeFailure", "Native compaction did not complete"), profile)
|
|
19053
|
+
};
|
|
19054
|
+
current.items.push({
|
|
19055
|
+
item: {
|
|
19056
|
+
type: "contextCompaction",
|
|
19057
|
+
itemId: hostItemIdSchema.parse(`compact-${text(row.id)}`)
|
|
19058
|
+
},
|
|
19059
|
+
outcome
|
|
19060
|
+
});
|
|
19061
|
+
}
|
|
19062
|
+
continue;
|
|
19063
|
+
}
|
|
18871
19064
|
if (row.type === "message" && row.role === "user") {
|
|
18872
19065
|
current = {
|
|
18873
19066
|
nativeTurnRef: nativeTurnRefSchema.parse({
|
|
@@ -24215,7 +24408,9 @@ function commandCaveat(row) {
|
|
|
24215
24408
|
}
|
|
24216
24409
|
function retainedRowCount(input, contents, sourceCwd = input.cwd, profile = CODEBUDDY_RUNTIME_PROFILE) {
|
|
24217
24410
|
const rows2 = nativeHistoryRows(contents);
|
|
24218
|
-
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile
|
|
24411
|
+
const turns = snapshotFromHistory(contents, input.sourceRef, sourceCwd, profile, {
|
|
24412
|
+
includeCompactionHistory: false
|
|
24413
|
+
}).turns;
|
|
24219
24414
|
let excluded2;
|
|
24220
24415
|
if (input.kind === "rollbackLastTurn") {
|
|
24221
24416
|
if (!turns.length)
|
|
@@ -26819,6 +27014,7 @@ function createHarnessAdapter(context) {
|
|
|
26819
27014
|
...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
|
|
26820
27015
|
};
|
|
26821
27016
|
return new BrokeredHarnessAdapter({
|
|
27017
|
+
sessionImport: true,
|
|
26822
27018
|
accountCredits: false,
|
|
26823
27019
|
harnessId: "workbuddy",
|
|
26824
27020
|
commandCatalog: WORKBUDDY_COMMAND_CATALOG,
|