@hunyed15/codecgc 0.2.7 → 0.2.9

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.
@@ -8,6 +8,7 @@ import json
8
8
  import os
9
9
  import queue
10
10
  import subprocess
11
+ import sys
11
12
  import threading
12
13
  import time
13
14
  import uuid
@@ -212,6 +213,18 @@ def run_shell_command(cmd: list[str], timeout_seconds: int = DEFAULT_CODEX_TIMEO
212
213
  codex_path = shutil.which('codex') or cmd[0]
213
214
  popen_cmd[0] = codex_path
214
215
 
216
+ # Ensure Codex CLI inherits the same Python environment as this MCP server
217
+ # This is critical for Python 3.11+ syntax compatibility (e.g., except*)
218
+ env = os.environ.copy()
219
+ python_executable = sys.executable
220
+ if python_executable:
221
+ # Add Python executable directory to PATH so Codex CLI uses the same Python
222
+ python_dir = os.path.dirname(python_executable)
223
+ if python_dir:
224
+ env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
225
+ # Set PYTHON environment variable as a hint for tools that respect it
226
+ env['PYTHON'] = python_executable
227
+
215
228
  process = subprocess.Popen(
216
229
  popen_cmd,
217
230
  shell=False,
@@ -220,6 +233,7 @@ def run_shell_command(cmd: list[str], timeout_seconds: int = DEFAULT_CODEX_TIMEO
220
233
  stderr=subprocess.STDOUT,
221
234
  universal_newlines=True,
222
235
  encoding='utf-8',
236
+ env=env,
223
237
  )
224
238
 
225
239
  output_queue: queue.Queue[str | None] = queue.Queue()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunyed15/codecgc",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Claude-hosted multi-model workflow product shell for CodeCGC.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -1952,22 +1952,29 @@ def build_assistant_reply(result: dict[str, Any]) -> str:
1952
1952
  dispatched = bool(result.get("dispatched"))
1953
1953
  dispatch_result = result.get("dispatch_result", {}) if isinstance(result.get("dispatch_result"), dict) else {}
1954
1954
  user_next = build_user_facing_next(result)
1955
+
1956
+ # Build beginner-friendly action suggestions
1957
+ beginner_actions = build_beginner_action_pack(result)
1958
+ beginner_suffix = ""
1959
+ if beginner_actions:
1960
+ beginner_suffix = "\n\n**下一步建议:**\n" + "\n".join(f"- {action}" for action in beginner_actions)
1961
+
1955
1962
  if entry_mode == "new":
1956
1963
  summary = build_new_mode_human_summary(result)
1957
1964
  suggested = str(result.get("suggested_reply_template", "")).strip()
1958
1965
  if dispatched and not dispatch_result.get("success"):
1959
- return summary
1966
+ return summary + beginner_suffix
1960
1967
  if suggested:
1961
- return f"{summary}\n\n{suggested}"
1962
- return compose_user_reply(summary, user_next)
1968
+ return f"{summary}\n\n{suggested}{beginner_suffix}"
1969
+ return compose_user_reply(summary, user_next) + beginner_suffix
1963
1970
 
1964
1971
  summary = build_existing_mode_human_summary(result)
1965
1972
  if dispatched and not dispatch_result.get("success"):
1966
- return summary
1973
+ return summary + beginner_suffix
1967
1974
  route_status = result.get("route_status", {}) if isinstance(result.get("route_status"), dict) else {}
1968
1975
  if str(route_status.get("operator_action_summary", "")).strip():
1969
- return compose_user_reply(summary, user_next)
1970
- return compose_user_reply(summary, user_next)
1976
+ return compose_user_reply(summary, user_next) + beginner_suffix
1977
+ return compose_user_reply(summary, user_next) + beginner_suffix
1971
1978
 
1972
1979
 
1973
1980
  def build_beginner_action_pack(result: dict[str, Any]) -> list[str]: