@karlorz/codexhost-cli-win32-x64 0.17.0-1 → 0.17.3-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.
@@ -15926,6 +15926,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
15926
15926
  /** The text about to be steered; a Harness command always stops and restarts. */
15927
15927
  text: external_exports.string().optional()
15928
15928
  }).strict();
15929
+ var threadSteeringContextSchema = external_exports.object({
15930
+ kind: external_exports.literal("application"),
15931
+ value: external_exports.string().transform((text2, context) => {
15932
+ try {
15933
+ return JSON.parse(text2);
15934
+ } catch {
15935
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15936
+ return external_exports.NEVER;
15937
+ }
15938
+ }).pipe(external_exports.object({
15939
+ expectedTurnId: hostTurnIdSchema,
15940
+ clientUserMessageId: external_exports.string().min(1),
15941
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15942
+ }).strict())
15943
+ }).strict().transform((context) => context.value);
15929
15944
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15930
15945
  var threadSteeringInspectResultSchema = external_exports.object({
15931
15946
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16046,6 +16046,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16046
16046
  /** The text about to be steered; a Harness command always stops and restarts. */
16047
16047
  text: external_exports.string().optional()
16048
16048
  }).strict();
16049
+ var threadSteeringContextSchema = external_exports.object({
16050
+ kind: external_exports.literal("application"),
16051
+ value: external_exports.string().transform((text, context) => {
16052
+ try {
16053
+ return JSON.parse(text);
16054
+ } catch {
16055
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16056
+ return external_exports.NEVER;
16057
+ }
16058
+ }).pipe(external_exports.object({
16059
+ expectedTurnId: hostTurnIdSchema,
16060
+ clientUserMessageId: external_exports.string().min(1),
16061
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16062
+ }).strict())
16063
+ }).strict().transform((context) => context.value);
16049
16064
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16050
16065
  var threadSteeringInspectResultSchema = external_exports.object({
16051
16066
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -24558,6 +24573,38 @@ function formatKimiCommandOutput(text) {
24558
24573
  return cleaned;
24559
24574
  }
24560
24575
 
24576
+ // dist/plan-approval.js
24577
+ import { randomUUID as randomUUID3 } from "node:crypto";
24578
+ function projectKimiPlanApprovalRequest(turnId, request) {
24579
+ const { options } = request;
24580
+ 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"))))
24581
+ return null;
24582
+ return {
24583
+ interaction: {
24584
+ type: "question",
24585
+ interactionId: hostInteractionIdSchema.parse(randomUUID3()),
24586
+ turnId,
24587
+ title: "Kimi Code 计划审批",
24588
+ questions: [
24589
+ {
24590
+ id: "planApproval",
24591
+ type: "choice",
24592
+ prompt: readAcpToolContentText(request.toolCall.content) || "ExitPlanMode",
24593
+ options: options.map(({ optionId, name }) => ({ value: optionId, label: name })),
24594
+ multiple: false,
24595
+ allowOther: false,
24596
+ optional: false
24597
+ }
24598
+ ]
24599
+ },
24600
+ schemaProperties: { planApproval: { type: "string" } },
24601
+ parseResponse(response) {
24602
+ const selected = response.action === "accept" ? response.content?.planApproval : void 0;
24603
+ return typeof selected === "string" && options.some(({ optionId }) => optionId === selected) ? { outcome: { outcome: "selected", optionId: selected } } : { outcome: { outcome: "cancelled" } };
24604
+ }
24605
+ };
24606
+ }
24607
+
24561
24608
  // dist/kimi-session.js
24562
24609
  var kimiHarnessId2 = harnessIdSchema.parse("kimi-code");
24563
24610
  var defaultNativeTurnFlushTimeoutMs = 6e3;
@@ -25094,6 +25141,19 @@ var KimiSession = class {
25094
25141
  if (currentAgentMessage) {
25095
25142
  completeAgentMessage("commentary");
25096
25143
  }
25144
+ const plan = projectKimiPlanApprovalRequest(turnId, request);
25145
+ if (plan) {
25146
+ return new Promise((resolve) => {
25147
+ this.#activeInteractions.set(plan.interaction.interactionId, {
25148
+ id: plan.interaction.interactionId,
25149
+ type: "question",
25150
+ interaction: plan.interaction,
25151
+ metadata: plan.schemaProperties,
25152
+ resolve: (value) => resolve(plan.parseResponse(value))
25153
+ });
25154
+ this.#channel.emit({ kind: "interaction", interaction: plan.interaction });
25155
+ });
25156
+ }
25097
25157
  const projected = projectKimiApprovalRequest(turnId, request);
25098
25158
  return new Promise((resolve) => {
25099
25159
  this.#activeInteractions.set(projected.interaction.interactionId, {
@@ -25719,8 +25779,9 @@ var KimiAdapter = class {
25719
25779
  if (this.#closed) {
25720
25780
  return err2("invalidState", "Adapter is closed");
25721
25781
  }
25722
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access") {
25723
- return err2("unsupported", "Kimi Code cannot guarantee unattended-full-access");
25782
+ const unattended = input.kind === "create" && input.executionPolicy === "unattended-full-access";
25783
+ if (unattended && input.permissionModeId && input.permissionModeId !== "yolo") {
25784
+ return err2("invalidRequest", "Kimi Code unattended execution requires the yolo Permission Mode");
25724
25785
  }
25725
25786
  if (input.kind === "resume" && input.nativeRef.harnessId !== this.harnessId || input.kind === "rollbackLastTurn" && input.sourceRef.harnessId !== this.harnessId) {
25726
25787
  return err2("invalidRequest", "Native Session belongs to a different Harness");
@@ -25780,10 +25841,11 @@ var KimiAdapter = class {
25780
25841
  if (input.permissionModeId && !isKimiModeId(input.permissionModeId)) {
25781
25842
  throw new Error(`Unsupported permission mode: ${input.permissionModeId}`);
25782
25843
  }
25844
+ const permissionModeId = input.permissionModeId ?? (unattended ? "yolo" : void 0);
25783
25845
  const requested = [
25784
25846
  ...input.model ? [{ id: "model", value: decodeKimiModelRefId(input.model.id) }] : [],
25785
25847
  ...input.thinkingOptionId ? [{ id: "thinking", value: input.thinkingOptionId }] : [],
25786
- ...input.permissionModeId ? [{ id: "mode", value: input.permissionModeId }] : []
25848
+ ...permissionModeId ? [{ id: "mode", value: permissionModeId }] : []
25787
25849
  ];
25788
25850
  const configOptions = await applyRequestedConfig(transport, sessionInfo.configOptions, requested);
25789
25851
  const state = stateFromConfig(sessionInfo.sessionId, cwd, configOptions);
@@ -15905,6 +15905,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
15905
15905
  /** The text about to be steered; a Harness command always stops and restarts. */
15906
15906
  text: external_exports.string().optional()
15907
15907
  }).strict();
15908
+ var threadSteeringContextSchema = external_exports.object({
15909
+ kind: external_exports.literal("application"),
15910
+ value: external_exports.string().transform((text, context) => {
15911
+ try {
15912
+ return JSON.parse(text);
15913
+ } catch {
15914
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
15915
+ return external_exports.NEVER;
15916
+ }
15917
+ }).pipe(external_exports.object({
15918
+ expectedTurnId: hostTurnIdSchema,
15919
+ clientUserMessageId: external_exports.string().min(1),
15920
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
15921
+ }).strict())
15922
+ }).strict().transform((context) => context.value);
15908
15923
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
15909
15924
  var threadSteeringInspectResultSchema = external_exports.object({
15910
15925
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16108,6 +16108,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16108
16108
  /** The text about to be steered; a Harness command always stops and restarts. */
16109
16109
  text: external_exports.string().optional()
16110
16110
  }).strict();
16111
+ var threadSteeringContextSchema = external_exports.object({
16112
+ kind: external_exports.literal("application"),
16113
+ value: external_exports.string().transform((text, context) => {
16114
+ try {
16115
+ return JSON.parse(text);
16116
+ } catch {
16117
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16118
+ return external_exports.NEVER;
16119
+ }
16120
+ }).pipe(external_exports.object({
16121
+ expectedTurnId: hostTurnIdSchema,
16122
+ clientUserMessageId: external_exports.string().min(1),
16123
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16124
+ }).strict())
16125
+ }).strict().transform((context) => context.value);
16111
16126
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16112
16127
  var threadSteeringInspectResultSchema = external_exports.object({
16113
16128
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])
@@ -16105,6 +16105,21 @@ var threadSteeringInspectParamsSchema = external_exports.object({
16105
16105
  /** The text about to be steered; a Harness command always stops and restarts. */
16106
16106
  text: external_exports.string().optional()
16107
16107
  }).strict();
16108
+ var threadSteeringContextSchema = external_exports.object({
16109
+ kind: external_exports.literal("application"),
16110
+ value: external_exports.string().transform((text, context) => {
16111
+ try {
16112
+ return JSON.parse(text);
16113
+ } catch {
16114
+ context.addIssue({ code: "custom", message: "Invalid steering context JSON" });
16115
+ return external_exports.NEVER;
16116
+ }
16117
+ }).pipe(external_exports.object({
16118
+ expectedTurnId: hostTurnIdSchema,
16119
+ clientUserMessageId: external_exports.string().min(1),
16120
+ delivery: external_exports.enum(["newTurn", "activeTurn"])
16121
+ }).strict())
16122
+ }).strict().transform((context) => context.value);
16108
16123
  var threadSteerDeliverySchema = external_exports.enum(["activeTurn", "newTurn"]);
16109
16124
  var threadSteeringInspectResultSchema = external_exports.object({
16110
16125
  delivery: external_exports.enum(["official", "activeTurn", "newTurn"])