browser-assistant 2.9.34 → 2.9.35

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Browser Assistant",
4
- "version": "2.9.34",
4
+ "version": "2.9.35",
5
5
  "description": "Scans webpages for MCQs and coding problems. Powered by Groq (cloud) and Ollama (local fallback).",
6
6
  "permissions": [
7
7
  "activeTab",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-assistant",
3
- "version": "2.9.34",
3
+ "version": "2.9.35",
4
4
  "description": "Chrome extension and local Python backend for exploring webpage questions and coding exercises",
5
5
  "license": "MIT",
6
6
  "repository": {
package/server/main.py CHANGED
@@ -28,7 +28,7 @@ from vision_images import (compress_image_base64, unique_image_blocks, collect_i
28
28
  cross_check_visual_answers, relative_percentage_question, RELATIVE_PERCENTAGE_INSTRUCTION,
29
29
  answer_permutation, cross_check_text_answers, solve_matrix_choice, solve_row_parallel_choice,
30
30
  solve_relu_parallel_choice,
31
- ordering_question, solve_sorted_list_merge_order, solve_stack_empty_order, solve_pseudocode_choice,
31
+ ordering_question, solve_sorted_list_merge_order, solve_stack_empty_order,
32
32
  solve_stack_push_order, solve_stack_pop_order, solve_next_greater_element_order,
33
33
  multiple_choice_question, solve_linked_stack_choices, cross_check_multiple_choice, stack_reasoning_guidance,
34
34
  reading_response_constraints, free_response_question,
@@ -195,7 +195,7 @@ async def lifespan(_app: FastAPI):
195
195
  client.close()
196
196
 
197
197
 
198
- app = FastAPI(title="Browser Assistant API", version="2.9.34", lifespan=lifespan)
198
+ app = FastAPI(title="Browser Assistant API", version="2.9.35", lifespan=lifespan)
199
199
  install_local_guards(app)
200
200
 
201
201
  @app.exception_handler(HTTPException)
@@ -1327,9 +1327,6 @@ def local_choice_result(text, language):
1327
1327
  if item is None:
1328
1328
  item = solve_relu_parallel_choice(text)
1329
1329
  provider = "local ReLU shard check"
1330
- if item is None:
1331
- item = solve_pseudocode_choice(text)
1332
- provider = "local pseudocode check"
1333
1330
  if item is not None:
1334
1331
  return {"results": json.dumps([item], ensure_ascii=False), "provider": f"{provider} [verified]",
1335
1332
  "language": language, "answer_verified": True, "code_reviewed": False}
@@ -645,52 +645,6 @@ def solve_linked_stack_choices(question):
645
645
  return {'type': 'mcq', 'question': prompt, 'answer': _format_choice_set(choices, selected), 'reasoning': reasoning}
646
646
 
647
647
 
648
- def solve_pseudocode_choice(text):
649
- choices = displayed_single_choices(text)
650
- if not choices:
651
- return None
652
- prompt = re.split(r'\n(?:Question format: )?Select one answer\.', text.strip(), maxsplit=1, flags=re.I)[0]
653
- initial = re.search(r'\binitial value of the\s+\x60?([a-zA-Z_]\w*)\x60?\s+node\s*\?', prompt, re.I)
654
- if initial:
655
- variable = re.escape(initial[1])
656
- constructors = re.findall(rf'^\s*{variable}\s*=\s*new\s+Node\s*\(\s*(-?\d+)\s*\)\s*;?\s*$',
657
- prompt, re.M)
658
- if len(constructors) != 1:
659
- return None
660
- expected = constructors[0]
661
- reason = f'The pseudocode initializes {initial[1]} with new Node({expected}).'
662
- matches = [(letter, option) for letter, option in choices.items()
663
- if option.strip().strip('\x60').replace('−', '-') == expected]
664
- elif re.search(r'time complexity of the below pseudo\s*code where size of linked list', prompt, re.I):
665
- loop = re.search(r'while\s*\(\s*(\w+)\s*!=\s*null\s*\|\|\s*(\w+)\s*!=\s*null\s*\)', prompt)
666
- if not loop or len(re.findall(r'\b(?:while|for)\s*\(', prompt)) != 1:
667
- return None
668
- first, second = loop.groups()
669
- if first == second or not all(re.search(rf'if\s*\(\s*{re.escape(pointer)}\s*!=\s*null\s*\)' r'[^}]*?'
670
- rf'\b{re.escape(pointer)}\s*=\s*{re.escape(pointer)}\s*->\s*next\b',
671
- prompt[loop.end():]) for pointer in (first, second)):
672
- return None
673
- matches = [(letter, option) for letter, option in choices.items()
674
- if re.sub(r'\s+', '', option.strip('\x60')) == 'O(max(m,n))']
675
- reason = 'Both available pointers advance in each iteration, so the loop runs until the longer list is exhausted.'
676
- elif 'mergeTwoLists' in prompt and re.search(r'\bwhat happens if\s+temp1\s*(?:->|→)\s*data\s+is less than or equal to\s+'
677
- r'temp2\s*(?:->|→)\s*data', prompt.replace('\x60', ''), re.I):
678
- branch = re.search(r'if\s*\(\s*temp1\s*->\s*data\s*<=\s*temp2\s*->\s*data\s*\)\s*\{([^}]+)\}', prompt)
679
- if not branch or not re.search(r'\bcur\s*->\s*next\s*=\s*temp1?\b', branch[1]) \
680
- or not re.search(r'\btemp1\s*=\s*temp1\s*->\s*next\b', branch[1]):
681
- return None
682
- matches = [(letter, option) for letter, option in choices.items() if re.fullmatch(
683
- r'temp1 is linked to the merged list and temp1 is moved to the next node\.?',
684
- ' '.join(option.replace('\x60', '').split()), re.I)]
685
- reason = 'The <= branch links the first-list node and advances temp1 to temp1->next.'
686
- else:
687
- return None
688
- if len(matches) != 1:
689
- return None
690
- letter, option = matches[0]
691
- return {'type': 'mcq', 'question': prompt, 'answer': f'Option {letter}: {option}', 'reasoning': reason}
692
-
693
-
694
648
  def solve_row_parallel_choice(text):
695
649
  """Check the shared multiplication dimension in a row-parallel linear layer."""
696
650
  choices = displayed_single_choices(text)
@@ -969,20 +923,6 @@ async def cross_check_text_answers(messages, results, complete, *, question_text
969
923
  'role': 'user',
970
924
  'content': 'Solve again using the original question and its context. Return the full verification JSON with the required ids.',
971
925
  }]
972
- # When both independent verifications failed to parse, prefer delivering the
973
- # primary answer over blocking the automation entirely. The primary solve was
974
- # validated and the verification provider returned unusable JSON — a parsing
975
- # failure, not a disagreement — so a hard 422 is disproportionate.
976
- if not require_agreement and not step_count and not free_response and current is None and previous is None:
977
- return results
978
- # For multi-answer questions (fill-in-the-blank), accept the primary answers
979
- # when the majority of individual answers agree with any independent solve.
980
- if not require_agreement and not choices and not step_count and not free_response and first is not None and len(first) > 1:
981
- best = current or previous
982
- if best is not None:
983
- agreed = sum(a == b for a, b in zip(first, best))
984
- if agreed > len(first) // 2:
985
- return results
986
926
  if step_count:
987
927
  raise VisionUnconfirmedError('The independent checks could not confirm a complete order for the displayed steps.')
988
928
  if free_response: