Initial Agentsd project commit
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
29
plugins/claudecode/test_chat.py
Normal file
29
plugins/claudecode/test_chat.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""Quick test: call Claude Code plugin's chat export."""
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "_sdk"))
|
||||
|
||||
import grpc
|
||||
import agentsd_pb2 as pb
|
||||
import agentsd_pb2_grpc as rpc
|
||||
|
||||
|
||||
def main():
|
||||
# Connect to claudecode plugin's callback server
|
||||
channel = grpc.insecure_channel("localhost:50053")
|
||||
bridge = rpc.PluginBridgeStub(channel)
|
||||
|
||||
# Call "chat"
|
||||
args = json.dumps({"prompt": "What is 2+2? Reply with just the number."}).encode()
|
||||
resp = bridge.Call(pb.CallRequest(target="claudecode", fn="chat", args=args))
|
||||
print(f"ok={resp.ok}")
|
||||
if resp.result:
|
||||
result = json.loads(resp.result)
|
||||
print(f"result: {result.get('result', result.get('error', ''))}")
|
||||
channel.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user