Files
gemini-cli/packages/sdk/test-data/hook-model-test.json
Michael Bleigh c7866e6a92 feat(sdk): implement runtime hooks support in GeminiCliAgent
- Introduced a new Hook type and hook() helper for strongly-typed SDK hooks.
- Integrated runtime hooks into GeminiCliSession lifecycle (startup, close, and tool execution).
- Added hooks option to GeminiCliAgentOptions.
- Exported executeToolWithHooks from core to facilitate SDK integration.
- Updated SDK_DESIGN.md to reflect implemented features and remaining tasks.
- Added and re-recorded SDK integration tests for hooks.
2026-02-25 13:44:16 -08:00

12 lines
8.4 KiB
JSON

{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"b":3,"a":5}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7237,"candidatesTokenCount":5,"totalTokenCount":7242,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7237}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":5}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"text":" encountered an error while trying to add the numbers. I will try a different approach using"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"text":" the `run_shell_command` tool.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10157,"totalTokenCount":10157,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10157}]}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"run_shell_command","args":{"command":"echo $((5+3))","description":"Adding 5 and 3 using bash."}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7259,"candidatesTokenCount":51,"totalTokenCount":7310,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7259}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":51}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10251,"totalTokenCount":10251,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10251}]}},{"candidates":[{"content":{"parts":[{"text":" still unable to perform this calculation. I will ask the user for assistance. I"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10251,"totalTokenCount":10251,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10251}]}},{"candidates":[{"content":{"parts":[{"text":" am unable to add these numbers, can you confirm that the `add` tool is functioning"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10251,"totalTokenCount":10251,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10251}]}},{"candidates":[{"content":{"parts":[{"text":" correctly?\n"}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7331,"candidatesTokenCount":39,"totalTokenCount":7370,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7331}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":39}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"b":3,"a":5}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7248,"candidatesTokenCount":5,"totalTokenCount":7253,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7248}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":5}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10168,"totalTokenCount":10168,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10168}]}},{"candidates":[{"content":{"parts":[{"text":" encountered an error when trying to add the numbers. I will try again.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10168,"totalTokenCount":10168,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10168}]}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"b":3,"a":5}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7270,"candidatesTokenCount":22,"totalTokenCount":7292,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7270}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":22}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am still encountering"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10230,"totalTokenCount":10230,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10230}]}},{"candidates":[{"content":{"parts":[{"text":" an error when trying to add the numbers. I will try a different approach.\n"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10230,"totalTokenCount":10230,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10230}]}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"b":3,"a":5}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7309,"candidatesTokenCount":26,"totalTokenCount":7335,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7309}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":26}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I am still encountering"}],"role":"model"}}],"usageMetadata":{"promptTokenCount":10296,"totalTokenCount":10296,"promptTokensDetails":[{"modality":"TEXT","tokenCount":10296}]}},{"candidates":[{"content":{"parts":[{"text":" errors. I am unable to fulfill the request."}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7352,"candidatesTokenCount":14,"totalTokenCount":7366,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7352}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":14}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"a":5,"b":3}}}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7248,"candidatesTokenCount":5,"totalTokenCount":7253,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7248}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":5}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"8"}],"role":"model"},"finishReason":"STOP"}],"usageMetadata":{"promptTokenCount":7256,"candidatesTokenCount":1,"totalTokenCount":7257,"promptTokensDetails":[{"modality":"TEXT","tokenCount":7256}],"candidatesTokensDetails":[{"modality":"TEXT","tokenCount":1}]}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"I will calculate the sum of 5 and 3"}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":11,"totalTokenCount":8874,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":54}},{"candidates":[{"content":{"parts":[{"text":".\n"}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":13,"totalTokenCount":8876,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":54}},{"candidates":[{"content":{"parts":[{"functionCall":{"name":"add","args":{"a":5,"b":3}},"thoughtSignature":"EpkCCpYCAb4+9vsvFfIrjchIYDs5FsTIofF1pKHBZJF2jQq8kq3MoYofuLF1wuaavEeeuqWueql+d60qSjF5t7TKFpi19BvMezCSa9JoTH+2jjmx/ibz1XytKVy9txIUx9RisXQYpEWXJf6wBtkPQ0dqu0EHlX3083JZBOrF0lFKZPK70wh2FqSlY+AfI4Ha1pTr75UQKbwtoqDbGmU4jlr4zbKMLMYi47sTBzfjzATqNb/s4zIZTIF+JT4LANzunycFLoM2+gwHDNj9bx5zJ0xXs8EvhaliPpXVkbBxtp3b3RwvWMnmWVLn81I1Uy/1TUPGOlpy11z8B0WtLMZhZ0JaqXANV78hltEsaAnuix/gArCpCZBRO8O78wY="}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":29,"totalTokenCount":8892,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":54}},{"candidates":[{"content":{"parts":[{"text":""}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":8809,"candidatesTokenCount":29,"totalTokenCount":8892,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8809}],"thoughtsTokenCount":54}}]}
{"method":"generateContentStream","response":[{"candidates":[{"content":{"parts":[{"text":"5 + 3 is 8."}],"role":"model"},"index":0}],"usageMetadata":{"promptTokenCount":8850,"candidatesTokenCount":8,"totalTokenCount":8874,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8850}],"thoughtsTokenCount":16}},{"candidates":[{"content":{"parts":[{"text":"","thoughtSignature":"EoUBCoIBAb4+9vtGiAeGV6qWtaWuie7UdX/hoOMU0GOrnD1ss0nh01wgo6rD3SXKOCyrh1+uBVe1RV1IGK+4EbmNnOd2A0F6ULVt/+NdXEKA94i88CQuPi00VwWyAcAEstNOKiRdD6SWEi2CK3WUkuG/aUxD0XCyvITwXwQRcWbXZuyq76u0UA=="}],"role":"model"},"finishReason":"STOP","index":0}],"usageMetadata":{"promptTokenCount":8904,"candidatesTokenCount":8,"totalTokenCount":8928,"promptTokensDetails":[{"modality":"TEXT","tokenCount":8904}],"thoughtsTokenCount":16}}]}