@codexhost/cli-darwin-arm64 0.16.1 → 0.17.1
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 +2 -2
- package/THIRD_PARTY_NOTICES.txt +6 -2
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +55 -20
- package/app/console-web.js +46 -18
- package/app/desktop-controller.mjs +982 -59
- package/app/host-runtime.mjs +3578 -1900
- package/app/plugins/antigravity/plugin.mjs +62 -9
- package/app/plugins/claude-code/plugin.mjs +12 -6
- package/app/plugins/codebuddy/plugin.mjs +10 -0
- package/app/plugins/cursor-cli/plugin.mjs +28 -8
- package/app/plugins/deepseek-harness/plugin.mjs +459 -46
- package/app/plugins/devin/assets/icon.svg +1 -0
- package/app/plugins/devin/manifest.json +30 -0
- package/app/plugins/devin/plugin.mjs +23363 -0
- package/app/plugins/enabled.json +2 -0
- package/app/plugins/grok/plugin.mjs +472 -391
- package/app/plugins/hermes/plugin.mjs +453 -196
- package/app/plugins/kimi-code/plugin.mjs +50 -3
- package/app/plugins/pi/plugin.mjs +1580 -411
- package/app/plugins/qoder/plugin.mjs +9524 -8654
- package/app/plugins/qoder-cn/plugin.mjs +9524 -8654
- package/app/plugins/qwen-code/assets/icon.svg +1 -0
- package/app/plugins/qwen-code/manifest.json +29 -0
- package/app/plugins/qwen-code/plugin.mjs +29298 -0
- package/app/plugins/workbuddy/plugin.mjs +10 -0
- package/app/plugins/zcode/plugin.mjs +142 -9
- package/app/renderer-extension.js +163 -55
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/licenses/Qwen-Code-SDK-LICENSE.txt +203 -0
- package/package.json +2 -2
|
@@ -19048,6 +19048,16 @@ function snapshotFromHistory(contents, ref, cwd, profile = CODEBUDDY_RUNTIME_PRO
|
|
|
19048
19048
|
continue;
|
|
19049
19049
|
if (supportsNativeCommands && row.type === "message" && row.role === "user" && data.agent === "compact" && !manualCompactions.has(text(row.id)))
|
|
19050
19050
|
continue;
|
|
19051
|
+
if (row.type === "message" && row.role === "user" && data.startsNewUserRequest === false && !localCommand && data.agent !== "compact" && !isNativeCompactionSummary(row)) {
|
|
19052
|
+
const contextOnly = body.trim().length > 0 && body.replace(/<system-reminder\b[^>]*\sdata-role=(["'])user-context\1[^>]*>[\s\S]*?<\/system-reminder>/gu, "").trim().length === 0;
|
|
19053
|
+
if (data.isMeta === true || contextOnly)
|
|
19054
|
+
continue;
|
|
19055
|
+
if (current) {
|
|
19056
|
+
if (body)
|
|
19057
|
+
current.input.push({ type: "text", text: body });
|
|
19058
|
+
continue;
|
|
19059
|
+
}
|
|
19060
|
+
}
|
|
19051
19061
|
if (includeCompactionHistory && isNativeCompactionSummary(row)) {
|
|
19052
19062
|
if (supportsNativeCommands && current) {
|
|
19053
19063
|
const outcome = data.isCompacted === true ? { status: "succeeded" } : {
|
|
@@ -16879,7 +16879,7 @@ function createZcodeInstallation(environment, app) {
|
|
|
16879
16879
|
}
|
|
16880
16880
|
|
|
16881
16881
|
// dist/account.js
|
|
16882
|
-
import { createHash as
|
|
16882
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
16883
16883
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
16884
16884
|
import path5 from "node:path";
|
|
16885
16885
|
|
|
@@ -16928,10 +16928,100 @@ async function readCredential(installation, environment, key) {
|
|
|
16928
16928
|
}
|
|
16929
16929
|
|
|
16930
16930
|
// dist/personal-coding-plan.js
|
|
16931
|
-
import { createHash as
|
|
16931
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
16932
16932
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
16933
16933
|
import { homedir as homedir3 } from "node:os";
|
|
16934
16934
|
import path4 from "node:path";
|
|
16935
|
+
|
|
16936
|
+
// dist/project-token.js
|
|
16937
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
16938
|
+
var locationSchema = external_exports.object({
|
|
16939
|
+
organizationId: external_exports.string().trim().min(1),
|
|
16940
|
+
projectId: external_exports.string().trim().min(1),
|
|
16941
|
+
apiKeyId: external_exports.string().trim().min(1)
|
|
16942
|
+
});
|
|
16943
|
+
function readProjectCredential(credential, family, identity, origin) {
|
|
16944
|
+
const key = `project-key-location:v1:${encodeURIComponent(JSON.stringify([origin, family, identity, null, 1, "non-team"]))}`;
|
|
16945
|
+
const raw = credential(key);
|
|
16946
|
+
if (!raw)
|
|
16947
|
+
return void 0;
|
|
16948
|
+
const location = locationSchema.parse(JSON.parse(raw));
|
|
16949
|
+
const login = credential(`oauth:${family}:access_token`).trim();
|
|
16950
|
+
const loginToken = login.replace(/^Bearer\s+/i, "").trim();
|
|
16951
|
+
if (!loginToken)
|
|
16952
|
+
throw projectCredentialError();
|
|
16953
|
+
const accountScope = createHash2("sha256").update(JSON.stringify([
|
|
16954
|
+
family,
|
|
16955
|
+
"individual-coding-plan",
|
|
16956
|
+
null,
|
|
16957
|
+
login,
|
|
16958
|
+
credential("zcodejwttoken").trim() || null
|
|
16959
|
+
])).digest("hex");
|
|
16960
|
+
return { origin, loginToken, location, accountScope };
|
|
16961
|
+
}
|
|
16962
|
+
var tokenSchema = external_exports.object({
|
|
16963
|
+
success: external_exports.boolean().optional(),
|
|
16964
|
+
code: external_exports.union([external_exports.literal(0), external_exports.literal(200), external_exports.literal("0"), external_exports.literal("200")]),
|
|
16965
|
+
data: external_exports.object({
|
|
16966
|
+
enable: external_exports.boolean().optional(),
|
|
16967
|
+
accessToken: external_exports.string().trim().min(1),
|
|
16968
|
+
tokenType: external_exports.literal("Bearer"),
|
|
16969
|
+
expiresIn: external_exports.number().finite().positive(),
|
|
16970
|
+
expiresAt: external_exports.number().finite().positive()
|
|
16971
|
+
})
|
|
16972
|
+
});
|
|
16973
|
+
function projectCredentialError() {
|
|
16974
|
+
return new ZcodeError("authenticationRequired", "ZCode Personal Coding Plan project credentials are unavailable. Open the personal plan in ZCode Desktop, then re-detect ZCode and reopen the Thread");
|
|
16975
|
+
}
|
|
16976
|
+
var ProjectToken = class {
|
|
16977
|
+
#cached;
|
|
16978
|
+
async resolve(credential, appVersion, signal, rejectedFingerprint) {
|
|
16979
|
+
signal.throwIfAborted();
|
|
16980
|
+
const scope = createHash2("sha256").update(JSON.stringify(credential)).digest("hex");
|
|
16981
|
+
const cached2 = this.#cached;
|
|
16982
|
+
if (cached2?.scope === scope && cached2.fingerprint !== rejectedFingerprint && cached2.expiresAt > Date.now() + 12e4)
|
|
16983
|
+
return cached2.token;
|
|
16984
|
+
this.#cached = void 0;
|
|
16985
|
+
const { origin, location, loginToken } = credential;
|
|
16986
|
+
const url2 = `${origin}/api/biz/v1/organization/${encodeURIComponent(location.organizationId)}/projects/${encodeURIComponent(location.projectId)}/api_keys/${encodeURIComponent(location.apiKeyId)}/access_tokens`;
|
|
16987
|
+
const started = Date.now();
|
|
16988
|
+
try {
|
|
16989
|
+
const response = await fetch(url2, {
|
|
16990
|
+
method: "POST",
|
|
16991
|
+
headers: { Authorization: `Bearer ${loginToken}`, "Content-Type": "application/json" },
|
|
16992
|
+
body: JSON.stringify({ clientType: "zcode", clientVersion: appVersion }),
|
|
16993
|
+
redirect: "error",
|
|
16994
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(15e3)])
|
|
16995
|
+
});
|
|
16996
|
+
if (!response.ok)
|
|
16997
|
+
throw projectCredentialError();
|
|
16998
|
+
const parsed = tokenSchema.safeParse(await response.json());
|
|
16999
|
+
if (!parsed.success || parsed.data.success === false || parsed.data.data.enable === false)
|
|
17000
|
+
throw projectCredentialError();
|
|
17001
|
+
const data = parsed.data.data;
|
|
17002
|
+
const expiresAt = Math.min(data.expiresAt * 1e3, started + data.expiresIn * 1e3);
|
|
17003
|
+
signal.throwIfAborted();
|
|
17004
|
+
if (expiresAt <= Date.now())
|
|
17005
|
+
throw projectCredentialError();
|
|
17006
|
+
this.#cached = {
|
|
17007
|
+
scope,
|
|
17008
|
+
token: data.accessToken,
|
|
17009
|
+
expiresAt,
|
|
17010
|
+
fingerprint: createHash2("sha256").update(data.accessToken).digest("hex")
|
|
17011
|
+
};
|
|
17012
|
+
return data.accessToken;
|
|
17013
|
+
} catch (error51) {
|
|
17014
|
+
signal.throwIfAborted();
|
|
17015
|
+
if (error51 instanceof ZcodeError)
|
|
17016
|
+
throw error51;
|
|
17017
|
+
if (error51 instanceof Error && error51.name === "TimeoutError")
|
|
17018
|
+
throw new ZcodeError("unavailable", "ZCode project token request timed out. Try again.", true);
|
|
17019
|
+
throw projectCredentialError();
|
|
17020
|
+
}
|
|
17021
|
+
}
|
|
17022
|
+
};
|
|
17023
|
+
|
|
17024
|
+
// dist/personal-coding-plan.js
|
|
16935
17025
|
var familySchema = external_exports.enum(["zai", "bigmodel"]);
|
|
16936
17026
|
var recordSchema2 = external_exports.record(external_exports.string(), external_exports.unknown());
|
|
16937
17027
|
var CONNECT = "Connect Personal Coding Plan in ZCode Desktop, then re-detect ZCode and reopen the Thread";
|
|
@@ -16985,7 +17075,7 @@ async function queryEntitlement(family, apiKey, environment) {
|
|
|
16985
17075
|
try {
|
|
16986
17076
|
const response = await fetch(`${personalCodingPlanOrigin(family, environment)}/api/biz/subscription/list`, {
|
|
16987
17077
|
method: "GET",
|
|
16988
|
-
//
|
|
17078
|
+
// Legacy Desktop uses a personal API Key; project-token Desktop uses its OAuth login.
|
|
16989
17079
|
headers: { Authorization: apiKey.trim() },
|
|
16990
17080
|
redirect: "error",
|
|
16991
17081
|
signal: AbortSignal.timeout(15e3)
|
|
@@ -17019,6 +17109,8 @@ var PersonalCodingPlanAccount = class {
|
|
|
17019
17109
|
installation;
|
|
17020
17110
|
environment;
|
|
17021
17111
|
#authorized = /* @__PURE__ */ new Map();
|
|
17112
|
+
#projectToken = new ProjectToken();
|
|
17113
|
+
issue;
|
|
17022
17114
|
constructor(installation, environment) {
|
|
17023
17115
|
this.installation = installation;
|
|
17024
17116
|
this.environment = environment;
|
|
@@ -17038,12 +17130,16 @@ var PersonalCodingPlanAccount = class {
|
|
|
17038
17130
|
const identity = normalized ? normalized.id.trim() : family === "zai" && typeof profile.user_id === "string" ? profile.user_id.trim() : "";
|
|
17039
17131
|
if (!identity || identity === "unknown")
|
|
17040
17132
|
return void 0;
|
|
17133
|
+
const project2 = readProjectCredential(credential, family, identity, personalCodingPlanOrigin(family, this.environment));
|
|
17134
|
+
if (project2)
|
|
17135
|
+
return { identity, current, apiKey: project2.loginToken, project: project2 };
|
|
17041
17136
|
const key = `account-provider:coding-plan:${providerId}:account:${encodeURIComponent(identity)}:api-key`;
|
|
17042
17137
|
return { identity, current, apiKey: credential(key).trim() };
|
|
17043
17138
|
}
|
|
17044
17139
|
async inspect(providerId, accountType) {
|
|
17045
17140
|
const family = familySchema.parse(accountType);
|
|
17046
17141
|
this.#authorized.delete(providerId);
|
|
17142
|
+
this.issue = void 0;
|
|
17047
17143
|
let current = false;
|
|
17048
17144
|
try {
|
|
17049
17145
|
const context = await this.#context(providerId, family);
|
|
@@ -17055,24 +17151,29 @@ var PersonalCodingPlanAccount = class {
|
|
|
17055
17151
|
unavailableReason: "not-connected"
|
|
17056
17152
|
};
|
|
17057
17153
|
current = context.current;
|
|
17058
|
-
const connectionKey =
|
|
17154
|
+
const connectionKey = createHash3("sha256").update(JSON.stringify([family, context.identity, "individual-coding-plan"])).digest("hex");
|
|
17059
17155
|
const base = { current, connectionKey };
|
|
17060
|
-
if (!context.apiKey)
|
|
17156
|
+
if (!context.apiKey) {
|
|
17157
|
+
if (current)
|
|
17158
|
+
this.issue = "ZCode is signed in, but its Personal Coding Plan credentials are not initialized. Open the personal plan in ZCode Desktop, then re-detect ZCode. This does not mean the subscription is inactive.";
|
|
17061
17159
|
return {
|
|
17062
17160
|
...base,
|
|
17063
17161
|
availability: "unavailable",
|
|
17064
17162
|
entitled: false,
|
|
17065
17163
|
unavailableReason: "credential-failed"
|
|
17066
17164
|
};
|
|
17165
|
+
}
|
|
17067
17166
|
const entitlement = await queryEntitlement(family, context.apiKey, this.environment);
|
|
17068
17167
|
const after = await this.#context(providerId, family);
|
|
17069
|
-
if (!after || after.identity !== context.identity || after.current !== current || after.apiKey !== context.apiKey)
|
|
17168
|
+
if (!after || after.identity !== context.identity || after.current !== current || after.apiKey !== context.apiKey || JSON.stringify(after.project) !== JSON.stringify(context.project))
|
|
17070
17169
|
return { availability: "unknown", entitled: false, current: false };
|
|
17071
17170
|
if (entitlement === "available") {
|
|
17072
17171
|
if (current)
|
|
17073
17172
|
this.#authorized.set(providerId, { family, identity: context.identity });
|
|
17074
17173
|
return { ...base, availability: "available", entitled: true };
|
|
17075
17174
|
}
|
|
17175
|
+
if (current)
|
|
17176
|
+
this.issue = entitlement === "unavailable" ? "ZCode Personal Coding Plan subscription check found no active subscription. Check the selected account in ZCode Desktop, then re-detect ZCode." : "ZCode Personal Coding Plan credentials or subscription could not be verified. Open the personal plan in ZCode Desktop, then re-detect ZCode; subscription status is unknown.";
|
|
17076
17177
|
return {
|
|
17077
17178
|
...base,
|
|
17078
17179
|
availability: entitlement === "unknown" ? "unknown" : "unavailable",
|
|
@@ -17082,6 +17183,9 @@ var PersonalCodingPlanAccount = class {
|
|
|
17082
17183
|
}
|
|
17083
17184
|
};
|
|
17084
17185
|
} catch {
|
|
17186
|
+
current = await readSelection(this.environment, family).catch(() => false);
|
|
17187
|
+
if (current)
|
|
17188
|
+
this.issue = "ZCode Personal Coding Plan credentials could not be read or verified. Open the personal plan in ZCode Desktop, then re-detect ZCode; subscription status is unknown.";
|
|
17085
17189
|
return { availability: "unknown", entitled: false, current };
|
|
17086
17190
|
}
|
|
17087
17191
|
}
|
|
@@ -17093,7 +17197,9 @@ var PersonalCodingPlanAccount = class {
|
|
|
17093
17197
|
type: external_exports.literal("zhipu-account"),
|
|
17094
17198
|
mode: external_exports.literal("individual-coding-plan"),
|
|
17095
17199
|
accountType: familySchema
|
|
17096
|
-
})
|
|
17200
|
+
}),
|
|
17201
|
+
expectedAccountScope: external_exports.string().optional(),
|
|
17202
|
+
rejectedProjectTokenFingerprint: external_exports.string().optional()
|
|
17097
17203
|
}).safeParse(request);
|
|
17098
17204
|
if (!parsed.success)
|
|
17099
17205
|
throw new ZcodeError("authenticationRequired", CONNECT);
|
|
@@ -17106,6 +17212,23 @@ var PersonalCodingPlanAccount = class {
|
|
|
17106
17212
|
signal.throwIfAborted();
|
|
17107
17213
|
if (!context?.current || context.identity !== authorized.identity || !context.apiKey)
|
|
17108
17214
|
throw new ZcodeError("authenticationRequired", CONNECT);
|
|
17215
|
+
if (context.project) {
|
|
17216
|
+
const { expectedAccountScope, rejectedProjectTokenFingerprint } = parsed.data;
|
|
17217
|
+
if (expectedAccountScope !== void 0 && expectedAccountScope !== context.project.accountScope || rejectedProjectTokenFingerprint && !expectedAccountScope)
|
|
17218
|
+
throw new ZcodeError("authenticationRequired", CONNECT);
|
|
17219
|
+
const apiKey = await this.#projectToken.resolve(context.project, this.installation.version, signal, rejectedProjectTokenFingerprint);
|
|
17220
|
+
const after = await this.#context(providerId, authorized.family);
|
|
17221
|
+
signal.throwIfAborted();
|
|
17222
|
+
if (!after?.current || after.identity !== context.identity || JSON.stringify(after.project) !== JSON.stringify(context.project))
|
|
17223
|
+
throw new ZcodeError("authenticationRequired", CONNECT);
|
|
17224
|
+
return {
|
|
17225
|
+
apiKey,
|
|
17226
|
+
apiKeyId: context.project.location.apiKeyId,
|
|
17227
|
+
accountScope: context.project.accountScope
|
|
17228
|
+
};
|
|
17229
|
+
}
|
|
17230
|
+
if (parsed.data.expectedAccountScope !== void 0 || parsed.data.rejectedProjectTokenFingerprint)
|
|
17231
|
+
throw new ZcodeError("authenticationRequired", CONNECT);
|
|
17109
17232
|
return { apiKey: context.apiKey };
|
|
17110
17233
|
}
|
|
17111
17234
|
};
|
|
@@ -17231,7 +17354,7 @@ async function queryStartPlanBalance(origin, appVersion, jwt2, deviceMid) {
|
|
|
17231
17354
|
async function accountConfig(installation, environment) {
|
|
17232
17355
|
const file2 = installation.builtinProviderConfig;
|
|
17233
17356
|
const builtin = builtinSchema.parse(JSON.parse(await readFile3(file2, "utf8")));
|
|
17234
|
-
const basedOnZCodeBuiltinRevision = `zcode-builtin:${builtin.revision}:${
|
|
17357
|
+
const basedOnZCodeBuiltinRevision = `zcode-builtin:${builtin.revision}:${createHash4("sha256").update(path5.resolve(file2)).digest("hex")}`;
|
|
17235
17358
|
const family = await readCredential(installation, environment, "oauth:active_provider");
|
|
17236
17359
|
let balanceData;
|
|
17237
17360
|
if (family) {
|
|
@@ -17283,7 +17406,7 @@ async function accountConfig(installation, environment) {
|
|
|
17283
17406
|
};
|
|
17284
17407
|
}
|
|
17285
17408
|
}
|
|
17286
|
-
const overlayDigest =
|
|
17409
|
+
const overlayDigest = createHash4("sha256").update(JSON.stringify([providers, states])).digest("hex").slice(0, 16);
|
|
17287
17410
|
return {
|
|
17288
17411
|
params: {
|
|
17289
17412
|
revision: `codexhost:${family || "signed-out"}:${builtin.revision}:${overlayDigest}`,
|
|
@@ -17300,6 +17423,7 @@ async function accountConfig(installation, environment) {
|
|
|
17300
17423
|
async function providerRuntimeHeaders(request, signal, installation, environment, verifier, codingPlan) {
|
|
17301
17424
|
const mode = external_exports.object({ mode: external_exports.string() }).safeParse(request.accountAccess).data?.mode;
|
|
17302
17425
|
try {
|
|
17426
|
+
signal.throwIfAborted();
|
|
17303
17427
|
if (mode === "individual-coding-plan")
|
|
17304
17428
|
return { headersApplied: true, requestAuth: await codingPlan.requestAuth(request, signal) };
|
|
17305
17429
|
if (mode !== "start-plan")
|
|
@@ -17313,6 +17437,8 @@ async function providerRuntimeHeaders(request, signal, installation, environment
|
|
|
17313
17437
|
const headers = await verifier().verify(signal);
|
|
17314
17438
|
return { headersApplied: true, requestAuth: { apiKey, headers } };
|
|
17315
17439
|
} catch (error51) {
|
|
17440
|
+
if (signal.aborted)
|
|
17441
|
+
return { headersApplied: false };
|
|
17316
17442
|
return {
|
|
17317
17443
|
headersApplied: false,
|
|
17318
17444
|
errorMessage: error51 instanceof ZcodeError ? error51.message : "ZCode account authentication failed"
|
|
@@ -17421,6 +17547,9 @@ var CliTransport = class {
|
|
|
17421
17547
|
get startPlanChecked() {
|
|
17422
17548
|
return this.#startPlanChecked;
|
|
17423
17549
|
}
|
|
17550
|
+
get codingPlanIssue() {
|
|
17551
|
+
return this.#codingPlan?.issue;
|
|
17552
|
+
}
|
|
17424
17553
|
constructor(options) {
|
|
17425
17554
|
this.options = options;
|
|
17426
17555
|
this.#context = {
|
|
@@ -20144,6 +20273,10 @@ var ZcodeAdapter = class {
|
|
|
20144
20273
|
code: "authenticationRequired",
|
|
20145
20274
|
message: "ZCode has no available models. Sign in to ZCode Desktop with a Start Plan or Personal Coding Plan account, or add a personal provider, then re-detect ZCode. Team Coding Plan is not supported.",
|
|
20146
20275
|
retryable: true
|
|
20276
|
+
} : transport.codingPlanIssue ? {
|
|
20277
|
+
code: "configurationRequired",
|
|
20278
|
+
message: transport.codingPlanIssue,
|
|
20279
|
+
retryable: true
|
|
20147
20280
|
} : transport.startPlanChecked ? {
|
|
20148
20281
|
code: "configurationRequired",
|
|
20149
20282
|
message: "ZCode is signed in, but the account has no available models: no active Start Plan or event quota, no Personal Coding Plan, and no personal provider. Free trial and event quotas expire; subscribe to GLM Coding Plan or add a personal provider (API Key) in ZCode Desktop, then re-detect ZCode. Team Coding Plan is not supported.",
|