agents-relay 1.0.12 → 1.0.13
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.
package/package.json
CHANGED
|
@@ -55,6 +55,10 @@ def _composer_text(selector):
|
|
|
55
55
|
}})()""") or ""
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
def _normalized_text(value):
|
|
59
|
+
return re.sub(r"\s+", " ", value or "").strip()
|
|
60
|
+
|
|
61
|
+
|
|
58
62
|
def _attachment_names():
|
|
59
63
|
return js(r"""(() => [...document.querySelectorAll('button[aria-label^="Remove file"]')]
|
|
60
64
|
.map(b => (b.getAttribute('aria-label') || '').replace(/^Remove file\s+\d+:\s*/, ''))
|
|
@@ -104,7 +108,7 @@ def _wait_user_turn(before_count, prompt, timeout=20):
|
|
|
104
108
|
deadline = time.time() + timeout
|
|
105
109
|
while time.time() < deadline:
|
|
106
110
|
turns = _user_turns()
|
|
107
|
-
if len(turns) > before_count and prompt
|
|
111
|
+
if len(turns) > before_count and _normalized_text(prompt) in _normalized_text(turns[-1]["text"]):
|
|
108
112
|
return turns[-1]
|
|
109
113
|
time.sleep(.25)
|
|
110
114
|
raise RuntimeError("Temporary Chat prompt did not become an observed user turn")
|
|
@@ -154,7 +158,7 @@ if CFG["prompt"].strip() not in _composer_text(selector):
|
|
|
154
158
|
click_at_xy(info["x"], info["y"])
|
|
155
159
|
press_key("CTRL+A")
|
|
156
160
|
type_text(CFG["prompt"])
|
|
157
|
-
if CFG["prompt"]
|
|
161
|
+
if _normalized_text(CFG["prompt"]) not in _normalized_text(_composer_text(selector)):
|
|
158
162
|
raise RuntimeError("Temporary Chat prompt was not observed in the composer")
|
|
159
163
|
|
|
160
164
|
_click_send()
|