From 292636f471bbf02a2824238fc05b9ec6bd33d49f Mon Sep 17 00:00:00 2001 From: Jonathan Haas Date: Wed, 15 Apr 2026 06:49:13 -0700 Subject: [PATCH] Add attribution service contract --- .github/workflows/ci.yml | 2 +- descriptions.yaml | 11 + gen/go/attribution/v1/attribution.pb.go | 1380 +++++++++++++++++ .../attribution.connect.go | 167 ++ gen/python/attribution/v1/attribution_pb2.py | 71 + gen/ts/attribution/v1/attribution_connect.ts | 46 + gen/ts/attribution/v1/attribution_pb.ts | 616 ++++++++ package.json | 4 + proto/attribution/v1/attribution.proto | 138 ++ 9 files changed, 2434 insertions(+), 1 deletion(-) create mode 100644 gen/go/attribution/v1/attribution.pb.go create mode 100644 gen/go/attribution/v1/attributionv1connect/attribution.connect.go create mode 100644 gen/python/attribution/v1/attribution_pb2.py create mode 100644 gen/ts/attribution/v1/attribution_connect.ts create mode 100644 gen/ts/attribution/v1/attribution_pb.ts create mode 100644 proto/attribution/v1/attribution.proto diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb301b0..e3d4e39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,4 +100,4 @@ jobs: . .venv-smoke/bin/activate python -m pip install --upgrade pip python -m pip install dist/*.whl - python -c "from agents.v1.agents_pb2 import Agent; from compliance.v1.compliance_pb2 import EvidencePackage; from config.v1.config_pb2 import FeatureFlagSnapshot; from events.v1.cloudevent_pb2 import CloudEvent; from traces.v1.traces_pb2 import TraceSummary; from workflows.v1.workflows_pb2 import WorkflowRun; assert Agent.DESCRIPTOR.full_name == 'agents.v1.Agent'; assert EvidencePackage.DESCRIPTOR.full_name == 'compliance.v1.EvidencePackage'; assert FeatureFlagSnapshot.DESCRIPTOR.full_name == 'config.v1.FeatureFlagSnapshot'; assert CloudEvent.DESCRIPTOR.full_name == 'events.v1.CloudEvent'; assert TraceSummary.DESCRIPTOR.full_name == 'traces.v1.TraceSummary'; assert WorkflowRun.DESCRIPTOR.full_name == 'workflows.v1.WorkflowRun'" + python -c "from agents.v1.agents_pb2 import Agent; from attribution.v1.attribution_pb2 import AttributionReport; from compliance.v1.compliance_pb2 import EvidencePackage; from config.v1.config_pb2 import FeatureFlagSnapshot; from events.v1.cloudevent_pb2 import CloudEvent; from traces.v1.traces_pb2 import TraceSummary; from workflows.v1.workflows_pb2 import WorkflowRun; assert Agent.DESCRIPTOR.full_name == 'agents.v1.Agent'; assert AttributionReport.DESCRIPTOR.full_name == 'attribution.v1.AttributionReport'; assert EvidencePackage.DESCRIPTOR.full_name == 'compliance.v1.EvidencePackage'; assert FeatureFlagSnapshot.DESCRIPTOR.full_name == 'config.v1.FeatureFlagSnapshot'; assert CloudEvent.DESCRIPTOR.full_name == 'events.v1.CloudEvent'; assert TraceSummary.DESCRIPTOR.full_name == 'traces.v1.TraceSummary'; assert WorkflowRun.DESCRIPTOR.full_name == 'workflows.v1.WorkflowRun'" diff --git a/descriptions.yaml b/descriptions.yaml index ee0723f..73c7f28 100644 --- a/descriptions.yaml +++ b/descriptions.yaml @@ -130,6 +130,17 @@ ConnectorService_GetCapabilities: >- bulk-export). Used to determine what operations an agent can perform through this integration. +# --- attribution/v1 --- +AttributionService_GenerateReport: >- + Generate a persisted attribution report for one or more pipeline deals by + correlating traces, metered usage, and deal context into per-agent and + optional team revenue and ROI rollups. +AttributionService_GetReport: >- + Retrieve a previously generated attribution report by ID. +AttributionService_ExportReport: >- + Render an attribution report into JSON or CSV for finance, operations, or + downstream analytics tooling. + # --- compliance/v1 --- ComplianceService_GenerateEvidencePackage: >- Generate a compliance evidence package for a workspace and framework by diff --git a/gen/go/attribution/v1/attribution.pb.go b/gen/go/attribution/v1/attribution.pb.go new file mode 100644 index 0000000..37fc366 --- /dev/null +++ b/gen/go/attribution/v1/attribution.pb.go @@ -0,0 +1,1380 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: attribution/v1/attribution.proto + +package attributionv1 + +import ( + v1 "github.com/evalops/proto/gen/go/traces/v1" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AttributionModel int32 + +const ( + AttributionModel_ATTRIBUTION_MODEL_UNSPECIFIED AttributionModel = 0 + AttributionModel_ATTRIBUTION_MODEL_DIRECT AttributionModel = 1 + AttributionModel_ATTRIBUTION_MODEL_ASSISTED AttributionModel = 2 + AttributionModel_ATTRIBUTION_MODEL_INFLUENCED AttributionModel = 3 +) + +// Enum value maps for AttributionModel. +var ( + AttributionModel_name = map[int32]string{ + 0: "ATTRIBUTION_MODEL_UNSPECIFIED", + 1: "ATTRIBUTION_MODEL_DIRECT", + 2: "ATTRIBUTION_MODEL_ASSISTED", + 3: "ATTRIBUTION_MODEL_INFLUENCED", + } + AttributionModel_value = map[string]int32{ + "ATTRIBUTION_MODEL_UNSPECIFIED": 0, + "ATTRIBUTION_MODEL_DIRECT": 1, + "ATTRIBUTION_MODEL_ASSISTED": 2, + "ATTRIBUTION_MODEL_INFLUENCED": 3, + } +) + +func (x AttributionModel) Enum() *AttributionModel { + p := new(AttributionModel) + *p = x + return p +} + +func (x AttributionModel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AttributionModel) Descriptor() protoreflect.EnumDescriptor { + return file_attribution_v1_attribution_proto_enumTypes[0].Descriptor() +} + +func (AttributionModel) Type() protoreflect.EnumType { + return &file_attribution_v1_attribution_proto_enumTypes[0] +} + +func (x AttributionModel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AttributionModel.Descriptor instead. +func (AttributionModel) EnumDescriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{0} +} + +type ReportExportFormat int32 + +const ( + ReportExportFormat_REPORT_EXPORT_FORMAT_UNSPECIFIED ReportExportFormat = 0 + ReportExportFormat_REPORT_EXPORT_FORMAT_JSON ReportExportFormat = 1 + ReportExportFormat_REPORT_EXPORT_FORMAT_CSV ReportExportFormat = 2 +) + +// Enum value maps for ReportExportFormat. +var ( + ReportExportFormat_name = map[int32]string{ + 0: "REPORT_EXPORT_FORMAT_UNSPECIFIED", + 1: "REPORT_EXPORT_FORMAT_JSON", + 2: "REPORT_EXPORT_FORMAT_CSV", + } + ReportExportFormat_value = map[string]int32{ + "REPORT_EXPORT_FORMAT_UNSPECIFIED": 0, + "REPORT_EXPORT_FORMAT_JSON": 1, + "REPORT_EXPORT_FORMAT_CSV": 2, + } +) + +func (x ReportExportFormat) Enum() *ReportExportFormat { + p := new(ReportExportFormat) + *p = x + return p +} + +func (x ReportExportFormat) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ReportExportFormat) Descriptor() protoreflect.EnumDescriptor { + return file_attribution_v1_attribution_proto_enumTypes[1].Descriptor() +} + +func (ReportExportFormat) Type() protoreflect.EnumType { + return &file_attribution_v1_attribution_proto_enumTypes[1] +} + +func (x ReportExportFormat) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ReportExportFormat.Descriptor instead. +func (ReportExportFormat) EnumDescriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{1} +} + +type AttributionQuery struct { + state protoimpl.MessageState `protogen:"open.v1"` + WorkspaceId string `protobuf:"bytes,1,opt,name=workspace_id,json=workspaceId,proto3" json:"workspace_id,omitempty"` + OrganizationId string `protobuf:"bytes,2,opt,name=organization_id,json=organizationId,proto3" json:"organization_id,omitempty"` + DealIds []string `protobuf:"bytes,3,rep,name=deal_ids,json=dealIds,proto3" json:"deal_ids,omitempty"` + Model AttributionModel `protobuf:"varint,4,opt,name=model,proto3,enum=attribution.v1.AttributionModel" json:"model,omitempty"` + StartTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + IncludeTeamRollups bool `protobuf:"varint,7,opt,name=include_team_rollups,json=includeTeamRollups,proto3" json:"include_team_rollups,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttributionQuery) Reset() { + *x = AttributionQuery{} + mi := &file_attribution_v1_attribution_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttributionQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttributionQuery) ProtoMessage() {} + +func (x *AttributionQuery) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 AttributionQuery.ProtoReflect.Descriptor instead. +func (*AttributionQuery) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{0} +} + +func (x *AttributionQuery) GetWorkspaceId() string { + if x != nil { + return x.WorkspaceId + } + return "" +} + +func (x *AttributionQuery) GetOrganizationId() string { + if x != nil { + return x.OrganizationId + } + return "" +} + +func (x *AttributionQuery) GetDealIds() []string { + if x != nil { + return x.DealIds + } + return nil +} + +func (x *AttributionQuery) GetModel() AttributionModel { + if x != nil { + return x.Model + } + return AttributionModel_ATTRIBUTION_MODEL_UNSPECIFIED +} + +func (x *AttributionQuery) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.StartTime + } + return nil +} + +func (x *AttributionQuery) GetEndTime() *timestamppb.Timestamp { + if x != nil { + return x.EndTime + } + return nil +} + +func (x *AttributionQuery) GetIncludeTeamRollups() bool { + if x != nil { + return x.IncludeTeamRollups + } + return false +} + +type DealContext struct { + state protoimpl.MessageState `protogen:"open.v1"` + DealId string `protobuf:"bytes,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + Stage string `protobuf:"bytes,3,opt,name=stage,proto3" json:"stage,omitempty"` + Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` + Currency string `protobuf:"bytes,5,opt,name=currency,proto3" json:"currency,omitempty"` + OwnerId string `protobuf:"bytes,6,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"` + ContactId string `protobuf:"bytes,7,opt,name=contact_id,json=contactId,proto3" json:"contact_id,omitempty"` + CompanyId string `protobuf:"bytes,8,opt,name=company_id,json=companyId,proto3" json:"company_id,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DealContext) Reset() { + *x = DealContext{} + mi := &file_attribution_v1_attribution_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DealContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DealContext) ProtoMessage() {} + +func (x *DealContext) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_proto_msgTypes[1] + 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 DealContext.ProtoReflect.Descriptor instead. +func (*DealContext) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{1} +} + +func (x *DealContext) GetDealId() string { + if x != nil { + return x.DealId + } + return "" +} + +func (x *DealContext) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *DealContext) GetStage() string { + if x != nil { + return x.Stage + } + return "" +} + +func (x *DealContext) GetValue() float64 { + if x != nil { + return x.Value + } + return 0 +} + +func (x *DealContext) GetCurrency() string { + if x != nil { + return x.Currency + } + return "" +} + +func (x *DealContext) GetOwnerId() string { + if x != nil { + return x.OwnerId + } + return "" +} + +func (x *DealContext) GetContactId() string { + if x != nil { + return x.ContactId + } + return "" +} + +func (x *DealContext) GetCompanyId() string { + if x != nil { + return x.CompanyId + } + return "" +} + +func (x *DealContext) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *DealContext) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +type TraceTouchpoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + Trace *v1.TraceSummary `protobuf:"bytes,1,opt,name=trace,proto3" json:"trace,omitempty"` + MatchReasons []string `protobuf:"bytes,2,rep,name=match_reasons,json=matchReasons,proto3" json:"match_reasons,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TraceTouchpoint) Reset() { + *x = TraceTouchpoint{} + mi := &file_attribution_v1_attribution_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TraceTouchpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceTouchpoint) ProtoMessage() {} + +func (x *TraceTouchpoint) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_proto_msgTypes[2] + 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 TraceTouchpoint.ProtoReflect.Descriptor instead. +func (*TraceTouchpoint) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{2} +} + +func (x *TraceTouchpoint) GetTrace() *v1.TraceSummary { + if x != nil { + return x.Trace + } + return nil +} + +func (x *TraceTouchpoint) GetMatchReasons() []string { + if x != nil { + return x.MatchReasons + } + return nil +} + +type UsageTouchpoint struct { + state protoimpl.MessageState `protogen:"open.v1"` + RecordId string `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` + RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + AgentId string `protobuf:"bytes,3,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` + TeamId string `protobuf:"bytes,4,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` + Surface string `protobuf:"bytes,5,opt,name=surface,proto3" json:"surface,omitempty"` + Model string `protobuf:"bytes,6,opt,name=model,proto3" json:"model,omitempty"` + Provider string `protobuf:"bytes,7,opt,name=provider,proto3" json:"provider,omitempty"` + InputTokens int64 `protobuf:"varint,8,opt,name=input_tokens,json=inputTokens,proto3" json:"input_tokens,omitempty"` + OutputTokens int64 `protobuf:"varint,9,opt,name=output_tokens,json=outputTokens,proto3" json:"output_tokens,omitempty"` + TotalCostUsd float64 `protobuf:"fixed64,10,opt,name=total_cost_usd,json=totalCostUsd,proto3" json:"total_cost_usd,omitempty"` + ObservedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=observed_at,json=observedAt,proto3" json:"observed_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UsageTouchpoint) Reset() { + *x = UsageTouchpoint{} + mi := &file_attribution_v1_attribution_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UsageTouchpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UsageTouchpoint) ProtoMessage() {} + +func (x *UsageTouchpoint) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_proto_msgTypes[3] + 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 UsageTouchpoint.ProtoReflect.Descriptor instead. +func (*UsageTouchpoint) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{3} +} + +func (x *UsageTouchpoint) GetRecordId() string { + if x != nil { + return x.RecordId + } + return "" +} + +func (x *UsageTouchpoint) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *UsageTouchpoint) GetAgentId() string { + if x != nil { + return x.AgentId + } + return "" +} + +func (x *UsageTouchpoint) GetTeamId() string { + if x != nil { + return x.TeamId + } + return "" +} + +func (x *UsageTouchpoint) GetSurface() string { + if x != nil { + return x.Surface + } + return "" +} + +func (x *UsageTouchpoint) GetModel() string { + if x != nil { + return x.Model + } + return "" +} + +func (x *UsageTouchpoint) GetProvider() string { + if x != nil { + return x.Provider + } + return "" +} + +func (x *UsageTouchpoint) GetInputTokens() int64 { + if x != nil { + return x.InputTokens + } + return 0 +} + +func (x *UsageTouchpoint) GetOutputTokens() int64 { + if x != nil { + return x.OutputTokens + } + return 0 +} + +func (x *UsageTouchpoint) GetTotalCostUsd() float64 { + if x != nil { + return x.TotalCostUsd + } + return 0 +} + +func (x *UsageTouchpoint) GetObservedAt() *timestamppb.Timestamp { + if x != nil { + return x.ObservedAt + } + return nil +} + +type AgentSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` + AttributionWeight float64 `protobuf:"fixed64,2,opt,name=attribution_weight,json=attributionWeight,proto3" json:"attribution_weight,omitempty"` + AttributedRevenueUsd float64 `protobuf:"fixed64,3,opt,name=attributed_revenue_usd,json=attributedRevenueUsd,proto3" json:"attributed_revenue_usd,omitempty"` + TotalCostUsd float64 `protobuf:"fixed64,4,opt,name=total_cost_usd,json=totalCostUsd,proto3" json:"total_cost_usd,omitempty"` + RoiMultiple float64 `protobuf:"fixed64,5,opt,name=roi_multiple,json=roiMultiple,proto3" json:"roi_multiple,omitempty"` + TraceCount int32 `protobuf:"varint,6,opt,name=trace_count,json=traceCount,proto3" json:"trace_count,omitempty"` + UsageCount int32 `protobuf:"varint,7,opt,name=usage_count,json=usageCount,proto3" json:"usage_count,omitempty"` + TraceIds []string `protobuf:"bytes,8,rep,name=trace_ids,json=traceIds,proto3" json:"trace_ids,omitempty"` + UsageRecordIds []string `protobuf:"bytes,9,rep,name=usage_record_ids,json=usageRecordIds,proto3" json:"usage_record_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AgentSummary) Reset() { + *x = AgentSummary{} + mi := &file_attribution_v1_attribution_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AgentSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentSummary) ProtoMessage() {} + +func (x *AgentSummary) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 AgentSummary.ProtoReflect.Descriptor instead. +func (*AgentSummary) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{4} +} + +func (x *AgentSummary) GetAgentId() string { + if x != nil { + return x.AgentId + } + return "" +} + +func (x *AgentSummary) GetAttributionWeight() float64 { + if x != nil { + return x.AttributionWeight + } + return 0 +} + +func (x *AgentSummary) GetAttributedRevenueUsd() float64 { + if x != nil { + return x.AttributedRevenueUsd + } + return 0 +} + +func (x *AgentSummary) GetTotalCostUsd() float64 { + if x != nil { + return x.TotalCostUsd + } + return 0 +} + +func (x *AgentSummary) GetRoiMultiple() float64 { + if x != nil { + return x.RoiMultiple + } + return 0 +} + +func (x *AgentSummary) GetTraceCount() int32 { + if x != nil { + return x.TraceCount + } + return 0 +} + +func (x *AgentSummary) GetUsageCount() int32 { + if x != nil { + return x.UsageCount + } + return 0 +} + +func (x *AgentSummary) GetTraceIds() []string { + if x != nil { + return x.TraceIds + } + return nil +} + +func (x *AgentSummary) GetUsageRecordIds() []string { + if x != nil { + return x.UsageRecordIds + } + return nil +} + +type TeamSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + TeamId string `protobuf:"bytes,1,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` + AttributedRevenueUsd float64 `protobuf:"fixed64,2,opt,name=attributed_revenue_usd,json=attributedRevenueUsd,proto3" json:"attributed_revenue_usd,omitempty"` + TotalCostUsd float64 `protobuf:"fixed64,3,opt,name=total_cost_usd,json=totalCostUsd,proto3" json:"total_cost_usd,omitempty"` + RoiMultiple float64 `protobuf:"fixed64,4,opt,name=roi_multiple,json=roiMultiple,proto3" json:"roi_multiple,omitempty"` + AgentIds []string `protobuf:"bytes,5,rep,name=agent_ids,json=agentIds,proto3" json:"agent_ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TeamSummary) Reset() { + *x = TeamSummary{} + mi := &file_attribution_v1_attribution_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TeamSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TeamSummary) ProtoMessage() {} + +func (x *TeamSummary) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 TeamSummary.ProtoReflect.Descriptor instead. +func (*TeamSummary) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{5} +} + +func (x *TeamSummary) GetTeamId() string { + if x != nil { + return x.TeamId + } + return "" +} + +func (x *TeamSummary) GetAttributedRevenueUsd() float64 { + if x != nil { + return x.AttributedRevenueUsd + } + return 0 +} + +func (x *TeamSummary) GetTotalCostUsd() float64 { + if x != nil { + return x.TotalCostUsd + } + return 0 +} + +func (x *TeamSummary) GetRoiMultiple() float64 { + if x != nil { + return x.RoiMultiple + } + return 0 +} + +func (x *TeamSummary) GetAgentIds() []string { + if x != nil { + return x.AgentIds + } + return nil +} + +type DealAttribution struct { + state protoimpl.MessageState `protogen:"open.v1"` + Deal *DealContext `protobuf:"bytes,1,opt,name=deal,proto3" json:"deal,omitempty"` + TraceTouchpoints []*TraceTouchpoint `protobuf:"bytes,2,rep,name=trace_touchpoints,json=traceTouchpoints,proto3" json:"trace_touchpoints,omitempty"` + UsageTouchpoints []*UsageTouchpoint `protobuf:"bytes,3,rep,name=usage_touchpoints,json=usageTouchpoints,proto3" json:"usage_touchpoints,omitempty"` + AgentSummaries []*AgentSummary `protobuf:"bytes,4,rep,name=agent_summaries,json=agentSummaries,proto3" json:"agent_summaries,omitempty"` + TeamSummaries []*TeamSummary `protobuf:"bytes,5,rep,name=team_summaries,json=teamSummaries,proto3" json:"team_summaries,omitempty"` + TotalAttributedRevenueUsd float64 `protobuf:"fixed64,6,opt,name=total_attributed_revenue_usd,json=totalAttributedRevenueUsd,proto3" json:"total_attributed_revenue_usd,omitempty"` + TotalAttributedCostUsd float64 `protobuf:"fixed64,7,opt,name=total_attributed_cost_usd,json=totalAttributedCostUsd,proto3" json:"total_attributed_cost_usd,omitempty"` + UnattributedRevenueUsd float64 `protobuf:"fixed64,8,opt,name=unattributed_revenue_usd,json=unattributedRevenueUsd,proto3" json:"unattributed_revenue_usd,omitempty"` + UnattributedCostUsd float64 `protobuf:"fixed64,9,opt,name=unattributed_cost_usd,json=unattributedCostUsd,proto3" json:"unattributed_cost_usd,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DealAttribution) Reset() { + *x = DealAttribution{} + mi := &file_attribution_v1_attribution_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DealAttribution) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DealAttribution) ProtoMessage() {} + +func (x *DealAttribution) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 DealAttribution.ProtoReflect.Descriptor instead. +func (*DealAttribution) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{6} +} + +func (x *DealAttribution) GetDeal() *DealContext { + if x != nil { + return x.Deal + } + return nil +} + +func (x *DealAttribution) GetTraceTouchpoints() []*TraceTouchpoint { + if x != nil { + return x.TraceTouchpoints + } + return nil +} + +func (x *DealAttribution) GetUsageTouchpoints() []*UsageTouchpoint { + if x != nil { + return x.UsageTouchpoints + } + return nil +} + +func (x *DealAttribution) GetAgentSummaries() []*AgentSummary { + if x != nil { + return x.AgentSummaries + } + return nil +} + +func (x *DealAttribution) GetTeamSummaries() []*TeamSummary { + if x != nil { + return x.TeamSummaries + } + return nil +} + +func (x *DealAttribution) GetTotalAttributedRevenueUsd() float64 { + if x != nil { + return x.TotalAttributedRevenueUsd + } + return 0 +} + +func (x *DealAttribution) GetTotalAttributedCostUsd() float64 { + if x != nil { + return x.TotalAttributedCostUsd + } + return 0 +} + +func (x *DealAttribution) GetUnattributedRevenueUsd() float64 { + if x != nil { + return x.UnattributedRevenueUsd + } + return 0 +} + +func (x *DealAttribution) GetUnattributedCostUsd() float64 { + if x != nil { + return x.UnattributedCostUsd + } + return 0 +} + +type AttributionReport struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Query *AttributionQuery `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + GeneratedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=generated_at,json=generatedAt,proto3" json:"generated_at,omitempty"` + Deals []*DealAttribution `protobuf:"bytes,4,rep,name=deals,proto3" json:"deals,omitempty"` + AgentSummaries []*AgentSummary `protobuf:"bytes,5,rep,name=agent_summaries,json=agentSummaries,proto3" json:"agent_summaries,omitempty"` + TeamSummaries []*TeamSummary `protobuf:"bytes,6,rep,name=team_summaries,json=teamSummaries,proto3" json:"team_summaries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttributionReport) Reset() { + *x = AttributionReport{} + mi := &file_attribution_v1_attribution_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttributionReport) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttributionReport) ProtoMessage() {} + +func (x *AttributionReport) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 AttributionReport.ProtoReflect.Descriptor instead. +func (*AttributionReport) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{7} +} + +func (x *AttributionReport) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AttributionReport) GetQuery() *AttributionQuery { + if x != nil { + return x.Query + } + return nil +} + +func (x *AttributionReport) GetGeneratedAt() *timestamppb.Timestamp { + if x != nil { + return x.GeneratedAt + } + return nil +} + +func (x *AttributionReport) GetDeals() []*DealAttribution { + if x != nil { + return x.Deals + } + return nil +} + +func (x *AttributionReport) GetAgentSummaries() []*AgentSummary { + if x != nil { + return x.AgentSummaries + } + return nil +} + +func (x *AttributionReport) GetTeamSummaries() []*TeamSummary { + if x != nil { + return x.TeamSummaries + } + return nil +} + +type GenerateReportRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query *AttributionQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GenerateReportRequest) Reset() { + *x = GenerateReportRequest{} + mi := &file_attribution_v1_attribution_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GenerateReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateReportRequest) ProtoMessage() {} + +func (x *GenerateReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 GenerateReportRequest.ProtoReflect.Descriptor instead. +func (*GenerateReportRequest) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{8} +} + +func (x *GenerateReportRequest) GetQuery() *AttributionQuery { + if x != nil { + return x.Query + } + return nil +} + +type GenerateReportResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Report *AttributionReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GenerateReportResponse) Reset() { + *x = GenerateReportResponse{} + mi := &file_attribution_v1_attribution_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GenerateReportResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateReportResponse) ProtoMessage() {} + +func (x *GenerateReportResponse) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 GenerateReportResponse.ProtoReflect.Descriptor instead. +func (*GenerateReportResponse) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{9} +} + +func (x *GenerateReportResponse) GetReport() *AttributionReport { + if x != nil { + return x.Report + } + return nil +} + +type GetReportRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ReportId string `protobuf:"bytes,1,opt,name=report_id,json=reportId,proto3" json:"report_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetReportRequest) Reset() { + *x = GetReportRequest{} + mi := &file_attribution_v1_attribution_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReportRequest) ProtoMessage() {} + +func (x *GetReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 GetReportRequest.ProtoReflect.Descriptor instead. +func (*GetReportRequest) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{10} +} + +func (x *GetReportRequest) GetReportId() string { + if x != nil { + return x.ReportId + } + return "" +} + +type GetReportResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Report *AttributionReport `protobuf:"bytes,1,opt,name=report,proto3" json:"report,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetReportResponse) Reset() { + *x = GetReportResponse{} + mi := &file_attribution_v1_attribution_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetReportResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetReportResponse) ProtoMessage() {} + +func (x *GetReportResponse) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 GetReportResponse.ProtoReflect.Descriptor instead. +func (*GetReportResponse) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{11} +} + +func (x *GetReportResponse) GetReport() *AttributionReport { + if x != nil { + return x.Report + } + return nil +} + +type ExportReportRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Query *AttributionQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + Format ReportExportFormat `protobuf:"varint,2,opt,name=format,proto3,enum=attribution.v1.ReportExportFormat" json:"format,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExportReportRequest) Reset() { + *x = ExportReportRequest{} + mi := &file_attribution_v1_attribution_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExportReportRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExportReportRequest) ProtoMessage() {} + +func (x *ExportReportRequest) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_proto_msgTypes[12] + 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 ExportReportRequest.ProtoReflect.Descriptor instead. +func (*ExportReportRequest) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{12} +} + +func (x *ExportReportRequest) GetQuery() *AttributionQuery { + if x != nil { + return x.Query + } + return nil +} + +func (x *ExportReportRequest) GetFormat() ReportExportFormat { + if x != nil { + return x.Format + } + return ReportExportFormat_REPORT_EXPORT_FORMAT_UNSPECIFIED +} + +type ExportReportResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExportReportResponse) Reset() { + *x = ExportReportResponse{} + mi := &file_attribution_v1_attribution_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExportReportResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExportReportResponse) ProtoMessage() {} + +func (x *ExportReportResponse) ProtoReflect() protoreflect.Message { + mi := &file_attribution_v1_attribution_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 ExportReportResponse.ProtoReflect.Descriptor instead. +func (*ExportReportResponse) Descriptor() ([]byte, []int) { + return file_attribution_v1_attribution_proto_rawDescGZIP(), []int{13} +} + +func (x *ExportReportResponse) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *ExportReportResponse) GetContentType() string { + if x != nil { + return x.ContentType + } + return "" +} + +func (x *ExportReportResponse) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +var File_attribution_v1_attribution_proto protoreflect.FileDescriptor + +const file_attribution_v1_attribution_proto_rawDesc = "" + + "\n" + + " attribution/v1/attribution.proto\x12\x0eattribution.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16traces/v1/traces.proto\"\xd5\x02\n" + + "\x10AttributionQuery\x12!\n" + + "\fworkspace_id\x18\x01 \x01(\tR\vworkspaceId\x12'\n" + + "\x0forganization_id\x18\x02 \x01(\tR\x0eorganizationId\x12\x19\n" + + "\bdeal_ids\x18\x03 \x03(\tR\adealIds\x126\n" + + "\x05model\x18\x04 \x01(\x0e2 .attribution.v1.AttributionModelR\x05model\x129\n" + + "\n" + + "start_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\tstartTime\x125\n" + + "\bend_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\aendTime\x120\n" + + "\x14include_team_rollups\x18\a \x01(\bR\x12includeTeamRollups\"\xd3\x02\n" + + "\vDealContext\x12\x17\n" + + "\adeal_id\x18\x01 \x01(\tR\x06dealId\x12\x14\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12\x14\n" + + "\x05stage\x18\x03 \x01(\tR\x05stage\x12\x14\n" + + "\x05value\x18\x04 \x01(\x01R\x05value\x12\x1a\n" + + "\bcurrency\x18\x05 \x01(\tR\bcurrency\x12\x19\n" + + "\bowner_id\x18\x06 \x01(\tR\aownerId\x12\x1d\n" + + "\n" + + "contact_id\x18\a \x01(\tR\tcontactId\x12\x1d\n" + + "\n" + + "company_id\x18\b \x01(\tR\tcompanyId\x129\n" + + "\n" + + "created_at\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + + "\n" + + "updated_at\x18\n" + + " \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt\"e\n" + + "\x0fTraceTouchpoint\x12-\n" + + "\x05trace\x18\x01 \x01(\v2\x17.traces.v1.TraceSummaryR\x05trace\x12#\n" + + "\rmatch_reasons\x18\x02 \x03(\tR\fmatchReasons\"\xf8\x02\n" + + "\x0fUsageTouchpoint\x12\x1b\n" + + "\trecord_id\x18\x01 \x01(\tR\brecordId\x12\x1d\n" + + "\n" + + "request_id\x18\x02 \x01(\tR\trequestId\x12\x19\n" + + "\bagent_id\x18\x03 \x01(\tR\aagentId\x12\x17\n" + + "\ateam_id\x18\x04 \x01(\tR\x06teamId\x12\x18\n" + + "\asurface\x18\x05 \x01(\tR\asurface\x12\x14\n" + + "\x05model\x18\x06 \x01(\tR\x05model\x12\x1a\n" + + "\bprovider\x18\a \x01(\tR\bprovider\x12!\n" + + "\finput_tokens\x18\b \x01(\x03R\vinputTokens\x12#\n" + + "\routput_tokens\x18\t \x01(\x03R\foutputTokens\x12$\n" + + "\x0etotal_cost_usd\x18\n" + + " \x01(\x01R\ftotalCostUsd\x12;\n" + + "\vobserved_at\x18\v \x01(\v2\x1a.google.protobuf.TimestampR\n" + + "observedAt\"\xe0\x02\n" + + "\fAgentSummary\x12\x19\n" + + "\bagent_id\x18\x01 \x01(\tR\aagentId\x12-\n" + + "\x12attribution_weight\x18\x02 \x01(\x01R\x11attributionWeight\x124\n" + + "\x16attributed_revenue_usd\x18\x03 \x01(\x01R\x14attributedRevenueUsd\x12$\n" + + "\x0etotal_cost_usd\x18\x04 \x01(\x01R\ftotalCostUsd\x12!\n" + + "\froi_multiple\x18\x05 \x01(\x01R\vroiMultiple\x12\x1f\n" + + "\vtrace_count\x18\x06 \x01(\x05R\n" + + "traceCount\x12\x1f\n" + + "\vusage_count\x18\a \x01(\x05R\n" + + "usageCount\x12\x1b\n" + + "\ttrace_ids\x18\b \x03(\tR\btraceIds\x12(\n" + + "\x10usage_record_ids\x18\t \x03(\tR\x0eusageRecordIds\"\xc2\x01\n" + + "\vTeamSummary\x12\x17\n" + + "\ateam_id\x18\x01 \x01(\tR\x06teamId\x124\n" + + "\x16attributed_revenue_usd\x18\x02 \x01(\x01R\x14attributedRevenueUsd\x12$\n" + + "\x0etotal_cost_usd\x18\x03 \x01(\x01R\ftotalCostUsd\x12!\n" + + "\froi_multiple\x18\x04 \x01(\x01R\vroiMultiple\x12\x1b\n" + + "\tagent_ids\x18\x05 \x03(\tR\bagentIds\"\xd3\x04\n" + + "\x0fDealAttribution\x12/\n" + + "\x04deal\x18\x01 \x01(\v2\x1b.attribution.v1.DealContextR\x04deal\x12L\n" + + "\x11trace_touchpoints\x18\x02 \x03(\v2\x1f.attribution.v1.TraceTouchpointR\x10traceTouchpoints\x12L\n" + + "\x11usage_touchpoints\x18\x03 \x03(\v2\x1f.attribution.v1.UsageTouchpointR\x10usageTouchpoints\x12E\n" + + "\x0fagent_summaries\x18\x04 \x03(\v2\x1c.attribution.v1.AgentSummaryR\x0eagentSummaries\x12B\n" + + "\x0eteam_summaries\x18\x05 \x03(\v2\x1b.attribution.v1.TeamSummaryR\rteamSummaries\x12?\n" + + "\x1ctotal_attributed_revenue_usd\x18\x06 \x01(\x01R\x19totalAttributedRevenueUsd\x129\n" + + "\x19total_attributed_cost_usd\x18\a \x01(\x01R\x16totalAttributedCostUsd\x128\n" + + "\x18unattributed_revenue_usd\x18\b \x01(\x01R\x16unattributedRevenueUsd\x122\n" + + "\x15unattributed_cost_usd\x18\t \x01(\x01R\x13unattributedCostUsd\"\xdc\x02\n" + + "\x11AttributionReport\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x126\n" + + "\x05query\x18\x02 \x01(\v2 .attribution.v1.AttributionQueryR\x05query\x12=\n" + + "\fgenerated_at\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\vgeneratedAt\x125\n" + + "\x05deals\x18\x04 \x03(\v2\x1f.attribution.v1.DealAttributionR\x05deals\x12E\n" + + "\x0fagent_summaries\x18\x05 \x03(\v2\x1c.attribution.v1.AgentSummaryR\x0eagentSummaries\x12B\n" + + "\x0eteam_summaries\x18\x06 \x03(\v2\x1b.attribution.v1.TeamSummaryR\rteamSummaries\"O\n" + + "\x15GenerateReportRequest\x126\n" + + "\x05query\x18\x01 \x01(\v2 .attribution.v1.AttributionQueryR\x05query\"S\n" + + "\x16GenerateReportResponse\x129\n" + + "\x06report\x18\x01 \x01(\v2!.attribution.v1.AttributionReportR\x06report\"/\n" + + "\x10GetReportRequest\x12\x1b\n" + + "\treport_id\x18\x01 \x01(\tR\breportId\"N\n" + + "\x11GetReportResponse\x129\n" + + "\x06report\x18\x01 \x01(\v2!.attribution.v1.AttributionReportR\x06report\"\x89\x01\n" + + "\x13ExportReportRequest\x126\n" + + "\x05query\x18\x01 \x01(\v2 .attribution.v1.AttributionQueryR\x05query\x12:\n" + + "\x06format\x18\x02 \x01(\x0e2\".attribution.v1.ReportExportFormatR\x06format\"o\n" + + "\x14ExportReportResponse\x12\x18\n" + + "\acontent\x18\x01 \x01(\fR\acontent\x12!\n" + + "\fcontent_type\x18\x02 \x01(\tR\vcontentType\x12\x1a\n" + + "\bfilename\x18\x03 \x01(\tR\bfilename*\x95\x01\n" + + "\x10AttributionModel\x12!\n" + + "\x1dATTRIBUTION_MODEL_UNSPECIFIED\x10\x00\x12\x1c\n" + + "\x18ATTRIBUTION_MODEL_DIRECT\x10\x01\x12\x1e\n" + + "\x1aATTRIBUTION_MODEL_ASSISTED\x10\x02\x12 \n" + + "\x1cATTRIBUTION_MODEL_INFLUENCED\x10\x03*w\n" + + "\x12ReportExportFormat\x12$\n" + + " REPORT_EXPORT_FORMAT_UNSPECIFIED\x10\x00\x12\x1d\n" + + "\x19REPORT_EXPORT_FORMAT_JSON\x10\x01\x12\x1c\n" + + "\x18REPORT_EXPORT_FORMAT_CSV\x10\x022\xa2\x02\n" + + "\x12AttributionService\x12_\n" + + "\x0eGenerateReport\x12%.attribution.v1.GenerateReportRequest\x1a&.attribution.v1.GenerateReportResponse\x12P\n" + + "\tGetReport\x12 .attribution.v1.GetReportRequest\x1a!.attribution.v1.GetReportResponse\x12Y\n" + + "\fExportReport\x12#.attribution.v1.ExportReportRequest\x1a$.attribution.v1.ExportReportResponseB>Z attribution.v1.AttributionModel + 16, // 1: attribution.v1.AttributionQuery.start_time:type_name -> google.protobuf.Timestamp + 16, // 2: attribution.v1.AttributionQuery.end_time:type_name -> google.protobuf.Timestamp + 16, // 3: attribution.v1.DealContext.created_at:type_name -> google.protobuf.Timestamp + 16, // 4: attribution.v1.DealContext.updated_at:type_name -> google.protobuf.Timestamp + 17, // 5: attribution.v1.TraceTouchpoint.trace:type_name -> traces.v1.TraceSummary + 16, // 6: attribution.v1.UsageTouchpoint.observed_at:type_name -> google.protobuf.Timestamp + 3, // 7: attribution.v1.DealAttribution.deal:type_name -> attribution.v1.DealContext + 4, // 8: attribution.v1.DealAttribution.trace_touchpoints:type_name -> attribution.v1.TraceTouchpoint + 5, // 9: attribution.v1.DealAttribution.usage_touchpoints:type_name -> attribution.v1.UsageTouchpoint + 6, // 10: attribution.v1.DealAttribution.agent_summaries:type_name -> attribution.v1.AgentSummary + 7, // 11: attribution.v1.DealAttribution.team_summaries:type_name -> attribution.v1.TeamSummary + 2, // 12: attribution.v1.AttributionReport.query:type_name -> attribution.v1.AttributionQuery + 16, // 13: attribution.v1.AttributionReport.generated_at:type_name -> google.protobuf.Timestamp + 8, // 14: attribution.v1.AttributionReport.deals:type_name -> attribution.v1.DealAttribution + 6, // 15: attribution.v1.AttributionReport.agent_summaries:type_name -> attribution.v1.AgentSummary + 7, // 16: attribution.v1.AttributionReport.team_summaries:type_name -> attribution.v1.TeamSummary + 2, // 17: attribution.v1.GenerateReportRequest.query:type_name -> attribution.v1.AttributionQuery + 9, // 18: attribution.v1.GenerateReportResponse.report:type_name -> attribution.v1.AttributionReport + 9, // 19: attribution.v1.GetReportResponse.report:type_name -> attribution.v1.AttributionReport + 2, // 20: attribution.v1.ExportReportRequest.query:type_name -> attribution.v1.AttributionQuery + 1, // 21: attribution.v1.ExportReportRequest.format:type_name -> attribution.v1.ReportExportFormat + 10, // 22: attribution.v1.AttributionService.GenerateReport:input_type -> attribution.v1.GenerateReportRequest + 12, // 23: attribution.v1.AttributionService.GetReport:input_type -> attribution.v1.GetReportRequest + 14, // 24: attribution.v1.AttributionService.ExportReport:input_type -> attribution.v1.ExportReportRequest + 11, // 25: attribution.v1.AttributionService.GenerateReport:output_type -> attribution.v1.GenerateReportResponse + 13, // 26: attribution.v1.AttributionService.GetReport:output_type -> attribution.v1.GetReportResponse + 15, // 27: attribution.v1.AttributionService.ExportReport:output_type -> attribution.v1.ExportReportResponse + 25, // [25:28] is the sub-list for method output_type + 22, // [22:25] is the sub-list for method input_type + 22, // [22:22] is the sub-list for extension type_name + 22, // [22:22] is the sub-list for extension extendee + 0, // [0:22] is the sub-list for field type_name +} + +func init() { file_attribution_v1_attribution_proto_init() } +func file_attribution_v1_attribution_proto_init() { + if File_attribution_v1_attribution_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_attribution_v1_attribution_proto_rawDesc), len(file_attribution_v1_attribution_proto_rawDesc)), + NumEnums: 2, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_attribution_v1_attribution_proto_goTypes, + DependencyIndexes: file_attribution_v1_attribution_proto_depIdxs, + EnumInfos: file_attribution_v1_attribution_proto_enumTypes, + MessageInfos: file_attribution_v1_attribution_proto_msgTypes, + }.Build() + File_attribution_v1_attribution_proto = out.File + file_attribution_v1_attribution_proto_goTypes = nil + file_attribution_v1_attribution_proto_depIdxs = nil +} diff --git a/gen/go/attribution/v1/attributionv1connect/attribution.connect.go b/gen/go/attribution/v1/attributionv1connect/attribution.connect.go new file mode 100644 index 0000000..bc89357 --- /dev/null +++ b/gen/go/attribution/v1/attributionv1connect/attribution.connect.go @@ -0,0 +1,167 @@ +// Code generated by protoc-gen-connect-go. DO NOT EDIT. +// +// Source: attribution/v1/attribution.proto + +package attributionv1connect + +import ( + connect "connectrpc.com/connect" + context "context" + errors "errors" + v1 "github.com/evalops/proto/gen/go/attribution/v1" + http "net/http" + strings "strings" +) + +// This is a compile-time assertion to ensure that this generated file and the connect package are +// compatible. If you get a compiler error that this constant is not defined, this code was +// generated with a version of connect newer than the one compiled into your binary. You can fix the +// problem by either regenerating this code with an older version of connect or updating the connect +// version compiled into your binary. +const _ = connect.IsAtLeastVersion1_13_0 + +const ( + // AttributionServiceName is the fully-qualified name of the AttributionService service. + AttributionServiceName = "attribution.v1.AttributionService" +) + +// These constants are the fully-qualified names of the RPCs defined in this package. They're +// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route. +// +// Note that these are different from the fully-qualified method names used by +// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to +// reflection-formatted method names, remove the leading slash and convert the remaining slash to a +// period. +const ( + // AttributionServiceGenerateReportProcedure is the fully-qualified name of the AttributionService's + // GenerateReport RPC. + AttributionServiceGenerateReportProcedure = "/attribution.v1.AttributionService/GenerateReport" + // AttributionServiceGetReportProcedure is the fully-qualified name of the AttributionService's + // GetReport RPC. + AttributionServiceGetReportProcedure = "/attribution.v1.AttributionService/GetReport" + // AttributionServiceExportReportProcedure is the fully-qualified name of the AttributionService's + // ExportReport RPC. + AttributionServiceExportReportProcedure = "/attribution.v1.AttributionService/ExportReport" +) + +// AttributionServiceClient is a client for the attribution.v1.AttributionService service. +type AttributionServiceClient interface { + GenerateReport(context.Context, *connect.Request[v1.GenerateReportRequest]) (*connect.Response[v1.GenerateReportResponse], error) + GetReport(context.Context, *connect.Request[v1.GetReportRequest]) (*connect.Response[v1.GetReportResponse], error) + ExportReport(context.Context, *connect.Request[v1.ExportReportRequest]) (*connect.Response[v1.ExportReportResponse], error) +} + +// NewAttributionServiceClient constructs a client for the attribution.v1.AttributionService +// service. By default, it uses the Connect protocol with the binary Protobuf Codec, asks for +// gzipped responses, and sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply +// the connect.WithGRPC() or connect.WithGRPCWeb() options. +// +// The URL supplied here should be the base URL for the Connect or gRPC server (for example, +// http://api.acme.com or https://acme.com/grpc). +func NewAttributionServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) AttributionServiceClient { + baseURL = strings.TrimRight(baseURL, "/") + attributionServiceMethods := v1.File_attribution_v1_attribution_proto.Services().ByName("AttributionService").Methods() + return &attributionServiceClient{ + generateReport: connect.NewClient[v1.GenerateReportRequest, v1.GenerateReportResponse]( + httpClient, + baseURL+AttributionServiceGenerateReportProcedure, + connect.WithSchema(attributionServiceMethods.ByName("GenerateReport")), + connect.WithClientOptions(opts...), + ), + getReport: connect.NewClient[v1.GetReportRequest, v1.GetReportResponse]( + httpClient, + baseURL+AttributionServiceGetReportProcedure, + connect.WithSchema(attributionServiceMethods.ByName("GetReport")), + connect.WithClientOptions(opts...), + ), + exportReport: connect.NewClient[v1.ExportReportRequest, v1.ExportReportResponse]( + httpClient, + baseURL+AttributionServiceExportReportProcedure, + connect.WithSchema(attributionServiceMethods.ByName("ExportReport")), + connect.WithClientOptions(opts...), + ), + } +} + +// attributionServiceClient implements AttributionServiceClient. +type attributionServiceClient struct { + generateReport *connect.Client[v1.GenerateReportRequest, v1.GenerateReportResponse] + getReport *connect.Client[v1.GetReportRequest, v1.GetReportResponse] + exportReport *connect.Client[v1.ExportReportRequest, v1.ExportReportResponse] +} + +// GenerateReport calls attribution.v1.AttributionService.GenerateReport. +func (c *attributionServiceClient) GenerateReport(ctx context.Context, req *connect.Request[v1.GenerateReportRequest]) (*connect.Response[v1.GenerateReportResponse], error) { + return c.generateReport.CallUnary(ctx, req) +} + +// GetReport calls attribution.v1.AttributionService.GetReport. +func (c *attributionServiceClient) GetReport(ctx context.Context, req *connect.Request[v1.GetReportRequest]) (*connect.Response[v1.GetReportResponse], error) { + return c.getReport.CallUnary(ctx, req) +} + +// ExportReport calls attribution.v1.AttributionService.ExportReport. +func (c *attributionServiceClient) ExportReport(ctx context.Context, req *connect.Request[v1.ExportReportRequest]) (*connect.Response[v1.ExportReportResponse], error) { + return c.exportReport.CallUnary(ctx, req) +} + +// AttributionServiceHandler is an implementation of the attribution.v1.AttributionService service. +type AttributionServiceHandler interface { + GenerateReport(context.Context, *connect.Request[v1.GenerateReportRequest]) (*connect.Response[v1.GenerateReportResponse], error) + GetReport(context.Context, *connect.Request[v1.GetReportRequest]) (*connect.Response[v1.GetReportResponse], error) + ExportReport(context.Context, *connect.Request[v1.ExportReportRequest]) (*connect.Response[v1.ExportReportResponse], error) +} + +// NewAttributionServiceHandler builds an HTTP handler from the service implementation. It returns +// the path on which to mount the handler and the handler itself. +// +// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf +// and JSON codecs. They also support gzip compression. +func NewAttributionServiceHandler(svc AttributionServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { + attributionServiceMethods := v1.File_attribution_v1_attribution_proto.Services().ByName("AttributionService").Methods() + attributionServiceGenerateReportHandler := connect.NewUnaryHandler( + AttributionServiceGenerateReportProcedure, + svc.GenerateReport, + connect.WithSchema(attributionServiceMethods.ByName("GenerateReport")), + connect.WithHandlerOptions(opts...), + ) + attributionServiceGetReportHandler := connect.NewUnaryHandler( + AttributionServiceGetReportProcedure, + svc.GetReport, + connect.WithSchema(attributionServiceMethods.ByName("GetReport")), + connect.WithHandlerOptions(opts...), + ) + attributionServiceExportReportHandler := connect.NewUnaryHandler( + AttributionServiceExportReportProcedure, + svc.ExportReport, + connect.WithSchema(attributionServiceMethods.ByName("ExportReport")), + connect.WithHandlerOptions(opts...), + ) + return "/attribution.v1.AttributionService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case AttributionServiceGenerateReportProcedure: + attributionServiceGenerateReportHandler.ServeHTTP(w, r) + case AttributionServiceGetReportProcedure: + attributionServiceGetReportHandler.ServeHTTP(w, r) + case AttributionServiceExportReportProcedure: + attributionServiceExportReportHandler.ServeHTTP(w, r) + default: + http.NotFound(w, r) + } + }) +} + +// UnimplementedAttributionServiceHandler returns CodeUnimplemented from all methods. +type UnimplementedAttributionServiceHandler struct{} + +func (UnimplementedAttributionServiceHandler) GenerateReport(context.Context, *connect.Request[v1.GenerateReportRequest]) (*connect.Response[v1.GenerateReportResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("attribution.v1.AttributionService.GenerateReport is not implemented")) +} + +func (UnimplementedAttributionServiceHandler) GetReport(context.Context, *connect.Request[v1.GetReportRequest]) (*connect.Response[v1.GetReportResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("attribution.v1.AttributionService.GetReport is not implemented")) +} + +func (UnimplementedAttributionServiceHandler) ExportReport(context.Context, *connect.Request[v1.ExportReportRequest]) (*connect.Response[v1.ExportReportResponse], error) { + return nil, connect.NewError(connect.CodeUnimplemented, errors.New("attribution.v1.AttributionService.ExportReport is not implemented")) +} diff --git a/gen/python/attribution/v1/attribution_pb2.py b/gen/python/attribution/v1/attribution_pb2.py new file mode 100644 index 0000000..276b645 --- /dev/null +++ b/gen/python/attribution/v1/attribution_pb2.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: attribution/v1/attribution.proto +# Protobuf Python Version: 7.34.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 7, + 34, + 1, + '', + 'attribution/v1/attribution.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from traces.v1 import traces_pb2 as traces_dot_v1_dot_traces__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n attribution/v1/attribution.proto\x12\x0e\x61ttribution.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16traces/v1/traces.proto\"\xd5\x02\n\x10\x41ttributionQuery\x12!\n\x0cworkspace_id\x18\x01 \x01(\tR\x0bworkspaceId\x12\'\n\x0forganization_id\x18\x02 \x01(\tR\x0eorganizationId\x12\x19\n\x08\x64\x65\x61l_ids\x18\x03 \x03(\tR\x07\x64\x65\x61lIds\x12\x36\n\x05model\x18\x04 \x01(\x0e\x32 .attribution.v1.AttributionModelR\x05model\x12\x39\n\nstart_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tstartTime\x12\x35\n\x08\x65nd_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x65ndTime\x12\x30\n\x14include_team_rollups\x18\x07 \x01(\x08R\x12includeTeamRollups\"\xd3\x02\n\x0b\x44\x65\x61lContext\x12\x17\n\x07\x64\x65\x61l_id\x18\x01 \x01(\tR\x06\x64\x65\x61lId\x12\x14\n\x05title\x18\x02 \x01(\tR\x05title\x12\x14\n\x05stage\x18\x03 \x01(\tR\x05stage\x12\x14\n\x05value\x18\x04 \x01(\x01R\x05value\x12\x1a\n\x08\x63urrency\x18\x05 \x01(\tR\x08\x63urrency\x12\x19\n\x08owner_id\x18\x06 \x01(\tR\x07ownerId\x12\x1d\n\ncontact_id\x18\x07 \x01(\tR\tcontactId\x12\x1d\n\ncompany_id\x18\x08 \x01(\tR\tcompanyId\x12\x39\n\ncreated_at\x18\t \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\"e\n\x0fTraceTouchpoint\x12-\n\x05trace\x18\x01 \x01(\x0b\x32\x17.traces.v1.TraceSummaryR\x05trace\x12#\n\rmatch_reasons\x18\x02 \x03(\tR\x0cmatchReasons\"\xf8\x02\n\x0fUsageTouchpoint\x12\x1b\n\trecord_id\x18\x01 \x01(\tR\x08recordId\x12\x1d\n\nrequest_id\x18\x02 \x01(\tR\trequestId\x12\x19\n\x08\x61gent_id\x18\x03 \x01(\tR\x07\x61gentId\x12\x17\n\x07team_id\x18\x04 \x01(\tR\x06teamId\x12\x18\n\x07surface\x18\x05 \x01(\tR\x07surface\x12\x14\n\x05model\x18\x06 \x01(\tR\x05model\x12\x1a\n\x08provider\x18\x07 \x01(\tR\x08provider\x12!\n\x0cinput_tokens\x18\x08 \x01(\x03R\x0binputTokens\x12#\n\routput_tokens\x18\t \x01(\x03R\x0coutputTokens\x12$\n\x0etotal_cost_usd\x18\n \x01(\x01R\x0ctotalCostUsd\x12;\n\x0bobserved_at\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampR\nobservedAt\"\xe0\x02\n\x0c\x41gentSummary\x12\x19\n\x08\x61gent_id\x18\x01 \x01(\tR\x07\x61gentId\x12-\n\x12\x61ttribution_weight\x18\x02 \x01(\x01R\x11\x61ttributionWeight\x12\x34\n\x16\x61ttributed_revenue_usd\x18\x03 \x01(\x01R\x14\x61ttributedRevenueUsd\x12$\n\x0etotal_cost_usd\x18\x04 \x01(\x01R\x0ctotalCostUsd\x12!\n\x0croi_multiple\x18\x05 \x01(\x01R\x0broiMultiple\x12\x1f\n\x0btrace_count\x18\x06 \x01(\x05R\ntraceCount\x12\x1f\n\x0busage_count\x18\x07 \x01(\x05R\nusageCount\x12\x1b\n\ttrace_ids\x18\x08 \x03(\tR\x08traceIds\x12(\n\x10usage_record_ids\x18\t \x03(\tR\x0eusageRecordIds\"\xc2\x01\n\x0bTeamSummary\x12\x17\n\x07team_id\x18\x01 \x01(\tR\x06teamId\x12\x34\n\x16\x61ttributed_revenue_usd\x18\x02 \x01(\x01R\x14\x61ttributedRevenueUsd\x12$\n\x0etotal_cost_usd\x18\x03 \x01(\x01R\x0ctotalCostUsd\x12!\n\x0croi_multiple\x18\x04 \x01(\x01R\x0broiMultiple\x12\x1b\n\tagent_ids\x18\x05 \x03(\tR\x08\x61gentIds\"\xd3\x04\n\x0f\x44\x65\x61lAttribution\x12/\n\x04\x64\x65\x61l\x18\x01 \x01(\x0b\x32\x1b.attribution.v1.DealContextR\x04\x64\x65\x61l\x12L\n\x11trace_touchpoints\x18\x02 \x03(\x0b\x32\x1f.attribution.v1.TraceTouchpointR\x10traceTouchpoints\x12L\n\x11usage_touchpoints\x18\x03 \x03(\x0b\x32\x1f.attribution.v1.UsageTouchpointR\x10usageTouchpoints\x12\x45\n\x0f\x61gent_summaries\x18\x04 \x03(\x0b\x32\x1c.attribution.v1.AgentSummaryR\x0e\x61gentSummaries\x12\x42\n\x0eteam_summaries\x18\x05 \x03(\x0b\x32\x1b.attribution.v1.TeamSummaryR\rteamSummaries\x12?\n\x1ctotal_attributed_revenue_usd\x18\x06 \x01(\x01R\x19totalAttributedRevenueUsd\x12\x39\n\x19total_attributed_cost_usd\x18\x07 \x01(\x01R\x16totalAttributedCostUsd\x12\x38\n\x18unattributed_revenue_usd\x18\x08 \x01(\x01R\x16unattributedRevenueUsd\x12\x32\n\x15unattributed_cost_usd\x18\t \x01(\x01R\x13unattributedCostUsd\"\xdc\x02\n\x11\x41ttributionReport\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x36\n\x05query\x18\x02 \x01(\x0b\x32 .attribution.v1.AttributionQueryR\x05query\x12=\n\x0cgenerated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0bgeneratedAt\x12\x35\n\x05\x64\x65\x61ls\x18\x04 \x03(\x0b\x32\x1f.attribution.v1.DealAttributionR\x05\x64\x65\x61ls\x12\x45\n\x0f\x61gent_summaries\x18\x05 \x03(\x0b\x32\x1c.attribution.v1.AgentSummaryR\x0e\x61gentSummaries\x12\x42\n\x0eteam_summaries\x18\x06 \x03(\x0b\x32\x1b.attribution.v1.TeamSummaryR\rteamSummaries\"O\n\x15GenerateReportRequest\x12\x36\n\x05query\x18\x01 \x01(\x0b\x32 .attribution.v1.AttributionQueryR\x05query\"S\n\x16GenerateReportResponse\x12\x39\n\x06report\x18\x01 \x01(\x0b\x32!.attribution.v1.AttributionReportR\x06report\"/\n\x10GetReportRequest\x12\x1b\n\treport_id\x18\x01 \x01(\tR\x08reportId\"N\n\x11GetReportResponse\x12\x39\n\x06report\x18\x01 \x01(\x0b\x32!.attribution.v1.AttributionReportR\x06report\"\x89\x01\n\x13\x45xportReportRequest\x12\x36\n\x05query\x18\x01 \x01(\x0b\x32 .attribution.v1.AttributionQueryR\x05query\x12:\n\x06\x66ormat\x18\x02 \x01(\x0e\x32\".attribution.v1.ReportExportFormatR\x06\x66ormat\"o\n\x14\x45xportReportResponse\x12\x18\n\x07\x63ontent\x18\x01 \x01(\x0cR\x07\x63ontent\x12!\n\x0c\x63ontent_type\x18\x02 \x01(\tR\x0b\x63ontentType\x12\x1a\n\x08\x66ilename\x18\x03 \x01(\tR\x08\x66ilename*\x95\x01\n\x10\x41ttributionModel\x12!\n\x1d\x41TTRIBUTION_MODEL_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x41TTRIBUTION_MODEL_DIRECT\x10\x01\x12\x1e\n\x1a\x41TTRIBUTION_MODEL_ASSISTED\x10\x02\x12 \n\x1c\x41TTRIBUTION_MODEL_INFLUENCED\x10\x03*w\n\x12ReportExportFormat\x12$\n REPORT_EXPORT_FORMAT_UNSPECIFIED\x10\x00\x12\x1d\n\x19REPORT_EXPORT_FORMAT_JSON\x10\x01\x12\x1c\n\x18REPORT_EXPORT_FORMAT_CSV\x10\x02\x32\xa2\x02\n\x12\x41ttributionService\x12_\n\x0eGenerateReport\x12%.attribution.v1.GenerateReportRequest\x1a&.attribution.v1.GenerateReportResponse\x12P\n\tGetReport\x12 .attribution.v1.GetReportRequest\x1a!.attribution.v1.GetReportResponse\x12Y\n\x0c\x45xportReport\x12#.attribution.v1.ExportReportRequest\x1a$.attribution.v1.ExportReportResponseB>Z & { + /** + * @generated from field: string workspace_id = 1; + */ + workspaceId: string; + + /** + * @generated from field: string organization_id = 2; + */ + organizationId: string; + + /** + * @generated from field: repeated string deal_ids = 3; + */ + dealIds: string[]; + + /** + * @generated from field: attribution.v1.AttributionModel model = 4; + */ + model: AttributionModel; + + /** + * @generated from field: google.protobuf.Timestamp start_time = 5; + */ + startTime?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp end_time = 6; + */ + endTime?: Timestamp; + + /** + * @generated from field: bool include_team_rollups = 7; + */ + includeTeamRollups: boolean; +}; + +/** + * Describes the message attribution.v1.AttributionQuery. + * Use `create(AttributionQuerySchema)` to create a new message. + */ +export const AttributionQuerySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 0); + +/** + * @generated from message attribution.v1.DealContext + */ +export type DealContext = Message<"attribution.v1.DealContext"> & { + /** + * @generated from field: string deal_id = 1; + */ + dealId: string; + + /** + * @generated from field: string title = 2; + */ + title: string; + + /** + * @generated from field: string stage = 3; + */ + stage: string; + + /** + * @generated from field: double value = 4; + */ + value: number; + + /** + * @generated from field: string currency = 5; + */ + currency: string; + + /** + * @generated from field: string owner_id = 6; + */ + ownerId: string; + + /** + * @generated from field: string contact_id = 7; + */ + contactId: string; + + /** + * @generated from field: string company_id = 8; + */ + companyId: string; + + /** + * @generated from field: google.protobuf.Timestamp created_at = 9; + */ + createdAt?: Timestamp; + + /** + * @generated from field: google.protobuf.Timestamp updated_at = 10; + */ + updatedAt?: Timestamp; +}; + +/** + * Describes the message attribution.v1.DealContext. + * Use `create(DealContextSchema)` to create a new message. + */ +export const DealContextSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 1); + +/** + * @generated from message attribution.v1.TraceTouchpoint + */ +export type TraceTouchpoint = Message<"attribution.v1.TraceTouchpoint"> & { + /** + * @generated from field: traces.v1.TraceSummary trace = 1; + */ + trace?: TraceSummary; + + /** + * @generated from field: repeated string match_reasons = 2; + */ + matchReasons: string[]; +}; + +/** + * Describes the message attribution.v1.TraceTouchpoint. + * Use `create(TraceTouchpointSchema)` to create a new message. + */ +export const TraceTouchpointSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 2); + +/** + * @generated from message attribution.v1.UsageTouchpoint + */ +export type UsageTouchpoint = Message<"attribution.v1.UsageTouchpoint"> & { + /** + * @generated from field: string record_id = 1; + */ + recordId: string; + + /** + * @generated from field: string request_id = 2; + */ + requestId: string; + + /** + * @generated from field: string agent_id = 3; + */ + agentId: string; + + /** + * @generated from field: string team_id = 4; + */ + teamId: string; + + /** + * @generated from field: string surface = 5; + */ + surface: string; + + /** + * @generated from field: string model = 6; + */ + model: string; + + /** + * @generated from field: string provider = 7; + */ + provider: string; + + /** + * @generated from field: int64 input_tokens = 8; + */ + inputTokens: bigint; + + /** + * @generated from field: int64 output_tokens = 9; + */ + outputTokens: bigint; + + /** + * @generated from field: double total_cost_usd = 10; + */ + totalCostUsd: number; + + /** + * @generated from field: google.protobuf.Timestamp observed_at = 11; + */ + observedAt?: Timestamp; +}; + +/** + * Describes the message attribution.v1.UsageTouchpoint. + * Use `create(UsageTouchpointSchema)` to create a new message. + */ +export const UsageTouchpointSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 3); + +/** + * @generated from message attribution.v1.AgentSummary + */ +export type AgentSummary = Message<"attribution.v1.AgentSummary"> & { + /** + * @generated from field: string agent_id = 1; + */ + agentId: string; + + /** + * @generated from field: double attribution_weight = 2; + */ + attributionWeight: number; + + /** + * @generated from field: double attributed_revenue_usd = 3; + */ + attributedRevenueUsd: number; + + /** + * @generated from field: double total_cost_usd = 4; + */ + totalCostUsd: number; + + /** + * @generated from field: double roi_multiple = 5; + */ + roiMultiple: number; + + /** + * @generated from field: int32 trace_count = 6; + */ + traceCount: number; + + /** + * @generated from field: int32 usage_count = 7; + */ + usageCount: number; + + /** + * @generated from field: repeated string trace_ids = 8; + */ + traceIds: string[]; + + /** + * @generated from field: repeated string usage_record_ids = 9; + */ + usageRecordIds: string[]; +}; + +/** + * Describes the message attribution.v1.AgentSummary. + * Use `create(AgentSummarySchema)` to create a new message. + */ +export const AgentSummarySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 4); + +/** + * @generated from message attribution.v1.TeamSummary + */ +export type TeamSummary = Message<"attribution.v1.TeamSummary"> & { + /** + * @generated from field: string team_id = 1; + */ + teamId: string; + + /** + * @generated from field: double attributed_revenue_usd = 2; + */ + attributedRevenueUsd: number; + + /** + * @generated from field: double total_cost_usd = 3; + */ + totalCostUsd: number; + + /** + * @generated from field: double roi_multiple = 4; + */ + roiMultiple: number; + + /** + * @generated from field: repeated string agent_ids = 5; + */ + agentIds: string[]; +}; + +/** + * Describes the message attribution.v1.TeamSummary. + * Use `create(TeamSummarySchema)` to create a new message. + */ +export const TeamSummarySchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 5); + +/** + * @generated from message attribution.v1.DealAttribution + */ +export type DealAttribution = Message<"attribution.v1.DealAttribution"> & { + /** + * @generated from field: attribution.v1.DealContext deal = 1; + */ + deal?: DealContext; + + /** + * @generated from field: repeated attribution.v1.TraceTouchpoint trace_touchpoints = 2; + */ + traceTouchpoints: TraceTouchpoint[]; + + /** + * @generated from field: repeated attribution.v1.UsageTouchpoint usage_touchpoints = 3; + */ + usageTouchpoints: UsageTouchpoint[]; + + /** + * @generated from field: repeated attribution.v1.AgentSummary agent_summaries = 4; + */ + agentSummaries: AgentSummary[]; + + /** + * @generated from field: repeated attribution.v1.TeamSummary team_summaries = 5; + */ + teamSummaries: TeamSummary[]; + + /** + * @generated from field: double total_attributed_revenue_usd = 6; + */ + totalAttributedRevenueUsd: number; + + /** + * @generated from field: double total_attributed_cost_usd = 7; + */ + totalAttributedCostUsd: number; + + /** + * @generated from field: double unattributed_revenue_usd = 8; + */ + unattributedRevenueUsd: number; + + /** + * @generated from field: double unattributed_cost_usd = 9; + */ + unattributedCostUsd: number; +}; + +/** + * Describes the message attribution.v1.DealAttribution. + * Use `create(DealAttributionSchema)` to create a new message. + */ +export const DealAttributionSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 6); + +/** + * @generated from message attribution.v1.AttributionReport + */ +export type AttributionReport = Message<"attribution.v1.AttributionReport"> & { + /** + * @generated from field: string id = 1; + */ + id: string; + + /** + * @generated from field: attribution.v1.AttributionQuery query = 2; + */ + query?: AttributionQuery; + + /** + * @generated from field: google.protobuf.Timestamp generated_at = 3; + */ + generatedAt?: Timestamp; + + /** + * @generated from field: repeated attribution.v1.DealAttribution deals = 4; + */ + deals: DealAttribution[]; + + /** + * @generated from field: repeated attribution.v1.AgentSummary agent_summaries = 5; + */ + agentSummaries: AgentSummary[]; + + /** + * @generated from field: repeated attribution.v1.TeamSummary team_summaries = 6; + */ + teamSummaries: TeamSummary[]; +}; + +/** + * Describes the message attribution.v1.AttributionReport. + * Use `create(AttributionReportSchema)` to create a new message. + */ +export const AttributionReportSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 7); + +/** + * @generated from message attribution.v1.GenerateReportRequest + */ +export type GenerateReportRequest = Message<"attribution.v1.GenerateReportRequest"> & { + /** + * @generated from field: attribution.v1.AttributionQuery query = 1; + */ + query?: AttributionQuery; +}; + +/** + * Describes the message attribution.v1.GenerateReportRequest. + * Use `create(GenerateReportRequestSchema)` to create a new message. + */ +export const GenerateReportRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 8); + +/** + * @generated from message attribution.v1.GenerateReportResponse + */ +export type GenerateReportResponse = Message<"attribution.v1.GenerateReportResponse"> & { + /** + * @generated from field: attribution.v1.AttributionReport report = 1; + */ + report?: AttributionReport; +}; + +/** + * Describes the message attribution.v1.GenerateReportResponse. + * Use `create(GenerateReportResponseSchema)` to create a new message. + */ +export const GenerateReportResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 9); + +/** + * @generated from message attribution.v1.GetReportRequest + */ +export type GetReportRequest = Message<"attribution.v1.GetReportRequest"> & { + /** + * @generated from field: string report_id = 1; + */ + reportId: string; +}; + +/** + * Describes the message attribution.v1.GetReportRequest. + * Use `create(GetReportRequestSchema)` to create a new message. + */ +export const GetReportRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 10); + +/** + * @generated from message attribution.v1.GetReportResponse + */ +export type GetReportResponse = Message<"attribution.v1.GetReportResponse"> & { + /** + * @generated from field: attribution.v1.AttributionReport report = 1; + */ + report?: AttributionReport; +}; + +/** + * Describes the message attribution.v1.GetReportResponse. + * Use `create(GetReportResponseSchema)` to create a new message. + */ +export const GetReportResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 11); + +/** + * @generated from message attribution.v1.ExportReportRequest + */ +export type ExportReportRequest = Message<"attribution.v1.ExportReportRequest"> & { + /** + * @generated from field: attribution.v1.AttributionQuery query = 1; + */ + query?: AttributionQuery; + + /** + * @generated from field: attribution.v1.ReportExportFormat format = 2; + */ + format: ReportExportFormat; +}; + +/** + * Describes the message attribution.v1.ExportReportRequest. + * Use `create(ExportReportRequestSchema)` to create a new message. + */ +export const ExportReportRequestSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 12); + +/** + * @generated from message attribution.v1.ExportReportResponse + */ +export type ExportReportResponse = Message<"attribution.v1.ExportReportResponse"> & { + /** + * @generated from field: bytes content = 1; + */ + content: Uint8Array; + + /** + * @generated from field: string content_type = 2; + */ + contentType: string; + + /** + * @generated from field: string filename = 3; + */ + filename: string; +}; + +/** + * Describes the message attribution.v1.ExportReportResponse. + * Use `create(ExportReportResponseSchema)` to create a new message. + */ +export const ExportReportResponseSchema: GenMessage = /*@__PURE__*/ + messageDesc(file_attribution_v1_attribution, 13); + +/** + * @generated from enum attribution.v1.AttributionModel + */ +export enum AttributionModel { + /** + * @generated from enum value: ATTRIBUTION_MODEL_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: ATTRIBUTION_MODEL_DIRECT = 1; + */ + DIRECT = 1, + + /** + * @generated from enum value: ATTRIBUTION_MODEL_ASSISTED = 2; + */ + ASSISTED = 2, + + /** + * @generated from enum value: ATTRIBUTION_MODEL_INFLUENCED = 3; + */ + INFLUENCED = 3, +} + +/** + * Describes the enum attribution.v1.AttributionModel. + */ +export const AttributionModelSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_attribution_v1_attribution, 0); + +/** + * @generated from enum attribution.v1.ReportExportFormat + */ +export enum ReportExportFormat { + /** + * @generated from enum value: REPORT_EXPORT_FORMAT_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: REPORT_EXPORT_FORMAT_JSON = 1; + */ + JSON = 1, + + /** + * @generated from enum value: REPORT_EXPORT_FORMAT_CSV = 2; + */ + CSV = 2, +} + +/** + * Describes the enum attribution.v1.ReportExportFormat. + */ +export const ReportExportFormatSchema: GenEnum = /*@__PURE__*/ + enumDesc(file_attribution_v1_attribution, 1); + +/** + * AttributionService computes revenue attribution and ROI across traces and usage. + * + * @generated from service attribution.v1.AttributionService + */ +export const AttributionService: GenService<{ + /** + * @generated from rpc attribution.v1.AttributionService.GenerateReport + */ + generateReport: { + methodKind: "unary"; + input: typeof GenerateReportRequestSchema; + output: typeof GenerateReportResponseSchema; + }, + /** + * @generated from rpc attribution.v1.AttributionService.GetReport + */ + getReport: { + methodKind: "unary"; + input: typeof GetReportRequestSchema; + output: typeof GetReportResponseSchema; + }, + /** + * @generated from rpc attribution.v1.AttributionService.ExportReport + */ + exportReport: { + methodKind: "unary"; + input: typeof ExportReportRequestSchema; + output: typeof ExportReportResponseSchema; + }, +}> = /*@__PURE__*/ + serviceDesc(file_attribution_v1_attribution, 0); + diff --git a/package.json b/package.json index c9d3859..dd661e5 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,10 @@ "types": "./gen/dist/agents/v1/agents_pb.d.ts", "import": "./gen/dist/agents/v1/agents_pb.js" }, + "./attribution/v1/attribution_pb": { + "types": "./gen/dist/attribution/v1/attribution_pb.d.ts", + "import": "./gen/dist/attribution/v1/attribution_pb.js" + }, "./approvals/v1/approvals_pb": { "types": "./gen/dist/approvals/v1/approvals_pb.d.ts", "import": "./gen/dist/approvals/v1/approvals_pb.js" diff --git a/proto/attribution/v1/attribution.proto b/proto/attribution/v1/attribution.proto new file mode 100644 index 0000000..9299779 --- /dev/null +++ b/proto/attribution/v1/attribution.proto @@ -0,0 +1,138 @@ +syntax = "proto3"; + +package attribution.v1; + +option go_package = "github.com/evalops/proto/gen/go/attribution/v1;attributionv1"; + +import "google/protobuf/timestamp.proto"; +import "traces/v1/traces.proto"; + +// AttributionService computes revenue attribution and ROI across traces and usage. +service AttributionService { + rpc GenerateReport(GenerateReportRequest) returns (GenerateReportResponse); + rpc GetReport(GetReportRequest) returns (GetReportResponse); + rpc ExportReport(ExportReportRequest) returns (ExportReportResponse); +} + +enum AttributionModel { + ATTRIBUTION_MODEL_UNSPECIFIED = 0; + ATTRIBUTION_MODEL_DIRECT = 1; + ATTRIBUTION_MODEL_ASSISTED = 2; + ATTRIBUTION_MODEL_INFLUENCED = 3; +} + +enum ReportExportFormat { + REPORT_EXPORT_FORMAT_UNSPECIFIED = 0; + REPORT_EXPORT_FORMAT_JSON = 1; + REPORT_EXPORT_FORMAT_CSV = 2; +} + +message AttributionQuery { + string workspace_id = 1; + string organization_id = 2; + repeated string deal_ids = 3; + AttributionModel model = 4; + google.protobuf.Timestamp start_time = 5; + google.protobuf.Timestamp end_time = 6; + bool include_team_rollups = 7; +} + +message DealContext { + string deal_id = 1; + string title = 2; + string stage = 3; + double value = 4; + string currency = 5; + string owner_id = 6; + string contact_id = 7; + string company_id = 8; + google.protobuf.Timestamp created_at = 9; + google.protobuf.Timestamp updated_at = 10; +} + +message TraceTouchpoint { + traces.v1.TraceSummary trace = 1; + repeated string match_reasons = 2; +} + +message UsageTouchpoint { + string record_id = 1; + string request_id = 2; + string agent_id = 3; + string team_id = 4; + string surface = 5; + string model = 6; + string provider = 7; + int64 input_tokens = 8; + int64 output_tokens = 9; + double total_cost_usd = 10; + google.protobuf.Timestamp observed_at = 11; +} + +message AgentSummary { + string agent_id = 1; + double attribution_weight = 2; + double attributed_revenue_usd = 3; + double total_cost_usd = 4; + double roi_multiple = 5; + int32 trace_count = 6; + int32 usage_count = 7; + repeated string trace_ids = 8; + repeated string usage_record_ids = 9; +} + +message TeamSummary { + string team_id = 1; + double attributed_revenue_usd = 2; + double total_cost_usd = 3; + double roi_multiple = 4; + repeated string agent_ids = 5; +} + +message DealAttribution { + DealContext deal = 1; + repeated TraceTouchpoint trace_touchpoints = 2; + repeated UsageTouchpoint usage_touchpoints = 3; + repeated AgentSummary agent_summaries = 4; + repeated TeamSummary team_summaries = 5; + double total_attributed_revenue_usd = 6; + double total_attributed_cost_usd = 7; + double unattributed_revenue_usd = 8; + double unattributed_cost_usd = 9; +} + +message AttributionReport { + string id = 1; + AttributionQuery query = 2; + google.protobuf.Timestamp generated_at = 3; + repeated DealAttribution deals = 4; + repeated AgentSummary agent_summaries = 5; + repeated TeamSummary team_summaries = 6; +} + +message GenerateReportRequest { + AttributionQuery query = 1; +} + +message GenerateReportResponse { + AttributionReport report = 1; +} + +message GetReportRequest { + string report_id = 1; +} + +message GetReportResponse { + AttributionReport report = 1; +} + +message ExportReportRequest { + AttributionQuery query = 1; + ReportExportFormat format = 2; +} + +message ExportReportResponse { + bytes content = 1; + string content_type = 2; + string filename = 3; +}