(self, project: str, is_active: bool)
| 107 | return None |
| 108 | |
| 109 | def set_agent_active(self, project: str, is_active: bool): |
| 110 | with Session(self.engine) as session: |
| 111 | agent_state = session.query(AgentStateModel).filter(AgentStateModel.project == project).first() |
| 112 | if agent_state: |
| 113 | state_stack = json.loads(agent_state.state_stack_json) |
| 114 | state_stack[-1]["agent_is_active"] = is_active |
| 115 | agent_state.state_stack_json = json.dumps(state_stack) |
| 116 | session.commit() |
| 117 | else: |
| 118 | state_stack = [self.new_state()] |
| 119 | state_stack[-1]["agent_is_active"] = is_active |
| 120 | agent_state = AgentStateModel(project=project, state_stack_json=json.dumps(state_stack)) |
| 121 | session.add(agent_state) |
| 122 | session.commit() |
| 123 | emit_agent("agent-state", state_stack) |
| 124 | |
| 125 | def is_agent_active(self, project: str): |
| 126 | with Session(self.engine) as session: |
no test coverage detected