@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.
@@ -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
- if (input.kind === "create" && input.executionPolicy === "unattended-full-access") {
25540
- return err2("unsupported", "Kimi Code cannot guarantee unattended-full-access");
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
- ...input.permissionModeId ? [{ id: "mode", value: input.permissionModeId }] : []
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);