MCPcopy Create free account
hub / github.com/idank/explainshell / _jsonl_response

Function _jsonl_response

tests/extraction/llm/test_codex_provider.py:24–38  ·  view source on GitHub ↗

Return a bash snippet that emits JSONL events mimicking codex output.

(text: str, input_tokens: int = 0, output_tokens: int = 0)

Source from the content-addressed store, hash-verified

22
23
24def _jsonl_response(text: str, input_tokens: int = 0, output_tokens: int = 0) -> str:
25 """Return a bash snippet that emits JSONL events mimicking codex output."""
26 item_event = json.dumps(
27 {
28 "type": "item.completed",
29 "item": {"id": "item_0", "type": "agent_message", "text": text},
30 }
31 )
32 usage_event = json.dumps(
33 {
34 "type": "turn.completed",
35 "usage": {"input_tokens": input_tokens, "output_tokens": output_tokens},
36 }
37 )
38 return f"echo '{item_event}'\necho '{usage_event}'\n"
39
40
41class TestParseJsonl(unittest.TestCase):

Calls

no outgoing calls

Tested by

no test coverage detected