Mercurial
comparison mrjunejune/inference/mock_sidecar_test.py @ 265:056790c4fb0d
add role-aware Epi assistant prompts
Add verified June knowledge, guest/member/admin Copilot profiles, profile-isolated session recovery, animated Epi greetings, and a single authoritative runtime config workflow for inference.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 10:50:30 -0700 |
| parents | b401627fc49e |
| children |
comparison
equal
deleted
inserted
replaced
| 264:04fee26ecce0 | 265:056790c4fb0d |
|---|---|
| 126 { | 126 { |
| 127 "command": "turn.start", | 127 "command": "turn.start", |
| 128 "request_id": "request-1", | 128 "request_id": "request-1", |
| 129 "conversation_id": "conversation-1", | 129 "conversation_id": "conversation-1", |
| 130 "prompt": "!hello", | 130 "prompt": "!hello", |
| 131 "prompt_profile": "public_visitor", | |
| 132 "prompt_version": 1, | |
| 133 "knowledge_version": 1, | |
| 131 } | 134 } |
| 132 ) | 135 ) |
| 133 await self.sidecar.wait_for_idle() | 136 await self.sidecar.wait_for_idle() |
| 134 | 137 |
| 135 self.assertEqual( | 138 self.assertEqual( |
| 153 if event["type"] == "assistant.completed" | 156 if event["type"] == "assistant.completed" |
| 154 ) | 157 ) |
| 155 self.assertEqual(deltas, completed) | 158 self.assertEqual(deltas, completed) |
| 156 self.assertEqual(self.events[-1]["mock_command"], "!hello") | 159 self.assertEqual(self.events[-1]["mock_command"], "!hello") |
| 157 | 160 |
| 161 async def test_turn_rejects_missing_prompt_profile(self): | |
| 162 await self.sidecar.dispatch( | |
| 163 { | |
| 164 "command": "turn.start", | |
| 165 "request_id": "request-missing-profile", | |
| 166 "conversation_id": "conversation-missing-profile", | |
| 167 "prompt": "!hello", | |
| 168 } | |
| 169 ) | |
| 170 self.assertEqual( | |
| 171 [item["type"] for item in self.events], | |
| 172 ["turn.error", "turn.done"], | |
| 173 ) | |
| 174 self.assertEqual( | |
| 175 self.events[0]["error"]["code"], | |
| 176 "invalid_prompt_profile", | |
| 177 ) | |
| 178 | |
| 158 async def test_tool_command_preserves_custom_event_payloads(self): | 179 async def test_tool_command_preserves_custom_event_payloads(self): |
| 159 await self.sidecar.dispatch( | 180 await self.sidecar.dispatch( |
| 160 { | 181 { |
| 161 "command": "turn.start", | 182 "command": "turn.start", |
| 162 "request_id": "request-2", | 183 "request_id": "request-2", |
| 163 "conversation_id": "conversation-2", | 184 "conversation_id": "conversation-2", |
| 164 "prompt": "!tool", | 185 "prompt": "!tool", |
| 186 "prompt_profile": "invited_friend", | |
| 187 "prompt_version": 1, | |
| 188 "knowledge_version": 1, | |
| 165 } | 189 } |
| 166 ) | 190 ) |
| 167 await self.sidecar.wait_for_idle() | 191 await self.sidecar.wait_for_idle() |
| 168 | 192 |
| 169 started = next( | 193 started = next( |
| 180 { | 204 { |
| 181 "command": "turn.start", | 205 "command": "turn.start", |
| 182 "request_id": "request-3", | 206 "request_id": "request-3", |
| 183 "conversation_id": "conversation-3", | 207 "conversation_id": "conversation-3", |
| 184 "prompt": "!error", | 208 "prompt": "!error", |
| 209 "prompt_profile": "june_admin", | |
| 210 "prompt_version": 1, | |
| 211 "knowledge_version": 1, | |
| 185 } | 212 } |
| 186 ) | 213 ) |
| 187 await self.sidecar.wait_for_idle() | 214 await self.sidecar.wait_for_idle() |
| 188 | 215 |
| 189 self.assertEqual( | 216 self.assertEqual( |
| 202 { | 229 { |
| 203 "command": "turn.start", | 230 "command": "turn.start", |
| 204 "request_id": "request-4", | 231 "request_id": "request-4", |
| 205 "conversation_id": "conversation-4", | 232 "conversation_id": "conversation-4", |
| 206 "prompt": "!response", | 233 "prompt": "!response", |
| 234 "prompt_profile": "public_visitor", | |
| 235 "prompt_version": 1, | |
| 236 "knowledge_version": 1, | |
| 207 } | 237 } |
| 208 ) | 238 ) |
| 209 await asyncio.sleep(0.01) | 239 await asyncio.sleep(0.01) |
| 210 await self.sidecar.dispatch( | 240 await self.sidecar.dispatch( |
| 211 { | 241 { |