@karlorz/codexhost-cli-win32-x64 0.18.0-1 → 0.19.0-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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +59 -2
  4. package/app/console-web.js +98 -8
  5. package/app/cpa-live-voice-hook.js +59 -2
  6. package/app/desktop-controller.mjs +290 -12
  7. package/app/host-runtime.mjs +12896 -2966
  8. package/app/plugins/antigravity/plugin.mjs +654 -216
  9. package/app/plugins/claude-code/plugin.mjs +138 -11
  10. package/app/plugins/codebuddy/plugin.mjs +152 -20
  11. package/app/plugins/codex-usage/plugin.mjs +59 -2
  12. package/app/plugins/copilot/plugin.mjs +59 -2
  13. package/app/plugins/cursor-cli/plugin.mjs +134 -12
  14. package/app/plugins/deepseek-harness/manifest.json +2 -2
  15. package/app/plugins/deepseek-harness/plugin.mjs +86 -7
  16. package/app/plugins/devin/plugin.mjs +59 -2
  17. package/app/plugins/grok/plugin.mjs +1093 -970
  18. package/app/plugins/hermes/plugin.mjs +138 -14
  19. package/app/plugins/kimi-code/plugin.mjs +59 -2
  20. package/app/plugins/kiro-cli/plugin.mjs +287 -18
  21. package/app/plugins/omp/plugin.mjs +789 -628
  22. package/app/plugins/opencode/plugin.mjs +59 -2
  23. package/app/plugins/pi/plugin.mjs +786 -660
  24. package/app/plugins/qoder/plugin.mjs +61 -6
  25. package/app/plugins/qoder-cn/plugin.mjs +61 -6
  26. package/app/plugins/qwen-code/plugin.mjs +168 -94
  27. package/app/plugins/workbuddy/plugin.mjs +152 -20
  28. package/app/plugins/zcode/plugin.mjs +132 -5
  29. package/app/renderer-extension.js +434 -39
  30. package/app/web/assets/{index-py6Ho-Dy.js → index-BCyiiDDL.js} +62 -62
  31. package/app/web/assets/index-BNQIOOHE.css +1 -0
  32. package/app/web/codexhost-settings.js +84 -4
  33. package/app/web/index.html +2 -2
  34. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  35. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  36. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  37. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +3 -3
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +129 -8
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +8 -6
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +95 -93
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
  44. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +1 -1
  45. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  46. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.excel.js +1 -1
  47. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/client.js +1 -1
  48. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +16 -16
  49. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  50. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +11 -11
  51. package/app/web-modules/server.mjs +2345 -1518
  52. package/bin/codexhost.exe +0 -0
  53. package/libexec/codexhost-node-repl.exe +0 -0
  54. package/libexec/codexhost-shim.exe +0 -0
  55. package/libexec/codexhost-updater.exe +0 -0
  56. package/package.json +1 -1
  57. package/app/web/assets/index-C3lniEH1.css +0 -1
@@ -3432,8 +3432,8 @@ var require_utils = __commonJS({
3432
3432
  }
3433
3433
  return ind;
3434
3434
  }
3435
- function removeDotSegments(path5) {
3436
- let input = path5;
3435
+ function removeDotSegments(path6) {
3436
+ let input = path6;
3437
3437
  const output = [];
3438
3438
  let nextSlash = -1;
3439
3439
  let len = 0;
@@ -3685,8 +3685,8 @@ var require_schemes = __commonJS({
3685
3685
  wsComponent.secure = void 0;
3686
3686
  }
3687
3687
  if (wsComponent.resourceName) {
3688
- const [path5, query] = wsComponent.resourceName.split("?");
3689
- wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
3688
+ const [path6, query] = wsComponent.resourceName.split("?");
3689
+ wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
3690
3690
  wsComponent.query = query;
3691
3691
  wsComponent.resourceName = void 0;
3692
3692
  }
@@ -6897,7 +6897,7 @@ var require_dist = __commonJS({
6897
6897
 
6898
6898
  // dist/qwen-code-adapter.js
6899
6899
  import { randomUUID as randomUUID2 } from "node:crypto";
6900
- import path4 from "node:path";
6900
+ import path5 from "node:path";
6901
6901
 
6902
6902
  // ../../../node_modules/zod/v4/classic/external.js
6903
6903
  var external_exports = {};
@@ -7665,10 +7665,10 @@ function mergeDefs(...defs) {
7665
7665
  function cloneDef(schema) {
7666
7666
  return mergeDefs(schema._zod.def);
7667
7667
  }
7668
- function getElementAtPath(obj, path5) {
7669
- if (!path5)
7668
+ function getElementAtPath(obj, path6) {
7669
+ if (!path6)
7670
7670
  return obj;
7671
- return path5.reduce((acc, key) => acc?.[key], obj);
7671
+ return path6.reduce((acc, key) => acc?.[key], obj);
7672
7672
  }
7673
7673
  function promiseAllObject(promisesObj) {
7674
7674
  const keys = Object.keys(promisesObj);
@@ -8077,11 +8077,11 @@ function explicitlyAborted(x, startIndex = 0) {
8077
8077
  }
8078
8078
  return false;
8079
8079
  }
8080
- function prefixIssues(path5, issues) {
8080
+ function prefixIssues(path6, issues) {
8081
8081
  return issues.map((iss) => {
8082
8082
  var _a3;
8083
8083
  (_a3 = iss).path ?? (_a3.path = []);
8084
- iss.path.unshift(path5);
8084
+ iss.path.unshift(path6);
8085
8085
  return iss;
8086
8086
  });
8087
8087
  }
@@ -8228,16 +8228,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
8228
8228
  }
8229
8229
  function formatError(error51, mapper = (issue2) => issue2.message) {
8230
8230
  const fieldErrors = { _errors: [] };
8231
- const processError = (error52, path5 = []) => {
8231
+ const processError = (error52, path6 = []) => {
8232
8232
  for (const issue2 of error52.issues) {
8233
8233
  if (issue2.code === "invalid_union" && issue2.errors.length) {
8234
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
8234
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
8235
8235
  } else if (issue2.code === "invalid_key") {
8236
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
8236
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
8237
8237
  } else if (issue2.code === "invalid_element") {
8238
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
8238
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
8239
8239
  } else {
8240
- const fullpath = [...path5, ...issue2.path];
8240
+ const fullpath = [...path6, ...issue2.path];
8241
8241
  if (fullpath.length === 0) {
8242
8242
  fieldErrors._errors.push(mapper(issue2));
8243
8243
  } else {
@@ -8264,17 +8264,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
8264
8264
  }
8265
8265
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
8266
8266
  const result = { errors: [] };
8267
- const processError = (error52, path5 = []) => {
8267
+ const processError = (error52, path6 = []) => {
8268
8268
  var _a3, _b;
8269
8269
  for (const issue2 of error52.issues) {
8270
8270
  if (issue2.code === "invalid_union" && issue2.errors.length) {
8271
- issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
8271
+ issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
8272
8272
  } else if (issue2.code === "invalid_key") {
8273
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
8273
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
8274
8274
  } else if (issue2.code === "invalid_element") {
8275
- processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
8275
+ processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
8276
8276
  } else {
8277
- const fullpath = [...path5, ...issue2.path];
8277
+ const fullpath = [...path6, ...issue2.path];
8278
8278
  if (fullpath.length === 0) {
8279
8279
  result.errors.push(mapper(issue2));
8280
8280
  continue;
@@ -8306,8 +8306,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
8306
8306
  }
8307
8307
  function toDotPath(_path) {
8308
8308
  const segs = [];
8309
- const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
8310
- for (const seg of path5) {
8309
+ const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
8310
+ for (const seg of path6) {
8311
8311
  if (typeof seg === "number")
8312
8312
  segs.push(`[${seg}]`);
8313
8313
  else if (typeof seg === "symbol")
@@ -20999,13 +20999,13 @@ function resolveRef(ref, ctx) {
20999
20999
  if (!ref.startsWith("#")) {
21000
21000
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
21001
21001
  }
21002
- const path5 = ref.slice(1).split("/").filter(Boolean);
21003
- if (path5.length === 0) {
21002
+ const path6 = ref.slice(1).split("/").filter(Boolean);
21003
+ if (path6.length === 0) {
21004
21004
  return ctx.rootSchema;
21005
21005
  }
21006
21006
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
21007
- if (path5[0] === defsKey) {
21008
- const key = path5[1];
21007
+ if (path6[0] === defsKey) {
21008
+ const key = path6[1];
21009
21009
  if (!key || !ctx.defs[key]) {
21010
21010
  throw new Error(`Reference not found: ${ref}`);
21011
21011
  }
@@ -22410,6 +22410,10 @@ var CLIENT_CHANNEL_VERSION = 1;
22410
22410
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
22411
22411
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
22412
22412
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
22413
+ var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
22414
+ var clientThreadTreeSchema = external_exports.object({
22415
+ parents: external_exports.record(external_exports.string().min(1), external_exports.string().min(1))
22416
+ }).strict();
22413
22417
  var clientProjectlessWorkspaceSchema = external_exports.object({
22414
22418
  prompt: external_exports.string().max(16384).optional()
22415
22419
  }).strict();
@@ -22426,6 +22430,11 @@ var clientChannelCursorSchema = external_exports.object({
22426
22430
  sequence: external_exports.number().int().nonnegative()
22427
22431
  });
22428
22432
  var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
22433
+ external_exports.object({
22434
+ type: external_exports.literal("skills-changed"),
22435
+ cursor: clientChannelCursorSchema,
22436
+ cwd: external_exports.string().optional()
22437
+ }),
22429
22438
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
22430
22439
  external_exports.object({
22431
22440
  type: external_exports.literal("preferences-changed"),
@@ -22623,6 +22632,28 @@ var voiceTranscribeResultSchema = external_exports.discriminatedUnion("ok", [
22623
22632
  external_exports.object({ ok: external_exports.literal(false), error: external_exports.object({ code: voiceErrorCodeSchema }).strict() }).strict()
22624
22633
  ]);
22625
22634
 
22635
+ // ../../shared-contracts/dist/skills.js
22636
+ var skillsListParamsSchema = external_exports.object({
22637
+ threadId: hostThreadIdSchema.optional(),
22638
+ cwd: external_exports.string().min(1).optional()
22639
+ }).strict().refine((params) => !(params.threadId && params.cwd), {
22640
+ message: "Specify threadId or cwd, not both"
22641
+ });
22642
+ var librarySkillSchema = external_exports.object({
22643
+ name: external_exports.string().min(1).regex(/^[^\s[\]]+$/u),
22644
+ description: external_exports.string().optional(),
22645
+ path: external_exports.string().min(1),
22646
+ scope: external_exports.enum(["project", "global"]),
22647
+ source: external_exports.string().min(1)
22648
+ }).strict();
22649
+ var skillsListResultSchema = external_exports.object({
22650
+ revision: external_exports.number().int().nonnegative(),
22651
+ complete: external_exports.boolean(),
22652
+ skills: external_exports.array(librarySkillSchema),
22653
+ warnings: external_exports.array(external_exports.string()).optional()
22654
+ }).strict();
22655
+ var skillsChangedParamsSchema = external_exports.object({ cwd: external_exports.string().min(1).optional() }).strict();
22656
+
22626
22657
  // ../../shared-contracts/dist/web-access-tokens.js
22627
22658
  var webNetworkAccessUrlSchema = external_exports.object({
22628
22659
  /**
@@ -22728,8 +22759,8 @@ var REMOTE_THREAD_REPLY_MAX_BYTES = 16 * 1024 * 1024;
22728
22759
  var delegationReadParamsSchema = external_exports.strictObject({
22729
22760
  threadId: external_exports.string().min(1).max(1024),
22730
22761
  view: external_exports.enum(["result", "messages"]),
22731
- cursor: external_exports.string().min(1).max(8192).optional(),
22732
- limit: external_exports.number().int().min(1).max(100).optional()
22762
+ from: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional(),
22763
+ to: external_exports.number().int().min(1).max(Number.MAX_SAFE_INTEGER).optional()
22733
22764
  });
22734
22765
 
22735
22766
  // ../../shared-contracts/dist/credential-imports.js
@@ -23729,6 +23760,17 @@ var updateStatusResultSchema = external_exports.strictObject({
23729
23760
  status: updateStatusSchema.nullable()
23730
23761
  });
23731
23762
 
23763
+ // ../../shared-contracts/dist/thread-watch-notice.js
23764
+ var THREAD_WATCH_NOTICE_OUTCOMES = [
23765
+ "completed",
23766
+ "failed",
23767
+ "interrupted",
23768
+ "timedOut",
23769
+ "unreadable",
23770
+ "notFound"
23771
+ ];
23772
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
23773
+
23732
23774
  // ../../shared-contracts/dist/remote-runtime.js
23733
23775
  var remoteUpdatePhaseSchema = external_exports.enum([
23734
23776
  "idle",
@@ -23776,6 +23818,14 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
23776
23818
  archived: external_exports.boolean()
23777
23819
  }),
23778
23820
  external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
23821
+ external_exports.strictObject({
23822
+ kind: external_exports.literal("configure"),
23823
+ ...thread,
23824
+ epoch: identity,
23825
+ modelId: identity.optional(),
23826
+ thinkingOptionId: identity.optional(),
23827
+ permissionModeId: identity.optional()
23828
+ }).refine((value) => [value.modelId, value.thinkingOptionId, value.permissionModeId].filter((v) => v !== void 0).length === 1, "Select exactly one remote setting"),
23779
23829
  external_exports.strictObject({
23780
23830
  kind: external_exports.literal("prompt"),
23781
23831
  ...thread,
@@ -23848,6 +23898,13 @@ var remoteConnectionsReplySchema = external_exports.union([
23848
23898
  external_exports.strictObject({ error: external_exports.strictObject({ code: external_exports.number().int(), message: external_exports.string() }) })
23849
23899
  ]);
23850
23900
 
23901
+ // ../../shared-contracts/dist/thread-title.js
23902
+ var threadTitleInputSchema = external_exports.strictObject({
23903
+ prompt: external_exports.string().trim().min(1).max(2e3),
23904
+ cwd: external_exports.string().max(4096).nullable()
23905
+ });
23906
+ var threadTitleResultSchema = external_exports.string().trim().min(1).max(60).nullable();
23907
+
23851
23908
  // ../../shared-contracts/dist/web-ui-extensions.js
23852
23909
  var webUiExtensionIdSchema = external_exports.string().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u);
23853
23910
  var localizedTextSchema2 = external_exports.union([
@@ -25947,7 +26004,9 @@ var It = class n2 {
25947
26004
  f && (k.execPath = f), this.childProcess = Fs(d, m, k);
25948
26005
  } else K.debug(`Spawning CLI (${s.type}): ${s.command} ${[...s.args, ...e].join(" ")}`), this.childProcess = jn(s.command, [...s.args, ...e], { cwd: t, env: o, stdio: ["pipe", "pipe", r], signal: this.abortController.signal });
25949
26006
  } else K.debug(`Spawning CLI (${s.type}): ${s.command} ${[...s.args, ...e].join(" ")}`), this.childProcess = jn(s.command, [...s.args, ...e], { cwd: t, env: o, stdio: ["pipe", "pipe", r], signal: this.abortController.signal });
25950
- this.childStdin = this.childProcess.stdin, this.childStdout = this.childProcess.stdout, (this.options.debug || this.options.stderr) && this.childProcess.stderr?.on("data", (i) => {
26007
+ this.childStdin = this.childProcess.stdin, this.childStdin.on("error", (i) => {
26008
+ this.inputClosed = true, K.warn(`CLI stdin closed: ${i.message}`);
26009
+ }), this.childStdout = this.childProcess.stdout, (this.options.debug || this.options.stderr) && this.childProcess.stderr?.on("data", (i) => {
25951
26010
  K.debug(i.toString());
25952
26011
  }), this.abortHandler = () => {
25953
26012
  this.killChildProcess();
@@ -28228,57 +28287,6 @@ var sd = /* @__PURE__ */ new Set(["plan", "default"]);
28228
28287
  var Ds = pe.filter((n18) => !sd.has(n18));
28229
28288
  var rd = pe.join(", ");
28230
28289
 
28231
- // dist/permission-modes.js
28232
- var nativePermissionModes = /* @__PURE__ */ new Set([
28233
- "plan",
28234
- "default",
28235
- "auto-edit",
28236
- "auto",
28237
- "yolo"
28238
- ]);
28239
- var QWEN_CODE_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("default");
28240
- var QWEN_CODE_PERMISSION_MODE_CATALOG = harnessPermissionModeCatalogSchema.parse({
28241
- modes: [
28242
- {
28243
- id: "plan",
28244
- label: "Plan",
28245
- description: "Analyze only, do not modify files or execute commands."
28246
- },
28247
- {
28248
- id: "default",
28249
- label: "Default",
28250
- description: "Require approval for file edits or shell commands."
28251
- },
28252
- {
28253
- id: "auto-edit",
28254
- label: "Auto Edit",
28255
- description: "Automatically approve file edits."
28256
- },
28257
- {
28258
- id: "auto",
28259
- label: "Auto",
28260
- description: "LLM classifier auto-approves safe actions, blocks risky ones."
28261
- },
28262
- {
28263
- id: "yolo",
28264
- label: "YOLO",
28265
- description: "Automatically approve all tools.",
28266
- dangerous: true
28267
- }
28268
- ],
28269
- defaultModeId: QWEN_CODE_DEFAULT_PERMISSION_MODE_ID
28270
- });
28271
- function decodeQwenCodePermissionModeId(permissionModeId) {
28272
- const parsed = harnessPermissionModeIdSchema.parse(permissionModeId);
28273
- if (!nativePermissionModes.has(parsed)) {
28274
- throw new Error("Qwen Code Permission Mode belongs to another Adapter");
28275
- }
28276
- return parsed;
28277
- }
28278
-
28279
- // dist/command.js
28280
- import path2 from "node:path";
28281
-
28282
28290
  // ../../harness-discovery/dist/environment.js
28283
28291
  import fs from "node:fs";
28284
28292
  import path from "node:path";
@@ -28325,6 +28333,20 @@ function newestFirst(names) {
28325
28333
  return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
28326
28334
  }
28327
28335
 
28336
+ // ../../harness-discovery/dist/node-runtime.js
28337
+ import path2 from "node:path";
28338
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
28339
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
28340
+ const delimiter = platform === "win32" ? ";" : ":";
28341
+ const runtimeDirectory = path2.dirname(runtimeExecutable);
28342
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
28343
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
28344
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
28345
+ directories.push(runtimeDirectory);
28346
+ }
28347
+ return { ...environment, [pathKey]: directories.join(delimiter) };
28348
+ }
28349
+
28328
28350
  // ../../harness-discovery/dist/resolve.js
28329
28351
  import os from "node:os";
28330
28352
 
@@ -28488,7 +28510,56 @@ function resolveHarnessExecutable(spec, input, dependencies = {}) {
28488
28510
  return void 0;
28489
28511
  }
28490
28512
 
28513
+ // dist/permission-modes.js
28514
+ var nativePermissionModes = /* @__PURE__ */ new Set([
28515
+ "plan",
28516
+ "default",
28517
+ "auto-edit",
28518
+ "auto",
28519
+ "yolo"
28520
+ ]);
28521
+ var QWEN_CODE_DEFAULT_PERMISSION_MODE_ID = harnessPermissionModeIdSchema.parse("default");
28522
+ var QWEN_CODE_PERMISSION_MODE_CATALOG = harnessPermissionModeCatalogSchema.parse({
28523
+ modes: [
28524
+ {
28525
+ id: "plan",
28526
+ label: "Plan",
28527
+ description: "Analyze only, do not modify files or execute commands."
28528
+ },
28529
+ {
28530
+ id: "default",
28531
+ label: "Default",
28532
+ description: "Require approval for file edits or shell commands."
28533
+ },
28534
+ {
28535
+ id: "auto-edit",
28536
+ label: "Auto Edit",
28537
+ description: "Automatically approve file edits."
28538
+ },
28539
+ {
28540
+ id: "auto",
28541
+ label: "Auto",
28542
+ description: "LLM classifier auto-approves safe actions, blocks risky ones."
28543
+ },
28544
+ {
28545
+ id: "yolo",
28546
+ label: "YOLO",
28547
+ description: "Automatically approve all tools.",
28548
+ dangerous: true
28549
+ }
28550
+ ],
28551
+ defaultModeId: QWEN_CODE_DEFAULT_PERMISSION_MODE_ID
28552
+ });
28553
+ function decodeQwenCodePermissionModeId(permissionModeId) {
28554
+ const parsed = harnessPermissionModeIdSchema.parse(permissionModeId);
28555
+ if (!nativePermissionModes.has(parsed)) {
28556
+ throw new Error("Qwen Code Permission Mode belongs to another Adapter");
28557
+ }
28558
+ return parsed;
28559
+ }
28560
+
28491
28561
  // dist/command.js
28562
+ import path3 from "node:path";
28492
28563
  var QWEN_NPM_ENTRY = "node_modules/@qwen-code/qwen-code/cli-entry.js";
28493
28564
  var qwenCodeDiscoverySpec = {
28494
28565
  id: "qwen-code",
@@ -28520,7 +28591,7 @@ function resolveQwenCodeExecutable(input = {}, dependencies = {}) {
28520
28591
  }, dependencies);
28521
28592
  if (!resolution)
28522
28593
  throw new Error("Executable file not found: Qwen Code CLI is not installed");
28523
- return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path2.resolve(resolution.executable);
28594
+ return targetPath(platform).isAbsolute(resolution.executable) ? resolution.executable : path3.resolve(resolution.executable);
28524
28595
  }
28525
28596
 
28526
28597
  // dist/qwen-tool-output.js
@@ -28876,7 +28947,7 @@ var QwenCodeSdkTransport = class {
28876
28947
  cwd: this.#options.cwd,
28877
28948
  ...input.model ? { model: input.model } : {},
28878
28949
  ...this.#options.commandTimeoutMs ? { timeout: { controlRequest: this.#options.commandTimeoutMs } } : {},
28879
- ...environment ? { env: environment } : {},
28950
+ env: environment,
28880
28951
  abortController,
28881
28952
  includePartialMessages: true,
28882
28953
  pathToQwenExecutable: executable,
@@ -28903,10 +28974,13 @@ var QwenCodeSdkTransport = class {
28903
28974
  throw classifyError(error51);
28904
28975
  }
28905
28976
  }
28977
+ /**
28978
+ * The SDK merges `env` over `process.env`. Supplying PATH here keeps a
28979
+ * `#!/usr/bin/env node` launcher runnable when the Host started with a
28980
+ * minimal PATH (for example from a login item).
28981
+ */
28906
28982
  #environment() {
28907
- const environment = this.#options.environment;
28908
- if (!environment)
28909
- return void 0;
28983
+ const environment = withNodeRuntimeOnPath({ ...process.env, ...this.#options.environment });
28910
28984
  return Object.fromEntries(Object.entries(environment).filter((entry) => typeof entry[1] === "string"));
28911
28985
  }
28912
28986
  #canUseTool = async (toolName, input) => {
@@ -29120,7 +29194,7 @@ function stateForQwenCodeModel(modelState, nativeState, model2 = modelState.curr
29120
29194
  // dist/qwen-history.js
29121
29195
  import { readFile } from "node:fs/promises";
29122
29196
  import os2 from "node:os";
29123
- import path3 from "node:path";
29197
+ import path4 from "node:path";
29124
29198
  var QWEN_CODE_TURN_KEY_PREFIX = "qwen-turn-";
29125
29199
  function qwenCodeTurnKey(ordinal) {
29126
29200
  return `${QWEN_CODE_TURN_KEY_PREFIX}${ordinal}`;
@@ -29365,21 +29439,21 @@ function sanitizeCwd(cwd) {
29365
29439
  return (process.platform === "win32" ? cwd.toLowerCase() : cwd).replace(/[^a-zA-Z0-9]/g, "-");
29366
29440
  }
29367
29441
  function resolveQwenDirectory(value, cwd) {
29368
- const expanded = value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? path3.join(os2.homedir(), ...value.slice(value === "~" ? 1 : 2).split(/[/\\]+/u).filter(Boolean)) : value;
29369
- return path3.isAbsolute(expanded) ? expanded : path3.resolve(cwd, expanded);
29442
+ const expanded = value === "~" || value.startsWith("~/") || value.startsWith("~\\") ? path4.join(os2.homedir(), ...value.slice(value === "~" ? 1 : 2).split(/[/\\]+/u).filter(Boolean)) : value;
29443
+ return path4.isAbsolute(expanded) ? expanded : path4.resolve(cwd, expanded);
29370
29444
  }
29371
29445
  function qwenRuntimeBase(cwd, environment) {
29372
29446
  const overrides = Object.fromEntries(Object.entries(environment ?? {}).filter((entry) => typeof entry[1] === "string"));
29373
29447
  const effectiveEnvironment = { ...process.env, ...overrides };
29374
29448
  const configured = effectiveEnvironment.QWEN_RUNTIME_DIR || effectiveEnvironment.QWEN_HOME;
29375
- return configured ? resolveQwenDirectory(configured, cwd) : path3.join(os2.homedir(), ".qwen");
29449
+ return configured ? resolveQwenDirectory(configured, cwd) : path4.join(os2.homedir(), ".qwen");
29376
29450
  }
29377
29451
  async function readQwenCodeHistory(cwd, harnessId, sessionId, knownTurnRefs = [], toolOutputLimit = 64e3, environment) {
29378
29452
  const runtimeBase = qwenRuntimeBase(cwd, environment);
29379
- const projectDir = path3.join(runtimeBase, "projects", sanitizeCwd(cwd), "chats");
29453
+ const projectDir = path4.join(runtimeBase, "projects", sanitizeCwd(cwd), "chats");
29380
29454
  const paths = [
29381
- path3.join(projectDir, `${sessionId}.jsonl`),
29382
- path3.join(projectDir, "archive", `${sessionId}.jsonl`)
29455
+ path4.join(projectDir, `${sessionId}.jsonl`),
29456
+ path4.join(projectDir, "archive", `${sessionId}.jsonl`)
29383
29457
  ];
29384
29458
  let lastReadError;
29385
29459
  for (const filePath of paths) {
@@ -30122,7 +30196,7 @@ var QwenCodeAdapter = class {
30122
30196
  if (this.#closePromise) {
30123
30197
  return { status: "unavailable", error: invalidState("Qwen Code Adapter is closed") };
30124
30198
  }
30125
- const cwd = path4.resolve(input.cwd ?? process.cwd());
30199
+ const cwd = path5.resolve(input.cwd ?? process.cwd());
30126
30200
  if (!input.refresh) {
30127
30201
  const cached2 = this.#inspectionCache.get(cwd);
30128
30202
  if (cached2)
@@ -30189,7 +30263,7 @@ var QwenCodeAdapter = class {
30189
30263
  }
30190
30264
  };
30191
30265
  }
30192
- const cwd = path4.resolve(input.cwd);
30266
+ const cwd = path5.resolve(input.cwd);
30193
30267
  const sessionEnvironment = mergeEnvironment(this.#environment, input.environment);
30194
30268
  let initialPermissionModeId = QWEN_CODE_DEFAULT_PERMISSION_MODE_ID;
30195
30269
  if (input.kind === "create") {