mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-18 22:10:52 -07:00
ea19aeb14b
Implements the AgentSession interface for gemini-cli's agentic loop: - LegacyAgentSession owns send/stream/abort with multi-turn tool scheduling - Event translator maps all GeminiEventType variants to AgentEvents - nonInteractiveCli.ts consumes session.stream() instead of manual loop - Removes dead LocalAgentSessionShim (superseded by LegacyAgentSession) - 94 tests (68 event-translator + 26 integration/consumer contract)
35 lines
2.6 KiB
Plaintext
35 lines
2.6 KiB
Plaintext
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
|
|
exports[`runNonInteractive > should emit appropriate error event in streaming JSON mode: 'loop detected' 1`] = `
|
|
"{"type":"init","timestamp":"<TIMESTAMP>","session_id":"test-session-id","model":"test-model"}
|
|
{"type":"message","timestamp":"<TIMESTAMP>","role":"user","content":"Loop test"}
|
|
{"type":"result","timestamp":"<TIMESTAMP>","status":"error","error":{"type":"Error","message":"[API Error: Loop detected]"},"stats":{"total_tokens":0,"input_tokens":0,"output_tokens":0,"cached":0,"input":0,"duration_ms":<DURATION>,"tool_calls":0,"models":{}}}
|
|
"
|
|
`;
|
|
|
|
exports[`runNonInteractive > should emit appropriate error event in streaming JSON mode: 'max session turns' 1`] = `
|
|
"{"type":"init","timestamp":"<TIMESTAMP>","session_id":"test-session-id","model":"test-model"}
|
|
{"type":"message","timestamp":"<TIMESTAMP>","role":"user","content":"Max turns test"}
|
|
{"type":"result","timestamp":"<TIMESTAMP>","status":"error","error":{"type":"FatalTurnLimitedError","message":"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."},"stats":{"total_tokens":0,"input_tokens":0,"output_tokens":0,"cached":0,"input":0,"duration_ms":<DURATION>,"tool_calls":0,"models":{}}}
|
|
{"type":"result","timestamp":"<TIMESTAMP>","status":"error","error":{"type":"Error","message":"[API Error: process.exit(53) called]"},"stats":{"total_tokens":0,"input_tokens":0,"output_tokens":0,"cached":0,"input":0,"duration_ms":<DURATION>,"tool_calls":0,"models":{}}}
|
|
"
|
|
`;
|
|
|
|
exports[`runNonInteractive > should emit appropriate events for streaming JSON output 1`] = `
|
|
"{"type":"init","timestamp":"<TIMESTAMP>","session_id":"test-session-id","model":"test-model"}
|
|
{"type":"message","timestamp":"<TIMESTAMP>","role":"user","content":"Stream test"}
|
|
{"type":"message","timestamp":"<TIMESTAMP>","role":"assistant","content":"Thinking...","delta":true}
|
|
{"type":"tool_use","timestamp":"<TIMESTAMP>","tool_name":"testTool","tool_id":"tool-1","parameters":{"arg1":"value1"}}
|
|
{"type":"tool_result","timestamp":"<TIMESTAMP>","tool_id":"tool-1","status":"success","output":"Tool executed successfully"}
|
|
{"type":"message","timestamp":"<TIMESTAMP>","role":"assistant","content":"Final answer","delta":true}
|
|
{"type":"result","timestamp":"<TIMESTAMP>","status":"success","stats":{"total_tokens":0,"input_tokens":0,"output_tokens":0,"cached":0,"input":0,"duration_ms":<DURATION>,"tool_calls":0,"models":{}}}
|
|
"
|
|
`;
|
|
|
|
exports[`runNonInteractive > should write a single newline between sequential text outputs from the model 1`] = `
|
|
"Use mock tool
|
|
Use mock tool again
|
|
Finished.
|
|
"
|
|
`;
|