@dev-anywhere/proxy 0.9.6 → 0.9.7

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 (39) hide show
  1. package/dist/{autostart-TMACAYHZ.js → autostart-GMEGJAZJ.js} +3 -3
  2. package/dist/{chunk-C2VZS676.js → chunk-3ZDUDCEI.js} +2 -2
  3. package/dist/{chunk-7FPUPHTZ.js → chunk-5KXGIGKU.js} +9 -2
  4. package/dist/chunk-5KXGIGKU.js.map +1 -0
  5. package/dist/{chunk-LAFXAGDU.js → chunk-5RESCDN4.js} +2 -2
  6. package/dist/{chunk-IEBAPWH3.js → chunk-7EKB4LAE.js} +3 -3
  7. package/dist/{chunk-TIXHLU3Q.js → chunk-CQFTS5QX.js} +5 -3
  8. package/dist/chunk-CQFTS5QX.js.map +1 -0
  9. package/dist/{chunk-TLY6IMDY.js → chunk-DSZJSFEG.js} +42 -8
  10. package/dist/chunk-DSZJSFEG.js.map +1 -0
  11. package/dist/{chunk-SSTYQQSR.js → chunk-EWIHC4BK.js} +2 -2
  12. package/dist/{chunk-TQP3COOV.js → chunk-HJOYOYGB.js} +2 -1
  13. package/dist/{chunk-BUUAXCBP.js → chunk-QZNAESON.js} +2 -2
  14. package/dist/{chunk-UBWS5JVM.js → chunk-YEBLIMID.js} +15 -8
  15. package/dist/chunk-YEBLIMID.js.map +1 -0
  16. package/dist/{chunk-ZRABX7EM.js → chunk-ZHG3MO4C.js} +2 -2
  17. package/dist/index.js +6 -6
  18. package/dist/preview-worker.js +4 -4
  19. package/dist/serve.js +69 -13
  20. package/dist/serve.js.map +1 -1
  21. package/dist/session-worker.js +6 -6
  22. package/dist/{terminal-FNVKGTTL.js → terminal-XOAZAJYR.js} +18 -10
  23. package/dist/terminal-XOAZAJYR.js.map +1 -0
  24. package/dist/terminal-worker.js +9 -9
  25. package/dist/update-runner.js +2 -2
  26. package/package.json +3 -3
  27. package/dist/chunk-7FPUPHTZ.js.map +0 -1
  28. package/dist/chunk-TIXHLU3Q.js.map +0 -1
  29. package/dist/chunk-TLY6IMDY.js.map +0 -1
  30. package/dist/chunk-UBWS5JVM.js.map +0 -1
  31. package/dist/terminal-FNVKGTTL.js.map +0 -1
  32. /package/dist/{autostart-TMACAYHZ.js.map → autostart-GMEGJAZJ.js.map} +0 -0
  33. /package/dist/{chunk-C2VZS676.js.map → chunk-3ZDUDCEI.js.map} +0 -0
  34. /package/dist/{chunk-LAFXAGDU.js.map → chunk-5RESCDN4.js.map} +0 -0
  35. /package/dist/{chunk-IEBAPWH3.js.map → chunk-7EKB4LAE.js.map} +0 -0
  36. /package/dist/{chunk-SSTYQQSR.js.map → chunk-EWIHC4BK.js.map} +0 -0
  37. /package/dist/{chunk-TQP3COOV.js.map → chunk-HJOYOYGB.js.map} +0 -0
  38. /package/dist/{chunk-BUUAXCBP.js.map → chunk-QZNAESON.js.map} +0 -0
  39. /package/dist/{chunk-ZRABX7EM.js.map → chunk-ZHG3MO4C.js.map} +0 -0
package/dist/serve.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  sessionRuntimeIpcVersionMatches,
13
13
  stripProxyProfileArgs,
14
14
  writeSessionRuntimeIpcVersions
15
- } from "./chunk-ZRABX7EM.js";
15
+ } from "./chunk-ZHG3MO4C.js";
16
16
  import {
17
17
  processExistsOrIsInaccessible
18
18
  } from "./chunk-5OARBB2B.js";
@@ -21,7 +21,7 @@ import {
21
21
  isPreviewControlRequest,
22
22
  readPreviewWorkerMessages,
23
23
  writePreviewWorkerMessage
24
- } from "./chunk-BUUAXCBP.js";
24
+ } from "./chunk-QZNAESON.js";
25
25
  import {
26
26
  ContentBlockDeltaSchema,
27
27
  IGNORED_EVENT_TYPES,
@@ -40,7 +40,7 @@ import {
40
40
  import {
41
41
  buildHostedPtyArgs,
42
42
  parseTerminalWorkerCliArgs
43
- } from "./chunk-UBWS5JVM.js";
43
+ } from "./chunk-YEBLIMID.js";
44
44
  import {
45
45
  ReconnectSupervisor,
46
46
  TERMINAL_ADMISSION_FRAME_MAX_BYTES,
@@ -48,7 +48,7 @@ import {
48
48
  isTerminalAdmissionRequestCandidate,
49
49
  parseTerminalAdmissionRequest,
50
50
  serializeTerminalAdmissionMessage
51
- } from "./chunk-TLY6IMDY.js";
51
+ } from "./chunk-DSZJSFEG.js";
52
52
  import {
53
53
  startServiceControl
54
54
  } from "./chunk-AZ5MTPUR.js";
@@ -67,7 +67,7 @@ import {
67
67
  detectAgentCliStatus,
68
68
  resolveCodexPermissionPolicy,
69
69
  resolveKimiAcpMode
70
- } from "./chunk-TIXHLU3Q.js";
70
+ } from "./chunk-CQFTS5QX.js";
71
71
  import {
72
72
  TERMINAL_IPC_PROTOCOL_VERSION,
73
73
  WORKER_IPC_PROTOCOL_VERSION,
@@ -75,8 +75,8 @@ import {
75
75
  createWorkerReader,
76
76
  serializeIpc,
77
77
  serializeWorkerMsg
78
- } from "./chunk-C2VZS676.js";
79
- import "./chunk-LAFXAGDU.js";
78
+ } from "./chunk-3ZDUDCEI.js";
79
+ import "./chunk-5RESCDN4.js";
80
80
  import {
81
81
  ControlErrorCode,
82
82
  MessageEnvelopeSchema,
@@ -103,7 +103,7 @@ import {
103
103
  isProxyProtocolRejectDirection,
104
104
  serializeControl,
105
105
  summarizeToolActivity
106
- } from "./chunk-7FPUPHTZ.js";
106
+ } from "./chunk-5KXGIGKU.js";
107
107
  import {
108
108
  localIpcEndpointMayExist,
109
109
  removeLocalIpcEndpoint,
@@ -121,8 +121,13 @@ import {
121
121
  codexActiveWriterMessage,
122
122
  sanitizeProviderErrorTail
123
123
  } from "./chunk-J5V2TKSV.js";
124
- import "./chunk-SSTYQQSR.js";
125
- import "./chunk-TQP3COOV.js";
124
+ import "./chunk-EWIHC4BK.js";
125
+ import {
126
+ defaultShell,
127
+ environmentValue,
128
+ findExecutableCandidates,
129
+ isExecutableFile
130
+ } from "./chunk-HJOYOYGB.js";
126
131
  import {
127
132
  serviceLogger
128
133
  } from "./chunk-EEXWF5SA.js";
@@ -5554,6 +5559,51 @@ var RelayPermissionHandlers = class {
5554
5559
  import { homedir as homedir4 } from "os";
5555
5560
  import { accessSync, constants, statSync } from "fs";
5556
5561
  import { isAbsolute as isAbsolute7 } from "path";
5562
+
5563
+ // src/common/terminal-shell.ts
5564
+ import { win32 } from "path";
5565
+ function windowsTerminalShells(env, options) {
5566
+ const probe = options.isExecutableFile ?? ((file) => isExecutableFile(file, "win32"));
5567
+ const systemRoot = environmentValue(env, "SystemRoot", "win32") || "C:\\Windows";
5568
+ const programFiles = environmentValue(env, "ProgramFiles", "win32");
5569
+ const powerShell7 = findExecutableCandidates("pwsh.exe", env, { ...options, platform: "win32" })[0] ?? (programFiles ? [win32.join(programFiles, "PowerShell", "7", "pwsh.exe")].find(probe) : void 0);
5570
+ const windowsPowerShell = win32.join(
5571
+ systemRoot,
5572
+ "System32",
5573
+ "WindowsPowerShell",
5574
+ "v1.0",
5575
+ "powershell.exe"
5576
+ );
5577
+ const commandPrompt = win32.join(systemRoot, "System32", "cmd.exe");
5578
+ const shells = [];
5579
+ if (powerShell7) {
5580
+ shells.push({ id: "powershell", label: "PowerShell 7", command: powerShell7 });
5581
+ } else if (probe(windowsPowerShell)) {
5582
+ shells.push({ id: "powershell", label: "Windows PowerShell", command: windowsPowerShell });
5583
+ }
5584
+ if (probe(commandPrompt)) shells.push({ id: "cmd", label: "CMD", command: commandPrompt });
5585
+ return shells;
5586
+ }
5587
+ function listTerminalShells(env = process.env, options = {}) {
5588
+ if ((options.platform ?? process.platform) !== "win32") return void 0;
5589
+ return windowsTerminalShells(env, options).map(({ id, label }) => ({ id, label }));
5590
+ }
5591
+ function resolveTerminalShell(shell, env = process.env, options = {}) {
5592
+ const platform = options.platform ?? process.platform;
5593
+ if (platform !== "win32") {
5594
+ if (shell !== void 0) throw new Error("CMD \u548C PowerShell \u9009\u9879\u4EC5\u652F\u6301 Windows \u5F00\u53D1\u673A");
5595
+ return { command: defaultShell(env, platform) };
5596
+ }
5597
+ const available = windowsTerminalShells(env, options);
5598
+ const resolved = shell === void 0 ? available[0] : available.find(({ id }) => id === shell);
5599
+ if (!resolved) {
5600
+ const label = shell === "powershell" ? "PowerShell" : shell === "cmd" ? "CMD" : "Shell";
5601
+ throw new Error(label + " \u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u5F00\u53D1\u673A\u4E0A\u7684 Shell \u5B89\u88C5\u540E\u91CD\u8BD5");
5602
+ }
5603
+ return { command: resolved.command, label: resolved.label };
5604
+ }
5605
+
5606
+ // src/serve/relay-resource-handlers.ts
5557
5607
  function errorMessage(err) {
5558
5608
  return err instanceof Error ? err.message : String(err);
5559
5609
  }
@@ -5571,12 +5621,15 @@ var RelayResourceHandlers = class {
5571
5621
  }
5572
5622
  deps;
5573
5623
  async onProxyInfoRequest(msg) {
5624
+ const env = this.deps.getProviderEnv();
5625
+ const terminalShells = listTerminalShells(env);
5574
5626
  this.deps.relaySend(
5575
5627
  serializeControl({
5576
5628
  type: "proxy_info",
5577
5629
  requestId: msg.requestId,
5578
5630
  homePath: homedir4() || "/",
5579
- agentCli: detectAgentCliStatus(this.deps.getProviderEnv(), {
5631
+ ...terminalShells !== void 0 ? { terminalShells } : {},
5632
+ agentCli: detectAgentCliStatus(env, {
5580
5633
  suggestions: this.deps.getAgentCliSuggestions()
5581
5634
  })
5582
5635
  })
@@ -6333,15 +6386,17 @@ var RelaySessionCreateHandler = class {
6333
6386
  const pendingId = nanoid3();
6334
6387
  const cwd = resolveTerminalCwd();
6335
6388
  const requestedName = normalizeSessionName(msg.name);
6336
- const name = requestedName ?? tildify(cwd);
6337
6389
  const nameLocked = requestedName !== void 0;
6338
6390
  const { cols, rows } = msg;
6339
6391
  const geometry = resolveInitialPtyGeometry({ cols, rows });
6340
6392
  let startup;
6341
6393
  try {
6394
+ const shell = resolveTerminalShell(msg.shell, this.deps.getProviderEnv());
6395
+ const name = requestedName ?? shell.label ?? tildify(cwd);
6342
6396
  startup = this.deps.terminalWorkerSpawner.start({
6343
6397
  sessionId: pendingId,
6344
6398
  kind: "terminal",
6399
+ shell: shell.command,
6345
6400
  provider: "claude",
6346
6401
  cwd,
6347
6402
  name,
@@ -8852,7 +8907,8 @@ function guessMimeType(filePath) {
8852
8907
  return EXT_MIME_MAP[ext] ?? "application/octet-stream";
8853
8908
  }
8854
8909
  function resolveRemoteFilePath(rawPath, cwd) {
8855
- const expandedPath = rawPath === "~" || rawPath.startsWith("~/") ? resolve4(homedir7(), rawPath.slice(2)) : rawPath;
8910
+ const isHomePath = rawPath === "~" || rawPath.startsWith("~/") || process.platform === "win32" && rawPath.startsWith("~\\");
8911
+ const expandedPath = isHomePath ? resolve4(homedir7(), rawPath.slice(2)) : rawPath;
8856
8912
  const candidate = isAbsolute10(expandedPath) ? resolve4(expandedPath) : resolve4(cwd, expandedPath);
8857
8913
  return realpathSync2(candidate);
8858
8914
  }