agents-relay 1.0.11 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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.strip() in turns[-1]["text"]:
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")
@@ -144,14 +148,17 @@ else:
144
148
  attachments = _upload_files(CFG.get("file", []))
145
149
  selector = _composer()
146
150
  before_count = len(_user_turns())
147
- info = js(f"""(() => {{
148
- const e=document.querySelector({json.dumps(selector)});
149
- const r=e.getBoundingClientRect();
150
- return {{x:r.x+r.width/2,y:r.y+r.height/2}};
151
- }})()""")
152
- click_at_xy(info["x"], info["y"])
153
- type_text(CFG["prompt"])
151
+ fill_input(selector, CFG["prompt"], clear_first=True)
154
152
  if CFG["prompt"].strip() not in _composer_text(selector):
153
+ info = js(f"""(() => {{
154
+ const e=document.querySelector({json.dumps(selector)});
155
+ const r=e.getBoundingClientRect();
156
+ return {{x:r.x+r.width/2,y:r.y+r.height/2}};
157
+ }})()""")
158
+ click_at_xy(info["x"], info["y"])
159
+ press_key("CTRL+A")
160
+ type_text(CFG["prompt"])
161
+ if _normalized_text(CFG["prompt"]) not in _normalized_text(_composer_text(selector)):
155
162
  raise RuntimeError("Temporary Chat prompt was not observed in the composer")
156
163
 
157
164
  _click_send()