defcheck(self, command: str) -> bool: disabled = [c.strip() for c inself._disable_list.split(",") if c.strip()]
for pattern in disabled: if pattern == "*": returnFalse if pattern.startswith("*") and command.endswith(pattern[1:]): returnFalse if pattern.endswith("*") and command.startswith(pattern[:-1]): returnFalse if command == pattern: returnFalse
defcheck_debounce(self) -> bool: now = time.time() if now < self._debounce_until: returnFalse self._debounce_until = now + self.debounce_seconds returnTrue
node_to_condition = {} for cond in rule.conditions: node_id = cond.config.get("_node_id") if cond.config elseNone if node_id: node_to_condition[node_id] = cond.condition_id
node_to_action = {} for action in rule.actions: node_id = action.config.get("_node_id") if action.config elseNone if node_id: node_to_action[node_id] = action.action_id
for conn in connections: from_node = conn.get('source') from_output = conn.get('sourceOutput') to_node = conn.get('target')
if from_node in condition_node_set and to_node in action_node_set: backend_action_id = node_to_action[to_node] backend_condition_id = node_to_condition[from_node] for action in rule.actions: if action.action_id == backend_action_id: action.config["_condition_branch"] = { "condition_id": backend_condition_id, "output": from_output, }
@dataclass classEpisodeCandidate: checkpoint_path: Path seed: int records: list total_reward: float terminal_score: float invalid_actions: int clear_rank: int
for item in ocr_result.results: iflen(item.text) >= 3: status, db_result = database.search(item.text) if status and db_result: return db_result.id returnNone
raw_content = getattr(chunk, "content", None) ifisinstance(raw_content, list): for block in raw_content: ifnotisinstance(block, dict): continue block_type = str(block.get("type", "")).lower() if block_type in {"reasoning", "thinking", "reasoning_content"}: text = cls._extract_reasoning_text(block) if text: thinking_parts.append(text)
for container in ( getattr(chunk, "additional_kwargs", None), getattr(chunk, "response_metadata", None), ): ifnotisinstance(container, dict): continue for key in ("reasoning_content", "thinking", "reasoning"): if key in container: text = cls._extract_reasoning_text(container.get(key)) if text: thinking_parts.append(text)
classAgentState(TypedDict): tool_calls_made: int tool_failure_streak: int last_failed_tool: Optional[str] last_tool_error: Optional[str] forced_tool_rounds: int