From 019911226cdfbd7ef92f136f51e24fc74b21a353 Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Tue, 11 Aug 2026 21:16:47 -0700 Subject: [PATCH 1/5] Introduction of steps --- cmd/ax/exec.go | 16 +- internal/cmd/e2e/main.go | 4 +- internal/controller/controller.go | 6 +- internal/controller/controller_test.go | 40 +- internal/server/interceptors_test.go | 20 +- internal/server/server.go | 10 +- proto/ax.pb.go | 937 +++++++++++++++++++++++-- proto/ax.proto | 118 +++- proto/ax_grpc.pb.go | 82 +-- python/proto/ax_pb2.py | 70 +- python/proto/ax_pb2_grpc.py | 52 +- python/proto/content_pb2.py | 14 - python/proto/content_pb2_grpc.py | 14 - 13 files changed, 1139 insertions(+), 244 deletions(-) diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go index 07bb118c..60cdca27 100644 --- a/cmd/ax/exec.go +++ b/cmd/ax/exec.go @@ -174,7 +174,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] reqCtx, cancel := context.WithCancel(ctx) interruptHandler.SetActiveCancel(cancel) - conf, err := runAutoExec(reqCtx, d, &proto.ExecRequest{ + conf, err := runAutoExec(reqCtx, d, &proto.CreateInteractionRequest{ ConversationId: id, HarnessId: harnessID, HarnessConfig: harnessConfig, @@ -241,7 +241,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] reqCtx, cancel := context.WithCancel(ctx) interruptHandler.SetActiveCancel(cancel) - conf, err = runAutoExec(reqCtx, d, &proto.ExecRequest{ + conf, err = runAutoExec(reqCtx, d, &proto.CreateInteractionRequest{ ConversationId: id, HarnessId: harnessID, HarnessConfig: harnessConfig, @@ -291,7 +291,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] } } -func runAutoExec(ctx context.Context, d *internal.Display, req *proto.ExecRequest) (*proto.ConfirmationContent, error) { +func runAutoExec(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { fn := runExecHeadless if execServerAddr != "" { fn = runExecServer @@ -299,10 +299,10 @@ func runAutoExec(ctx context.Context, d *internal.Display, req *proto.ExecReques return fn(ctx, d, req) } -func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.ExecRequest) (*proto.ConfirmationContent, error) { +func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { var confirmation *proto.ConfirmationContent var lastStep int32 - outputHandler := cliutil.ExecHandler(func(resp *proto.ExecResponse) error { + outputHandler := cliutil.ExecHandler(func(resp *proto.CreateInteractionResponse) error { for _, m := range resp.Outputs { if conf := m.GetContent().GetConfirmation(); conf != nil { confirmation = conf @@ -322,15 +322,15 @@ func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.ExecRe return confirmation, nil } -func runExecServer(ctx context.Context, d *internal.Display, req *proto.ExecRequest) (*proto.ConfirmationContent, error) { +func runExecServer(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { conn, err := connect(execServerAddr) if err != nil { return nil, err } defer conn.Close() - client := proto.NewExecutionServiceClient(conn) - stream, err := client.Exec(ctx, req) + client := proto.NewInteractionsServiceClient(conn) + stream, err := client.CreateInteraction(ctx, req) if err != nil { return nil, fmt.Errorf("error executing: %w", err) } diff --git a/internal/cmd/e2e/main.go b/internal/cmd/e2e/main.go index 0e48dc6e..c6d21f4b 100644 --- a/internal/cmd/e2e/main.go +++ b/internal/cmd/e2e/main.go @@ -97,7 +97,7 @@ func runDemo(ctx context.Context, harnessID string, setupRegistry func(reg *cont } defer c.Close() - handler := controller.ExecHandler(func(resp *proto.ExecResponse) error { + handler := controller.ExecHandler(func(resp *proto.CreateInteractionResponse) error { for _, out := range resp.Outputs { if textContent := out.GetContent().GetText().GetText(); textContent != "" { fmt.Printf("Agent Output: %s\n", textContent) @@ -119,7 +119,7 @@ func runDemo(ctx context.Context, harnessID string, setupRegistry func(reg *cont }, } - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: "e2e-conv", Inputs: inputs, HarnessId: harnessID, diff --git a/internal/controller/controller.go b/internal/controller/controller.go index ac7a129f..afeeaf2d 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -27,7 +27,7 @@ import ( "google.golang.org/protobuf/types/known/structpb" ) -type ExecHandler func(resp *proto.ExecResponse) error +type ExecHandler func(resp *proto.CreateInteractionResponse) error // Controller is the main controller that coordinates all components. // It acts as a single-writer system for managing agentic loops. @@ -64,7 +64,7 @@ func New(ctx context.Context, cfg Config) (*Controller, error) { // Exec executes a new agentic loop execution or resumes an existing one. // If id is empty, a UUID will be generated. // If the execution already exists, it will be resumed with optional new inputs. -func (d *Controller) Exec(ctx context.Context, req *proto.ExecRequest, handler ExecHandler) error { +func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionRequest, handler ExecHandler) error { if req.ConversationId == "" { return fmt.Errorf("conversation_id is required") } @@ -163,7 +163,7 @@ func (a *harnessHandler) OnMessage(ctx context.Context, execID string, msg *prot if a.execHandler == nil { return nil } - return a.execHandler(&proto.ExecResponse{ + return a.execHandler(&proto.CreateInteractionResponse{ Outputs: []*proto.Message{msg}, Step: step, }) diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.go index 24ab7559..4696d60d 100644 --- a/internal/controller/controller_test.go +++ b/internal/controller/controller_test.go @@ -92,7 +92,7 @@ func TestController2_ExecHelloWorld(t *testing.T) { defer c.Close() var outputs []*proto.Message - handler := ExecHandler(func(resp *proto.ExecResponse) error { + handler := ExecHandler(func(resp *proto.CreateInteractionResponse) error { outputs = append(outputs, resp.Outputs...) return nil }) @@ -108,7 +108,7 @@ func TestController2_ExecHelloWorld(t *testing.T) { }, } - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, Inputs: inputs, }, handler) @@ -193,7 +193,7 @@ func TestController2_ExecWithAgentID(t *testing.T) { defer c.Close() var outputs []*proto.Message - handler := ExecHandler(func(resp *proto.ExecResponse) error { + handler := ExecHandler(func(resp *proto.CreateInteractionResponse) error { outputs = append(outputs, resp.Outputs...) return nil }) @@ -209,7 +209,7 @@ func TestController2_ExecWithAgentID(t *testing.T) { }, } - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "my-agent", Inputs: inputs, @@ -246,7 +246,7 @@ func TestController2_ExecHarnessNotFound(t *testing.T) { } defer c.Close() - handler := ExecHandler(func(resp *proto.ExecResponse) error { + handler := ExecHandler(func(resp *proto.CreateInteractionResponse) error { return nil }) @@ -261,7 +261,7 @@ func TestController2_ExecHarnessNotFound(t *testing.T) { }, } - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, Inputs: inputs, HarnessId: "antigravity", @@ -347,13 +347,13 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "test-agent", Inputs: []*proto.Message{ {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "Hello"}}}}, }, - }, func(resp *proto.ExecResponse) error { return nil }) + }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { t.Fatal(err) } @@ -415,11 +415,11 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "test-agent", Inputs: nil, // NO new inputs - }, func(resp *proto.ExecResponse) error { return nil }) + }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { t.Fatal(err) } @@ -482,13 +482,13 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "test-agent", Inputs: []*proto.Message{ {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "New input"}}}}, }, - }, func(resp *proto.ExecResponse) error { return nil }) + }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { t.Fatal(err) } @@ -552,10 +552,10 @@ func TestExec_ResumeEmptyHarnessUsesStored(t *testing.T) { } defer c.Close() - noop := ExecHandler(func(*proto.ExecResponse) error { return nil }) + noop := ExecHandler(func(*proto.CreateInteractionResponse) error { return nil }) // Turn 1: explicitly run the NON-default harness. - if err := c.Exec(ctx, &proto.ExecRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "harness-b", Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, @@ -565,7 +565,7 @@ func TestExec_ResumeEmptyHarnessUsesStored(t *testing.T) { // Turn 2: resume WITHOUT a harness id. Must reuse harness-b, not the default. before := stored.startCalls - if err := c.Exec(ctx, &proto.ExecRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "more"}}}}}, }, noop); err != nil { @@ -605,16 +605,16 @@ func TestExec_ResumeExplicitDifferentHarnessRejected(t *testing.T) { } defer c.Close() - noop := ExecHandler(func(*proto.ExecResponse) error { return nil }) + noop := ExecHandler(func(*proto.CreateInteractionResponse) error { return nil }) - if err := c.Exec(ctx, &proto.ExecRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "harness-a", Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, }, noop); err != nil { t.Fatalf("turn 1: %v", err) } - err = c.Exec(ctx, &proto.ExecRequest{ + err = c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, HarnessId: "harness-b", Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "more"}}}}}, @@ -649,10 +649,10 @@ func TestExec_NewConversationLogsCanonicalDefault(t *testing.T) { } defer c.Close() - if err := c.Exec(ctx, &proto.ExecRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionRequest{ ConversationId: cid, Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, - }, ExecHandler(func(*proto.ExecResponse) error { return nil })); err != nil { + }, ExecHandler(func(*proto.CreateInteractionResponse) error { return nil })); err != nil { t.Fatalf("exec: %v", err) } _, stored, err := newLogger(log, cid, "").ResumptionState(ctx) diff --git a/internal/server/interceptors_test.go b/internal/server/interceptors_test.go index 0d02e8ee..bf2ed527 100644 --- a/internal/server/interceptors_test.go +++ b/internal/server/interceptors_test.go @@ -45,14 +45,14 @@ func (m *mockConversationServer) DeleteConversation(ctx context.Context, req *pr } type mockExecutionServer struct { - proto.UnimplementedExecutionServiceServer + proto.UnimplementedInteractionsServiceServer } -func (m *mockExecutionServer) Exec(req *proto.ExecRequest, stream proto.ExecutionService_ExecServer) error { +func (m *mockExecutionServer) CreateInteraction(req *proto.CreateInteractionRequest, stream proto.InteractionsService_CreateInteractionServer) error { if req.ConversationId == "fail" { return status.Error(codes.InvalidArgument, "mock error") } - return stream.Send(&proto.ExecResponse{}) + return stream.Send(&proto.CreateInteractionResponse{}) } const bufSize = 1024 * 1024 @@ -65,7 +65,7 @@ func setupTestServer(t *testing.T) (*grpc.ClientConn, func()) { ) proto.RegisterConversationServiceServer(s, &mockConversationServer{}) - proto.RegisterExecutionServiceServer(s, &mockExecutionServer{}) + proto.RegisterInteractionsServiceServer(s, &mockExecutionServer{}) go func() { if err := s.Serve(lis); err != nil && err != grpc.ErrServerStopped { @@ -114,7 +114,7 @@ func TestLoggingInterceptors(t *testing.T) { defer slog.SetDefault(oldLogger) convClient := proto.NewConversationServiceClient(conn) - executionClient := proto.NewExecutionServiceClient(conn) + executionClient := proto.NewInteractionsServiceClient(conn) t.Run("Unary Success", func(t *testing.T) { logBuf.Reset() @@ -177,9 +177,9 @@ func TestLoggingInterceptors(t *testing.T) { t.Run("Stream Success", func(t *testing.T) { logBuf.Reset() ctx := context.Background() - stream, err := executionClient.Exec(ctx, &proto.ExecRequest{ConversationId: "conv-456"}) + stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionRequest{ConversationId: "conv-456"}) if err != nil { - t.Fatalf("Exec stream init failed: %v", err) + t.Fatalf("CreateInteraction stream init failed: %v", err) } // Consume stream @@ -202,8 +202,8 @@ func TestLoggingInterceptors(t *testing.T) { if entries[0].Msg != "Handling stream request" { t.Errorf("Expected start log msg 'Handling stream request', got %q", entries[0].Msg) } - if entries[0].Method != "/ax.ExecutionService/Exec" { - t.Errorf("Expected method '/ax.ExecutionService/Exec', got %q", entries[0].Method) + if entries[0].Method != "/ax.InteractionsService/CreateInteraction" { + t.Errorf("Expected method '/ax.InteractionsService/CreateInteraction', got %q", entries[0].Method) } // Verify End Log @@ -218,7 +218,7 @@ func TestLoggingInterceptors(t *testing.T) { t.Run("Stream Failure", func(t *testing.T) { logBuf.Reset() ctx := context.Background() - stream, err := executionClient.Exec(ctx, &proto.ExecRequest{ConversationId: "fail"}) + stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionRequest{ConversationId: "fail"}) if err != nil { t.Fatalf("Exec stream init failed: %v", err) } diff --git a/internal/server/server.go b/internal/server/server.go index 267460ff..e5cca671 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -37,7 +37,7 @@ import ( // Server implements the AXService gRPC service. type Server struct { - proto.UnimplementedExecutionServiceServer + proto.UnimplementedInteractionsServiceServer proto.UnimplementedConversationServiceServer controller *controller.Controller @@ -54,8 +54,8 @@ func New(c *controller.Controller) *Server { } } -// Exec executes a new agentic task with streaming responses. -func (s *Server) Exec(req *proto.ExecRequest, stream grpc.ServerStreamingServer[proto.ExecResponse]) error { +// CreateInteraction executes a new agentic task with streaming responses. +func (s *Server) CreateInteraction(req *proto.CreateInteractionRequest, stream grpc.ServerStreamingServer[proto.CreateInteractionResponse]) error { ctx := stream.Context() slog.InfoContext(ctx, "Executing request", slog.String("request", req.String()), @@ -67,7 +67,7 @@ func (s *Server) Exec(req *proto.ExecRequest, stream grpc.ServerStreamingServer[ } defer cleanup() - outputHandler := controller.ExecHandler(func(resp *proto.ExecResponse) error { + outputHandler := controller.ExecHandler(func(resp *proto.CreateInteractionResponse) error { return stream.Send(resp) }) return s.controller.Exec(ctx, req, outputHandler) @@ -107,7 +107,7 @@ func (s *Server) Serve(address string, opts ...grpc.ServerOption) error { ) s.grpcServer = grpc.NewServer(opts...) - proto.RegisterExecutionServiceServer(s.grpcServer, s) + proto.RegisterInteractionsServiceServer(s.grpcServer, s) proto.RegisterConversationServiceServer(s.grpcServer, s) // Register standard gRPC Health Check server. diff --git a/proto/ax.pb.go b/proto/ax.pb.go index 3fa254f9..e11bef23 100644 --- a/proto/ax.pb.go +++ b/proto/ax.pb.go @@ -731,8 +731,8 @@ func (*HarnessResponse_Outputs) isHarnessResponse_Type() {} func (*HarnessResponse_End) isHarnessResponse_Type() {} -// ExecRequest for executing. -type ExecRequest struct { +// CreateInteractionRequest for creating an interaction. +type CreateInteractionRequest struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` // Unique conversation identifier Inputs []*Message `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs @@ -743,20 +743,20 @@ type ExecRequest struct { sizeCache protoimpl.SizeCache } -func (x *ExecRequest) Reset() { - *x = ExecRequest{} +func (x *CreateInteractionRequest) Reset() { + *x = CreateInteractionRequest{} mi := &file_proto_ax_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ExecRequest) String() string { +func (x *CreateInteractionRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ExecRequest) ProtoMessage() {} +func (*CreateInteractionRequest) ProtoMessage() {} -func (x *ExecRequest) ProtoReflect() protoreflect.Message { +func (x *CreateInteractionRequest) ProtoReflect() protoreflect.Message { mi := &file_proto_ax_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -768,48 +768,48 @@ func (x *ExecRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ExecRequest.ProtoReflect.Descriptor instead. -func (*ExecRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use CreateInteractionRequest.ProtoReflect.Descriptor instead. +func (*CreateInteractionRequest) Descriptor() ([]byte, []int) { return file_proto_ax_proto_rawDescGZIP(), []int{9} } -func (x *ExecRequest) GetConversationId() string { +func (x *CreateInteractionRequest) GetConversationId() string { if x != nil { return x.ConversationId } return "" } -func (x *ExecRequest) GetInputs() []*Message { +func (x *CreateInteractionRequest) GetInputs() []*Message { if x != nil { return x.Inputs } return nil } -func (x *ExecRequest) GetLastStep() int32 { +func (x *CreateInteractionRequest) GetLastStep() int32 { if x != nil { return x.LastStep } return 0 } -func (x *ExecRequest) GetHarnessId() string { +func (x *CreateInteractionRequest) GetHarnessId() string { if x != nil { return x.HarnessId } return "" } -func (x *ExecRequest) GetHarnessConfig() []byte { +func (x *CreateInteractionRequest) GetHarnessConfig() []byte { if x != nil { return x.HarnessConfig } return nil } -// ExecResponse contains the result of an execution. -type ExecResponse struct { +// CreateInteractionResponse contains the result of an interaction. +type CreateInteractionResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Outputs []*Message `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty"` // Output content Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` // Step of the outputs @@ -817,20 +817,20 @@ type ExecResponse struct { sizeCache protoimpl.SizeCache } -func (x *ExecResponse) Reset() { - *x = ExecResponse{} +func (x *CreateInteractionResponse) Reset() { + *x = CreateInteractionResponse{} mi := &file_proto_ax_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ExecResponse) String() string { +func (x *CreateInteractionResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ExecResponse) ProtoMessage() {} +func (*CreateInteractionResponse) ProtoMessage() {} -func (x *ExecResponse) ProtoReflect() protoreflect.Message { +func (x *CreateInteractionResponse) ProtoReflect() protoreflect.Message { mi := &file_proto_ax_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -842,19 +842,19 @@ func (x *ExecResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ExecResponse.ProtoReflect.Descriptor instead. -func (*ExecResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use CreateInteractionResponse.ProtoReflect.Descriptor instead. +func (*CreateInteractionResponse) Descriptor() ([]byte, []int) { return file_proto_ax_proto_rawDescGZIP(), []int{10} } -func (x *ExecResponse) GetOutputs() []*Message { +func (x *CreateInteractionResponse) GetOutputs() []*Message { if x != nil { return x.Outputs } return nil } -func (x *ExecResponse) GetStep() int32 { +func (x *CreateInteractionResponse) GetStep() int32 { if x != nil { return x.Step } @@ -941,6 +941,738 @@ func (*DeleteConversationResponse) Descriptor() ([]byte, []int) { return file_proto_ax_proto_rawDescGZIP(), []int{12} } +type Step struct { + state protoimpl.MessageState `protogen:"open.v1"` + Description string `protobuf:"bytes,16,opt,name=description,proto3" json:"description,omitempty"` + // Types that are valid to be assigned to Type: + // + // *Step_Content + // *Step_Thought + // *Step_ToolCall + // *Step_ToolResult + Type isStep_Type `protobuf_oneof:"type"` + Index int64 `protobuf:"varint,22,opt,name=index,proto3" json:"index,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Step) Reset() { + *x = Step{} + mi := &file_proto_ax_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Step) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Step) ProtoMessage() {} + +func (x *Step) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Step.ProtoReflect.Descriptor instead. +func (*Step) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{13} +} + +func (x *Step) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *Step) GetType() isStep_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *Step) GetContent() *ContentStep { + if x != nil { + if x, ok := x.Type.(*Step_Content); ok { + return x.Content + } + } + return nil +} + +func (x *Step) GetThought() *ThoughtStep { + if x != nil { + if x, ok := x.Type.(*Step_Thought); ok { + return x.Thought + } + } + return nil +} + +func (x *Step) GetToolCall() *ToolCallStep { + if x != nil { + if x, ok := x.Type.(*Step_ToolCall); ok { + return x.ToolCall + } + } + return nil +} + +func (x *Step) GetToolResult() *ToolResultStep { + if x != nil { + if x, ok := x.Type.(*Step_ToolResult); ok { + return x.ToolResult + } + } + return nil +} + +func (x *Step) GetIndex() int64 { + if x != nil { + return x.Index + } + return 0 +} + +type isStep_Type interface { + isStep_Type() +} + +type Step_Content struct { + Content *ContentStep `protobuf:"bytes,12,opt,name=content,proto3,oneof"` +} + +type Step_Thought struct { + Thought *ThoughtStep `protobuf:"bytes,3,opt,name=thought,proto3,oneof"` +} + +type Step_ToolCall struct { + ToolCall *ToolCallStep `protobuf:"bytes,4,opt,name=tool_call,json=toolCall,proto3,oneof"` +} + +type Step_ToolResult struct { + ToolResult *ToolResultStep `protobuf:"bytes,5,opt,name=tool_result,json=toolResult,proto3,oneof"` +} + +func (*Step_Content) isStep_Type() {} + +func (*Step_Thought) isStep_Type() {} + +func (*Step_ToolCall) isStep_Type() {} + +func (*Step_ToolResult) isStep_Type() {} + +type ContentStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` + Content []*Content `protobuf:"bytes,2,rep,name=content,proto3" json:"content,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ContentStep) Reset() { + *x = ContentStep{} + mi := &file_proto_ax_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ContentStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContentStep) ProtoMessage() {} + +func (x *ContentStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContentStep.ProtoReflect.Descriptor instead. +func (*ContentStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{14} +} + +func (x *ContentStep) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +func (x *ContentStep) GetContent() []*Content { + if x != nil { + return x.Content + } + return nil +} + +type ThoughtStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A signature hash for backend validation. + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` + // A summary of the thought. + Summary []*Content `protobuf:"bytes,2,rep,name=summary,proto3" json:"summary,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ThoughtStep) Reset() { + *x = ThoughtStep{} + mi := &file_proto_ax_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ThoughtStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ThoughtStep) ProtoMessage() {} + +func (x *ThoughtStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ThoughtStep.ProtoReflect.Descriptor instead. +func (*ThoughtStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{15} +} + +func (x *ThoughtStep) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *ThoughtStep) GetSummary() []*Content { + if x != nil { + return x.Summary + } + return nil +} + +type ToolCallStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Types that are valid to be assigned to Type: + // + // *ToolCallStep_FunctionCall + Type isToolCallStep_Type `protobuf_oneof:"type"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToolCallStep) Reset() { + *x = ToolCallStep{} + mi := &file_proto_ax_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToolCallStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToolCallStep) ProtoMessage() {} + +func (x *ToolCallStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToolCallStep.ProtoReflect.Descriptor instead. +func (*ToolCallStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{16} +} + +func (x *ToolCallStep) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ToolCallStep) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *ToolCallStep) GetType() isToolCallStep_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *ToolCallStep) GetFunctionCall() *FunctionCallStep { + if x != nil { + if x, ok := x.Type.(*ToolCallStep_FunctionCall); ok { + return x.FunctionCall + } + } + return nil +} + +type isToolCallStep_Type interface { + isToolCallStep_Type() +} + +type ToolCallStep_FunctionCall struct { + FunctionCall *FunctionCallStep `protobuf:"bytes,3,opt,name=function_call,json=functionCall,proto3,oneof"` +} + +func (*ToolCallStep_FunctionCall) isToolCallStep_Type() {} + +type FunctionCallStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Arguments *structpb.Struct `protobuf:"bytes,2,opt,name=arguments,proto3" json:"arguments,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionCallStep) Reset() { + *x = FunctionCallStep{} + mi := &file_proto_ax_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionCallStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionCallStep) ProtoMessage() {} + +func (x *FunctionCallStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionCallStep.ProtoReflect.Descriptor instead. +func (*FunctionCallStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{17} +} + +func (x *FunctionCallStep) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FunctionCallStep) GetArguments() *structpb.Struct { + if x != nil { + return x.Arguments + } + return nil +} + +type ToolResultStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + CallId string `protobuf:"bytes,1,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + // Types that are valid to be assigned to Type: + // + // *ToolResultStep_FunctionResult + Type isToolResultStep_Type `protobuf_oneof:"type"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ToolResultStep) Reset() { + *x = ToolResultStep{} + mi := &file_proto_ax_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ToolResultStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ToolResultStep) ProtoMessage() {} + +func (x *ToolResultStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ToolResultStep.ProtoReflect.Descriptor instead. +func (*ToolResultStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{18} +} + +func (x *ToolResultStep) GetCallId() string { + if x != nil { + return x.CallId + } + return "" +} + +func (x *ToolResultStep) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *ToolResultStep) GetType() isToolResultStep_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *ToolResultStep) GetFunctionResult() *FunctionResultStep { + if x != nil { + if x, ok := x.Type.(*ToolResultStep_FunctionResult); ok { + return x.FunctionResult + } + } + return nil +} + +type isToolResultStep_Type interface { + isToolResultStep_Type() +} + +type ToolResultStep_FunctionResult struct { + FunctionResult *FunctionResultStep `protobuf:"bytes,3,opt,name=function_result,json=functionResult,proto3,oneof"` +} + +func (*ToolResultStep_FunctionResult) isToolResultStep_Type() {} + +type FunctionResultStep struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The name of the tool that was called. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Whether the tool call resulted in an error. + IsError bool `protobuf:"varint,3,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + // The result of the tool call. + Result *Value `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionResultStep) Reset() { + *x = FunctionResultStep{} + mi := &file_proto_ax_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionResultStep) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionResultStep) ProtoMessage() {} + +func (x *FunctionResultStep) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionResultStep.ProtoReflect.Descriptor instead. +func (*FunctionResultStep) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{19} +} + +func (x *FunctionResultStep) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FunctionResultStep) GetIsError() bool { + if x != nil { + return x.IsError + } + return false +} + +func (x *FunctionResultStep) GetResult() *Value { + if x != nil { + return x.Result + } + return nil +} + +type Value struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // + // *Value_NullValue + // *Value_NumberValue + // *Value_StringValue + // *Value_BoolValue + // *Value_StructValue + // *Value_ListValue + // *Value_ContentValue + Kind isValue_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Value) Reset() { + *x = Value{} + mi := &file_proto_ax_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Value) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Value) ProtoMessage() {} + +func (x *Value) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Value.ProtoReflect.Descriptor instead. +func (*Value) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{20} +} + +func (x *Value) GetKind() isValue_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *Value) GetNullValue() structpb.NullValue { + if x != nil { + if x, ok := x.Kind.(*Value_NullValue); ok { + return x.NullValue + } + } + return structpb.NullValue(0) +} + +func (x *Value) GetNumberValue() float64 { + if x != nil { + if x, ok := x.Kind.(*Value_NumberValue); ok { + return x.NumberValue + } + } + return 0 +} + +func (x *Value) GetStringValue() string { + if x != nil { + if x, ok := x.Kind.(*Value_StringValue); ok { + return x.StringValue + } + } + return "" +} + +func (x *Value) GetBoolValue() bool { + if x != nil { + if x, ok := x.Kind.(*Value_BoolValue); ok { + return x.BoolValue + } + } + return false +} + +func (x *Value) GetStructValue() *structpb.Struct { + if x != nil { + if x, ok := x.Kind.(*Value_StructValue); ok { + return x.StructValue + } + } + return nil +} + +func (x *Value) GetListValue() *ListValue { + if x != nil { + if x, ok := x.Kind.(*Value_ListValue); ok { + return x.ListValue + } + } + return nil +} + +func (x *Value) GetContentValue() *Content { + if x != nil { + if x, ok := x.Kind.(*Value_ContentValue); ok { + return x.ContentValue + } + } + return nil +} + +type isValue_Kind interface { + isValue_Kind() +} + +type Value_NullValue struct { + // Represents a null value. + NullValue structpb.NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` +} + +type Value_NumberValue struct { + // Represents a double value. + NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` +} + +type Value_StringValue struct { + // Represents a string value. + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type Value_BoolValue struct { + // Represents a boolean value. + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type Value_StructValue struct { + // Represents a structured value. + StructValue *structpb.Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` +} + +type Value_ListValue struct { + // Represents a repeated `Value`. + ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` +} + +type Value_ContentValue struct { + // Represents rich content (text, image, etc.). + ContentValue *Content `protobuf:"bytes,7,opt,name=content_value,json=contentValue,proto3,oneof"` +} + +func (*Value_NullValue) isValue_Kind() {} + +func (*Value_NumberValue) isValue_Kind() {} + +func (*Value_StringValue) isValue_Kind() {} + +func (*Value_BoolValue) isValue_Kind() {} + +func (*Value_StructValue) isValue_Kind() {} + +func (*Value_ListValue) isValue_Kind() {} + +func (*Value_ContentValue) isValue_Kind() {} + +// `ListValue` is a wrapper around a repeated field of values. +type ListValue struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Repeated field of dynamically typed values. + Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListValue) Reset() { + *x = ListValue{} + mi := &file_proto_ax_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListValue) ProtoMessage() {} + +func (x *ListValue) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListValue.ProtoReflect.Descriptor instead. +func (*ListValue) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{21} +} + +func (x *ListValue) GetValues() []*Value { + if x != nil { + return x.Values + } + return nil +} + var File_proto_ax_proto protoreflect.FileDescriptor const file_proto_ax_proto_rawDesc = "" + @@ -983,20 +1715,71 @@ const file_proto_ax_proto_rawDesc = "" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12.\n" + "\aoutputs\x18\x02 \x01(\v2\x12.ax.HarnessOutputsH\x00R\aoutputs\x12\"\n" + "\x03end\x18\x03 \x01(\v2\x0e.ax.HarnessEndH\x00R\x03endB\x06\n" + - "\x04type\"\xbe\x01\n" + - "\vExecRequest\x12'\n" + + "\x04type\"\xcb\x01\n" + + "\x18CreateInteractionRequest\x12'\n" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12#\n" + "\x06inputs\x18\x02 \x03(\v2\v.ax.MessageR\x06inputs\x12\x1b\n" + "\tlast_step\x18\x03 \x01(\x05R\blastStep\x12\x1d\n" + "\n" + "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" + - "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfig\"I\n" + - "\fExecResponse\x12%\n" + + "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfig\"V\n" + + "\x19CreateInteractionResponse\x12%\n" + "\aoutputs\x18\x01 \x03(\v2\v.ax.MessageR\aoutputs\x12\x12\n" + "\x04step\x18\x02 \x01(\x05R\x04step\"D\n" + "\x19DeleteConversationRequest\x12'\n" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\"\x1c\n" + - "\x1aDeleteConversationResponse*l\n" + + "\x1aDeleteConversationResponse\"\x88\x02\n" + + "\x04Step\x12 \n" + + "\vdescription\x18\x10 \x01(\tR\vdescription\x12+\n" + + "\acontent\x18\f \x01(\v2\x0f.ax.ContentStepH\x00R\acontent\x12+\n" + + "\athought\x18\x03 \x01(\v2\x0f.ax.ThoughtStepH\x00R\athought\x12/\n" + + "\ttool_call\x18\x04 \x01(\v2\x10.ax.ToolCallStepH\x00R\btoolCall\x125\n" + + "\vtool_result\x18\x05 \x01(\v2\x12.ax.ToolResultStepH\x00R\n" + + "toolResult\x12\x14\n" + + "\x05index\x18\x16 \x01(\x03R\x05indexB\x06\n" + + "\x04type\"Z\n" + + "\vContentStep\x12\x12\n" + + "\x04role\x18\x01 \x01(\tR\x04role\x12%\n" + + "\acontent\x18\x02 \x03(\v2\v.ax.ContentR\acontentR\x04typeR\n" + + "event_type\"d\n" + + "\vThoughtStep\x12\x1c\n" + + "\tsignature\x18\x01 \x01(\fR\tsignature\x12%\n" + + "\asummary\x18\x02 \x03(\v2\v.ax.ContentR\asummaryR\x04typeR\n" + + "event_type\"\x8d\x01\n" + + "\fToolCallStep\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + + "\tsignature\x18\x02 \x01(\fR\tsignature\x12;\n" + + "\rfunction_call\x18\x03 \x01(\v2\x14.ax.FunctionCallStepH\x00R\ffunctionCallB\x06\n" + + "\x04typeR\n" + + "event_type\"c\n" + + "\x10FunctionCallStep\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x125\n" + + "\targuments\x18\x02 \x01(\v2\x17.google.protobuf.StructR\targumentsR\x04type\"\x9e\x01\n" + + "\x0eToolResultStep\x12\x17\n" + + "\acall_id\x18\x01 \x01(\tR\x06callId\x12\x1c\n" + + "\tsignature\x18\x02 \x01(\fR\tsignature\x12A\n" + + "\x0ffunction_result\x18\x03 \x01(\v2\x16.ax.FunctionResultStepH\x00R\x0efunctionResultB\x06\n" + + "\x04typeR\n" + + "event_type\"\x8a\x01\n" + + "\x12FunctionResultStep\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x19\n" + + "\bis_error\x18\x03 \x01(\bR\aisError\x12!\n" + + "\x06result\x18\a \x01(\v2\t.ax.ValueR\x06resultJ\x04\b\x01\x10\x02J\x04\b\x04\x10\x05J\x04\b\n" + + "\x10\vJ\x04\b\v\x10\fJ\x04\b\f\x10\rR\x04type\"\xd9\x02\n" + + "\x05Value\x12;\n" + + "\n" + + "null_value\x18\x01 \x01(\x0e2\x1a.google.protobuf.NullValueH\x00R\tnullValue\x12#\n" + + "\fnumber_value\x18\x02 \x01(\x01H\x00R\vnumberValue\x12#\n" + + "\fstring_value\x18\x03 \x01(\tH\x00R\vstringValue\x12\x1f\n" + + "\n" + + "bool_value\x18\x04 \x01(\bH\x00R\tboolValue\x12<\n" + + "\fstruct_value\x18\x05 \x01(\v2\x17.google.protobuf.StructH\x00R\vstructValue\x12.\n" + + "\n" + + "list_value\x18\x06 \x01(\v2\r.ax.ListValueH\x00R\tlistValue\x122\n" + + "\rcontent_value\x18\a \x01(\v2\v.ax.ContentH\x00R\fcontentValueB\x06\n" + + "\x04kind\".\n" + + "\tListValue\x12!\n" + + "\x06values\x18\x01 \x03(\v2\t.ax.ValueR\x06values*l\n" + "\x05State\x12\x15\n" + "\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n" + "\rSTATE_PENDING\x10\x01\x12\x10\n" + @@ -1009,9 +1792,9 @@ const file_proto_ax_proto_rawDesc = "" + "\x15CANCEL_REASON_TIMEOUT\x10\x02\x12 \n" + "\x1cCANCEL_REASON_INTERNAL_ERROR\x10\x032H\n" + "\x0eHarnessService\x126\n" + - "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012?\n" + - "\x10ExecutionService\x12+\n" + - "\x04Exec\x12\x0f.ax.ExecRequest\x1a\x10.ax.ExecResponse0\x012j\n" + + "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012i\n" + + "\x13InteractionsService\x12R\n" + + "\x11CreateInteraction\x12\x1c.ax.CreateInteractionRequest\x1a\x1d.ax.CreateInteractionResponse0\x012j\n" + "\x13ConversationService\x12S\n" + "\x12DeleteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3" @@ -1028,7 +1811,7 @@ func file_proto_ax_proto_rawDescGZIP() []byte { } var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_proto_ax_proto_goTypes = []any{ (State)(0), // 0: ax.State (CancelReason)(0), // 1: ax.CancelReason @@ -1041,16 +1824,26 @@ var file_proto_ax_proto_goTypes = []any{ (*Error)(nil), // 8: ax.Error (*HarnessEnd)(nil), // 9: ax.HarnessEnd (*HarnessResponse)(nil), // 10: ax.HarnessResponse - (*ExecRequest)(nil), // 11: ax.ExecRequest - (*ExecResponse)(nil), // 12: ax.ExecResponse + (*CreateInteractionRequest)(nil), // 11: ax.CreateInteractionRequest + (*CreateInteractionResponse)(nil), // 12: ax.CreateInteractionResponse (*DeleteConversationRequest)(nil), // 13: ax.DeleteConversationRequest (*DeleteConversationResponse)(nil), // 14: ax.DeleteConversationResponse - (*Content)(nil), // 15: ax.Content - (*structpb.Struct)(nil), // 16: google.protobuf.Struct + (*Step)(nil), // 15: ax.Step + (*ContentStep)(nil), // 16: ax.ContentStep + (*ThoughtStep)(nil), // 17: ax.ThoughtStep + (*ToolCallStep)(nil), // 18: ax.ToolCallStep + (*FunctionCallStep)(nil), // 19: ax.FunctionCallStep + (*ToolResultStep)(nil), // 20: ax.ToolResultStep + (*FunctionResultStep)(nil), // 21: ax.FunctionResultStep + (*Value)(nil), // 22: ax.Value + (*ListValue)(nil), // 23: ax.ListValue + (*Content)(nil), // 24: ax.Content + (*structpb.Struct)(nil), // 25: google.protobuf.Struct + (structpb.NullValue)(0), // 26: google.protobuf.NullValue } var file_proto_ax_proto_depIdxs = []int32{ - 15, // 0: ax.Message.content:type_name -> ax.Content - 16, // 1: ax.ConversationEvent.harness_config:type_name -> google.protobuf.Struct + 24, // 0: ax.Message.content:type_name -> ax.Content + 25, // 1: ax.ConversationEvent.harness_config:type_name -> google.protobuf.Struct 2, // 2: ax.ConversationEvent.messages:type_name -> ax.Message 0, // 3: ax.ConversationEvent.state:type_name -> ax.State 2, // 4: ax.HarnessStart.messages:type_name -> ax.Message @@ -1062,19 +1855,34 @@ var file_proto_ax_proto_depIdxs = []int32{ 8, // 10: ax.HarnessEnd.error:type_name -> ax.Error 7, // 11: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs 9, // 12: ax.HarnessResponse.end:type_name -> ax.HarnessEnd - 2, // 13: ax.ExecRequest.inputs:type_name -> ax.Message - 2, // 14: ax.ExecResponse.outputs:type_name -> ax.Message - 6, // 15: ax.HarnessService.Connect:input_type -> ax.HarnessRequest - 11, // 16: ax.ExecutionService.Exec:input_type -> ax.ExecRequest - 13, // 17: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest - 10, // 18: ax.HarnessService.Connect:output_type -> ax.HarnessResponse - 12, // 19: ax.ExecutionService.Exec:output_type -> ax.ExecResponse - 14, // 20: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse - 18, // [18:21] is the sub-list for method output_type - 15, // [15:18] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 2, // 13: ax.CreateInteractionRequest.inputs:type_name -> ax.Message + 2, // 14: ax.CreateInteractionResponse.outputs:type_name -> ax.Message + 16, // 15: ax.Step.content:type_name -> ax.ContentStep + 17, // 16: ax.Step.thought:type_name -> ax.ThoughtStep + 18, // 17: ax.Step.tool_call:type_name -> ax.ToolCallStep + 20, // 18: ax.Step.tool_result:type_name -> ax.ToolResultStep + 24, // 19: ax.ContentStep.content:type_name -> ax.Content + 24, // 20: ax.ThoughtStep.summary:type_name -> ax.Content + 19, // 21: ax.ToolCallStep.function_call:type_name -> ax.FunctionCallStep + 25, // 22: ax.FunctionCallStep.arguments:type_name -> google.protobuf.Struct + 21, // 23: ax.ToolResultStep.function_result:type_name -> ax.FunctionResultStep + 22, // 24: ax.FunctionResultStep.result:type_name -> ax.Value + 26, // 25: ax.Value.null_value:type_name -> google.protobuf.NullValue + 25, // 26: ax.Value.struct_value:type_name -> google.protobuf.Struct + 23, // 27: ax.Value.list_value:type_name -> ax.ListValue + 24, // 28: ax.Value.content_value:type_name -> ax.Content + 22, // 29: ax.ListValue.values:type_name -> ax.Value + 6, // 30: ax.HarnessService.Connect:input_type -> ax.HarnessRequest + 11, // 31: ax.InteractionsService.CreateInteraction:input_type -> ax.CreateInteractionRequest + 13, // 32: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest + 10, // 33: ax.HarnessService.Connect:output_type -> ax.HarnessResponse + 12, // 34: ax.InteractionsService.CreateInteraction:output_type -> ax.CreateInteractionResponse + 14, // 35: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse + 33, // [33:36] is the sub-list for method output_type + 30, // [30:33] is the sub-list for method input_type + 30, // [30:30] is the sub-list for extension type_name + 30, // [30:30] is the sub-list for extension extendee + 0, // [0:30] is the sub-list for field type_name } func init() { file_proto_ax_proto_init() } @@ -1091,13 +1899,34 @@ func file_proto_ax_proto_init() { (*HarnessResponse_Outputs)(nil), (*HarnessResponse_End)(nil), } + file_proto_ax_proto_msgTypes[13].OneofWrappers = []any{ + (*Step_Content)(nil), + (*Step_Thought)(nil), + (*Step_ToolCall)(nil), + (*Step_ToolResult)(nil), + } + file_proto_ax_proto_msgTypes[16].OneofWrappers = []any{ + (*ToolCallStep_FunctionCall)(nil), + } + file_proto_ax_proto_msgTypes[18].OneofWrappers = []any{ + (*ToolResultStep_FunctionResult)(nil), + } + file_proto_ax_proto_msgTypes[20].OneofWrappers = []any{ + (*Value_NullValue)(nil), + (*Value_NumberValue)(nil), + (*Value_StringValue)(nil), + (*Value_BoolValue)(nil), + (*Value_StructValue)(nil), + (*Value_ListValue)(nil), + (*Value_ContentValue)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_ax_proto_rawDesc), len(file_proto_ax_proto_rawDesc)), NumEnums: 2, - NumMessages: 13, + NumMessages: 22, NumExtensions: 0, NumServices: 3, }, diff --git a/proto/ax.proto b/proto/ax.proto index 31b90a61..7c5d6b6a 100644 --- a/proto/ax.proto +++ b/proto/ax.proto @@ -114,8 +114,8 @@ enum CancelReason { CANCEL_REASON_INTERNAL_ERROR = 3; } -// ExecRequest for executing. -message ExecRequest { +// CreateInteractionRequest for creating an interaction. +message CreateInteractionRequest { string conversation_id = 1; // Unique conversation identifier repeated Message inputs = 2; // New inputs int32 last_step = 3; // Last step number seen by the client @@ -124,16 +124,16 @@ message ExecRequest { bytes harness_config = 5; // Per-request harness configuration (opaque JSON), if any } -// ExecResponse contains the result of an execution. -message ExecResponse { +// CreateInteractionResponse contains the result of an interaction. +message CreateInteractionResponse { repeated Message outputs = 1; // Output content int32 step = 2; // Step of the outputs } -service ExecutionService { - // Exec executes an agentic task or resumes an existing one with streaming responses +service InteractionsService { + // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - rpc Exec(ExecRequest) returns (stream ExecResponse); + rpc CreateInteraction(CreateInteractionRequest) returns (stream CreateInteractionResponse); } message DeleteConversationRequest { @@ -147,3 +147,107 @@ service ConversationService { // for its children executions. rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse); } + +message Step { + string description = 16; + + oneof type { + ContentStep content = 12; + ThoughtStep thought = 3; + ToolCallStep tool_call = 4; + ToolResultStep tool_result = 5; + } + + int64 index = 22; +} + +message ContentStep { + reserved "type"; + reserved "event_type"; + + string role = 1; + repeated Content content = 2; +} + +message ThoughtStep { + reserved "type"; + reserved "event_type"; + + // A signature hash for backend validation. + bytes signature = 1; + // A summary of the thought. + repeated Content summary = 2; +} + +message ToolCallStep { + reserved "event_type"; + + string id = 1; + + bytes signature = 2; + + oneof type { + FunctionCallStep function_call = 3; + } +} + +message FunctionCallStep { + reserved "type"; + + string name = 1; + + google.protobuf.Struct arguments = 2; +} + +message ToolResultStep { + reserved "event_type"; + + string call_id = 1; + + bytes signature = 2; + + oneof type { + FunctionResultStep function_result = 3; + } +} + +message FunctionResultStep { + reserved "type"; + reserved 1, 4; + + // The name of the tool that was called. + string name = 2; + + // Whether the tool call resulted in an error. + bool is_error = 3; + + // The result of the tool call. + Value result = 7; + reserved 10, 11, 12; +} + +message Value { + // The kind of value. + oneof kind { + // Represents a null value. + google.protobuf.NullValue null_value = 1; + // Represents a double value. + double number_value = 2; + // Represents a string value. + string string_value = 3; + // Represents a boolean value. + bool bool_value = 4; + // Represents a structured value. + google.protobuf.Struct struct_value = 5; + // Represents a repeated `Value`. + ListValue list_value = 6; + // Represents rich content (text, image, etc.). + Content content_value = 7; + } +} + +// `ListValue` is a wrapper around a repeated field of values. +message ListValue { + // Repeated field of dynamically typed values. + repeated Value values = 1; +} \ No newline at end of file diff --git a/proto/ax_grpc.pb.go b/proto/ax_grpc.pb.go index dc1e0b81..88e3704a 100644 --- a/proto/ax_grpc.pb.go +++ b/proto/ax_grpc.pb.go @@ -137,33 +137,33 @@ var HarnessService_ServiceDesc = grpc.ServiceDesc{ } const ( - ExecutionService_Exec_FullMethodName = "/ax.ExecutionService/Exec" + InteractionsService_CreateInteraction_FullMethodName = "/ax.InteractionsService/CreateInteraction" ) -// ExecutionServiceClient is the client API for ExecutionService service. +// InteractionsServiceClient is the client API for InteractionsService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ExecutionServiceClient interface { - // Exec executes an agentic task or resumes an existing one with streaming responses +type InteractionsServiceClient interface { + // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExecResponse], error) + CreateInteraction(ctx context.Context, in *CreateInteractionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) } -type executionServiceClient struct { +type interactionsServiceClient struct { cc grpc.ClientConnInterface } -func NewExecutionServiceClient(cc grpc.ClientConnInterface) ExecutionServiceClient { - return &executionServiceClient{cc} +func NewInteractionsServiceClient(cc grpc.ClientConnInterface) InteractionsServiceClient { + return &interactionsServiceClient{cc} } -func (c *executionServiceClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExecResponse], error) { +func (c *interactionsServiceClient) CreateInteraction(ctx context.Context, in *CreateInteractionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &ExecutionService_ServiceDesc.Streams[0], ExecutionService_Exec_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &InteractionsService_ServiceDesc.Streams[0], InteractionsService_CreateInteraction_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ExecRequest, ExecResponse]{ClientStream: stream} + x := &grpc.GenericClientStream[CreateInteractionRequest, CreateInteractionResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -174,71 +174,71 @@ func (c *executionServiceClient) Exec(ctx context.Context, in *ExecRequest, opts } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ExecutionService_ExecClient = grpc.ServerStreamingClient[ExecResponse] +type InteractionsService_CreateInteractionClient = grpc.ServerStreamingClient[CreateInteractionResponse] -// ExecutionServiceServer is the server API for ExecutionService service. -// All implementations must embed UnimplementedExecutionServiceServer +// InteractionsServiceServer is the server API for InteractionsService service. +// All implementations must embed UnimplementedInteractionsServiceServer // for forward compatibility. -type ExecutionServiceServer interface { - // Exec executes an agentic task or resumes an existing one with streaming responses +type InteractionsServiceServer interface { + // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - Exec(*ExecRequest, grpc.ServerStreamingServer[ExecResponse]) error - mustEmbedUnimplementedExecutionServiceServer() + CreateInteraction(*CreateInteractionRequest, grpc.ServerStreamingServer[CreateInteractionResponse]) error + mustEmbedUnimplementedInteractionsServiceServer() } -// UnimplementedExecutionServiceServer must be embedded to have +// UnimplementedInteractionsServiceServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. -type UnimplementedExecutionServiceServer struct{} +type UnimplementedInteractionsServiceServer struct{} -func (UnimplementedExecutionServiceServer) Exec(*ExecRequest, grpc.ServerStreamingServer[ExecResponse]) error { - return status.Errorf(codes.Unimplemented, "method Exec not implemented") +func (UnimplementedInteractionsServiceServer) CreateInteraction(*CreateInteractionRequest, grpc.ServerStreamingServer[CreateInteractionResponse]) error { + return status.Errorf(codes.Unimplemented, "method CreateInteraction not implemented") } -func (UnimplementedExecutionServiceServer) mustEmbedUnimplementedExecutionServiceServer() {} -func (UnimplementedExecutionServiceServer) testEmbeddedByValue() {} +func (UnimplementedInteractionsServiceServer) mustEmbedUnimplementedInteractionsServiceServer() {} +func (UnimplementedInteractionsServiceServer) testEmbeddedByValue() {} -// UnsafeExecutionServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ExecutionServiceServer will +// UnsafeInteractionsServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to InteractionsServiceServer will // result in compilation errors. -type UnsafeExecutionServiceServer interface { - mustEmbedUnimplementedExecutionServiceServer() +type UnsafeInteractionsServiceServer interface { + mustEmbedUnimplementedInteractionsServiceServer() } -func RegisterExecutionServiceServer(s grpc.ServiceRegistrar, srv ExecutionServiceServer) { - // If the following call pancis, it indicates UnimplementedExecutionServiceServer was +func RegisterInteractionsServiceServer(s grpc.ServiceRegistrar, srv InteractionsServiceServer) { + // If the following call pancis, it indicates UnimplementedInteractionsServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } - s.RegisterService(&ExecutionService_ServiceDesc, srv) + s.RegisterService(&InteractionsService_ServiceDesc, srv) } -func _ExecutionService_Exec_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ExecRequest) +func _InteractionsService_CreateInteraction_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(CreateInteractionRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(ExecutionServiceServer).Exec(m, &grpc.GenericServerStream[ExecRequest, ExecResponse]{ServerStream: stream}) + return srv.(InteractionsServiceServer).CreateInteraction(m, &grpc.GenericServerStream[CreateInteractionRequest, CreateInteractionResponse]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ExecutionService_ExecServer = grpc.ServerStreamingServer[ExecResponse] +type InteractionsService_CreateInteractionServer = grpc.ServerStreamingServer[CreateInteractionResponse] -// ExecutionService_ServiceDesc is the grpc.ServiceDesc for ExecutionService service. +// InteractionsService_ServiceDesc is the grpc.ServiceDesc for InteractionsService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var ExecutionService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ax.ExecutionService", - HandlerType: (*ExecutionServiceServer)(nil), +var InteractionsService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ax.InteractionsService", + HandlerType: (*InteractionsServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { - StreamName: "Exec", - Handler: _ExecutionService_Exec_Handler, + StreamName: "CreateInteraction", + Handler: _InteractionsService_CreateInteraction_Handler, ServerStreams: true, }, }, diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py index 64befc9e..3662b292 100644 --- a/python/proto/ax_pb2.py +++ b/python/proto/ax_pb2.py @@ -1,17 +1,3 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/ax.proto @@ -30,7 +16,7 @@ from proto import content_pb2 as proto_dot_content__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"5\n\x07Message\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x0b.ax.Content\"\xc9\x01\n\x11\x43onversationEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0c\n\x04step\x18\x02 \x01(\x05\x12\x0f\n\x07\x65xec_id\x18\x03 \x01(\t\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12/\n\x0eharness_config\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1d\n\x08messages\x18\x06 \x03(\x0b\x32\x0b.ax.Message\x12\x18\n\x05state\x18\x07 \x01(\x0e\x32\t.ax.State\"E\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x1d\n\x08messages\x18\x02 \x03(\x0b\x32\x0b.ax.Message\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\"/\n\x0eHarnessOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"\x82\x01\n\x0b\x45xecRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x1b\n\x06inputs\x18\x02 \x03(\x0b\x32\x0b.ax.Message\x12\x11\n\tlast_step\x18\x03 \x01(\x05\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0c\":\n\x0c\x45xecResponse\x12\x1c\n\x07outputs\x18\x01 \x03(\x0b\x32\x0b.ax.Message\x12\x0c\n\x04step\x18\x02 \x01(\x05\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32?\n\x10\x45xecutionService\x12+\n\x04\x45xec\x12\x0f.ax.ExecRequest\x1a\x10.ax.ExecResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"5\n\x07Message\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x0b.ax.Content\"\xc9\x01\n\x11\x43onversationEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0c\n\x04step\x18\x02 \x01(\x05\x12\x0f\n\x07\x65xec_id\x18\x03 \x01(\t\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12/\n\x0eharness_config\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1d\n\x08messages\x18\x06 \x03(\x0b\x32\x0b.ax.Message\x12\x18\n\x05state\x18\x07 \x01(\x0e\x32\t.ax.State\"E\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x1d\n\x08messages\x18\x02 \x03(\x0b\x32\x0b.ax.Message\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\"/\n\x0eHarnessOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"\x8f\x01\n\x18\x43reateInteractionRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x1b\n\x06inputs\x18\x02 \x03(\x0b\x32\x0b.ax.Message\x12\x11\n\tlast_step\x18\x03 \x01(\x05\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0c\"G\n\x19\x43reateInteractionResponse\x12\x1c\n\x07outputs\x18\x01 \x03(\x0b\x32\x0b.ax.Message\x12\x0c\n\x04step\x18\x02 \x01(\x05\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32i\n\x13InteractionsService\x12R\n\x11\x43reateInteraction\x12\x1c.ax.CreateInteractionRequest\x1a\x1d.ax.CreateInteractionResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -38,10 +24,10 @@ if _descriptor._USE_C_DESCRIPTORS == False: _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto' - _globals['_STATE']._serialized_start=1156 - _globals['_STATE']._serialized_end=1264 - _globals['_CANCELREASON']._serialized_start=1267 - _globals['_CANCELREASON']._serialized_end=1407 + _globals['_STATE']._serialized_start=2290 + _globals['_STATE']._serialized_end=2398 + _globals['_CANCELREASON']._serialized_start=2401 + _globals['_CANCELREASON']._serialized_end=2541 _globals['_MESSAGE']._serialized_start=73 _globals['_MESSAGE']._serialized_end=126 _globals['_CONVERSATIONEVENT']._serialized_start=129 @@ -60,18 +46,36 @@ _globals['_HARNESSEND']._serialized_end=755 _globals['_HARNESSRESPONSE']._serialized_start=757 _globals['_HARNESSRESPONSE']._serialized_end=877 - _globals['_EXECREQUEST']._serialized_start=880 - _globals['_EXECREQUEST']._serialized_end=1010 - _globals['_EXECRESPONSE']._serialized_start=1012 - _globals['_EXECRESPONSE']._serialized_end=1070 - _globals['_DELETECONVERSATIONREQUEST']._serialized_start=1072 - _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1124 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1126 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1154 - _globals['_HARNESSSERVICE']._serialized_start=1409 - _globals['_HARNESSSERVICE']._serialized_end=1481 - _globals['_EXECUTIONSERVICE']._serialized_start=1483 - _globals['_EXECUTIONSERVICE']._serialized_end=1546 - _globals['_CONVERSATIONSERVICE']._serialized_start=1548 - _globals['_CONVERSATIONSERVICE']._serialized_end=1654 + _globals['_CREATEINTERACTIONREQUEST']._serialized_start=880 + _globals['_CREATEINTERACTIONREQUEST']._serialized_end=1023 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=1025 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=1096 + _globals['_DELETECONVERSATIONREQUEST']._serialized_start=1098 + _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1150 + _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1152 + _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1180 + _globals['_STEP']._serialized_start=1183 + _globals['_STEP']._serialized_end=1387 + _globals['_CONTENTSTEP']._serialized_start=1389 + _globals['_CONTENTSTEP']._serialized_end=1464 + _globals['_THOUGHTSTEP']._serialized_start=1466 + _globals['_THOUGHTSTEP']._serialized_end=1546 + _globals['_TOOLCALLSTEP']._serialized_start=1548 + _globals['_TOOLCALLSTEP']._serialized_end=1660 + _globals['_FUNCTIONCALLSTEP']._serialized_start=1662 + _globals['_FUNCTIONCALLSTEP']._serialized_end=1744 + _globals['_TOOLRESULTSTEP']._serialized_start=1746 + _globals['_TOOLRESULTSTEP']._serialized_end=1869 + _globals['_FUNCTIONRESULTSTEP']._serialized_start=1871 + _globals['_FUNCTIONRESULTSTEP']._serialized_end=1986 + _globals['_VALUE']._serialized_start=1989 + _globals['_VALUE']._serialized_end=2248 + _globals['_LISTVALUE']._serialized_start=2250 + _globals['_LISTVALUE']._serialized_end=2288 + _globals['_HARNESSSERVICE']._serialized_start=2543 + _globals['_HARNESSSERVICE']._serialized_end=2615 + _globals['_INTERACTIONSSERVICE']._serialized_start=2617 + _globals['_INTERACTIONSSERVICE']._serialized_end=2722 + _globals['_CONVERSATIONSERVICE']._serialized_start=2724 + _globals['_CONVERSATIONSERVICE']._serialized_end=2830 # @@protoc_insertion_point(module_scope) diff --git a/python/proto/ax_pb2_grpc.py b/python/proto/ax_pb2_grpc.py index 78d74565..c46ceb08 100644 --- a/python/proto/ax_pb2_grpc.py +++ b/python/proto/ax_pb2_grpc.py @@ -1,17 +1,3 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc @@ -84,7 +70,7 @@ def Connect(request_iterator, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) -class ExecutionServiceStub(object): +class InteractionsServiceStub(object): """Missing associated documentation comment in .proto file.""" def __init__(self, channel): @@ -93,18 +79,18 @@ def __init__(self, channel): Args: channel: A grpc.Channel. """ - self.Exec = channel.unary_stream( - '/ax.ExecutionService/Exec', - request_serializer=proto_dot_ax__pb2.ExecRequest.SerializeToString, - response_deserializer=proto_dot_ax__pb2.ExecResponse.FromString, + self.CreateInteraction = channel.unary_stream( + '/ax.InteractionsService/CreateInteraction', + request_serializer=proto_dot_ax__pb2.CreateInteractionRequest.SerializeToString, + response_deserializer=proto_dot_ax__pb2.CreateInteractionResponse.FromString, ) -class ExecutionServiceServicer(object): +class InteractionsServiceServicer(object): """Missing associated documentation comment in .proto file.""" - def Exec(self, request, context): - """Exec executes an agentic task or resumes an existing one with streaming responses + def CreateInteraction(self, request, context): + """CreateInteraction executes an agentic task or resumes an existing one with streaming responses If the conversation_id already exists, it will be resumed. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -112,25 +98,25 @@ def Exec(self, request, context): raise NotImplementedError('Method not implemented!') -def add_ExecutionServiceServicer_to_server(servicer, server): +def add_InteractionsServiceServicer_to_server(servicer, server): rpc_method_handlers = { - 'Exec': grpc.unary_stream_rpc_method_handler( - servicer.Exec, - request_deserializer=proto_dot_ax__pb2.ExecRequest.FromString, - response_serializer=proto_dot_ax__pb2.ExecResponse.SerializeToString, + 'CreateInteraction': grpc.unary_stream_rpc_method_handler( + servicer.CreateInteraction, + request_deserializer=proto_dot_ax__pb2.CreateInteractionRequest.FromString, + response_serializer=proto_dot_ax__pb2.CreateInteractionResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( - 'ax.ExecutionService', rpc_method_handlers) + 'ax.InteractionsService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) # This class is part of an EXPERIMENTAL API. -class ExecutionService(object): +class InteractionsService(object): """Missing associated documentation comment in .proto file.""" @staticmethod - def Exec(request, + def CreateInteraction(request, target, options=(), channel_credentials=None, @@ -140,9 +126,9 @@ def Exec(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_stream(request, target, '/ax.ExecutionService/Exec', - proto_dot_ax__pb2.ExecRequest.SerializeToString, - proto_dot_ax__pb2.ExecResponse.FromString, + return grpc.experimental.unary_stream(request, target, '/ax.InteractionsService/CreateInteraction', + proto_dot_ax__pb2.CreateInteractionRequest.SerializeToString, + proto_dot_ax__pb2.CreateInteractionResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/python/proto/content_pb2.py b/python/proto/content_pb2.py index c7439ff5..3f2bf3c2 100644 --- a/python/proto/content_pb2.py +++ b/python/proto/content_pb2.py @@ -1,17 +1,3 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/content.proto diff --git a/python/proto/content_pb2_grpc.py b/python/proto/content_pb2_grpc.py index 0a3290b2..2daafffe 100644 --- a/python/proto/content_pb2_grpc.py +++ b/python/proto/content_pb2_grpc.py @@ -1,17 +1,3 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc From 82465281b7608376a643023326782b75cecbe58c Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Tue, 11 Aug 2026 21:23:48 -0700 Subject: [PATCH 2/5] Use steps --- README.md | 16 +- cmd/ax/exec.go | 157 +++-- cmd/ax/harnessclient.go | 26 +- cmd/ax/internal/display.go | 78 ++- cmd/ax/internal/display_test.go | 98 +-- internal/cmd/e2e/main.go | 28 +- internal/controller/controller.go | 54 +- internal/controller/controller_test.go | 148 ++--- internal/controller/eventlog/eventlog.go | 6 +- .../eventlog/eventlogtest/eventlog.go | 26 +- internal/controller/eventlog/sql.go | 16 +- internal/controller/eventlog/sql_test.go | 31 +- internal/harness/antigravity/antigravity.go | 8 +- .../harness/antigravity/antigravity_test.go | 27 +- .../antigravityinteractions.go | 48 +- .../antigravityinteractions_test.go | 2 +- .../harness/antigravityinteractions/server.go | 8 +- .../antigravityinteractions/server_test.go | 2 +- internal/harness/harness.go | 6 +- internal/harness/harnesstest/harnesstest.go | 87 +-- internal/harness/stream.go | 4 +- internal/harness/substrate/substrate.go | 8 +- internal/harness/substrate/substrate_test.go | 6 +- internal/server/interceptors_test.go | 6 +- internal/server/server.go | 2 +- proto/ax.pb.go | 487 ++++++-------- proto/ax.proto | 39 +- proto/ax_grpc.pb.go | 14 +- proto/content.pb.go | 626 ++---------------- proto/content.proto | 62 +- python/antigravity/harness_server.py | 72 +- python/antigravity/harness_server_test.py | 89 ++- python/proto/ax_pb2.py | 108 ++- python/proto/ax_pb2_grpc.py | 6 +- python/proto/content_pb2.py | 71 +- 35 files changed, 918 insertions(+), 1554 deletions(-) diff --git a/README.md b/README.md index 2e9dcf0e..0f8aeb46 100644 --- a/README.md +++ b/README.md @@ -148,18 +148,6 @@ ax --conversation d85a4b4e-c53b-4c84-b879-f10d905bce40 \ --input "Show me the contents of README.md" ``` -If the client gets disconnected, pass the last step it saw to -replay the events it missed. This catches the client up; it does not -rewind the conversation. - -In this example, we catch up a client from step number 12: - -```bash -ax --conversation d85a4b4e-c53b-4c84-b879-f10d905bce40 \ - --last-step 12 \ - --resume -``` - Instead of running the default harness, you can start executing any registered harness: @@ -187,8 +175,7 @@ ax \ [--config-file ] \ [--server
] \ [--ax-config ] \ - [--resume] \ - [--last-step ] + [--resume] ``` Options: @@ -198,7 +185,6 @@ Options: - `--conversation`: Conversation ID (optional, generates UUID if not provided) - `--harness`: Harness ID (optional, default harness is used if not specified) - `--input`: Input message to send (optional) -- `--last-step`: Last step number seen by the client - `--resume`: Resume a conversation without inputs - `--server`: gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server) diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go index 60cdca27..104c905c 100644 --- a/cmd/ax/exec.go +++ b/cmd/ax/exec.go @@ -42,7 +42,6 @@ var ( execServerAddr string execAXConfigFile string execResume bool // allow resuming an execution without inputs - execLastStep int32 ) var execCmd = &cobra.Command{ @@ -63,7 +62,6 @@ func registerExecFlags(cmd *cobra.Command) { cmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)") cmd.Flags().StringVar(&execAXConfigFile, "ax-config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)") cmd.Flags().BoolVar(&execResume, "resume", false, "Resume a conversation without inputs") - cmd.Flags().Int32Var(&execLastStep, "last-step", 0, "Last step number seen by the client") cmd.MarkFlagsMutuallyExclusive("input", "resume") cmd.MarkFlagsMutuallyExclusive("config", "config-file") } @@ -138,14 +136,14 @@ func runExec(cmd *cobra.Command, args []string) error { harnessConfig = []byte(execConfig) } - return execLoop(ctx, execConversationID, execHarnessID, harnessConfig, execInput, execLastStep) + return execLoop(ctx, execConversationID, execHarnessID, harnessConfig, execInput) } -func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []byte, input string, lastStep int32) error { +func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []byte, input string) error { d := internal.NewDisplay(id, os.Stdout) d.DisplayHeader() - var inputs []*proto.Message + var inputs []*proto.Step if !execResume { var quit bool var err error @@ -156,13 +154,19 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] if quit { return nil } - inputs = []*proto.Message{ + inputs = []*proto.Step{ { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{ - Text: input, + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + { + Type: &proto.Content_Text{ + Text: &proto.TextContent{ + Text: input, + }, + }, + }, }, }, }, @@ -174,14 +178,12 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] reqCtx, cancel := context.WithCancel(ctx) interruptHandler.SetActiveCancel(cancel) - conf, err := runAutoExec(reqCtx, d, &proto.CreateInteractionRequest{ + conf, err := runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{ ConversationId: id, HarnessId: harnessID, HarnessConfig: harnessConfig, Inputs: inputs, - LastStep: lastStep, }) - lastStep = 0 // disable resuming from step, user sees the step on the screen interruptHandler.ClearActiveCancel() cancel() @@ -207,30 +209,42 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] } return err } - var decision []*proto.Message + var decision []*proto.Step if approved { - decision = []*proto.Message{{ - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Confirmation{ - Confirmation: &proto.ConfirmationContent{ - Id: conf.Id, - Decision: &proto.ConfirmationContent_Approval{ - Approval: &proto.ApprovalDecision{Approved: true}, + decision = []*proto.Step{{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + { + Type: &proto.Content_Confirmation{ + Confirmation: &proto.ConfirmationContent{ + Id: conf.Id, + Decision: &proto.ConfirmationContent_Approval{ + Approval: &proto.ApprovalDecision{Approved: true}, + }, + }, + }, }, }, }, }, }} } else { - decision = []*proto.Message{{ - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Confirmation{ - Confirmation: &proto.ConfirmationContent{ - Id: conf.Id, - Decision: &proto.ConfirmationContent_Decline{ - Decline: &proto.DeclineDecision{Declined: true}, + decision = []*proto.Step{{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + { + Type: &proto.Content_Confirmation{ + Confirmation: &proto.ConfirmationContent{ + Id: conf.Id, + Decision: &proto.ConfirmationContent_Decline{ + Decline: &proto.DeclineDecision{Declined: true}, + }, + }, + }, }, }, }, @@ -241,7 +255,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] reqCtx, cancel := context.WithCancel(ctx) interruptHandler.SetActiveCancel(cancel) - conf, err = runAutoExec(reqCtx, d, &proto.CreateInteractionRequest{ + conf, err = runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{ ConversationId: id, HarnessId: harnessID, HarnessConfig: harnessConfig, @@ -254,6 +268,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] if err != nil { if errors.Is(err, context.Canceled) { fmt.Println("Request canceled.") + inputs = nil break } return err @@ -265,8 +280,6 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] } // Per-request config: clear the config after each turn. - harnessConfig = nil - var quit bool input, harnessConfig, quit, err = promptUser(d, "", harnessConfig) if err != nil { @@ -276,13 +289,19 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] return nil } - inputs = []*proto.Message{ + inputs = []*proto.Step{ { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{ - Text: input, + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + { + Type: &proto.Content_Text{ + Text: &proto.TextContent{ + Text: input, + }, + }, + }, }, }, }, @@ -291,7 +310,7 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] } } -func runAutoExec(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { +func runAutoExec(ctx context.Context, d *internal.Display, req *proto.CreateInteractionEvent) (*proto.ConfirmationContent, error) { fn := runExecHeadless if execServerAddr != "" { fn = runExecServer @@ -299,16 +318,22 @@ func runAutoExec(ctx context.Context, d *internal.Display, req *proto.CreateInte return fn(ctx, d, req) } -func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { +func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.CreateInteractionEvent) (*proto.ConfirmationContent, error) { var confirmation *proto.ConfirmationContent - var lastStep int32 + var lastStep int64 outputHandler := cliutil.ExecHandler(func(resp *proto.CreateInteractionResponse) error { - for _, m := range resp.Outputs { - if conf := m.GetContent().GetConfirmation(); conf != nil { - confirmation = conf + for _, step := range resp.Outputs { + if step.Index != 0 { + lastStep = step.Index + } + if contentStep := step.GetContent(); contentStep != nil { + for _, c := range contentStep.Content { + if conf := c.GetConfirmation(); conf != nil { + confirmation = conf + } + } } } - lastStep = resp.Step displayContents(d, resp.Outputs) return nil }) @@ -317,12 +342,16 @@ func runExecHeadless(ctx context.Context, d *internal.Display, req *proto.Create } if confirmation == nil { - d.FinishOutput(fmt.Sprintf("step=%d", lastStep)) + if lastStep != 0 { + d.FinishOutput(fmt.Sprintf("step=%d", lastStep)) + } else { + d.FinishOutput("") + } } return confirmation, nil } -func runExecServer(ctx context.Context, d *internal.Display, req *proto.CreateInteractionRequest) (*proto.ConfirmationContent, error) { +func runExecServer(ctx context.Context, d *internal.Display, req *proto.CreateInteractionEvent) (*proto.ConfirmationContent, error) { conn, err := connect(execServerAddr) if err != nil { return nil, err @@ -336,7 +365,7 @@ func runExecServer(ctx context.Context, d *internal.Display, req *proto.CreateIn } var confirmation *proto.ConfirmationContent - var lastStep int32 + var lastStep int64 for { resp, err := stream.Recv() if err == io.EOF { @@ -345,27 +374,35 @@ func runExecServer(ctx context.Context, d *internal.Display, req *proto.CreateIn if err != nil { return nil, fmt.Errorf("error receiving response: %w", err) } - lastStep = resp.Step if resp.Outputs != nil { - for _, m := range resp.Outputs { - if conf := m.GetContent().GetConfirmation(); conf != nil { - confirmation = conf + for _, step := range resp.Outputs { + if step.Index != 0 { + lastStep = step.Index + } + if contentStep := step.GetContent(); contentStep != nil { + for _, c := range contentStep.Content { + if conf := c.GetConfirmation(); conf != nil { + confirmation = conf + } + } } } displayContents(d, resp.Outputs) } } if confirmation == nil { - d.FinishOutput(fmt.Sprintf("step=%d", lastStep)) + if lastStep != 0 { + d.FinishOutput(fmt.Sprintf("step=%d", lastStep)) + } else { + d.FinishOutput("") + } } return confirmation, nil } -func displayContents(d *internal.Display, contents []*proto.Message) { - for _, output := range contents { - if content := output.GetContent(); content != nil { - d.Display(content) - } +func displayContents(d *internal.Display, steps []*proto.Step) { + for _, step := range steps { + d.Display(step) } } diff --git a/cmd/ax/harnessclient.go b/cmd/ax/harnessclient.go index dc0f778e..4bee89bb 100644 --- a/cmd/ax/harnessclient.go +++ b/cmd/ax/harnessclient.go @@ -79,11 +79,15 @@ func runHarnessClient(cmd *cobra.Command, args []string) error { HarnessId: harnessClientID, Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ - Messages: []*proto.Message{ + Steps: []*proto.Step{ { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{Text: &proto.TextContent{Text: input}}, + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + {Type: &proto.Content_Text{Text: &proto.TextContent{Text: input}}}, + }, + }, }, }, }, @@ -108,12 +112,16 @@ func runHarnessClient(cmd *cobra.Command, args []string) error { } switch payload := resp.Type.(type) { case *proto.HarnessResponse_Outputs: - for i, m := range payload.Outputs.Messages { - var text string - if tb, ok := m.Content.Type.(*proto.Content_Text); ok { - text = tb.Text.Text + for i, step := range payload.Outputs.Steps { + if contentStep := step.GetContent(); contentStep != nil { + for _, c := range contentStep.Content { + var text string + if tb, ok := c.Type.(*proto.Content_Text); ok { + text = tb.Text.Text + } + fmt.Printf("Server > step[%d] (%s): %s\n", i, contentStep.Role, text) + } } - fmt.Printf("Server > message[%d] (%s): %s\n", i, m.Role, text) } case *proto.HarnessResponse_End: if errDetail := payload.End.GetError(); errDetail != nil { diff --git a/cmd/ax/internal/display.go b/cmd/ax/internal/display.go index c3a38072..eb359b7a 100644 --- a/cmd/ax/internal/display.go +++ b/cmd/ax/internal/display.go @@ -89,45 +89,24 @@ func (d *Display) DisplayInput(text string) { fmt.Fprintln(d.w) } -// Display prints a content block according to its type. -func (d *Display) Display(content *proto.Content) { - if content == nil { +// Display prints a step according to its type. +func (d *Display) Display(step *proto.Step) { + if step == nil { return } - switch o := content.Type.(type) { - case *proto.Content_Text: - if d.state == stateThought { - fmt.Fprintln(d.w) // end the thinking line + switch o := step.Type.(type) { + case *proto.Step_Content: + if o.Content == nil { + return } - d.state = stateText - fmt.Fprint(d.w, o.Text.Text) - - case *proto.Content_Confirmation: - // Let the confirmation prompt handle displaying the question. - - case *proto.Content_ToolCall: - // Tool calls aren't rendered, but they mark a boundary between - // contiguous text/thought blocks. Terminate the current line so the - // next response starts fresh instead of running into the previous one - // (e.g. "...configured.I will list..."). - if d.state != stateNone { - fmt.Fprintln(d.w) - d.state = stateNone + for _, content := range o.Content.Content { + d.displayContent(content) } - case *proto.Content_ToolResult: - // Only print if the tool returned an error, otherwise skip - tr := o.ToolResult - if fr := tr.GetFunctionResult(); fr != nil { - if fr.GetResponse() != nil { - respMap := fr.GetResponse().AsMap() - if errStr, ok := respMap["error"]; ok { - d.displaySystem(fmt.Sprintf("[TOOL ERROR for %s]\n%v", fr.Name, errStr)) - } - } + case *proto.Step_Thought: + if o.Thought == nil { + return } - - case *proto.Content_Thought: for _, summary := range o.Thought.GetSummary() { if textContent := summary.GetText(); textContent != nil { if d.state != stateThought { @@ -141,6 +120,39 @@ func (d *Display) Display(content *proto.Content) { } } + case *proto.Step_ToolCall: + // Tool calls aren't rendered, but they mark a boundary between + // contiguous text/thought blocks. Terminate the current line so the + // next response starts fresh instead of running into the previous one + // (e.g. "...configured.I will list..."). + if d.state != stateNone { + fmt.Fprintln(d.w) + d.state = stateNone + } + + case *proto.Step_ToolResult: + // Tool results aren't rendered. + + default: + d.displaySystem(fmt.Sprintf("unknown step type: %v", o)) + } +} + +func (d *Display) displayContent(content *proto.Content) { + if content == nil { + return + } + switch o := content.Type.(type) { + case *proto.Content_Text: + if d.state == stateThought { + fmt.Fprintln(d.w) // end the thinking line + } + d.state = stateText + fmt.Fprint(d.w, o.Text.Text) + + case *proto.Content_Confirmation: + // Let the confirmation prompt handle displaying the question. + case *proto.Content_Image, *proto.Content_Audio, *proto.Content_Video, *proto.Content_Document: d.displaySystem(fmt.Sprintf("unsupported output type for display: %T", o)) diff --git a/cmd/ax/internal/display_test.go b/cmd/ax/internal/display_test.go index edd4b462..6095fbca 100644 --- a/cmd/ax/internal/display_test.go +++ b/cmd/ax/internal/display_test.go @@ -22,76 +22,36 @@ import ( ) func TestDisplay_Streaming(t *testing.T) { - textContent := func(txt string) *proto.Content { - return &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: txt}}} - } - thoughtContent := func(txt string) *proto.Content { - return &proto.Content{Type: &proto.Content_Thought{Thought: &proto.ThoughtContent{ - Summary: []*proto.ThoughtSummaryContent{ - {Type: &proto.ThoughtSummaryContent_Text{Text: &proto.TextContent{Text: txt}}}, + stepText := func(txt string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Content: []*proto.Content{ + {Type: &proto.Content_Text{Text: &proto.TextContent{Text: txt}}}, + }, + }, }, - }}} - } - toolCallContent := func() *proto.Content { - return &proto.Content{Type: &proto.Content_ToolCall{ToolCall: &proto.ToolCallContent{}}} - } - - t.Run("consecutive text chunks are concatenated", func(t *testing.T) { - t.Parallel() - var buf bytes.Buffer - d := NewDisplay("test-id", &buf) - - d.Display(textContent("Hello ")) - d.Display(textContent("world")) - d.Display(textContent("!")) - - got := buf.String() - want := "Hello world!" - if got != want { - t.Errorf("got %q, want %q", got, want) } - }) - - t.Run("tool call separates consecutive text blocks", func(t *testing.T) { - t.Parallel() - var buf bytes.Buffer - d := NewDisplay("test-id", &buf) - - d.Display(textContent("...configured.")) - d.Display(toolCallContent()) - d.Display(textContent("I will list the contents.")) - - got := buf.String() - want := "...configured.\nI will list the contents." - if got != want { - t.Errorf("got %q, want %q", got, want) - } - }) - - t.Run("repeated tool calls do not add extra newlines", func(t *testing.T) { - t.Parallel() - var buf bytes.Buffer - d := NewDisplay("test-id", &buf) - - d.Display(textContent("Done.")) - d.Display(toolCallContent()) - d.Display(toolCallContent()) - d.Display(textContent("Next.")) - - got := buf.String() - want := "Done.\nNext." - if got != want { - t.Errorf("got %q, want %q", got, want) + } + stepThought := func(txt string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Thought{ + Thought: &proto.ThoughtStep{ + Summary: []*proto.Content{ + {Type: &proto.Content_Text{Text: &proto.TextContent{Text: txt}}}, + }, + }, + }, } - }) + } t.Run("consecutive thought chunks are concatenated with prefix", func(t *testing.T) { t.Parallel() var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(thoughtContent("thinking ")) - d.Display(thoughtContent("deeply")) + d.Display(stepThought("thinking ")) + d.Display(stepThought("deeply")) got := buf.String() want := "Thinking: thinking deeply" @@ -105,8 +65,8 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(thoughtContent("thinking")) - d.Display(textContent("Hello")) + d.Display(stepThought("thinking")) + d.Display(stepText("Hello")) got := buf.String() want := "Thinking: thinking\nHello" @@ -120,8 +80,8 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(textContent("Hello")) - d.Display(thoughtContent("thinking")) + d.Display(stepText("Hello")) + d.Display(stepThought("thinking")) got := buf.String() want := "Hello\nThinking: thinking" @@ -135,7 +95,7 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(textContent("Hello")) + d.Display(stepText("Hello")) d.FinishOutput("") got := buf.String() @@ -150,7 +110,7 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(textContent("Hello")) + d.Display(stepText("Hello")) d.FinishOutput("seq=1") got := buf.String() @@ -167,7 +127,7 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(textContent("Hello")) + d.Display(stepText("Hello")) d.displaySystem("system message") got := buf.String() @@ -182,7 +142,7 @@ func TestDisplay_Streaming(t *testing.T) { var buf bytes.Buffer d := NewDisplay("test-id", &buf) - d.Display(textContent("Hello")) + d.Display(stepText("Hello")) d.DisplayInput("prompt") got := buf.String() diff --git a/internal/cmd/e2e/main.go b/internal/cmd/e2e/main.go index c6d21f4b..a922896f 100644 --- a/internal/cmd/e2e/main.go +++ b/internal/cmd/e2e/main.go @@ -99,27 +99,37 @@ func runDemo(ctx context.Context, harnessID string, setupRegistry func(reg *cont handler := controller.ExecHandler(func(resp *proto.CreateInteractionResponse) error { for _, out := range resp.Outputs { - if textContent := out.GetContent().GetText().GetText(); textContent != "" { - fmt.Printf("Agent Output: %s\n", textContent) - } else if toolCall := out.GetContent().GetToolCall(); toolCall != nil { + if contentStep := out.GetContent(); contentStep != nil { + for _, c := range contentStep.Content { + if textContent := c.GetText().GetText(); textContent != "" { + fmt.Printf("Agent Output: %s\n", textContent) + } + } + } else if toolCall := out.GetToolCall(); toolCall != nil { fmt.Printf("Agent Triggered Tool Call: %s (ID: %s)\n", toolCall.GetFunctionCall().Name, toolCall.Id) } } return nil }) - inputs := []*proto.Message{ + inputs := []*proto.Step{ { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{Text: "What is the weather in New York?"}, + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{ + { + Type: &proto.Content_Text{ + Text: &proto.TextContent{Text: "What is the weather in New York?"}, + }, + }, + }, }, }, }, } - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: "e2e-conv", Inputs: inputs, HarnessId: harnessID, diff --git a/internal/controller/controller.go b/internal/controller/controller.go index afeeaf2d..26ee0518 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -64,7 +64,7 @@ func New(ctx context.Context, cfg Config) (*Controller, error) { // Exec executes a new agentic loop execution or resumes an existing one. // If id is empty, a UUID will be generated. // If the execution already exists, it will be resumed with optional new inputs. -func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionRequest, handler ExecHandler) error { +func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent, handler ExecHandler) error { if req.ConversationId == "" { return fmt.Errorf("conversation_id is required") } @@ -149,10 +149,10 @@ type harnessHandler struct { execHandler ExecHandler } -func (a *harnessHandler) OnMessage(ctx context.Context, execID string, msg *proto.Message) error { +func (a *harnessHandler) OnMessage(ctx context.Context, execID string, step *proto.Step) error { // Log every response received from the harness // TODO(anj): The harness should send the full input sent to get this particular response. - step, err := a.logger.LogOutputs(ctx, []*proto.Message{msg}, proto.State_STATE_PENDING) + logStep, err := a.logger.LogOutputs(ctx, []*proto.Step{step}, proto.State_STATE_PENDING) if err != nil { slog.WarnContext(ctx, "Failed to log streamed message to event log", slog.String("conversation_id", a.logger.conversationID), @@ -160,23 +160,29 @@ func (a *harnessHandler) OnMessage(ctx context.Context, execID string, msg *prot ) } + if step != nil { + step.Index = logStep + } + if a.execHandler == nil { return nil } return a.execHandler(&proto.CreateInteractionResponse{ - Outputs: []*proto.Message{msg}, - Step: step, + Outputs: []*proto.Step{step}, }) } func (a *harnessHandler) OnComplete(ctx context.Context, execID string) error { // Mark the execution turn as completed in the conversation log if _, err := a.logger.LogOutputs(ctx, nil, proto.State_STATE_COMPLETED); err != nil { - slog.WarnContext(ctx, "Failed to log completion event to event log", + slog.WarnContext(ctx, "Failed to mark completion state in event log", slog.String("conversation_id", a.logger.conversationID), slog.Any("error", err), ) } + if a.execHandler == nil { + return nil + } return nil } @@ -205,6 +211,13 @@ func (d *Controller) Close() error { return nil } +type logger struct { + conversationID string + interactionID string + el eventlog.EventLog + harnessID string +} + func newLogger( el eventlog.EventLog, conversationID string, @@ -216,13 +229,6 @@ func newLogger( } } -type logger struct { - conversationID string - execID string - el eventlog.EventLog - harnessID string -} - // ResumptionState returns the conversation's current state and the harness it used. func (l *logger) ResumptionState(ctx context.Context) (proto.State, string, error) { events, err := l.el.Events(ctx, l.conversationID) @@ -236,16 +242,14 @@ func (l *logger) ResumptionState(ctx context.Context) (proto.State, string, erro if harnessID == "" && ev.HarnessId != "" { harnessID = ev.HarnessId } - if l.execID == "" || ev.ExecId == l.execID { - if ev.State != proto.State_STATE_UNSPECIFIED { - state = ev.State - } + if ev.State != proto.State_STATE_UNSPECIFIED { + state = ev.State } } return state, harnessID, nil } -func (l *logger) LogInputs(ctx context.Context, inputs []*proto.Message, harnessConfig []byte) (int32, error) { +func (l *logger) LogInputs(ctx context.Context, steps []*proto.Step, harnessConfig []byte) (int64, error) { // Parse the harness config into a human-readable struct for logging. var cfg *structpb.Struct if len(harnessConfig) > 0 { @@ -258,22 +262,22 @@ func (l *logger) LogInputs(ctx context.Context, inputs []*proto.Message, harness cfg = nil } } - ev := &proto.ConversationEvent{ + ev := &proto.StepEvent{ ConversationId: l.conversationID, - ExecId: l.execID, + InteractionId: l.interactionID, HarnessId: l.harnessID, HarnessConfig: cfg, - Messages: inputs, + Steps: steps, State: proto.State_STATE_PENDING, } return l.el.Append(ctx, ev) } -func (l *logger) LogOutputs(ctx context.Context, outputs []*proto.Message, state proto.State) (int32, error) { - ev := &proto.ConversationEvent{ +func (l *logger) LogOutputs(ctx context.Context, steps []*proto.Step, state proto.State) (int64, error) { + ev := &proto.StepEvent{ ConversationId: l.conversationID, - ExecId: l.execID, - Messages: outputs, + InteractionId: l.interactionID, + Steps: steps, State: state, } return l.el.Append(ctx, ev) diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.go index 4696d60d..020206f4 100644 --- a/internal/controller/controller_test.go +++ b/internal/controller/controller_test.go @@ -23,6 +23,7 @@ import ( "github.com/google/ax/internal/controller/eventlog" "github.com/google/ax/internal/controller/eventlog/eventlogtest" "github.com/google/ax/internal/harness" + "github.com/google/ax/internal/harness/harnesstest" "github.com/google/ax/proto" ) @@ -34,30 +35,36 @@ func (f *fakeHarness) Start(ctx context.Context, conversationID string, harnessC type fakeExecution struct { id string - queued []*proto.Message + queued []*proto.Step } func (f *fakeExecution) ID() string { return f.id } -func (f *fakeExecution) Queue(ctx context.Context, msg ...*proto.Message) error { - f.queued = append(f.queued, msg...) +func (f *fakeExecution) Queue(ctx context.Context, steps ...*proto.Step) error { + f.queued = append(f.queued, steps...) return nil } func (f *fakeExecution) Run(ctx context.Context, handler harness.Handler) error { - msg := &proto.Message{ - Role: "assistant", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{ - Text: "Hello world", + step := &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "assistant", + Content: []*proto.Content{ + { + Type: &proto.Content_Text{ + Text: &proto.TextContent{ + Text: "Hello world", + }, + }, + }, }, }, }, } - if err := handler.OnMessage(ctx, f.id, msg); err != nil { + if err := handler.OnMessage(ctx, f.id, step); err != nil { return err } return handler.OnComplete(ctx, f.id) @@ -91,26 +98,15 @@ func TestController2_ExecHelloWorld(t *testing.T) { } defer c.Close() - var outputs []*proto.Message + var outputs []*proto.Step handler := ExecHandler(func(resp *proto.CreateInteractionResponse) error { outputs = append(outputs, resp.Outputs...) return nil }) - inputs := []*proto.Message{ - { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{Text: "Trigger prompt"}, - }, - }, - }, - } - - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - Inputs: inputs, + Inputs: []*proto.Step{harnesstest.UserStep("Trigger prompt")}, }, handler) if err != nil { t.Fatalf("Controller2.Exec failed: %v", err) @@ -120,7 +116,7 @@ func TestController2_ExecHelloWorld(t *testing.T) { t.Fatalf("expected exactly 1 output message, got %d", len(outputs)) } - gotText := outputs[0].GetContent().GetText().GetText() + gotText := outputs[0].GetContent().Content[0].GetText().GetText() if gotText != "Hello world" { t.Errorf("expected 'Hello world' output text response, got %q", gotText) } @@ -136,10 +132,10 @@ func TestController2_ExecHelloWorld(t *testing.T) { } // 1. First event should be inputs - if len(events[0].Messages) != 1 { - t.Errorf("expected 1 message in first event, got %d", len(events[0].Messages)) + if len(events[0].Steps) != 1 { + t.Errorf("expected 1 step in first event, got %d", len(events[0].Steps)) } else { - gotInputText := events[0].Messages[0].GetContent().GetText().GetText() + gotInputText := events[0].Steps[0].GetContent().Content[0].GetText().GetText() if gotInputText != "Trigger prompt" { t.Errorf("expected 'Trigger prompt' in logged input, got %q", gotInputText) } @@ -149,10 +145,10 @@ func TestController2_ExecHelloWorld(t *testing.T) { } // 2. Second event should be output - if len(events[1].Messages) != 1 { - t.Errorf("expected 1 message in second event, got %d", len(events[1].Messages)) + if len(events[1].Steps) != 1 { + t.Errorf("expected 1 step in second event, got %d", len(events[1].Steps)) } else { - gotOutputText := events[1].Messages[0].GetContent().GetText().GetText() + gotOutputText := events[1].Steps[0].GetContent().Content[0].GetText().GetText() if gotOutputText != "Hello world" { t.Errorf("expected 'Hello world' in logged output, got %q", gotOutputText) } @@ -162,8 +158,8 @@ func TestController2_ExecHelloWorld(t *testing.T) { } // 3. Third event should be completion - if len(events[2].Messages) != 0 { - t.Errorf("expected 0 messages in third event, got %d", len(events[2].Messages)) + if len(events[2].Steps) != 0 { + t.Errorf("expected 0 steps in third event, got %d", len(events[2].Steps)) } if events[2].State != proto.State_STATE_COMPLETED { t.Errorf("expected third event state to be COMPLETED, got %v", events[2].State) @@ -192,27 +188,16 @@ func TestController2_ExecWithAgentID(t *testing.T) { } defer c.Close() - var outputs []*proto.Message + var outputs []*proto.Step handler := ExecHandler(func(resp *proto.CreateInteractionResponse) error { outputs = append(outputs, resp.Outputs...) return nil }) - inputs := []*proto.Message{ - { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{Text: "Trigger prompt"}, - }, - }, - }, - } - - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "my-agent", - Inputs: inputs, + Inputs: []*proto.Step{harnesstest.UserStep("Trigger prompt")}, }, handler) if err != nil { t.Fatalf("Controller2.Exec failed: %v", err) @@ -222,7 +207,7 @@ func TestController2_ExecWithAgentID(t *testing.T) { t.Fatalf("expected exactly 1 output message, got %d", len(outputs)) } - gotText := outputs[0].GetContent().GetText().GetText() + gotText := outputs[0].GetContent().Content[0].GetText().GetText() if gotText != "Hello world" { t.Errorf("expected 'Hello world' output text response, got %q", gotText) } @@ -250,21 +235,10 @@ func TestController2_ExecHarnessNotFound(t *testing.T) { return nil }) - inputs := []*proto.Message{ - { - Role: "user", - Content: &proto.Content{ - Type: &proto.Content_Text{ - Text: &proto.TextContent{Text: "Trigger prompt"}, - }, - }, - }, - } - - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - Inputs: inputs, HarnessId: "antigravity", + Inputs: []*proto.Step{harnesstest.UserStep("Trigger prompt")}, }, handler) if err == nil { t.Fatal("expected error requesting unregistered agent, got nil") @@ -286,7 +260,7 @@ type testExecution struct { queueCalls int runCalls int closeCalls int - queued []*proto.Message + queued []*proto.Step runFunc func(ctx context.Context, execID string, handler harness.Handler) error } @@ -294,9 +268,9 @@ func (c *testExecution) ID() string { return c.id } -func (c *testExecution) Queue(ctx context.Context, msg ...*proto.Message) error { +func (c *testExecution) Queue(ctx context.Context, steps ...*proto.Step) error { c.queueCalls++ - c.queued = append(c.queued, msg...) + c.queued = append(c.queued, steps...) return nil } @@ -347,12 +321,10 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "test-agent", - Inputs: []*proto.Message{ - {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "Hello"}}}}, - }, + Inputs: []*proto.Step{harnesstest.UserStep("Hello")}, }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { t.Fatal(err) @@ -376,13 +348,11 @@ func TestController2_ExecResumptionFlow(t *testing.T) { log := &eventlogtest.MemoryEventLog{} // Seed the event log with a pending event - _, err := log.Append(ctx, &proto.ConversationEvent{ + _, err := log.Append(ctx, &proto.StepEvent{ ConversationId: cid, HarnessId: "test-agent", State: proto.State_STATE_PENDING, - Messages: []*proto.Message{ - {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "Initial"}}}}, - }, + Steps: []*proto.Step{harnesstest.UserStep("Initial")}, }) if err != nil { t.Fatal(err) @@ -415,7 +385,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "test-agent", Inputs: nil, // NO new inputs @@ -442,13 +412,11 @@ func TestController2_ExecResumptionFlow(t *testing.T) { log := &eventlogtest.MemoryEventLog{} // Seed the event log with a pending event - _, err := log.Append(ctx, &proto.ConversationEvent{ + _, err := log.Append(ctx, &proto.StepEvent{ ConversationId: cid, HarnessId: "test-agent", State: proto.State_STATE_PENDING, - Messages: []*proto.Message{ - {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "Initial"}}}}, - }, + Steps: []*proto.Step{harnesstest.UserStep("Initial")}, }) if err != nil { t.Fatal(err) @@ -482,12 +450,10 @@ func TestController2_ExecResumptionFlow(t *testing.T) { } defer c.Close() - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "test-agent", - Inputs: []*proto.Message{ - {Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "New input"}}}}, - }, + Inputs: []*proto.Step{harnesstest.UserStep("New input")}, }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { t.Fatal(err) @@ -555,19 +521,19 @@ func TestExec_ResumeEmptyHarnessUsesStored(t *testing.T) { noop := ExecHandler(func(*proto.CreateInteractionResponse) error { return nil }) // Turn 1: explicitly run the NON-default harness. - if err := c.Exec(ctx, &proto.CreateInteractionRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "harness-b", - Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, + Inputs: []*proto.Step{harnesstest.UserStep("hi")}, }, noop); err != nil { t.Fatalf("turn 1: %v", err) } // Turn 2: resume WITHOUT a harness id. Must reuse harness-b, not the default. before := stored.startCalls - if err := c.Exec(ctx, &proto.CreateInteractionRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "more"}}}}}, + Inputs: []*proto.Step{harnesstest.UserStep("more")}, }, noop); err != nil { t.Fatalf("turn 2 (resume, empty harness): %v", err) } @@ -607,17 +573,17 @@ func TestExec_ResumeExplicitDifferentHarnessRejected(t *testing.T) { noop := ExecHandler(func(*proto.CreateInteractionResponse) error { return nil }) - if err := c.Exec(ctx, &proto.CreateInteractionRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "harness-a", - Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, + Inputs: []*proto.Step{harnesstest.UserStep("hi")}, }, noop); err != nil { t.Fatalf("turn 1: %v", err) } - err = c.Exec(ctx, &proto.CreateInteractionRequest{ + err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, HarnessId: "harness-b", - Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "more"}}}}}, + Inputs: []*proto.Step{harnesstest.UserStep("more")}, }, noop) if err == nil || !strings.Contains(err.Error(), "harness ID changed from harness-a to harness-b") { t.Fatalf("resume with a different harness: got %v, want error 'harness ID changed from harness-a to harness-b'", err) @@ -649,9 +615,9 @@ func TestExec_NewConversationLogsCanonicalDefault(t *testing.T) { } defer c.Close() - if err := c.Exec(ctx, &proto.CreateInteractionRequest{ + if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - Inputs: []*proto.Message{{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "hi"}}}}}, + Inputs: []*proto.Step{harnesstest.UserStep("hi")}, }, ExecHandler(func(*proto.CreateInteractionResponse) error { return nil })); err != nil { t.Fatalf("exec: %v", err) } diff --git a/internal/controller/eventlog/eventlog.go b/internal/controller/eventlog/eventlog.go index 4e5e1883..16956abb 100644 --- a/internal/controller/eventlog/eventlog.go +++ b/internal/controller/eventlog/eventlog.go @@ -29,11 +29,11 @@ type EventLogBuilder func() (EventLog, error) // exec. Every entry is an atomic step: replaying the log in order brings // the executor back to a consistent state from which execution can resume. type EventLog interface { - // Append adds a conversation event to the end of the log. - Append(ctx context.Context, event *proto.ConversationEvent) (int32, error) + // Append adds a step event to the end of the log. + Append(ctx context.Context, event *proto.StepEvent) (int64, error) // Events returns all events for the conversation. - Events(ctx context.Context, conversationID string) ([]*proto.ConversationEvent, error) + Events(ctx context.Context, conversationID string) ([]*proto.StepEvent, error) // DeleteAll deletes all events for a specific conversation ID. DeleteAll(ctx context.Context, conversationID string) error diff --git a/internal/controller/eventlog/eventlogtest/eventlog.go b/internal/controller/eventlog/eventlogtest/eventlog.go index 58235136..9c7b80e7 100644 --- a/internal/controller/eventlog/eventlogtest/eventlog.go +++ b/internal/controller/eventlog/eventlogtest/eventlog.go @@ -25,33 +25,29 @@ import ( // executions. It does not survive process restarts. type MemoryEventLog struct { mu sync.Mutex - AllEvents []*proto.ConversationEvent + AllEvents []*proto.StepEvent } -func (m *MemoryEventLog) Append(_ context.Context, event *proto.ConversationEvent) (int32, error) { +func (m *MemoryEventLog) Append(_ context.Context, event *proto.StepEvent) (int64, error) { m.mu.Lock() defer m.mu.Unlock() - step := event.Step - if step == 0 { - maxStep := int32(0) - for _, ev := range m.AllEvents { - if ev.ConversationId == event.ConversationId && ev.Step > maxStep { - maxStep = ev.Step - } + maxStep := int64(0) + for _, ev := range m.AllEvents { + if ev.ConversationId == event.ConversationId { + maxStep++ } - step = maxStep + 1 - event.Step = step } + step := maxStep + 1 m.AllEvents = append(m.AllEvents, event) return step, nil } -func (m *MemoryEventLog) Events(_ context.Context, conversationID string) ([]*proto.ConversationEvent, error) { +func (m *MemoryEventLog) Events(_ context.Context, conversationID string) ([]*proto.StepEvent, error) { m.mu.Lock() defer m.mu.Unlock() - out := make([]*proto.ConversationEvent, 0) + out := make([]*proto.StepEvent, 0) for _, ev := range m.AllEvents { if ev.ConversationId == conversationID { out = append(out, ev) @@ -62,7 +58,7 @@ func (m *MemoryEventLog) Events(_ context.Context, conversationID string) ([]*pr // Drop removes every event for which drop returns true. // It is provided for testing and crash-simulation purposes. -func (m *MemoryEventLog) Drop(drop func(*proto.ConversationEvent) bool) { +func (m *MemoryEventLog) Drop(drop func(*proto.StepEvent) bool) { m.mu.Lock() defer m.mu.Unlock() @@ -79,7 +75,7 @@ func (m *MemoryEventLog) DeleteAll(_ context.Context, conversationID string) err m.mu.Lock() defer m.mu.Unlock() - var keptEvents []*proto.ConversationEvent + var keptEvents []*proto.StepEvent for _, ev := range m.AllEvents { if ev.ConversationId != conversationID { keptEvents = append(keptEvents, ev) diff --git a/internal/controller/eventlog/sql.go b/internal/controller/eventlog/sql.go index e584285d..54ef3651 100644 --- a/internal/controller/eventlog/sql.go +++ b/internal/controller/eventlog/sql.go @@ -33,7 +33,7 @@ type sqlEventLog struct { } // Append serializes the event to JSON and inserts it into the database. -func (l *sqlEventLog) Append(ctx context.Context, event *proto.ConversationEvent) (step int32, err error) { +func (l *sqlEventLog) Append(ctx context.Context, event *proto.StepEvent) (step int64, err error) { ctx, endSpan := l.startSpan(ctx, "Append", event.ConversationId) defer func() { endSpan(err) }() @@ -43,12 +43,8 @@ func (l *sqlEventLog) Append(ctx context.Context, event *proto.ConversationEvent } defer tx.Rollback() - step = event.Step - if step == 0 { - if err := tx.QueryRowContext(ctx, "SELECT COALESCE(MAX(step), 0) + 1 FROM conversation_log WHERE conversation_id = $1", event.ConversationId).Scan(&step); err != nil { - return 0, fmt.Errorf("eventlog: compute step: %w", err) - } - event.Step = step + if err := tx.QueryRowContext(ctx, "SELECT COALESCE(MAX(step), 0) + 1 FROM conversation_log WHERE conversation_id = $1", event.ConversationId).Scan(&step); err != nil { + return 0, fmt.Errorf("eventlog: compute step: %w", err) } payload, err := marshalOpts.Marshal(event) @@ -58,7 +54,7 @@ func (l *sqlEventLog) Append(ctx context.Context, event *proto.ConversationEvent if _, err := tx.ExecContext(ctx, "INSERT INTO conversation_log (conversation_id, step, payload) VALUES ($1, $2, $3)", - event.ConversationId, event.Step, string(payload)); err != nil { + event.ConversationId, step, string(payload)); err != nil { return 0, fmt.Errorf("eventlog: insert conversation: %w", err) } @@ -70,7 +66,7 @@ func (l *sqlEventLog) Append(ctx context.Context, event *proto.ConversationEvent } // Events retrieves all events from the database for a conversation, ordered by step. -func (l *sqlEventLog) Events(ctx context.Context, conversationID string) (events []*proto.ConversationEvent, err error) { +func (l *sqlEventLog) Events(ctx context.Context, conversationID string) (events []*proto.StepEvent, err error) { ctx, endSpan := l.startSpan(ctx, "Events", conversationID) defer func() { endSpan(err) }() @@ -86,7 +82,7 @@ func (l *sqlEventLog) Events(ctx context.Context, conversationID string) (events return nil, fmt.Errorf("eventlog: scan conversation: %w", err) } - ev := &proto.ConversationEvent{} + ev := &proto.StepEvent{} if err := unmarshalOpts.Unmarshal([]byte(payload), ev); err != nil { return nil, fmt.Errorf("eventlog: unmarshal event: %w", err) } diff --git a/internal/controller/eventlog/sql_test.go b/internal/controller/eventlog/sql_test.go index 4f07b07f..4330aecb 100644 --- a/internal/controller/eventlog/sql_test.go +++ b/internal/controller/eventlog/sql_test.go @@ -43,12 +43,14 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { t.Cleanup(func() { _ = log.DeleteAll(ctx, conv) }) // 1. Conversation log. - cev1 := &proto.ConversationEvent{ConversationId: conv, Step: 1, ExecId: task1} - cev2 := &proto.ConversationEvent{ConversationId: conv, Step: 2, ExecId: task2} - if _, err := log.Append(ctx, cev1); err != nil { + cev1 := &proto.StepEvent{ConversationId: conv, InteractionId: task1} + cev2 := &proto.StepEvent{ConversationId: conv, InteractionId: task2} + s1, err := log.Append(ctx, cev1) + if err != nil { t.Fatalf("failed to append cev1: %v", err) } - if _, err := log.Append(ctx, cev2); err != nil { + s2, err := log.Append(ctx, cev2) + if err != nil { t.Fatalf("failed to append cev2: %v", err) } @@ -59,11 +61,11 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { if len(cEvents) != 2 { t.Fatalf("expected 2 conversation events, got %d", len(cEvents)) } - if cEvents[0].Step != 1 || cEvents[1].Step != 2 { - t.Errorf("conversation events out of order: %d, %d", cEvents[0].Step, cEvents[1].Step) + if s1 != 1 || s2 != 2 { + t.Errorf("conversation events out of order: %d, %d", s1, s2) } - if cEvents[0].ExecId != task1 || cEvents[1].ExecId != task2 { - t.Errorf("conversation events mismatch: %q, %q", cEvents[0].ExecId, cEvents[1].ExecId) + if cEvents[0].InteractionId != task1 || cEvents[1].InteractionId != task2 { + t.Errorf("conversation events mismatch: %q, %q", cEvents[0].InteractionId, cEvents[1].InteractionId) } @@ -97,10 +99,10 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { _ = log.DeleteAll(ctx, conv2) }) - if _, err := log.Append(ctx, &proto.ConversationEvent{ConversationId: conv1, Step: 1, ExecId: task1}); err != nil { + if _, err := log.Append(ctx, &proto.StepEvent{ConversationId: conv1, InteractionId: task1}); err != nil { t.Fatalf("append: %v", err) } - if _, err := log.Append(ctx, &proto.ConversationEvent{ConversationId: conv2, Step: 1, ExecId: task3}); err != nil { + if _, err := log.Append(ctx, &proto.StepEvent{ConversationId: conv2, InteractionId: task3}); err != nil { t.Fatalf("append: %v", err) } @@ -129,8 +131,8 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { t.Cleanup(func() { _ = log.DeleteAll(ctx, conv) }) const n = 3 - for i := int32(1); i <= n; i++ { - step, err := log.Append(ctx, &proto.ConversationEvent{ConversationId: conv, ExecId: "t"}) + for i := int64(1); i <= n; i++ { + step, err := log.Append(ctx, &proto.StepEvent{ConversationId: conv, InteractionId: "t"}) if err != nil { t.Fatalf("auto-step append failed: %v", err) } @@ -146,11 +148,6 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { if len(events) != n { t.Fatalf("expected %d events, got %d", n, len(events)) } - for i, e := range events { - if e.Step != int32(i+1) { - t.Errorf("event %d: expected step %d, got %d", i, i+1, e.Step) - } - } }) } diff --git a/internal/harness/antigravity/antigravity.go b/internal/harness/antigravity/antigravity.go index db69ed9b..b817ad88 100644 --- a/internal/harness/antigravity/antigravity.go +++ b/internal/harness/antigravity/antigravity.go @@ -139,7 +139,7 @@ type antigravityExecution struct { harnessConfig []byte mu sync.Mutex - queued []*proto.Message + queued []*proto.Step closed bool } @@ -149,13 +149,13 @@ func (e *antigravityExecution) ID() string { } // Queue implements Execution.Queue. -func (e *antigravityExecution) Queue(ctx context.Context, msg ...*proto.Message) error { +func (e *antigravityExecution) Queue(ctx context.Context, steps ...*proto.Step) error { e.mu.Lock() defer e.mu.Unlock() if e.closed { return fmt.Errorf("execution session already closed") } - e.queued = append(e.queued, msg...) + e.queued = append(e.queued, steps...) return nil } @@ -197,7 +197,7 @@ func (e *antigravityExecution) Run(ctx context.Context, handler harness.Handler) Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ HarnessConfig: e.harnessConfig, - Messages: inputs, + Steps: inputs, }, }, } diff --git a/internal/harness/antigravity/antigravity_test.go b/internal/harness/antigravity/antigravity_test.go index c01ade27..15f5ff09 100644 --- a/internal/harness/antigravity/antigravity_test.go +++ b/internal/harness/antigravity/antigravity_test.go @@ -29,7 +29,7 @@ var antigravityHarnessConfig = []byte(`{"system_instructions":"be terse"}`) func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) { srv := &harnesstest.MockHarnessServer{ - Outputs: []*proto.Message{harnesstest.ThoughtText("Analyzing"), harnesstest.AssistantText("Hello world")}, + Outputs: []*proto.Step{harnesstest.ThoughtStep("Analyzing"), harnesstest.AssistantStep("Hello world")}, } harnessClient, err := New(context.Background(), harnesstest.StartHarnessServer(t, srv), "", false) if err != nil { @@ -42,7 +42,7 @@ func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) { } defer exec.Close(context.Background()) - if err := exec.Queue(context.Background(), harnesstest.UserText("Hi")); err != nil { + if err := exec.Queue(context.Background(), userStep("Hi")); err != nil { t.Fatalf("failed to queue message: %v", err) } @@ -54,14 +54,14 @@ func TestRun_AutoStartFalse_ServerOK_Succeeds(t *testing.T) { if !handler.IsDone() { t.Error("expected OnComplete to be called") } - msgs := handler.Collected() - if len(msgs) != 2 { - t.Fatalf("expected 2 messages, got %d", len(msgs)) + steps := handler.Collected() + if len(steps) != 2 { + t.Fatalf("expected 2 steps, got %d", len(steps)) } - if got := msgs[0].GetContent().GetThought().GetSummary()[0].GetText().GetText(); got != "Analyzing" { + if got := steps[0].GetThought().GetSummary()[0].GetText().GetText(); got != "Analyzing" { t.Errorf("expected 'Analyzing', got %q", got) } - if got := msgs[1].GetContent().GetText().GetText(); got != "Hello world" { + if got := steps[1].GetContent().Content[0].GetText().GetText(); got != "Hello world" { t.Errorf("expected 'Hello world', got %q", got) } // The harness propagated the conversation id and config to the server. @@ -84,7 +84,7 @@ func TestRun_AutoStartFalse_ServerErrorFrame_Fails(t *testing.T) { exec, _ := harnessClient.Start(context.Background(), "conv-test", antigravityHarnessConfig) defer exec.Close(context.Background()) - if err := exec.Queue(context.Background(), harnesstest.UserText("Hi")); err != nil { + if err := exec.Queue(context.Background(), userStep("Hi")); err != nil { t.Fatalf("failed to queue message: %v", err) } @@ -122,3 +122,14 @@ func TestDefaultStateDir(t *testing.T) { t.Errorf("DefaultStateDir() = %q, want %q", got, want) } } + +func userStep(text string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{{Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}}, + }, + }, + } +} diff --git a/internal/harness/antigravityinteractions/antigravityinteractions.go b/internal/harness/antigravityinteractions/antigravityinteractions.go index ce9cc00d..af3bf6b4 100644 --- a/internal/harness/antigravityinteractions/antigravityinteractions.go +++ b/internal/harness/antigravityinteractions/antigravityinteractions.go @@ -276,7 +276,7 @@ type antigravityInteractionsExecution struct { harnessConfig []byte mu sync.Mutex - queued []*proto.Message + queued []*proto.Step closed bool // prevInteractionID chains the turns of the interaction loop (the interaction @@ -293,13 +293,13 @@ func (e *antigravityInteractionsExecution) ID() string { return e.id } // prompt, or steering messages injected mid-run. Tool results are NOT queued by // the caller -- the harness executes all tools itself. Queued messages are // drained at the next interaction gap within Run. -func (e *antigravityInteractionsExecution) Queue(ctx context.Context, msg ...*proto.Message) error { +func (e *antigravityInteractionsExecution) Queue(ctx context.Context, steps ...*proto.Step) error { e.mu.Lock() defer e.mu.Unlock() if e.closed { return fmt.Errorf("execution session already closed") } - e.queued = append(e.queued, msg...) + e.queued = append(e.queued, steps...) return nil } @@ -316,10 +316,10 @@ func (e *antigravityInteractionsExecution) Close(ctx context.Context) error { // messages are folded into the next interaction. func (e *antigravityInteractionsExecution) drainQueue() []any { e.mu.Lock() - msgs := e.queued + steps := e.queued e.queued = nil e.mu.Unlock() - return messagesToInputSteps(msgs) + return stepsToInputSteps(steps) } // setPrevID records the latest interaction id (in memory) and durably persists @@ -438,32 +438,40 @@ func (e *antigravityInteractionsExecution) Run(ctx context.Context, handler harn return handler.OnComplete(ctx, e.id) } -// emitText forwards non-empty model text to the handler as a Message. +// emitText forwards non-empty model text to the handler as a Step. func emitText(ctx context.Context, handler harness.Handler, execID, text string) error { if strings.TrimSpace(text) == "" { return nil } - return handler.OnMessage(ctx, execID, &proto.Message{ - Role: "assistant", - Content: &proto.Content{ - Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}, + return handler.OnMessage(ctx, execID, &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "assistant", + Content: []*proto.Content{ + {Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}, + }, + }, }, }) } -// messagesToInputSteps converts queued ax Messages (human input) into user_input +// stepsToInputSteps converts queued ax Steps (human input) into user_input // steps. Only text content is supported as input today. -func messagesToInputSteps(msgs []*proto.Message) []any { - var steps []any - for _, m := range msgs { - if t, ok := m.GetContent().GetType().(*proto.Content_Text); ok && t.Text.GetText() != "" { - steps = append(steps, userInputStep{ - Type: "user_input", - Content: []textPart{{Type: "text", Text: t.Text.GetText()}}, - }) +func stepsToInputSteps(steps []*proto.Step) []any { + var out []any + for _, s := range steps { + if contentStep := s.GetContent(); contentStep != nil { + for _, part := range contentStep.Content { + if t, ok := part.GetType().(*proto.Content_Text); ok && t.Text.GetText() != "" { + out = append(out, userInputStep{ + Type: "user_input", + Content: []textPart{{Type: "text", Text: t.Text.GetText()}}, + }) + } + } } } - return steps + return out } // --------------------------------------------------------------------------- diff --git a/internal/harness/antigravityinteractions/antigravityinteractions_test.go b/internal/harness/antigravityinteractions/antigravityinteractions_test.go index fe4e17b7..af524a48 100644 --- a/internal/harness/antigravityinteractions/antigravityinteractions_test.go +++ b/internal/harness/antigravityinteractions/antigravityinteractions_test.go @@ -111,7 +111,7 @@ func runOneTurn(t *testing.T, h *AntigravityInteractionsHarness, conversationID, if err != nil { t.Fatalf("Start(%q): %v", conversationID, err) } - if err := exec.Queue(ctx, harnesstest.UserText(prompt)); err != nil { + if err := exec.Queue(ctx, harnesstest.UserStep(prompt)); err != nil { t.Fatalf("Queue: %v", err) } if err := exec.Run(ctx, &harnesstest.MockHandler{}); err != nil { diff --git a/internal/harness/antigravityinteractions/server.go b/internal/harness/antigravityinteractions/server.go index 7d77a438..6e864824 100644 --- a/internal/harness/antigravityinteractions/server.go +++ b/internal/harness/antigravityinteractions/server.go @@ -134,8 +134,8 @@ func (s *server) Connect(stream proto.HarnessService_ConnectServer) error { } defer func() { _ = exec.Close(context.WithoutCancel(ctx)) }() - if len(start.GetMessages()) > 0 { - if err := exec.Queue(ctx, start.GetMessages()...); err != nil { + if len(start.GetSteps()) > 0 { + if err := exec.Queue(ctx, start.GetSteps()...); err != nil { return sendEnd(stream, convID, proto.State_STATE_FAILED, err) } } @@ -188,11 +188,11 @@ type streamHandler struct { var _ harness.Handler = (*streamHandler)(nil) -func (h *streamHandler) OnMessage(_ context.Context, _ string, msg *proto.Message) error { +func (h *streamHandler) OnMessage(_ context.Context, _ string, step *proto.Step) error { err := h.stream.Send(&proto.HarnessResponse{ ConversationId: h.convID, Type: &proto.HarnessResponse_Outputs{ - Outputs: &proto.HarnessOutputs{Messages: []*proto.Message{msg}}, + Outputs: &proto.HarnessOutputs{Steps: []*proto.Step{step}}, }, }) if err != nil { diff --git a/internal/harness/antigravityinteractions/server_test.go b/internal/harness/antigravityinteractions/server_test.go index e0e454b2..679ac037 100644 --- a/internal/harness/antigravityinteractions/server_test.go +++ b/internal/harness/antigravityinteractions/server_test.go @@ -68,7 +68,7 @@ func TestConnect_StartToEnd(t *testing.T) { ConversationId: "conv-1", HarnessId: "antigravity-interactions", Type: &proto.HarnessRequest_Start{ - Start: &proto.HarnessStart{Messages: []*proto.Message{harnesstest.UserText("hello")}}, + Start: &proto.HarnessStart{Steps: []*proto.Step{harnesstest.UserStep("hello")}}, }, }); err != nil { t.Fatalf("send start: %v", err) diff --git a/internal/harness/harness.go b/internal/harness/harness.go index 716f0165..5023db43 100644 --- a/internal/harness/harness.go +++ b/internal/harness/harness.go @@ -25,7 +25,7 @@ import ( // Handler defines the streaming event hook callbacks for an execution turn. type Handler interface { // OnMessage is invoked when the agent generates output content during its turn. - OnMessage(ctx context.Context, execID string, msg *proto.Message) error + OnMessage(ctx context.Context, execID string, step *proto.Step) error // OnComplete is invoked when the agent finishes its current execution turn. OnComplete(ctx context.Context, execID string) error @@ -52,8 +52,8 @@ type Execution interface { // It blocks until the current turn completes or fails. Run(ctx context.Context, handler Handler) error - // Queue enqueues new input messages to be processed in the next turn. - Queue(ctx context.Context, msg ...*proto.Message) error + // Queue enqueues new input steps to be processed in the next turn. + Queue(ctx context.Context, steps ...*proto.Step) error // ID returns the unique execution session ID. ID() string diff --git a/internal/harness/harnesstest/harnesstest.go b/internal/harness/harnesstest/harnesstest.go index 6328b063..94ae0bd2 100644 --- a/internal/harness/harnesstest/harnesstest.go +++ b/internal/harness/harnesstest/harnesstest.go @@ -98,9 +98,9 @@ func (f *MockControlServer) Calls() (create, resume, suspend []string) { type MockHarnessServer struct { proto.UnimplementedHarnessServiceServer - // Outputs are the messages emitted (in a single Outputs frame) before the + // Outputs are the steps emitted (in a single Outputs frame) before the // terminal HarnessEnd. When nil, each input is echoed as "ack: ". - Outputs []*proto.Message + Outputs []*proto.Step // FailConnect makes Connect return an RPC error before any frame. FailConnect bool // FailFrame makes Connect terminate the turn with HarnessEnd{STATE_FAILED}. @@ -128,9 +128,13 @@ func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e } var inputs []string - for _, m := range req.GetStart().GetMessages() { - if text := m.GetContent().GetText().GetText(); text != "" { - inputs = append(inputs, text) + for _, step := range req.GetStart().GetSteps() { + if contentStep := step.GetContent(); contentStep != nil { + for _, c := range contentStep.Content { + if text := c.GetText().GetText(); text != "" { + inputs = append(inputs, text) + } + } } } s.mu.Lock() @@ -156,17 +160,17 @@ func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e }) } - msgs := s.Outputs - if msgs == nil { + steps := s.Outputs + if steps == nil { for _, in := range inputs { - msgs = append(msgs, AssistantText("ack: "+in)) + steps = append(steps, AssistantStep("ack: "+in)) } } - if len(msgs) > 0 { + if len(steps) > 0 { if err := stream.Send(&proto.HarnessResponse{ ConversationId: convID, Type: &proto.HarnessResponse_Outputs{ - Outputs: &proto.HarnessOutputs{Messages: msgs}, + Outputs: &proto.HarnessOutputs{Steps: steps}, }, }); err != nil { return err @@ -185,19 +189,19 @@ func (s *MockHarnessServer) Received() (convID, harnessID string, harnessConfig return s.gotConvID, s.gotHarnessID, append([]byte(nil), s.gotHarnessConfig...), append([]string(nil), s.gotInputs...) } -// mockHandler records the messages and completion streamed during a turn. +// MockHandler records the steps and completion streamed during a turn. type MockHandler struct { mu sync.Mutex - messages []*proto.Message + steps []*proto.Step complete bool } var _ harness.Handler = (*MockHandler)(nil) -func (h *MockHandler) OnMessage(_ context.Context, _ string, msg *proto.Message) error { +func (h *MockHandler) OnMessage(_ context.Context, _ string, step *proto.Step) error { h.mu.Lock() defer h.mu.Unlock() - h.messages = append(h.messages, msg) + h.steps = append(h.steps, step) return nil } @@ -214,47 +218,56 @@ func (h *MockHandler) IsDone() bool { return h.complete } -// Collected returns a copy of the messages received via OnMessage. -func (h *MockHandler) Collected() []*proto.Message { +// Collected returns a copy of the steps received via OnMessage. +func (h *MockHandler) Collected() []*proto.Step { h.mu.Lock() defer h.mu.Unlock() - return append([]*proto.Message(nil), h.messages...) + return append([]*proto.Step(nil), h.steps...) } -// Texts returns the text content of each received message, in order. +// Texts returns the text content of each received step, in order. func (h *MockHandler) Texts() []string { h.mu.Lock() defer h.mu.Unlock() var out []string - for _, m := range h.messages { - out = append(out, m.GetContent().GetText().GetText()) + for _, s := range h.steps { + if contentStep := s.GetContent(); contentStep != nil { + for _, part := range contentStep.Content { + out = append(out, part.GetText().GetText()) + } + } } return out } -func AssistantText(text string) *proto.Message { - return &proto.Message{ - Role: "assistant", - Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}, +func UserStep(text string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "user", + Content: []*proto.Content{{Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}}, + }, + }, } } -func UserText(text string) *proto.Message { - return &proto.Message{ - Role: "user", - Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}, +func AssistantStep(text string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Content{ + Content: &proto.ContentStep{ + Role: "assistant", + Content: []*proto.Content{{Type: &proto.Content_Text{Text: &proto.TextContent{Text: text}}}}, + }, + }, } } -func ThoughtText(summary string) *proto.Message { - return &proto.Message{ - Role: "model", - Content: &proto.Content{ - Type: &proto.Content_Thought{ - Thought: &proto.ThoughtContent{ - Summary: []*proto.ThoughtSummaryContent{ - {Type: &proto.ThoughtSummaryContent_Text{Text: &proto.TextContent{Text: summary}}}, - }, +func ThoughtStep(summary string) *proto.Step { + return &proto.Step{ + Type: &proto.Step_Thought{ + Thought: &proto.ThoughtStep{ + Summary: []*proto.Content{ + {Type: &proto.Content_Text{Text: &proto.TextContent{Text: summary}}}, }, }, }, diff --git a/internal/harness/stream.go b/internal/harness/stream.go index 7551da85..54430d48 100644 --- a/internal/harness/stream.go +++ b/internal/harness/stream.go @@ -40,8 +40,8 @@ func DrainStream(ctx context.Context, stream proto.HarnessService_ConnectClient, switch payload := resp.Type.(type) { case *proto.HarnessResponse_Outputs: - for _, outMsg := range payload.Outputs.Messages { - if err := handler.OnMessage(ctx, execID, outMsg); err != nil { + for _, step := range payload.Outputs.Steps { + if err := handler.OnMessage(ctx, execID, step); err != nil { return fmt.Errorf("failed to dispatch streamed output: %w", err) } } diff --git a/internal/harness/substrate/substrate.go b/internal/harness/substrate/substrate.go index 4743a602..5f4d39fc 100644 --- a/internal/harness/substrate/substrate.go +++ b/internal/harness/substrate/substrate.go @@ -177,17 +177,17 @@ type substrateExecution struct { harnessConfig []byte mu sync.Mutex - pending []*proto.Message + pending []*proto.Step } func (e *substrateExecution) ID() string { return e.execID } -func (e *substrateExecution) Queue(ctx context.Context, msg ...*proto.Message) error { +func (e *substrateExecution) Queue(ctx context.Context, steps ...*proto.Step) error { e.mu.Lock() defer e.mu.Unlock() - e.pending = append(e.pending, msg...) + e.pending = append(e.pending, steps...) return nil } @@ -212,7 +212,7 @@ func (e *substrateExecution) Run(ctx context.Context, handler harness.Handler) e Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ HarnessConfig: e.harnessConfig, - Messages: inputs, + Steps: inputs, }, }, } diff --git a/internal/harness/substrate/substrate_test.go b/internal/harness/substrate/substrate_test.go index 4403dbd1..ab797990 100644 --- a/internal/harness/substrate/substrate_test.go +++ b/internal/harness/substrate/substrate_test.go @@ -166,7 +166,7 @@ func TestSubstrateHarness_EndToEnd(t *testing.T) { if err != nil { t.Fatalf("Start: %v", err) } - if err := exec.Queue(ctx, harnesstest.UserText("hi")); err != nil { + if err := exec.Queue(ctx, harnesstest.UserStep("hi")); err != nil { t.Fatalf("Queue: %v", err) } handler := &harnesstest.MockHandler{} @@ -227,7 +227,7 @@ func TestSubstrateHarness_CreateAlreadyExistsTolerated(t *testing.T) { } t.Cleanup(func() { _ = exec.Close(ctx) }) - if err := exec.Queue(ctx, harnesstest.UserText("hi")); err != nil { + if err := exec.Queue(ctx, harnesstest.UserStep("hi")); err != nil { t.Fatalf("Queue: %v", err) } handler := &harnesstest.MockHandler{} @@ -279,7 +279,7 @@ func TestSubstrateHarness_HarnessFailedFrame(t *testing.T) { t.Fatalf("Start: %v", err) } t.Cleanup(func() { _ = exec.Close(ctx) }) - if err := exec.Queue(ctx, harnesstest.UserText("hi")); err != nil { + if err := exec.Queue(ctx, harnesstest.UserStep("hi")); err != nil { t.Fatalf("Queue: %v", err) } if err := exec.Run(ctx, &harnesstest.MockHandler{}); err == nil { diff --git a/internal/server/interceptors_test.go b/internal/server/interceptors_test.go index bf2ed527..9f5c8cb5 100644 --- a/internal/server/interceptors_test.go +++ b/internal/server/interceptors_test.go @@ -48,7 +48,7 @@ type mockExecutionServer struct { proto.UnimplementedInteractionsServiceServer } -func (m *mockExecutionServer) CreateInteraction(req *proto.CreateInteractionRequest, stream proto.InteractionsService_CreateInteractionServer) error { +func (m *mockExecutionServer) CreateInteraction(req *proto.CreateInteractionEvent, stream proto.InteractionsService_CreateInteractionServer) error { if req.ConversationId == "fail" { return status.Error(codes.InvalidArgument, "mock error") } @@ -177,7 +177,7 @@ func TestLoggingInterceptors(t *testing.T) { t.Run("Stream Success", func(t *testing.T) { logBuf.Reset() ctx := context.Background() - stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionRequest{ConversationId: "conv-456"}) + stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionEvent{ConversationId: "conv-456"}) if err != nil { t.Fatalf("CreateInteraction stream init failed: %v", err) } @@ -218,7 +218,7 @@ func TestLoggingInterceptors(t *testing.T) { t.Run("Stream Failure", func(t *testing.T) { logBuf.Reset() ctx := context.Background() - stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionRequest{ConversationId: "fail"}) + stream, err := executionClient.CreateInteraction(ctx, &proto.CreateInteractionEvent{ConversationId: "fail"}) if err != nil { t.Fatalf("Exec stream init failed: %v", err) } diff --git a/internal/server/server.go b/internal/server/server.go index e5cca671..73b4bc93 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -55,7 +55,7 @@ func New(c *controller.Controller) *Server { } // CreateInteraction executes a new agentic task with streaming responses. -func (s *Server) CreateInteraction(req *proto.CreateInteractionRequest, stream grpc.ServerStreamingServer[proto.CreateInteractionResponse]) error { +func (s *Server) CreateInteraction(req *proto.CreateInteractionEvent, stream grpc.ServerStreamingServer[proto.CreateInteractionResponse]) error { ctx := stream.Context() slog.InfoContext(ctx, "Executing request", slog.String("request", req.String()), diff --git a/proto/ax.pb.go b/proto/ax.pb.go index e11bef23..d73ce814 100644 --- a/proto/ax.pb.go +++ b/proto/ax.pb.go @@ -145,90 +145,36 @@ func (CancelReason) EnumDescriptor() ([]byte, []int) { return file_proto_ax_proto_rawDescGZIP(), []int{1} } -// Message is a message in the history. -type Message struct { - state protoimpl.MessageState `protogen:"open.v1"` - Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` // user, assistant, or model - Content *Content `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // content of the message - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Message) Reset() { - *x = Message{} - mi := &file_proto_ax_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Message) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Message) ProtoMessage() {} - -func (x *Message) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Message.ProtoReflect.Descriptor instead. -func (*Message) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{0} -} - -func (x *Message) GetRole() string { - if x != nil { - return x.Role - } - return "" -} - -func (x *Message) GetContent() *Content { - if x != nil { - return x.Content - } - return nil -} - // A conversation is the historical session that consist of // a number of execution. A conversation cannot be continued // before the last execution is completed or failed. -type ConversationEvent struct { +type StepEvent struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` - Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` - ExecId string `protobuf:"bytes,3,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"` - HarnessId string `protobuf:"bytes,4,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` - HarnessConfig *structpb.Struct `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` - Messages []*Message `protobuf:"bytes,6,rep,name=messages,proto3" json:"messages,omitempty"` - State State `protobuf:"varint,7,opt,name=state,proto3,enum=ax.State" json:"state,omitempty"` + InteractionId string `protobuf:"bytes,2,opt,name=interaction_id,json=interactionId,proto3" json:"interaction_id,omitempty"` + HarnessId string `protobuf:"bytes,3,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` + HarnessConfig *structpb.Struct `protobuf:"bytes,4,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` + Steps []*Step `protobuf:"bytes,5,rep,name=steps,proto3" json:"steps,omitempty"` + State State `protobuf:"varint,6,opt,name=state,proto3,enum=ax.State" json:"state,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ConversationEvent) Reset() { - *x = ConversationEvent{} - mi := &file_proto_ax_proto_msgTypes[1] +func (x *StepEvent) Reset() { + *x = StepEvent{} + mi := &file_proto_ax_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ConversationEvent) String() string { +func (x *StepEvent) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConversationEvent) ProtoMessage() {} +func (*StepEvent) ProtoMessage() {} -func (x *ConversationEvent) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[1] +func (x *StepEvent) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -239,54 +185,47 @@ func (x *ConversationEvent) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConversationEvent.ProtoReflect.Descriptor instead. -func (*ConversationEvent) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{1} +// Deprecated: Use StepEvent.ProtoReflect.Descriptor instead. +func (*StepEvent) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{0} } -func (x *ConversationEvent) GetConversationId() string { +func (x *StepEvent) GetConversationId() string { if x != nil { return x.ConversationId } return "" } -func (x *ConversationEvent) GetStep() int32 { - if x != nil { - return x.Step - } - return 0 -} - -func (x *ConversationEvent) GetExecId() string { +func (x *StepEvent) GetInteractionId() string { if x != nil { - return x.ExecId + return x.InteractionId } return "" } -func (x *ConversationEvent) GetHarnessId() string { +func (x *StepEvent) GetHarnessId() string { if x != nil { return x.HarnessId } return "" } -func (x *ConversationEvent) GetHarnessConfig() *structpb.Struct { +func (x *StepEvent) GetHarnessConfig() *structpb.Struct { if x != nil { return x.HarnessConfig } return nil } -func (x *ConversationEvent) GetMessages() []*Message { +func (x *StepEvent) GetSteps() []*Step { if x != nil { - return x.Messages + return x.Steps } return nil } -func (x *ConversationEvent) GetState() State { +func (x *StepEvent) GetState() State { if x != nil { return x.State } @@ -296,15 +235,15 @@ func (x *ConversationEvent) GetState() State { type HarnessStart struct { state protoimpl.MessageState `protogen:"open.v1"` // Per-execution harness configuration. - HarnessConfig []byte `protobuf:"bytes,1,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` - Messages []*Message `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + HarnessConfig []byte `protobuf:"bytes,1,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` + Steps []*Step `protobuf:"bytes,2,rep,name=steps,proto3" json:"steps,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *HarnessStart) Reset() { *x = HarnessStart{} - mi := &file_proto_ax_proto_msgTypes[2] + mi := &file_proto_ax_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -316,7 +255,7 @@ func (x *HarnessStart) String() string { func (*HarnessStart) ProtoMessage() {} func (x *HarnessStart) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[2] + mi := &file_proto_ax_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -329,7 +268,7 @@ func (x *HarnessStart) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessStart.ProtoReflect.Descriptor instead. func (*HarnessStart) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{2} + return file_proto_ax_proto_rawDescGZIP(), []int{1} } func (x *HarnessStart) GetHarnessConfig() []byte { @@ -339,9 +278,9 @@ func (x *HarnessStart) GetHarnessConfig() []byte { return nil } -func (x *HarnessStart) GetMessages() []*Message { +func (x *HarnessStart) GetSteps() []*Step { if x != nil { - return x.Messages + return x.Steps } return nil } @@ -356,7 +295,7 @@ type HarnessCancel struct { func (x *HarnessCancel) Reset() { *x = HarnessCancel{} - mi := &file_proto_ax_proto_msgTypes[3] + mi := &file_proto_ax_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -368,7 +307,7 @@ func (x *HarnessCancel) String() string { func (*HarnessCancel) ProtoMessage() {} func (x *HarnessCancel) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[3] + mi := &file_proto_ax_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -381,7 +320,7 @@ func (x *HarnessCancel) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessCancel.ProtoReflect.Descriptor instead. func (*HarnessCancel) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{3} + return file_proto_ax_proto_rawDescGZIP(), []int{2} } func (x *HarnessCancel) GetReason() CancelReason { @@ -406,7 +345,7 @@ type HarnessRequest struct { func (x *HarnessRequest) Reset() { *x = HarnessRequest{} - mi := &file_proto_ax_proto_msgTypes[4] + mi := &file_proto_ax_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -418,7 +357,7 @@ func (x *HarnessRequest) String() string { func (*HarnessRequest) ProtoMessage() {} func (x *HarnessRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[4] + mi := &file_proto_ax_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -431,7 +370,7 @@ func (x *HarnessRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessRequest.ProtoReflect.Descriptor instead. func (*HarnessRequest) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{4} + return file_proto_ax_proto_rawDescGZIP(), []int{3} } func (x *HarnessRequest) GetConversationId() string { @@ -491,14 +430,14 @@ func (*HarnessRequest_Cancel) isHarnessRequest_Type() {} type HarnessOutputs struct { state protoimpl.MessageState `protogen:"open.v1"` - Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + Steps []*Step `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *HarnessOutputs) Reset() { *x = HarnessOutputs{} - mi := &file_proto_ax_proto_msgTypes[5] + mi := &file_proto_ax_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -510,7 +449,7 @@ func (x *HarnessOutputs) String() string { func (*HarnessOutputs) ProtoMessage() {} func (x *HarnessOutputs) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[5] + mi := &file_proto_ax_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -523,12 +462,12 @@ func (x *HarnessOutputs) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessOutputs.ProtoReflect.Descriptor instead. func (*HarnessOutputs) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{5} + return file_proto_ax_proto_rawDescGZIP(), []int{4} } -func (x *HarnessOutputs) GetMessages() []*Message { +func (x *HarnessOutputs) GetSteps() []*Step { if x != nil { - return x.Messages + return x.Steps } return nil } @@ -545,7 +484,7 @@ type Error struct { func (x *Error) Reset() { *x = Error{} - mi := &file_proto_ax_proto_msgTypes[6] + mi := &file_proto_ax_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -557,7 +496,7 @@ func (x *Error) String() string { func (*Error) ProtoMessage() {} func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[6] + mi := &file_proto_ax_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -570,7 +509,7 @@ func (x *Error) ProtoReflect() protoreflect.Message { // Deprecated: Use Error.ProtoReflect.Descriptor instead. func (*Error) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{6} + return file_proto_ax_proto_rawDescGZIP(), []int{5} } func (x *Error) GetCode() int32 { @@ -599,7 +538,7 @@ type HarnessEnd struct { func (x *HarnessEnd) Reset() { *x = HarnessEnd{} - mi := &file_proto_ax_proto_msgTypes[7] + mi := &file_proto_ax_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -611,7 +550,7 @@ func (x *HarnessEnd) String() string { func (*HarnessEnd) ProtoMessage() {} func (x *HarnessEnd) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[7] + mi := &file_proto_ax_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -624,7 +563,7 @@ func (x *HarnessEnd) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessEnd.ProtoReflect.Descriptor instead. func (*HarnessEnd) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{7} + return file_proto_ax_proto_rawDescGZIP(), []int{6} } func (x *HarnessEnd) GetState() State { @@ -655,7 +594,7 @@ type HarnessResponse struct { func (x *HarnessResponse) Reset() { *x = HarnessResponse{} - mi := &file_proto_ax_proto_msgTypes[8] + mi := &file_proto_ax_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -667,7 +606,7 @@ func (x *HarnessResponse) String() string { func (*HarnessResponse) ProtoMessage() {} func (x *HarnessResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[8] + mi := &file_proto_ax_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -680,7 +619,7 @@ func (x *HarnessResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HarnessResponse.ProtoReflect.Descriptor instead. func (*HarnessResponse) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{8} + return file_proto_ax_proto_rawDescGZIP(), []int{7} } func (x *HarnessResponse) GetConversationId() string { @@ -731,33 +670,32 @@ func (*HarnessResponse_Outputs) isHarnessResponse_Type() {} func (*HarnessResponse_End) isHarnessResponse_Type() {} -// CreateInteractionRequest for creating an interaction. -type CreateInteractionRequest struct { +// CreateInteractionEvent for creating an interaction. +type CreateInteractionEvent struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` // Unique conversation identifier - Inputs []*Message `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs - LastStep int32 `protobuf:"varint,3,opt,name=last_step,json=lastStep,proto3" json:"last_step,omitempty"` // Last step number seen by the client + Inputs []*Step `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs HarnessId string `protobuf:"bytes,4,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` // Harness ID, empty selects the default harness HarnessConfig []byte `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` // Per-request harness configuration (opaque JSON), if any unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *CreateInteractionRequest) Reset() { - *x = CreateInteractionRequest{} - mi := &file_proto_ax_proto_msgTypes[9] +func (x *CreateInteractionEvent) Reset() { + *x = CreateInteractionEvent{} + mi := &file_proto_ax_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *CreateInteractionRequest) String() string { +func (x *CreateInteractionEvent) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateInteractionRequest) ProtoMessage() {} +func (*CreateInteractionEvent) ProtoMessage() {} -func (x *CreateInteractionRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[9] +func (x *CreateInteractionEvent) ProtoReflect() protoreflect.Message { + mi := &file_proto_ax_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -768,40 +706,33 @@ func (x *CreateInteractionRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CreateInteractionRequest.ProtoReflect.Descriptor instead. -func (*CreateInteractionRequest) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{9} +// Deprecated: Use CreateInteractionEvent.ProtoReflect.Descriptor instead. +func (*CreateInteractionEvent) Descriptor() ([]byte, []int) { + return file_proto_ax_proto_rawDescGZIP(), []int{8} } -func (x *CreateInteractionRequest) GetConversationId() string { +func (x *CreateInteractionEvent) GetConversationId() string { if x != nil { return x.ConversationId } return "" } -func (x *CreateInteractionRequest) GetInputs() []*Message { +func (x *CreateInteractionEvent) GetInputs() []*Step { if x != nil { return x.Inputs } return nil } -func (x *CreateInteractionRequest) GetLastStep() int32 { - if x != nil { - return x.LastStep - } - return 0 -} - -func (x *CreateInteractionRequest) GetHarnessId() string { +func (x *CreateInteractionEvent) GetHarnessId() string { if x != nil { return x.HarnessId } return "" } -func (x *CreateInteractionRequest) GetHarnessConfig() []byte { +func (x *CreateInteractionEvent) GetHarnessConfig() []byte { if x != nil { return x.HarnessConfig } @@ -811,15 +742,14 @@ func (x *CreateInteractionRequest) GetHarnessConfig() []byte { // CreateInteractionResponse contains the result of an interaction. type CreateInteractionResponse struct { state protoimpl.MessageState `protogen:"open.v1"` - Outputs []*Message `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty"` // Output content - Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` // Step of the outputs + Outputs []*Step `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty"` // Output content unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *CreateInteractionResponse) Reset() { *x = CreateInteractionResponse{} - mi := &file_proto_ax_proto_msgTypes[10] + mi := &file_proto_ax_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -831,7 +761,7 @@ func (x *CreateInteractionResponse) String() string { func (*CreateInteractionResponse) ProtoMessage() {} func (x *CreateInteractionResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[10] + mi := &file_proto_ax_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -844,23 +774,16 @@ func (x *CreateInteractionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateInteractionResponse.ProtoReflect.Descriptor instead. func (*CreateInteractionResponse) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{10} + return file_proto_ax_proto_rawDescGZIP(), []int{9} } -func (x *CreateInteractionResponse) GetOutputs() []*Message { +func (x *CreateInteractionResponse) GetOutputs() []*Step { if x != nil { return x.Outputs } return nil } -func (x *CreateInteractionResponse) GetStep() int32 { - if x != nil { - return x.Step - } - return 0 -} - type DeleteConversationRequest struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` @@ -870,7 +793,7 @@ type DeleteConversationRequest struct { func (x *DeleteConversationRequest) Reset() { *x = DeleteConversationRequest{} - mi := &file_proto_ax_proto_msgTypes[11] + mi := &file_proto_ax_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -882,7 +805,7 @@ func (x *DeleteConversationRequest) String() string { func (*DeleteConversationRequest) ProtoMessage() {} func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[11] + mi := &file_proto_ax_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -895,7 +818,7 @@ func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteConversationRequest.ProtoReflect.Descriptor instead. func (*DeleteConversationRequest) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{11} + return file_proto_ax_proto_rawDescGZIP(), []int{10} } func (x *DeleteConversationRequest) GetConversationId() string { @@ -913,7 +836,7 @@ type DeleteConversationResponse struct { func (x *DeleteConversationResponse) Reset() { *x = DeleteConversationResponse{} - mi := &file_proto_ax_proto_msgTypes[12] + mi := &file_proto_ax_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -925,7 +848,7 @@ func (x *DeleteConversationResponse) String() string { func (*DeleteConversationResponse) ProtoMessage() {} func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[12] + mi := &file_proto_ax_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -938,7 +861,7 @@ func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteConversationResponse.ProtoReflect.Descriptor instead. func (*DeleteConversationResponse) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{12} + return file_proto_ax_proto_rawDescGZIP(), []int{11} } type Step struct { @@ -958,7 +881,7 @@ type Step struct { func (x *Step) Reset() { *x = Step{} - mi := &file_proto_ax_proto_msgTypes[13] + mi := &file_proto_ax_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -970,7 +893,7 @@ func (x *Step) String() string { func (*Step) ProtoMessage() {} func (x *Step) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[13] + mi := &file_proto_ax_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -983,7 +906,7 @@ func (x *Step) ProtoReflect() protoreflect.Message { // Deprecated: Use Step.ProtoReflect.Descriptor instead. func (*Step) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{13} + return file_proto_ax_proto_rawDescGZIP(), []int{12} } func (x *Step) GetDescription() string { @@ -1081,7 +1004,7 @@ type ContentStep struct { func (x *ContentStep) Reset() { *x = ContentStep{} - mi := &file_proto_ax_proto_msgTypes[14] + mi := &file_proto_ax_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1093,7 +1016,7 @@ func (x *ContentStep) String() string { func (*ContentStep) ProtoMessage() {} func (x *ContentStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[14] + mi := &file_proto_ax_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1106,7 +1029,7 @@ func (x *ContentStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ContentStep.ProtoReflect.Descriptor instead. func (*ContentStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{14} + return file_proto_ax_proto_rawDescGZIP(), []int{13} } func (x *ContentStep) GetRole() string { @@ -1135,7 +1058,7 @@ type ThoughtStep struct { func (x *ThoughtStep) Reset() { *x = ThoughtStep{} - mi := &file_proto_ax_proto_msgTypes[15] + mi := &file_proto_ax_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1147,7 +1070,7 @@ func (x *ThoughtStep) String() string { func (*ThoughtStep) ProtoMessage() {} func (x *ThoughtStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[15] + mi := &file_proto_ax_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1160,7 +1083,7 @@ func (x *ThoughtStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ThoughtStep.ProtoReflect.Descriptor instead. func (*ThoughtStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{15} + return file_proto_ax_proto_rawDescGZIP(), []int{14} } func (x *ThoughtStep) GetSignature() []byte { @@ -1191,7 +1114,7 @@ type ToolCallStep struct { func (x *ToolCallStep) Reset() { *x = ToolCallStep{} - mi := &file_proto_ax_proto_msgTypes[16] + mi := &file_proto_ax_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1203,7 +1126,7 @@ func (x *ToolCallStep) String() string { func (*ToolCallStep) ProtoMessage() {} func (x *ToolCallStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[16] + mi := &file_proto_ax_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1216,7 +1139,7 @@ func (x *ToolCallStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ToolCallStep.ProtoReflect.Descriptor instead. func (*ToolCallStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{16} + return file_proto_ax_proto_rawDescGZIP(), []int{15} } func (x *ToolCallStep) GetId() string { @@ -1269,7 +1192,7 @@ type FunctionCallStep struct { func (x *FunctionCallStep) Reset() { *x = FunctionCallStep{} - mi := &file_proto_ax_proto_msgTypes[17] + mi := &file_proto_ax_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1281,7 +1204,7 @@ func (x *FunctionCallStep) String() string { func (*FunctionCallStep) ProtoMessage() {} func (x *FunctionCallStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[17] + mi := &file_proto_ax_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1294,7 +1217,7 @@ func (x *FunctionCallStep) ProtoReflect() protoreflect.Message { // Deprecated: Use FunctionCallStep.ProtoReflect.Descriptor instead. func (*FunctionCallStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{17} + return file_proto_ax_proto_rawDescGZIP(), []int{16} } func (x *FunctionCallStep) GetName() string { @@ -1325,7 +1248,7 @@ type ToolResultStep struct { func (x *ToolResultStep) Reset() { *x = ToolResultStep{} - mi := &file_proto_ax_proto_msgTypes[18] + mi := &file_proto_ax_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1337,7 +1260,7 @@ func (x *ToolResultStep) String() string { func (*ToolResultStep) ProtoMessage() {} func (x *ToolResultStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[18] + mi := &file_proto_ax_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1350,7 +1273,7 @@ func (x *ToolResultStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ToolResultStep.ProtoReflect.Descriptor instead. func (*ToolResultStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{18} + return file_proto_ax_proto_rawDescGZIP(), []int{17} } func (x *ToolResultStep) GetCallId() string { @@ -1407,7 +1330,7 @@ type FunctionResultStep struct { func (x *FunctionResultStep) Reset() { *x = FunctionResultStep{} - mi := &file_proto_ax_proto_msgTypes[19] + mi := &file_proto_ax_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1419,7 +1342,7 @@ func (x *FunctionResultStep) String() string { func (*FunctionResultStep) ProtoMessage() {} func (x *FunctionResultStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[19] + mi := &file_proto_ax_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1432,7 +1355,7 @@ func (x *FunctionResultStep) ProtoReflect() protoreflect.Message { // Deprecated: Use FunctionResultStep.ProtoReflect.Descriptor instead. func (*FunctionResultStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{19} + return file_proto_ax_proto_rawDescGZIP(), []int{18} } func (x *FunctionResultStep) GetName() string { @@ -1476,7 +1399,7 @@ type Value struct { func (x *Value) Reset() { *x = Value{} - mi := &file_proto_ax_proto_msgTypes[20] + mi := &file_proto_ax_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1488,7 +1411,7 @@ func (x *Value) String() string { func (*Value) ProtoMessage() {} func (x *Value) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[20] + mi := &file_proto_ax_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1501,7 +1424,7 @@ func (x *Value) ProtoReflect() protoreflect.Message { // Deprecated: Use Value.ProtoReflect.Descriptor instead. func (*Value) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{20} + return file_proto_ax_proto_rawDescGZIP(), []int{19} } func (x *Value) GetKind() isValue_Kind { @@ -1638,7 +1561,7 @@ type ListValue struct { func (x *ListValue) Reset() { *x = ListValue{} - mi := &file_proto_ax_proto_msgTypes[21] + mi := &file_proto_ax_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1650,7 +1573,7 @@ func (x *ListValue) String() string { func (*ListValue) ProtoMessage() {} func (x *ListValue) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[21] + mi := &file_proto_ax_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1663,7 +1586,7 @@ func (x *ListValue) ProtoReflect() protoreflect.Message { // Deprecated: Use ListValue.ProtoReflect.Descriptor instead. func (*ListValue) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{21} + return file_proto_ax_proto_rawDescGZIP(), []int{20} } func (x *ListValue) GetValues() []*Value { @@ -1677,22 +1600,18 @@ var File_proto_ax_proto protoreflect.FileDescriptor const file_proto_ax_proto_rawDesc = "" + "\n" + - "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"D\n" + - "\aMessage\x12\x12\n" + - "\x04role\x18\x01 \x01(\tR\x04role\x12%\n" + - "\acontent\x18\x02 \x01(\v2\v.ax.ContentR\acontent\"\x92\x02\n" + - "\x11ConversationEvent\x12'\n" + - "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x12\n" + - "\x04step\x18\x02 \x01(\x05R\x04step\x12\x17\n" + - "\aexec_id\x18\x03 \x01(\tR\x06execId\x12\x1d\n" + + "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xfb\x01\n" + + "\tStepEvent\x12'\n" + + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12%\n" + + "\x0einteraction_id\x18\x02 \x01(\tR\rinteractionId\x12\x1d\n" + "\n" + - "harness_id\x18\x04 \x01(\tR\tharnessId\x12>\n" + - "\x0eharness_config\x18\x05 \x01(\v2\x17.google.protobuf.StructR\rharnessConfig\x12'\n" + - "\bmessages\x18\x06 \x03(\v2\v.ax.MessageR\bmessages\x12\x1f\n" + - "\x05state\x18\a \x01(\x0e2\t.ax.StateR\x05state\"^\n" + + "harness_id\x18\x03 \x01(\tR\tharnessId\x12>\n" + + "\x0eharness_config\x18\x04 \x01(\v2\x17.google.protobuf.StructR\rharnessConfig\x12\x1e\n" + + "\x05steps\x18\x05 \x03(\v2\b.ax.StepR\x05steps\x12\x1f\n" + + "\x05state\x18\x06 \x01(\x0e2\t.ax.StateR\x05state\"U\n" + "\fHarnessStart\x12%\n" + - "\x0eharness_config\x18\x01 \x01(\fR\rharnessConfig\x12'\n" + - "\bmessages\x18\x02 \x03(\v2\v.ax.MessageR\bmessages\"9\n" + + "\x0eharness_config\x18\x01 \x01(\fR\rharnessConfig\x12\x1e\n" + + "\x05steps\x18\x02 \x03(\v2\b.ax.StepR\x05steps\"9\n" + "\rHarnessCancel\x12(\n" + "\x06reason\x18\x01 \x01(\x0e2\x10.ax.CancelReasonR\x06reason\"\xb7\x01\n" + "\x0eHarnessRequest\x12'\n" + @@ -1701,9 +1620,9 @@ const file_proto_ax_proto_rawDesc = "" + "harness_id\x18\x02 \x01(\tR\tharnessId\x12(\n" + "\x05start\x18\x03 \x01(\v2\x10.ax.HarnessStartH\x00R\x05start\x12+\n" + "\x06cancel\x18\x04 \x01(\v2\x11.ax.HarnessCancelH\x00R\x06cancelB\x06\n" + - "\x04type\"9\n" + - "\x0eHarnessOutputs\x12'\n" + - "\bmessages\x18\x01 \x03(\v2\v.ax.MessageR\bmessages\"=\n" + + "\x04type\"0\n" + + "\x0eHarnessOutputs\x12\x1e\n" + + "\x05steps\x18\x01 \x03(\v2\b.ax.StepR\x05steps\"=\n" + "\x05Error\x12\x12\n" + "\x04code\x18\x01 \x01(\x05R\x04code\x12 \n" + "\vdescription\x18\x02 \x01(\tR\vdescription\"N\n" + @@ -1715,17 +1634,15 @@ const file_proto_ax_proto_rawDesc = "" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12.\n" + "\aoutputs\x18\x02 \x01(\v2\x12.ax.HarnessOutputsH\x00R\aoutputs\x12\"\n" + "\x03end\x18\x03 \x01(\v2\x0e.ax.HarnessEndH\x00R\x03endB\x06\n" + - "\x04type\"\xcb\x01\n" + - "\x18CreateInteractionRequest\x12'\n" + - "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12#\n" + - "\x06inputs\x18\x02 \x03(\v2\v.ax.MessageR\x06inputs\x12\x1b\n" + - "\tlast_step\x18\x03 \x01(\x05R\blastStep\x12\x1d\n" + + "\x04type\"\xaf\x01\n" + + "\x16CreateInteractionEvent\x12'\n" + + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12 \n" + + "\x06inputs\x18\x02 \x03(\v2\b.ax.StepR\x06inputs\x12\x1d\n" + "\n" + "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" + - "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfig\"V\n" + - "\x19CreateInteractionResponse\x12%\n" + - "\aoutputs\x18\x01 \x03(\v2\v.ax.MessageR\aoutputs\x12\x12\n" + - "\x04step\x18\x02 \x01(\x05R\x04step\"D\n" + + "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfigJ\x04\b\x03\x10\x04\"?\n" + + "\x19CreateInteractionResponse\x12\"\n" + + "\aoutputs\x18\x01 \x03(\v2\b.ax.StepR\aoutputs\"D\n" + "\x19DeleteConversationRequest\x12'\n" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\"\x1c\n" + "\x1aDeleteConversationResponse\"\x88\x02\n" + @@ -1792,9 +1709,9 @@ const file_proto_ax_proto_rawDesc = "" + "\x15CANCEL_REASON_TIMEOUT\x10\x02\x12 \n" + "\x1cCANCEL_REASON_INTERNAL_ERROR\x10\x032H\n" + "\x0eHarnessService\x126\n" + - "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012i\n" + - "\x13InteractionsService\x12R\n" + - "\x11CreateInteraction\x12\x1c.ax.CreateInteractionRequest\x1a\x1d.ax.CreateInteractionResponse0\x012j\n" + + "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012g\n" + + "\x13InteractionsService\x12P\n" + + "\x11CreateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x012j\n" + "\x13ConversationService\x12S\n" + "\x12DeleteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3" @@ -1811,78 +1728,76 @@ func file_proto_ax_proto_rawDescGZIP() []byte { } var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 22) +var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 21) var file_proto_ax_proto_goTypes = []any{ (State)(0), // 0: ax.State (CancelReason)(0), // 1: ax.CancelReason - (*Message)(nil), // 2: ax.Message - (*ConversationEvent)(nil), // 3: ax.ConversationEvent - (*HarnessStart)(nil), // 4: ax.HarnessStart - (*HarnessCancel)(nil), // 5: ax.HarnessCancel - (*HarnessRequest)(nil), // 6: ax.HarnessRequest - (*HarnessOutputs)(nil), // 7: ax.HarnessOutputs - (*Error)(nil), // 8: ax.Error - (*HarnessEnd)(nil), // 9: ax.HarnessEnd - (*HarnessResponse)(nil), // 10: ax.HarnessResponse - (*CreateInteractionRequest)(nil), // 11: ax.CreateInteractionRequest - (*CreateInteractionResponse)(nil), // 12: ax.CreateInteractionResponse - (*DeleteConversationRequest)(nil), // 13: ax.DeleteConversationRequest - (*DeleteConversationResponse)(nil), // 14: ax.DeleteConversationResponse - (*Step)(nil), // 15: ax.Step - (*ContentStep)(nil), // 16: ax.ContentStep - (*ThoughtStep)(nil), // 17: ax.ThoughtStep - (*ToolCallStep)(nil), // 18: ax.ToolCallStep - (*FunctionCallStep)(nil), // 19: ax.FunctionCallStep - (*ToolResultStep)(nil), // 20: ax.ToolResultStep - (*FunctionResultStep)(nil), // 21: ax.FunctionResultStep - (*Value)(nil), // 22: ax.Value - (*ListValue)(nil), // 23: ax.ListValue + (*StepEvent)(nil), // 2: ax.StepEvent + (*HarnessStart)(nil), // 3: ax.HarnessStart + (*HarnessCancel)(nil), // 4: ax.HarnessCancel + (*HarnessRequest)(nil), // 5: ax.HarnessRequest + (*HarnessOutputs)(nil), // 6: ax.HarnessOutputs + (*Error)(nil), // 7: ax.Error + (*HarnessEnd)(nil), // 8: ax.HarnessEnd + (*HarnessResponse)(nil), // 9: ax.HarnessResponse + (*CreateInteractionEvent)(nil), // 10: ax.CreateInteractionEvent + (*CreateInteractionResponse)(nil), // 11: ax.CreateInteractionResponse + (*DeleteConversationRequest)(nil), // 12: ax.DeleteConversationRequest + (*DeleteConversationResponse)(nil), // 13: ax.DeleteConversationResponse + (*Step)(nil), // 14: ax.Step + (*ContentStep)(nil), // 15: ax.ContentStep + (*ThoughtStep)(nil), // 16: ax.ThoughtStep + (*ToolCallStep)(nil), // 17: ax.ToolCallStep + (*FunctionCallStep)(nil), // 18: ax.FunctionCallStep + (*ToolResultStep)(nil), // 19: ax.ToolResultStep + (*FunctionResultStep)(nil), // 20: ax.FunctionResultStep + (*Value)(nil), // 21: ax.Value + (*ListValue)(nil), // 22: ax.ListValue + (*structpb.Struct)(nil), // 23: google.protobuf.Struct (*Content)(nil), // 24: ax.Content - (*structpb.Struct)(nil), // 25: google.protobuf.Struct - (structpb.NullValue)(0), // 26: google.protobuf.NullValue + (structpb.NullValue)(0), // 25: google.protobuf.NullValue } var file_proto_ax_proto_depIdxs = []int32{ - 24, // 0: ax.Message.content:type_name -> ax.Content - 25, // 1: ax.ConversationEvent.harness_config:type_name -> google.protobuf.Struct - 2, // 2: ax.ConversationEvent.messages:type_name -> ax.Message - 0, // 3: ax.ConversationEvent.state:type_name -> ax.State - 2, // 4: ax.HarnessStart.messages:type_name -> ax.Message - 1, // 5: ax.HarnessCancel.reason:type_name -> ax.CancelReason - 4, // 6: ax.HarnessRequest.start:type_name -> ax.HarnessStart - 5, // 7: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel - 2, // 8: ax.HarnessOutputs.messages:type_name -> ax.Message - 0, // 9: ax.HarnessEnd.state:type_name -> ax.State - 8, // 10: ax.HarnessEnd.error:type_name -> ax.Error - 7, // 11: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs - 9, // 12: ax.HarnessResponse.end:type_name -> ax.HarnessEnd - 2, // 13: ax.CreateInteractionRequest.inputs:type_name -> ax.Message - 2, // 14: ax.CreateInteractionResponse.outputs:type_name -> ax.Message - 16, // 15: ax.Step.content:type_name -> ax.ContentStep - 17, // 16: ax.Step.thought:type_name -> ax.ThoughtStep - 18, // 17: ax.Step.tool_call:type_name -> ax.ToolCallStep - 20, // 18: ax.Step.tool_result:type_name -> ax.ToolResultStep - 24, // 19: ax.ContentStep.content:type_name -> ax.Content - 24, // 20: ax.ThoughtStep.summary:type_name -> ax.Content - 19, // 21: ax.ToolCallStep.function_call:type_name -> ax.FunctionCallStep - 25, // 22: ax.FunctionCallStep.arguments:type_name -> google.protobuf.Struct - 21, // 23: ax.ToolResultStep.function_result:type_name -> ax.FunctionResultStep - 22, // 24: ax.FunctionResultStep.result:type_name -> ax.Value - 26, // 25: ax.Value.null_value:type_name -> google.protobuf.NullValue - 25, // 26: ax.Value.struct_value:type_name -> google.protobuf.Struct - 23, // 27: ax.Value.list_value:type_name -> ax.ListValue - 24, // 28: ax.Value.content_value:type_name -> ax.Content - 22, // 29: ax.ListValue.values:type_name -> ax.Value - 6, // 30: ax.HarnessService.Connect:input_type -> ax.HarnessRequest - 11, // 31: ax.InteractionsService.CreateInteraction:input_type -> ax.CreateInteractionRequest - 13, // 32: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest - 10, // 33: ax.HarnessService.Connect:output_type -> ax.HarnessResponse - 12, // 34: ax.InteractionsService.CreateInteraction:output_type -> ax.CreateInteractionResponse - 14, // 35: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse - 33, // [33:36] is the sub-list for method output_type - 30, // [30:33] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name + 23, // 0: ax.StepEvent.harness_config:type_name -> google.protobuf.Struct + 14, // 1: ax.StepEvent.steps:type_name -> ax.Step + 0, // 2: ax.StepEvent.state:type_name -> ax.State + 14, // 3: ax.HarnessStart.steps:type_name -> ax.Step + 1, // 4: ax.HarnessCancel.reason:type_name -> ax.CancelReason + 3, // 5: ax.HarnessRequest.start:type_name -> ax.HarnessStart + 4, // 6: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel + 14, // 7: ax.HarnessOutputs.steps:type_name -> ax.Step + 0, // 8: ax.HarnessEnd.state:type_name -> ax.State + 7, // 9: ax.HarnessEnd.error:type_name -> ax.Error + 6, // 10: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs + 8, // 11: ax.HarnessResponse.end:type_name -> ax.HarnessEnd + 14, // 12: ax.CreateInteractionEvent.inputs:type_name -> ax.Step + 14, // 13: ax.CreateInteractionResponse.outputs:type_name -> ax.Step + 15, // 14: ax.Step.content:type_name -> ax.ContentStep + 16, // 15: ax.Step.thought:type_name -> ax.ThoughtStep + 17, // 16: ax.Step.tool_call:type_name -> ax.ToolCallStep + 19, // 17: ax.Step.tool_result:type_name -> ax.ToolResultStep + 24, // 18: ax.ContentStep.content:type_name -> ax.Content + 24, // 19: ax.ThoughtStep.summary:type_name -> ax.Content + 18, // 20: ax.ToolCallStep.function_call:type_name -> ax.FunctionCallStep + 23, // 21: ax.FunctionCallStep.arguments:type_name -> google.protobuf.Struct + 20, // 22: ax.ToolResultStep.function_result:type_name -> ax.FunctionResultStep + 21, // 23: ax.FunctionResultStep.result:type_name -> ax.Value + 25, // 24: ax.Value.null_value:type_name -> google.protobuf.NullValue + 23, // 25: ax.Value.struct_value:type_name -> google.protobuf.Struct + 22, // 26: ax.Value.list_value:type_name -> ax.ListValue + 24, // 27: ax.Value.content_value:type_name -> ax.Content + 21, // 28: ax.ListValue.values:type_name -> ax.Value + 5, // 29: ax.HarnessService.Connect:input_type -> ax.HarnessRequest + 10, // 30: ax.InteractionsService.CreateInteraction:input_type -> ax.CreateInteractionEvent + 12, // 31: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest + 9, // 32: ax.HarnessService.Connect:output_type -> ax.HarnessResponse + 11, // 33: ax.InteractionsService.CreateInteraction:output_type -> ax.CreateInteractionResponse + 13, // 34: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse + 32, // [32:35] is the sub-list for method output_type + 29, // [29:32] is the sub-list for method input_type + 29, // [29:29] is the sub-list for extension type_name + 29, // [29:29] is the sub-list for extension extendee + 0, // [0:29] is the sub-list for field type_name } func init() { file_proto_ax_proto_init() } @@ -1891,27 +1806,27 @@ func file_proto_ax_proto_init() { return } file_proto_content_proto_init() - file_proto_ax_proto_msgTypes[4].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[3].OneofWrappers = []any{ (*HarnessRequest_Start)(nil), (*HarnessRequest_Cancel)(nil), } - file_proto_ax_proto_msgTypes[8].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[7].OneofWrappers = []any{ (*HarnessResponse_Outputs)(nil), (*HarnessResponse_End)(nil), } - file_proto_ax_proto_msgTypes[13].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[12].OneofWrappers = []any{ (*Step_Content)(nil), (*Step_Thought)(nil), (*Step_ToolCall)(nil), (*Step_ToolResult)(nil), } - file_proto_ax_proto_msgTypes[16].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[15].OneofWrappers = []any{ (*ToolCallStep_FunctionCall)(nil), } - file_proto_ax_proto_msgTypes[18].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[17].OneofWrappers = []any{ (*ToolResultStep_FunctionResult)(nil), } - file_proto_ax_proto_msgTypes[20].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[19].OneofWrappers = []any{ (*Value_NullValue)(nil), (*Value_NumberValue)(nil), (*Value_StringValue)(nil), @@ -1926,7 +1841,7 @@ func file_proto_ax_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_ax_proto_rawDesc), len(file_proto_ax_proto_rawDesc)), NumEnums: 2, - NumMessages: 22, + NumMessages: 21, NumExtensions: 0, NumServices: 3, }, diff --git a/proto/ax.proto b/proto/ax.proto index 7c5d6b6a..c516b7c8 100644 --- a/proto/ax.proto +++ b/proto/ax.proto @@ -24,29 +24,22 @@ option go_package = "github.com/google/ax/proto"; // WARNING: This file is in active development and // significant changes can be made with breaking changes. -// Message is a message in the history. -message Message { - string role = 1; // user, assistant, or model - Content content = 2; // content of the message -} - // A conversation is the historical session that consist of // a number of execution. A conversation cannot be continued // before the last execution is completed or failed. -message ConversationEvent { +message StepEvent { string conversation_id = 1; - int32 step = 2; - string exec_id = 3; - string harness_id = 4; - google.protobuf.Struct harness_config = 5; - repeated Message messages = 6; - State state = 7; + string interaction_id = 2; + string harness_id = 3; + google.protobuf.Struct harness_config = 4; + repeated Step steps = 5; + State state = 6; } message HarnessStart { // Per-execution harness configuration. bytes harness_config = 1; - repeated Message messages = 2; + repeated Step steps = 2; } // HarnessCancel aborts the in-flight harness execution. @@ -64,7 +57,7 @@ message HarnessRequest { } message HarnessOutputs { - repeated Message messages = 1; + repeated Step steps = 1; } message Error { @@ -114,11 +107,11 @@ enum CancelReason { CANCEL_REASON_INTERNAL_ERROR = 3; } -// CreateInteractionRequest for creating an interaction. -message CreateInteractionRequest { +// CreateInteractionEvent for creating an interaction. +message CreateInteractionEvent { string conversation_id = 1; // Unique conversation identifier - repeated Message inputs = 2; // New inputs - int32 last_step = 3; // Last step number seen by the client + repeated Step inputs = 2; // New inputs + reserved 3; string harness_id = 4; // Harness ID, empty selects the default harness bytes harness_config = 5; // Per-request harness configuration (opaque JSON), if any @@ -126,16 +119,18 @@ message CreateInteractionRequest { // CreateInteractionResponse contains the result of an interaction. message CreateInteractionResponse { - repeated Message outputs = 1; // Output content - int32 step = 2; // Step of the outputs + repeated Step outputs = 1; // Output content } service InteractionsService { // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - rpc CreateInteraction(CreateInteractionRequest) returns (stream CreateInteractionResponse); + rpc CreateInteraction(CreateInteractionEvent) returns (stream CreateInteractionResponse); } +// TODO(jbd): CreateInteraction should return an Interaction message +// and the outputs should be polled from the Interaction. + message DeleteConversationRequest { string conversation_id = 1; } diff --git a/proto/ax_grpc.pb.go b/proto/ax_grpc.pb.go index 88e3704a..edfb8fbe 100644 --- a/proto/ax_grpc.pb.go +++ b/proto/ax_grpc.pb.go @@ -146,7 +146,7 @@ const ( type InteractionsServiceClient interface { // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - CreateInteraction(ctx context.Context, in *CreateInteractionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) + CreateInteraction(ctx context.Context, in *CreateInteractionEvent, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) } type interactionsServiceClient struct { @@ -157,13 +157,13 @@ func NewInteractionsServiceClient(cc grpc.ClientConnInterface) InteractionsServi return &interactionsServiceClient{cc} } -func (c *interactionsServiceClient) CreateInteraction(ctx context.Context, in *CreateInteractionRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) { +func (c *interactionsServiceClient) CreateInteraction(ctx context.Context, in *CreateInteractionEvent, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CreateInteractionResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &InteractionsService_ServiceDesc.Streams[0], InteractionsService_CreateInteraction_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[CreateInteractionRequest, CreateInteractionResponse]{ClientStream: stream} + x := &grpc.GenericClientStream[CreateInteractionEvent, CreateInteractionResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -182,7 +182,7 @@ type InteractionsService_CreateInteractionClient = grpc.ServerStreamingClient[Cr type InteractionsServiceServer interface { // CreateInteraction executes an agentic task or resumes an existing one with streaming responses // If the conversation_id already exists, it will be resumed. - CreateInteraction(*CreateInteractionRequest, grpc.ServerStreamingServer[CreateInteractionResponse]) error + CreateInteraction(*CreateInteractionEvent, grpc.ServerStreamingServer[CreateInteractionResponse]) error mustEmbedUnimplementedInteractionsServiceServer() } @@ -193,7 +193,7 @@ type InteractionsServiceServer interface { // pointer dereference when methods are called. type UnimplementedInteractionsServiceServer struct{} -func (UnimplementedInteractionsServiceServer) CreateInteraction(*CreateInteractionRequest, grpc.ServerStreamingServer[CreateInteractionResponse]) error { +func (UnimplementedInteractionsServiceServer) CreateInteraction(*CreateInteractionEvent, grpc.ServerStreamingServer[CreateInteractionResponse]) error { return status.Errorf(codes.Unimplemented, "method CreateInteraction not implemented") } func (UnimplementedInteractionsServiceServer) mustEmbedUnimplementedInteractionsServiceServer() {} @@ -218,11 +218,11 @@ func RegisterInteractionsServiceServer(s grpc.ServiceRegistrar, srv Interactions } func _InteractionsService_CreateInteraction_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CreateInteractionRequest) + m := new(CreateInteractionEvent) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(InteractionsServiceServer).CreateInteraction(m, &grpc.GenericServerStream[CreateInteractionRequest, CreateInteractionResponse]{ServerStream: stream}) + return srv.(InteractionsServiceServer).CreateInteraction(m, &grpc.GenericServerStream[CreateInteractionEvent, CreateInteractionResponse]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. diff --git a/proto/content.pb.go b/proto/content.pb.go index 1cae4f60..f3474d64 100644 --- a/proto/content.pb.go +++ b/proto/content.pb.go @@ -23,7 +23,6 @@ package proto import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" unsafe "unsafe" @@ -156,7 +155,7 @@ func (x ImageContent_MimeType) Number() protoreflect.EnumNumber { // Deprecated: Use ImageContent_MimeType.Descriptor instead. func (ImageContent_MimeType) EnumDescriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{10, 0} + return file_proto_content_proto_rawDescGZIP(), []int{4, 0} } type AudioContent_MimeType int32 @@ -238,7 +237,7 @@ func (x AudioContent_MimeType) Number() protoreflect.EnumNumber { // Deprecated: Use AudioContent_MimeType.Descriptor instead. func (AudioContent_MimeType) EnumDescriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{11, 0} + return file_proto_content_proto_rawDescGZIP(), []int{5, 0} } type DocumentContent_MimeType int32 @@ -290,7 +289,7 @@ func (x DocumentContent_MimeType) Number() protoreflect.EnumNumber { // Deprecated: Use DocumentContent_MimeType.Descriptor instead. func (DocumentContent_MimeType) EnumDescriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{12, 0} + return file_proto_content_proto_rawDescGZIP(), []int{6, 0} } type VideoContent_MimeType int32 @@ -360,7 +359,7 @@ func (x VideoContent_MimeType) Number() protoreflect.EnumNumber { // Deprecated: Use VideoContent_MimeType.Descriptor instead. func (VideoContent_MimeType) EnumDescriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{13, 0} + return file_proto_content_proto_rawDescGZIP(), []int{7, 0} } // TextContent represents a text content. @@ -594,414 +593,6 @@ func (*ConfirmationContent_Approval) isConfirmationContent_Decision() {} func (*ConfirmationContent_Decline) isConfirmationContent_Decision() {} -type ThoughtSummaryContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Type: - // - // *ThoughtSummaryContent_Text - Type isThoughtSummaryContent_Type `protobuf_oneof:"type"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ThoughtSummaryContent) Reset() { - *x = ThoughtSummaryContent{} - mi := &file_proto_content_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ThoughtSummaryContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ThoughtSummaryContent) ProtoMessage() {} - -func (x *ThoughtSummaryContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ThoughtSummaryContent.ProtoReflect.Descriptor instead. -func (*ThoughtSummaryContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{4} -} - -func (x *ThoughtSummaryContent) GetType() isThoughtSummaryContent_Type { - if x != nil { - return x.Type - } - return nil -} - -func (x *ThoughtSummaryContent) GetText() *TextContent { - if x != nil { - if x, ok := x.Type.(*ThoughtSummaryContent_Text); ok { - return x.Text - } - } - return nil -} - -type isThoughtSummaryContent_Type interface { - isThoughtSummaryContent_Type() -} - -type ThoughtSummaryContent_Text struct { - Text *TextContent `protobuf:"bytes,1,opt,name=text,proto3,oneof"` -} - -func (*ThoughtSummaryContent_Text) isThoughtSummaryContent_Type() {} - -type ThoughtContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` - Summary []*ThoughtSummaryContent `protobuf:"bytes,9,rep,name=summary,proto3" json:"summary,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ThoughtContent) Reset() { - *x = ThoughtContent{} - mi := &file_proto_content_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ThoughtContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ThoughtContent) ProtoMessage() {} - -func (x *ThoughtContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ThoughtContent.ProtoReflect.Descriptor instead. -func (*ThoughtContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{5} -} - -func (x *ThoughtContent) GetSignature() []byte { - if x != nil { - return x.Signature - } - return nil -} - -func (x *ThoughtContent) GetSummary() []*ThoughtSummaryContent { - if x != nil { - return x.Summary - } - return nil -} - -type ToolCallContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // A unique ID for this specific tool call. - Signature []byte `protobuf:"bytes,9,opt,name=signature,proto3" json:"signature,omitempty"` // A signature hash for backend validation. - // Types that are valid to be assigned to Type: - // - // *ToolCallContent_FunctionCall - Type isToolCallContent_Type `protobuf_oneof:"type"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ToolCallContent) Reset() { - *x = ToolCallContent{} - mi := &file_proto_content_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ToolCallContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToolCallContent) ProtoMessage() {} - -func (x *ToolCallContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToolCallContent.ProtoReflect.Descriptor instead. -func (*ToolCallContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{6} -} - -func (x *ToolCallContent) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *ToolCallContent) GetSignature() []byte { - if x != nil { - return x.Signature - } - return nil -} - -func (x *ToolCallContent) GetType() isToolCallContent_Type { - if x != nil { - return x.Type - } - return nil -} - -func (x *ToolCallContent) GetFunctionCall() *FunctionCallContent { - if x != nil { - if x, ok := x.Type.(*ToolCallContent_FunctionCall); ok { - return x.FunctionCall - } - } - return nil -} - -type isToolCallContent_Type interface { - isToolCallContent_Type() -} - -type ToolCallContent_FunctionCall struct { - FunctionCall *FunctionCallContent `protobuf:"bytes,2,opt,name=function_call,json=functionCall,proto3,oneof"` -} - -func (*ToolCallContent_FunctionCall) isToolCallContent_Type() {} - -type ToolResultContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - CallId string `protobuf:"bytes,8,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` // ID to match the ID from the function call block. - Signature []byte `protobuf:"bytes,9,opt,name=signature,proto3" json:"signature,omitempty"` // A signature hash for backend validation. - // Types that are valid to be assigned to Type: - // - // *ToolResultContent_FunctionResult - Type isToolResultContent_Type `protobuf_oneof:"type"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ToolResultContent) Reset() { - *x = ToolResultContent{} - mi := &file_proto_content_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ToolResultContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToolResultContent) ProtoMessage() {} - -func (x *ToolResultContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToolResultContent.ProtoReflect.Descriptor instead. -func (*ToolResultContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{7} -} - -func (x *ToolResultContent) GetCallId() string { - if x != nil { - return x.CallId - } - return "" -} - -func (x *ToolResultContent) GetSignature() []byte { - if x != nil { - return x.Signature - } - return nil -} - -func (x *ToolResultContent) GetType() isToolResultContent_Type { - if x != nil { - return x.Type - } - return nil -} - -func (x *ToolResultContent) GetFunctionResult() *FunctionResultContent { - if x != nil { - if x, ok := x.Type.(*ToolResultContent_FunctionResult); ok { - return x.FunctionResult - } - } - return nil -} - -type isToolResultContent_Type interface { - isToolResultContent_Type() -} - -type ToolResultContent_FunctionResult struct { - FunctionResult *FunctionResultContent `protobuf:"bytes,2,opt,name=function_result,json=functionResult,proto3,oneof"` -} - -func (*ToolResultContent_FunctionResult) isToolResultContent_Type() {} - -type FunctionCallContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Arguments *structpb.Struct `protobuf:"bytes,4,opt,name=arguments,proto3" json:"arguments,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FunctionCallContent) Reset() { - *x = FunctionCallContent{} - mi := &file_proto_content_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FunctionCallContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FunctionCallContent) ProtoMessage() {} - -func (x *FunctionCallContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FunctionCallContent.ProtoReflect.Descriptor instead. -func (*FunctionCallContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{8} -} - -func (x *FunctionCallContent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FunctionCallContent) GetArguments() *structpb.Struct { - if x != nil { - return x.Arguments - } - return nil -} - -type FunctionResultContent struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"` - // Types that are valid to be assigned to Result: - // - // *FunctionResultContent_Response - Result isFunctionResultContent_Result `protobuf_oneof:"result"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *FunctionResultContent) Reset() { - *x = FunctionResultContent{} - mi := &file_proto_content_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *FunctionResultContent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FunctionResultContent) ProtoMessage() {} - -func (x *FunctionResultContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FunctionResultContent.ProtoReflect.Descriptor instead. -func (*FunctionResultContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{9} -} - -func (x *FunctionResultContent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FunctionResultContent) GetResult() isFunctionResultContent_Result { - if x != nil { - return x.Result - } - return nil -} - -func (x *FunctionResultContent) GetResponse() *structpb.Struct { - if x != nil { - if x, ok := x.Result.(*FunctionResultContent_Response); ok { - return x.Response - } - } - return nil -} - -type isFunctionResultContent_Result interface { - isFunctionResultContent_Result() -} - -type FunctionResultContent_Response struct { - Response *structpb.Struct `protobuf:"bytes,3,opt,name=response,proto3,oneof"` -} - -func (*FunctionResultContent_Response) isFunctionResultContent_Result() {} - // An image content block. type ImageContent struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -1018,7 +609,7 @@ type ImageContent struct { func (x *ImageContent) Reset() { *x = ImageContent{} - mi := &file_proto_content_proto_msgTypes[10] + mi := &file_proto_content_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1030,7 +621,7 @@ func (x *ImageContent) String() string { func (*ImageContent) ProtoMessage() {} func (x *ImageContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[10] + mi := &file_proto_content_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1043,7 +634,7 @@ func (x *ImageContent) ProtoReflect() protoreflect.Message { // Deprecated: Use ImageContent.ProtoReflect.Descriptor instead. func (*ImageContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{10} + return file_proto_content_proto_rawDescGZIP(), []int{4} } func (x *ImageContent) GetMimeType() ImageContent_MimeType { @@ -1118,7 +709,7 @@ type AudioContent struct { func (x *AudioContent) Reset() { *x = AudioContent{} - mi := &file_proto_content_proto_msgTypes[11] + mi := &file_proto_content_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1130,7 +721,7 @@ func (x *AudioContent) String() string { func (*AudioContent) ProtoMessage() {} func (x *AudioContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[11] + mi := &file_proto_content_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1143,7 +734,7 @@ func (x *AudioContent) ProtoReflect() protoreflect.Message { // Deprecated: Use AudioContent.ProtoReflect.Descriptor instead. func (*AudioContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{11} + return file_proto_content_proto_rawDescGZIP(), []int{5} } func (x *AudioContent) GetMimeType() AudioContent_MimeType { @@ -1223,7 +814,7 @@ type DocumentContent struct { func (x *DocumentContent) Reset() { *x = DocumentContent{} - mi := &file_proto_content_proto_msgTypes[12] + mi := &file_proto_content_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1235,7 +826,7 @@ func (x *DocumentContent) String() string { func (*DocumentContent) ProtoMessage() {} func (x *DocumentContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[12] + mi := &file_proto_content_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1248,7 +839,7 @@ func (x *DocumentContent) ProtoReflect() protoreflect.Message { // Deprecated: Use DocumentContent.ProtoReflect.Descriptor instead. func (*DocumentContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{12} + return file_proto_content_proto_rawDescGZIP(), []int{6} } func (x *DocumentContent) GetMimeType() DocumentContent_MimeType { @@ -1315,7 +906,7 @@ type VideoContent struct { func (x *VideoContent) Reset() { *x = VideoContent{} - mi := &file_proto_content_proto_msgTypes[13] + mi := &file_proto_content_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1327,7 +918,7 @@ func (x *VideoContent) String() string { func (*VideoContent) ProtoMessage() {} func (x *VideoContent) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[13] + mi := &file_proto_content_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1340,7 +931,7 @@ func (x *VideoContent) ProtoReflect() protoreflect.Message { // Deprecated: Use VideoContent.ProtoReflect.Descriptor instead. func (*VideoContent) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{13} + return file_proto_content_proto_rawDescGZIP(), []int{7} } func (x *VideoContent) GetMimeType() VideoContent_MimeType { @@ -1398,20 +989,16 @@ func (*VideoContent_Data) isVideoContent_DataOrUri() {} func (*VideoContent_Uri) isVideoContent_DataOrUri() {} -// Content represents a content input or output. type Content struct { state protoimpl.MessageState `protogen:"open.v1"` // Types that are valid to be assigned to Type: // - // *Content_Thought // *Content_Text // *Content_Image // *Content_Audio // *Content_Document // *Content_Video // *Content_Confirmation - // *Content_ToolCall - // *Content_ToolResult Type isContent_Type `protobuf_oneof:"type"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -1419,7 +1006,7 @@ type Content struct { func (x *Content) Reset() { *x = Content{} - mi := &file_proto_content_proto_msgTypes[14] + mi := &file_proto_content_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1431,7 +1018,7 @@ func (x *Content) String() string { func (*Content) ProtoMessage() {} func (x *Content) ProtoReflect() protoreflect.Message { - mi := &file_proto_content_proto_msgTypes[14] + mi := &file_proto_content_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1444,7 +1031,7 @@ func (x *Content) ProtoReflect() protoreflect.Message { // Deprecated: Use Content.ProtoReflect.Descriptor instead. func (*Content) Descriptor() ([]byte, []int) { - return file_proto_content_proto_rawDescGZIP(), []int{14} + return file_proto_content_proto_rawDescGZIP(), []int{8} } func (x *Content) GetType() isContent_Type { @@ -1454,15 +1041,6 @@ func (x *Content) GetType() isContent_Type { return nil } -func (x *Content) GetThought() *ThoughtContent { - if x != nil { - if x, ok := x.Type.(*Content_Thought); ok { - return x.Thought - } - } - return nil -} - func (x *Content) GetText() *TextContent { if x != nil { if x, ok := x.Type.(*Content_Text); ok { @@ -1517,32 +1095,10 @@ func (x *Content) GetConfirmation() *ConfirmationContent { return nil } -func (x *Content) GetToolCall() *ToolCallContent { - if x != nil { - if x, ok := x.Type.(*Content_ToolCall); ok { - return x.ToolCall - } - } - return nil -} - -func (x *Content) GetToolResult() *ToolResultContent { - if x != nil { - if x, ok := x.Type.(*Content_ToolResult); ok { - return x.ToolResult - } - } - return nil -} - type isContent_Type interface { isContent_Type() } -type Content_Thought struct { - Thought *ThoughtContent `protobuf:"bytes,5,opt,name=thought,proto3,oneof"` -} - type Content_Text struct { Text *TextContent `protobuf:"bytes,10,opt,name=text,proto3,oneof"` } @@ -1564,19 +1120,9 @@ type Content_Video struct { } type Content_Confirmation struct { - Confirmation *ConfirmationContent `protobuf:"bytes,26,opt,name=confirmation,proto3,oneof"` // TODO(jbd): Remove out of the Content. + Confirmation *ConfirmationContent `protobuf:"bytes,26,opt,name=confirmation,proto3,oneof"` // TODO(jbd): Remove out of the Content and replace it with EliciationStep. } -type Content_ToolCall struct { - ToolCall *ToolCallContent `protobuf:"bytes,24,opt,name=tool_call,json=toolCall,proto3,oneof"` -} - -type Content_ToolResult struct { - ToolResult *ToolResultContent `protobuf:"bytes,25,opt,name=tool_result,json=toolResult,proto3,oneof"` -} - -func (*Content_Thought) isContent_Type() {} - func (*Content_Text) isContent_Type() {} func (*Content_Image) isContent_Type() {} @@ -1589,15 +1135,11 @@ func (*Content_Video) isContent_Type() {} func (*Content_Confirmation) isContent_Type() {} -func (*Content_ToolCall) isContent_Type() {} - -func (*Content_ToolResult) isContent_Type() {} - var File_proto_content_proto protoreflect.FileDescriptor const file_proto_content_proto_rawDesc = "" + "\n" + - "\x13proto/content.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\"3\n" + + "\x13proto/content.proto\x12\x02ax\"3\n" + "\vTextContent\x12\x12\n" + "\x04text\x18\x03 \x01(\tR\x04textJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\x04type\".\n" + "\x10ApprovalDecision\x12\x1a\n" + @@ -1610,30 +1152,7 @@ const file_proto_content_proto_rawDesc = "" + "\bapproval\x18\x05 \x01(\v2\x14.ax.ApprovalDecisionH\x00R\bapproval\x12/\n" + "\adecline\x18\x06 \x01(\v2\x13.ax.DeclineDecisionH\x00R\adeclineB\n" + "\n" + - "\bdecisionJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\x04type\"L\n" + - "\x15ThoughtSummaryContent\x12%\n" + - "\x04text\x18\x01 \x01(\v2\x0f.ax.TextContentH\x00R\x04textB\x06\n" + - "\x04typeJ\x04\b\x02\x10\x03\"\x8d\x01\n" + - "\x0eThoughtContent\x12\x1c\n" + - "\tsignature\x18\a \x01(\fR\tsignature\x123\n" + - "\asummary\x18\t \x03(\v2\x19.ax.ThoughtSummaryContentR\asummaryJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03J\x04\b\x03\x10\x04J\x04\b\x04\x10\x05J\x04\b\x05\x10\x06J\x04\b\b\x10\tR\x04type\"\x87\x01\n" + - "\x0fToolCallContent\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + - "\tsignature\x18\t \x01(\fR\tsignature\x12>\n" + - "\rfunction_call\x18\x02 \x01(\v2\x17.ax.FunctionCallContentH\x00R\ffunctionCallB\x06\n" + - "\x04type\"\x9e\x01\n" + - "\x11ToolResultContent\x12\x17\n" + - "\acall_id\x18\b \x01(\tR\x06callId\x12\x1c\n" + - "\tsignature\x18\t \x01(\fR\tsignature\x12D\n" + - "\x0ffunction_result\x18\x02 \x01(\v2\x19.ax.FunctionResultContentH\x00R\x0efunctionResultB\x06\n" + - "\x04typeJ\x04\b\x01\x10\x02\"l\n" + - "\x13FunctionCallContent\x12\x12\n" + - "\x04name\x18\x03 \x01(\tR\x04name\x125\n" + - "\targuments\x18\x04 \x01(\v2\x17.google.protobuf.StructR\targumentsJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03\"~\n" + - "\x15FunctionResultContent\x12\x12\n" + - "\x04name\x18\b \x01(\tR\x04name\x125\n" + - "\bresponse\x18\x03 \x01(\v2\x17.google.protobuf.StructH\x00R\bresponseB\b\n" + - "\x06resultJ\x04\b\x01\x10\x02J\x04\b\x04\x10\x05R\x04type\"\xde\x02\n" + + "\bdecisionJ\x04\b\x01\x10\x02J\x04\b\x02\x10\x03R\x04type\"\xde\x02\n" + "\fImageContent\x126\n" + "\tmime_type\x18\x01 \x01(\x0e2\x19.ax.ImageContent.MimeTypeR\bmimeType\x12\x14\n" + "\x04data\x18\x02 \x01(\fH\x00R\x04data\x12\x12\n" + @@ -1707,21 +1226,17 @@ const file_proto_content_proto_rawDesc = "" + "\tTYPE_WEBM\x10\a\x12\f\n" + "\bTYPE_WMV\x10\b\x12\r\n" + "\tTYPE_3GPP\x10\tB\r\n" + - "\vdata_or_uriJ\x04\b\x03\x10\x04R\x04type\"\xd8\x03\n" + - "\aContent\x12.\n" + - "\athought\x18\x05 \x01(\v2\x12.ax.ThoughtContentH\x00R\athought\x12%\n" + + "\vdata_or_uriJ\x04\b\x03\x10\x04R\x04type\"\xb4\x02\n" + + "\aContent\x12%\n" + "\x04text\x18\n" + " \x01(\v2\x0f.ax.TextContentH\x00R\x04text\x12(\n" + "\x05image\x18\v \x01(\v2\x10.ax.ImageContentH\x00R\x05image\x12(\n" + "\x05audio\x18\f \x01(\v2\x10.ax.AudioContentH\x00R\x05audio\x121\n" + "\bdocument\x18\r \x01(\v2\x13.ax.DocumentContentH\x00R\bdocument\x12(\n" + "\x05video\x18\x0e \x01(\v2\x10.ax.VideoContentH\x00R\x05video\x12=\n" + - "\fconfirmation\x18\x1a \x01(\v2\x17.ax.ConfirmationContentH\x00R\fconfirmation\x122\n" + - "\ttool_call\x18\x18 \x01(\v2\x13.ax.ToolCallContentH\x00R\btoolCall\x128\n" + - "\vtool_result\x18\x19 \x01(\v2\x15.ax.ToolResultContentH\x00R\n" + - "toolResultB\x06\n" + - "\x04typeJ\x04\b\x01\x10\x05J\x04\b\x06\x10\n" + - "J\x04\b\x0f\x10\x18*b\n" + + "\fconfirmation\x18\x1a \x01(\v2\x17.ax.ConfirmationContentH\x00R\fconfirmationB\x06\n" + + "\x04typeJ\x04\b\x01\x10\n" + + "J\x04\b\x0f\x10\x1a*b\n" + "\x0fMediaResolution\x12 \n" + "\x1cMEDIA_RESOLUTION_UNSPECIFIED\x10\x00\x12\a\n" + "\x03LOW\x10\x01\x12\n" + @@ -1744,7 +1259,7 @@ func file_proto_content_proto_rawDescGZIP() []byte { } var file_proto_content_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_proto_content_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_proto_content_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_proto_content_proto_goTypes = []any{ (MediaResolution)(0), // 0: ax.MediaResolution (ImageContent_MimeType)(0), // 1: ax.ImageContent.MimeType @@ -1755,48 +1270,32 @@ var file_proto_content_proto_goTypes = []any{ (*ApprovalDecision)(nil), // 6: ax.ApprovalDecision (*DeclineDecision)(nil), // 7: ax.DeclineDecision (*ConfirmationContent)(nil), // 8: ax.ConfirmationContent - (*ThoughtSummaryContent)(nil), // 9: ax.ThoughtSummaryContent - (*ThoughtContent)(nil), // 10: ax.ThoughtContent - (*ToolCallContent)(nil), // 11: ax.ToolCallContent - (*ToolResultContent)(nil), // 12: ax.ToolResultContent - (*FunctionCallContent)(nil), // 13: ax.FunctionCallContent - (*FunctionResultContent)(nil), // 14: ax.FunctionResultContent - (*ImageContent)(nil), // 15: ax.ImageContent - (*AudioContent)(nil), // 16: ax.AudioContent - (*DocumentContent)(nil), // 17: ax.DocumentContent - (*VideoContent)(nil), // 18: ax.VideoContent - (*Content)(nil), // 19: ax.Content - (*structpb.Struct)(nil), // 20: google.protobuf.Struct + (*ImageContent)(nil), // 9: ax.ImageContent + (*AudioContent)(nil), // 10: ax.AudioContent + (*DocumentContent)(nil), // 11: ax.DocumentContent + (*VideoContent)(nil), // 12: ax.VideoContent + (*Content)(nil), // 13: ax.Content } var file_proto_content_proto_depIdxs = []int32{ 6, // 0: ax.ConfirmationContent.approval:type_name -> ax.ApprovalDecision 7, // 1: ax.ConfirmationContent.decline:type_name -> ax.DeclineDecision - 5, // 2: ax.ThoughtSummaryContent.text:type_name -> ax.TextContent - 9, // 3: ax.ThoughtContent.summary:type_name -> ax.ThoughtSummaryContent - 13, // 4: ax.ToolCallContent.function_call:type_name -> ax.FunctionCallContent - 14, // 5: ax.ToolResultContent.function_result:type_name -> ax.FunctionResultContent - 20, // 6: ax.FunctionCallContent.arguments:type_name -> google.protobuf.Struct - 20, // 7: ax.FunctionResultContent.response:type_name -> google.protobuf.Struct - 1, // 8: ax.ImageContent.mime_type:type_name -> ax.ImageContent.MimeType - 0, // 9: ax.ImageContent.resolution:type_name -> ax.MediaResolution - 2, // 10: ax.AudioContent.mime_type:type_name -> ax.AudioContent.MimeType - 3, // 11: ax.DocumentContent.mime_type:type_name -> ax.DocumentContent.MimeType - 4, // 12: ax.VideoContent.mime_type:type_name -> ax.VideoContent.MimeType - 0, // 13: ax.VideoContent.resolution:type_name -> ax.MediaResolution - 10, // 14: ax.Content.thought:type_name -> ax.ThoughtContent - 5, // 15: ax.Content.text:type_name -> ax.TextContent - 15, // 16: ax.Content.image:type_name -> ax.ImageContent - 16, // 17: ax.Content.audio:type_name -> ax.AudioContent - 17, // 18: ax.Content.document:type_name -> ax.DocumentContent - 18, // 19: ax.Content.video:type_name -> ax.VideoContent - 8, // 20: ax.Content.confirmation:type_name -> ax.ConfirmationContent - 11, // 21: ax.Content.tool_call:type_name -> ax.ToolCallContent - 12, // 22: ax.Content.tool_result:type_name -> ax.ToolResultContent - 23, // [23:23] is the sub-list for method output_type - 23, // [23:23] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 1, // 2: ax.ImageContent.mime_type:type_name -> ax.ImageContent.MimeType + 0, // 3: ax.ImageContent.resolution:type_name -> ax.MediaResolution + 2, // 4: ax.AudioContent.mime_type:type_name -> ax.AudioContent.MimeType + 3, // 5: ax.DocumentContent.mime_type:type_name -> ax.DocumentContent.MimeType + 4, // 6: ax.VideoContent.mime_type:type_name -> ax.VideoContent.MimeType + 0, // 7: ax.VideoContent.resolution:type_name -> ax.MediaResolution + 5, // 8: ax.Content.text:type_name -> ax.TextContent + 9, // 9: ax.Content.image:type_name -> ax.ImageContent + 10, // 10: ax.Content.audio:type_name -> ax.AudioContent + 11, // 11: ax.Content.document:type_name -> ax.DocumentContent + 12, // 12: ax.Content.video:type_name -> ax.VideoContent + 8, // 13: ax.Content.confirmation:type_name -> ax.ConfirmationContent + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_proto_content_proto_init() } @@ -1809,43 +1308,28 @@ func file_proto_content_proto_init() { (*ConfirmationContent_Decline)(nil), } file_proto_content_proto_msgTypes[4].OneofWrappers = []any{ - (*ThoughtSummaryContent_Text)(nil), - } - file_proto_content_proto_msgTypes[6].OneofWrappers = []any{ - (*ToolCallContent_FunctionCall)(nil), - } - file_proto_content_proto_msgTypes[7].OneofWrappers = []any{ - (*ToolResultContent_FunctionResult)(nil), - } - file_proto_content_proto_msgTypes[9].OneofWrappers = []any{ - (*FunctionResultContent_Response)(nil), - } - file_proto_content_proto_msgTypes[10].OneofWrappers = []any{ (*ImageContent_Data)(nil), (*ImageContent_Uri)(nil), } - file_proto_content_proto_msgTypes[11].OneofWrappers = []any{ + file_proto_content_proto_msgTypes[5].OneofWrappers = []any{ (*AudioContent_Data)(nil), (*AudioContent_Uri)(nil), } - file_proto_content_proto_msgTypes[12].OneofWrappers = []any{ + file_proto_content_proto_msgTypes[6].OneofWrappers = []any{ (*DocumentContent_Data)(nil), (*DocumentContent_Uri)(nil), } - file_proto_content_proto_msgTypes[13].OneofWrappers = []any{ + file_proto_content_proto_msgTypes[7].OneofWrappers = []any{ (*VideoContent_Data)(nil), (*VideoContent_Uri)(nil), } - file_proto_content_proto_msgTypes[14].OneofWrappers = []any{ - (*Content_Thought)(nil), + file_proto_content_proto_msgTypes[8].OneofWrappers = []any{ (*Content_Text)(nil), (*Content_Image)(nil), (*Content_Audio)(nil), (*Content_Document)(nil), (*Content_Video)(nil), (*Content_Confirmation)(nil), - (*Content_ToolCall)(nil), - (*Content_ToolResult)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1853,7 +1337,7 @@ func file_proto_content_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_content_proto_rawDesc), len(file_proto_content_proto_rawDesc)), NumEnums: 5, - NumMessages: 15, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/content.proto b/proto/content.proto index 20cf98f1..f7036158 100644 --- a/proto/content.proto +++ b/proto/content.proto @@ -16,8 +16,6 @@ syntax = "proto3"; package ax; -import "google/protobuf/struct.proto"; - option go_package = "github.com/google/ax/proto"; // TextContent represents a text content. @@ -48,58 +46,6 @@ message ConfirmationContent { } } -message ThoughtSummaryContent { - reserved 2; - - oneof type { - TextContent text = 1; - } -} - -message ThoughtContent { - reserved 1, 2, 3, 4, 5, 8; - reserved "type"; - - bytes signature = 7; - repeated ThoughtSummaryContent summary = 9; -} - -message ToolCallContent { - string id = 1; // A unique ID for this specific tool call. - bytes signature = 9; // A signature hash for backend validation. - oneof type { - FunctionCallContent function_call = 2; - } -} - -message ToolResultContent { - reserved 1; - - string call_id = 8; // ID to match the ID from the function call block. - bytes signature = 9; // A signature hash for backend validation. - - oneof type { - FunctionResultContent function_result = 2; - } -} - -message FunctionCallContent { - reserved 1, 2; - - string name = 3; - google.protobuf.Struct arguments = 4; -} - -message FunctionResultContent { - reserved 1, 4; - reserved "type"; - - string name = 8; - oneof result { - google.protobuf.Struct response = 3; - } -} - // Resolution for input media (images/video). enum MediaResolution { MEDIA_RESOLUTION_UNSPECIFIED = 0; @@ -207,19 +153,15 @@ message VideoContent { MediaResolution resolution = 5; } -// Content represents a content input or output. message Content { - reserved 1 to 4, 6 to 9, 15 to 23; + reserved 1 to 9, 15 to 25; oneof type { - ThoughtContent thought = 5; TextContent text = 10; ImageContent image = 11; AudioContent audio = 12; DocumentContent document = 13; VideoContent video = 14; - ConfirmationContent confirmation = 26; // TODO(jbd): Remove out of the Content. - ToolCallContent tool_call = 24; - ToolResultContent tool_result = 25; + ConfirmationContent confirmation = 26; // TODO(jbd): Remove out of the Content and replace it with EliciationStep. } } diff --git a/python/antigravity/harness_server.py b/python/antigravity/harness_server.py index bd2ecd93..6168fd68 100644 --- a/python/antigravity/harness_server.py +++ b/python/antigravity/harness_server.py @@ -225,36 +225,50 @@ async def _run_turn(self, request): ) return - # 1. Retrieve and check messages - ax_messages = request.start.messages - if not ax_messages: + # 1. Retrieve and check steps + ax_steps = request.start.steps + if not ax_steps: yield ax_pb2.HarnessResponse( conversation_id=request.conversation_id, end=ax_pb2.HarnessEnd( state=ax_pb2.STATE_FAILED, error=ax_pb2.Error( code=3, # INVALID_ARGUMENT - description="No messages found in start payload", + description="No steps found in start payload", ), ), ) return - latest_message = ax_messages[-1] + latest_step = ax_steps[-1] - if latest_message.content.WhichOneof("type") != "text": + if latest_step.WhichOneof("type") != "content": yield ax_pb2.HarnessResponse( conversation_id=request.conversation_id, end=ax_pb2.HarnessEnd( state=ax_pb2.STATE_FAILED, error=ax_pb2.Error( code=3, # INVALID_ARGUMENT - description="Latest message must contain text content", + description="Latest step must be a content step", ), ), ) return - latest_query_text = latest_message.content.text.text + + content_step = latest_step.content + if not content_step.content or content_step.content[0].WhichOneof("type") != "text": + yield ax_pb2.HarnessResponse( + conversation_id=request.conversation_id, + end=ax_pb2.HarnessEnd( + state=ax_pb2.STATE_FAILED, + error=ax_pb2.Error( + code=3, # INVALID_ARGUMENT + description="Latest step must contain text content", + ), + ), + ) + return + latest_query_text = content_step.content[0].text.text if not self._default_config: yield ax_pb2.HarnessResponse( @@ -291,16 +305,20 @@ async def _run_turn(self, request): def flush_text(): if not text_chunks: return None - msg = ax_pb2.Message( - role="assistant", - content=content_pb2.Content( - text=content_pb2.TextContent(text="".join(text_chunks)) - ), + step = ax_pb2.Step( + content=ax_pb2.ContentStep( + role="assistant", + content=[ + content_pb2.Content( + text=content_pb2.TextContent(text="".join(text_chunks)) + ) + ], + ) ) text_chunks.clear() return ax_pb2.HarnessResponse( conversation_id=request.conversation_id, - outputs=ax_pb2.HarnessOutputs(messages=[msg]), + outputs=ax_pb2.HarnessOutputs(steps=[step]), ) def flush_thought(): @@ -318,20 +336,17 @@ def flush_thought(): clean_text = re.sub(r"\n{3,}", "\n\n", raw_text).rstrip() + "\n" summary = [ - content_pb2.ThoughtSummaryContent( + content_pb2.Content( text=content_pb2.TextContent(text=clean_text) ) ] thought_chunks.clear() - msg = ax_pb2.Message( - role="model", - content=content_pb2.Content( - thought=content_pb2.ThoughtContent(summary=summary) - ), + step = ax_pb2.Step( + thought=ax_pb2.ThoughtStep(summary=summary) ) return ax_pb2.HarnessResponse( conversation_id=request.conversation_id, - outputs=ax_pb2.HarnessOutputs(messages=[msg]), + outputs=ax_pb2.HarnessOutputs(steps=[step]), ) async for chunk in response.chunks: @@ -353,20 +368,17 @@ def flush_thought(): struct_args = Struct() struct_args.update(chunk.args) - func_call = content_pb2.FunctionCallContent( + func_call = ax_pb2.FunctionCallStep( name=str(chunk.name), arguments=struct_args ) - msg = ax_pb2.Message( - role="model", - content=content_pb2.Content( - tool_call=content_pb2.ToolCallContent( - id=chunk.id or "", function_call=func_call - ) - ), + step = ax_pb2.Step( + tool_call=ax_pb2.ToolCallStep( + id=chunk.id or "", function_call=func_call + ) ) yield ax_pb2.HarnessResponse( conversation_id=request.conversation_id, - outputs=ax_pb2.HarnessOutputs(messages=[msg]), + outputs=ax_pb2.HarnessOutputs(steps=[step]), ) # Flush any remaining text/thought buffers after the generator loop ends diff --git a/python/antigravity/harness_server_test.py b/python/antigravity/harness_server_test.py index 95916606..e043ad89 100644 --- a/python/antigravity/harness_server_test.py +++ b/python/antigravity/harness_server_test.py @@ -68,8 +68,13 @@ async def __aexit__(self, exc_type, exc, tb): # 3. Construct and fire a HarnessRequest{start} over the bidi stream start_payload = ax_pb2.HarnessStart( - messages=[ - ax_pb2.Message(role="user", content=content_pb2.Content(text=content_pb2.TextContent(text="Hi"))) + steps=[ + ax_pb2.Step( + content=ax_pb2.ContentStep( + role="user", + content=[content_pb2.Content(text=content_pb2.TextContent(text="Hi"))], + ) + ) ] ) req = ax_pb2.HarnessRequest( @@ -87,8 +92,8 @@ async def request_iter(): # 4. Assert outputs are correctly mapped and completed assert len(responses) == 3 # Thought + Text + End - assert responses[0].outputs.messages[0].content.thought.summary[0].text.text == "Thinking details\n" - assert responses[1].outputs.messages[0].content.text.text == "Hello human" + assert responses[0].outputs.steps[0].thought.summary[0].text.text == "Thinking details\n" + assert responses[1].outputs.steps[0].content.content[0].text.text == "Hello human" assert responses[2].WhichOneof('type') == 'end' assert responses[2].end.state == ax_pb2.STATE_COMPLETED @@ -141,8 +146,14 @@ async def fire(conv_id): conversation_id=conv_id, harness_id="antigravity", start=ax_pb2.HarnessStart( - messages=[ax_pb2.Message(role="user", - content=content_pb2.Content(text=content_pb2.TextContent(text="Hi")))] + steps=[ + ax_pb2.Step( + content=ax_pb2.ContentStep( + role="user", + content=[content_pb2.Content(text=content_pb2.TextContent(text="Hi"))], + ) + ) + ] ), ) async def req_iter(): @@ -280,8 +291,13 @@ async def __aexit__(self, exc_type, exc, tb): monkeypatch.setattr("python.antigravity.harness_server.Agent", MockAgent) start_payload = ax_pb2.HarnessStart( - messages=[ - ax_pb2.Message(role="user", content=content_pb2.Content(text=content_pb2.TextContent(text="Hi"))) + steps=[ + ax_pb2.Step( + content=ax_pb2.ContentStep( + role="user", + content=[content_pb2.Content(text=content_pb2.TextContent(text="Hi"))], + ) + ) ] ) req = ax_pb2.HarnessRequest( @@ -298,7 +314,8 @@ async def request_iter(): responses.append(resp) assert len(responses) == 2 # Text + End - assert responses[0].outputs.messages[0].content.text.text == "Passed check" + assert responses[0].outputs.steps[0].content.content[0].text.text == "Passed check" + assert responses[1].WhichOneof('type') == 'end' assert responses[1].end.state == ax_pb2.STATE_COMPLETED await server.stop(0) @@ -323,7 +340,10 @@ def test_enhance_config_from_env(monkeypatch, tmp_path): assert str(skills_dir) in cfg.skills_paths -def test_grpc_connect_buffering(mock_config, monkeypatch, tmp_path): +def test_grpc_connect_tool_call_flushes_buffers(mock_config, monkeypatch, tmp_path): + """ToolCall chunks immediately flush any pending text and thought buffers + before sending the tool_call output message.""" + async def _run(): server = grpc.aio.server() servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) @@ -346,7 +366,7 @@ async def _chunk_generator(self): from google.antigravity.types import Text, Thought, ToolCall yield Thought(text="Think1", step_index=0) yield Thought(text=" Think2", step_index=0) - yield ToolCall(name="tool1", args={}, id="call1") + yield ToolCall(id="tc-123", name="tool1", args={"a": 1}, step_index=0) yield Text(text="Hello", step_index=0) yield Text(text=" human", step_index=0) return MockResponse() @@ -361,8 +381,13 @@ async def __aexit__(self, exc_type, exc, tb): monkeypatch.setattr("python.antigravity.harness_server.Agent", MockAgent) start_payload = ax_pb2.HarnessStart( - messages=[ - ax_pb2.Message(role="user", content=content_pb2.Content(text=content_pb2.TextContent(text="Hi"))) + steps=[ + ax_pb2.Step( + content=ax_pb2.ContentStep( + role="user", + content=[content_pb2.Content(text=content_pb2.TextContent(text="Hi"))], + ) + ) ] ) req = ax_pb2.HarnessRequest( @@ -386,16 +411,16 @@ async def request_iter(): assert len(responses) == 4 # Assert 1st response: Thought summary text is "Think1 Think2" - assert responses[0].outputs.messages[0].content.WhichOneof('type') == 'thought' - assert responses[0].outputs.messages[0].content.thought.summary[0].text.text == "Think1 Think2\n" + assert responses[0].outputs.steps[0].WhichOneof('type') == 'thought' + assert responses[0].outputs.steps[0].thought.summary[0].text.text == "Think1 Think2\n" # Assert 2nd response: ToolCall name is "tool1" - assert responses[1].outputs.messages[0].content.WhichOneof('type') == 'tool_call' - assert responses[1].outputs.messages[0].content.tool_call.function_call.name == "tool1" + assert responses[1].outputs.steps[0].WhichOneof('type') == 'tool_call' + assert responses[1].outputs.steps[0].tool_call.function_call.name == "tool1" # Assert 3rd response: Text content is "Hello human" - assert responses[2].outputs.messages[0].content.WhichOneof('type') == 'text' - assert responses[2].outputs.messages[0].content.text.text == "Hello human" + assert responses[2].outputs.steps[0].WhichOneof('type') == 'content' + assert responses[2].outputs.steps[0].content.content[0].text.text == "Hello human" # Assert 4th response: Completion end frame assert responses[3].WhichOneof('type') == 'end' @@ -451,9 +476,11 @@ async def _run(): req = ax_pb2.HarnessRequest( conversation_id="conv-guard", harness_id="antigravity", - start=ax_pb2.HarnessStart(messages=[ - ax_pb2.Message(role="user", - content=content_pb2.Content(text=content_pb2.TextContent(text="Hi"))), + start=ax_pb2.HarnessStart(steps=[ + ax_pb2.Step(content=ax_pb2.ContentStep( + role="user", + content=[content_pb2.Content(text=content_pb2.TextContent(text="Hi"))], + )), ]), ) async def request_iter(): @@ -550,10 +577,10 @@ async def _run(): harness_id="antigravity", start=ax_pb2.HarnessStart( harness_config=b"{", - messages=[ax_pb2.Message( + steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", - content=content_pb2.Content(text=content_pb2.TextContent(text="hi")), - )], + content=[content_pb2.Content(text=content_pb2.TextContent(text="hi"))], + ))], ), ) responses = [r async for r in servicer._run_turn(req)] @@ -613,10 +640,10 @@ async def _run(): conversation_id="../escape", harness_id="antigravity", start=ax_pb2.HarnessStart( - messages=[ax_pb2.Message( + steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", - content=content_pb2.Content(text=content_pb2.TextContent(text="hi")), - )], + content=[content_pb2.Content(text=content_pb2.TextContent(text="hi"))], + ))], ), ) responses = [r async for r in servicer._run_turn(req)] @@ -638,10 +665,10 @@ async def _run(): conversation_id="../escape", harness_id="antigravity", start=ax_pb2.HarnessStart( - messages=[ax_pb2.Message( + steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", - content=content_pb2.Content(text=content_pb2.TextContent(text="hi")), - )], + content=[content_pb2.Content(text=content_pb2.TextContent(text="hi"))], + ))], ), ) responses = [r async for r in servicer._run_turn(req)] diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py index 3662b292..2bb1f025 100644 --- a/python/proto/ax_pb2.py +++ b/python/proto/ax_pb2.py @@ -16,7 +16,7 @@ from proto import content_pb2 as proto_dot_content__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"5\n\x07Message\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x0b.ax.Content\"\xc9\x01\n\x11\x43onversationEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0c\n\x04step\x18\x02 \x01(\x05\x12\x0f\n\x07\x65xec_id\x18\x03 \x01(\t\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12/\n\x0eharness_config\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1d\n\x08messages\x18\x06 \x03(\x0b\x32\x0b.ax.Message\x12\x18\n\x05state\x18\x07 \x01(\x0e\x32\t.ax.State\"E\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x1d\n\x08messages\x18\x02 \x03(\x0b\x32\x0b.ax.Message\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\"/\n\x0eHarnessOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"\x8f\x01\n\x18\x43reateInteractionRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x1b\n\x06inputs\x18\x02 \x03(\x0b\x32\x0b.ax.Message\x12\x11\n\tlast_step\x18\x03 \x01(\x05\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0c\"G\n\x19\x43reateInteractionResponse\x12\x1c\n\x07outputs\x18\x01 \x03(\x0b\x32\x0b.ax.Message\x12\x0c\n\x04step\x18\x02 \x01(\x05\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32i\n\x13InteractionsService\x12R\n\x11\x43reateInteraction\x12\x1c.ax.CreateInteractionRequest\x1a\x1d.ax.CreateInteractionResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xb4\x01\n\tStepEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x16\n\x0einteraction_id\x18\x02 \x01(\t\x12\x12\n\nharness_id\x18\x03 \x01(\t\x12/\n\x0eharness_config\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x17\n\x05steps\x18\x05 \x03(\x0b\x32\x08.ax.Step\x12\x18\n\x05state\x18\x06 \x01(\x0e\x32\t.ax.State\"?\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x17\n\x05steps\x18\x02 \x03(\x0b\x32\x08.ax.Step\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\")\n\x0eHarnessOutputs\x12\x17\n\x05steps\x18\x01 \x03(\x0b\x32\x08.ax.Step\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"}\n\x16\x43reateInteractionEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x18\n\x06inputs\x18\x02 \x03(\x0b\x32\x08.ax.Step\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0cJ\x04\x08\x03\x10\x04\"6\n\x19\x43reateInteractionResponse\x12\x19\n\x07outputs\x18\x01 \x03(\x0b\x32\x08.ax.Step\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32g\n\x13InteractionsService\x12P\n\x11\x43reateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -24,58 +24,56 @@ if _descriptor._USE_C_DESCRIPTORS == False: _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto' - _globals['_STATE']._serialized_start=2290 - _globals['_STATE']._serialized_end=2398 - _globals['_CANCELREASON']._serialized_start=2401 - _globals['_CANCELREASON']._serialized_end=2541 - _globals['_MESSAGE']._serialized_start=73 - _globals['_MESSAGE']._serialized_end=126 - _globals['_CONVERSATIONEVENT']._serialized_start=129 - _globals['_CONVERSATIONEVENT']._serialized_end=330 - _globals['_HARNESSSTART']._serialized_start=332 - _globals['_HARNESSSTART']._serialized_end=401 - _globals['_HARNESSCANCEL']._serialized_start=403 - _globals['_HARNESSCANCEL']._serialized_end=452 - _globals['_HARNESSREQUEST']._serialized_start=455 - _globals['_HARNESSREQUEST']._serialized_end=596 - _globals['_HARNESSOUTPUTS']._serialized_start=598 - _globals['_HARNESSOUTPUTS']._serialized_end=645 - _globals['_ERROR']._serialized_start=647 - _globals['_ERROR']._serialized_end=689 - _globals['_HARNESSEND']._serialized_start=691 - _globals['_HARNESSEND']._serialized_end=755 - _globals['_HARNESSRESPONSE']._serialized_start=757 - _globals['_HARNESSRESPONSE']._serialized_end=877 - _globals['_CREATEINTERACTIONREQUEST']._serialized_start=880 - _globals['_CREATEINTERACTIONREQUEST']._serialized_end=1023 - _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=1025 - _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=1096 - _globals['_DELETECONVERSATIONREQUEST']._serialized_start=1098 - _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1150 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1152 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1180 - _globals['_STEP']._serialized_start=1183 - _globals['_STEP']._serialized_end=1387 - _globals['_CONTENTSTEP']._serialized_start=1389 - _globals['_CONTENTSTEP']._serialized_end=1464 - _globals['_THOUGHTSTEP']._serialized_start=1466 - _globals['_THOUGHTSTEP']._serialized_end=1546 - _globals['_TOOLCALLSTEP']._serialized_start=1548 - _globals['_TOOLCALLSTEP']._serialized_end=1660 - _globals['_FUNCTIONCALLSTEP']._serialized_start=1662 - _globals['_FUNCTIONCALLSTEP']._serialized_end=1744 - _globals['_TOOLRESULTSTEP']._serialized_start=1746 - _globals['_TOOLRESULTSTEP']._serialized_end=1869 - _globals['_FUNCTIONRESULTSTEP']._serialized_start=1871 - _globals['_FUNCTIONRESULTSTEP']._serialized_end=1986 - _globals['_VALUE']._serialized_start=1989 - _globals['_VALUE']._serialized_end=2248 - _globals['_LISTVALUE']._serialized_start=2250 - _globals['_LISTVALUE']._serialized_end=2288 - _globals['_HARNESSSERVICE']._serialized_start=2543 - _globals['_HARNESSSERVICE']._serialized_end=2615 - _globals['_INTERACTIONSSERVICE']._serialized_start=2617 - _globals['_INTERACTIONSSERVICE']._serialized_end=2722 - _globals['_CONVERSATIONSERVICE']._serialized_start=2724 - _globals['_CONVERSATIONSERVICE']._serialized_end=2830 + _globals['_STATE']._serialized_start=2166 + _globals['_STATE']._serialized_end=2274 + _globals['_CANCELREASON']._serialized_start=2277 + _globals['_CANCELREASON']._serialized_end=2417 + _globals['_STEPEVENT']._serialized_start=74 + _globals['_STEPEVENT']._serialized_end=254 + _globals['_HARNESSSTART']._serialized_start=256 + _globals['_HARNESSSTART']._serialized_end=319 + _globals['_HARNESSCANCEL']._serialized_start=321 + _globals['_HARNESSCANCEL']._serialized_end=370 + _globals['_HARNESSREQUEST']._serialized_start=373 + _globals['_HARNESSREQUEST']._serialized_end=514 + _globals['_HARNESSOUTPUTS']._serialized_start=516 + _globals['_HARNESSOUTPUTS']._serialized_end=557 + _globals['_ERROR']._serialized_start=559 + _globals['_ERROR']._serialized_end=601 + _globals['_HARNESSEND']._serialized_start=603 + _globals['_HARNESSEND']._serialized_end=667 + _globals['_HARNESSRESPONSE']._serialized_start=669 + _globals['_HARNESSRESPONSE']._serialized_end=789 + _globals['_CREATEINTERACTIONEVENT']._serialized_start=791 + _globals['_CREATEINTERACTIONEVENT']._serialized_end=916 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=918 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=972 + _globals['_DELETECONVERSATIONREQUEST']._serialized_start=974 + _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1026 + _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1028 + _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1056 + _globals['_STEP']._serialized_start=1059 + _globals['_STEP']._serialized_end=1263 + _globals['_CONTENTSTEP']._serialized_start=1265 + _globals['_CONTENTSTEP']._serialized_end=1340 + _globals['_THOUGHTSTEP']._serialized_start=1342 + _globals['_THOUGHTSTEP']._serialized_end=1422 + _globals['_TOOLCALLSTEP']._serialized_start=1424 + _globals['_TOOLCALLSTEP']._serialized_end=1536 + _globals['_FUNCTIONCALLSTEP']._serialized_start=1538 + _globals['_FUNCTIONCALLSTEP']._serialized_end=1620 + _globals['_TOOLRESULTSTEP']._serialized_start=1622 + _globals['_TOOLRESULTSTEP']._serialized_end=1745 + _globals['_FUNCTIONRESULTSTEP']._serialized_start=1747 + _globals['_FUNCTIONRESULTSTEP']._serialized_end=1862 + _globals['_VALUE']._serialized_start=1865 + _globals['_VALUE']._serialized_end=2124 + _globals['_LISTVALUE']._serialized_start=2126 + _globals['_LISTVALUE']._serialized_end=2164 + _globals['_HARNESSSERVICE']._serialized_start=2419 + _globals['_HARNESSSERVICE']._serialized_end=2491 + _globals['_INTERACTIONSSERVICE']._serialized_start=2493 + _globals['_INTERACTIONSSERVICE']._serialized_end=2596 + _globals['_CONVERSATIONSERVICE']._serialized_start=2598 + _globals['_CONVERSATIONSERVICE']._serialized_end=2704 # @@protoc_insertion_point(module_scope) diff --git a/python/proto/ax_pb2_grpc.py b/python/proto/ax_pb2_grpc.py index c46ceb08..d3e87448 100644 --- a/python/proto/ax_pb2_grpc.py +++ b/python/proto/ax_pb2_grpc.py @@ -81,7 +81,7 @@ def __init__(self, channel): """ self.CreateInteraction = channel.unary_stream( '/ax.InteractionsService/CreateInteraction', - request_serializer=proto_dot_ax__pb2.CreateInteractionRequest.SerializeToString, + request_serializer=proto_dot_ax__pb2.CreateInteractionEvent.SerializeToString, response_deserializer=proto_dot_ax__pb2.CreateInteractionResponse.FromString, ) @@ -102,7 +102,7 @@ def add_InteractionsServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'CreateInteraction': grpc.unary_stream_rpc_method_handler( servicer.CreateInteraction, - request_deserializer=proto_dot_ax__pb2.CreateInteractionRequest.FromString, + request_deserializer=proto_dot_ax__pb2.CreateInteractionEvent.FromString, response_serializer=proto_dot_ax__pb2.CreateInteractionResponse.SerializeToString, ), } @@ -127,7 +127,7 @@ def CreateInteraction(request, timeout=None, metadata=None): return grpc.experimental.unary_stream(request, target, '/ax.InteractionsService/CreateInteraction', - proto_dot_ax__pb2.CreateInteractionRequest.SerializeToString, + proto_dot_ax__pb2.CreateInteractionEvent.SerializeToString, proto_dot_ax__pb2.CreateInteractionResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/python/proto/content_pb2.py b/python/proto/content_pb2.py index 3f2bf3c2..425fdad0 100644 --- a/python/proto/content_pb2.py +++ b/python/proto/content_pb2.py @@ -12,10 +12,9 @@ _sym_db = _symbol_database.Default() -from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13proto/content.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\"-\n\x0bTextContent\x12\x0c\n\x04text\x18\x03 \x01(\tJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x04type\"$\n\x10\x41pprovalDecision\x12\x10\n\x08\x61pproved\x18\x01 \x01(\x08\"1\n\x0f\x44\x65\x63lineDecision\x12\x10\n\x08\x64\x65\x63lined\x18\x01 \x01(\x08J\x04\x08\x02\x10\x03R\x06reason\"\xa3\x01\n\x13\x43onfirmationContent\x12\n\n\x02id\x18\x03 \x01(\t\x12\x10\n\x08question\x18\x04 \x01(\t\x12(\n\x08\x61pproval\x18\x05 \x01(\x0b\x32\x14.ax.ApprovalDecisionH\x00\x12&\n\x07\x64\x65\x63line\x18\x06 \x01(\x0b\x32\x13.ax.DeclineDecisionH\x00\x42\n\n\x08\x64\x65\x63isionJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x04type\"F\n\x15ThoughtSummaryContent\x12\x1f\n\x04text\x18\x01 \x01(\x0b\x32\x0f.ax.TextContentH\x00\x42\x06\n\x04typeJ\x04\x08\x02\x10\x03\"y\n\x0eThoughtContent\x12\x11\n\tsignature\x18\x07 \x01(\x0c\x12*\n\x07summary\x18\t \x03(\x0b\x32\x19.ax.ThoughtSummaryContentJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x03\x10\x04J\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x08\x10\tR\x04type\"j\n\x0fToolCallContent\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\t \x01(\x0c\x12\x30\n\rfunction_call\x18\x02 \x01(\x0b\x32\x17.ax.FunctionCallContentH\x00\x42\x06\n\x04type\"{\n\x11ToolResultContent\x12\x0f\n\x07\x63\x61ll_id\x18\x08 \x01(\t\x12\x11\n\tsignature\x18\t \x01(\x0c\x12\x34\n\x0f\x66unction_result\x18\x02 \x01(\x0b\x32\x19.ax.FunctionResultContentH\x00\x42\x06\n\x04typeJ\x04\x08\x01\x10\x02\"[\n\x13\x46unctionCallContent\x12\x0c\n\x04name\x18\x03 \x01(\t\x12*\n\targuments\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03\"n\n\x15\x46unctionResultContent\x12\x0c\n\x04name\x18\x08 \x01(\t\x12+\n\x08response\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x42\x08\n\x06resultJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05R\x04type\"\xbd\x02\n\x0cImageContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.ImageContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x06 \x01(\tH\x00\x12\'\n\nresolution\x18\x05 \x01(\x0e\x32\x13.ax.MediaResolution\"\x9b\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_PNG\x10\x01\x12\r\n\tTYPE_JPEG\x10\x02\x12\r\n\tTYPE_WEBP\x10\x03\x12\r\n\tTYPE_HEIC\x10\x04\x12\r\n\tTYPE_HEIF\x10\x05\x12\x0c\n\x08TYPE_GIF\x10\x07\x12\x0c\n\x08TYPE_BMP\x10\x08\x12\r\n\tTYPE_TIFF\x10\t\"\x04\x08\x06\x10\x06\x42\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\x8b\x03\n\x0c\x41udioContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.AudioContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x05 \x01(\tH\x00\x12\x10\n\x08\x63hannels\x18\x07 \x01(\x05\x12\x13\n\x0bsample_rate\x18\x08 \x01(\x05\"\xdf\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_WAV\x10\x01\x12\x0c\n\x08TYPE_MP3\x10\x02\x12\r\n\tTYPE_AIFF\x10\x03\x12\x0c\n\x08TYPE_AAC\x10\x04\x12\x0c\n\x08TYPE_OGG\x10\x05\x12\r\n\tTYPE_FLAC\x10\x06\x12\r\n\tTYPE_MPEG\x10\x07\x12\x0c\n\x08TYPE_M4A\x10\x08\x12\x0c\n\x08TYPE_L16\x10\t\x12\x0e\n\nTYPE_S16LE\x10\n\x12\r\n\tTYPE_OPUS\x10\x0b\x12\r\n\tTYPE_ALAW\x10\x0c\x12\x0e\n\nTYPE_MULAW\x10\rB\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04J\x04\x08\x06\x10\x07R\x04typeR\x04rate\"\xcc\x01\n\x0f\x44ocumentContent\x12/\n\tmime_type\x18\x01 \x01(\x0e\x32\x1c.ax.DocumentContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x05 \x01(\tH\x00\"N\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_PDF\x10\x01\x12\r\n\tTYPE_JSON\x10\x02\x12\x0f\n\x0bTYPE_PYTHON\x10\x03\x42\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\xc5\x02\n\x0cVideoContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.VideoContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x06 \x01(\tH\x00\x12\'\n\nresolution\x18\x05 \x01(\x0e\x32\x13.ax.MediaResolution\"\xa3\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_MP4\x10\x01\x12\r\n\tTYPE_MPEG\x10\x02\x12\x0c\n\x08TYPE_MPG\x10\x03\x12\x0c\n\x08TYPE_MOV\x10\x04\x12\x0c\n\x08TYPE_AVI\x10\x05\x12\x0e\n\nTYPE_X_FLV\x10\x06\x12\r\n\tTYPE_WEBM\x10\x07\x12\x0c\n\x08TYPE_WMV\x10\x08\x12\r\n\tTYPE_3GPP\x10\tB\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\x86\x03\n\x07\x43ontent\x12%\n\x07thought\x18\x05 \x01(\x0b\x32\x12.ax.ThoughtContentH\x00\x12\x1f\n\x04text\x18\n \x01(\x0b\x32\x0f.ax.TextContentH\x00\x12!\n\x05image\x18\x0b \x01(\x0b\x32\x10.ax.ImageContentH\x00\x12!\n\x05\x61udio\x18\x0c \x01(\x0b\x32\x10.ax.AudioContentH\x00\x12\'\n\x08\x64ocument\x18\r \x01(\x0b\x32\x13.ax.DocumentContentH\x00\x12!\n\x05video\x18\x0e \x01(\x0b\x32\x10.ax.VideoContentH\x00\x12/\n\x0c\x63onfirmation\x18\x1a \x01(\x0b\x32\x17.ax.ConfirmationContentH\x00\x12(\n\ttool_call\x18\x18 \x01(\x0b\x32\x13.ax.ToolCallContentH\x00\x12,\n\x0btool_result\x18\x19 \x01(\x0b\x32\x15.ax.ToolResultContentH\x00\x42\x06\n\x04typeJ\x04\x08\x01\x10\x05J\x04\x08\x06\x10\nJ\x04\x08\x0f\x10\x18*b\n\x0fMediaResolution\x12 \n\x1cMEDIA_RESOLUTION_UNSPECIFIED\x10\x00\x12\x07\n\x03LOW\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x12\x08\n\x04HIGH\x10\x03\x12\x0e\n\nULTRA_HIGH\x10\x04\x42\x1cZ\x1agithub.com/google/ax/protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13proto/content.proto\x12\x02\x61x\"-\n\x0bTextContent\x12\x0c\n\x04text\x18\x03 \x01(\tJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x04type\"$\n\x10\x41pprovalDecision\x12\x10\n\x08\x61pproved\x18\x01 \x01(\x08\"1\n\x0f\x44\x65\x63lineDecision\x12\x10\n\x08\x64\x65\x63lined\x18\x01 \x01(\x08J\x04\x08\x02\x10\x03R\x06reason\"\xa3\x01\n\x13\x43onfirmationContent\x12\n\n\x02id\x18\x03 \x01(\t\x12\x10\n\x08question\x18\x04 \x01(\t\x12(\n\x08\x61pproval\x18\x05 \x01(\x0b\x32\x14.ax.ApprovalDecisionH\x00\x12&\n\x07\x64\x65\x63line\x18\x06 \x01(\x0b\x32\x13.ax.DeclineDecisionH\x00\x42\n\n\x08\x64\x65\x63isionJ\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03R\x04type\"\xbd\x02\n\x0cImageContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.ImageContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x06 \x01(\tH\x00\x12\'\n\nresolution\x18\x05 \x01(\x0e\x32\x13.ax.MediaResolution\"\x9b\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_PNG\x10\x01\x12\r\n\tTYPE_JPEG\x10\x02\x12\r\n\tTYPE_WEBP\x10\x03\x12\r\n\tTYPE_HEIC\x10\x04\x12\r\n\tTYPE_HEIF\x10\x05\x12\x0c\n\x08TYPE_GIF\x10\x07\x12\x0c\n\x08TYPE_BMP\x10\x08\x12\r\n\tTYPE_TIFF\x10\t\"\x04\x08\x06\x10\x06\x42\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\x8b\x03\n\x0c\x41udioContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.AudioContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x05 \x01(\tH\x00\x12\x10\n\x08\x63hannels\x18\x07 \x01(\x05\x12\x13\n\x0bsample_rate\x18\x08 \x01(\x05\"\xdf\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_WAV\x10\x01\x12\x0c\n\x08TYPE_MP3\x10\x02\x12\r\n\tTYPE_AIFF\x10\x03\x12\x0c\n\x08TYPE_AAC\x10\x04\x12\x0c\n\x08TYPE_OGG\x10\x05\x12\r\n\tTYPE_FLAC\x10\x06\x12\r\n\tTYPE_MPEG\x10\x07\x12\x0c\n\x08TYPE_M4A\x10\x08\x12\x0c\n\x08TYPE_L16\x10\t\x12\x0e\n\nTYPE_S16LE\x10\n\x12\r\n\tTYPE_OPUS\x10\x0b\x12\r\n\tTYPE_ALAW\x10\x0c\x12\x0e\n\nTYPE_MULAW\x10\rB\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04J\x04\x08\x06\x10\x07R\x04typeR\x04rate\"\xcc\x01\n\x0f\x44ocumentContent\x12/\n\tmime_type\x18\x01 \x01(\x0e\x32\x1c.ax.DocumentContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x05 \x01(\tH\x00\"N\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_PDF\x10\x01\x12\r\n\tTYPE_JSON\x10\x02\x12\x0f\n\x0bTYPE_PYTHON\x10\x03\x42\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\xc5\x02\n\x0cVideoContent\x12,\n\tmime_type\x18\x01 \x01(\x0e\x32\x19.ax.VideoContent.MimeType\x12\x0e\n\x04\x64\x61ta\x18\x02 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x06 \x01(\tH\x00\x12\'\n\nresolution\x18\x05 \x01(\x0e\x32\x13.ax.MediaResolution\"\xa3\x01\n\x08MimeType\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08TYPE_MP4\x10\x01\x12\r\n\tTYPE_MPEG\x10\x02\x12\x0c\n\x08TYPE_MPG\x10\x03\x12\x0c\n\x08TYPE_MOV\x10\x04\x12\x0c\n\x08TYPE_AVI\x10\x05\x12\x0e\n\nTYPE_X_FLV\x10\x06\x12\r\n\tTYPE_WEBM\x10\x07\x12\x0c\n\x08TYPE_WMV\x10\x08\x12\r\n\tTYPE_3GPP\x10\tB\r\n\x0b\x64\x61ta_or_uriJ\x04\x08\x03\x10\x04R\x04type\"\x81\x02\n\x07\x43ontent\x12\x1f\n\x04text\x18\n \x01(\x0b\x32\x0f.ax.TextContentH\x00\x12!\n\x05image\x18\x0b \x01(\x0b\x32\x10.ax.ImageContentH\x00\x12!\n\x05\x61udio\x18\x0c \x01(\x0b\x32\x10.ax.AudioContentH\x00\x12\'\n\x08\x64ocument\x18\r \x01(\x0b\x32\x13.ax.DocumentContentH\x00\x12!\n\x05video\x18\x0e \x01(\x0b\x32\x10.ax.VideoContentH\x00\x12/\n\x0c\x63onfirmation\x18\x1a \x01(\x0b\x32\x17.ax.ConfirmationContentH\x00\x42\x06\n\x04typeJ\x04\x08\x01\x10\nJ\x04\x08\x0f\x10\x1a*b\n\x0fMediaResolution\x12 \n\x1cMEDIA_RESOLUTION_UNSPECIFIED\x10\x00\x12\x07\n\x03LOW\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x12\x08\n\x04HIGH\x10\x03\x12\x0e\n\nULTRA_HIGH\x10\x04\x42\x1cZ\x1agithub.com/google/ax/protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -23,44 +22,32 @@ if _descriptor._USE_C_DESCRIPTORS == False: _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto' - _globals['_MEDIARESOLUTION']._serialized_start=2638 - _globals['_MEDIARESOLUTION']._serialized_end=2736 - _globals['_TEXTCONTENT']._serialized_start=57 - _globals['_TEXTCONTENT']._serialized_end=102 - _globals['_APPROVALDECISION']._serialized_start=104 - _globals['_APPROVALDECISION']._serialized_end=140 - _globals['_DECLINEDECISION']._serialized_start=142 - _globals['_DECLINEDECISION']._serialized_end=191 - _globals['_CONFIRMATIONCONTENT']._serialized_start=194 - _globals['_CONFIRMATIONCONTENT']._serialized_end=357 - _globals['_THOUGHTSUMMARYCONTENT']._serialized_start=359 - _globals['_THOUGHTSUMMARYCONTENT']._serialized_end=429 - _globals['_THOUGHTCONTENT']._serialized_start=431 - _globals['_THOUGHTCONTENT']._serialized_end=552 - _globals['_TOOLCALLCONTENT']._serialized_start=554 - _globals['_TOOLCALLCONTENT']._serialized_end=660 - _globals['_TOOLRESULTCONTENT']._serialized_start=662 - _globals['_TOOLRESULTCONTENT']._serialized_end=785 - _globals['_FUNCTIONCALLCONTENT']._serialized_start=787 - _globals['_FUNCTIONCALLCONTENT']._serialized_end=878 - _globals['_FUNCTIONRESULTCONTENT']._serialized_start=880 - _globals['_FUNCTIONRESULTCONTENT']._serialized_end=990 - _globals['_IMAGECONTENT']._serialized_start=993 - _globals['_IMAGECONTENT']._serialized_end=1310 - _globals['_IMAGECONTENT_MIMETYPE']._serialized_start=1128 - _globals['_IMAGECONTENT_MIMETYPE']._serialized_end=1283 - _globals['_AUDIOCONTENT']._serialized_start=1313 - _globals['_AUDIOCONTENT']._serialized_end=1708 - _globals['_AUDIOCONTENT_MIMETYPE']._serialized_start=1446 - _globals['_AUDIOCONTENT_MIMETYPE']._serialized_end=1669 - _globals['_DOCUMENTCONTENT']._serialized_start=1711 - _globals['_DOCUMENTCONTENT']._serialized_end=1915 - _globals['_DOCUMENTCONTENT_MIMETYPE']._serialized_start=1810 - _globals['_DOCUMENTCONTENT_MIMETYPE']._serialized_end=1888 - _globals['_VIDEOCONTENT']._serialized_start=1918 - _globals['_VIDEOCONTENT']._serialized_end=2243 - _globals['_VIDEOCONTENT_MIMETYPE']._serialized_start=2053 - _globals['_VIDEOCONTENT_MIMETYPE']._serialized_end=2216 - _globals['_CONTENT']._serialized_start=2246 - _globals['_CONTENT']._serialized_end=2636 + _globals['_MEDIARESOLUTION']._serialized_start=1842 + _globals['_MEDIARESOLUTION']._serialized_end=1940 + _globals['_TEXTCONTENT']._serialized_start=27 + _globals['_TEXTCONTENT']._serialized_end=72 + _globals['_APPROVALDECISION']._serialized_start=74 + _globals['_APPROVALDECISION']._serialized_end=110 + _globals['_DECLINEDECISION']._serialized_start=112 + _globals['_DECLINEDECISION']._serialized_end=161 + _globals['_CONFIRMATIONCONTENT']._serialized_start=164 + _globals['_CONFIRMATIONCONTENT']._serialized_end=327 + _globals['_IMAGECONTENT']._serialized_start=330 + _globals['_IMAGECONTENT']._serialized_end=647 + _globals['_IMAGECONTENT_MIMETYPE']._serialized_start=465 + _globals['_IMAGECONTENT_MIMETYPE']._serialized_end=620 + _globals['_AUDIOCONTENT']._serialized_start=650 + _globals['_AUDIOCONTENT']._serialized_end=1045 + _globals['_AUDIOCONTENT_MIMETYPE']._serialized_start=783 + _globals['_AUDIOCONTENT_MIMETYPE']._serialized_end=1006 + _globals['_DOCUMENTCONTENT']._serialized_start=1048 + _globals['_DOCUMENTCONTENT']._serialized_end=1252 + _globals['_DOCUMENTCONTENT_MIMETYPE']._serialized_start=1147 + _globals['_DOCUMENTCONTENT_MIMETYPE']._serialized_end=1225 + _globals['_VIDEOCONTENT']._serialized_start=1255 + _globals['_VIDEOCONTENT']._serialized_end=1580 + _globals['_VIDEOCONTENT_MIMETYPE']._serialized_start=1390 + _globals['_VIDEOCONTENT_MIMETYPE']._serialized_end=1553 + _globals['_CONTENT']._serialized_start=1583 + _globals['_CONTENT']._serialized_end=1840 # @@protoc_insertion_point(module_scope) From 2247161d34919b548ac67ecfdf466321c1f33bf8 Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Tue, 11 Aug 2026 22:24:28 -0700 Subject: [PATCH 3/5] Delete ConversationService for now --- internal/controller/controller.go | 9 - internal/controller/eventlog/eventlog.go | 3 - .../eventlog/eventlogtest/eventlog.go | 15 - internal/controller/eventlog/sql.go | 11 - internal/controller/eventlog/sql_test.go | 41 --- internal/server/interceptors_test.go | 71 ----- internal/server/server.go | 23 -- proto/ax.pb.go | 259 ++++++------------ proto/ax.proto | 12 - proto/ax_grpc.pb.go | 106 ------- python/proto/ax_pb2.py | 60 ++-- python/proto/ax_pb2_grpc.py | 63 ----- 12 files changed, 112 insertions(+), 561 deletions(-) diff --git a/internal/controller/controller.go b/internal/controller/controller.go index 26ee0518..b3354c8d 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -186,15 +186,6 @@ func (a *harnessHandler) OnComplete(ctx context.Context, execID string) error { return nil } -// Delete deletes all events for a specific conversation ID. -func (d *Controller) Delete(ctx context.Context, conversationID string) error { - if conversationID == "" { - return fmt.Errorf("conversation_id is required") - } - - return d.eventLog.DeleteAll(ctx, conversationID) -} - // Registry returns the agent registry. func (d *Controller) Registry() *Registry { return d.registry diff --git a/internal/controller/eventlog/eventlog.go b/internal/controller/eventlog/eventlog.go index 16956abb..0abbd372 100644 --- a/internal/controller/eventlog/eventlog.go +++ b/internal/controller/eventlog/eventlog.go @@ -35,9 +35,6 @@ type EventLog interface { // Events returns all events for the conversation. Events(ctx context.Context, conversationID string) ([]*proto.StepEvent, error) - // DeleteAll deletes all events for a specific conversation ID. - DeleteAll(ctx context.Context, conversationID string) error - // Close releases the underlying resources and closes the log. Close() error } diff --git a/internal/controller/eventlog/eventlogtest/eventlog.go b/internal/controller/eventlog/eventlogtest/eventlog.go index 9c7b80e7..97a7feca 100644 --- a/internal/controller/eventlog/eventlogtest/eventlog.go +++ b/internal/controller/eventlog/eventlogtest/eventlog.go @@ -71,21 +71,6 @@ func (m *MemoryEventLog) Drop(drop func(*proto.StepEvent) bool) { m.AllEvents = kept } -func (m *MemoryEventLog) DeleteAll(_ context.Context, conversationID string) error { - m.mu.Lock() - defer m.mu.Unlock() - - var keptEvents []*proto.StepEvent - for _, ev := range m.AllEvents { - if ev.ConversationId != conversationID { - keptEvents = append(keptEvents, ev) - } - } - m.AllEvents = keptEvents - - return nil -} - func (m *MemoryEventLog) Close() error { return nil } diff --git a/internal/controller/eventlog/sql.go b/internal/controller/eventlog/sql.go index 54ef3651..a8999c8c 100644 --- a/internal/controller/eventlog/sql.go +++ b/internal/controller/eventlog/sql.go @@ -96,17 +96,6 @@ func (l *sqlEventLog) Events(ctx context.Context, conversationID string) (events return events, nil } -// DeleteAll deletes all events for a specific conversation ID. -func (l *sqlEventLog) DeleteAll(ctx context.Context, conversationID string) (err error) { - ctx, endSpan := l.startSpan(ctx, "DeleteAll", conversationID) - defer func() { endSpan(err) }() - - if _, err := l.db.ExecContext(ctx, "DELETE FROM conversation_log WHERE conversation_id = $1", conversationID); err != nil { - return fmt.Errorf("eventlog: delete conversation: %w", err) - } - return nil -} - // Close releases the database connection. func (l *sqlEventLog) Close() error { return l.db.Close() diff --git a/internal/controller/eventlog/sql_test.go b/internal/controller/eventlog/sql_test.go index 4330aecb..65c9b430 100644 --- a/internal/controller/eventlog/sql_test.go +++ b/internal/controller/eventlog/sql_test.go @@ -39,8 +39,6 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { conv := t.Name() + "-conv-1" task1 := t.Name() + "-task-1" task2 := t.Name() + "-task-2" - _ = log.DeleteAll(ctx, conv) - t.Cleanup(func() { _ = log.DeleteAll(ctx, conv) }) // 1. Conversation log. cev1 := &proto.StepEvent{ConversationId: conv, InteractionId: task1} @@ -68,7 +66,6 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { t.Errorf("conversation events mismatch: %q, %q", cEvents[0].InteractionId, cEvents[1].InteractionId) } - }) t.Run("Empty", func(t *testing.T) { @@ -84,42 +81,6 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { } }) - t.Run("DeleteAll", func(t *testing.T) { - ctx := context.Background() - log := newLog(t) - - conv1 := t.Name() + "-conv-1" - conv2 := t.Name() + "-conv-2" - task1 := t.Name() + "-task-1" - task3 := t.Name() + "-task-3" - _ = log.DeleteAll(ctx, conv1) - _ = log.DeleteAll(ctx, conv2) - t.Cleanup(func() { - _ = log.DeleteAll(ctx, conv1) - _ = log.DeleteAll(ctx, conv2) - }) - - if _, err := log.Append(ctx, &proto.StepEvent{ConversationId: conv1, InteractionId: task1}); err != nil { - t.Fatalf("append: %v", err) - } - if _, err := log.Append(ctx, &proto.StepEvent{ConversationId: conv2, InteractionId: task3}); err != nil { - t.Fatalf("append: %v", err) - } - - - if err := log.DeleteAll(ctx, conv1); err != nil { - t.Fatalf("failed to delete events: %v", err) - } - - if ev, _ := log.Events(ctx, conv1); len(ev) != 0 { - t.Errorf("expected 0 events for conv1, got %d", len(ev)) - } - if ev, _ := log.Events(ctx, conv2); len(ev) != 1 { - t.Errorf("expected 1 event for conv2, got %d", len(ev)) - } - - }) - // AutoStep exercises the step==0 auto-assignment path: appends with Step unset // receive sequential numbers starting at 1. t.Run("AutoStep", func(t *testing.T) { @@ -127,8 +88,6 @@ func testEventLog(t *testing.T, newLog func(t *testing.T) EventLog) { log := newLog(t) conv := t.Name() + "-conv" - _ = log.DeleteAll(ctx, conv) - t.Cleanup(func() { _ = log.DeleteAll(ctx, conv) }) const n = 3 for i := int64(1); i <= n; i++ { diff --git a/internal/server/interceptors_test.go b/internal/server/interceptors_test.go index 9f5c8cb5..712238d1 100644 --- a/internal/server/interceptors_test.go +++ b/internal/server/interceptors_test.go @@ -33,17 +33,6 @@ import ( ) // Mock servers for testing interceptors -type mockConversationServer struct { - proto.UnimplementedConversationServiceServer -} - -func (m *mockConversationServer) DeleteConversation(ctx context.Context, req *proto.DeleteConversationRequest) (*proto.DeleteConversationResponse, error) { - if req.ConversationId == "fail" { - return nil, status.Error(codes.InvalidArgument, "mock error") - } - return &proto.DeleteConversationResponse{}, nil -} - type mockExecutionServer struct { proto.UnimplementedInteractionsServiceServer } @@ -64,7 +53,6 @@ func setupTestServer(t *testing.T) (*grpc.ClientConn, func()) { grpc.ChainStreamInterceptor(StreamLoggingInterceptor), ) - proto.RegisterConversationServiceServer(s, &mockConversationServer{}) proto.RegisterInteractionsServiceServer(s, &mockExecutionServer{}) go func() { @@ -113,67 +101,8 @@ func TestLoggingInterceptors(t *testing.T) { slog.SetDefault(testLogger) defer slog.SetDefault(oldLogger) - convClient := proto.NewConversationServiceClient(conn) executionClient := proto.NewInteractionsServiceClient(conn) - t.Run("Unary Success", func(t *testing.T) { - logBuf.Reset() - ctx := context.Background() - _, err := convClient.DeleteConversation(ctx, &proto.DeleteConversationRequest{ConversationId: "conv-123"}) - if err != nil { - t.Fatalf("DeleteConversation failed: %v", err) - } - - entries := parseLogs(t, &logBuf) - if len(entries) != 2 { - t.Fatalf("Expected 2 log entries, got %d", len(entries)) - } - - // Verify Start Log - if entries[0].Msg != "Handling unary request" { - t.Errorf("Expected start log msg 'Handling unary request', got %q", entries[0].Msg) - } - if entries[0].Method != "/ax.ConversationService/DeleteConversation" { - t.Errorf("Expected method '/ax.ConversationService/DeleteConversation', got %q", entries[0].Method) - } - if entries[0].ConversationID != "conv-123" { - t.Errorf("Expected conversation_id 'conv-123', got %q", entries[0].ConversationID) - } - - // Verify End Log - if entries[1].Msg != "Request completed" { - t.Errorf("Expected end log msg 'Request completed', got %q", entries[1].Msg) - } - if entries[1].Level != "INFO" { - t.Errorf("Expected Level INFO, got %s", entries[1].Level) - } - }) - - t.Run("Unary Failure", func(t *testing.T) { - logBuf.Reset() - ctx := context.Background() - _, err := convClient.DeleteConversation(ctx, &proto.DeleteConversationRequest{ConversationId: "fail"}) - if err == nil { - t.Fatal("Expected DeleteConversation to fail") - } - - entries := parseLogs(t, &logBuf) - if len(entries) != 2 { - t.Fatalf("Expected 2 log entries, got %d", len(entries)) - } - - // Verify End Log - if entries[1].Msg != "Request failed" { - t.Errorf("Expected end log msg 'Request failed', got %q", entries[1].Msg) - } - if entries[1].Level != "ERROR" { - t.Errorf("Expected Level ERROR, got %s", entries[1].Level) - } - if !strings.Contains(entries[1].Error, "mock error") { - t.Errorf("Expected error details to contain 'mock error', got %q", entries[1].Error) - } - }) - t.Run("Stream Success", func(t *testing.T) { logBuf.Reset() ctx := context.Background() diff --git a/internal/server/server.go b/internal/server/server.go index 73b4bc93..c79421c4 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -18,7 +18,6 @@ package server import ( - "context" "fmt" "log/slog" "net" @@ -38,7 +37,6 @@ import ( // Server implements the AXService gRPC service. type Server struct { proto.UnimplementedInteractionsServiceServer - proto.UnimplementedConversationServiceServer controller *controller.Controller grpcServer *grpc.Server @@ -73,26 +71,6 @@ func (s *Server) CreateInteraction(req *proto.CreateInteractionEvent, stream grp return s.controller.Exec(ctx, req, outputHandler) } - -func (s *Server) DeleteConversation(ctx context.Context, req *proto.DeleteConversationRequest) (*proto.DeleteConversationResponse, error) { - slog.InfoContext(ctx, "Deleting conversation...", - slog.String("conversation_id", req.ConversationId)) - - if req.ConversationId == "" { - return nil, status.Errorf(codes.InvalidArgument, "conversation_id is required") - } - inFlight, cleanup := s.markInFlight(req.ConversationId) - if inFlight { - return nil, status.Errorf(codes.FailedPrecondition, "conversation %q is already in flight", req.ConversationId) - } - defer cleanup() - - if err := s.controller.Delete(ctx, req.ConversationId); err != nil { - return nil, status.Errorf(codes.Internal, "failed to delete conversation: %v", err) - } - return &proto.DeleteConversationResponse{}, nil -} - // Serve starts the gRPC server on the specified address. func (s *Server) Serve(address string, opts ...grpc.ServerOption) error { lis, err := net.Listen("tcp", address) @@ -108,7 +86,6 @@ func (s *Server) Serve(address string, opts ...grpc.ServerOption) error { s.grpcServer = grpc.NewServer(opts...) proto.RegisterInteractionsServiceServer(s.grpcServer, s) - proto.RegisterConversationServiceServer(s.grpcServer, s) // Register standard gRPC Health Check server. hs := health.NewServer() diff --git a/proto/ax.pb.go b/proto/ax.pb.go index d73ce814..a05742c1 100644 --- a/proto/ax.pb.go +++ b/proto/ax.pb.go @@ -784,86 +784,6 @@ func (x *CreateInteractionResponse) GetOutputs() []*Step { return nil } -type DeleteConversationRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteConversationRequest) Reset() { - *x = DeleteConversationRequest{} - mi := &file_proto_ax_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteConversationRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteConversationRequest) ProtoMessage() {} - -func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteConversationRequest.ProtoReflect.Descriptor instead. -func (*DeleteConversationRequest) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{10} -} - -func (x *DeleteConversationRequest) GetConversationId() string { - if x != nil { - return x.ConversationId - } - return "" -} - -type DeleteConversationResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteConversationResponse) Reset() { - *x = DeleteConversationResponse{} - mi := &file_proto_ax_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteConversationResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteConversationResponse) ProtoMessage() {} - -func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteConversationResponse.ProtoReflect.Descriptor instead. -func (*DeleteConversationResponse) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{11} -} - type Step struct { state protoimpl.MessageState `protogen:"open.v1"` Description string `protobuf:"bytes,16,opt,name=description,proto3" json:"description,omitempty"` @@ -881,7 +801,7 @@ type Step struct { func (x *Step) Reset() { *x = Step{} - mi := &file_proto_ax_proto_msgTypes[12] + mi := &file_proto_ax_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -893,7 +813,7 @@ func (x *Step) String() string { func (*Step) ProtoMessage() {} func (x *Step) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[12] + mi := &file_proto_ax_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -906,7 +826,7 @@ func (x *Step) ProtoReflect() protoreflect.Message { // Deprecated: Use Step.ProtoReflect.Descriptor instead. func (*Step) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{12} + return file_proto_ax_proto_rawDescGZIP(), []int{10} } func (x *Step) GetDescription() string { @@ -1004,7 +924,7 @@ type ContentStep struct { func (x *ContentStep) Reset() { *x = ContentStep{} - mi := &file_proto_ax_proto_msgTypes[13] + mi := &file_proto_ax_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1016,7 +936,7 @@ func (x *ContentStep) String() string { func (*ContentStep) ProtoMessage() {} func (x *ContentStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[13] + mi := &file_proto_ax_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1029,7 +949,7 @@ func (x *ContentStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ContentStep.ProtoReflect.Descriptor instead. func (*ContentStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{13} + return file_proto_ax_proto_rawDescGZIP(), []int{11} } func (x *ContentStep) GetRole() string { @@ -1058,7 +978,7 @@ type ThoughtStep struct { func (x *ThoughtStep) Reset() { *x = ThoughtStep{} - mi := &file_proto_ax_proto_msgTypes[14] + mi := &file_proto_ax_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1070,7 +990,7 @@ func (x *ThoughtStep) String() string { func (*ThoughtStep) ProtoMessage() {} func (x *ThoughtStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[14] + mi := &file_proto_ax_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1083,7 +1003,7 @@ func (x *ThoughtStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ThoughtStep.ProtoReflect.Descriptor instead. func (*ThoughtStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{14} + return file_proto_ax_proto_rawDescGZIP(), []int{12} } func (x *ThoughtStep) GetSignature() []byte { @@ -1114,7 +1034,7 @@ type ToolCallStep struct { func (x *ToolCallStep) Reset() { *x = ToolCallStep{} - mi := &file_proto_ax_proto_msgTypes[15] + mi := &file_proto_ax_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1126,7 +1046,7 @@ func (x *ToolCallStep) String() string { func (*ToolCallStep) ProtoMessage() {} func (x *ToolCallStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[15] + mi := &file_proto_ax_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1139,7 +1059,7 @@ func (x *ToolCallStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ToolCallStep.ProtoReflect.Descriptor instead. func (*ToolCallStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{15} + return file_proto_ax_proto_rawDescGZIP(), []int{13} } func (x *ToolCallStep) GetId() string { @@ -1192,7 +1112,7 @@ type FunctionCallStep struct { func (x *FunctionCallStep) Reset() { *x = FunctionCallStep{} - mi := &file_proto_ax_proto_msgTypes[16] + mi := &file_proto_ax_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1204,7 +1124,7 @@ func (x *FunctionCallStep) String() string { func (*FunctionCallStep) ProtoMessage() {} func (x *FunctionCallStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[16] + mi := &file_proto_ax_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1217,7 +1137,7 @@ func (x *FunctionCallStep) ProtoReflect() protoreflect.Message { // Deprecated: Use FunctionCallStep.ProtoReflect.Descriptor instead. func (*FunctionCallStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{16} + return file_proto_ax_proto_rawDescGZIP(), []int{14} } func (x *FunctionCallStep) GetName() string { @@ -1248,7 +1168,7 @@ type ToolResultStep struct { func (x *ToolResultStep) Reset() { *x = ToolResultStep{} - mi := &file_proto_ax_proto_msgTypes[17] + mi := &file_proto_ax_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1260,7 +1180,7 @@ func (x *ToolResultStep) String() string { func (*ToolResultStep) ProtoMessage() {} func (x *ToolResultStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[17] + mi := &file_proto_ax_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1273,7 +1193,7 @@ func (x *ToolResultStep) ProtoReflect() protoreflect.Message { // Deprecated: Use ToolResultStep.ProtoReflect.Descriptor instead. func (*ToolResultStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{17} + return file_proto_ax_proto_rawDescGZIP(), []int{15} } func (x *ToolResultStep) GetCallId() string { @@ -1330,7 +1250,7 @@ type FunctionResultStep struct { func (x *FunctionResultStep) Reset() { *x = FunctionResultStep{} - mi := &file_proto_ax_proto_msgTypes[18] + mi := &file_proto_ax_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1342,7 +1262,7 @@ func (x *FunctionResultStep) String() string { func (*FunctionResultStep) ProtoMessage() {} func (x *FunctionResultStep) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[18] + mi := &file_proto_ax_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1355,7 +1275,7 @@ func (x *FunctionResultStep) ProtoReflect() protoreflect.Message { // Deprecated: Use FunctionResultStep.ProtoReflect.Descriptor instead. func (*FunctionResultStep) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{18} + return file_proto_ax_proto_rawDescGZIP(), []int{16} } func (x *FunctionResultStep) GetName() string { @@ -1399,7 +1319,7 @@ type Value struct { func (x *Value) Reset() { *x = Value{} - mi := &file_proto_ax_proto_msgTypes[19] + mi := &file_proto_ax_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1411,7 +1331,7 @@ func (x *Value) String() string { func (*Value) ProtoMessage() {} func (x *Value) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[19] + mi := &file_proto_ax_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1424,7 +1344,7 @@ func (x *Value) ProtoReflect() protoreflect.Message { // Deprecated: Use Value.ProtoReflect.Descriptor instead. func (*Value) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{19} + return file_proto_ax_proto_rawDescGZIP(), []int{17} } func (x *Value) GetKind() isValue_Kind { @@ -1561,7 +1481,7 @@ type ListValue struct { func (x *ListValue) Reset() { *x = ListValue{} - mi := &file_proto_ax_proto_msgTypes[20] + mi := &file_proto_ax_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1573,7 +1493,7 @@ func (x *ListValue) String() string { func (*ListValue) ProtoMessage() {} func (x *ListValue) ProtoReflect() protoreflect.Message { - mi := &file_proto_ax_proto_msgTypes[20] + mi := &file_proto_ax_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1586,7 +1506,7 @@ func (x *ListValue) ProtoReflect() protoreflect.Message { // Deprecated: Use ListValue.ProtoReflect.Descriptor instead. func (*ListValue) Descriptor() ([]byte, []int) { - return file_proto_ax_proto_rawDescGZIP(), []int{20} + return file_proto_ax_proto_rawDescGZIP(), []int{18} } func (x *ListValue) GetValues() []*Value { @@ -1642,10 +1562,7 @@ const file_proto_ax_proto_rawDesc = "" + "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" + "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfigJ\x04\b\x03\x10\x04\"?\n" + "\x19CreateInteractionResponse\x12\"\n" + - "\aoutputs\x18\x01 \x03(\v2\b.ax.StepR\aoutputs\"D\n" + - "\x19DeleteConversationRequest\x12'\n" + - "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\"\x1c\n" + - "\x1aDeleteConversationResponse\"\x88\x02\n" + + "\aoutputs\x18\x01 \x03(\v2\b.ax.StepR\aoutputs\"\x88\x02\n" + "\x04Step\x12 \n" + "\vdescription\x18\x10 \x01(\tR\vdescription\x12+\n" + "\acontent\x18\f \x01(\v2\x0f.ax.ContentStepH\x00R\acontent\x12+\n" + @@ -1711,9 +1628,7 @@ const file_proto_ax_proto_rawDesc = "" + "\x0eHarnessService\x126\n" + "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012g\n" + "\x13InteractionsService\x12P\n" + - "\x11CreateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x012j\n" + - "\x13ConversationService\x12S\n" + - "\x12DeleteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3" + "\x11CreateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01B\x1cZ\x1agithub.com/google/ax/protob\x06proto3" var ( file_proto_ax_proto_rawDescOnce sync.Once @@ -1728,73 +1643,69 @@ func file_proto_ax_proto_rawDescGZIP() []byte { } var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_proto_ax_proto_goTypes = []any{ - (State)(0), // 0: ax.State - (CancelReason)(0), // 1: ax.CancelReason - (*StepEvent)(nil), // 2: ax.StepEvent - (*HarnessStart)(nil), // 3: ax.HarnessStart - (*HarnessCancel)(nil), // 4: ax.HarnessCancel - (*HarnessRequest)(nil), // 5: ax.HarnessRequest - (*HarnessOutputs)(nil), // 6: ax.HarnessOutputs - (*Error)(nil), // 7: ax.Error - (*HarnessEnd)(nil), // 8: ax.HarnessEnd - (*HarnessResponse)(nil), // 9: ax.HarnessResponse - (*CreateInteractionEvent)(nil), // 10: ax.CreateInteractionEvent - (*CreateInteractionResponse)(nil), // 11: ax.CreateInteractionResponse - (*DeleteConversationRequest)(nil), // 12: ax.DeleteConversationRequest - (*DeleteConversationResponse)(nil), // 13: ax.DeleteConversationResponse - (*Step)(nil), // 14: ax.Step - (*ContentStep)(nil), // 15: ax.ContentStep - (*ThoughtStep)(nil), // 16: ax.ThoughtStep - (*ToolCallStep)(nil), // 17: ax.ToolCallStep - (*FunctionCallStep)(nil), // 18: ax.FunctionCallStep - (*ToolResultStep)(nil), // 19: ax.ToolResultStep - (*FunctionResultStep)(nil), // 20: ax.FunctionResultStep - (*Value)(nil), // 21: ax.Value - (*ListValue)(nil), // 22: ax.ListValue - (*structpb.Struct)(nil), // 23: google.protobuf.Struct - (*Content)(nil), // 24: ax.Content - (structpb.NullValue)(0), // 25: google.protobuf.NullValue + (State)(0), // 0: ax.State + (CancelReason)(0), // 1: ax.CancelReason + (*StepEvent)(nil), // 2: ax.StepEvent + (*HarnessStart)(nil), // 3: ax.HarnessStart + (*HarnessCancel)(nil), // 4: ax.HarnessCancel + (*HarnessRequest)(nil), // 5: ax.HarnessRequest + (*HarnessOutputs)(nil), // 6: ax.HarnessOutputs + (*Error)(nil), // 7: ax.Error + (*HarnessEnd)(nil), // 8: ax.HarnessEnd + (*HarnessResponse)(nil), // 9: ax.HarnessResponse + (*CreateInteractionEvent)(nil), // 10: ax.CreateInteractionEvent + (*CreateInteractionResponse)(nil), // 11: ax.CreateInteractionResponse + (*Step)(nil), // 12: ax.Step + (*ContentStep)(nil), // 13: ax.ContentStep + (*ThoughtStep)(nil), // 14: ax.ThoughtStep + (*ToolCallStep)(nil), // 15: ax.ToolCallStep + (*FunctionCallStep)(nil), // 16: ax.FunctionCallStep + (*ToolResultStep)(nil), // 17: ax.ToolResultStep + (*FunctionResultStep)(nil), // 18: ax.FunctionResultStep + (*Value)(nil), // 19: ax.Value + (*ListValue)(nil), // 20: ax.ListValue + (*structpb.Struct)(nil), // 21: google.protobuf.Struct + (*Content)(nil), // 22: ax.Content + (structpb.NullValue)(0), // 23: google.protobuf.NullValue } var file_proto_ax_proto_depIdxs = []int32{ - 23, // 0: ax.StepEvent.harness_config:type_name -> google.protobuf.Struct - 14, // 1: ax.StepEvent.steps:type_name -> ax.Step + 21, // 0: ax.StepEvent.harness_config:type_name -> google.protobuf.Struct + 12, // 1: ax.StepEvent.steps:type_name -> ax.Step 0, // 2: ax.StepEvent.state:type_name -> ax.State - 14, // 3: ax.HarnessStart.steps:type_name -> ax.Step + 12, // 3: ax.HarnessStart.steps:type_name -> ax.Step 1, // 4: ax.HarnessCancel.reason:type_name -> ax.CancelReason 3, // 5: ax.HarnessRequest.start:type_name -> ax.HarnessStart 4, // 6: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel - 14, // 7: ax.HarnessOutputs.steps:type_name -> ax.Step + 12, // 7: ax.HarnessOutputs.steps:type_name -> ax.Step 0, // 8: ax.HarnessEnd.state:type_name -> ax.State 7, // 9: ax.HarnessEnd.error:type_name -> ax.Error 6, // 10: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs 8, // 11: ax.HarnessResponse.end:type_name -> ax.HarnessEnd - 14, // 12: ax.CreateInteractionEvent.inputs:type_name -> ax.Step - 14, // 13: ax.CreateInteractionResponse.outputs:type_name -> ax.Step - 15, // 14: ax.Step.content:type_name -> ax.ContentStep - 16, // 15: ax.Step.thought:type_name -> ax.ThoughtStep - 17, // 16: ax.Step.tool_call:type_name -> ax.ToolCallStep - 19, // 17: ax.Step.tool_result:type_name -> ax.ToolResultStep - 24, // 18: ax.ContentStep.content:type_name -> ax.Content - 24, // 19: ax.ThoughtStep.summary:type_name -> ax.Content - 18, // 20: ax.ToolCallStep.function_call:type_name -> ax.FunctionCallStep - 23, // 21: ax.FunctionCallStep.arguments:type_name -> google.protobuf.Struct - 20, // 22: ax.ToolResultStep.function_result:type_name -> ax.FunctionResultStep - 21, // 23: ax.FunctionResultStep.result:type_name -> ax.Value - 25, // 24: ax.Value.null_value:type_name -> google.protobuf.NullValue - 23, // 25: ax.Value.struct_value:type_name -> google.protobuf.Struct - 22, // 26: ax.Value.list_value:type_name -> ax.ListValue - 24, // 27: ax.Value.content_value:type_name -> ax.Content - 21, // 28: ax.ListValue.values:type_name -> ax.Value + 12, // 12: ax.CreateInteractionEvent.inputs:type_name -> ax.Step + 12, // 13: ax.CreateInteractionResponse.outputs:type_name -> ax.Step + 13, // 14: ax.Step.content:type_name -> ax.ContentStep + 14, // 15: ax.Step.thought:type_name -> ax.ThoughtStep + 15, // 16: ax.Step.tool_call:type_name -> ax.ToolCallStep + 17, // 17: ax.Step.tool_result:type_name -> ax.ToolResultStep + 22, // 18: ax.ContentStep.content:type_name -> ax.Content + 22, // 19: ax.ThoughtStep.summary:type_name -> ax.Content + 16, // 20: ax.ToolCallStep.function_call:type_name -> ax.FunctionCallStep + 21, // 21: ax.FunctionCallStep.arguments:type_name -> google.protobuf.Struct + 18, // 22: ax.ToolResultStep.function_result:type_name -> ax.FunctionResultStep + 19, // 23: ax.FunctionResultStep.result:type_name -> ax.Value + 23, // 24: ax.Value.null_value:type_name -> google.protobuf.NullValue + 21, // 25: ax.Value.struct_value:type_name -> google.protobuf.Struct + 20, // 26: ax.Value.list_value:type_name -> ax.ListValue + 22, // 27: ax.Value.content_value:type_name -> ax.Content + 19, // 28: ax.ListValue.values:type_name -> ax.Value 5, // 29: ax.HarnessService.Connect:input_type -> ax.HarnessRequest 10, // 30: ax.InteractionsService.CreateInteraction:input_type -> ax.CreateInteractionEvent - 12, // 31: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest - 9, // 32: ax.HarnessService.Connect:output_type -> ax.HarnessResponse - 11, // 33: ax.InteractionsService.CreateInteraction:output_type -> ax.CreateInteractionResponse - 13, // 34: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse - 32, // [32:35] is the sub-list for method output_type - 29, // [29:32] is the sub-list for method input_type + 9, // 31: ax.HarnessService.Connect:output_type -> ax.HarnessResponse + 11, // 32: ax.InteractionsService.CreateInteraction:output_type -> ax.CreateInteractionResponse + 31, // [31:33] is the sub-list for method output_type + 29, // [29:31] is the sub-list for method input_type 29, // [29:29] is the sub-list for extension type_name 29, // [29:29] is the sub-list for extension extendee 0, // [0:29] is the sub-list for field type_name @@ -1814,19 +1725,19 @@ func file_proto_ax_proto_init() { (*HarnessResponse_Outputs)(nil), (*HarnessResponse_End)(nil), } - file_proto_ax_proto_msgTypes[12].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[10].OneofWrappers = []any{ (*Step_Content)(nil), (*Step_Thought)(nil), (*Step_ToolCall)(nil), (*Step_ToolResult)(nil), } - file_proto_ax_proto_msgTypes[15].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[13].OneofWrappers = []any{ (*ToolCallStep_FunctionCall)(nil), } - file_proto_ax_proto_msgTypes[17].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[15].OneofWrappers = []any{ (*ToolResultStep_FunctionResult)(nil), } - file_proto_ax_proto_msgTypes[19].OneofWrappers = []any{ + file_proto_ax_proto_msgTypes[17].OneofWrappers = []any{ (*Value_NullValue)(nil), (*Value_NumberValue)(nil), (*Value_StringValue)(nil), @@ -1841,9 +1752,9 @@ func file_proto_ax_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_ax_proto_rawDesc), len(file_proto_ax_proto_rawDesc)), NumEnums: 2, - NumMessages: 21, + NumMessages: 19, NumExtensions: 0, - NumServices: 3, + NumServices: 2, }, GoTypes: file_proto_ax_proto_goTypes, DependencyIndexes: file_proto_ax_proto_depIdxs, diff --git a/proto/ax.proto b/proto/ax.proto index c516b7c8..f91dbb2e 100644 --- a/proto/ax.proto +++ b/proto/ax.proto @@ -131,18 +131,6 @@ service InteractionsService { // TODO(jbd): CreateInteraction should return an Interaction message // and the outputs should be polled from the Interaction. -message DeleteConversationRequest { - string conversation_id = 1; -} - -message DeleteConversationResponse {} - -service ConversationService { - // Deletes conversational events and all event log resources - // for its children executions. - rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse); -} - message Step { string description = 16; diff --git a/proto/ax_grpc.pb.go b/proto/ax_grpc.pb.go index edfb8fbe..1af304ca 100644 --- a/proto/ax_grpc.pb.go +++ b/proto/ax_grpc.pb.go @@ -244,109 +244,3 @@ var InteractionsService_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "proto/ax.proto", } - -const ( - ConversationService_DeleteConversation_FullMethodName = "/ax.ConversationService/DeleteConversation" -) - -// ConversationServiceClient is the client API for ConversationService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ConversationServiceClient interface { - // Deletes conversational events and all event log resources - // for its children executions. - DeleteConversation(ctx context.Context, in *DeleteConversationRequest, opts ...grpc.CallOption) (*DeleteConversationResponse, error) -} - -type conversationServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewConversationServiceClient(cc grpc.ClientConnInterface) ConversationServiceClient { - return &conversationServiceClient{cc} -} - -func (c *conversationServiceClient) DeleteConversation(ctx context.Context, in *DeleteConversationRequest, opts ...grpc.CallOption) (*DeleteConversationResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(DeleteConversationResponse) - err := c.cc.Invoke(ctx, ConversationService_DeleteConversation_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ConversationServiceServer is the server API for ConversationService service. -// All implementations must embed UnimplementedConversationServiceServer -// for forward compatibility. -type ConversationServiceServer interface { - // Deletes conversational events and all event log resources - // for its children executions. - DeleteConversation(context.Context, *DeleteConversationRequest) (*DeleteConversationResponse, error) - mustEmbedUnimplementedConversationServiceServer() -} - -// UnimplementedConversationServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedConversationServiceServer struct{} - -func (UnimplementedConversationServiceServer) DeleteConversation(context.Context, *DeleteConversationRequest) (*DeleteConversationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteConversation not implemented") -} -func (UnimplementedConversationServiceServer) mustEmbedUnimplementedConversationServiceServer() {} -func (UnimplementedConversationServiceServer) testEmbeddedByValue() {} - -// UnsafeConversationServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ConversationServiceServer will -// result in compilation errors. -type UnsafeConversationServiceServer interface { - mustEmbedUnimplementedConversationServiceServer() -} - -func RegisterConversationServiceServer(s grpc.ServiceRegistrar, srv ConversationServiceServer) { - // If the following call pancis, it indicates UnimplementedConversationServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&ConversationService_ServiceDesc, srv) -} - -func _ConversationService_DeleteConversation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteConversationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ConversationServiceServer).DeleteConversation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ConversationService_DeleteConversation_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ConversationServiceServer).DeleteConversation(ctx, req.(*DeleteConversationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// ConversationService_ServiceDesc is the grpc.ServiceDesc for ConversationService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ConversationService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "ax.ConversationService", - HandlerType: (*ConversationServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "DeleteConversation", - Handler: _ConversationService_DeleteConversation_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "proto/ax.proto", -} diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py index 2bb1f025..2f33ffb2 100644 --- a/python/proto/ax_pb2.py +++ b/python/proto/ax_pb2.py @@ -16,7 +16,7 @@ from proto import content_pb2 as proto_dot_content__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xb4\x01\n\tStepEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x16\n\x0einteraction_id\x18\x02 \x01(\t\x12\x12\n\nharness_id\x18\x03 \x01(\t\x12/\n\x0eharness_config\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x17\n\x05steps\x18\x05 \x03(\x0b\x32\x08.ax.Step\x12\x18\n\x05state\x18\x06 \x01(\x0e\x32\t.ax.State\"?\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x17\n\x05steps\x18\x02 \x03(\x0b\x32\x08.ax.Step\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\")\n\x0eHarnessOutputs\x12\x17\n\x05steps\x18\x01 \x03(\x0b\x32\x08.ax.Step\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"}\n\x16\x43reateInteractionEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x18\n\x06inputs\x18\x02 \x03(\x0b\x32\x08.ax.Step\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0cJ\x04\x08\x03\x10\x04\"6\n\x19\x43reateInteractionResponse\x12\x19\n\x07outputs\x18\x01 \x03(\x0b\x32\x08.ax.Step\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32g\n\x13InteractionsService\x12P\n\x11\x43reateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xb4\x01\n\tStepEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x16\n\x0einteraction_id\x18\x02 \x01(\t\x12\x12\n\nharness_id\x18\x03 \x01(\t\x12/\n\x0eharness_config\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x17\n\x05steps\x18\x05 \x03(\x0b\x32\x08.ax.Step\x12\x18\n\x05state\x18\x06 \x01(\x0e\x32\t.ax.State\"?\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x17\n\x05steps\x18\x02 \x03(\x0b\x32\x08.ax.Step\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\")\n\x0eHarnessOutputs\x12\x17\n\x05steps\x18\x01 \x03(\x0b\x32\x08.ax.Step\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"}\n\x16\x43reateInteractionEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x18\n\x06inputs\x18\x02 \x03(\x0b\x32\x08.ax.Step\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0cJ\x04\x08\x03\x10\x04\"6\n\x19\x43reateInteractionResponse\x12\x19\n\x07outputs\x18\x01 \x03(\x0b\x32\x08.ax.Step\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32g\n\x13InteractionsService\x12P\n\x11\x43reateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01\x42\x1cZ\x1agithub.com/google/ax/protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -24,10 +24,10 @@ if _descriptor._USE_C_DESCRIPTORS == False: _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto' - _globals['_STATE']._serialized_start=2166 - _globals['_STATE']._serialized_end=2274 - _globals['_CANCELREASON']._serialized_start=2277 - _globals['_CANCELREASON']._serialized_end=2417 + _globals['_STATE']._serialized_start=2082 + _globals['_STATE']._serialized_end=2190 + _globals['_CANCELREASON']._serialized_start=2193 + _globals['_CANCELREASON']._serialized_end=2333 _globals['_STEPEVENT']._serialized_start=74 _globals['_STEPEVENT']._serialized_end=254 _globals['_HARNESSSTART']._serialized_start=256 @@ -48,32 +48,26 @@ _globals['_CREATEINTERACTIONEVENT']._serialized_end=916 _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=918 _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=972 - _globals['_DELETECONVERSATIONREQUEST']._serialized_start=974 - _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1026 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1028 - _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1056 - _globals['_STEP']._serialized_start=1059 - _globals['_STEP']._serialized_end=1263 - _globals['_CONTENTSTEP']._serialized_start=1265 - _globals['_CONTENTSTEP']._serialized_end=1340 - _globals['_THOUGHTSTEP']._serialized_start=1342 - _globals['_THOUGHTSTEP']._serialized_end=1422 - _globals['_TOOLCALLSTEP']._serialized_start=1424 - _globals['_TOOLCALLSTEP']._serialized_end=1536 - _globals['_FUNCTIONCALLSTEP']._serialized_start=1538 - _globals['_FUNCTIONCALLSTEP']._serialized_end=1620 - _globals['_TOOLRESULTSTEP']._serialized_start=1622 - _globals['_TOOLRESULTSTEP']._serialized_end=1745 - _globals['_FUNCTIONRESULTSTEP']._serialized_start=1747 - _globals['_FUNCTIONRESULTSTEP']._serialized_end=1862 - _globals['_VALUE']._serialized_start=1865 - _globals['_VALUE']._serialized_end=2124 - _globals['_LISTVALUE']._serialized_start=2126 - _globals['_LISTVALUE']._serialized_end=2164 - _globals['_HARNESSSERVICE']._serialized_start=2419 - _globals['_HARNESSSERVICE']._serialized_end=2491 - _globals['_INTERACTIONSSERVICE']._serialized_start=2493 - _globals['_INTERACTIONSSERVICE']._serialized_end=2596 - _globals['_CONVERSATIONSERVICE']._serialized_start=2598 - _globals['_CONVERSATIONSERVICE']._serialized_end=2704 + _globals['_STEP']._serialized_start=975 + _globals['_STEP']._serialized_end=1179 + _globals['_CONTENTSTEP']._serialized_start=1181 + _globals['_CONTENTSTEP']._serialized_end=1256 + _globals['_THOUGHTSTEP']._serialized_start=1258 + _globals['_THOUGHTSTEP']._serialized_end=1338 + _globals['_TOOLCALLSTEP']._serialized_start=1340 + _globals['_TOOLCALLSTEP']._serialized_end=1452 + _globals['_FUNCTIONCALLSTEP']._serialized_start=1454 + _globals['_FUNCTIONCALLSTEP']._serialized_end=1536 + _globals['_TOOLRESULTSTEP']._serialized_start=1538 + _globals['_TOOLRESULTSTEP']._serialized_end=1661 + _globals['_FUNCTIONRESULTSTEP']._serialized_start=1663 + _globals['_FUNCTIONRESULTSTEP']._serialized_end=1778 + _globals['_VALUE']._serialized_start=1781 + _globals['_VALUE']._serialized_end=2040 + _globals['_LISTVALUE']._serialized_start=2042 + _globals['_LISTVALUE']._serialized_end=2080 + _globals['_HARNESSSERVICE']._serialized_start=2335 + _globals['_HARNESSSERVICE']._serialized_end=2407 + _globals['_INTERACTIONSSERVICE']._serialized_start=2409 + _globals['_INTERACTIONSSERVICE']._serialized_end=2512 # @@protoc_insertion_point(module_scope) diff --git a/python/proto/ax_pb2_grpc.py b/python/proto/ax_pb2_grpc.py index d3e87448..10afe378 100644 --- a/python/proto/ax_pb2_grpc.py +++ b/python/proto/ax_pb2_grpc.py @@ -131,66 +131,3 @@ def CreateInteraction(request, proto_dot_ax__pb2.CreateInteractionResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - -class ConversationServiceStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.DeleteConversation = channel.unary_unary( - '/ax.ConversationService/DeleteConversation', - request_serializer=proto_dot_ax__pb2.DeleteConversationRequest.SerializeToString, - response_deserializer=proto_dot_ax__pb2.DeleteConversationResponse.FromString, - ) - - -class ConversationServiceServicer(object): - """Missing associated documentation comment in .proto file.""" - - def DeleteConversation(self, request, context): - """Deletes conversational events and all event log resources - for its children executions. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_ConversationServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - 'DeleteConversation': grpc.unary_unary_rpc_method_handler( - servicer.DeleteConversation, - request_deserializer=proto_dot_ax__pb2.DeleteConversationRequest.FromString, - response_serializer=proto_dot_ax__pb2.DeleteConversationResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'ax.ConversationService', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class ConversationService(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def DeleteConversation(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/ax.ConversationService/DeleteConversation', - proto_dot_ax__pb2.DeleteConversationRequest.SerializeToString, - proto_dot_ax__pb2.DeleteConversationResponse.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) From 9dcd31361dc9446037da6188f4574d2940c2c527 Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Tue, 11 Aug 2026 22:42:04 -0700 Subject: [PATCH 4/5] CreateInteractionEvent should use agent_id and agent_config Harness should become an internal implementation detail. --- README.md | 8 +- cmd/ax/exec.go | 22 ++--- cmd/ax/harnessclient.go | 25 ++--- internal/cmd/e2e/main.go | 2 +- internal/controller/controller.go | 22 ++--- internal/controller/controller_test.go | 20 ++-- internal/harness/antigravity/antigravity.go | 6 +- .../harness/antigravityinteractions/server.go | 2 +- .../antigravityinteractions/server_test.go | 2 +- internal/harness/harnesstest/harnesstest.go | 4 +- internal/harness/substrate/substrate.go | 6 +- manifests/install-ax.sh | 2 +- proto/ax.pb.go | 71 +++++++------- proto/ax.proto | 14 +-- python/antigravity/harness_server.py | 54 ++++++----- python/antigravity/harness_server_test.py | 49 +++++----- python/proto/ax_pb2.py | 92 +++++++++---------- 17 files changed, 204 insertions(+), 197 deletions(-) diff --git a/README.md b/README.md index 0f8aeb46..16fc62b1 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ Execute a new conversation or resume an existing one. If no conversation ID is p ax \ [--input ] \ [--conversation ] \ - [--harness ] \ + [--agent ] \ [--config ] \ [--config-file ] \ [--server
] \ @@ -179,11 +179,11 @@ ax \ ``` Options: +- `--agent`: Agent ID (optional, default agent is used if not specified) - `--ax-config`: Path to YAML configuration file (only used with a local built-in AX server) (default "ax.yaml") -- `--config`: Per-request harness configuration as an inline JSON string (mutually exclusive with `--config-file`) -- `--config-file`: Path to a JSON file with per-request harness configuration +- `--config`: Per-request agent configuration as an inline JSON string (mutually exclusive with `--config-file`) +- `--config-file`: Path to a JSON file with per-request agent configuration - `--conversation`: Conversation ID (optional, generates UUID if not provided) -- `--harness`: Harness ID (optional, default harness is used if not specified) - `--input`: Input message to send (optional) - `--resume`: Resume a conversation without inputs - `--server`: gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server) diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go index 104c905c..d7e71acd 100644 --- a/cmd/ax/exec.go +++ b/cmd/ax/exec.go @@ -35,7 +35,7 @@ import ( var ( execConversationID string - execHarnessID string + execAgentID string execConfigFile string execConfig string execInput string @@ -55,9 +55,9 @@ If no conversation ID is provided, a new UUID will be generated.`, func registerExecFlags(cmd *cobra.Command) { cmd.Flags().StringVar(&execConversationID, "conversation", "", "Conversation ID (optional, generates UUID if not provided)") - cmd.Flags().StringVar(&execHarnessID, "harness", "", "Harness ID (optional, default harness is used if not specified)") - cmd.Flags().StringVar(&execConfigFile, "config-file", "", "Path to a JSON file with per-request harness configuration") - cmd.Flags().StringVar(&execConfig, "config", "", "Per-request harness configuration as an inline JSON string (mutually exclusive with --config-file)") + cmd.Flags().StringVar(&execAgentID, "agent", "", "Agent ID (optional, default agent is used if not specified)") + cmd.Flags().StringVar(&execConfigFile, "config-file", "", "Path to a JSON file with per-request agent configuration") + cmd.Flags().StringVar(&execConfig, "config", "", "Per-request agent configuration as an inline JSON string (mutually exclusive with --config-file)") cmd.Flags().StringVar(&execInput, "input", "", "Input message to send (optional)") cmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)") cmd.Flags().StringVar(&execAXConfigFile, "ax-config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)") @@ -136,7 +136,7 @@ func runExec(cmd *cobra.Command, args []string) error { harnessConfig = []byte(execConfig) } - return execLoop(ctx, execConversationID, execHarnessID, harnessConfig, execInput) + return execLoop(ctx, execConversationID, execAgentID, harnessConfig, execInput) } func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []byte, input string) error { @@ -180,9 +180,9 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] conf, err := runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{ ConversationId: id, - HarnessId: harnessID, - HarnessConfig: harnessConfig, - Inputs: inputs, + AgentId: harnessID, + AgentConfig: harnessConfig, + Inputs: inputs, }) interruptHandler.ClearActiveCancel() @@ -257,9 +257,9 @@ func execLoop(ctx context.Context, id string, harnessID string, harnessConfig [] conf, err = runAutoExec(reqCtx, d, &proto.CreateInteractionEvent{ ConversationId: id, - HarnessId: harnessID, - HarnessConfig: harnessConfig, - Inputs: decision, + AgentId: harnessID, + AgentConfig: harnessConfig, + Inputs: decision, }) interruptHandler.ClearActiveCancel() diff --git a/cmd/ax/harnessclient.go b/cmd/ax/harnessclient.go index 4bee89bb..26b1d69e 100644 --- a/cmd/ax/harnessclient.go +++ b/cmd/ax/harnessclient.go @@ -19,12 +19,11 @@ package main import ( - "bufio" "context" "fmt" "io" "log" - "os" + "strings" "github.com/google/ax/proto" "github.com/google/uuid" @@ -35,7 +34,7 @@ import ( var ( harnessServerAddr string - harnessClientID string + agentClientID string ) var harnessClientCmd = &cobra.Command{ @@ -47,7 +46,7 @@ var harnessClientCmd = &cobra.Command{ func init() { harnessClientCmd.Flags().StringVar(&harnessServerAddr, "server", "localhost:50053", "The server address for the gRPC HarnessService.") - harnessClientCmd.Flags().StringVar(&harnessClientID, "harness", "testharness", "The harness id to send on the request envelope.") + harnessClientCmd.Flags().StringVar(&agentClientID, "agent", "testharness", "The agent id to send on the request envelope.") rootCmd.AddCommand(harnessClientCmd) } @@ -62,21 +61,23 @@ func runHarnessClient(cmd *cobra.Command, args []string) error { defer conn.Close() client := proto.NewHarnessServiceClient(conn) - - fmt.Print("Client > ") - scanner := bufio.NewScanner(os.Stdin) - scanner.Scan() - input := scanner.Text() - stream, err := client.Connect(ctx) if err != nil { - return fmt.Errorf("failed to open connection stream: %v", err) + return fmt.Errorf("failed to call Connect: %v", err) + } + + // Wait for user input from stdin if not specified, but for simple execution, send a single frame. + var input string + if len(args) > 0 { + input = strings.Join(args, " ") + } else { + input = "Hello from harness client!" } // A single HarnessRequest{start} initiates the turn. start := &proto.HarnessRequest{ ConversationId: uuid.NewString(), - HarnessId: harnessClientID, + AgentId: agentClientID, Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ Steps: []*proto.Step{ diff --git a/internal/cmd/e2e/main.go b/internal/cmd/e2e/main.go index a922896f..6f8c42a2 100644 --- a/internal/cmd/e2e/main.go +++ b/internal/cmd/e2e/main.go @@ -132,7 +132,7 @@ func runDemo(ctx context.Context, harnessID string, setupRegistry func(reg *cont err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: "e2e-conv", Inputs: inputs, - HarnessId: harnessID, + AgentId: harnessID, }, handler) if err != nil { diff --git a/internal/controller/controller.go b/internal/controller/controller.go index b3354c8d..ff16f61a 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -73,7 +73,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent // TODO(jbd): Enable bringing a remote harness that implements HarnessService. // TODO(anj): We need to consolidate agents and harness registration. // Adding harness registration support temporarily. - l := newLogger(d.eventLog, req.ConversationId, req.HarnessId) + l := newLogger(d.eventLog, req.ConversationId, req.AgentId) state, storedHarnessID, err := l.ResumptionState(ctx) if err != nil { return fmt.Errorf("failed to check resumption state: %w", err) @@ -81,10 +81,10 @@ func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent // On resume, use the conversation's recorded harness. Using a different harness // for the same conversation is not allowed. - if req.HarnessId != "" && storedHarnessID != "" && req.HarnessId != storedHarnessID { - return fmt.Errorf("resumption not allowed: harness ID changed from %s to %s", storedHarnessID, req.HarnessId) + if req.AgentId != "" && storedHarnessID != "" && req.AgentId != storedHarnessID { + return fmt.Errorf("resumption not allowed: harness ID changed from %s to %s", storedHarnessID, req.AgentId) } - harnessID := req.HarnessId + harnessID := req.AgentId // Use the conversations's stored harness if no harness is specified. if harnessID == "" { harnessID = storedHarnessID @@ -109,7 +109,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent // If the state is pending, first try to resume the // pending execution. If the state is COMPLETED or FAILED, start // a new execution. - exec, err := h.Start(ctx, req.ConversationId, req.HarnessConfig) + exec, err := h.Start(ctx, req.ConversationId, req.AgentConfig) if err != nil { return fmt.Errorf("failed to start harness session: %w", err) } @@ -125,7 +125,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent return nil } - exec, err := h.Start(ctx, req.ConversationId, req.HarnessConfig) + exec, err := h.Start(ctx, req.ConversationId, req.AgentConfig) if err != nil { return fmt.Errorf("failed to start harness session: %w", err) } @@ -135,7 +135,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.CreateInteractionEvent return fmt.Errorf("failed to queue inputs: %w", err) } // Log inputs before running harness - if _, err := l.LogInputs(ctx, req.Inputs, req.HarnessConfig); err != nil { + if _, err := l.LogInputs(ctx, req.Inputs, req.AgentConfig); err != nil { return fmt.Errorf("failed to log inputs: %w", err) } if err := exec.Run(ctx, hhandler); err != nil { @@ -230,8 +230,8 @@ func (l *logger) ResumptionState(ctx context.Context) (proto.State, string, erro var state proto.State var harnessID string for _, ev := range events { - if harnessID == "" && ev.HarnessId != "" { - harnessID = ev.HarnessId + if harnessID == "" && ev.AgentId != "" { + harnessID = ev.AgentId } if ev.State != proto.State_STATE_UNSPECIFIED { state = ev.State @@ -256,8 +256,8 @@ func (l *logger) LogInputs(ctx context.Context, steps []*proto.Step, harnessConf ev := &proto.StepEvent{ ConversationId: l.conversationID, InteractionId: l.interactionID, - HarnessId: l.harnessID, - HarnessConfig: cfg, + AgentId: l.harnessID, + AgentConfig: cfg, Steps: steps, State: proto.State_STATE_PENDING, } diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.go index 020206f4..2937a6f2 100644 --- a/internal/controller/controller_test.go +++ b/internal/controller/controller_test.go @@ -196,7 +196,7 @@ func TestController2_ExecWithAgentID(t *testing.T) { err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "my-agent", + AgentId: "my-agent", Inputs: []*proto.Step{harnesstest.UserStep("Trigger prompt")}, }, handler) if err != nil { @@ -237,7 +237,7 @@ func TestController2_ExecHarnessNotFound(t *testing.T) { err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "antigravity", + AgentId: "antigravity", Inputs: []*proto.Step{harnesstest.UserStep("Trigger prompt")}, }, handler) if err == nil { @@ -323,7 +323,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "test-agent", + AgentId: "test-agent", Inputs: []*proto.Step{harnesstest.UserStep("Hello")}, }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { @@ -350,7 +350,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { // Seed the event log with a pending event _, err := log.Append(ctx, &proto.StepEvent{ ConversationId: cid, - HarnessId: "test-agent", + AgentId: "test-agent", State: proto.State_STATE_PENDING, Steps: []*proto.Step{harnesstest.UserStep("Initial")}, }) @@ -387,7 +387,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "test-agent", + AgentId: "test-agent", Inputs: nil, // NO new inputs }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { @@ -414,7 +414,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { // Seed the event log with a pending event _, err := log.Append(ctx, &proto.StepEvent{ ConversationId: cid, - HarnessId: "test-agent", + AgentId: "test-agent", State: proto.State_STATE_PENDING, Steps: []*proto.Step{harnesstest.UserStep("Initial")}, }) @@ -452,7 +452,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) { err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "test-agent", + AgentId: "test-agent", Inputs: []*proto.Step{harnesstest.UserStep("New input")}, }, func(resp *proto.CreateInteractionResponse) error { return nil }) if err != nil { @@ -523,7 +523,7 @@ func TestExec_ResumeEmptyHarnessUsesStored(t *testing.T) { // Turn 1: explicitly run the NON-default harness. if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "harness-b", + AgentId: "harness-b", Inputs: []*proto.Step{harnesstest.UserStep("hi")}, }, noop); err != nil { t.Fatalf("turn 1: %v", err) @@ -575,14 +575,14 @@ func TestExec_ResumeExplicitDifferentHarnessRejected(t *testing.T) { if err := c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "harness-a", + AgentId: "harness-a", Inputs: []*proto.Step{harnesstest.UserStep("hi")}, }, noop); err != nil { t.Fatalf("turn 1: %v", err) } err = c.Exec(ctx, &proto.CreateInteractionEvent{ ConversationId: cid, - HarnessId: "harness-b", + AgentId: "harness-b", Inputs: []*proto.Step{harnesstest.UserStep("more")}, }, noop) if err == nil || !strings.Contains(err.Error(), "harness ID changed from harness-a to harness-b") { diff --git a/internal/harness/antigravity/antigravity.go b/internal/harness/antigravity/antigravity.go index b817ad88..9d65561d 100644 --- a/internal/harness/antigravity/antigravity.go +++ b/internal/harness/antigravity/antigravity.go @@ -193,11 +193,11 @@ func (e *antigravityExecution) Run(ctx context.Context, handler harness.Handler) // 3. Build standard HarnessRequest. start := &proto.HarnessRequest{ ConversationId: e.conversationID, - HarnessId: "antigravity", + AgentId: "antigravity", Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ - HarnessConfig: e.harnessConfig, - Steps: inputs, + AgentConfig: e.harnessConfig, + Steps: inputs, }, }, } diff --git a/internal/harness/antigravityinteractions/server.go b/internal/harness/antigravityinteractions/server.go index 6e864824..c705afe3 100644 --- a/internal/harness/antigravityinteractions/server.go +++ b/internal/harness/antigravityinteractions/server.go @@ -128,7 +128,7 @@ func (s *server) Connect(stream proto.HarnessService_ConnectServer) error { } convID := req.GetConversationId() - exec, err := s.h.Start(ctx, convID, start.GetHarnessConfig()) + exec, err := s.h.Start(ctx, convID, start.GetAgentConfig()) if err != nil { return sendEnd(stream, convID, proto.State_STATE_FAILED, err) } diff --git a/internal/harness/antigravityinteractions/server_test.go b/internal/harness/antigravityinteractions/server_test.go index 679ac037..5e33b182 100644 --- a/internal/harness/antigravityinteractions/server_test.go +++ b/internal/harness/antigravityinteractions/server_test.go @@ -66,7 +66,7 @@ func TestConnect_StartToEnd(t *testing.T) { } if err := stream.Send(&proto.HarnessRequest{ ConversationId: "conv-1", - HarnessId: "antigravity-interactions", + AgentId: "antigravity-interactions", Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{Steps: []*proto.Step{harnesstest.UserStep("hello")}}, }, diff --git a/internal/harness/harnesstest/harnesstest.go b/internal/harness/harnesstest/harnesstest.go index 94ae0bd2..f748381c 100644 --- a/internal/harness/harnesstest/harnesstest.go +++ b/internal/harness/harnesstest/harnesstest.go @@ -139,8 +139,8 @@ func (s *MockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e } s.mu.Lock() s.gotConvID = req.GetConversationId() - s.gotHarnessID = req.GetHarnessId() - s.gotHarnessConfig = req.GetStart().GetHarnessConfig() + s.gotHarnessID = req.GetAgentId() + s.gotHarnessConfig = req.GetStart().GetAgentConfig() s.gotInputs = inputs s.mu.Unlock() diff --git a/internal/harness/substrate/substrate.go b/internal/harness/substrate/substrate.go index 5f4d39fc..ff219ed8 100644 --- a/internal/harness/substrate/substrate.go +++ b/internal/harness/substrate/substrate.go @@ -208,11 +208,11 @@ func (e *substrateExecution) Run(ctx context.Context, handler harness.Handler) e // Send a HarnessRequest to initiate the turn. start := &proto.HarnessRequest{ ConversationId: e.conversationID, - HarnessId: e.harness.harnessID, + AgentId: e.harness.harnessID, Type: &proto.HarnessRequest_Start{ Start: &proto.HarnessStart{ - HarnessConfig: e.harnessConfig, - Steps: inputs, + AgentConfig: e.harnessConfig, + Steps: inputs, }, }, } diff --git a/manifests/install-ax.sh b/manifests/install-ax.sh index 9c5c02a2..82ebde87 100755 --- a/manifests/install-ax.sh +++ b/manifests/install-ax.sh @@ -314,7 +314,7 @@ deploy_ax_server() { echo "Forward the AX server by running the following command (optional)" echo "kubectl port-forward -n ax rs/ax-server 8494:8494" echo "" - echo "Then, run: ax --server localhost:8494 [--harness antigravity|antigravity-interactions]" + echo "Then, run: ax --server localhost:8494 [--agent antigravity|antigravity-interactions]" } # delete_ax_server removes the AX server and harness resources but preserves the diff --git a/proto/ax.pb.go b/proto/ax.pb.go index a05742c1..9603c37e 100644 --- a/proto/ax.pb.go +++ b/proto/ax.pb.go @@ -152,8 +152,8 @@ type StepEvent struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` InteractionId string `protobuf:"bytes,2,opt,name=interaction_id,json=interactionId,proto3" json:"interaction_id,omitempty"` - HarnessId string `protobuf:"bytes,3,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` - HarnessConfig *structpb.Struct `protobuf:"bytes,4,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` + AgentId string `protobuf:"bytes,3,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` + AgentConfig *structpb.Struct `protobuf:"bytes,4,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` Steps []*Step `protobuf:"bytes,5,rep,name=steps,proto3" json:"steps,omitempty"` State State `protobuf:"varint,6,opt,name=state,proto3,enum=ax.State" json:"state,omitempty"` unknownFields protoimpl.UnknownFields @@ -204,16 +204,16 @@ func (x *StepEvent) GetInteractionId() string { return "" } -func (x *StepEvent) GetHarnessId() string { +func (x *StepEvent) GetAgentId() string { if x != nil { - return x.HarnessId + return x.AgentId } return "" } -func (x *StepEvent) GetHarnessConfig() *structpb.Struct { +func (x *StepEvent) GetAgentConfig() *structpb.Struct { if x != nil { - return x.HarnessConfig + return x.AgentConfig } return nil } @@ -234,8 +234,8 @@ func (x *StepEvent) GetState() State { type HarnessStart struct { state protoimpl.MessageState `protogen:"open.v1"` - // Per-execution harness configuration. - HarnessConfig []byte `protobuf:"bytes,1,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` + // Per-execution agent configuration. + AgentConfig []byte `protobuf:"bytes,1,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` Steps []*Step `protobuf:"bytes,2,rep,name=steps,proto3" json:"steps,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -271,9 +271,9 @@ func (*HarnessStart) Descriptor() ([]byte, []int) { return file_proto_ax_proto_rawDescGZIP(), []int{1} } -func (x *HarnessStart) GetHarnessConfig() []byte { +func (x *HarnessStart) GetAgentConfig() []byte { if x != nil { - return x.HarnessConfig + return x.AgentConfig } return nil } @@ -333,7 +333,7 @@ func (x *HarnessCancel) GetReason() CancelReason { type HarnessRequest struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` - HarnessId string `protobuf:"bytes,2,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` + AgentId string `protobuf:"bytes,2,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` // Types that are valid to be assigned to Type: // // *HarnessRequest_Start @@ -380,9 +380,9 @@ func (x *HarnessRequest) GetConversationId() string { return "" } -func (x *HarnessRequest) GetHarnessId() string { +func (x *HarnessRequest) GetAgentId() string { if x != nil { - return x.HarnessId + return x.AgentId } return "" } @@ -675,8 +675,8 @@ type CreateInteractionEvent struct { state protoimpl.MessageState `protogen:"open.v1"` ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` // Unique conversation identifier Inputs []*Step `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs - HarnessId string `protobuf:"bytes,4,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` // Harness ID, empty selects the default harness - HarnessConfig []byte `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` // Per-request harness configuration (opaque JSON), if any + AgentId string `protobuf:"bytes,4,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` // Agent ID, empty selects the default agent + AgentConfig []byte `protobuf:"bytes,5,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` // Per-request agent configuration (opaque JSON), if any unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -725,16 +725,16 @@ func (x *CreateInteractionEvent) GetInputs() []*Step { return nil } -func (x *CreateInteractionEvent) GetHarnessId() string { +func (x *CreateInteractionEvent) GetAgentId() string { if x != nil { - return x.HarnessId + return x.AgentId } return "" } -func (x *CreateInteractionEvent) GetHarnessConfig() []byte { +func (x *CreateInteractionEvent) GetAgentConfig() []byte { if x != nil { - return x.HarnessConfig + return x.AgentConfig } return nil } @@ -1520,24 +1520,22 @@ var File_proto_ax_proto protoreflect.FileDescriptor const file_proto_ax_proto_rawDesc = "" + "\n" + - "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xfb\x01\n" + + "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xf3\x01\n" + "\tStepEvent\x12'\n" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12%\n" + - "\x0einteraction_id\x18\x02 \x01(\tR\rinteractionId\x12\x1d\n" + - "\n" + - "harness_id\x18\x03 \x01(\tR\tharnessId\x12>\n" + - "\x0eharness_config\x18\x04 \x01(\v2\x17.google.protobuf.StructR\rharnessConfig\x12\x1e\n" + + "\x0einteraction_id\x18\x02 \x01(\tR\rinteractionId\x12\x19\n" + + "\bagent_id\x18\x03 \x01(\tR\aagentId\x12:\n" + + "\fagent_config\x18\x04 \x01(\v2\x17.google.protobuf.StructR\vagentConfig\x12\x1e\n" + "\x05steps\x18\x05 \x03(\v2\b.ax.StepR\x05steps\x12\x1f\n" + - "\x05state\x18\x06 \x01(\x0e2\t.ax.StateR\x05state\"U\n" + - "\fHarnessStart\x12%\n" + - "\x0eharness_config\x18\x01 \x01(\fR\rharnessConfig\x12\x1e\n" + + "\x05state\x18\x06 \x01(\x0e2\t.ax.StateR\x05state\"Q\n" + + "\fHarnessStart\x12!\n" + + "\fagent_config\x18\x01 \x01(\fR\vagentConfig\x12\x1e\n" + "\x05steps\x18\x02 \x03(\v2\b.ax.StepR\x05steps\"9\n" + "\rHarnessCancel\x12(\n" + - "\x06reason\x18\x01 \x01(\x0e2\x10.ax.CancelReasonR\x06reason\"\xb7\x01\n" + + "\x06reason\x18\x01 \x01(\x0e2\x10.ax.CancelReasonR\x06reason\"\xb3\x01\n" + "\x0eHarnessRequest\x12'\n" + - "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x1d\n" + - "\n" + - "harness_id\x18\x02 \x01(\tR\tharnessId\x12(\n" + + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x19\n" + + "\bagent_id\x18\x02 \x01(\tR\aagentId\x12(\n" + "\x05start\x18\x03 \x01(\v2\x10.ax.HarnessStartH\x00R\x05start\x12+\n" + "\x06cancel\x18\x04 \x01(\v2\x11.ax.HarnessCancelH\x00R\x06cancelB\x06\n" + "\x04type\"0\n" + @@ -1554,13 +1552,12 @@ const file_proto_ax_proto_rawDesc = "" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12.\n" + "\aoutputs\x18\x02 \x01(\v2\x12.ax.HarnessOutputsH\x00R\aoutputs\x12\"\n" + "\x03end\x18\x03 \x01(\v2\x0e.ax.HarnessEndH\x00R\x03endB\x06\n" + - "\x04type\"\xaf\x01\n" + + "\x04type\"\xa7\x01\n" + "\x16CreateInteractionEvent\x12'\n" + "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12 \n" + - "\x06inputs\x18\x02 \x03(\v2\b.ax.StepR\x06inputs\x12\x1d\n" + - "\n" + - "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" + - "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfigJ\x04\b\x03\x10\x04\"?\n" + + "\x06inputs\x18\x02 \x03(\v2\b.ax.StepR\x06inputs\x12\x19\n" + + "\bagent_id\x18\x04 \x01(\tR\aagentId\x12!\n" + + "\fagent_config\x18\x05 \x01(\fR\vagentConfigJ\x04\b\x03\x10\x04\"?\n" + "\x19CreateInteractionResponse\x12\"\n" + "\aoutputs\x18\x01 \x03(\v2\b.ax.StepR\aoutputs\"\x88\x02\n" + "\x04Step\x12 \n" + @@ -1671,7 +1668,7 @@ var file_proto_ax_proto_goTypes = []any{ (structpb.NullValue)(0), // 23: google.protobuf.NullValue } var file_proto_ax_proto_depIdxs = []int32{ - 21, // 0: ax.StepEvent.harness_config:type_name -> google.protobuf.Struct + 21, // 0: ax.StepEvent.agent_config:type_name -> google.protobuf.Struct 12, // 1: ax.StepEvent.steps:type_name -> ax.Step 0, // 2: ax.StepEvent.state:type_name -> ax.State 12, // 3: ax.HarnessStart.steps:type_name -> ax.Step diff --git a/proto/ax.proto b/proto/ax.proto index f91dbb2e..7ba2fec6 100644 --- a/proto/ax.proto +++ b/proto/ax.proto @@ -30,15 +30,15 @@ option go_package = "github.com/google/ax/proto"; message StepEvent { string conversation_id = 1; string interaction_id = 2; - string harness_id = 3; - google.protobuf.Struct harness_config = 4; + string agent_id = 3; + google.protobuf.Struct agent_config = 4; repeated Step steps = 5; State state = 6; } message HarnessStart { - // Per-execution harness configuration. - bytes harness_config = 1; + // Per-execution agent configuration. + bytes agent_config = 1; repeated Step steps = 2; } @@ -49,7 +49,7 @@ message HarnessCancel { message HarnessRequest { string conversation_id = 1; - string harness_id = 2; + string agent_id = 2; oneof type { HarnessStart start = 3; HarnessCancel cancel = 4; @@ -113,8 +113,8 @@ message CreateInteractionEvent { repeated Step inputs = 2; // New inputs reserved 3; - string harness_id = 4; // Harness ID, empty selects the default harness - bytes harness_config = 5; // Per-request harness configuration (opaque JSON), if any + string agent_id = 4; // Agent ID, empty selects the default agent + bytes agent_config = 5; // Per-request agent configuration (opaque JSON), if any } // CreateInteractionResponse contains the result of an interaction. diff --git a/python/antigravity/harness_server.py b/python/antigravity/harness_server.py index 6168fd68..babb8d7b 100644 --- a/python/antigravity/harness_server.py +++ b/python/antigravity/harness_server.py @@ -36,17 +36,17 @@ from google.antigravity import Agent, AgentConfig, LocalAgentConfig from google.antigravity.types import Text, Thought, ToolCall -# Fields that come from outside harness_config and must not be set through it: +# Fields that come from outside agent_config and must not be set through it: # - conversation_id: taken from the runtime request (request.conversation_id). # - save_dir: derived at the server level from the configured state_dir. # TODO: add validation for fields that are unsafe to set per execution # (e.g. credentials, deployment routing) or that may only be set at # conversation creation. -_NON_HARNESS_CONFIG_FIELDS = frozenset({"conversation_id", "save_dir"}) +_NON_AGENT_CONFIG_FIELDS = frozenset({"conversation_id", "save_dir"}) -class HarnessConfigError(ValueError): - """Raised when request harness_config is not a valid overlay.""" +class AgentConfigError(ValueError): + """Raised when request agent_config is not a valid overlay.""" class ConversationIdError(ValueError): @@ -87,11 +87,19 @@ def _build_default_config() -> LocalAgentConfig: Credentials/backend come from the standard GenAI env vars, which the AGY SDK reads natively as of google-antigravity 0.1.7. - TODO(#194): per-request `harness_config` will override fields of this + TODO(#194): per-request `agent_config` will override fields of this default on a per-conversation basis. Until then, every conversation uses this config. """ - return LocalAgentConfig(system_instructions="You are a helpful agent.") + vertex = _env_use_vertex() or None + project = os.environ.get("GOOGLE_CLOUD_PROJECT") if vertex else None + location = os.environ.get("GOOGLE_CLOUD_LOCATION") if vertex else None + return LocalAgentConfig( + system_instructions="You are a helpful agent.", + vertex=vertex, + project=project, + location=location, + ) def _has_credentials(config: AgentConfig | None) -> bool: @@ -132,22 +140,22 @@ def _existing_sdk_conv_id(save_dir: str) -> str | None: def _reject_disallowed_fields(overrides: dict[str, object]) -> None: - """Best-effort validation of a request harness_config overlay's keys. + """Best-effort validation of a request agent_config overlay's keys. - Rejects fields managed outside harness_config and unknown top-level + Rejects fields managed outside agent_config and unknown top-level fields (typos that LocalAgentConfig's extra="ignore" would otherwise silently drop). Top-level only: nested-key and value/type validation is delegated to the SDK's own LocalAgentConfig validation when the config is constructed. """ - managed = sorted(set(overrides) & _NON_HARNESS_CONFIG_FIELDS) + managed = sorted(set(overrides) & _NON_AGENT_CONFIG_FIELDS) if managed: - raise HarnessConfigError( - f"field(s) managed outside harness_config cannot be set: {', '.join(managed)}" + raise AgentConfigError( + f"field(s) managed outside agent_config cannot be set: {', '.join(managed)}" ) unknown = sorted(set(overrides) - set(LocalAgentConfig.model_fields)) if unknown: - raise HarnessConfigError(f"unknown config field(s): {', '.join(unknown)}") + raise AgentConfigError(f"unknown config field(s): {', '.join(unknown)}") class AntigravityHarnessServiceServicer(ax_pb2_grpc.HarnessServiceServicer): @@ -158,23 +166,23 @@ def __init__(self, default_config: AgentConfig, state_dir: pathlib.Path): self._state_dir = state_dir def _build_config_for( - self, conversation_id: str, harness_config: bytes = b"" + self, conversation_id: str, agent_config: bytes = b"" ) -> LocalAgentConfig: - # Overlay the request's harness_config (JSON-in-bytes) onto the server + # Overlay the request's agent_config (JSON-in-bytes) onto the server # default. The parsed dict is a local intermediate only; this method's # boundary type is the validated LocalAgentConfig. - if harness_config: + if agent_config: try: - overrides = json.loads(harness_config.decode("utf-8")) + overrides = json.loads(agent_config.decode("utf-8")) except (UnicodeDecodeError, json.JSONDecodeError) as exc: - raise HarnessConfigError(f"expected UTF-8 JSON: {exc}") from exc + raise AgentConfigError(f"expected UTF-8 JSON: {exc}") from exc if not isinstance(overrides, dict): - raise HarnessConfigError("top-level JSON value must be an object") + raise AgentConfigError("top-level JSON value must be an object") _reject_disallowed_fields(overrides) else: overrides = {} - # Persistence values managed outside harness_config go on last so a + # Persistence values managed outside agent_config go on last so a # request can never redirect trajectory storage. Per-AX-conv save_dir # under the configured state_dir base; resume by the SDK's own conv_id # if a trajectory already exists there. SDK auto-creates the directory. @@ -192,7 +200,7 @@ def _build_config_for( try: return LocalAgentConfig(**values) except (TypeError, ValueError) as exc: - raise HarnessConfigError(str(exc)) from exc + raise AgentConfigError(str(exc)) from exc async def Connect(self, request_iterator, context): # Each HarnessRequest{start} drives one stateless turn; the stream stays @@ -284,7 +292,7 @@ async def _run_turn(self, request): return try: per_conv_config = self._build_config_for( - request.conversation_id, request.start.harness_config + request.conversation_id, request.start.agent_config ) print( f"[gRPC] Starting Agent for conv_id={request.conversation_id}, save_dir={per_conv_config.save_dir}" @@ -394,14 +402,14 @@ def flush_thought(): ) print("[gRPC] Turn completed successfully.") - except HarnessConfigError as exc: + except AgentConfigError as exc: yield ax_pb2.HarnessResponse( conversation_id=request.conversation_id, end=ax_pb2.HarnessEnd( state=ax_pb2.STATE_FAILED, error=ax_pb2.Error( code=3, # INVALID_ARGUMENT - description=f"Invalid harness_config: {exc}", + description=f"Invalid agent_config: {exc}", ), ), ) diff --git a/python/antigravity/harness_server_test.py b/python/antigravity/harness_server_test.py index e043ad89..0bafc8dc 100644 --- a/python/antigravity/harness_server_test.py +++ b/python/antigravity/harness_server_test.py @@ -19,7 +19,7 @@ from python.proto import ax_pb2, ax_pb2_grpc, content_pb2 from python.antigravity.harness_server import AntigravityHarnessServiceServicer from python.antigravity.harness_server import ConversationIdError -from python.antigravity.harness_server import HarnessConfigError +from python.antigravity.harness_server import AgentConfigError from python.antigravity.harness_server import _validate_conversation_id from google.antigravity import LocalAgentConfig @@ -79,7 +79,7 @@ async def __aexit__(self, exc_type, exc, tb): ) req = ax_pb2.HarnessRequest( conversation_id="conv-test", - harness_id="antigravity", + agent_id="antigravity", start=start_payload ) @@ -144,7 +144,7 @@ async def __aexit__(self, exc_type, exc, tb): async def fire(conv_id): req = ax_pb2.HarnessRequest( conversation_id=conv_id, - harness_id="antigravity", + agent_id="antigravity", start=ax_pb2.HarnessStart( steps=[ ax_pb2.Step( @@ -302,7 +302,7 @@ async def __aexit__(self, exc_type, exc, tb): ) req = ax_pb2.HarnessRequest( conversation_id="conv-test-prog", - harness_id="antigravity", + agent_id="antigravity", start=start_payload ) @@ -392,7 +392,7 @@ async def __aexit__(self, exc_type, exc, tb): ) req = ax_pb2.HarnessRequest( conversation_id="conv-test-buffer", - harness_id="antigravity", + agent_id="antigravity", start=start_payload ) @@ -444,7 +444,6 @@ def test_build_default_config_routes_to_vertex_via_env(monkeypatch): monkeypatch.setenv("GOOGLE_CLOUD_PROJECT", "env-project") monkeypatch.setenv("GOOGLE_CLOUD_LOCATION", "us-east1") cfg = _build_default_config() - assert cfg.vertex is True endpoint = cfg._build_shorthand_endpoint() assert isinstance(endpoint, types.VertexEndpoint) assert endpoint.project == "env-project" @@ -475,7 +474,7 @@ async def _run(): stub = ax_pb2_grpc.HarnessServiceStub(channel) req = ax_pb2.HarnessRequest( conversation_id="conv-guard", - harness_id="antigravity", + agent_id="antigravity", start=ax_pb2.HarnessStart(steps=[ ax_pb2.Step(content=ax_pb2.ContentStep( role="user", @@ -497,7 +496,7 @@ async def request_iter(): asyncio.run(_run()) -def test_harness_config_empty_is_noop(mock_config, tmp_path): +def test_agent_config_empty_is_noop(mock_config, tmp_path): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) assert servicer._build_config_for("conv-1", b"").system_instructions == ( mock_config.system_instructions @@ -507,7 +506,7 @@ def test_harness_config_empty_is_noop(mock_config, tmp_path): ) -def test_harness_config_overlay_applies(mock_config, tmp_path): +def test_agent_config_overlay_applies(mock_config, tmp_path): # Fields flow through to the SDK, which validates values. servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) raw = json.dumps({"system_instructions": "Answer in one sentence."}).encode() @@ -517,7 +516,7 @@ def test_harness_config_overlay_applies(mock_config, tmp_path): assert config.system_instructions == "Answer in one sentence." -def test_harness_config_overlay_keeps_ax_managed_save_dir(mock_config, tmp_path): +def test_agent_config_overlay_keeps_ax_managed_save_dir(mock_config, tmp_path): # A valid overlay must not disturb the AX-injected save_dir. servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) raw = json.dumps({"system_instructions": "x"}).encode() @@ -528,7 +527,7 @@ def test_harness_config_overlay_keeps_ax_managed_save_dir(mock_config, tmp_path) assert config.save_dir == str(tmp_path / "conv-1") -def test_harness_config_overlay_does_not_mutate_default(mock_config, tmp_path): +def test_agent_config_overlay_does_not_mutate_default(mock_config, tmp_path): # Reconstruction must not mutate the shared server default. servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) servicer._build_config_for( @@ -537,7 +536,7 @@ def test_harness_config_overlay_does_not_mutate_default(mock_config, tmp_path): assert mock_config.system_instructions == "Test instructions" -def test_harness_config_overlay_applies_multiple_fields(mock_config, tmp_path): +def test_agent_config_overlay_applies_multiple_fields(mock_config, tmp_path): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) raw = json.dumps({ "system_instructions": "x", @@ -554,8 +553,8 @@ def test_harness_config_overlay_applies_multiple_fields(mock_config, tmp_path): (b"{", "expected UTF-8 JSON"), (b"\xff", "expected UTF-8 JSON"), (json.dumps([]).encode(), "top-level JSON value must be an object"), - (json.dumps({"save_dir": "/tmp/other"}).encode(), "managed outside harness_config"), - (json.dumps({"conversation_id": "other"}).encode(), "managed outside harness_config"), + (json.dumps({"save_dir": "/tmp/other"}).encode(), "managed outside agent_config"), + (json.dumps({"conversation_id": "other"}).encode(), "managed outside agent_config"), ( json.dumps({"capabilities": {"enabled_tools": ["not-a-tool"]}}).encode(), "validation error", @@ -563,20 +562,21 @@ def test_harness_config_overlay_applies_multiple_fields(mock_config, tmp_path): (json.dumps({"system_instruction": "typo"}).encode(), "unknown config field"), (json.dumps({"model": "m", "frobnicate": True}).encode(), "unknown config field"), ]) -def test_harness_config_rejects(mock_config, tmp_path, raw_config, error): +def test_agent_config_rejects(mock_config, tmp_path, raw_config, error): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) - with pytest.raises(HarnessConfigError, match=error): + from python.antigravity.harness_server import AgentConfigError + with pytest.raises(AgentConfigError, match=error): servicer._build_config_for("conv-1", raw_config) -def test_run_turn_invalid_harness_config_maps_to_invalid_argument(mock_config, tmp_path): +def test_run_turn_invalid_agent_config_maps_to_invalid_argument(mock_config, tmp_path): async def _run(): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) req = ax_pb2.HarnessRequest( conversation_id="conv-1", - harness_id="antigravity", + agent_id="antigravity", start=ax_pb2.HarnessStart( - harness_config=b"{", + agent_config=b"{", steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", content=[content_pb2.Content(text=content_pb2.TextContent(text="hi"))], @@ -587,18 +587,19 @@ async def _run(): assert len(responses) == 1 assert responses[0].end.state == ax_pb2.STATE_FAILED assert responses[0].end.error.code == 3 - assert "Invalid harness_config" in responses[0].end.error.description + assert "Invalid agent_config" in responses[0].end.error.description asyncio.run(_run()) -def test_harness_config_unknown_field_names_are_reported(mock_config, tmp_path): +def test_agent_config_unknown_field_names_are_reported(mock_config, tmp_path): # The error lists the offending field(s), sorted, so a typo is actionable; # any unknown field rejects the whole overlay (no silent drop) and valid # fields in the same request are not flagged. servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) + from python.antigravity.harness_server import AgentConfigError raw = json.dumps({"zzz_bad": 1, "aaa_bad": 2, "system_instructions": "ok"}).encode() - with pytest.raises(HarnessConfigError) as excinfo: + with pytest.raises(AgentConfigError) as excinfo: servicer._build_config_for("conv-1", raw) msg = str(excinfo.value) assert "unknown config field(s): aaa_bad, zzz_bad" in msg @@ -638,7 +639,7 @@ async def _run(): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) req = ax_pb2.HarnessRequest( conversation_id="../escape", - harness_id="antigravity", + agent_id="antigravity", start=ax_pb2.HarnessStart( steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", @@ -663,7 +664,7 @@ async def _run(): servicer = AntigravityHarnessServiceServicer(mock_config, tmp_path) req = ax_pb2.HarnessRequest( conversation_id="../escape", - harness_id="antigravity", + agent_id="antigravity", start=ax_pb2.HarnessStart( steps=[ax_pb2.Step(content=ax_pb2.ContentStep( role="user", diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py index 2f33ffb2..fbe00658 100644 --- a/python/proto/ax_pb2.py +++ b/python/proto/ax_pb2.py @@ -16,7 +16,7 @@ from proto import content_pb2 as proto_dot_content__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xb4\x01\n\tStepEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x16\n\x0einteraction_id\x18\x02 \x01(\t\x12\x12\n\nharness_id\x18\x03 \x01(\t\x12/\n\x0eharness_config\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x17\n\x05steps\x18\x05 \x03(\x0b\x32\x08.ax.Step\x12\x18\n\x05state\x18\x06 \x01(\x0e\x32\t.ax.State\"?\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x17\n\x05steps\x18\x02 \x03(\x0b\x32\x08.ax.Step\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\")\n\x0eHarnessOutputs\x12\x17\n\x05steps\x18\x01 \x03(\x0b\x32\x08.ax.Step\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"}\n\x16\x43reateInteractionEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x18\n\x06inputs\x18\x02 \x03(\x0b\x32\x08.ax.Step\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0cJ\x04\x08\x03\x10\x04\"6\n\x19\x43reateInteractionResponse\x12\x19\n\x07outputs\x18\x01 \x03(\x0b\x32\x08.ax.Step\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32g\n\x13InteractionsService\x12P\n\x11\x43reateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01\x42\x1cZ\x1agithub.com/google/ax/protob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"\xb0\x01\n\tStepEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x16\n\x0einteraction_id\x18\x02 \x01(\t\x12\x10\n\x08\x61gent_id\x18\x03 \x01(\t\x12-\n\x0c\x61gent_config\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x17\n\x05steps\x18\x05 \x03(\x0b\x32\x08.ax.Step\x12\x18\n\x05state\x18\x06 \x01(\x0e\x32\t.ax.State\"=\n\x0cHarnessStart\x12\x14\n\x0c\x61gent_config\x18\x01 \x01(\x0c\x12\x17\n\x05steps\x18\x02 \x03(\x0b\x32\x08.ax.Step\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8b\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x10\n\x08\x61gent_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\")\n\x0eHarnessOutputs\x12\x17\n\x05steps\x18\x01 \x03(\x0b\x32\x08.ax.Step\"*\n\x05\x45rror\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x05\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"@\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x18\n\x05\x65rror\x18\x02 \x01(\x0b\x32\t.ax.Error\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"y\n\x16\x43reateInteractionEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x18\n\x06inputs\x18\x02 \x03(\x0b\x32\x08.ax.Step\x12\x10\n\x08\x61gent_id\x18\x04 \x01(\t\x12\x14\n\x0c\x61gent_config\x18\x05 \x01(\x0cJ\x04\x08\x03\x10\x04\"6\n\x19\x43reateInteractionResponse\x12\x19\n\x07outputs\x18\x01 \x03(\x0b\x32\x08.ax.Step\"\xcc\x01\n\x04Step\x12\x13\n\x0b\x64\x65scription\x18\x10 \x01(\t\x12\"\n\x07\x63ontent\x18\x0c \x01(\x0b\x32\x0f.ax.ContentStepH\x00\x12\"\n\x07thought\x18\x03 \x01(\x0b\x32\x0f.ax.ThoughtStepH\x00\x12%\n\ttool_call\x18\x04 \x01(\x0b\x32\x10.ax.ToolCallStepH\x00\x12)\n\x0btool_result\x18\x05 \x01(\x0b\x32\x12.ax.ToolResultStepH\x00\x12\r\n\x05index\x18\x16 \x01(\x03\x42\x06\n\x04type\"K\n\x0b\x43ontentStep\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"P\n\x0bThoughtStep\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x1c\n\x07summary\x18\x02 \x03(\x0b\x32\x0b.ax.ContentR\x04typeR\nevent_type\"p\n\x0cToolCallStep\x12\n\n\x02id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12-\n\rfunction_call\x18\x03 \x01(\x0b\x32\x14.ax.FunctionCallStepH\x00\x42\x06\n\x04typeR\nevent_type\"R\n\x10\x46unctionCallStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\targuments\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04type\"{\n\x0eToolResultStep\x12\x0f\n\x07\x63\x61ll_id\x18\x01 \x01(\t\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x12\x31\n\x0f\x66unction_result\x18\x03 \x01(\x0b\x32\x16.ax.FunctionResultStepH\x00\x42\x06\n\x04typeR\nevent_type\"s\n\x12\x46unctionResultStep\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08is_error\x18\x03 \x01(\x08\x12\x19\n\x06result\x18\x07 \x01(\x0b\x32\t.ax.ValueJ\x04\x08\x01\x10\x02J\x04\x08\x04\x10\x05J\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rR\x04type\"\x83\x02\n\x05Value\x12\x30\n\nnull_value\x18\x01 \x01(\x0e\x32\x1a.google.protobuf.NullValueH\x00\x12\x16\n\x0cnumber_value\x18\x02 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x03 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12/\n\x0cstruct_value\x18\x05 \x01(\x0b\x32\x17.google.protobuf.StructH\x00\x12#\n\nlist_value\x18\x06 \x01(\x0b\x32\r.ax.ListValueH\x00\x12$\n\rcontent_value\x18\x07 \x01(\x0b\x32\x0b.ax.ContentH\x00\x42\x06\n\x04kind\"&\n\tListValue\x12\x19\n\x06values\x18\x01 \x03(\x0b\x32\t.ax.Value*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32g\n\x13InteractionsService\x12P\n\x11\x43reateInteraction\x12\x1a.ax.CreateInteractionEvent\x1a\x1d.ax.CreateInteractionResponse0\x01\x42\x1cZ\x1agithub.com/google/ax/protob\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -24,50 +24,50 @@ if _descriptor._USE_C_DESCRIPTORS == False: _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto' - _globals['_STATE']._serialized_start=2082 - _globals['_STATE']._serialized_end=2190 - _globals['_CANCELREASON']._serialized_start=2193 - _globals['_CANCELREASON']._serialized_end=2333 + _globals['_STATE']._serialized_start=2070 + _globals['_STATE']._serialized_end=2178 + _globals['_CANCELREASON']._serialized_start=2181 + _globals['_CANCELREASON']._serialized_end=2321 _globals['_STEPEVENT']._serialized_start=74 - _globals['_STEPEVENT']._serialized_end=254 - _globals['_HARNESSSTART']._serialized_start=256 - _globals['_HARNESSSTART']._serialized_end=319 - _globals['_HARNESSCANCEL']._serialized_start=321 - _globals['_HARNESSCANCEL']._serialized_end=370 - _globals['_HARNESSREQUEST']._serialized_start=373 - _globals['_HARNESSREQUEST']._serialized_end=514 - _globals['_HARNESSOUTPUTS']._serialized_start=516 - _globals['_HARNESSOUTPUTS']._serialized_end=557 - _globals['_ERROR']._serialized_start=559 - _globals['_ERROR']._serialized_end=601 - _globals['_HARNESSEND']._serialized_start=603 - _globals['_HARNESSEND']._serialized_end=667 - _globals['_HARNESSRESPONSE']._serialized_start=669 - _globals['_HARNESSRESPONSE']._serialized_end=789 - _globals['_CREATEINTERACTIONEVENT']._serialized_start=791 - _globals['_CREATEINTERACTIONEVENT']._serialized_end=916 - _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=918 - _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=972 - _globals['_STEP']._serialized_start=975 - _globals['_STEP']._serialized_end=1179 - _globals['_CONTENTSTEP']._serialized_start=1181 - _globals['_CONTENTSTEP']._serialized_end=1256 - _globals['_THOUGHTSTEP']._serialized_start=1258 - _globals['_THOUGHTSTEP']._serialized_end=1338 - _globals['_TOOLCALLSTEP']._serialized_start=1340 - _globals['_TOOLCALLSTEP']._serialized_end=1452 - _globals['_FUNCTIONCALLSTEP']._serialized_start=1454 - _globals['_FUNCTIONCALLSTEP']._serialized_end=1536 - _globals['_TOOLRESULTSTEP']._serialized_start=1538 - _globals['_TOOLRESULTSTEP']._serialized_end=1661 - _globals['_FUNCTIONRESULTSTEP']._serialized_start=1663 - _globals['_FUNCTIONRESULTSTEP']._serialized_end=1778 - _globals['_VALUE']._serialized_start=1781 - _globals['_VALUE']._serialized_end=2040 - _globals['_LISTVALUE']._serialized_start=2042 - _globals['_LISTVALUE']._serialized_end=2080 - _globals['_HARNESSSERVICE']._serialized_start=2335 - _globals['_HARNESSSERVICE']._serialized_end=2407 - _globals['_INTERACTIONSSERVICE']._serialized_start=2409 - _globals['_INTERACTIONSSERVICE']._serialized_end=2512 + _globals['_STEPEVENT']._serialized_end=250 + _globals['_HARNESSSTART']._serialized_start=252 + _globals['_HARNESSSTART']._serialized_end=313 + _globals['_HARNESSCANCEL']._serialized_start=315 + _globals['_HARNESSCANCEL']._serialized_end=364 + _globals['_HARNESSREQUEST']._serialized_start=367 + _globals['_HARNESSREQUEST']._serialized_end=506 + _globals['_HARNESSOUTPUTS']._serialized_start=508 + _globals['_HARNESSOUTPUTS']._serialized_end=549 + _globals['_ERROR']._serialized_start=551 + _globals['_ERROR']._serialized_end=593 + _globals['_HARNESSEND']._serialized_start=595 + _globals['_HARNESSEND']._serialized_end=659 + _globals['_HARNESSRESPONSE']._serialized_start=661 + _globals['_HARNESSRESPONSE']._serialized_end=781 + _globals['_CREATEINTERACTIONEVENT']._serialized_start=783 + _globals['_CREATEINTERACTIONEVENT']._serialized_end=904 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_start=906 + _globals['_CREATEINTERACTIONRESPONSE']._serialized_end=960 + _globals['_STEP']._serialized_start=963 + _globals['_STEP']._serialized_end=1167 + _globals['_CONTENTSTEP']._serialized_start=1169 + _globals['_CONTENTSTEP']._serialized_end=1244 + _globals['_THOUGHTSTEP']._serialized_start=1246 + _globals['_THOUGHTSTEP']._serialized_end=1326 + _globals['_TOOLCALLSTEP']._serialized_start=1328 + _globals['_TOOLCALLSTEP']._serialized_end=1440 + _globals['_FUNCTIONCALLSTEP']._serialized_start=1442 + _globals['_FUNCTIONCALLSTEP']._serialized_end=1524 + _globals['_TOOLRESULTSTEP']._serialized_start=1526 + _globals['_TOOLRESULTSTEP']._serialized_end=1649 + _globals['_FUNCTIONRESULTSTEP']._serialized_start=1651 + _globals['_FUNCTIONRESULTSTEP']._serialized_end=1766 + _globals['_VALUE']._serialized_start=1769 + _globals['_VALUE']._serialized_end=2028 + _globals['_LISTVALUE']._serialized_start=2030 + _globals['_LISTVALUE']._serialized_end=2068 + _globals['_HARNESSSERVICE']._serialized_start=2323 + _globals['_HARNESSSERVICE']._serialized_end=2395 + _globals['_INTERACTIONSSERVICE']._serialized_start=2397 + _globals['_INTERACTIONSSERVICE']._serialized_end=2500 # @@protoc_insertion_point(module_scope) From d5f0e1da3e3d49227179d11010e766608972e064 Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Tue, 11 Aug 2026 22:49:22 -0700 Subject: [PATCH 5/5] Add the missing license headers --- Makefile | 2 ++ python/proto/ax_pb2.py | 14 ++++++++++++++ python/proto/ax_pb2_grpc.py | 14 ++++++++++++++ python/proto/content_pb2.py | 14 ++++++++++++++ python/proto/content_pb2_grpc.py | 14 ++++++++++++++ 5 files changed, 58 insertions(+) diff --git a/Makefile b/Makefile index ce04e638..189a2b8f 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ proto: --go-grpc_out=. --go-grpc_opt=paths=source_relative \ proto/ax.proto proto/content.proto @python3 -m grpc_tools.protoc -I. --python_out=python --grpc_python_out=python proto/ax.proto proto/content.proto + @$$(go env GOPATH)/bin/addlicense -l apache python/proto/*.py @echo "Protobuf generation complete!" # Run Go tests @@ -54,6 +55,7 @@ deps: @go mod download @go install google.golang.org/protobuf/cmd/protoc-gen-go@latest @go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + @go install github.com/google/addlicense@latest @echo "Dependencies installed!" clean-logs: diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py index fbe00658..42f9d659 100644 --- a/python/proto/ax_pb2.py +++ b/python/proto/ax_pb2.py @@ -1,3 +1,17 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/ax.proto diff --git a/python/proto/ax_pb2_grpc.py b/python/proto/ax_pb2_grpc.py index 10afe378..0b3286f8 100644 --- a/python/proto/ax_pb2_grpc.py +++ b/python/proto/ax_pb2_grpc.py @@ -1,3 +1,17 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/python/proto/content_pb2.py b/python/proto/content_pb2.py index 425fdad0..f6f7d60f 100644 --- a/python/proto/content_pb2.py +++ b/python/proto/content_pb2.py @@ -1,3 +1,17 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proto/content.proto diff --git a/python/proto/content_pb2_grpc.py b/python/proto/content_pb2_grpc.py index 2daafffe..fe9b2e77 100644 --- a/python/proto/content_pb2_grpc.py +++ b/python/proto/content_pb2_grpc.py @@ -1,3 +1,17 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc