@liberseek/boft-cli-win32-arm64 0.7.7 → 0.7.9
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 +16598 -16440
- package/app/console-web.js +3628 -1789
- package/app/desktop-controller.mjs +16256 -351
- package/app/host-runtime.mjs +4360 -962
- package/app/plugins/antigravity/plugin.mjs +86 -2
- package/app/plugins/claude-code/plugin.mjs +399 -102
- package/app/plugins/codebuddy/plugin.mjs +733 -136
- package/app/plugins/cursor-cli/plugin.mjs +436 -122
- package/app/plugins/deepseek-harness/plugin.mjs +87 -2
- package/app/plugins/enabled.json +2 -1
- package/app/plugins/grok/plugin.mjs +464 -58
- package/app/plugins/hermes/plugin.mjs +3307 -7685
- package/app/plugins/kimi-code/plugin.mjs +376 -43
- package/app/plugins/kiro-cli/plugin.mjs +390 -48
- package/app/plugins/muse/plugin.mjs +86 -2
- package/app/plugins/omp/plugin.mjs +539 -105
- package/app/plugins/opencode/plugin.mjs +333 -79
- package/app/plugins/pi/plugin.mjs +200 -57
- package/app/plugins/qoder/plugin.mjs +317 -38
- package/app/plugins/qoder-cn/plugin.mjs +317 -38
- package/app/plugins/workbuddy/plugin.mjs +704 -98
- package/app/plugins/zcode/assets/icon.svg +8 -0
- package/app/plugins/zcode/manifest.json +14 -0
- package/app/plugins/zcode/plugin.mjs +19304 -0
- package/app/renderer-extension.js +2766 -695
- package/bin/boft.exe +0 -0
- package/libexec/boft-node-repl.exe +0 -0
- package/libexec/boft-shim.exe +0 -0
- package/libexec/boft-updater.exe +0 -0
- package/package.json +2 -2
|
@@ -27655,6 +27655,10 @@ var hostTurnIdSchema = opaqueIdSchema.brand();
|
|
|
27655
27655
|
var hostItemIdSchema = opaqueIdSchema.brand();
|
|
27656
27656
|
var hostInteractionIdSchema = opaqueIdSchema.brand();
|
|
27657
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
|
+
|
|
27658
27662
|
// ../../shared-contracts/dist/harness-plugins.js
|
|
27659
27663
|
var HARNESS_PLUGIN_MANIFEST_MAX_BYTES = 32 * 1024;
|
|
27660
27664
|
var HARNESS_PLUGIN_ICON_MAX_BYTES = 128 * 1024;
|
|
@@ -27722,6 +27726,9 @@ var consoleOpenResultSchema = external_exports.strictObject({
|
|
|
27722
27726
|
url: external_exports.string().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)
|
|
27723
27727
|
});
|
|
27724
27728
|
var CONSOLE_HOST_METHODS = Object.freeze([
|
|
27729
|
+
"codexhost/console/remote-connections",
|
|
27730
|
+
"codexhost/runtime/status",
|
|
27731
|
+
"codexhost/remote/ssh-setup",
|
|
27725
27732
|
"codexhost/harness/plugins/list",
|
|
27726
27733
|
"codexhost/harness/display-settings/get",
|
|
27727
27734
|
"codexhost/harness/display-settings/set",
|
|
@@ -28350,7 +28357,10 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
28350
28357
|
latestVersion: external_exports.string().min(1).max(128),
|
|
28351
28358
|
updateAvailable: external_exports.boolean(),
|
|
28352
28359
|
canUpdate: external_exports.boolean(),
|
|
28353
|
-
|
|
28360
|
+
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
28361
|
+
message: external_exports.string().max(2048).optional(),
|
|
28362
|
+
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
28363
|
+
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
28354
28364
|
}).strict();
|
|
28355
28365
|
|
|
28356
28366
|
// ../../shared-contracts/dist/codex-accounts.js
|
|
@@ -28645,7 +28655,7 @@ var updateStatusSchema = external_exports.strictObject({
|
|
|
28645
28655
|
}
|
|
28646
28656
|
});
|
|
28647
28657
|
var updateEmptyParamsSchema = external_exports.strictObject({});
|
|
28648
|
-
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/LiberSeek\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
28658
|
+
var githubReleaseNotesUrlSchema = external_exports.string().max(300).regex(/^https:\/\/github\.com\/(LiberSeek|LIBERSEEK)\/BOFT-CLI\/releases\/tag\/v[0-9A-Za-z.+-]+$/u, "release notes URL must identify a codexhost GitHub Release");
|
|
28649
28659
|
var updateCheckResultSchema = external_exports.strictObject({
|
|
28650
28660
|
currentVersion: updateSemanticVersionSchema,
|
|
28651
28661
|
installation: updateInstallationSchema.nullable(),
|
|
@@ -28664,6 +28674,80 @@ var updateStatusResultSchema = external_exports.strictObject({
|
|
|
28664
28674
|
status: updateStatusSchema.nullable()
|
|
28665
28675
|
});
|
|
28666
28676
|
|
|
28677
|
+
// ../../shared-contracts/dist/remote-runtime.js
|
|
28678
|
+
var remoteUpdatePhaseSchema = external_exports.enum([
|
|
28679
|
+
"idle",
|
|
28680
|
+
"installing",
|
|
28681
|
+
"restarting",
|
|
28682
|
+
"succeeded",
|
|
28683
|
+
"failed"
|
|
28684
|
+
]);
|
|
28685
|
+
var runtimeStatusSchema = external_exports.object({
|
|
28686
|
+
runningVersion: external_exports.string().nullable(),
|
|
28687
|
+
installedVersion: external_exports.string().nullable(),
|
|
28688
|
+
restartRequired: external_exports.boolean(),
|
|
28689
|
+
remote: external_exports.boolean(),
|
|
28690
|
+
updateSupported: external_exports.boolean(),
|
|
28691
|
+
update: external_exports.object({
|
|
28692
|
+
phase: remoteUpdatePhaseSchema,
|
|
28693
|
+
targetVersion: external_exports.string().nullable(),
|
|
28694
|
+
error: external_exports.string().nullable()
|
|
28695
|
+
})
|
|
28696
|
+
});
|
|
28697
|
+
var remoteUpdateParamsSchema = external_exports.object({
|
|
28698
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)
|
|
28699
|
+
}).strict();
|
|
28700
|
+
var remoteSshSetupParamsSchema = external_exports.object({
|
|
28701
|
+
hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
|
|
28702
|
+
port: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28703
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28704
|
+
action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
|
|
28705
|
+
uninstallPackage: external_exports.boolean().optional(),
|
|
28706
|
+
version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
|
|
28707
|
+
}).strict();
|
|
28708
|
+
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
28709
|
+
|
|
28710
|
+
// ../../shared-contracts/dist/remote-connections.js
|
|
28711
|
+
var hostId = external_exports.string().min(1).max(1024);
|
|
28712
|
+
var codexSshConnectionSchema = external_exports.object({
|
|
28713
|
+
hostId,
|
|
28714
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28715
|
+
source: external_exports.enum(["codex-managed", "discovered"]),
|
|
28716
|
+
sshAlias: external_exports.string().max(1024).nullable(),
|
|
28717
|
+
sshHost: external_exports.string().min(1).max(1024),
|
|
28718
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28719
|
+
identity: external_exports.string().max(4096).nullable(),
|
|
28720
|
+
autoConnect: external_exports.boolean(),
|
|
28721
|
+
connectionAnalyticsId: external_exports.string().max(1024).optional()
|
|
28722
|
+
});
|
|
28723
|
+
var codexSshDraftSchema = external_exports.strictObject({
|
|
28724
|
+
displayName: external_exports.string().min(1).max(1024),
|
|
28725
|
+
hostname: external_exports.string().min(1).max(1024),
|
|
28726
|
+
sshPort: external_exports.number().int().min(1).max(65535).nullable(),
|
|
28727
|
+
identity: external_exports.string().max(4096).nullable()
|
|
28728
|
+
});
|
|
28729
|
+
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
28730
|
+
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
28731
|
+
external_exports.strictObject({
|
|
28732
|
+
action: external_exports.literal("save"),
|
|
28733
|
+
draft: codexSshDraftSchema,
|
|
28734
|
+
previous: codexSshConnectionSchema.nullable()
|
|
28735
|
+
}),
|
|
28736
|
+
external_exports.strictObject({ action: external_exports.literal("remove"), previous: codexSshConnectionSchema }),
|
|
28737
|
+
external_exports.strictObject({ action: external_exports.literal("connect"), hostId, enabled: external_exports.boolean() }),
|
|
28738
|
+
external_exports.strictObject({ action: external_exports.literal("state"), hostId }),
|
|
28739
|
+
external_exports.strictObject({ action: external_exports.literal("runtime"), hostId }),
|
|
28740
|
+
external_exports.strictObject({
|
|
28741
|
+
action: external_exports.literal("update"),
|
|
28742
|
+
hostId: hostId.refine((id) => id !== "local"),
|
|
28743
|
+
version: remoteUpdateParamsSchema.shape.version
|
|
28744
|
+
})
|
|
28745
|
+
]);
|
|
28746
|
+
var remoteConnectionsReplySchema = external_exports.union([
|
|
28747
|
+
external_exports.strictObject({ result: jsonValueSchema }),
|
|
28748
|
+
external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
|
|
28749
|
+
]);
|
|
28750
|
+
|
|
28667
28751
|
// ../../shared-contracts/dist/index.js
|
|
28668
28752
|
var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
|
|
28669
28753
|
|
|
@@ -29026,11 +29110,13 @@ function cursorDiscoverySpec(skipPinnedVersions) {
|
|
|
29026
29110
|
} : {}
|
|
29027
29111
|
};
|
|
29028
29112
|
}
|
|
29113
|
+
var CursorNotInstalledError = class extends Error {
|
|
29114
|
+
};
|
|
29029
29115
|
function resolveCursorExecutable(environment, command) {
|
|
29030
29116
|
const input = { environment, ...command ? { command } : {} };
|
|
29031
29117
|
const pinned = resolveHarnessExecutable(cursorDiscoverySpec(false), input);
|
|
29032
29118
|
if (!pinned)
|
|
29033
|
-
throw new
|
|
29119
|
+
throw new CursorNotInstalledError("Cursor CLI is not installed; install cursor-agent or set CODEXHOST_CURSOR_COMMAND");
|
|
29034
29120
|
const explicit = command?.trim() || environment.CODEXHOST_CURSOR_COMMAND?.trim();
|
|
29035
29121
|
if (explicit || !PINNED_VERSION_AGENT.test(pinned.executable))
|
|
29036
29122
|
return pinned;
|
|
@@ -29174,6 +29260,99 @@ async function fetchCursorAccount(input = {}) {
|
|
|
29174
29260
|
import { lstat, opendir, readFile as readFile2, realpath, stat } from "node:fs/promises";
|
|
29175
29261
|
import path7 from "node:path";
|
|
29176
29262
|
|
|
29263
|
+
// ../../harness-adapter/dist/session-import.js
|
|
29264
|
+
var SessionImportChangedError = class extends Error {
|
|
29265
|
+
constructor(message = "Native Session changed during discovery; refresh and retry") {
|
|
29266
|
+
super(message);
|
|
29267
|
+
this.name = "SessionImportChangedError";
|
|
29268
|
+
}
|
|
29269
|
+
};
|
|
29270
|
+
function isMissingFileError(error51) {
|
|
29271
|
+
return typeof error51 === "object" && error51 !== null && "code" in error51 && error51.code === "ENOENT";
|
|
29272
|
+
}
|
|
29273
|
+
function sameFileFingerprint(left, right) {
|
|
29274
|
+
return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
29275
|
+
}
|
|
29276
|
+
function sessionImportTitle(value, maxLength = HARNESS_SESSION_IMPORT_TITLE_MAX_LENGTH) {
|
|
29277
|
+
if (typeof value !== "string")
|
|
29278
|
+
return null;
|
|
29279
|
+
const normalized = value.replaceAll("\0", "").replaceAll(/\s+/gu, " ").trim();
|
|
29280
|
+
if (!normalized)
|
|
29281
|
+
return null;
|
|
29282
|
+
if (normalized.length <= maxLength)
|
|
29283
|
+
return normalized;
|
|
29284
|
+
const characters = [...normalized];
|
|
29285
|
+
if (characters.length <= maxLength)
|
|
29286
|
+
return normalized;
|
|
29287
|
+
return `${characters.slice(0, maxLength - 1).join("").trimEnd()}…`;
|
|
29288
|
+
}
|
|
29289
|
+
function sessionImportCandidate(input) {
|
|
29290
|
+
const time3 = typeof input.updatedAt === "number" ? input.updatedAt : typeof input.updatedAt === "string" ? Date.parse(input.updatedAt) : Number.NaN;
|
|
29291
|
+
const parsed = harnessSessionImportCandidateSchema.safeParse({
|
|
29292
|
+
nativeSessionId: input.nativeSessionId,
|
|
29293
|
+
cwd: input.cwd,
|
|
29294
|
+
title: typeof input.title === "string" && input.title.trim().length > 0 ? input.title : null,
|
|
29295
|
+
updatedAt: Math.floor(time3),
|
|
29296
|
+
// Unknown must stay unknown; only an explicit boolean is a native statement.
|
|
29297
|
+
running: typeof input.running === "boolean" ? input.running : null
|
|
29298
|
+
});
|
|
29299
|
+
return parsed.success ? parsed.data : null;
|
|
29300
|
+
}
|
|
29301
|
+
var SessionImportScope = class {
|
|
29302
|
+
#abort = new AbortController();
|
|
29303
|
+
#options;
|
|
29304
|
+
#pending = /* @__PURE__ */ new Set();
|
|
29305
|
+
constructor(options) {
|
|
29306
|
+
this.#options = options;
|
|
29307
|
+
}
|
|
29308
|
+
#closed() {
|
|
29309
|
+
return {
|
|
29310
|
+
ok: false,
|
|
29311
|
+
error: { code: "invalidState", message: this.#options.closedMessage, retryable: false }
|
|
29312
|
+
};
|
|
29313
|
+
}
|
|
29314
|
+
read(operation) {
|
|
29315
|
+
const signal = this.#abort.signal;
|
|
29316
|
+
if (signal.aborted)
|
|
29317
|
+
return Promise.resolve(this.#closed());
|
|
29318
|
+
let started;
|
|
29319
|
+
try {
|
|
29320
|
+
started = operation(signal);
|
|
29321
|
+
} catch (error51) {
|
|
29322
|
+
started = Promise.reject(error51 instanceof Error ? error51 : new Error("Session read failed"));
|
|
29323
|
+
}
|
|
29324
|
+
const request = started.then((value) => signal.aborted ? this.#closed() : { ok: true, value }).catch(() => signal.aborted ? this.#closed() : {
|
|
29325
|
+
ok: false,
|
|
29326
|
+
error: {
|
|
29327
|
+
code: "unavailable",
|
|
29328
|
+
message: this.#options.unavailableMessage,
|
|
29329
|
+
retryable: true
|
|
29330
|
+
}
|
|
29331
|
+
}).finally(() => this.#pending.delete(request));
|
|
29332
|
+
this.#pending.add(request);
|
|
29333
|
+
return request;
|
|
29334
|
+
}
|
|
29335
|
+
/** `read` for `resolveCandidate`: a null source is the selected Session having disappeared. */
|
|
29336
|
+
async resolve(operation) {
|
|
29337
|
+
const result = await this.read(operation);
|
|
29338
|
+
if (!result.ok)
|
|
29339
|
+
return result;
|
|
29340
|
+
return result.value ? { ok: true, value: result.value } : {
|
|
29341
|
+
ok: false,
|
|
29342
|
+
error: {
|
|
29343
|
+
code: "sessionNotFound",
|
|
29344
|
+
message: this.#options.notFoundMessage,
|
|
29345
|
+
retryable: false
|
|
29346
|
+
}
|
|
29347
|
+
};
|
|
29348
|
+
}
|
|
29349
|
+
/** Idempotent. Resolves after every started read has settled. */
|
|
29350
|
+
async close() {
|
|
29351
|
+
this.#abort.abort();
|
|
29352
|
+
await Promise.allSettled(this.#pending);
|
|
29353
|
+
}
|
|
29354
|
+
};
|
|
29355
|
+
|
|
29177
29356
|
// dist/native-history.js
|
|
29178
29357
|
import { existsSync as existsSync2, readFileSync, realpathSync } from "node:fs";
|
|
29179
29358
|
import os2 from "node:os";
|
|
@@ -29319,8 +29498,6 @@ function cursorExecutionPolicy(ref) {
|
|
|
29319
29498
|
// dist/session-import.js
|
|
29320
29499
|
var SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
29321
29500
|
var MAX_METADATA_BYTES = 1024 * 1024;
|
|
29322
|
-
var CursorSessionChangedError = class extends Error {
|
|
29323
|
-
};
|
|
29324
29501
|
function errorCode(error51) {
|
|
29325
29502
|
return typeof error51 === "object" && error51 !== null && "code" in error51 && typeof error51.code === "string" ? error51.code : void 0;
|
|
29326
29503
|
}
|
|
@@ -29328,23 +29505,23 @@ async function optionalStat(file2) {
|
|
|
29328
29505
|
try {
|
|
29329
29506
|
return await lstat(file2);
|
|
29330
29507
|
} catch (error51) {
|
|
29331
|
-
if (
|
|
29508
|
+
if (isMissingFileError(error51))
|
|
29332
29509
|
return null;
|
|
29333
29510
|
throw error51;
|
|
29334
29511
|
}
|
|
29335
29512
|
}
|
|
29336
|
-
function sameFile(left, right) {
|
|
29337
|
-
return left === null || right === null ? left === right : left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
|
|
29338
|
-
}
|
|
29339
29513
|
var CursorSessionImport = class {
|
|
29340
29514
|
#environment;
|
|
29341
|
-
#
|
|
29342
|
-
|
|
29515
|
+
#scope = new SessionImportScope({
|
|
29516
|
+
closedMessage: "Cursor Session import is closed",
|
|
29517
|
+
unavailableMessage: "Cursor ACP sessions could not be read; close native clients, check storage access and retry",
|
|
29518
|
+
notFoundMessage: "Cursor ACP Session is no longer importable"
|
|
29519
|
+
});
|
|
29343
29520
|
constructor(environment) {
|
|
29344
29521
|
this.#environment = { ...environment };
|
|
29345
29522
|
}
|
|
29346
29523
|
listCandidates() {
|
|
29347
|
-
return this.#read(async (signal) => {
|
|
29524
|
+
return this.#scope.read(async (signal) => {
|
|
29348
29525
|
const root = path7.join(cursorConfigDirectory(this.#environment), "acp-sessions");
|
|
29349
29526
|
const info = await optionalStat(root);
|
|
29350
29527
|
if (!info)
|
|
@@ -29362,7 +29539,7 @@ var CursorSessionImport = class {
|
|
|
29362
29539
|
if (candidate)
|
|
29363
29540
|
candidates.push(candidate);
|
|
29364
29541
|
} catch (error51) {
|
|
29365
|
-
if (!(error51 instanceof
|
|
29542
|
+
if (!(error51 instanceof SessionImportChangedError))
|
|
29366
29543
|
throw error51;
|
|
29367
29544
|
}
|
|
29368
29545
|
}
|
|
@@ -29379,27 +29556,15 @@ var CursorSessionImport = class {
|
|
|
29379
29556
|
retryable: false
|
|
29380
29557
|
}
|
|
29381
29558
|
};
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
return
|
|
29385
|
-
|
|
29386
|
-
return {
|
|
29387
|
-
ok: false,
|
|
29388
|
-
error: {
|
|
29389
|
-
code: "sessionNotFound",
|
|
29390
|
-
message: "Cursor ACP Session is no longer importable",
|
|
29391
|
-
retryable: false
|
|
29392
|
-
}
|
|
29393
|
-
};
|
|
29394
|
-
return {
|
|
29395
|
-
ok: true,
|
|
29396
|
-
value: {
|
|
29397
|
-
candidate: result.value,
|
|
29559
|
+
return this.#scope.resolve(async (signal) => {
|
|
29560
|
+
const candidate = await this.#candidate(nativeSessionId, signal);
|
|
29561
|
+
return candidate ? {
|
|
29562
|
+
candidate,
|
|
29398
29563
|
// Native ACP stores do not attest to --force. Imported sessions must not
|
|
29399
29564
|
// acquire unattended privileges from UI defaults or a guessed locator.
|
|
29400
29565
|
nativeRef: cursorNativeSessionRef(nativeSessionId, "default")
|
|
29401
|
-
}
|
|
29402
|
-
};
|
|
29566
|
+
} : null;
|
|
29567
|
+
});
|
|
29403
29568
|
}
|
|
29404
29569
|
async #candidate(id, signal) {
|
|
29405
29570
|
signal.throwIfAborted();
|
|
@@ -29430,7 +29595,7 @@ var CursorSessionImport = class {
|
|
|
29430
29595
|
const turns = readCursorNativeTurns(id, cwd, this.#environment);
|
|
29431
29596
|
if (!turns.length)
|
|
29432
29597
|
return null;
|
|
29433
|
-
title = turns[0]?.text
|
|
29598
|
+
title = sessionImportTitle(turns[0]?.text);
|
|
29434
29599
|
} catch (error51) {
|
|
29435
29600
|
signal.throwIfAborted();
|
|
29436
29601
|
if (["EACCES", "EPERM", "EIO", "EMFILE", "ENFILE"].includes(errorCode(error51) ?? ""))
|
|
@@ -29439,46 +29604,17 @@ var CursorSessionImport = class {
|
|
|
29439
29604
|
}
|
|
29440
29605
|
signal.throwIfAborted();
|
|
29441
29606
|
const after = await Promise.all(files.map(optionalStat));
|
|
29442
|
-
if (before.some((info, index) => !
|
|
29443
|
-
throw new
|
|
29444
|
-
|
|
29607
|
+
if (before.some((info, index) => !sameFileFingerprint(info, after[index] ?? null)))
|
|
29608
|
+
throw new SessionImportChangedError("Cursor Session changed during discovery");
|
|
29609
|
+
return sessionImportCandidate({
|
|
29445
29610
|
nativeSessionId: id,
|
|
29446
29611
|
cwd,
|
|
29447
29612
|
title,
|
|
29448
|
-
updatedAt: Math.
|
|
29449
|
-
// A stable read does not establish that another Cursor process is idle.
|
|
29450
|
-
running: null
|
|
29613
|
+
updatedAt: Math.max(database.mtimeMs, wal?.mtimeMs ?? 0)
|
|
29451
29614
|
});
|
|
29452
|
-
return parsed.success ? parsed.data : null;
|
|
29453
29615
|
}
|
|
29454
|
-
|
|
29455
|
-
|
|
29456
|
-
if (signal.aborted)
|
|
29457
|
-
return Promise.resolve({
|
|
29458
|
-
ok: false,
|
|
29459
|
-
error: {
|
|
29460
|
-
code: "invalidState",
|
|
29461
|
-
message: "Cursor Session import is closed",
|
|
29462
|
-
retryable: false
|
|
29463
|
-
}
|
|
29464
|
-
});
|
|
29465
|
-
const request = operation(signal).then((value) => {
|
|
29466
|
-
signal.throwIfAborted();
|
|
29467
|
-
return { ok: true, value };
|
|
29468
|
-
}).catch(() => ({
|
|
29469
|
-
ok: false,
|
|
29470
|
-
error: {
|
|
29471
|
-
code: signal.aborted ? "invalidState" : "unavailable",
|
|
29472
|
-
message: signal.aborted ? "Cursor Session import is closed" : "Cursor ACP sessions could not be read; close native clients, check storage access and retry",
|
|
29473
|
-
retryable: !signal.aborted
|
|
29474
|
-
}
|
|
29475
|
-
})).finally(() => this.#pending.delete(request));
|
|
29476
|
-
this.#pending.add(request);
|
|
29477
|
-
return request;
|
|
29478
|
-
}
|
|
29479
|
-
async close() {
|
|
29480
|
-
this.#abort.abort();
|
|
29481
|
-
await Promise.allSettled(this.#pending);
|
|
29616
|
+
close() {
|
|
29617
|
+
return this.#scope.close();
|
|
29482
29618
|
}
|
|
29483
29619
|
};
|
|
29484
29620
|
|
|
@@ -47527,6 +47663,7 @@ var CursorSession = class {
|
|
|
47527
47663
|
};
|
|
47528
47664
|
|
|
47529
47665
|
// ../../harness-broker/dist/client.js
|
|
47666
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
47530
47667
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
47531
47668
|
import { lstat as lstat2, readFile as readFile4 } from "node:fs/promises";
|
|
47532
47669
|
import net, {} from "node:net";
|
|
@@ -47537,9 +47674,12 @@ var HARNESS_BROKER_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
|
47537
47674
|
var HARNESS_BROKER_MAX_PENDING_REQUESTS = 32;
|
|
47538
47675
|
var HARNESS_BROKER_REQUEST_TIMEOUT_MS = 15e3;
|
|
47539
47676
|
var HARNESS_BROKER_SESSION_IMPORT_PAGE_SIZE = 100;
|
|
47677
|
+
var HARNESS_BROKER_IDLE_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
47678
|
+
var HARNESS_BROKER_RETIRING_ERROR_CODE = "brokerRetiring";
|
|
47540
47679
|
var harnessBrokerMethodSchema = external_exports.enum([
|
|
47541
47680
|
"adapter.inspect",
|
|
47542
47681
|
"adapter.inspectAccount",
|
|
47682
|
+
"adapter.credits",
|
|
47543
47683
|
"adapter.open",
|
|
47544
47684
|
"adapter.sessionImport.list",
|
|
47545
47685
|
"adapter.sessionImport.resolve",
|
|
@@ -47659,6 +47799,14 @@ function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId
|
|
|
47659
47799
|
return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
|
|
47660
47800
|
return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
|
|
47661
47801
|
}
|
|
47802
|
+
function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
|
|
47803
|
+
harnessPluginIdSchema.parse(harnessId);
|
|
47804
|
+
return harnessId === "claude-code" ? "ai.bytepioneer.codexhost.native-harness-broker" : `ai.bytepioneer.codexhost.${harnessId}-broker`;
|
|
47805
|
+
}
|
|
47806
|
+
function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
|
|
47807
|
+
const home = environment.HOME || os4.homedir();
|
|
47808
|
+
return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
|
|
47809
|
+
}
|
|
47662
47810
|
|
|
47663
47811
|
// ../../harness-broker/dist/validation.js
|
|
47664
47812
|
var cwdSchema = external_exports.string().min(1).max(16384);
|
|
@@ -47985,10 +48133,55 @@ async function readDescriptor(descriptorPath) {
|
|
|
47985
48133
|
try {
|
|
47986
48134
|
process.kill(descriptor.ownerPid, 0);
|
|
47987
48135
|
} catch {
|
|
47988
|
-
throw new
|
|
48136
|
+
throw new BrokerNotRunningError("its owner process has exited");
|
|
47989
48137
|
}
|
|
47990
48138
|
return descriptor;
|
|
47991
48139
|
}
|
|
48140
|
+
var BrokerNotRunningError = class extends Error {
|
|
48141
|
+
};
|
|
48142
|
+
var BrokerRetiringError = class extends Error {
|
|
48143
|
+
};
|
|
48144
|
+
var BrokerRequestNotDeliveredError = class extends Error {
|
|
48145
|
+
};
|
|
48146
|
+
var HarnessNotInstalledError = class extends Error {
|
|
48147
|
+
};
|
|
48148
|
+
var BROKER_NOT_RUNNING_CODES = /* @__PURE__ */ new Set(["ENOENT", "ECONNREFUSED"]);
|
|
48149
|
+
var BROKER_START_TIMEOUT_MS = 15e3;
|
|
48150
|
+
var BROKER_START_POLL_MS = 250;
|
|
48151
|
+
function classifyConnectFailure(error51) {
|
|
48152
|
+
if (error51 instanceof BrokerNotRunningError)
|
|
48153
|
+
return error51;
|
|
48154
|
+
const code = error51?.code;
|
|
48155
|
+
if (code && BROKER_NOT_RUNNING_CODES.has(code)) {
|
|
48156
|
+
return new BrokerNotRunningError(code === "ENOENT" ? "its descriptor or socket is missing" : "its socket refused the connection");
|
|
48157
|
+
}
|
|
48158
|
+
return error51 instanceof Error ? error51 : new Error(String(error51));
|
|
48159
|
+
}
|
|
48160
|
+
function describeBrokerFailure(error51, harnessId) {
|
|
48161
|
+
if (error51 instanceof BrokerNotRunningError) {
|
|
48162
|
+
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}`;
|
|
48163
|
+
}
|
|
48164
|
+
return error51 instanceof Error ? error51.message : String(error51);
|
|
48165
|
+
}
|
|
48166
|
+
function runLaunchctl(arguments_) {
|
|
48167
|
+
return new Promise((resolve) => {
|
|
48168
|
+
execFile4("/bin/launchctl", arguments_, { timeout: 1e4 }, (error51) => resolve(!error51));
|
|
48169
|
+
});
|
|
48170
|
+
}
|
|
48171
|
+
async function startBrokerLaunchAgent(harnessId, environment) {
|
|
48172
|
+
const uid = process.getuid?.();
|
|
48173
|
+
if (uid === void 0)
|
|
48174
|
+
return;
|
|
48175
|
+
const target = `gui/${uid}/${harnessBrokerLaunchAgentLabel(harnessId)}`;
|
|
48176
|
+
if (await runLaunchctl(["kickstart", target]))
|
|
48177
|
+
return;
|
|
48178
|
+
await runLaunchctl([
|
|
48179
|
+
"bootstrap",
|
|
48180
|
+
`gui/${uid}`,
|
|
48181
|
+
harnessBrokerLaunchAgentPlistPath(environment, harnessId)
|
|
48182
|
+
]);
|
|
48183
|
+
await runLaunchctl(["kickstart", target]);
|
|
48184
|
+
}
|
|
47992
48185
|
var BrokerConnection = class _BrokerConnection {
|
|
47993
48186
|
#onClose;
|
|
47994
48187
|
onClose(callback) {
|
|
@@ -48012,21 +48205,31 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48012
48205
|
socket.once("error", (error51) => this.#fail(error51));
|
|
48013
48206
|
}
|
|
48014
48207
|
static async connect(descriptorPath, harnessId) {
|
|
48015
|
-
|
|
48016
|
-
|
|
48017
|
-
|
|
48018
|
-
|
|
48019
|
-
|
|
48020
|
-
|
|
48021
|
-
|
|
48022
|
-
|
|
48023
|
-
|
|
48024
|
-
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
|
|
48208
|
+
let descriptor;
|
|
48209
|
+
let socket;
|
|
48210
|
+
let connecting;
|
|
48211
|
+
try {
|
|
48212
|
+
descriptor = await readDescriptor(descriptorPath);
|
|
48213
|
+
if (descriptor.harnessId !== harnessId)
|
|
48214
|
+
throw new Error("Aqua broker belongs to another Harness");
|
|
48215
|
+
connecting = net.createConnection(descriptor.socketPath);
|
|
48216
|
+
const pending = connecting;
|
|
48217
|
+
await new Promise((resolve, reject) => {
|
|
48218
|
+
const timeout = setTimeout(() => reject(new Error("Timed out connecting to Aqua Harness broker")), HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
48219
|
+
pending.once("connect", () => {
|
|
48220
|
+
clearTimeout(timeout);
|
|
48221
|
+
resolve();
|
|
48222
|
+
});
|
|
48223
|
+
pending.once("error", (error51) => {
|
|
48224
|
+
clearTimeout(timeout);
|
|
48225
|
+
reject(error51);
|
|
48226
|
+
});
|
|
48028
48227
|
});
|
|
48029
|
-
|
|
48228
|
+
socket = pending;
|
|
48229
|
+
} catch (error51) {
|
|
48230
|
+
connecting?.destroy();
|
|
48231
|
+
throw classifyConnectFailure(error51);
|
|
48232
|
+
}
|
|
48030
48233
|
const connection = new _BrokerConnection(descriptor, socket);
|
|
48031
48234
|
const hello = connection.#waitForHello();
|
|
48032
48235
|
await writeBrokerFrame(socket, {
|
|
@@ -48079,15 +48282,24 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48079
48282
|
}, HARNESS_BROKER_REQUEST_TIMEOUT_MS);
|
|
48080
48283
|
this.#pending.set(id, { resolve, reject, timeout });
|
|
48081
48284
|
});
|
|
48082
|
-
|
|
48083
|
-
|
|
48084
|
-
|
|
48085
|
-
|
|
48086
|
-
|
|
48087
|
-
|
|
48088
|
-
|
|
48089
|
-
|
|
48090
|
-
|
|
48285
|
+
try {
|
|
48286
|
+
await writeBrokerFrame(this.#socket, {
|
|
48287
|
+
version: HARNESS_BROKER_PROTOCOL_VERSION,
|
|
48288
|
+
generation: this.#descriptor.generation,
|
|
48289
|
+
sequence: this.#inputSequence,
|
|
48290
|
+
kind: "request",
|
|
48291
|
+
id,
|
|
48292
|
+
method,
|
|
48293
|
+
params
|
|
48294
|
+
});
|
|
48295
|
+
} catch (error51) {
|
|
48296
|
+
const pending = this.#pending.get(id);
|
|
48297
|
+
if (pending)
|
|
48298
|
+
clearTimeout(pending.timeout);
|
|
48299
|
+
this.#pending.delete(id);
|
|
48300
|
+
response.catch(() => void 0);
|
|
48301
|
+
throw new BrokerRequestNotDeliveredError(error51 instanceof Error ? error51.message : String(error51));
|
|
48302
|
+
}
|
|
48091
48303
|
return response;
|
|
48092
48304
|
}
|
|
48093
48305
|
close() {
|
|
@@ -48131,6 +48343,8 @@ var BrokerConnection = class _BrokerConnection {
|
|
|
48131
48343
|
this.#pending.delete(frame.id);
|
|
48132
48344
|
if (frame.ok)
|
|
48133
48345
|
pending.resolve(frame.value);
|
|
48346
|
+
else if (frame.error?.code === HARNESS_BROKER_RETIRING_ERROR_CODE)
|
|
48347
|
+
pending.reject(new BrokerRetiringError(frame.error.message));
|
|
48134
48348
|
else
|
|
48135
48349
|
pending.reject(new Error(frame.error?.message ?? "Broker request failed"));
|
|
48136
48350
|
}
|
|
@@ -48356,18 +48570,20 @@ var BrokeredHarnessAdapter = class {
|
|
|
48356
48570
|
harnessId;
|
|
48357
48571
|
#descriptorPath;
|
|
48358
48572
|
#forwardEnvironment;
|
|
48573
|
+
#isInstalled;
|
|
48574
|
+
#startBroker;
|
|
48575
|
+
#startTimeoutMs;
|
|
48359
48576
|
#connection = null;
|
|
48360
48577
|
#closed = false;
|
|
48361
48578
|
#sessionImportListing = null;
|
|
48579
|
+
#credits = null;
|
|
48580
|
+
#creditsRefresh = null;
|
|
48362
48581
|
subagents = {
|
|
48363
48582
|
readSnapshot: async (input) => {
|
|
48364
48583
|
try {
|
|
48365
|
-
return parseHarnessResult(await
|
|
48584
|
+
return parseHarnessResult(await this.#request("adapter.subagent.readSnapshot", input));
|
|
48366
48585
|
} catch (error51) {
|
|
48367
|
-
return {
|
|
48368
|
-
ok: false,
|
|
48369
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
48370
|
-
};
|
|
48586
|
+
return { ok: false, error: this.#error(error51) };
|
|
48371
48587
|
}
|
|
48372
48588
|
}
|
|
48373
48589
|
};
|
|
@@ -48457,12 +48673,39 @@ var BrokeredHarnessAdapter = class {
|
|
|
48457
48673
|
if (input.liveCommandCatalog)
|
|
48458
48674
|
this.liveCommandCatalog = true;
|
|
48459
48675
|
this.#descriptorPath = input.descriptorPath ?? defaultHarnessBrokerDescriptorPath(input.environment, this.harnessId);
|
|
48676
|
+
this.#isInstalled = input.isInstalled;
|
|
48677
|
+
const environment = input.environment ?? process.env;
|
|
48678
|
+
this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
|
|
48679
|
+
this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
|
|
48680
|
+
}
|
|
48681
|
+
credits() {
|
|
48682
|
+
return this.#credits;
|
|
48683
|
+
}
|
|
48684
|
+
refreshCredits() {
|
|
48685
|
+
if (this.#closed)
|
|
48686
|
+
return Promise.resolve(null);
|
|
48687
|
+
if (this.#creditsRefresh)
|
|
48688
|
+
return this.#creditsRefresh;
|
|
48689
|
+
this.#creditsRefresh = this.#readCredits().finally(() => {
|
|
48690
|
+
this.#creditsRefresh = null;
|
|
48691
|
+
});
|
|
48692
|
+
return this.#creditsRefresh;
|
|
48693
|
+
}
|
|
48694
|
+
async #readCredits() {
|
|
48695
|
+
try {
|
|
48696
|
+
const value = await this.#request("adapter.credits", {}, true);
|
|
48697
|
+
const credits = accountCreditsSnapshotSchema.nullable().parse(value);
|
|
48698
|
+
if (!this.#closed)
|
|
48699
|
+
this.#credits = credits;
|
|
48700
|
+
} catch {
|
|
48701
|
+
}
|
|
48702
|
+
return this.#credits;
|
|
48460
48703
|
}
|
|
48461
48704
|
async inspectAccount() {
|
|
48462
48705
|
if (this.#closed)
|
|
48463
48706
|
return null;
|
|
48464
48707
|
try {
|
|
48465
|
-
const value = await
|
|
48708
|
+
const value = await this.#request("adapter.inspectAccount", {}, true);
|
|
48466
48709
|
return harnessAccountSnapshotSchema.nullable().parse(value);
|
|
48467
48710
|
} catch {
|
|
48468
48711
|
return null;
|
|
@@ -48472,33 +48715,46 @@ var BrokeredHarnessAdapter = class {
|
|
|
48472
48715
|
if (this.#closed)
|
|
48473
48716
|
return failedInspection("Aqua Harness broker adapter is closed");
|
|
48474
48717
|
try {
|
|
48475
|
-
return harnessInspectionSchema.parse(await
|
|
48718
|
+
return harnessInspectionSchema.parse(await this.#request("adapter.inspect", input, true));
|
|
48476
48719
|
} catch (error51) {
|
|
48477
48720
|
this.#connection = null;
|
|
48478
|
-
|
|
48721
|
+
if (error51 instanceof HarnessNotInstalledError)
|
|
48722
|
+
return { status: "notInstalled", error: this.#error(error51) };
|
|
48723
|
+
return failedInspection(describeBrokerFailure(error51, this.harnessId));
|
|
48479
48724
|
}
|
|
48480
48725
|
}
|
|
48481
48726
|
async open(input) {
|
|
48482
48727
|
if (this.#closed)
|
|
48483
48728
|
return { ok: false, error: unavailable("Aqua Harness broker adapter is closed", false) };
|
|
48729
|
+
const safeInput = { ...input };
|
|
48730
|
+
delete safeInput.environment;
|
|
48731
|
+
if (this.#forwardEnvironment && input.environment) {
|
|
48732
|
+
const allowed = [
|
|
48733
|
+
"CODEXHOST_CLI_PATH",
|
|
48734
|
+
"CODEXHOST_CLI_NODE_PATH",
|
|
48735
|
+
"CODEXHOST_RUNTIME_ENDPOINT",
|
|
48736
|
+
"CODEXHOST_RUNTIME_TOKEN",
|
|
48737
|
+
"CODEXHOST_THREAD_ID"
|
|
48738
|
+
];
|
|
48739
|
+
const environment = Object.fromEntries(Object.entries(input.environment).filter(([key, value]) => allowed.includes(key) && value !== void 0));
|
|
48740
|
+
if (Object.keys(environment).length)
|
|
48741
|
+
safeInput.environment = environment;
|
|
48742
|
+
}
|
|
48484
48743
|
let connection;
|
|
48485
48744
|
try {
|
|
48486
|
-
|
|
48487
|
-
|
|
48488
|
-
|
|
48489
|
-
|
|
48490
|
-
"
|
|
48491
|
-
|
|
48492
|
-
|
|
48493
|
-
|
|
48494
|
-
|
|
48495
|
-
|
|
48496
|
-
|
|
48497
|
-
|
|
48498
|
-
|
|
48499
|
-
}
|
|
48500
|
-
connection = await this.#connect();
|
|
48501
|
-
const result = parseHarnessResult(await connection.request("adapter.open", safeInput));
|
|
48745
|
+
let value;
|
|
48746
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
48747
|
+
connection = await this.#connect();
|
|
48748
|
+
try {
|
|
48749
|
+
value = await connection.request("adapter.open", safeInput);
|
|
48750
|
+
break;
|
|
48751
|
+
} catch (error51) {
|
|
48752
|
+
if (attempt > 0 || !(error51 instanceof BrokerRetiringError || error51 instanceof BrokerRequestNotDeliveredError))
|
|
48753
|
+
throw error51;
|
|
48754
|
+
this.#connection = null;
|
|
48755
|
+
}
|
|
48756
|
+
}
|
|
48757
|
+
const result = parseHarnessResult(value);
|
|
48502
48758
|
if (!result.ok)
|
|
48503
48759
|
return result;
|
|
48504
48760
|
const session = new BrokeredHarnessSession(connection, parseSessionMetadata(result.value), this.harnessId, safeInput, () => this.#connect(), () => {
|
|
@@ -48509,25 +48765,51 @@ var BrokeredHarnessAdapter = class {
|
|
|
48509
48765
|
} catch (error51) {
|
|
48510
48766
|
connection?.close();
|
|
48511
48767
|
this.#connection = null;
|
|
48512
|
-
return {
|
|
48513
|
-
ok: false,
|
|
48514
|
-
error: unavailable(error51 instanceof Error ? error51.message : String(error51))
|
|
48515
|
-
};
|
|
48768
|
+
return { ok: false, error: this.#error(error51) };
|
|
48516
48769
|
}
|
|
48517
48770
|
}
|
|
48518
48771
|
async close() {
|
|
48519
48772
|
this.#closed = true;
|
|
48773
|
+
this.#credits = null;
|
|
48520
48774
|
await Promise.allSettled([...this.#sessions].map((session) => session.close()));
|
|
48521
48775
|
this.#sessions.clear();
|
|
48522
48776
|
const connection = await this.#connection?.catch(() => null);
|
|
48523
48777
|
await connection?.dispose();
|
|
48524
48778
|
this.#connection = null;
|
|
48525
48779
|
}
|
|
48780
|
+
#error(error51) {
|
|
48781
|
+
if (error51 instanceof HarnessNotInstalledError)
|
|
48782
|
+
return {
|
|
48783
|
+
code: "notInstalled",
|
|
48784
|
+
message: error51.message,
|
|
48785
|
+
retryable: false,
|
|
48786
|
+
stage: "harnessBroker"
|
|
48787
|
+
};
|
|
48788
|
+
return unavailable(describeBrokerFailure(error51, this.harnessId));
|
|
48789
|
+
}
|
|
48790
|
+
/**
|
|
48791
|
+
* Sends one adapter-level request. A broker that retired between requests refuses it
|
|
48792
|
+
* unprocessed, so it is retried once on a fresh broker. Idempotent reads also retry
|
|
48793
|
+
* once after a plain disconnect.
|
|
48794
|
+
*/
|
|
48795
|
+
async #request(method, params, idempotent = false) {
|
|
48796
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
48797
|
+
const connection = await this.#connect();
|
|
48798
|
+
try {
|
|
48799
|
+
return await connection.request(method, params);
|
|
48800
|
+
} catch (error51) {
|
|
48801
|
+
const retryable = error51 instanceof BrokerRetiringError || error51 instanceof BrokerRequestNotDeliveredError || idempotent && connection.closed;
|
|
48802
|
+
if (attempt > 0 || !retryable)
|
|
48803
|
+
throw error51;
|
|
48804
|
+
this.#connection = null;
|
|
48805
|
+
}
|
|
48806
|
+
}
|
|
48807
|
+
}
|
|
48526
48808
|
#connect() {
|
|
48527
48809
|
if (this.#closed)
|
|
48528
48810
|
return Promise.reject(new Error("Aqua Harness broker adapter is closed"));
|
|
48529
48811
|
if (!this.#connection) {
|
|
48530
|
-
const pending =
|
|
48812
|
+
const pending = this.#establish().then((connection) => {
|
|
48531
48813
|
connection.onClose(() => {
|
|
48532
48814
|
if (this.#connection === pending)
|
|
48533
48815
|
this.#connection = null;
|
|
@@ -48542,18 +48824,50 @@ var BrokeredHarnessAdapter = class {
|
|
|
48542
48824
|
}
|
|
48543
48825
|
return this.#connection;
|
|
48544
48826
|
}
|
|
48827
|
+
async #establish() {
|
|
48828
|
+
try {
|
|
48829
|
+
return await BrokerConnection.connect(this.#descriptorPath, this.harnessId);
|
|
48830
|
+
} catch (error51) {
|
|
48831
|
+
if (!(error51 instanceof BrokerNotRunningError) || !this.#startBroker)
|
|
48832
|
+
throw error51;
|
|
48833
|
+
}
|
|
48834
|
+
if (this.#isInstalled && !this.#isInstalled()) {
|
|
48835
|
+
throw new HarnessNotInstalledError(`${this.harnessId} is not installed on this Mac`);
|
|
48836
|
+
}
|
|
48837
|
+
const deadline = Date.now() + this.#startTimeoutMs;
|
|
48838
|
+
for (; ; ) {
|
|
48839
|
+
await this.#startBroker();
|
|
48840
|
+
try {
|
|
48841
|
+
return await BrokerConnection.connect(this.#descriptorPath, this.harnessId);
|
|
48842
|
+
} catch (error51) {
|
|
48843
|
+
if (!(error51 instanceof BrokerNotRunningError) || Date.now() >= deadline)
|
|
48844
|
+
throw error51;
|
|
48845
|
+
}
|
|
48846
|
+
await new Promise((resolve) => setTimeout(resolve, BROKER_START_POLL_MS));
|
|
48847
|
+
}
|
|
48848
|
+
}
|
|
48545
48849
|
};
|
|
48546
48850
|
|
|
48547
48851
|
// dist/plugin.js
|
|
48548
48852
|
function createHarnessAdapter(context) {
|
|
48549
|
-
if (context.platform === "darwin" && context.managedRemoteHost)
|
|
48853
|
+
if (context.platform === "darwin" && context.managedRemoteHost) {
|
|
48854
|
+
const environment2 = { ...context.environment };
|
|
48550
48855
|
return new BrokeredHarnessAdapter({
|
|
48551
48856
|
harnessId: "cursor-cli",
|
|
48552
48857
|
forwardDelegationEnvironment: true,
|
|
48553
48858
|
commandCatalog: CURSOR_COMMAND_CATALOG,
|
|
48554
48859
|
liveCommandCatalog: true,
|
|
48555
|
-
environment:
|
|
48860
|
+
environment: environment2,
|
|
48861
|
+
isInstalled: () => {
|
|
48862
|
+
try {
|
|
48863
|
+
resolveCursorExecutable(environment2);
|
|
48864
|
+
return true;
|
|
48865
|
+
} catch (error51) {
|
|
48866
|
+
return !(error51 instanceof CursorNotInstalledError);
|
|
48867
|
+
}
|
|
48868
|
+
}
|
|
48556
48869
|
});
|
|
48870
|
+
}
|
|
48557
48871
|
const environment = { ...context.environment };
|
|
48558
48872
|
return Object.assign(new CursorAdapter({ environment }), {
|
|
48559
48873
|
installation: createCursorInstallation(environment),
|