@codexhost/cli-darwin-arm64 0.17.0 → 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 +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-web.js +1 -1
- package/app/desktop-controller.mjs +909 -31
- package/app/host-runtime.mjs +910 -34
- 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 +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -19804,17 +19804,20 @@ ${line}`).slice(-8e3);
|
|
|
19804
19804
|
else if (unshown.trim() !== "")
|
|
19805
19805
|
this.#appendAgentText(active, unshown);
|
|
19806
19806
|
}
|
|
19807
|
+
if (!convId) {
|
|
19808
|
+
this.#completeIdentitylessTurn(active, event);
|
|
19809
|
+
return;
|
|
19810
|
+
}
|
|
19807
19811
|
const safeTurnId = event.result.num_turns !== void 0 && event.result.num_turns !== null ? `turn:${event.result.num_turns}` : `turn:${this.#history.snapshot().length + 1}`;
|
|
19808
|
-
const safeSessionId = convId || this.#nativeRef?.nativeSessionId || "unknown-session";
|
|
19809
19812
|
const nativeTurnRef = nativeTurnRefSchema.parse({
|
|
19810
19813
|
harnessId: this.harnessId,
|
|
19811
|
-
nativeSessionId:
|
|
19814
|
+
nativeSessionId: convId,
|
|
19812
19815
|
nativeTurnKey: safeTurnId,
|
|
19813
19816
|
formatVersion: 1
|
|
19814
19817
|
});
|
|
19815
19818
|
const checkpoint = nativeCheckpointRefSchema.parse({
|
|
19816
19819
|
harnessId: this.harnessId,
|
|
19817
|
-
nativeSessionId:
|
|
19820
|
+
nativeSessionId: convId,
|
|
19818
19821
|
checkpointId: safeTurnId,
|
|
19819
19822
|
formatVersion: 1
|
|
19820
19823
|
});
|
|
@@ -19831,16 +19834,33 @@ ${line}`).slice(-8e3);
|
|
|
19831
19834
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19832
19835
|
}
|
|
19833
19836
|
} else {
|
|
19834
|
-
const
|
|
19835
|
-
|
|
19836
|
-
const error51 = normalizedProcessError(errorDetail, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19837
|
-
if (repliedThisTurn && nativeError && this.#reportedEarlier(error51)) {
|
|
19837
|
+
const error51 = this.#resultError(active, event);
|
|
19838
|
+
if (repliedThisTurn && event.result.error?.trim() && this.#reportedEarlier(error51)) {
|
|
19838
19839
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19839
19840
|
} else {
|
|
19840
19841
|
this.#completeTurn(active, { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
19841
19842
|
}
|
|
19842
19843
|
}
|
|
19843
19844
|
}
|
|
19845
|
+
/** A Turn agy ended without a Conversation keeps its native outcome but no native identity. */
|
|
19846
|
+
#completeIdentitylessTurn(active, event) {
|
|
19847
|
+
if (active.cancellationRequested) {
|
|
19848
|
+
this.#completeTurn(active, { status: "cancelled", reason: "Cancelled by user" });
|
|
19849
|
+
return;
|
|
19850
|
+
}
|
|
19851
|
+
this.#completeTurn(active, {
|
|
19852
|
+
status: "failed",
|
|
19853
|
+
error: event.result.status === "SUCCESS" ? {
|
|
19854
|
+
code: "protocolError",
|
|
19855
|
+
message: "Antigravity finished the Turn without a Conversation identity",
|
|
19856
|
+
retryable: true
|
|
19857
|
+
} : this.#resultError(active, event)
|
|
19858
|
+
});
|
|
19859
|
+
}
|
|
19860
|
+
#resultError(active, event) {
|
|
19861
|
+
const nativeError = event.result.error?.trim();
|
|
19862
|
+
return normalizedProcessError(nativeError || active.stderr, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19863
|
+
}
|
|
19844
19864
|
#reportedEarlier(error51) {
|
|
19845
19865
|
return this.#history.snapshot().some(({ outcome }) => outcome.status === "failed" && outcome.error.code === error51.code && outcome.error.message === error51.message);
|
|
19846
19866
|
}
|
|
@@ -17042,6 +17042,16 @@ function cursorConfigDirectory(environment) {
|
|
|
17042
17042
|
const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
|
|
17043
17043
|
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");
|
|
17044
17044
|
}
|
|
17045
|
+
function cursorCliApprovalModeIsUnrestricted(environment, cwd = process.cwd()) {
|
|
17046
|
+
try {
|
|
17047
|
+
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) ?? os2.userInfo().homedir;
|
|
17048
|
+
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");
|
|
17049
|
+
const raw = JSON.parse(readFileSync(path6.resolve(cwd, directory, "cli-config.json"), "utf8"));
|
|
17050
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw) && raw.approvalMode === "unrestricted";
|
|
17051
|
+
} catch {
|
|
17052
|
+
return false;
|
|
17053
|
+
}
|
|
17054
|
+
}
|
|
17045
17055
|
function cursorSessionDirectory(sessionId, environment) {
|
|
17046
17056
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(sessionId))
|
|
17047
17057
|
throw new Error("Unsupported Cursor native session ID");
|
|
@@ -17413,12 +17423,17 @@ function cursorCatalog(info) {
|
|
|
17413
17423
|
const native = cursorModels(info);
|
|
17414
17424
|
const thinking = /* @__PURE__ */ new Map();
|
|
17415
17425
|
const models = native.models.map((model2) => {
|
|
17416
|
-
const
|
|
17426
|
+
const live = model2.value === native.current;
|
|
17427
|
+
const config2 = live ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
|
|
17417
17428
|
const options = cursorThinking(config2);
|
|
17418
17429
|
for (const { id, label } of options)
|
|
17419
17430
|
thinking.set(id, { id, label });
|
|
17420
17431
|
return {
|
|
17421
|
-
|
|
17432
|
+
// Only the live model's parameters reflect the user's Cursor settings. The parameterized
|
|
17433
|
+
// catalog reports Cursor's built-in defaults for every other model (for example
|
|
17434
|
+
// `fast=true`), so pinning them would override the user's remembered per-model parameters.
|
|
17435
|
+
// A bare Ref selects only the model and lets Cursor apply those parameters itself.
|
|
17436
|
+
ref: live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
|
|
17422
17437
|
label: model2.name,
|
|
17423
17438
|
supportedThinkingOptionIds: options.map(({ id }) => id)
|
|
17424
17439
|
};
|
|
@@ -21717,7 +21732,8 @@ var CursorTransport = class {
|
|
|
21717
21732
|
return this.#preparation ??= this.#prepare();
|
|
21718
21733
|
}
|
|
21719
21734
|
async #prepare() {
|
|
21720
|
-
const
|
|
21735
|
+
const useForce = this.options.executionPolicy === "unattended-full-access" || cursorCliApprovalModeIsUnrestricted(this.options.environment, this.options.cwd);
|
|
21736
|
+
const invocation = cursorInvocation(this.options.environment, this.options.command, useForce ? ["--force", "acp"] : ["acp"]);
|
|
21721
21737
|
const child = spawn(invocation.command, invocation.arguments, {
|
|
21722
21738
|
cwd: this.options.cwd,
|
|
21723
21739
|
env: this.options.environment,
|
|
@@ -24385,6 +24385,38 @@ function formatKimiCommandOutput(text) {
|
|
|
24385
24385
|
return cleaned;
|
|
24386
24386
|
}
|
|
24387
24387
|
|
|
24388
|
+
// dist/plan-approval.js
|
|
24389
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24390
|
+
function projectKimiPlanApprovalRequest(turnId, request) {
|
|
24391
|
+
const { options } = request;
|
|
24392
|
+
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"))))
|
|
24393
|
+
return null;
|
|
24394
|
+
return {
|
|
24395
|
+
interaction: {
|
|
24396
|
+
type: "question",
|
|
24397
|
+
interactionId: hostInteractionIdSchema.parse(randomUUID3()),
|
|
24398
|
+
turnId,
|
|
24399
|
+
title: "Kimi Code 计划审批",
|
|
24400
|
+
questions: [
|
|
24401
|
+
{
|
|
24402
|
+
id: "planApproval",
|
|
24403
|
+
type: "choice",
|
|
24404
|
+
prompt: readAcpToolContentText(request.toolCall.content) || "ExitPlanMode",
|
|
24405
|
+
options: options.map(({ optionId, name }) => ({ value: optionId, label: name })),
|
|
24406
|
+
multiple: false,
|
|
24407
|
+
allowOther: false,
|
|
24408
|
+
optional: false
|
|
24409
|
+
}
|
|
24410
|
+
]
|
|
24411
|
+
},
|
|
24412
|
+
schemaProperties: { planApproval: { type: "string" } },
|
|
24413
|
+
parseResponse(response) {
|
|
24414
|
+
const selected = response.action === "accept" ? response.content?.planApproval : void 0;
|
|
24415
|
+
return typeof selected === "string" && options.some(({ optionId }) => optionId === selected) ? { outcome: { outcome: "selected", optionId: selected } } : { outcome: { outcome: "cancelled" } };
|
|
24416
|
+
}
|
|
24417
|
+
};
|
|
24418
|
+
}
|
|
24419
|
+
|
|
24388
24420
|
// dist/kimi-session.js
|
|
24389
24421
|
var kimiHarnessId2 = harnessIdSchema.parse("kimi-code");
|
|
24390
24422
|
var defaultNativeTurnFlushTimeoutMs = 6e3;
|
|
@@ -24921,6 +24953,19 @@ var KimiSession = class {
|
|
|
24921
24953
|
if (currentAgentMessage) {
|
|
24922
24954
|
completeAgentMessage("commentary");
|
|
24923
24955
|
}
|
|
24956
|
+
const plan = projectKimiPlanApprovalRequest(turnId, request);
|
|
24957
|
+
if (plan) {
|
|
24958
|
+
return new Promise((resolve) => {
|
|
24959
|
+
this.#activeInteractions.set(plan.interaction.interactionId, {
|
|
24960
|
+
id: plan.interaction.interactionId,
|
|
24961
|
+
type: "question",
|
|
24962
|
+
interaction: plan.interaction,
|
|
24963
|
+
metadata: plan.schemaProperties,
|
|
24964
|
+
resolve: (value) => resolve(plan.parseResponse(value))
|
|
24965
|
+
});
|
|
24966
|
+
this.#channel.emit({ kind: "interaction", interaction: plan.interaction });
|
|
24967
|
+
});
|
|
24968
|
+
}
|
|
24924
24969
|
const projected = projectKimiApprovalRequest(turnId, request);
|
|
24925
24970
|
return new Promise((resolve) => {
|
|
24926
24971
|
this.#activeInteractions.set(projected.interaction.interactionId, {
|
|
@@ -25536,8 +25581,9 @@ var KimiAdapter = class {
|
|
|
25536
25581
|
if (this.#closed) {
|
|
25537
25582
|
return err2("invalidState", "Adapter is closed");
|
|
25538
25583
|
}
|
|
25539
|
-
|
|
25540
|
-
|
|
25584
|
+
const unattended = input.kind === "create" && input.executionPolicy === "unattended-full-access";
|
|
25585
|
+
if (unattended && input.permissionModeId && input.permissionModeId !== "yolo") {
|
|
25586
|
+
return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
|
|
25541
25587
|
}
|
|
25542
25588
|
if (input.kind === "resume" && input.nativeRef.harnessId !== this.harnessId || input.kind === "rollbackLastTurn" && input.sourceRef.harnessId !== this.harnessId) {
|
|
25543
25589
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
@@ -25597,10 +25643,11 @@ var KimiAdapter = class {
|
|
|
25597
25643
|
if (input.permissionModeId && !isKimiModeId(input.permissionModeId)) {
|
|
25598
25644
|
throw new Error(`Unsupported permission mode: ${input.permissionModeId}`);
|
|
25599
25645
|
}
|
|
25646
|
+
const permissionModeId = input.permissionModeId ?? (unattended ? "yolo" : void 0);
|
|
25600
25647
|
const requested = [
|
|
25601
25648
|
...input.model ? [{ id: "model", value: decodeKimiModelRefId(input.model.id) }] : [],
|
|
25602
25649
|
...input.thinkingOptionId ? [{ id: "thinking", value: input.thinkingOptionId }] : [],
|
|
25603
|
-
...
|
|
25650
|
+
...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
|
|
25604
25651
|
];
|
|
25605
25652
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
25606
25653
|
const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
|