@codexhost/cli-linux-arm64 0.12.0 → 0.12.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/console-server.mjs +16509 -16397
- package/app/console-web.js +826 -221
- package/app/desktop-controller.mjs +16007 -303
- package/app/host-runtime.mjs +17582 -17153
- package/app/plugins/antigravity/plugin.mjs +62 -13
- package/app/plugins/claude-code/plugin.mjs +308 -75
- package/app/plugins/codebuddy/plugin.mjs +326 -106
- package/app/plugins/cursor-cli/plugin.mjs +298 -69
- package/app/plugins/deepseek-harness/plugin.mjs +62 -13
- package/app/plugins/grok/plugin.mjs +62 -13
- package/app/plugins/hermes/plugin.mjs +62 -13
- package/app/plugins/kimi-code/plugin.mjs +62 -13
- package/app/plugins/kiro-cli/plugin.mjs +62 -13
- package/app/plugins/omp/plugin.mjs +62 -13
- package/app/plugins/opencode/plugin.mjs +62 -13
- package/app/plugins/pi/plugin.mjs +62 -13
- package/app/plugins/qoder/plugin.mjs +62 -13
- package/app/plugins/qoder-cn/plugin.mjs +62 -13
- package/app/plugins/workbuddy/plugin.mjs +301 -71
- package/app/plugins/zcode/plugin.mjs +62 -13
- package/app/renderer-extension.js +1077 -464
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -27645,6 +27645,20 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
27645
27645
|
initializeOnly: external_exports.boolean().optional()
|
|
27646
27646
|
});
|
|
27647
27647
|
|
|
27648
|
+
// ../../shared-contracts/dist/ids.js
|
|
27649
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27650
|
+
message: "Identifier must not be empty or whitespace"
|
|
27651
|
+
});
|
|
27652
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
27653
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
27654
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
27655
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27656
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27657
|
+
|
|
27658
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
27659
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
27660
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
27661
|
+
|
|
27648
27662
|
// ../../shared-contracts/dist/console.js
|
|
27649
27663
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
27650
27664
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -27657,6 +27671,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
27657
27671
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27658
27672
|
});
|
|
27659
27673
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27674
|
+
"codexhost/console/remote-connections",
|
|
27675
|
+
"codexhost/runtime/status",
|
|
27676
|
+
"codexhost/remote/ssh-setup",
|
|
27660
27677
|
"codexhost/harness/plugins/list",
|
|
27661
27678
|
"codexhost/harness/display-settings/get",
|
|
27662
27679
|
"codexhost/harness/display-settings/set",
|
|
@@ -27723,16 +27740,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
27723
27740
|
inactiveMs: external_exports.number().nonnegative()
|
|
27724
27741
|
}));
|
|
27725
27742
|
|
|
27726
|
-
// ../../shared-contracts/dist/ids.js
|
|
27727
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
27728
|
-
message: "Identifier must not be empty or whitespace"
|
|
27729
|
-
});
|
|
27730
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
27731
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
27732
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
27733
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27734
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27735
|
-
|
|
27736
27743
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
27737
27744
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
27738
27745
|
threadId: hostThreadIdSchema,
|
|
@@ -28647,11 +28654,53 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
28647
28654
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28648
28655
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28649
28656
|
identity: external_exports.string().max(4096).nullable(),
|
|
28650
|
-
action: external_exports.enum(["inspect", "install", "update", "repair"]),
|
|
28657
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
28658
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
28651
28659
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28652
28660
|
}).strict();
|
|
28653
28661
|
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28654
28662
|
|
|
28663
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
28664
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
28665
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
28666
|
+
hostId,
|
|
28667
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28668
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
28669
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
28670
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
28671
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28672
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28673
|
+
autoConnect: external_exports.boolean(),
|
|
28674
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
28675
|
+
});
|
|
28676
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
28677
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28678
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
28679
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28680
|
+
identity: external_exports.string().max(4096).nullable()
|
|
28681
|
+
});
|
|
28682
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28683
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28684
|
+
external_exports.strictObject({
|
|
28685
|
+
action: external_exports.literal("save"),
|
|
28686
|
+
draft: codexSshDraftSchema,
|
|
28687
|
+
previous: codexSshConnectionSchema.nullable()
|
|
28688
|
+
}),
|
|
28689
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
28690
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
28691
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
28692
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
28693
|
+
external_exports.strictObject({
|
|
28694
|
+
action: external_exports.literal("update"),
|
|
28695
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28696
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
28697
|
+
})
|
|
28698
|
+
]);
|
|
28699
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
28700
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
28701
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
28702
|
+
]);
|
|
28703
|
+
|
|
28655
28704
|
// ../../shared-contracts/dist/index.js
|
|
28656
28705
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28657
28706
|
|
|
@@ -28780,7 +28829,6 @@ var tokenFields = [
|
|
|
28780
28829
|
"cachedInputTokens",
|
|
28781
28830
|
"cacheWriteInputTokens",
|
|
28782
28831
|
"outputTokens",
|
|
28783
|
-
"outputTokensPerSecond",
|
|
28784
28832
|
"reasoningOutputTokens",
|
|
28785
28833
|
"totalTokens",
|
|
28786
28834
|
"contextWindowTokens",
|
|
@@ -28801,7 +28849,8 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
28801
28849
|
...percentFields,
|
|
28802
28850
|
"totalCostUsd",
|
|
28803
28851
|
"totalCredits",
|
|
28804
|
-
"contextUsagePercent"
|
|
28852
|
+
"contextUsagePercent",
|
|
28853
|
+
"outputTokensPerSecond"
|
|
28805
28854
|
]);
|
|
28806
28855
|
function isRecord(value) {
|
|
28807
28856
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -29008,11 +29057,13 @@ function cursorDiscoverySpec(skipPinnedVersions) {
|
|
|
29008
29057
|
} : {}
|
|
29009
29058
|
};
|
|
29010
29059
|
}
|
|
29060
|
+
var CursorNotInstalledError = class extends Error {
|
|
29061
|
+
};
|
|
29011
29062
|
function resolveCursorExecutable(environment, command) {
|
|
29012
29063
|
const input = { environment, ...command ? { command } : {} };
|
|
29013
29064
|
const pinned = resolveHarnessExecutable(cursorDiscoverySpec(false), input);
|
|
29014
29065
|
if (!pinned)
|
|
29015
|
-
throw new
|
|
29066
|
+
throw new CursorNotInstalledError("Cursor CLI is not installed; install cursor-agent or set CODEXHOST_CURSOR_COMMAND");
|
|
29016
29067
|
const explicit = command?.trim() || environment.CODEXHOST_CURSOR_COMMAND?.trim();
|
|
29017
29068
|
if (explicit || !PINNED_VERSION_AGENT.test(pinned.executable))
|
|
29018
29069
|
return pinned;
|
|
@@ -47557,6 +47608,7 @@ var CursorSession = class {
|
|
|
47557
47608
|
};
|
|
47558
47609
|
|
|
47559
47610
|
// ../../harness-broker/dist/client.js
|
|
47611
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
47560
47612
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
47561
47613
|
import { lstat as lstat2, readFile as readFile4 } from "node:fs/promises";
|
|
47562
47614
|
import net, {} from "node:net";
|
|
@@ -47566,9 +47618,12 @@ var HARNESS_BROKER_PROTOCOL_VERSION = 1;
|
|
|
47566
47618
|
var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
47567
47619
|
var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
|
|
47568
47620
|
var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
|
|
47621
|
+
var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
47622
|
+
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
47569
47623
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
47570
47624
|
"adapter.inspect",
|
|
47571
47625
|
"adapter.inspectAccount",
|
|
47626
|
+
"adapter.credits",
|
|
47572
47627
|
"adapter.open",
|
|
47573
47628
|
"adapter.subagent.readSnapshot",
|
|
47574
47629
|
"session.readSnapshot",
|
|
@@ -47686,6 +47741,14 @@ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId
|
|
|
47686
47741
|
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
47687
47742
|
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
47688
47743
|
}
|
|
47744
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
47745
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
47746
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
47747
|
+
}
|
|
47748
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
47749
|
+
const home = environment.HOME || os4.homedir();
|
|
47750
|
+
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
47751
|
+
}
|
|
47689
47752
|
|
|
47690
47753
|
// ../../harness-broker/dist/validation.js
|
|
47691
47754
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
@@ -47991,10 +48054,55 @@ async function readDescriptor(descriptorPath) {
|
|
|
47991
48054
|
try {
|
|
47992
48055
|
process.kill(descriptor.ownerPid, 0);
|
|
47993
48056
|
} catch {
|
|
47994
|
-
throw new
|
|
48057
|
+
throw new BrokerNotRunningError("its owner process has exited");
|
|
47995
48058
|
}
|
|
47996
48059
|
return descriptor;
|
|
47997
48060
|
}
|
|
48061
|
+
var BrokerNotRunningError = class extends Error {
|
|
48062
|
+
};
|
|
48063
|
+
var BrokerRetiringError = class extends Error {
|
|
48064
|
+
};
|
|
48065
|
+
var BrokerRequestNotDeliveredError = class extends Error {
|
|
48066
|
+
};
|
|
48067
|
+
var HarnessNotInstalledError = class extends Error {
|
|
48068
|
+
};
|
|
48069
|
+
var BROKER_NOT_RUNNING_CODES = /* @__PURE__ */ new Set(["ENOENT", "ECONNREFUSED"]);
|
|
48070
|
+
var BROKER_START_TIMEOUT_MS = 15e3;
|
|
48071
|
+
var BROKER_START_POLL_MS = 250;
|
|
48072
|
+
function classifyConnectFailure(error51) {
|
|
48073
|
+
if (error51 instanceof BrokerNotRunningError)
|
|
48074
|
+
return error51;
|
|
48075
|
+
const code = error51?.code;
|
|
48076
|
+
if (code && BROKER_NOT_RUNNING_CODES.has(code)) {
|
|
48077
|
+
return new BrokerNotRunningError(code === "ENOENT" ? "its descriptor or socket is missing" : "its socket refused the connection");
|
|
48078
|
+
}
|
|
48079
|
+
return error51 instanceof Error ? error51 : new Error(String(error51));
|
|
48080
|
+
}
|
|
48081
|
+
function describeBrokerFailure(error51, harnessId) {
|
|
48082
|
+
if (error51 instanceof BrokerNotRunningError) {
|
|
48083
|
+
return `The ${harnessId} Aqua Harness broker on this Mac could not be started (${error51.message}). Keep the desktop user logged in, then repair the remote service or run on this Mac: codexhost broker install --harness ${harnessId}`;
|
|
48084
|
+
}
|
|
48085
|
+
return error51 instanceof Error ? error51.message : String(error51);
|
|
48086
|
+
}
|
|
48087
|
+
function runLaunchctl(arguments_) {
|
|
48088
|
+
return new Promise((resolve) => {
|
|
48089
|
+
execFile4("/bin/launchctl", arguments_, { timeout: 1e4 }, (error51) => resolve(!error51));
|
|
48090
|
+
});
|
|
48091
|
+
}
|
|
48092
|
+
async function startBrokerLaunchAgent(harnessId, environment) {
|
|
48093
|
+
const uid = process.getuid?.();
|
|
48094
|
+
if (uid === void 0)
|
|
48095
|
+
return;
|
|
48096
|
+
const target = `gui/${uid}/${harnessBrokerLaunchAgentLabel(harnessId)}`;
|
|
48097
|
+
if (await runLaunchctl(["kickstart", target]))
|
|
48098
|
+
return;
|
|
48099
|
+
await runLaunchctl([
|
|
48100
|
+
"bootstrap",
|
|
48101
|
+
`gui/${uid}`,
|
|
48102
|
+
harnessBrokerLaunchAgentPlistPath(environment, harnessId)
|
|
48103
|
+
]);
|
|
48104
|
+
await runLaunchctl(["kickstart", target]);
|
|
48105
|
+
}
|
|
47998
48106
|
var BrokerConnection = class _BrokerConnection {
|
|
47999
48107
|
#onClose;
|
|
48000
48108
|
onClose(callback) {
|
|
@@ -48018,21 +48126,31 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48018
48126
|
socket.once("error", (error51) => this.#fail(error51));
|
|
48019
48127
|
}
|
|
48020
48128
|
static async connect(descriptorPath, harnessId) {
|
|
48021
|
-
|
|
48022
|
-
|
|
48023
|
-
|
|
48024
|
-
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48028
|
-
|
|
48029
|
-
|
|
48030
|
-
|
|
48031
|
-
|
|
48032
|
-
|
|
48033
|
-
|
|
48129
|
+
let descriptor;
|
|
48130
|
+
let socket;
|
|
48131
|
+
let connecting;
|
|
48132
|
+
try {
|
|
48133
|
+
descriptor = await readDescriptor(descriptorPath);
|
|
48134
|
+
if (descriptor.harnessId !== harnessId)
|
|
48135
|
+
throw new Error("Aqua broker belongs to another Harness");
|
|
48136
|
+
connecting = net.createConnection(descriptor.socketPath);
|
|
48137
|
+
const pending = connecting;
|
|
48138
|
+
await new Promise((resolve, reject) => {
|
|
48139
|
+
const timeout = setTimeout(() => reject(new Error("Timed out connecting to Aqua Harness broker")), HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
48140
|
+
pending.once("connect", () => {
|
|
48141
|
+
clearTimeout(timeout);
|
|
48142
|
+
resolve();
|
|
48143
|
+
});
|
|
48144
|
+
pending.once("error", (error51) => {
|
|
48145
|
+
clearTimeout(timeout);
|
|
48146
|
+
reject(error51);
|
|
48147
|
+
});
|
|
48034
48148
|
});
|
|
48035
|
-
|
|
48149
|
+
socket = pending;
|
|
48150
|
+
} catch (error51) {
|
|
48151
|
+
connecting?.destroy();
|
|
48152
|
+
throw classifyConnectFailure(error51);
|
|
48153
|
+
}
|
|
48036
48154
|
const connection = new _BrokerConnection(descriptor, socket);
|
|
48037
48155
|
const hello = connection.#waitForHello();
|
|
48038
48156
|
await writeBrokerFrame(socket, {
|
|
@@ -48085,15 +48203,24 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48085
48203
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
48086
48204
|
this.#pending.set(id, { resolve, reject, timeout });
|
|
48087
48205
|
});
|
|
48088
|
-
|
|
48089
|
-
|
|
48090
|
-
|
|
48091
|
-
|
|
48092
|
-
|
|
48093
|
-
|
|
48094
|
-
|
|
48095
|
-
|
|
48096
|
-
|
|
48206
|
+
try {
|
|
48207
|
+
await writeBrokerFrame(this.#socket, {
|
|
48208
|
+
version: HARNESS_BROKER_PROTOCOL_VERSION,
|
|
48209
|
+
generation: this.#descriptor.generation,
|
|
48210
|
+
sequence: this.#inputSequence,
|
|
48211
|
+
kind: "request",
|
|
48212
|
+
id,
|
|
48213
|
+
method,
|
|
48214
|
+
params
|
|
48215
|
+
});
|
|
48216
|
+
} catch (error51) {
|
|
48217
|
+
const pending = this.#pending.get(id);
|
|
48218
|
+
if (pending)
|
|
48219
|
+
clearTimeout(pending.timeout);
|
|
48220
|
+
this.#pending.delete(id);
|
|
48221
|
+
response.catch(() => void 0);
|
|
48222
|
+
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
48223
|
+
}
|
|
48097
48224
|
return response;
|
|
48098
48225
|
}
|
|
48099
48226
|
close() {
|
|
@@ -48137,6 +48264,8 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48137
48264
|
this.#pending.delete(frame.id);
|
|
48138
48265
|
if (frame.ok)
|
|
48139
48266
|
pending.resolve(frame.value);
|
|
48267
|
+
else if (frame.error?.code === HARNESS_BROKER_RETIRING_ERROR_CODE)
|
|
48268
|
+
pending.reject(new BrokerRetiringError(frame.error.message));
|
|
48140
48269
|
else
|
|
48141
48270
|
pending.reject(new Error(frame.error?.message ?? "Broker request failed"));
|
|
48142
48271
|
}
|
|
@@ -48362,17 +48491,19 @@ var BrokeredHarnessAdapter = class {
|
|
|
48362
48491
|
harnessId;
|
|
48363
48492
|
#descriptorPath;
|
|
48364
48493
|
#forwardEnvironment;
|
|
48494
|
+
#isInstalled;
|
|
48495
|
+
#startBroker;
|
|
48496
|
+
#startTimeoutMs;
|
|
48365
48497
|
#connection = null;
|
|
48366
48498
|
#closed = false;
|
|
48499
|
+
#credits = null;
|
|
48500
|
+
#creditsRefresh = null;
|
|
48367
48501
|
subagents = {
|
|
48368
48502
|
readSnapshot: async (input) => {
|
|
48369
48503
|
try {
|
|
48370
|
-
return parseHarnessResult(await
|
|
48504
|
+
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot", input));
|
|
48371
48505
|
} catch (error51) {
|
|
48372
|
-
return {
|
|
48373
|
-
ok: false,
|
|
48374
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
48375
|
-
};
|
|
48506
|
+
return { ok: false, error: this.#error(error51) };
|
|
48376
48507
|
}
|
|
48377
48508
|
}
|
|
48378
48509
|
};
|
|
@@ -48384,12 +48515,39 @@ var BrokeredHarnessAdapter = class {
|
|
|
48384
48515
|
if (input.liveCommandCatalog)
|
|
48385
48516
|
this.liveCommandCatalog = true;
|
|
48386
48517
|
this.#descriptorPath = input.descriptorPath ?? defaultHarnessBrokerDescriptorPath(input.environment, this.harnessId);
|
|
48518
|
+
this.#isInstalled = input.isInstalled;
|
|
48519
|
+
const environment = input.environment ?? process.env;
|
|
48520
|
+
this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
|
|
48521
|
+
this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
|
|
48522
|
+
}
|
|
48523
|
+
credits() {
|
|
48524
|
+
return this.#credits;
|
|
48525
|
+
}
|
|
48526
|
+
refreshCredits() {
|
|
48527
|
+
if (this.#closed)
|
|
48528
|
+
return Promise.resolve(null);
|
|
48529
|
+
if (this.#creditsRefresh)
|
|
48530
|
+
return this.#creditsRefresh;
|
|
48531
|
+
this.#creditsRefresh = this.#readCredits().finally(() => {
|
|
48532
|
+
this.#creditsRefresh = null;
|
|
48533
|
+
});
|
|
48534
|
+
return this.#creditsRefresh;
|
|
48535
|
+
}
|
|
48536
|
+
async #readCredits() {
|
|
48537
|
+
try {
|
|
48538
|
+
const value = await this.#request("adapter.credits", {}, true);
|
|
48539
|
+
const credits = accountCreditsSnapshotSchema.nullable().parse(value);
|
|
48540
|
+
if (!this.#closed)
|
|
48541
|
+
this.#credits = credits;
|
|
48542
|
+
} catch {
|
|
48543
|
+
}
|
|
48544
|
+
return this.#credits;
|
|
48387
48545
|
}
|
|
48388
48546
|
async inspectAccount() {
|
|
48389
48547
|
if (this.#closed)
|
|
48390
48548
|
return null;
|
|
48391
48549
|
try {
|
|
48392
|
-
const value = await
|
|
48550
|
+
const value = await this.#request("adapter.inspectAccount", {}, true);
|
|
48393
48551
|
return harnessAccountSnapshotSchema.nullable().parse(value);
|
|
48394
48552
|
} catch {
|
|
48395
48553
|
return null;
|
|
@@ -48399,33 +48557,46 @@ var BrokeredHarnessAdapter = class {
|
|
|
48399
48557
|
if (this.#closed)
|
|
48400
48558
|
return failedInspection("Aqua Harness broker adapter is closed");
|
|
48401
48559
|
try {
|
|
48402
|
-
return harnessInspectionSchema.parse(await
|
|
48560
|
+
return harnessInspectionSchema.parse(await this.#request("adapter.inspect", input, true));
|
|
48403
48561
|
} catch (error51) {
|
|
48404
48562
|
this.#connection = null;
|
|
48405
|
-
|
|
48563
|
+
if (error51 instanceof HarnessNotInstalledError)
|
|
48564
|
+
return { status: "notInstalled", error: this.#error(error51) };
|
|
48565
|
+
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
48406
48566
|
}
|
|
48407
48567
|
}
|
|
48408
48568
|
async open(input) {
|
|
48409
48569
|
if (this.#closed)
|
|
48410
48570
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|
|
48571
|
+
const safeInput = { ...input };
|
|
48572
|
+
delete safeInput.environment;
|
|
48573
|
+
if (this.#forwardEnvironment && input.environment) {
|
|
48574
|
+
const allowed = [
|
|
48575
|
+
"CODEXHOST_CLI_PATH",
|
|
48576
|
+
"CODEXHOST_CLI_NODE_PATH",
|
|
48577
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
48578
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
48579
|
+
"CODEXHOST_THREAD_ID"
|
|
48580
|
+
];
|
|
48581
|
+
const environment = Object.fromEntries(Object.entries(input.environment).filter(([key, value]) => allowed.includes(key) && value !== void 0));
|
|
48582
|
+
if (Object.keys(environment).length)
|
|
48583
|
+
safeInput.environment = environment;
|
|
48584
|
+
}
|
|
48411
48585
|
let connection;
|
|
48412
48586
|
try {
|
|
48413
|
-
|
|
48414
|
-
|
|
48415
|
-
|
|
48416
|
-
|
|
48417
|
-
"
|
|
48418
|
-
|
|
48419
|
-
|
|
48420
|
-
|
|
48421
|
-
|
|
48422
|
-
|
|
48423
|
-
|
|
48424
|
-
|
|
48425
|
-
|
|
48426
|
-
}
|
|
48427
|
-
connection = await this.#connect();
|
|
48428
|
-
const result = parseHarnessResult(await connection.request("adapter.open", safeInput));
|
|
48587
|
+
let value;
|
|
48588
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
48589
|
+
connection = await this.#connect();
|
|
48590
|
+
try {
|
|
48591
|
+
value = await connection.request("adapter.open", safeInput);
|
|
48592
|
+
break;
|
|
48593
|
+
} catch (error51) {
|
|
48594
|
+
if (attempt > 0 || !(error51 instanceof BrokerRetiringError || error51 instanceof BrokerRequestNotDeliveredError))
|
|
48595
|
+
throw error51;
|
|
48596
|
+
this.#connection = null;
|
|
48597
|
+
}
|
|
48598
|
+
}
|
|
48599
|
+
const result = parseHarnessResult(value);
|
|
48429
48600
|
if (!result.ok)
|
|
48430
48601
|
return result;
|
|
48431
48602
|
const session = new BrokeredHarnessSession(connection, parseSessionMetadata(result.value), this.harnessId, safeInput, () => this.#connect(), () => {
|
|
@@ -48436,25 +48607,51 @@ var BrokeredHarnessAdapter = class {
|
|
|
48436
48607
|
} catch (error51) {
|
|
48437
48608
|
connection?.close();
|
|
48438
48609
|
this.#connection = null;
|
|
48439
|
-
return {
|
|
48440
|
-
ok: false,
|
|
48441
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
48442
|
-
};
|
|
48610
|
+
return { ok: false, error: this.#error(error51) };
|
|
48443
48611
|
}
|
|
48444
48612
|
}
|
|
48445
48613
|
async close() {
|
|
48446
48614
|
this.#closed = true;
|
|
48615
|
+
this.#credits = null;
|
|
48447
48616
|
await Promise.allSettled([...this.#sessions].map((session) => session.close()));
|
|
48448
48617
|
this.#sessions.clear();
|
|
48449
48618
|
const connection = await this.#connection?.catch(() => null);
|
|
48450
48619
|
await connection?.dispose();
|
|
48451
48620
|
this.#connection = null;
|
|
48452
48621
|
}
|
|
48622
|
+
#error(error51) {
|
|
48623
|
+
if (error51 instanceof HarnessNotInstalledError)
|
|
48624
|
+
return {
|
|
48625
|
+
code: "notInstalled",
|
|
48626
|
+
message: error51.message,
|
|
48627
|
+
retryable: false,
|
|
48628
|
+
stage: "harnessBroker"
|
|
48629
|
+
};
|
|
48630
|
+
return unavailable(describeBrokerFailure(error51, this.harnessId));
|
|
48631
|
+
}
|
|
48632
|
+
/**
|
|
48633
|
+
* Sends one adapter-level request. A broker that retired between requests refuses it
|
|
48634
|
+
* unprocessed, so it is retried once on a fresh broker. Idempotent reads also retry
|
|
48635
|
+
* once after a plain disconnect.
|
|
48636
|
+
*/
|
|
48637
|
+
async #request(method, params, idempotent = false) {
|
|
48638
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
48639
|
+
const connection = await this.#connect();
|
|
48640
|
+
try {
|
|
48641
|
+
return await connection.request(method, params);
|
|
48642
|
+
} catch (error51) {
|
|
48643
|
+
const retryable = error51 instanceof BrokerRetiringError || error51 instanceof BrokerRequestNotDeliveredError || idempotent && connection.closed;
|
|
48644
|
+
if (attempt > 0 || !retryable)
|
|
48645
|
+
throw error51;
|
|
48646
|
+
this.#connection = null;
|
|
48647
|
+
}
|
|
48648
|
+
}
|
|
48649
|
+
}
|
|
48453
48650
|
#connect() {
|
|
48454
48651
|
if (this.#closed)
|
|
48455
48652
|
return Promise.reject(new Error("Aqua Harness broker adapter is closed"));
|
|
48456
48653
|
if (!this.#connection) {
|
|
48457
|
-
const pending =
|
|
48654
|
+
const pending = this.#establish().then((connection) => {
|
|
48458
48655
|
connection.onClose(() => {
|
|
48459
48656
|
if (this.#connection === pending)
|
|
48460
48657
|
this.#connection = null;
|
|
@@ -48469,18 +48666,50 @@ var BrokeredHarnessAdapter = class {
|
|
|
48469
48666
|
}
|
|
48470
48667
|
return this.#connection;
|
|
48471
48668
|
}
|
|
48669
|
+
async #establish() {
|
|
48670
|
+
try {
|
|
48671
|
+
return await BrokerConnection.connect(this.#descriptorPath, this.harnessId);
|
|
48672
|
+
} catch (error51) {
|
|
48673
|
+
if (!(error51 instanceof BrokerNotRunningError) || !this.#startBroker)
|
|
48674
|
+
throw error51;
|
|
48675
|
+
}
|
|
48676
|
+
if (this.#isInstalled && !this.#isInstalled()) {
|
|
48677
|
+
throw new HarnessNotInstalledError(`${this.harnessId} is not installed on this Mac`);
|
|
48678
|
+
}
|
|
48679
|
+
const deadline = Date.now() + this.#startTimeoutMs;
|
|
48680
|
+
for (; ; ) {
|
|
48681
|
+
await this.#startBroker();
|
|
48682
|
+
try {
|
|
48683
|
+
return await BrokerConnection.connect(this.#descriptorPath, this.harnessId);
|
|
48684
|
+
} catch (error51) {
|
|
48685
|
+
if (!(error51 instanceof BrokerNotRunningError) || Date.now() >= deadline)
|
|
48686
|
+
throw error51;
|
|
48687
|
+
}
|
|
48688
|
+
await new Promise((resolve) => setTimeout(resolve, BROKER_START_POLL_MS));
|
|
48689
|
+
}
|
|
48690
|
+
}
|
|
48472
48691
|
};
|
|
48473
48692
|
|
|
48474
48693
|
// dist/plugin.js
|
|
48475
48694
|
function createHarnessAdapter(context) {
|
|
48476
|
-
if (context.platform === "darwin" && context.managedRemoteHost)
|
|
48695
|
+
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
48696
|
+
const environment2 = { ...context.environment };
|
|
48477
48697
|
return new BrokeredHarnessAdapter({
|
|
48478
48698
|
harnessId: "cursor-cli",
|
|
48479
48699
|
forwardDelegationEnvironment: true,
|
|
48480
48700
|
commandCatalog: CURSOR_COMMAND_CATALOG,
|
|
48481
48701
|
liveCommandCatalog: true,
|
|
48482
|
-
environment:
|
|
48702
|
+
environment: environment2,
|
|
48703
|
+
isInstalled: () => {
|
|
48704
|
+
try {
|
|
48705
|
+
resolveCursorExecutable(environment2);
|
|
48706
|
+
return true;
|
|
48707
|
+
} catch (error51) {
|
|
48708
|
+
return !(error51 instanceof CursorNotInstalledError);
|
|
48709
|
+
}
|
|
48710
|
+
}
|
|
48483
48711
|
});
|
|
48712
|
+
}
|
|
48484
48713
|
const environment = { ...context.environment };
|
|
48485
48714
|
return Object.assign(new CursorAdapter({ environment }), {
|
|
48486
48715
|
installation: createCursorInstallation(environment),
|
|
@@ -18775,6 +18775,20 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
18775
18775
|
initializeOnly: external_exports.boolean().optional()
|
|
18776
18776
|
});
|
|
18777
18777
|
|
|
18778
|
+
// ../../shared-contracts/dist/ids.js
|
|
18779
|
+
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18780
|
+
message: "Identifier must not be empty or whitespace"
|
|
18781
|
+
});
|
|
18782
|
+
var harnessIdSchema = opaqueIdSchema.brand();
|
|
18783
|
+
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
18784
|
+
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
18785
|
+
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18786
|
+
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18787
|
+
|
|
18788
|
+
// ../../shared-contracts/dist/thread-prewarm.js
|
|
18789
|
+
var threadPrewarmDiscardParamsSchema = external_exports.object({ threadId: hostThreadIdSchema });
|
|
18790
|
+
var threadPrewarmDiscardResultSchema = external_exports.object({ discarded: external_exports.boolean() });
|
|
18791
|
+
|
|
18778
18792
|
// ../../shared-contracts/dist/console.js
|
|
18779
18793
|
var consoleAnnouncementSchema = external_exports.strictObject({
|
|
18780
18794
|
title: external_exports.string().trim().min(1).max(200),
|
|
@@ -18787,6 +18801,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
18787
18801
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
18788
18802
|
});
|
|
18789
18803
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
18804
|
+
"codexhost/console/remote-connections",
|
|
18805
|
+
"codexhost/runtime/status",
|
|
18806
|
+
"codexhost/remote/ssh-setup",
|
|
18790
18807
|
"codexhost/harness/plugins/list",
|
|
18791
18808
|
"codexhost/harness/display-settings/get",
|
|
18792
18809
|
"codexhost/harness/display-settings/set",
|
|
@@ -18853,16 +18870,6 @@ var loadedSessionsSchema = external_exports.array(external_exports.strictObject(
|
|
|
18853
18870
|
inactiveMs: external_exports.number().nonnegative()
|
|
18854
18871
|
}));
|
|
18855
18872
|
|
|
18856
|
-
// ../../shared-contracts/dist/ids.js
|
|
18857
|
-
var opaqueIdSchema = external_exports.string().refine((value) => value.trim().length > 0, {
|
|
18858
|
-
message: "Identifier must not be empty or whitespace"
|
|
18859
|
-
});
|
|
18860
|
-
var harnessIdSchema = opaqueIdSchema.brand();
|
|
18861
|
-
var hostThreadIdSchema = opaqueIdSchema.brand();
|
|
18862
|
-
var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
18863
|
-
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
18864
|
-
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
18865
|
-
|
|
18866
18873
|
// ../../shared-contracts/dist/manual-compaction.js
|
|
18867
18874
|
var threadManualCompactionStartedSchema = external_exports.strictObject({
|
|
18868
18875
|
threadId: hostThreadIdSchema,
|
|
@@ -19781,11 +19788,53 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
19781
19788
|
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
19782
19789
|
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
19783
19790
|
identity: external_exports.string().max(4096).nullable(),
|
|
19784
|
-
action: external_exports.enum(["inspect", "install", "update", "repair"]),
|
|
19791
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
19792
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
19785
19793
|
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
19786
19794
|
}).strict();
|
|
19787
19795
|
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
19788
19796
|
|
|
19797
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
19798
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
19799
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
19800
|
+
hostId,
|
|
19801
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
19802
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
19803
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
19804
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
19805
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
19806
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
19807
|
+
autoConnect: external_exports.boolean(),
|
|
19808
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
19809
|
+
});
|
|
19810
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
19811
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
19812
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
19813
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
19814
|
+
identity: external_exports.string().max(4096).nullable()
|
|
19815
|
+
});
|
|
19816
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
19817
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
19818
|
+
external_exports.strictObject({
|
|
19819
|
+
action: external_exports.literal("save"),
|
|
19820
|
+
draft: codexSshDraftSchema,
|
|
19821
|
+
previous: codexSshConnectionSchema.nullable()
|
|
19822
|
+
}),
|
|
19823
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
19824
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
19825
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
19826
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
19827
|
+
external_exports.strictObject({
|
|
19828
|
+
action: external_exports.literal("update"),
|
|
19829
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
19830
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
19831
|
+
})
|
|
19832
|
+
]);
|
|
19833
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
19834
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
19835
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
19836
|
+
]);
|
|
19837
|
+
|
|
19789
19838
|
// ../../shared-contracts/dist/index.js
|
|
19790
19839
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
19791
19840
|
|
|
@@ -19919,7 +19968,6 @@ var tokenFields = [
|
|
|
19919
19968
|
"cachedInputTokens",
|
|
19920
19969
|
"cacheWriteInputTokens",
|
|
19921
19970
|
"outputTokens",
|
|
19922
|
-
"outputTokensPerSecond",
|
|
19923
19971
|
"reasoningOutputTokens",
|
|
19924
19972
|
"totalTokens",
|
|
19925
19973
|
"contextWindowTokens",
|
|
@@ -19940,7 +19988,8 @@ var usageFields = /* @__PURE__ */ new Set([
|
|
|
19940
19988
|
...percentFields,
|
|
19941
19989
|
"totalCostUsd",
|
|
19942
19990
|
"totalCredits",
|
|
19943
|
-
"contextUsagePercent"
|
|
19991
|
+
"contextUsagePercent",
|
|
19992
|
+
"outputTokensPerSecond"
|
|
19944
19993
|
]);
|
|
19945
19994
|
function isRecord(value) {
|
|
19946
19995
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|