@codexhost/cli-darwin-arm64 0.17.0 → 0.17.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 +15 -0
- package/app/console-web.js +16 -1
- package/app/desktop-controller.mjs +1040 -33
- package/app/host-runtime.mjs +1104 -43
- package/app/plugins/antigravity/plugin.mjs +42 -7
- package/app/plugins/claude-code/plugin.mjs +15 -0
- package/app/plugins/codebuddy/plugin.mjs +15 -0
- package/app/plugins/codex-usage/plugin.mjs +15 -0
- package/app/plugins/copilot/plugin.mjs +15 -0
- package/app/plugins/cursor-cli/plugin.mjs +34 -3
- package/app/plugins/deepseek-harness/plugin.mjs +15 -0
- package/app/plugins/devin/plugin.mjs +15 -0
- package/app/plugins/grok/plugin.mjs +15 -0
- package/app/plugins/hermes/plugin.mjs +15 -0
- package/app/plugins/kimi-code/plugin.mjs +65 -3
- package/app/plugins/kiro-cli/plugin.mjs +15 -0
- package/app/plugins/omp/plugin.mjs +15 -0
- package/app/plugins/opencode/plugin.mjs +15 -0
- package/app/plugins/pi/plugin.mjs +223 -88
- package/app/plugins/qoder/plugin.mjs +15 -0
- package/app/plugins/qoder-cn/plugin.mjs +15 -0
- package/app/plugins/qwen-code/plugin.mjs +15 -0
- package/app/plugins/workbuddy/plugin.mjs +15 -0
- package/app/plugins/zcode/plugin.mjs +157 -9
- package/app/renderer-extension.js +559 -216
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -15898,6 +15898,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15898
15898
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15899
15899
|
text: external_exports.string().optional()
|
|
15900
15900
|
}).strict();
|
|
15901
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15902
|
+
kind: external_exports.literal("application"),
|
|
15903
|
+
value: external_exports.string().transform((text, context) => {
|
|
15904
|
+
try {
|
|
15905
|
+
return JSON.parse(text);
|
|
15906
|
+
} catch {
|
|
15907
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15908
|
+
return external_exports.NEVER;
|
|
15909
|
+
}
|
|
15910
|
+
}).pipe(external_exports.object({
|
|
15911
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15912
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15913
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15914
|
+
}).strict())
|
|
15915
|
+
}).strict().transform((context) => context.value);
|
|
15901
15916
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15902
15917
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15903
15918
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -19804,17 +19819,20 @@ ${line}`).slice(-8e3);
|
|
|
19804
19819
|
else if (unshown.trim() !== "")
|
|
19805
19820
|
this.#appendAgentText(active, unshown);
|
|
19806
19821
|
}
|
|
19822
|
+
if (!convId) {
|
|
19823
|
+
this.#completeIdentitylessTurn(active, event);
|
|
19824
|
+
return;
|
|
19825
|
+
}
|
|
19807
19826
|
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
19827
|
const nativeTurnRef = nativeTurnRefSchema.parse({
|
|
19810
19828
|
harnessId: this.harnessId,
|
|
19811
|
-
nativeSessionId:
|
|
19829
|
+
nativeSessionId: convId,
|
|
19812
19830
|
nativeTurnKey: safeTurnId,
|
|
19813
19831
|
formatVersion: 1
|
|
19814
19832
|
});
|
|
19815
19833
|
const checkpoint = nativeCheckpointRefSchema.parse({
|
|
19816
19834
|
harnessId: this.harnessId,
|
|
19817
|
-
nativeSessionId:
|
|
19835
|
+
nativeSessionId: convId,
|
|
19818
19836
|
checkpointId: safeTurnId,
|
|
19819
19837
|
formatVersion: 1
|
|
19820
19838
|
});
|
|
@@ -19831,16 +19849,33 @@ ${line}`).slice(-8e3);
|
|
|
19831
19849
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19832
19850
|
}
|
|
19833
19851
|
} 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)) {
|
|
19852
|
+
const error51 = this.#resultError(active, event);
|
|
19853
|
+
if (repliedThisTurn && event.result.error?.trim() && this.#reportedEarlier(error51)) {
|
|
19838
19854
|
this.#completeTurn(active, { status: "succeeded", checkpoint }, nativeTurnRef);
|
|
19839
19855
|
} else {
|
|
19840
19856
|
this.#completeTurn(active, { status: "failed", error: error51, checkpoint }, nativeTurnRef);
|
|
19841
19857
|
}
|
|
19842
19858
|
}
|
|
19843
19859
|
}
|
|
19860
|
+
/** A Turn agy ended without a Conversation keeps its native outcome but no native identity. */
|
|
19861
|
+
#completeIdentitylessTurn(active, event) {
|
|
19862
|
+
if (active.cancellationRequested) {
|
|
19863
|
+
this.#completeTurn(active, { status: "cancelled", reason: "Cancelled by user" });
|
|
19864
|
+
return;
|
|
19865
|
+
}
|
|
19866
|
+
this.#completeTurn(active, {
|
|
19867
|
+
status: "failed",
|
|
19868
|
+
error: event.result.status === "SUCCESS" ? {
|
|
19869
|
+
code: "protocolError",
|
|
19870
|
+
message: "Antigravity finished the Turn without a Conversation identity",
|
|
19871
|
+
retryable: true
|
|
19872
|
+
} : this.#resultError(active, event)
|
|
19873
|
+
});
|
|
19874
|
+
}
|
|
19875
|
+
#resultError(active, event) {
|
|
19876
|
+
const nativeError = event.result.error?.trim();
|
|
19877
|
+
return normalizedProcessError(nativeError || active.stderr, `Antigravity Turn ended with status ${event.result.status}`, nativeError !== void 0);
|
|
19878
|
+
}
|
|
19844
19879
|
#reportedEarlier(error51) {
|
|
19845
19880
|
return this.#history.snapshot().some(({ outcome }) => outcome.status === "failed" && outcome.error.code === error51.code && outcome.error.message === error51.message);
|
|
19846
19881
|
}
|
|
@@ -15492,6 +15492,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15492
15492
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15493
15493
|
text: external_exports.string().optional()
|
|
15494
15494
|
}).strict();
|
|
15495
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15496
|
+
kind: external_exports.literal("application"),
|
|
15497
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15498
|
+
try {
|
|
15499
|
+
return JSON.parse(text2);
|
|
15500
|
+
} catch {
|
|
15501
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15502
|
+
return external_exports.NEVER;
|
|
15503
|
+
}
|
|
15504
|
+
}).pipe(external_exports.object({
|
|
15505
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15506
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15507
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15508
|
+
}).strict())
|
|
15509
|
+
}).strict().transform((context) => context.value);
|
|
15495
15510
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15496
15511
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15497
15512
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15968,6 +15968,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15968
15968
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15969
15969
|
text: external_exports.string().optional()
|
|
15970
15970
|
}).strict();
|
|
15971
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15972
|
+
kind: external_exports.literal("application"),
|
|
15973
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15974
|
+
try {
|
|
15975
|
+
return JSON.parse(text2);
|
|
15976
|
+
} catch {
|
|
15977
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15978
|
+
return external_exports.NEVER;
|
|
15979
|
+
}
|
|
15980
|
+
}).pipe(external_exports.object({
|
|
15981
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15982
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15983
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15984
|
+
}).strict())
|
|
15985
|
+
}).strict().transform((context) => context.value);
|
|
15971
15986
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15972
15987
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15973
15988
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15486,6 +15486,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15486
15486
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15487
15487
|
text: external_exports.string().optional()
|
|
15488
15488
|
}).strict();
|
|
15489
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15490
|
+
kind: external_exports.literal("application"),
|
|
15491
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15492
|
+
try {
|
|
15493
|
+
return JSON.parse(text2);
|
|
15494
|
+
} catch {
|
|
15495
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15496
|
+
return external_exports.NEVER;
|
|
15497
|
+
}
|
|
15498
|
+
}).pipe(external_exports.object({
|
|
15499
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15500
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15501
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15502
|
+
}).strict())
|
|
15503
|
+
}).strict().transform((context) => context.value);
|
|
15489
15504
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15490
15505
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15491
15506
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -19543,6 +19543,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
19543
19543
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
19544
19544
|
text: external_exports.string().optional()
|
|
19545
19545
|
}).strict();
|
|
19546
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
19547
|
+
kind: external_exports.literal("application"),
|
|
19548
|
+
value: external_exports.string().transform((text, context) => {
|
|
19549
|
+
try {
|
|
19550
|
+
return JSON.parse(text);
|
|
19551
|
+
} catch {
|
|
19552
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
19553
|
+
return external_exports.NEVER;
|
|
19554
|
+
}
|
|
19555
|
+
}).pipe(external_exports.object({
|
|
19556
|
+
expectedTurnId: hostTurnIdSchema,
|
|
19557
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
19558
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
19559
|
+
}).strict())
|
|
19560
|
+
}).strict().transform((context) => context.value);
|
|
19546
19561
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
19547
19562
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
19548
19563
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15853,6 +15853,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15853
15853
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15854
15854
|
text: external_exports.string().optional()
|
|
15855
15855
|
}).strict();
|
|
15856
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15857
|
+
kind: external_exports.literal("application"),
|
|
15858
|
+
value: external_exports.string().transform((text, context) => {
|
|
15859
|
+
try {
|
|
15860
|
+
return JSON.parse(text);
|
|
15861
|
+
} catch {
|
|
15862
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15863
|
+
return external_exports.NEVER;
|
|
15864
|
+
}
|
|
15865
|
+
}).pipe(external_exports.object({
|
|
15866
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15867
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15868
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15869
|
+
}).strict())
|
|
15870
|
+
}).strict().transform((context) => context.value);
|
|
15856
15871
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15857
15872
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15858
15873
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -17042,6 +17057,16 @@ function cursorConfigDirectory(environment) {
|
|
|
17042
17057
|
const home = environment.HOME ?? environment.USERPROFILE ?? os2.homedir();
|
|
17043
17058
|
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
17059
|
}
|
|
17060
|
+
function cursorCliApprovalModeIsUnrestricted(environment, cwd = process.cwd()) {
|
|
17061
|
+
try {
|
|
17062
|
+
const home = (process.platform === "win32" ? environment.USERPROFILE : environment.HOME) ?? os2.userInfo().homedir;
|
|
17063
|
+
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");
|
|
17064
|
+
const raw = JSON.parse(readFileSync(path6.resolve(cwd, directory, "cli-config.json"), "utf8"));
|
|
17065
|
+
return !!raw && typeof raw === "object" && !Array.isArray(raw) && raw.approvalMode === "unrestricted";
|
|
17066
|
+
} catch {
|
|
17067
|
+
return false;
|
|
17068
|
+
}
|
|
17069
|
+
}
|
|
17045
17070
|
function cursorSessionDirectory(sessionId, environment) {
|
|
17046
17071
|
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
17072
|
throw new Error("Unsupported Cursor native session ID");
|
|
@@ -17413,12 +17438,17 @@ function cursorCatalog(info) {
|
|
|
17413
17438
|
const native = cursorModels(info);
|
|
17414
17439
|
const thinking = /* @__PURE__ */ new Map();
|
|
17415
17440
|
const models = native.models.map((model2) => {
|
|
17416
|
-
const
|
|
17441
|
+
const live = model2.value === native.current;
|
|
17442
|
+
const config2 = live ? info.configOptions : info.nativeModels?.find((entry) => entry.value === model2.value)?.configOptions;
|
|
17417
17443
|
const options = cursorThinking(config2);
|
|
17418
17444
|
for (const { id, label } of options)
|
|
17419
17445
|
thinking.set(id, { id, label });
|
|
17420
17446
|
return {
|
|
17421
|
-
|
|
17447
|
+
// Only the live model's parameters reflect the user's Cursor settings. The parameterized
|
|
17448
|
+
// catalog reports Cursor's built-in defaults for every other model (for example
|
|
17449
|
+
// `fast=true`), so pinning them would override the user's remembered per-model parameters.
|
|
17450
|
+
// A bare Ref selects only the model and lets Cursor apply those parameters itself.
|
|
17451
|
+
ref: live ? cursorConfiguredModelRef(model2.value, config2) : cursorModelRef(model2.value),
|
|
17422
17452
|
label: model2.name,
|
|
17423
17453
|
supportedThinkingOptionIds: options.map(({ id }) => id)
|
|
17424
17454
|
};
|
|
@@ -21717,7 +21747,8 @@ var CursorTransport = class {
|
|
|
21717
21747
|
return this.#preparation ??= this.#prepare();
|
|
21718
21748
|
}
|
|
21719
21749
|
async #prepare() {
|
|
21720
|
-
const
|
|
21750
|
+
const useForce = this.options.executionPolicy === "unattended-full-access" || cursorCliApprovalModeIsUnrestricted(this.options.environment, this.options.cwd);
|
|
21751
|
+
const invocation = cursorInvocation(this.options.environment, this.options.command, useForce ? ["--force", "acp"] : ["acp"]);
|
|
21721
21752
|
const child = spawn(invocation.command, invocation.arguments, {
|
|
21722
21753
|
cwd: this.options.cwd,
|
|
21723
21754
|
env: this.options.environment,
|
|
@@ -19733,6 +19733,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
19733
19733
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
19734
19734
|
text: external_exports.string().optional()
|
|
19735
19735
|
}).strict();
|
|
19736
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
19737
|
+
kind: external_exports.literal("application"),
|
|
19738
|
+
value: external_exports.string().transform((text, context) => {
|
|
19739
|
+
try {
|
|
19740
|
+
return JSON.parse(text);
|
|
19741
|
+
} catch {
|
|
19742
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
19743
|
+
return external_exports.NEVER;
|
|
19744
|
+
}
|
|
19745
|
+
}).pipe(external_exports.object({
|
|
19746
|
+
expectedTurnId: hostTurnIdSchema,
|
|
19747
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
19748
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
19749
|
+
}).strict())
|
|
19750
|
+
}).strict().transform((context) => context.value);
|
|
19736
19751
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
19737
19752
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
19738
19753
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15490,6 +15490,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15490
15490
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15491
15491
|
text: external_exports.string().optional()
|
|
15492
15492
|
}).strict();
|
|
15493
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15494
|
+
kind: external_exports.literal("application"),
|
|
15495
|
+
value: external_exports.string().transform((text, context) => {
|
|
15496
|
+
try {
|
|
15497
|
+
return JSON.parse(text);
|
|
15498
|
+
} catch {
|
|
15499
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15500
|
+
return external_exports.NEVER;
|
|
15501
|
+
}
|
|
15502
|
+
}).pipe(external_exports.object({
|
|
15503
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15504
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15505
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15506
|
+
}).strict())
|
|
15507
|
+
}).strict().transform((context) => context.value);
|
|
15493
15508
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15494
15509
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15495
15510
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -16086,6 +16086,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
16086
16086
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16087
16087
|
text: external_exports.string().optional()
|
|
16088
16088
|
}).strict();
|
|
16089
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
16090
|
+
kind: external_exports.literal("application"),
|
|
16091
|
+
value: external_exports.string().transform((text, context) => {
|
|
16092
|
+
try {
|
|
16093
|
+
return JSON.parse(text);
|
|
16094
|
+
} catch {
|
|
16095
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
16096
|
+
return external_exports.NEVER;
|
|
16097
|
+
}
|
|
16098
|
+
}).pipe(external_exports.object({
|
|
16099
|
+
expectedTurnId: hostTurnIdSchema,
|
|
16100
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
16101
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
16102
|
+
}).strict())
|
|
16103
|
+
}).strict().transform((context) => context.value);
|
|
16089
16104
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16090
16105
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16091
16106
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15853,6 +15853,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15853
15853
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15854
15854
|
text: external_exports.string().optional()
|
|
15855
15855
|
}).strict();
|
|
15856
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15857
|
+
kind: external_exports.literal("application"),
|
|
15858
|
+
value: external_exports.string().transform((text2, context) => {
|
|
15859
|
+
try {
|
|
15860
|
+
return JSON.parse(text2);
|
|
15861
|
+
} catch {
|
|
15862
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15863
|
+
return external_exports.NEVER;
|
|
15864
|
+
}
|
|
15865
|
+
}).pipe(external_exports.object({
|
|
15866
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15867
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15868
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15869
|
+
}).strict())
|
|
15870
|
+
}).strict().transform((context) => context.value);
|
|
15856
15871
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15857
15872
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15858
15873
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -15973,6 +15973,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15973
15973
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15974
15974
|
text: external_exports.string().optional()
|
|
15975
15975
|
}).strict();
|
|
15976
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15977
|
+
kind: external_exports.literal("application"),
|
|
15978
|
+
value: external_exports.string().transform((text, context) => {
|
|
15979
|
+
try {
|
|
15980
|
+
return JSON.parse(text);
|
|
15981
|
+
} catch {
|
|
15982
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15983
|
+
return external_exports.NEVER;
|
|
15984
|
+
}
|
|
15985
|
+
}).pipe(external_exports.object({
|
|
15986
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15987
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15988
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15989
|
+
}).strict())
|
|
15990
|
+
}).strict().transform((context) => context.value);
|
|
15976
15991
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15977
15992
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15978
15993
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -24385,6 +24400,38 @@ function formatKimiCommandOutput(text) {
|
|
|
24385
24400
|
return cleaned;
|
|
24386
24401
|
}
|
|
24387
24402
|
|
|
24403
|
+
// dist/plan-approval.js
|
|
24404
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
24405
|
+
function projectKimiPlanApprovalRequest(turnId, request) {
|
|
24406
|
+
const { options } = request;
|
|
24407
|
+
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"))))
|
|
24408
|
+
return null;
|
|
24409
|
+
return {
|
|
24410
|
+
interaction: {
|
|
24411
|
+
type: "question",
|
|
24412
|
+
interactionId: hostInteractionIdSchema.parse(randomUUID3()),
|
|
24413
|
+
turnId,
|
|
24414
|
+
title: "Kimi Code 计划审批",
|
|
24415
|
+
questions: [
|
|
24416
|
+
{
|
|
24417
|
+
id: "planApproval",
|
|
24418
|
+
type: "choice",
|
|
24419
|
+
prompt: readAcpToolContentText(request.toolCall.content) || "ExitPlanMode",
|
|
24420
|
+
options: options.map(({ optionId, name }) => ({ value: optionId, label: name })),
|
|
24421
|
+
multiple: false,
|
|
24422
|
+
allowOther: false,
|
|
24423
|
+
optional: false
|
|
24424
|
+
}
|
|
24425
|
+
]
|
|
24426
|
+
},
|
|
24427
|
+
schemaProperties: { planApproval: { type: "string" } },
|
|
24428
|
+
parseResponse(response) {
|
|
24429
|
+
const selected = response.action === "accept" ? response.content?.planApproval : void 0;
|
|
24430
|
+
return typeof selected === "string" && options.some(({ optionId }) => optionId === selected) ? { outcome: { outcome: "selected", optionId: selected } } : { outcome: { outcome: "cancelled" } };
|
|
24431
|
+
}
|
|
24432
|
+
};
|
|
24433
|
+
}
|
|
24434
|
+
|
|
24388
24435
|
// dist/kimi-session.js
|
|
24389
24436
|
var kimiHarnessId2 = harnessIdSchema.parse("kimi-code");
|
|
24390
24437
|
var defaultNativeTurnFlushTimeoutMs = 6e3;
|
|
@@ -24921,6 +24968,19 @@ var KimiSession = class {
|
|
|
24921
24968
|
if (currentAgentMessage) {
|
|
24922
24969
|
completeAgentMessage("commentary");
|
|
24923
24970
|
}
|
|
24971
|
+
const plan = projectKimiPlanApprovalRequest(turnId, request);
|
|
24972
|
+
if (plan) {
|
|
24973
|
+
return new Promise((resolve) => {
|
|
24974
|
+
this.#activeInteractions.set(plan.interaction.interactionId, {
|
|
24975
|
+
id: plan.interaction.interactionId,
|
|
24976
|
+
type: "question",
|
|
24977
|
+
interaction: plan.interaction,
|
|
24978
|
+
metadata: plan.schemaProperties,
|
|
24979
|
+
resolve: (value) => resolve(plan.parseResponse(value))
|
|
24980
|
+
});
|
|
24981
|
+
this.#channel.emit({ kind: "interaction", interaction: plan.interaction });
|
|
24982
|
+
});
|
|
24983
|
+
}
|
|
24924
24984
|
const projected = projectKimiApprovalRequest(turnId, request);
|
|
24925
24985
|
return new Promise((resolve) => {
|
|
24926
24986
|
this.#activeInteractions.set(projected.interaction.interactionId, {
|
|
@@ -25536,8 +25596,9 @@ var KimiAdapter = class {
|
|
|
25536
25596
|
if (this.#closed) {
|
|
25537
25597
|
return err2("invalidState", "Adapter is closed");
|
|
25538
25598
|
}
|
|
25539
|
-
|
|
25540
|
-
|
|
25599
|
+
const unattended = input.kind === "create" && input.executionPolicy === "unattended-full-access";
|
|
25600
|
+
if (unattended && input.permissionModeId && input.permissionModeId !== "yolo") {
|
|
25601
|
+
return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
|
|
25541
25602
|
}
|
|
25542
25603
|
if (input.kind === "resume" && input.nativeRef.harnessId !== this.harnessId || input.kind === "rollbackLastTurn" && input.sourceRef.harnessId !== this.harnessId) {
|
|
25543
25604
|
return err2("invalidRequest", "Native Session belongs to a different Harness");
|
|
@@ -25597,10 +25658,11 @@ var KimiAdapter = class {
|
|
|
25597
25658
|
if (input.permissionModeId && !isKimiModeId(input.permissionModeId)) {
|
|
25598
25659
|
throw new Error(`Unsupported permission mode: ${input.permissionModeId}`);
|
|
25599
25660
|
}
|
|
25661
|
+
const permissionModeId = input.permissionModeId ?? (unattended ? "yolo" : void 0);
|
|
25600
25662
|
const requested = [
|
|
25601
25663
|
...input.model ? [{ id: "model", value: decodeKimiModelRefId(input.model.id) }] : [],
|
|
25602
25664
|
...input.thinkingOptionId ? [{ id: "thinking", value: input.thinkingOptionId }] : [],
|
|
25603
|
-
...
|
|
25665
|
+
...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
|
|
25604
25666
|
];
|
|
25605
25667
|
const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
|
|
25606
25668
|
const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
|
|
@@ -15832,6 +15832,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
15832
15832
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
15833
15833
|
text: external_exports.string().optional()
|
|
15834
15834
|
}).strict();
|
|
15835
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
15836
|
+
kind: external_exports.literal("application"),
|
|
15837
|
+
value: external_exports.string().transform((text, context) => {
|
|
15838
|
+
try {
|
|
15839
|
+
return JSON.parse(text);
|
|
15840
|
+
} catch {
|
|
15841
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
15842
|
+
return external_exports.NEVER;
|
|
15843
|
+
}
|
|
15844
|
+
}).pipe(external_exports.object({
|
|
15845
|
+
expectedTurnId: hostTurnIdSchema,
|
|
15846
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
15847
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
15848
|
+
}).strict())
|
|
15849
|
+
}).strict().transform((context) => context.value);
|
|
15835
15850
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
15836
15851
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
15837
15852
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -16035,6 +16035,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
16035
16035
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16036
16036
|
text: external_exports.string().optional()
|
|
16037
16037
|
}).strict();
|
|
16038
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
16039
|
+
kind: external_exports.literal("application"),
|
|
16040
|
+
value: external_exports.string().transform((text, context) => {
|
|
16041
|
+
try {
|
|
16042
|
+
return JSON.parse(text);
|
|
16043
|
+
} catch {
|
|
16044
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
16045
|
+
return external_exports.NEVER;
|
|
16046
|
+
}
|
|
16047
|
+
}).pipe(external_exports.object({
|
|
16048
|
+
expectedTurnId: hostTurnIdSchema,
|
|
16049
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
16050
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
16051
|
+
}).strict())
|
|
16052
|
+
}).strict().transform((context) => context.value);
|
|
16038
16053
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16039
16054
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16040
16055
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|
|
@@ -16032,6 +16032,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
|
|
|
16032
16032
|
/** The text about to be steered; a Harness command always stops and restarts. */
|
|
16033
16033
|
text: external_exports.string().optional()
|
|
16034
16034
|
}).strict();
|
|
16035
|
+
var threadSteeringContextSchema = external_exports.object({
|
|
16036
|
+
kind: external_exports.literal("application"),
|
|
16037
|
+
value: external_exports.string().transform((text, context) => {
|
|
16038
|
+
try {
|
|
16039
|
+
return JSON.parse(text);
|
|
16040
|
+
} catch {
|
|
16041
|
+
context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
|
|
16042
|
+
return external_exports.NEVER;
|
|
16043
|
+
}
|
|
16044
|
+
}).pipe(external_exports.object({
|
|
16045
|
+
expectedTurnId: hostTurnIdSchema,
|
|
16046
|
+
clientUserMessageId: external_exports.string().min(1),
|
|
16047
|
+
delivery: external_exports.enum(["newTurn", "activeTurn"])
|
|
16048
|
+
}).strict())
|
|
16049
|
+
}).strict().transform((context) => context.value);
|
|
16035
16050
|
var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
|
|
16036
16051
|
var threadSteeringInspectResultSchema = external_exports.object({
|
|
16037
16052
|
delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
|