@karlorz/codexhost-cli-win32-x64 0.17.0-1 → 0.17.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-web.js +1 -1
- package/app/cpa-live-voice-hook.js +1 -1
- package/app/desktop-controller.mjs +910 -38
- package/app/host-runtime.mjs +911 -41
- package/app/plugins/antigravity/plugin.mjs +27 -7
- package/app/plugins/cursor-cli/plugin.mjs +19 -3
- package/app/plugins/kimi-code/plugin.mjs +50 -3
- package/app/plugins/pi/plugin.mjs +208 -88
- package/app/plugins/zcode/plugin.mjs +142 -9
- package/app/renderer-extension.js +1 -1
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
|
@@ -19977,17 +19977,20 @@ ${line}`).slice(-8e3);
|
|
|
19977
19977
|
else if (unshown.trim() !== "")
|
|
19978
19978
|
this.#appendAgentText(active, unshown);
|
|
19979
19979
|
}
|
|
19980
|
+
if (!convId) {
|
|
19981
|
+
this.#completeIdentitylessTurn(active, event);
|
|
19982
|
+
return;
|
|
19983
|
+
}
|
|
19980
19984
|
const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
|
|
19981
|
-
const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
|
|
19982
19985
|
const nativeTurnRef = nativeTurnRefSchema.parse({
|
|
19983
19986
|
harnessId: this.harnessId,
|
|
19984
|
-
nativeSessionId:
|
|
19987
|
+
nativeSessionId: convId,
|
|
19985
19988
|
nativeTurnKey: safeTurnId,
|
|
19986
19989
|
formatVersion: 1
|
|
19987
19990
|
});
|
|
19988
19991
|
const checkpoint = nativeCheckpointRefSchema.parse({
|
|
19989
19992
|
harnessId: this.harnessId,
|
|
19990
|
-
nativeSessionId:
|
|
19993
|
+
nativeSessionId: convId,
|
|
19991
19994
|
checkpointId: safeTurnId,
|
|
19992
19995
|
formatVersion: 1
|
|
19993
19996
|
});
|
|
@@ -20004,16 +20007,33 @@ ${line}`).slice(-8e3);
|
|
|
20004
20007
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
20005
20008
|
}
|
|
20006
20009
|
} else {
|
|
20007
|
-
const
|
|
20008
|
-
|
|
20009
|
-
const error51 = normalizedProcessError(errorDetail, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
20010
|
-
if (repliedThisTurn && nativeError && this.#reportedEarlier(error51)) {
|
|
20010
|
+
const error51 = this.#resultError(active, event);
|
|
20011
|
+
if (repliedThisTurn && event.result.error?.trim() && this.#reportedEarlier(error51)) {
|
|
20011
20012
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
20012
20013
|
} else {
|
|
20013
20014
|
this.#completeTurn(active, { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
20014
20015
|
}
|
|
20015
20016
|
}
|
|
20016
20017
|
}
|
|
20018
|
+
/** A Turn agy ended without a Conversation keeps its native outcome but no native identity. */
|
|
20019
|
+
#completeIdentitylessTurn(active, event) {
|
|
20020
|
+
if (active.cancellationRequested) {
|
|
20021
|
+
this.#completeTurn(active, { status: "cancelled", reason: "Cancelled by user" });
|
|
20022
|
+
return;
|
|
20023
|
+
}
|
|
20024
|
+
this.#completeTurn(active, {
|
|
20025
|
+
status: "failed",
|
|
20026
|
+
error: event.result.status === "SUCCESS" ? {
|
|
20027
|
+
code: "protocolError",
|
|
20028
|
+
message: "Antigravity finished the Turn without a Conversation identity",
|
|
20029
|
+
retryable: true
|
|
20030
|
+
} : this.#resultError(active, event)
|
|
20031
|
+
});
|
|
20032
|
+
}
|
|
20033
|
+
#resultError(active, event) {
|
|
20034
|
+
const nativeError = event.result.error?.trim();
|
|
20035
|
+
return normalizedProcessError(nativeError || active.stderr, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
20036
|
+
}
|
|
20017
20037
|
#reportedEarlier(error51) {
|
|
20018
20038
|
return this.#history.snapshot().some(({ outcome }) => outcome.status === "failed" && outcome.error.code === error51.code && outcome.error.message === error51.message);
|
|
20019
20039
|
}
|
|
@@ -17215,6 +17215,16 @@ function cursorConfigDirectory(environment) {
|
|
|
17215
17215
|
const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
|
|
17216
17216
|
return environment.CURSOR_CONFIG_DIR?.trim() ? path6.resolve(environment.CURSOR_CONFIG_DIR) : environment.XDG_CONFIG_HOME?.trim() ? path6.resolve(environment.XDG_CONFIG_HOME, "cursor") : path6.join(home, ".cursor");
|
|
17217
17217
|
}
|
|
17218
|
+
function cursorCliApprovalModeIsUnrestricted(environment, cwd = process.cwd()) {
|
|
17219
|
+
try {
|
|
17220
|
+
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) ?? os2.userInfo().homedir;
|
|
17221
|
+
const directory = environment.CURSOR_CONFIG_DIR?.trim() ? environment.CURSOR_CONFIG_DIR : environment.XDG_CONFIG_HOME?.trim() ? path6.join(environment.XDG_CONFIG_HOME, "cursor") : path6.join(home, ".cursor");
|
|
17222
|
+
const raw = JSON.parse(readFileSync(path6.resolve(cwd, directory, "cli-config.json"), "utf8"));
|
|
17223
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw) && raw.approvalMode === "unrestricted";
|
|
17224
|
+
} catch {
|
|
17225
|
+
return false;
|
|
17226
|
+
}
|
|
17227
|
+
}
|
|
17218
17228
|
function cursorSessionDirectory(sessionId, environment) {
|
|
17219
17229
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(sessionId))
|
|
17220
17230
|
throw new Error("Unsupported Cursor native session ID");
|
|
@@ -17586,12 +17596,17 @@ function cursorCatalog(info) {
|
|
|
17586
17596
|
const native = cursorModels(info);
|
|
17587
17597
|
const thinking = /* @__PURE__ */ new Map();
|
|
17588
17598
|
const models = native.models.map((model2) => {
|
|
17589
|
-
const
|
|
17599
|
+
const live = model2.value === native.current;
|
|
17600
|
+
const config2 = live ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
|
|
17590
17601
|
const options = cursorThinking(config2);
|
|
17591
17602
|
for (const { id, label } of options)
|
|
17592
17603
|
thinking.set(id, { id, label });
|
|
17593
17604
|
return {
|
|
17594
|
-
|
|
17605
|
+
// Only the live model's parameters reflect the user's Cursor settings. The parameterized
|
|
17606
|
+
// catalog reports Cursor's built-in defaults for every other model (for example
|
|
17607
|
+
// `fast=true`), so pinning them would override the user's remembered per-model parameters.
|
|
17608
|
+
// A bare Ref selects only the model and lets Cursor apply those parameters itself.
|
|
17609
|
+
ref: live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
|
|
17595
17610
|
label: model2.name,
|
|
17596
17611
|
supportedThinkingOptionIds: options.map(({ id }) => id)
|
|
17597
17612
|
};
|
|
@@ -21890,7 +21905,8 @@ var CursorTransport = class {
|
|
|
21890
21905
|
return this.#preparation ??= this.#prepare();
|
|
21891
21906
|
}
|
|
21892
21907
|
async #prepare() {
|
|
21893
|
-
const
|
|
21908
|
+
const useForce = this.options.executionPolicy === "unattended-full-access" || cursorCliApprovalModeIsUnrestricted(this.options.environment, this.options.cwd);
|
|
21909
|
+
const invocation = cursorInvocation(this.options.environment, this.options.command, useForce ? ["--force", "acp"] : ["acp"]);
|
|
21894
21910
|
const child = spawn(invocation.command, invocation.arguments, {
|
|
21895
21911
|
cwd: this.options.cwd,
|
|
21896
21912
|
env: this.options.environment,
|
|
@@ -24558,6 +24558,38 @@ function formatKimiCommandOutput(text) {
|
|
|
24558
24558
|
return cleaned;
|
|
24559
24559
|
}
|
|
24560
24560
|
|
|
24561
|
+
// dist/plan-approval.js
|
|
24562
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24563
|
+
function projectKimiPlanApprovalRequest(turnId, request) {
|
|
24564
|
+
const { options } = request;
|
|
24565
|
+
if (request.toolCall.title !== "ExitPlanMode" || !options.some(({ optionId, kind }) => optionId === "plan_revise" && kind === "reject_once") || !options.some(({ optionId, kind }) => optionId === "plan_reject_and_exit" && kind === "reject_once") || !options.some(({ kind }) => kind === "allow_once") || new Set(options.map(({ optionId }) => optionId)).size !== options.length || new Set(options.map(({ name }) => name)).size !== options.length || !options.every(({ optionId, kind, name }) => name.trim().length > 0 && (kind === "allow_once" ? optionId === "plan_approve" || /^plan_opt_\d+$/.test(optionId) : kind === "reject_once" && (optionId === "plan_revise" || optionId === "plan_reject_and_exit"))))
|
|
24566
|
+
return null;
|
|
24567
|
+
return {
|
|
24568
|
+
interaction: {
|
|
24569
|
+
type: "question",
|
|
24570
|
+
interactionId: hostInteractionIdSchema.parse(randomUUID3()),
|
|
24571
|
+
turnId,
|
|
24572
|
+
title: "Kimi Code 计划审批",
|
|
24573
|
+
questions: [
|
|
24574
|
+
{
|
|
24575
|
+
id: "planApproval",
|
|
24576
|
+
type: "choice",
|
|
24577
|
+
prompt: readAcpToolContentText(request.toolCall.content) || "ExitPlanMode",
|
|
24578
|
+
options: options.map(({ optionId, name }) => ({ value: optionId, label: name })),
|
|
24579
|
+
multiple: false,
|
|
24580
|
+
allowOther: false,
|
|
24581
|
+
optional: false
|
|
24582
|
+
}
|
|
24583
|
+
]
|
|
24584
|
+
},
|
|
24585
|
+
schemaProperties: { planApproval: { type: "string" } },
|
|
24586
|
+
parseResponse(response) {
|
|
24587
|
+
const selected = response.action === "accept" ? response.content?.planApproval : void 0;
|
|
24588
|
+
return typeof selected === "string" && options.some(({ optionId }) => optionId === selected) ? { outcome: { outcome: "selected", optionId: selected } } : { outcome: { outcome: "cancelled" } };
|
|
24589
|
+
}
|
|
24590
|
+
};
|
|
24591
|
+
}
|
|
24592
|
+
|
|
24561
24593
|
// dist/kimi-session.js
|
|
24562
24594
|
var kimiHarnessId2 = harnessIdSchema.parse("kimi-code");
|
|
24563
24595
|
var defaultNativeTurnFlushTimeoutMs = 6e3;
|
|
@@ -25094,6 +25126,19 @@ var KimiSession = class {
|
|
|
25094
25126
|
if (currentAgentMessage) {
|
|
25095
25127
|
completeAgentMessage("commentary");
|
|
25096
25128
|
}
|
|
25129
|
+
const plan = projectKimiPlanApprovalRequest(turnId, request);
|
|
25130
|
+
if (plan) {
|
|
25131
|
+
return new Promise((resolve) => {
|
|
25132
|
+
this.#activeInteractions.set(plan.interaction.interactionId, {
|
|
25133
|
+
id: plan.interaction.interactionId,
|
|
25134
|
+
type: "question",
|
|
25135
|
+
interaction: plan.interaction,
|
|
25136
|
+
metadata: plan.schemaProperties,
|
|
25137
|
+
resolve: (value) => resolve(plan.parseResponse(value))
|
|
25138
|
+
});
|
|
25139
|
+
this.#channel.emit({ kind: "interaction", interaction: plan.interaction });
|
|
25140
|
+
});
|
|
25141
|
+
}
|
|
25097
25142
|
const projected = projectKimiApprovalRequest(turnId, request);
|
|
25098
25143
|
return new Promise((resolve) => {
|
|
25099
25144
|
this.#activeInteractions.set(projected.interaction.interactionId, {
|
|
@@ -25719,8 +25764,9 @@ var KimiAdapter = class {
|
|
|
25719
25764
|
if (this.#closed) {
|
|
25720
25765
|
return err2("invalidState", "Adapter is closed");
|
|
25721
25766
|
}
|
|
25722
|
-
|
|
25723
|
-
|
|
25767
|
+
const unattended = input.kind === "create" && input.executionPolicy === "unattended-full-access";
|
|
25768
|
+
if (unattended && input.permissionModeId && input.permissionModeId !== "yolo") {
|
|
25769
|
+
return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
|
|
25724
25770
|
}
|
|
25725
25771
|
if (input.kind === "resume" && input.nativeRef.harnessId !== this.harnessId || input.kind === "rollbackLastTurn" && input.sourceRef.harnessId !== this.harnessId) {
|
|
25726
25772
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
@@ -25780,10 +25826,11 @@ var KimiAdapter = class {
|
|
|
25780
25826
|
if (input.permissionModeId && !isKimiModeId(input.permissionModeId)) {
|
|
25781
25827
|
throw new Error(`Unsupported permission mode: ${input.permissionModeId}`);
|
|
25782
25828
|
}
|
|
25829
|
+
const permissionModeId = input.permissionModeId ?? (unattended ? "yolo" : void 0);
|
|
25783
25830
|
const requested = [
|
|
25784
25831
|
...input.model ? [{ id: "model", value: decodeKimiModelRefId(input.model.id) }] : [],
|
|
25785
25832
|
...input.thinkingOptionId ? [{ id: "thinking", value: input.thinkingOptionId }] : [],
|
|
25786
|
-
...
|
|
25833
|
+
...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
|
|
25787
25834
|
];
|
|
25788
25835
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
25789
25836
|
const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
|