prompt-copilot-cli 0.6.0__tar.gz → 0.6.2__tar.gz
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.
- {prompt_copilot_cli-0.6.0/prompt_copilot_cli.egg-info → prompt_copilot_cli-0.6.2}/PKG-INFO +1 -1
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/main.py +28 -3
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2/prompt_copilot_cli.egg-info}/PKG-INFO +1 -1
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/SOURCES.txt +2 -1
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/pyproject.toml +1 -1
- prompt_copilot_cli-0.6.2/tests/test_think_filter.py +23 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/LICENSE +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/MANIFEST.in +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/README.md +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/README.zh-CN.md +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/dependency_links.txt +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/entry_points.txt +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/requires.txt +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/top_level.txt +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/requirements.txt +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/setup.cfg +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_cli_args.py +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_command_timeout.py +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_file_tools.py +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_image_tool.py +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_mcp_transport.py +0 -0
- {prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/tests/test_multimodal_messages.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prompt-copilot-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration.
|
|
5
5
|
Author: Jason Li
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -20,7 +20,7 @@ from typing import Any
|
|
|
20
20
|
from mcp.client.session import ClientSession
|
|
21
21
|
from mcp.client.sse import sse_client
|
|
22
22
|
from mcp.client.stdio import StdioServerParameters, stdio_client
|
|
23
|
-
from mcp.client.streamable_http import streamablehttp_client
|
|
23
|
+
from mcp.client.streamable_http import streamable_http_client as streamablehttp_client
|
|
24
24
|
from openai import OpenAI
|
|
25
25
|
from prompt_toolkit import PromptSession
|
|
26
26
|
from prompt_toolkit.completion import Completion, Completer
|
|
@@ -28,6 +28,7 @@ from prompt_toolkit.history import FileHistory
|
|
|
28
28
|
from rich.console import Console
|
|
29
29
|
from rich.panel import Panel
|
|
30
30
|
from types import SimpleNamespace
|
|
31
|
+
import re
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
ROOT = Path.home() / ".prompt-copilot"
|
|
@@ -278,7 +279,7 @@ DEFAULT_SYSTEM_PROMPT = f"""
|
|
|
278
279
|
"""
|
|
279
280
|
|
|
280
281
|
UI_SYSTEM_LANGUAGE = "en"
|
|
281
|
-
APPLICATION_VERSION = "0.6.
|
|
282
|
+
APPLICATION_VERSION = "0.6.2"
|
|
282
283
|
WORKSPACE_DIR = ROOT / "workspace"
|
|
283
284
|
LOG_DIR = ROOT / "logs"
|
|
284
285
|
LOG_FILE = LOG_DIR / "agent_runtime.log"
|
|
@@ -1479,6 +1480,24 @@ def show_tool_result(tool_call: Any, result: dict[str, Any]) -> None:
|
|
|
1479
1480
|
)
|
|
1480
1481
|
|
|
1481
1482
|
|
|
1483
|
+
def _filter_think_tags(content: str) -> str:
|
|
1484
|
+
"""Remove <think>..</think> and standalone <think/> tags and their contents.
|
|
1485
|
+
|
|
1486
|
+
- Removes any content between an opening <think> (or <think/>) and a closing </think>.
|
|
1487
|
+
- Removes standalone tags like <think/> or <think>.
|
|
1488
|
+
"""
|
|
1489
|
+
if not content:
|
|
1490
|
+
return content
|
|
1491
|
+
|
|
1492
|
+
between_re = re.compile(r"<think\s*/?>.*?</think>", flags=re.IGNORECASE | re.DOTALL)
|
|
1493
|
+
result = between_re.sub("", content)
|
|
1494
|
+
|
|
1495
|
+
tag_re = re.compile(r"<think\s*/?>", flags=re.IGNORECASE)
|
|
1496
|
+
result = tag_re.sub("", result)
|
|
1497
|
+
|
|
1498
|
+
return result
|
|
1499
|
+
|
|
1500
|
+
|
|
1482
1501
|
def chat_once(client: OpenAI, model: str, messages: list[dict[str, Any]], temperature: float, debug_enabled: bool = False, disable_tools:bool = False) -> Any:
|
|
1483
1502
|
ensure_not_interrupted()
|
|
1484
1503
|
wait_for_model_call_interval()
|
|
@@ -1511,6 +1530,12 @@ def chat_once(client: OpenAI, model: str, messages: list[dict[str, Any]], temper
|
|
|
1511
1530
|
update_total_token_usage(usage)
|
|
1512
1531
|
|
|
1513
1532
|
response_content = assistant_message.content or ""
|
|
1533
|
+
# Strip out internal <think> tags from model content
|
|
1534
|
+
try:
|
|
1535
|
+
response_content = _filter_think_tags(response_content)
|
|
1536
|
+
assistant_message.content = response_content
|
|
1537
|
+
except Exception:
|
|
1538
|
+
pass
|
|
1514
1539
|
response_length = len(str(response_content))
|
|
1515
1540
|
usage_summary = format_usage_summary(usage)
|
|
1516
1541
|
show_stage(
|
|
@@ -1669,7 +1694,7 @@ def plan_user_request(client: OpenAI, model: str, history: list[dict[str, Any]],
|
|
|
1669
1694
|
|
|
1670
1695
|
### 请严格按照以下格式输出任务清单:
|
|
1671
1696
|
|
|
1672
|
-
|
|
1697
|
+
用户原始输入:......
|
|
1673
1698
|
|
|
1674
1699
|
接下来按步骤逐步执行完成任务:
|
|
1675
1700
|
1、第一步:......
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prompt-copilot-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration.
|
|
5
5
|
Author: Jason Li
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "prompt-copilot-cli"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "A lightweight terminal-based coding agent with file tools, command execution, multimodal image support, and MCP integration."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from copilot.agent import AgentRuntime
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_filter_think_tags(tmp_path, monkeypatch):
|
|
5
|
+
# Create a minimal AgentRuntime-like object
|
|
6
|
+
class Dummy:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
rt = AgentRuntime.__new__(AgentRuntime)
|
|
11
|
+
# Attach the method under test
|
|
12
|
+
rt._filter_think_tags = AgentRuntime._filter_think_tags.__get__(rt, AgentRuntime)
|
|
13
|
+
|
|
14
|
+
sample = (
|
|
15
|
+
"Here is an answer. <think>internal thought: do not show</think>\nAnd more output."
|
|
16
|
+
)
|
|
17
|
+
assert "internal thought" not in rt._filter_think_tags(sample)
|
|
18
|
+
|
|
19
|
+
sample2 = "Start <think/>mid</think> end"
|
|
20
|
+
assert "mid" not in rt._filter_think_tags(sample2)
|
|
21
|
+
|
|
22
|
+
sample3 = "Visible text <think/>" # standalone
|
|
23
|
+
assert "think" not in rt._filter_think_tags(sample3)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/requires.txt
RENAMED
|
File without changes
|
{prompt_copilot_cli-0.6.0 → prompt_copilot_cli-0.6.2}/prompt_copilot_cli.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|