entari-plugin-hyw 3.2.112__py3-none-any.whl → 3.3.0__py3-none-any.whl

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.

Potentially problematic release.


This version of entari-plugin-hyw might be problematic. Click here for more details.

@@ -1,11 +1,11 @@
1
- entari_plugin_hyw/__init__.py,sha256=qRk1hp5HTb4gUPOalYXJScjWZtFKlv2SKEOWar-c4AI,35164
1
+ entari_plugin_hyw/__init__.py,sha256=wDJ8QVmDwWbDK1UkA6eThmX7k897ZcX66AGlN7SRNSk,36571
2
2
  entari_plugin_hyw/assets/package-lock.json,sha256=TIrLM-wLWZTrp3LKfzhEVuduhvBJmI93NdQEKYLW2W0,33172
3
3
  entari_plugin_hyw/assets/package.json,sha256=Y4H8JGtp3nv2WUtI20tXoXWddR-dwwKJhqQVLercpiw,306
4
4
  entari_plugin_hyw/assets/tailwind.config.js,sha256=S8I9X8hI8IaQRczWK9hTW-zl4oVpAXw5ykeksrzHjpU,382
5
- entari_plugin_hyw/assets/tailwind.input.css,sha256=QEZD-647GQfZeRYQdBx17RLUk6mKnZkDEwj7haTQzew,4735
5
+ entari_plugin_hyw/assets/tailwind.input.css,sha256=RO5TVYl7pHjP6w06bEaZyvygT2dQDdlzczQQXqToh3w,4732
6
6
  entari_plugin_hyw/assets/template.html,sha256=xPgOKlhKzz2p2_1nn5y44XwD37UqkW2uwHn4HpaGtCU,5646
7
7
  entari_plugin_hyw/assets/template.html.bak,sha256=xPgOKlhKzz2p2_1nn5y44XwD37UqkW2uwHn4HpaGtCU,5646
8
- entari_plugin_hyw/assets/template.j2,sha256=z-3X68wlncMkUYpHYsD4W7csmQIzWwVRamztDkQ6gpo,14329
8
+ entari_plugin_hyw/assets/template.j2,sha256=a2WfzdCmM9x3RUxE2lfmbzh0Tw3t9Nho1s5qSsQt7tI,18344
9
9
  entari_plugin_hyw/assets/icon/anthropic.svg,sha256=ASsy1ypo3osNc3n-B0R81tk_dIFsVgg7qQORrd5T2kA,558
10
10
  entari_plugin_hyw/assets/icon/deepseek.png,sha256=KWWAr9aeYMc6I07U_1qo7zcXO6e7-kfd9S2XjQumnf4,25338
11
11
  entari_plugin_hyw/assets/icon/gemini.svg,sha256=H74CoVmx5opcCtr3Ay3M09dpqL9cd9Whkx-M6an3t7s,599
@@ -26,22 +26,21 @@ entari_plugin_hyw/assets/libs/highlight.js,sha256=g3pvpbDHNrUrveKythkPMF2j_J7UFo
26
26
  entari_plugin_hyw/assets/libs/katex-auto-render.js,sha256=nLjaz8CGwpZsnsS6VPSi3EO3y-KzPOwaJ0PYhsf7R6c,3478
27
27
  entari_plugin_hyw/assets/libs/katex.css,sha256=UF1fgpAiu3tPJN_uCqEUHNe7pnr-QR0SQDNfgglgtcM,23196
28
28
  entari_plugin_hyw/assets/libs/katex.js,sha256=3ISyluw-iE3gkxWPdg_Z1Ftser5YtTgVV_ThOPRqWK4,277038
29
- entari_plugin_hyw/assets/libs/tailwind.css,sha256=Vxv_ByyehWd0I7CJ74ZgnwNmgBVU_dRUZ9FqB-FqPDY,18886
29
+ entari_plugin_hyw/assets/libs/tailwind.css,sha256=QlYLtFooDB4H5-2bxuS8DJD5L1_cZgjEQnrYvUXVFnI,19889
30
30
  entari_plugin_hyw/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- entari_plugin_hyw/core/config.py,sha256=LUP1LY0U9xfF_rzV2HxnNfJnfi929RNUZeFgbFFsyd4,1620
31
+ entari_plugin_hyw/core/config.py,sha256=iNCSOzd-OHNeaYBOZxx6pEmiQcR31KPE93BOwSLfBUU,1530
32
32
  entari_plugin_hyw/core/history.py,sha256=vqp7itwR5-KaqC4Ftmq6GOz7OM9GsiFJnSN9JJ2P6L4,5894
33
33
  entari_plugin_hyw/core/hyw.py,sha256=QwLB2YpUnzbVCWXcJF0uUeDAjxd4LWMzm9EjB9T1G1g,1671
34
- entari_plugin_hyw/core/pipeline.py,sha256=nV07UxzCXLLvAYDzcxgoYTxbxcHzD-_Ym4ZluvM82xg,38673
35
- entari_plugin_hyw/core/render.py,sha256=f2ugb5eZtZQKSQehmnyD9bvHasgZ2Px6QD-jUS8ndgY,26962
34
+ entari_plugin_hyw/core/pipeline.py,sha256=Lw_x3Z12-hQDGj9FtVqeJHM91Yy90LMmiX7SRp3T-wY,48346
35
+ entari_plugin_hyw/core/render.py,sha256=ypfjcTXptW_I0Z9tz4pZ9lJ6hdjYVq07UIiuApMuS9c,28193
36
36
  entari_plugin_hyw/core/render.py.bak,sha256=qMd6Tk0p6ItqGmErR6dkWRwCuKQYXINc7KRxnP-mb_s,48768
37
- entari_plugin_hyw/utils/__init__.py,sha256=2JEC3lqFoa8FgR1kUjNUbwSph23YSOxbCaqYSgFomxs,128
38
- entari_plugin_hyw/utils/browser.py,sha256=Szr7oIx8My9Qnh8_bQsEm7o3iUZYk9Gamtz7kvwTNyg,2086
39
- entari_plugin_hyw/utils/mcp_playwright.py,sha256=WB8LPrmfMotfX6C-4h2WxEKXypnSzQ4-poNS-lTNe7c,4680
37
+ entari_plugin_hyw/utils/__init__.py,sha256=TnkxDqYr0zgRE7TC92tVbUaY8m1UyyoLg2zvzQ8nMVI,84
38
+ entari_plugin_hyw/utils/browser.py,sha256=LJlFh-oSqt9mQBpMALxbYGUG__t1YLUo7RxUAslsWUc,1416
40
39
  entari_plugin_hyw/utils/misc.py,sha256=_7iHVYj_mJ6OGq6FU1s_cFeS1Ao-neBjZYd6eI2p95U,3482
41
- entari_plugin_hyw/utils/playwright_tool.py,sha256=eSIfur64U8Z5rN0UlZK8qg3vJrGgZZHjhyIId1jSHzs,1507
42
- entari_plugin_hyw/utils/prompts.py,sha256=A2440WZY4fIN6CX-VzOS99xd72OqpHjH2OAcCdMk0JQ,3301
43
- entari_plugin_hyw/utils/search.py,sha256=v9lW18V8rAGneejAiqJ4hCiCy7mIjkRCmR4UuiBqRxY,8048
44
- entari_plugin_hyw-3.2.112.dist-info/METADATA,sha256=DHwwuEwVdE0wsHOEAnw9lvCDmJWYrab_K9LFeEessUg,4697
45
- entari_plugin_hyw-3.2.112.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
- entari_plugin_hyw-3.2.112.dist-info/top_level.txt,sha256=TIDsn6XPs6KA5e3ezsE65JoXsy03ejDdrB41I4SPjmo,18
47
- entari_plugin_hyw-3.2.112.dist-info/RECORD,,
40
+ entari_plugin_hyw/utils/playwright_tool.py,sha256=ZZNkzFtUt_Gxny3Od4boBAgNF9J0N84uySatzn1Bwe4,1272
41
+ entari_plugin_hyw/utils/prompts.py,sha256=5ijz_4imSKJh-EBJJyyInSx-G-6NxqGbnfRHTcHAh9I,3530
42
+ entari_plugin_hyw/utils/search.py,sha256=uXDnyEq6SKytRfqbJRYxJHCaGTM-ZvvRodSYihZf5Es,9460
43
+ entari_plugin_hyw-3.3.0.dist-info/METADATA,sha256=ZSRZYnrQjyWDd_T5tsZt7P5GcI4x3zOiBFu2nwWQojE,4646
44
+ entari_plugin_hyw-3.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
45
+ entari_plugin_hyw-3.3.0.dist-info/top_level.txt,sha256=TIDsn6XPs6KA5e3ezsE65JoXsy03ejDdrB41I4SPjmo,18
46
+ entari_plugin_hyw-3.3.0.dist-info/RECORD,,
@@ -1,128 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from contextlib import AsyncExitStack, asynccontextmanager
4
- from typing import Any, AsyncIterator, Dict, List, Optional, Tuple
5
-
6
- import anyio
7
- from mcp.client.session import ClientSession
8
- from mcp.client.stdio import StdioServerParameters, stdio_client
9
-
10
-
11
- class MCPPlaywright:
12
- def __init__(
13
- self,
14
- command: str = "npx",
15
- args: Optional[List[str]] = None,
16
- env: Optional[Dict[str, str]] = None,
17
- cwd: Optional[str] = None,
18
- ):
19
- self.command = command
20
- self.args = args or ["-y", "@playwright/mcp@latest"]
21
- self.env = env
22
- self.cwd = cwd
23
-
24
- @asynccontextmanager
25
- async def connect(self) -> AsyncIterator[ClientSession]:
26
- server = StdioServerParameters(command=self.command, args=self.args, env=self.env, cwd=self.cwd)
27
- async with stdio_client(server) as (read, write):
28
- async with ClientSession(read, write) as session:
29
- await session.initialize()
30
- yield session
31
-
32
- @staticmethod
33
- def mcp_tools_to_openai(tools: Any) -> List[Dict[str, Any]]:
34
- openai_tools: List[Dict[str, Any]] = []
35
- for t in tools.tools:
36
- schema = dict(getattr(t, "inputSchema", None) or {"type": "object", "properties": {}})
37
- schema.pop("$schema", None)
38
- openai_tools.append(
39
- {
40
- "type": "function",
41
- "function": {
42
- "name": t.name,
43
- "description": t.description or "",
44
- "parameters": schema,
45
- },
46
- }
47
- )
48
- return openai_tools
49
-
50
- @staticmethod
51
- def call_result_to_text(result: Any) -> str:
52
- if result is None:
53
- return ""
54
- # MCP CallToolResult.content is typically a list of TextContent items
55
- content = getattr(result, "content", None)
56
- if isinstance(content, list):
57
- parts: List[str] = []
58
- for item in content:
59
- text = getattr(item, "text", None)
60
- if text is not None:
61
- parts.append(str(text))
62
- else:
63
- parts.append(str(item))
64
- return "\n".join(parts).strip()
65
- return str(result)
66
-
67
-
68
- class MCPPlaywrightManager:
69
- def __init__(
70
- self,
71
- command: str = "npx",
72
- args: Optional[List[str]] = None,
73
- env: Optional[Dict[str, str]] = None,
74
- cwd: Optional[str] = None,
75
- ):
76
- self._client = MCPPlaywright(command=command, args=args, env=env, cwd=cwd)
77
- self._lock = anyio.Lock()
78
- self._stack: Optional[AsyncExitStack] = None
79
- self._session: Optional[ClientSession] = None
80
- self._tools_openai: Optional[List[Dict[str, Any]]] = None
81
-
82
- async def ensure_connected(self) -> bool:
83
- async with self._lock:
84
- if self._session is not None:
85
- return True
86
-
87
- stack = AsyncExitStack()
88
- try:
89
- server = StdioServerParameters(
90
- command=self._client.command, args=self._client.args, env=self._client.env, cwd=self._client.cwd
91
- )
92
- read, write = await stack.enter_async_context(stdio_client(server))
93
- session = await stack.enter_async_context(ClientSession(read, write))
94
- await session.initialize()
95
-
96
- tools = await session.list_tools()
97
- self._tools_openai = MCPPlaywright.mcp_tools_to_openai(tools)
98
-
99
- self._stack = stack
100
- self._session = session
101
- return True
102
- except Exception:
103
- await stack.aclose()
104
- self._stack = None
105
- self._session = None
106
- self._tools_openai = None
107
- return False
108
-
109
- async def tools_openai(self) -> List[Dict[str, Any]]:
110
- ok = await self.ensure_connected()
111
- if not ok or self._tools_openai is None:
112
- return []
113
- return self._tools_openai
114
-
115
- async def call_tool_text(self, name: str, arguments: Optional[Dict[str, Any]] = None) -> str:
116
- ok = await self.ensure_connected()
117
- if not ok or self._session is None:
118
- return "Error: Playwright MCP is not connected."
119
- result = await self._session.call_tool(name, arguments or {})
120
- return MCPPlaywright.call_result_to_text(result)
121
-
122
- async def close(self):
123
- async with self._lock:
124
- if self._stack is not None:
125
- await self._stack.aclose()
126
- self._stack = None
127
- self._session = None
128
- self._tools_openai = None