feat(archiegateway): chat resolves models in the caller's org and bills it

The State Store answers the calling principal's org aliases
(CallerModels) and bills chat usage to that org; usage records no longer
carry a caller-named org. Chat lists and resolves aliases for the
caller's org and fails rather than substitute one it may not use.
This commit is contained in:
sam committed 2026-10-10 18:53:57 +11:00
1 parent 75b4eecfde
commit 87034535b6
14 files changed
+611 -333

No files matched your search

+34
View File
@@ -7,6 +7,7 @@ import (
"sync"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/modelcatalog"
)
@@ -20,6 +21,9 @@ type chatModelManager struct {
active string
details map[string]gateway.ModelDetails
providerNames map[string]string
// orgAliases answers the aliases the principal ctx carries may use. Nil
// serves every caller the instance aliases.
orgAliases func(ctx context.Context) (map[string]string, error)
}
func newChatModelManager(aliases map[string]string) *chatModelManager {
@@ -108,3 +112,33 @@ func (m *chatModelManager) SetActiveModel(ctx context.Context, alias string) err
m.active = alias
return nil
}
// aliasesFor is the alias table ctx's org resolves against: the instance's
// for the system org, the org's own answer otherwise.
func (m *chatModelManager) aliasesFor(ctx context.Context) (map[string]string, error) {
if m.orgAliases == nil || org.OrgFromContext(ctx) == org.DefaultOrgID {
m.mu.RLock()
defer m.mu.RUnlock()
return m.aliases, nil
}
return m.orgAliases(ctx)
}
// ModelsFor returns the aliases ctx's org may switch between.
func (m *chatModelManager) ModelsFor(ctx context.Context) ([]string, error) {
aliases, err := m.aliasesFor(ctx)
if err != nil {
return nil, err
}
return config.ChatAliases(aliases), nil
}
// ModelFor resolves the active alias in ctx's org. An org that cannot use it
// gets an error, never another model.
func (m *chatModelManager) ModelFor(ctx context.Context) (string, error) {
aliases, err := m.aliasesFor(ctx)
if err != nil {
return "", err
}
return config.ResolveModel(aliases, m.ActiveAlias(), config.PurposeChat)
}
@@ -77,6 +77,10 @@ func (b *server) setupChatRuntime(ctx context.Context, cfg config.Config, actor
b.usage = &usageSink{models: b.chatModels, log: b.log}
if b.stateStore != nil {
b.usage.store = b.stateStore
b.chatModels.orgAliases = func(ctx context.Context) (map[string]string, error) {
_, aliases, err := b.stateStore.CallerModels(ctx)
return aliases, err
}
}
b.statusHealth = newStatusHealth(b)
+3 -4
View File
@@ -7,15 +7,14 @@ import (
"github.com/samcharles93/ai-sdk/chat"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/usage"
"github.com/samcharles93/archie-core/internal/gateway"
)
const usageWriteTimeout = 5 * time.Second
// usageSink records the gateway's model calls. Chat has no org of its own
// yet, so its records belong to the system org. A nil sink records nothing.
// usageSink records the gateway's model calls. The State Store bills each to
// the org of the principal the call was made for. A nil sink records nothing.
type usageSink struct {
store usage.Recorder
models gateway.ModelManager
@@ -33,7 +32,7 @@ func (u *usageSink) record(ctx context.Context, source usage.Source, ref string,
alias = u.models.ActiveAlias()
}
record := usage.Record{
Org: storecontract.DefaultOrgID, Source: source, Alias: alias,
Source: source, Alias: alias,
InputTokens: int64(used.PromptTokens), OutputTokens: int64(used.CompletionTokens),
CachedTokens: int64(used.CachedTokens), At: time.Now().UTC(),
}.WithRef(ref)
+415 -322
View File
@@ -15369,10 +15369,9 @@ func (x *RecentLogsResponse) GetSnapshot() *v1.LogSnapshot {
}
// UsageRecord mirrors usage.Record. A task's record belongs to the task's
// org, whatever org_id says.
// org; any other belongs to the calling principal's org.
type UsageRecord struct {
state protoimpl.MessageState `protogen:"open.v1"`
OrgId string `protobuf:"bytes,1,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
// source is task, chat or curator.
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
TaskId int64 `protobuf:"varint,3,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"`
@@ -15420,13 +15419,6 @@ func (*UsageRecord) Descriptor() ([]byte, []int) {
return file_state_v1_state_proto_rawDescGZIP(), []int{285}
}
func (x *UsageRecord) GetOrgId() string {
if x != nil {
return x.OrgId
}
return ""
}
func (x *UsageRecord) GetSource() string {
if x != nil {
return x.Source
@@ -15757,6 +15749,94 @@ func (x *ModelProvider) GetApiKeyEnv() string {
return ""
}
type CallerModelsRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CallerModelsRequest) Reset() {
*x = CallerModelsRequest{}
mi := &file_state_v1_state_proto_msgTypes[291]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CallerModelsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallerModelsRequest) ProtoMessage() {}
func (x *CallerModelsRequest) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_state_proto_msgTypes[291]
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 CallerModelsRequest.ProtoReflect.Descriptor instead.
func (*CallerModelsRequest) Descriptor() ([]byte, []int) {
return file_state_v1_state_proto_rawDescGZIP(), []int{291}
}
type CallerModelsResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
OrgId string `protobuf:"bytes,1,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`
Aliases map[string]string `protobuf:"bytes,2,rep,name=aliases,proto3" json:"aliases,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *CallerModelsResponse) Reset() {
*x = CallerModelsResponse{}
mi := &file_state_v1_state_proto_msgTypes[292]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *CallerModelsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CallerModelsResponse) ProtoMessage() {}
func (x *CallerModelsResponse) ProtoReflect() protoreflect.Message {
mi := &file_state_v1_state_proto_msgTypes[292]
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 CallerModelsResponse.ProtoReflect.Descriptor instead.
func (*CallerModelsResponse) Descriptor() ([]byte, []int) {
return file_state_v1_state_proto_rawDescGZIP(), []int{292}
}
func (x *CallerModelsResponse) GetOrgId() string {
if x != nil {
return x.OrgId
}
return ""
}
func (x *CallerModelsResponse) GetAliases() map[string]string {
if x != nil {
return x.Aliases
}
return nil
}
var File_state_v1_state_proto protoreflect.FileDescriptor
const file_state_v1_state_proto_rawDesc = "" +
@@ -16758,9 +16838,8 @@ const file_state_v1_state_proto_rawDesc = "" +
"\x11RecentLogsRequest\x12*\n" +
"\x05query\x18\x01 \x01(\v2\x14.logging.v1.LogQueryR\x05query\"I\n" +
"\x12RecentLogsResponse\x123\n" +
"\bsnapshot\x18\x01 \x01(\v2\x17.logging.v1.LogSnapshotR\bsnapshot\"\x80\x03\n" +
"\vUsageRecord\x12\x15\n" +
"\x06org_id\x18\x01 \x01(\tR\x05orgId\x12\x16\n" +
"\bsnapshot\x18\x01 \x01(\v2\x17.logging.v1.LogSnapshotR\bsnapshot\"\xf7\x02\n" +
"\vUsageRecord\x12\x16\n" +
"\x06source\x18\x02 \x01(\tR\x06source\x12\x17\n" +
"\atask_id\x18\x03 \x01(\x03R\x06taskId\x12\x18\n" +
"\aattempt\x18\x04 \x01(\x03R\aattempt\x12\x1a\n" +
@@ -16773,7 +16852,7 @@ const file_state_v1_state_proto_rawDesc = "" +
" \x01(\x03R\vinputTokens\x12#\n" +
"\routput_tokens\x18\v \x01(\x03R\foutputTokens\x12#\n" +
"\rcached_tokens\x18\f \x01(\x03R\fcachedTokens\x12*\n" +
"\x02at\x18\r \x01(\v2\x1a.google.protobuf.TimestampR\x02at\"C\n" +
"\x02at\x18\r \x01(\v2\x1a.google.protobuf.TimestampR\x02atJ\x04\b\x01\x10\x02R\x06org_id\"C\n" +
"\x12RecordUsageRequest\x12-\n" +
"\x06record\x18\x01 \x01(\v2\x15.state.v1.UsageRecordR\x06record\"\x15\n" +
"\x13RecordUsageResponse\",\n" +
@@ -16792,7 +16871,14 @@ const file_state_v1_state_proto_rawDesc = "" +
"\rModelProvider\x12\x14\n" +
"\x05class\x18\x01 \x01(\tR\x05class\x12\x19\n" +
"\bbase_url\x18\x02 \x01(\tR\abaseUrl\x12\x1e\n" +
"\vapi_key_env\x18\x03 \x01(\tR\tapiKeyEnv2\xefS\n" +
"\vapi_key_env\x18\x03 \x01(\tR\tapiKeyEnv\"\x15\n" +
"\x13CallerModelsRequest\"\xb0\x01\n" +
"\x14CallerModelsResponse\x12\x15\n" +
"\x06org_id\x18\x01 \x01(\tR\x05orgId\x12E\n" +
"\aaliases\x18\x02 \x03(\v2+.state.v1.CallerModelsResponse.AliasesEntryR\aaliases\x1a:\n" +
"\fAliasesEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x012\xbeT\n" +
"\x11StateStoreService\x12G\n" +
"\n" +
"RecentLogs\x12\x1b.state.v1.RecentLogsRequest\x1a\x1c.state.v1.RecentLogsResponse\x12S\n" +
@@ -16829,7 +16915,8 @@ const file_state_v1_state_proto_rawDesc = "" +
"\tStartStep\x12\x1a.state.v1.StartStepRequest\x1a\x1b.state.v1.StartStepResponse\x12J\n" +
"\vRecordUsage\x12\x1c.state.v1.RecordUsageRequest\x1a\x1d.state.v1.RecordUsageResponse\x12G\n" +
"\n" +
"TaskModels\x12\x1b.state.v1.TaskModelsRequest\x1a\x1c.state.v1.TaskModelsResponse\x12G\n" +
"TaskModels\x12\x1b.state.v1.TaskModelsRequest\x1a\x1c.state.v1.TaskModelsResponse\x12M\n" +
"\fCallerModels\x12\x1d.state.v1.CallerModelsRequest\x1a\x1e.state.v1.CallerModelsResponse\x12G\n" +
"\n" +
"FinishStep\x12\x1b.state.v1.FinishStepRequest\x1a\x1c.state.v1.FinishStepResponse\x12V\n" +
"\x0fCancelExecution\x12 .state.v1.CancelExecutionRequest\x1a!.state.v1.CancelExecutionResponse\x12D\n" +
@@ -16943,7 +17030,7 @@ func file_state_v1_state_proto_rawDescGZIP() []byte {
return file_state_v1_state_proto_rawDescData
}
var file_state_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 295)
var file_state_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 298)
var file_state_v1_state_proto_goTypes = []any{
(*RegisterTaskGrantRequest)(nil), // 0: state.v1.RegisterTaskGrantRequest
(*RegisterTaskGrantResponse)(nil), // 1: state.v1.RegisterTaskGrantResponse
@@ -17236,17 +17323,20 @@ var file_state_v1_state_proto_goTypes = []any{
(*TaskModelsRequest)(nil), // 288: state.v1.TaskModelsRequest
(*TaskModelsResponse)(nil), // 289: state.v1.TaskModelsResponse
(*ModelProvider)(nil), // 290: state.v1.ModelProvider
nil, // 291: state.v1.EventType.SchemaEntry
nil, // 292: state.v1.StatusCountsResponse.CountsEntry
nil, // 293: state.v1.TaskModelsResponse.AliasesEntry
nil, // 294: state.v1.TaskModelsResponse.ProvidersEntry
(*timestamppb.Timestamp)(nil), // 295: google.protobuf.Timestamp
(*v1.LogQuery)(nil), // 296: logging.v1.LogQuery
(*v1.LogSnapshot)(nil), // 297: logging.v1.LogSnapshot
(*CallerModelsRequest)(nil), // 291: state.v1.CallerModelsRequest
(*CallerModelsResponse)(nil), // 292: state.v1.CallerModelsResponse
nil, // 293: state.v1.EventType.SchemaEntry
nil, // 294: state.v1.StatusCountsResponse.CountsEntry
nil, // 295: state.v1.TaskModelsResponse.AliasesEntry
nil, // 296: state.v1.TaskModelsResponse.ProvidersEntry
nil, // 297: state.v1.CallerModelsResponse.AliasesEntry
(*timestamppb.Timestamp)(nil), // 298: google.protobuf.Timestamp
(*v1.LogQuery)(nil), // 299: logging.v1.LogQuery
(*v1.LogSnapshot)(nil), // 300: logging.v1.LogSnapshot
}
var file_state_v1_state_proto_depIdxs = []int32{
295, // 0: state.v1.Identity.created_at:type_name -> google.protobuf.Timestamp
295, // 1: state.v1.Identity.updated_at:type_name -> google.protobuf.Timestamp
298, // 0: state.v1.Identity.created_at:type_name -> google.protobuf.Timestamp
298, // 1: state.v1.Identity.updated_at:type_name -> google.protobuf.Timestamp
6, // 2: state.v1.ListIdentitiesResponse.identities:type_name -> state.v1.Identity
6, // 3: state.v1.GetIdentityResponse.identity:type_name -> state.v1.Identity
7, // 4: state.v1.CreateIdentityRequest.audit:type_name -> state.v1.IdentityAudit
@@ -17262,37 +17352,37 @@ var file_state_v1_state_proto_depIdxs = []int32{
6, // 14: state.v1.ResolveIdentitySubjectResponse.identity:type_name -> state.v1.Identity
7, // 15: state.v1.BindIdentitySubjectRequest.audit:type_name -> state.v1.IdentityAudit
6, // 16: state.v1.BindIdentitySubjectResponse.identity:type_name -> state.v1.Identity
295, // 17: state.v1.PersonalToken.created_at:type_name -> google.protobuf.Timestamp
298, // 17: state.v1.PersonalToken.created_at:type_name -> google.protobuf.Timestamp
26, // 18: state.v1.ListPersonalTokensResponse.tokens:type_name -> state.v1.PersonalToken
295, // 19: state.v1.Task.created_at:type_name -> google.protobuf.Timestamp
295, // 20: state.v1.Task.updated_at:type_name -> google.protobuf.Timestamp
295, // 21: state.v1.Event.at:type_name -> google.protobuf.Timestamp
295, // 22: state.v1.CapturedEvent.received_at:type_name -> google.protobuf.Timestamp
298, // 19: state.v1.Task.created_at:type_name -> google.protobuf.Timestamp
298, // 20: state.v1.Task.updated_at:type_name -> google.protobuf.Timestamp
298, // 21: state.v1.Event.at:type_name -> google.protobuf.Timestamp
298, // 22: state.v1.CapturedEvent.received_at:type_name -> google.protobuf.Timestamp
36, // 23: state.v1.EventType.header_conditions:type_name -> state.v1.EventTypeHeaderCondition
37, // 24: state.v1.EventType.payload_conditions:type_name -> state.v1.EventTypePayloadCondition
291, // 25: state.v1.EventType.schema:type_name -> state.v1.EventType.SchemaEntry
295, // 26: state.v1.EventType.created_at:type_name -> google.protobuf.Timestamp
295, // 27: state.v1.EventType.updated_at:type_name -> google.protobuf.Timestamp
293, // 25: state.v1.EventType.schema:type_name -> state.v1.EventType.SchemaEntry
298, // 26: state.v1.EventType.created_at:type_name -> google.protobuf.Timestamp
298, // 27: state.v1.EventType.updated_at:type_name -> google.protobuf.Timestamp
39, // 28: state.v1.Mapping.fields:type_name -> state.v1.MappingField
295, // 29: state.v1.Mapping.created_at:type_name -> google.protobuf.Timestamp
295, // 30: state.v1.Mapping.updated_at:type_name -> google.protobuf.Timestamp
295, // 31: state.v1.Mapping.last_matched_at:type_name -> google.protobuf.Timestamp
298, // 29: state.v1.Mapping.created_at:type_name -> google.protobuf.Timestamp
298, // 30: state.v1.Mapping.updated_at:type_name -> google.protobuf.Timestamp
298, // 31: state.v1.Mapping.last_matched_at:type_name -> google.protobuf.Timestamp
41, // 32: state.v1.Binding.matcher:type_name -> state.v1.BindingMatcher
295, // 33: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
295, // 34: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
295, // 35: state.v1.Source.created_at:type_name -> google.protobuf.Timestamp
295, // 36: state.v1.Source.updated_at:type_name -> google.protobuf.Timestamp
298, // 33: state.v1.Binding.created_at:type_name -> google.protobuf.Timestamp
298, // 34: state.v1.Binding.updated_at:type_name -> google.protobuf.Timestamp
298, // 35: state.v1.Source.created_at:type_name -> google.protobuf.Timestamp
298, // 36: state.v1.Source.updated_at:type_name -> google.protobuf.Timestamp
33, // 37: state.v1.ActiveTasksByOriginResponse.tasks:type_name -> state.v1.Task
33, // 38: state.v1.EnqueueChatTaskResponse.task:type_name -> state.v1.Task
33, // 39: state.v1.ClaimNextResponse.task:type_name -> state.v1.Task
33, // 40: state.v1.ClaimByIssueResponse.task:type_name -> state.v1.Task
34, // 41: state.v1.StartStepResponse.event:type_name -> state.v1.Event
34, // 42: state.v1.FinishStepResponse.event:type_name -> state.v1.Event
295, // 43: state.v1.StepExecution.started_at:type_name -> google.protobuf.Timestamp
295, // 44: state.v1.StepExecution.finished_at:type_name -> google.protobuf.Timestamp
298, // 43: state.v1.StepExecution.started_at:type_name -> google.protobuf.Timestamp
298, // 44: state.v1.StepExecution.finished_at:type_name -> google.protobuf.Timestamp
65, // 45: state.v1.ListStepsResponse.steps:type_name -> state.v1.StepExecution
295, // 46: state.v1.HarnessSecret.expires_at:type_name -> google.protobuf.Timestamp
295, // 47: state.v1.HarnessSecret.updated_at:type_name -> google.protobuf.Timestamp
298, // 46: state.v1.HarnessSecret.expires_at:type_name -> google.protobuf.Timestamp
298, // 47: state.v1.HarnessSecret.updated_at:type_name -> google.protobuf.Timestamp
68, // 48: state.v1.GetHarnessSecretResponse.secret:type_name -> state.v1.HarnessSecret
68, // 49: state.v1.PutHarnessSecretRequest.secret:type_name -> state.v1.HarnessSecret
33, // 50: state.v1.UpdateRequest.task:type_name -> state.v1.Task
@@ -17301,35 +17391,35 @@ var file_state_v1_state_proto_depIdxs = []int32{
33, // 53: state.v1.OpenTaskByPRResponse.task:type_name -> state.v1.Task
33, // 54: state.v1.TaskByIDResponse.task:type_name -> state.v1.Task
33, // 55: state.v1.OpenPRsResponse.tasks:type_name -> state.v1.Task
295, // 56: state.v1.TasksRequest.after_updated_at:type_name -> google.protobuf.Timestamp
298, // 56: state.v1.TasksRequest.after_updated_at:type_name -> google.protobuf.Timestamp
33, // 57: state.v1.TasksResponse.tasks:type_name -> state.v1.Task
292, // 58: state.v1.StatusCountsResponse.counts:type_name -> state.v1.StatusCountsResponse.CountsEntry
294, // 58: state.v1.StatusCountsResponse.counts:type_name -> state.v1.StatusCountsResponse.CountsEntry
34, // 59: state.v1.InsertEventRequest.event:type_name -> state.v1.Event
34, // 60: state.v1.EventsSinceResponse.events:type_name -> state.v1.Event
34, // 61: state.v1.TaskEventsResponse.events:type_name -> state.v1.Event
44, // 62: state.v1.WorkflowStatsResponse.stats:type_name -> state.v1.WorkflowStat
45, // 63: state.v1.StageStatsResponse.stats:type_name -> state.v1.StageStat
46, // 64: state.v1.TokensByDayResponse.tokens:type_name -> state.v1.DayTokens
295, // 65: state.v1.ConfigSnapshot.published_at:type_name -> google.protobuf.Timestamp
298, // 65: state.v1.ConfigSnapshot.published_at:type_name -> google.protobuf.Timestamp
119, // 66: state.v1.PutConfigSnapshotRequest.snapshot:type_name -> state.v1.ConfigSnapshot
119, // 67: state.v1.GetConfigSnapshotResponse.snapshot:type_name -> state.v1.ConfigSnapshot
295, // 68: state.v1.ChannelStatus.observed_at:type_name -> google.protobuf.Timestamp
298, // 68: state.v1.ChannelStatus.observed_at:type_name -> google.protobuf.Timestamp
124, // 69: state.v1.PutChannelStatusRequest.channels:type_name -> state.v1.ChannelStatus
124, // 70: state.v1.ListChannelStatusResponse.channels:type_name -> state.v1.ChannelStatus
295, // 71: state.v1.ApplyStatus.reported_at:type_name -> google.protobuf.Timestamp
298, // 71: state.v1.ApplyStatus.reported_at:type_name -> google.protobuf.Timestamp
129, // 72: state.v1.PutApplyStatusRequest.status:type_name -> state.v1.ApplyStatus
129, // 73: state.v1.ListApplyStatusResponse.statuses:type_name -> state.v1.ApplyStatus
295, // 74: state.v1.Presence.started_at:type_name -> google.protobuf.Timestamp
295, // 75: state.v1.Presence.reported_at:type_name -> google.protobuf.Timestamp
298, // 74: state.v1.Presence.started_at:type_name -> google.protobuf.Timestamp
298, // 75: state.v1.Presence.reported_at:type_name -> google.protobuf.Timestamp
134, // 76: state.v1.Presence.checks:type_name -> state.v1.DependencyCheck
295, // 77: state.v1.RecordCaptureRefusalRequest.refused_at:type_name -> google.protobuf.Timestamp
295, // 78: state.v1.ListCaptureRefusalsRequest.since:type_name -> google.protobuf.Timestamp
298, // 77: state.v1.RecordCaptureRefusalRequest.refused_at:type_name -> google.protobuf.Timestamp
298, // 78: state.v1.ListCaptureRefusalsRequest.since:type_name -> google.protobuf.Timestamp
139, // 79: state.v1.ListCaptureRefusalsResponse.sources:type_name -> state.v1.CaptureRefusals
135, // 80: state.v1.PutPresenceRequest.presence:type_name -> state.v1.Presence
135, // 81: state.v1.ListPresenceResponse.presences:type_name -> state.v1.Presence
295, // 82: state.v1.TaskLogEntry.time:type_name -> google.protobuf.Timestamp
295, // 83: state.v1.ReadTaskLogRequest.since:type_name -> google.protobuf.Timestamp
295, // 84: state.v1.ReadTaskLogRequest.until:type_name -> google.protobuf.Timestamp
298, // 82: state.v1.TaskLogEntry.time:type_name -> google.protobuf.Timestamp
298, // 83: state.v1.ReadTaskLogRequest.since:type_name -> google.protobuf.Timestamp
298, // 84: state.v1.ReadTaskLogRequest.until:type_name -> google.protobuf.Timestamp
145, // 85: state.v1.ReadTaskLogResponse.entries:type_name -> state.v1.TaskLogEntry
35, // 86: state.v1.InsertCaptureRequest.capture:type_name -> state.v1.CapturedEvent
35, // 87: state.v1.StreamCapturesResponse.capture:type_name -> state.v1.CapturedEvent
@@ -17348,7 +17438,7 @@ var file_state_v1_state_proto_depIdxs = []int32{
43, // 100: state.v1.GetSourceResponse.source:type_name -> state.v1.Source
43, // 101: state.v1.ListSourcesResponse.sources:type_name -> state.v1.Source
42, // 102: state.v1.ArmedBindingsForSourceResponse.bindings:type_name -> state.v1.Binding
295, // 103: state.v1.Dispatch.dispatched_at:type_name -> google.protobuf.Timestamp
298, // 103: state.v1.Dispatch.dispatched_at:type_name -> google.protobuf.Timestamp
213, // 104: state.v1.ListDispatchesResponse.dispatches:type_name -> state.v1.Dispatch
35, // 105: state.v1.StreamUndispatchedCapturesResponse.capture:type_name -> state.v1.CapturedEvent
33, // 106: state.v1.EnqueueBindingTaskResponse.task:type_name -> state.v1.Task
@@ -17366,7 +17456,7 @@ var file_state_v1_state_proto_depIdxs = []int32{
248, // 118: state.v1.ListPoliciesResponse.policies:type_name -> state.v1.AccessPolicy
248, // 119: state.v1.PutPolicyRequest.policy:type_name -> state.v1.AccessPolicy
248, // 120: state.v1.DeletePolicyRequest.policy:type_name -> state.v1.AccessPolicy
295, // 121: state.v1.AccessDenial.at:type_name -> google.protobuf.Timestamp
298, // 121: state.v1.AccessDenial.at:type_name -> google.protobuf.Timestamp
257, // 122: state.v1.RecordDenialRequest.denial:type_name -> state.v1.AccessDenial
257, // 123: state.v1.ListDenialsResponse.denials:type_name -> state.v1.AccessDenial
262, // 124: state.v1.ListOrgsResponse.orgs:type_name -> state.v1.Org
@@ -17375,270 +17465,273 @@ var file_state_v1_state_proto_depIdxs = []int32{
263, // 127: state.v1.ListWorkspacesResponse.workspaces:type_name -> state.v1.Workspace
263, // 128: state.v1.CreateWorkspaceResponse.workspace:type_name -> state.v1.Workspace
264, // 129: state.v1.ListMembersResponse.members:type_name -> state.v1.Member
296, // 130: state.v1.RecentLogsRequest.query:type_name -> logging.v1.LogQuery
297, // 131: state.v1.RecentLogsResponse.snapshot:type_name -> logging.v1.LogSnapshot
295, // 132: state.v1.UsageRecord.at:type_name -> google.protobuf.Timestamp
299, // 130: state.v1.RecentLogsRequest.query:type_name -> logging.v1.LogQuery
300, // 131: state.v1.RecentLogsResponse.snapshot:type_name -> logging.v1.LogSnapshot
298, // 132: state.v1.UsageRecord.at:type_name -> google.protobuf.Timestamp
285, // 133: state.v1.RecordUsageRequest.record:type_name -> state.v1.UsageRecord
293, // 134: state.v1.TaskModelsResponse.aliases:type_name -> state.v1.TaskModelsResponse.AliasesEntry
294, // 135: state.v1.TaskModelsResponse.providers:type_name -> state.v1.TaskModelsResponse.ProvidersEntry
290, // 136: state.v1.TaskModelsResponse.ProvidersEntry.value:type_name -> state.v1.ModelProvider
283, // 137: state.v1.StateStoreService.RecentLogs:input_type -> state.v1.RecentLogsRequest
229, // 138: state.v1.StateStoreService.InstallPackage:input_type -> state.v1.InstallPackageRequest
232, // 139: state.v1.StateStoreService.ListCatalogue:input_type -> state.v1.ListCatalogueRequest
234, // 140: state.v1.StateStoreService.InstallFromCatalogue:input_type -> state.v1.InstallFromCatalogueRequest
236, // 141: state.v1.StateStoreService.GetInstalledPackage:input_type -> state.v1.GetInstalledPackageRequest
238, // 142: state.v1.StateStoreService.ListInstalledPackages:input_type -> state.v1.ListInstalledPackagesRequest
240, // 143: state.v1.StateStoreService.AcceptPackageAuthority:input_type -> state.v1.AcceptPackageAuthorityRequest
242, // 144: state.v1.StateStoreService.RemoveInstalledPackage:input_type -> state.v1.RemoveInstalledPackageRequest
0, // 145: state.v1.StateStoreService.RegisterTaskGrant:input_type -> state.v1.RegisterTaskGrantRequest
2, // 146: state.v1.StateStoreService.RevokeTaskGrant:input_type -> state.v1.RevokeTaskGrantRequest
4, // 147: state.v1.StateStoreService.ResolveTaskGrant:input_type -> state.v1.ResolveTaskGrantRequest
8, // 148: state.v1.StateStoreService.ListIdentities:input_type -> state.v1.ListIdentitiesRequest
10, // 149: state.v1.StateStoreService.GetIdentity:input_type -> state.v1.GetIdentityRequest
12, // 150: state.v1.StateStoreService.CreateIdentity:input_type -> state.v1.CreateIdentityRequest
13, // 151: state.v1.StateStoreService.RenameIdentity:input_type -> state.v1.RenameIdentityRequest
14, // 152: state.v1.StateStoreService.SuspendIdentity:input_type -> state.v1.SuspendIdentityRequest
15, // 153: state.v1.StateStoreService.ReactivateIdentity:input_type -> state.v1.ReactivateIdentityRequest
16, // 154: state.v1.StateStoreService.RetireIdentity:input_type -> state.v1.RetireIdentityRequest
22, // 155: state.v1.StateStoreService.ResolveIdentitySubject:input_type -> state.v1.ResolveIdentitySubjectRequest
24, // 156: state.v1.StateStoreService.BindIdentitySubject:input_type -> state.v1.BindIdentitySubjectRequest
27, // 157: state.v1.StateStoreService.AddPersonalToken:input_type -> state.v1.AddPersonalTokenRequest
29, // 158: state.v1.StateStoreService.ListPersonalTokens:input_type -> state.v1.ListPersonalTokensRequest
31, // 159: state.v1.StateStoreService.RevokePersonalToken:input_type -> state.v1.RevokePersonalTokenRequest
47, // 160: state.v1.StateStoreService.EnqueueIssue:input_type -> state.v1.EnqueueIssueRequest
51, // 161: state.v1.StateStoreService.EnqueueChatTask:input_type -> state.v1.EnqueueChatTaskRequest
49, // 162: state.v1.StateStoreService.ActiveTasksByOrigin:input_type -> state.v1.ActiveTasksByOriginRequest
53, // 163: state.v1.StateStoreService.ClaimNext:input_type -> state.v1.ClaimNextRequest
55, // 164: state.v1.StateStoreService.ClaimByIssue:input_type -> state.v1.ClaimByIssueRequest
57, // 165: state.v1.StateStoreService.Transition:input_type -> state.v1.TransitionRequest
73, // 166: state.v1.StateStoreService.Update:input_type -> state.v1.UpdateRequest
59, // 167: state.v1.StateStoreService.StartStep:input_type -> state.v1.StartStepRequest
286, // 168: state.v1.StateStoreService.RecordUsage:input_type -> state.v1.RecordUsageRequest
288, // 169: state.v1.StateStoreService.TaskModels:input_type -> state.v1.TaskModelsRequest
61, // 170: state.v1.StateStoreService.FinishStep:input_type -> state.v1.FinishStepRequest
63, // 171: state.v1.StateStoreService.CancelExecution:input_type -> state.v1.CancelExecutionRequest
66, // 172: state.v1.StateStoreService.ListSteps:input_type -> state.v1.ListStepsRequest
69, // 173: state.v1.StateStoreService.GetHarnessSecret:input_type -> state.v1.GetHarnessSecretRequest
71, // 174: state.v1.StateStoreService.PutHarnessSecret:input_type -> state.v1.PutHarnessSecretRequest
75, // 175: state.v1.StateStoreService.Requeue:input_type -> state.v1.RequeueRequest
77, // 176: state.v1.StateStoreService.ParkTask:input_type -> state.v1.ParkTaskRequest
79, // 177: state.v1.StateStoreService.RecoverStale:input_type -> state.v1.RecoverStaleRequest
81, // 178: state.v1.StateStoreService.ArchiveTask:input_type -> state.v1.ArchiveTaskRequest
83, // 179: state.v1.StateStoreService.RetryTask:input_type -> state.v1.RetryTaskRequest
85, // 180: state.v1.StateStoreService.RespondReviewGate:input_type -> state.v1.RespondReviewGateRequest
87, // 181: state.v1.StateStoreService.BeginRemediation:input_type -> state.v1.BeginRemediationRequest
89, // 182: state.v1.StateStoreService.UpdateReviewPayload:input_type -> state.v1.UpdateReviewPayloadRequest
91, // 183: state.v1.StateStoreService.SetReviewCursors:input_type -> state.v1.SetReviewCursorsRequest
93, // 184: state.v1.StateStoreService.TaskByIssue:input_type -> state.v1.TaskByIssueRequest
95, // 185: state.v1.StateStoreService.OpenTaskByPR:input_type -> state.v1.OpenTaskByPRRequest
97, // 186: state.v1.StateStoreService.TaskByID:input_type -> state.v1.TaskByIDRequest
99, // 187: state.v1.StateStoreService.OpenPRs:input_type -> state.v1.OpenPRsRequest
101, // 188: state.v1.StateStoreService.ClearTerminalTasks:input_type -> state.v1.ClearTerminalTasksRequest
103, // 189: state.v1.StateStoreService.Tasks:input_type -> state.v1.TasksRequest
105, // 190: state.v1.StateStoreService.StatusCounts:input_type -> state.v1.StatusCountsRequest
107, // 191: state.v1.StateStoreService.InsertEvent:input_type -> state.v1.InsertEventRequest
109, // 192: state.v1.StateStoreService.EventsSince:input_type -> state.v1.EventsSinceRequest
111, // 193: state.v1.StateStoreService.TaskEvents:input_type -> state.v1.TaskEventsRequest
113, // 194: state.v1.StateStoreService.WorkflowStats:input_type -> state.v1.WorkflowStatsRequest
115, // 195: state.v1.StateStoreService.StageStats:input_type -> state.v1.StageStatsRequest
117, // 196: state.v1.StateStoreService.TokensByDay:input_type -> state.v1.TokensByDayRequest
120, // 197: state.v1.StateStoreService.PutConfigSnapshot:input_type -> state.v1.PutConfigSnapshotRequest
122, // 198: state.v1.StateStoreService.GetConfigSnapshot:input_type -> state.v1.GetConfigSnapshotRequest
125, // 199: state.v1.StateStoreService.PutChannelStatus:input_type -> state.v1.PutChannelStatusRequest
127, // 200: state.v1.StateStoreService.ListChannelStatus:input_type -> state.v1.ListChannelStatusRequest
130, // 201: state.v1.StateStoreService.PutApplyStatus:input_type -> state.v1.PutApplyStatusRequest
132, // 202: state.v1.StateStoreService.ListApplyStatus:input_type -> state.v1.ListApplyStatusRequest
141, // 203: state.v1.StateStoreService.PutPresence:input_type -> state.v1.PutPresenceRequest
136, // 204: state.v1.StateStoreService.RecordCaptureRefusal:input_type -> state.v1.RecordCaptureRefusalRequest
138, // 205: state.v1.StateStoreService.ListCaptureRefusals:input_type -> state.v1.ListCaptureRefusalsRequest
143, // 206: state.v1.StateStoreService.ListPresence:input_type -> state.v1.ListPresenceRequest
146, // 207: state.v1.StateStoreService.ReadTaskLog:input_type -> state.v1.ReadTaskLogRequest
148, // 208: state.v1.StateStoreService.StreamTaskLogContent:input_type -> state.v1.StreamTaskLogContentRequest
150, // 209: state.v1.StateStoreService.InsertCapture:input_type -> state.v1.InsertCaptureRequest
152, // 210: state.v1.StateStoreService.StreamCaptures:input_type -> state.v1.StreamCapturesRequest
154, // 211: state.v1.StateStoreService.InsertMapping:input_type -> state.v1.InsertMappingRequest
156, // 212: state.v1.StateStoreService.GetMapping:input_type -> state.v1.GetMappingRequest
158, // 213: state.v1.StateStoreService.ListMappings:input_type -> state.v1.ListMappingsRequest
160, // 214: state.v1.StateStoreService.UpdateMapping:input_type -> state.v1.UpdateMappingRequest
162, // 215: state.v1.StateStoreService.DeleteMapping:input_type -> state.v1.DeleteMappingRequest
164, // 216: state.v1.StateStoreService.RecordMappingMatch:input_type -> state.v1.RecordMappingMatchRequest
166, // 217: state.v1.StateStoreService.InsertEventType:input_type -> state.v1.InsertEventTypeRequest
168, // 218: state.v1.StateStoreService.UpdateEventType:input_type -> state.v1.UpdateEventTypeRequest
170, // 219: state.v1.StateStoreService.DeleteEventType:input_type -> state.v1.DeleteEventTypeRequest
172, // 220: state.v1.StateStoreService.ListEventTypes:input_type -> state.v1.ListEventTypesRequest
174, // 221: state.v1.StateStoreService.InsertBinding:input_type -> state.v1.InsertBindingRequest
176, // 222: state.v1.StateStoreService.GetBinding:input_type -> state.v1.GetBindingRequest
178, // 223: state.v1.StateStoreService.ListBindings:input_type -> state.v1.ListBindingsRequest
212, // 224: state.v1.StateStoreService.ListDispatches:input_type -> state.v1.ListDispatchesRequest
180, // 225: state.v1.StateStoreService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
182, // 226: state.v1.StateStoreService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
184, // 227: state.v1.StateStoreService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
192, // 228: state.v1.StateStoreService.PauseBinding:input_type -> state.v1.PauseBindingRequest
194, // 229: state.v1.StateStoreService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
196, // 230: state.v1.StateStoreService.InsertSource:input_type -> state.v1.InsertSourceRequest
198, // 231: state.v1.StateStoreService.GetSource:input_type -> state.v1.GetSourceRequest
200, // 232: state.v1.StateStoreService.ListSources:input_type -> state.v1.ListSourcesRequest
202, // 233: state.v1.StateStoreService.SetSourceSigning:input_type -> state.v1.SetSourceSigningRequest
204, // 234: state.v1.StateStoreService.SetSourceSecret:input_type -> state.v1.SetSourceSecretRequest
186, // 235: state.v1.StateStoreService.SetSourceName:input_type -> state.v1.SetSourceNameRequest
188, // 236: state.v1.StateStoreService.SetSourceDeliveryHeader:input_type -> state.v1.SetSourceDeliveryHeaderRequest
190, // 237: state.v1.StateStoreService.DeleteSource:input_type -> state.v1.DeleteSourceRequest
206, // 238: state.v1.StateStoreService.ArmedBindingsForSource:input_type -> state.v1.ArmedBindingsForSourceRequest
208, // 239: state.v1.StateStoreService.RecordDispatch:input_type -> state.v1.RecordDispatchRequest
210, // 240: state.v1.StateStoreService.SetDispatchTask:input_type -> state.v1.SetDispatchTaskRequest
215, // 241: state.v1.StateStoreService.RecordPlaybookDispatch:input_type -> state.v1.RecordPlaybookDispatchRequest
217, // 242: state.v1.StateStoreService.DeletePlaybookDispatches:input_type -> state.v1.DeletePlaybookDispatchesRequest
219, // 243: state.v1.StateStoreService.StreamUndispatchedCaptures:input_type -> state.v1.StreamUndispatchedCapturesRequest
221, // 244: state.v1.StateStoreService.EnqueueBindingTask:input_type -> state.v1.EnqueueBindingTaskRequest
223, // 245: state.v1.StateStoreService.EnqueueCallTask:input_type -> state.v1.EnqueueCallTaskRequest
225, // 246: state.v1.StateStoreService.WorkflowCallStatus:input_type -> state.v1.WorkflowCallStatusRequest
244, // 247: state.v1.StateStoreService.GetPrincipal:input_type -> state.v1.GetPrincipalRequest
249, // 248: state.v1.StateStoreService.ListPolicies:input_type -> state.v1.ListPoliciesRequest
251, // 249: state.v1.StateStoreService.PutPolicy:input_type -> state.v1.PutPolicyRequest
253, // 250: state.v1.StateStoreService.DeletePolicy:input_type -> state.v1.DeletePolicyRequest
255, // 251: state.v1.StateStoreService.EnsureShippedOrgPolicies:input_type -> state.v1.EnsureShippedOrgPoliciesRequest
258, // 252: state.v1.StateStoreService.RecordDenial:input_type -> state.v1.RecordDenialRequest
260, // 253: state.v1.StateStoreService.ListDenials:input_type -> state.v1.ListDenialsRequest
265, // 254: state.v1.StateStoreService.ListOrgs:input_type -> state.v1.ListOrgsRequest
267, // 255: state.v1.StateStoreService.GetOrg:input_type -> state.v1.GetOrgRequest
269, // 256: state.v1.StateStoreService.CreateOrg:input_type -> state.v1.CreateOrgRequest
271, // 257: state.v1.StateStoreService.ListWorkspaces:input_type -> state.v1.ListWorkspacesRequest
273, // 258: state.v1.StateStoreService.CreateWorkspace:input_type -> state.v1.CreateWorkspaceRequest
275, // 259: state.v1.StateStoreService.ListMembers:input_type -> state.v1.ListMembersRequest
277, // 260: state.v1.StateStoreService.SetMembership:input_type -> state.v1.SetMembershipRequest
279, // 261: state.v1.StateStoreService.RemoveMembership:input_type -> state.v1.RemoveMembershipRequest
281, // 262: state.v1.StateStoreService.AssignAgent:input_type -> state.v1.AssignAgentRequest
284, // 263: state.v1.StateStoreService.RecentLogs:output_type -> state.v1.RecentLogsResponse
230, // 264: state.v1.StateStoreService.InstallPackage:output_type -> state.v1.InstallPackageResponse
233, // 265: state.v1.StateStoreService.ListCatalogue:output_type -> state.v1.ListCatalogueResponse
235, // 266: state.v1.StateStoreService.InstallFromCatalogue:output_type -> state.v1.InstallFromCatalogueResponse
237, // 267: state.v1.StateStoreService.GetInstalledPackage:output_type -> state.v1.GetInstalledPackageResponse
239, // 268: state.v1.StateStoreService.ListInstalledPackages:output_type -> state.v1.ListInstalledPackagesResponse
241, // 269: state.v1.StateStoreService.AcceptPackageAuthority:output_type -> state.v1.AcceptPackageAuthorityResponse
243, // 270: state.v1.StateStoreService.RemoveInstalledPackage:output_type -> state.v1.RemoveInstalledPackageResponse
1, // 271: state.v1.StateStoreService.RegisterTaskGrant:output_type -> state.v1.RegisterTaskGrantResponse
3, // 272: state.v1.StateStoreService.RevokeTaskGrant:output_type -> state.v1.RevokeTaskGrantResponse
5, // 273: state.v1.StateStoreService.ResolveTaskGrant:output_type -> state.v1.ResolveTaskGrantResponse
9, // 274: state.v1.StateStoreService.ListIdentities:output_type -> state.v1.ListIdentitiesResponse
11, // 275: state.v1.StateStoreService.GetIdentity:output_type -> state.v1.GetIdentityResponse
17, // 276: state.v1.StateStoreService.CreateIdentity:output_type -> state.v1.CreateIdentityResponse
18, // 277: state.v1.StateStoreService.RenameIdentity:output_type -> state.v1.RenameIdentityResponse
19, // 278: state.v1.StateStoreService.SuspendIdentity:output_type -> state.v1.SuspendIdentityResponse
20, // 279: state.v1.StateStoreService.ReactivateIdentity:output_type -> state.v1.ReactivateIdentityResponse
21, // 280: state.v1.StateStoreService.RetireIdentity:output_type -> state.v1.RetireIdentityResponse
23, // 281: state.v1.StateStoreService.ResolveIdentitySubject:output_type -> state.v1.ResolveIdentitySubjectResponse
25, // 282: state.v1.StateStoreService.BindIdentitySubject:output_type -> state.v1.BindIdentitySubjectResponse
28, // 283: state.v1.StateStoreService.AddPersonalToken:output_type -> state.v1.AddPersonalTokenResponse
30, // 284: state.v1.StateStoreService.ListPersonalTokens:output_type -> state.v1.ListPersonalTokensResponse
32, // 285: state.v1.StateStoreService.RevokePersonalToken:output_type -> state.v1.RevokePersonalTokenResponse
48, // 286: state.v1.StateStoreService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
52, // 287: state.v1.StateStoreService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
50, // 288: state.v1.StateStoreService.ActiveTasksByOrigin:output_type -> state.v1.ActiveTasksByOriginResponse
54, // 289: state.v1.StateStoreService.ClaimNext:output_type -> state.v1.ClaimNextResponse
56, // 290: state.v1.StateStoreService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
58, // 291: state.v1.StateStoreService.Transition:output_type -> state.v1.TransitionResponse
74, // 292: state.v1.StateStoreService.Update:output_type -> state.v1.UpdateResponse
60, // 293: state.v1.StateStoreService.StartStep:output_type -> state.v1.StartStepResponse
287, // 294: state.v1.StateStoreService.RecordUsage:output_type -> state.v1.RecordUsageResponse
289, // 295: state.v1.StateStoreService.TaskModels:output_type -> state.v1.TaskModelsResponse
62, // 296: state.v1.StateStoreService.FinishStep:output_type -> state.v1.FinishStepResponse
64, // 297: state.v1.StateStoreService.CancelExecution:output_type -> state.v1.CancelExecutionResponse
67, // 298: state.v1.StateStoreService.ListSteps:output_type -> state.v1.ListStepsResponse
70, // 299: state.v1.StateStoreService.GetHarnessSecret:output_type -> state.v1.GetHarnessSecretResponse
72, // 300: state.v1.StateStoreService.PutHarnessSecret:output_type -> state.v1.PutHarnessSecretResponse
76, // 301: state.v1.StateStoreService.Requeue:output_type -> state.v1.RequeueResponse
78, // 302: state.v1.StateStoreService.ParkTask:output_type -> state.v1.ParkTaskResponse
80, // 303: state.v1.StateStoreService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
82, // 304: state.v1.StateStoreService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
84, // 305: state.v1.StateStoreService.RetryTask:output_type -> state.v1.RetryTaskResponse
86, // 306: state.v1.StateStoreService.RespondReviewGate:output_type -> state.v1.RespondReviewGateResponse
88, // 307: state.v1.StateStoreService.BeginRemediation:output_type -> state.v1.BeginRemediationResponse
90, // 308: state.v1.StateStoreService.UpdateReviewPayload:output_type -> state.v1.UpdateReviewPayloadResponse
92, // 309: state.v1.StateStoreService.SetReviewCursors:output_type -> state.v1.SetReviewCursorsResponse
94, // 310: state.v1.StateStoreService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
96, // 311: state.v1.StateStoreService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
98, // 312: state.v1.StateStoreService.TaskByID:output_type -> state.v1.TaskByIDResponse
100, // 313: state.v1.StateStoreService.OpenPRs:output_type -> state.v1.OpenPRsResponse
102, // 314: state.v1.StateStoreService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
104, // 315: state.v1.StateStoreService.Tasks:output_type -> state.v1.TasksResponse
106, // 316: state.v1.StateStoreService.StatusCounts:output_type -> state.v1.StatusCountsResponse
108, // 317: state.v1.StateStoreService.InsertEvent:output_type -> state.v1.InsertEventResponse
110, // 318: state.v1.StateStoreService.EventsSince:output_type -> state.v1.EventsSinceResponse
112, // 319: state.v1.StateStoreService.TaskEvents:output_type -> state.v1.TaskEventsResponse
114, // 320: state.v1.StateStoreService.WorkflowStats:output_type -> state.v1.WorkflowStatsResponse
116, // 321: state.v1.StateStoreService.StageStats:output_type -> state.v1.StageStatsResponse
118, // 322: state.v1.StateStoreService.TokensByDay:output_type -> state.v1.TokensByDayResponse
121, // 323: state.v1.StateStoreService.PutConfigSnapshot:output_type -> state.v1.PutConfigSnapshotResponse
123, // 324: state.v1.StateStoreService.GetConfigSnapshot:output_type -> state.v1.GetConfigSnapshotResponse
126, // 325: state.v1.StateStoreService.PutChannelStatus:output_type -> state.v1.PutChannelStatusResponse
128, // 326: state.v1.StateStoreService.ListChannelStatus:output_type -> state.v1.ListChannelStatusResponse
131, // 327: state.v1.StateStoreService.PutApplyStatus:output_type -> state.v1.PutApplyStatusResponse
133, // 328: state.v1.StateStoreService.ListApplyStatus:output_type -> state.v1.ListApplyStatusResponse
142, // 329: state.v1.StateStoreService.PutPresence:output_type -> state.v1.PutPresenceResponse
137, // 330: state.v1.StateStoreService.RecordCaptureRefusal:output_type -> state.v1.RecordCaptureRefusalResponse
140, // 331: state.v1.StateStoreService.ListCaptureRefusals:output_type -> state.v1.ListCaptureRefusalsResponse
144, // 332: state.v1.StateStoreService.ListPresence:output_type -> state.v1.ListPresenceResponse
147, // 333: state.v1.StateStoreService.ReadTaskLog:output_type -> state.v1.ReadTaskLogResponse
149, // 334: state.v1.StateStoreService.StreamTaskLogContent:output_type -> state.v1.StreamTaskLogContentResponse
151, // 335: state.v1.StateStoreService.InsertCapture:output_type -> state.v1.InsertCaptureResponse
153, // 336: state.v1.StateStoreService.StreamCaptures:output_type -> state.v1.StreamCapturesResponse
155, // 337: state.v1.StateStoreService.InsertMapping:output_type -> state.v1.InsertMappingResponse
157, // 338: state.v1.StateStoreService.GetMapping:output_type -> state.v1.GetMappingResponse
159, // 339: state.v1.StateStoreService.ListMappings:output_type -> state.v1.ListMappingsResponse
161, // 340: state.v1.StateStoreService.UpdateMapping:output_type -> state.v1.UpdateMappingResponse
163, // 341: state.v1.StateStoreService.DeleteMapping:output_type -> state.v1.DeleteMappingResponse
165, // 342: state.v1.StateStoreService.RecordMappingMatch:output_type -> state.v1.RecordMappingMatchResponse
167, // 343: state.v1.StateStoreService.InsertEventType:output_type -> state.v1.InsertEventTypeResponse
169, // 344: state.v1.StateStoreService.UpdateEventType:output_type -> state.v1.UpdateEventTypeResponse
171, // 345: state.v1.StateStoreService.DeleteEventType:output_type -> state.v1.DeleteEventTypeResponse
173, // 346: state.v1.StateStoreService.ListEventTypes:output_type -> state.v1.ListEventTypesResponse
175, // 347: state.v1.StateStoreService.InsertBinding:output_type -> state.v1.InsertBindingResponse
177, // 348: state.v1.StateStoreService.GetBinding:output_type -> state.v1.GetBindingResponse
179, // 349: state.v1.StateStoreService.ListBindings:output_type -> state.v1.ListBindingsResponse
214, // 350: state.v1.StateStoreService.ListDispatches:output_type -> state.v1.ListDispatchesResponse
181, // 351: state.v1.StateStoreService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
183, // 352: state.v1.StateStoreService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
185, // 353: state.v1.StateStoreService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
193, // 354: state.v1.StateStoreService.PauseBinding:output_type -> state.v1.PauseBindingResponse
195, // 355: state.v1.StateStoreService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
197, // 356: state.v1.StateStoreService.InsertSource:output_type -> state.v1.InsertSourceResponse
199, // 357: state.v1.StateStoreService.GetSource:output_type -> state.v1.GetSourceResponse
201, // 358: state.v1.StateStoreService.ListSources:output_type -> state.v1.ListSourcesResponse
203, // 359: state.v1.StateStoreService.SetSourceSigning:output_type -> state.v1.SetSourceSigningResponse
205, // 360: state.v1.StateStoreService.SetSourceSecret:output_type -> state.v1.SetSourceSecretResponse
187, // 361: state.v1.StateStoreService.SetSourceName:output_type -> state.v1.SetSourceNameResponse
189, // 362: state.v1.StateStoreService.SetSourceDeliveryHeader:output_type -> state.v1.SetSourceDeliveryHeaderResponse
191, // 363: state.v1.StateStoreService.DeleteSource:output_type -> state.v1.DeleteSourceResponse
207, // 364: state.v1.StateStoreService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
209, // 365: state.v1.StateStoreService.RecordDispatch:output_type -> state.v1.RecordDispatchResponse
211, // 366: state.v1.StateStoreService.SetDispatchTask:output_type -> state.v1.SetDispatchTaskResponse
216, // 367: state.v1.StateStoreService.RecordPlaybookDispatch:output_type -> state.v1.RecordPlaybookDispatchResponse
218, // 368: state.v1.StateStoreService.DeletePlaybookDispatches:output_type -> state.v1.DeletePlaybookDispatchesResponse
220, // 369: state.v1.StateStoreService.StreamUndispatchedCaptures:output_type -> state.v1.StreamUndispatchedCapturesResponse
222, // 370: state.v1.StateStoreService.EnqueueBindingTask:output_type -> state.v1.EnqueueBindingTaskResponse
224, // 371: state.v1.StateStoreService.EnqueueCallTask:output_type -> state.v1.EnqueueCallTaskResponse
226, // 372: state.v1.StateStoreService.WorkflowCallStatus:output_type -> state.v1.WorkflowCallStatusResponse
247, // 373: state.v1.StateStoreService.GetPrincipal:output_type -> state.v1.GetPrincipalResponse
250, // 374: state.v1.StateStoreService.ListPolicies:output_type -> state.v1.ListPoliciesResponse
252, // 375: state.v1.StateStoreService.PutPolicy:output_type -> state.v1.PutPolicyResponse
254, // 376: state.v1.StateStoreService.DeletePolicy:output_type -> state.v1.DeletePolicyResponse
256, // 377: state.v1.StateStoreService.EnsureShippedOrgPolicies:output_type -> state.v1.EnsureShippedOrgPoliciesResponse
259, // 378: state.v1.StateStoreService.RecordDenial:output_type -> state.v1.RecordDenialResponse
261, // 379: state.v1.StateStoreService.ListDenials:output_type -> state.v1.ListDenialsResponse
266, // 380: state.v1.StateStoreService.ListOrgs:output_type -> state.v1.ListOrgsResponse
268, // 381: state.v1.StateStoreService.GetOrg:output_type -> state.v1.GetOrgResponse
270, // 382: state.v1.StateStoreService.CreateOrg:output_type -> state.v1.CreateOrgResponse
272, // 383: state.v1.StateStoreService.ListWorkspaces:output_type -> state.v1.ListWorkspacesResponse
274, // 384: state.v1.StateStoreService.CreateWorkspace:output_type -> state.v1.CreateWorkspaceResponse
276, // 385: state.v1.StateStoreService.ListMembers:output_type -> state.v1.ListMembersResponse
278, // 386: state.v1.StateStoreService.SetMembership:output_type -> state.v1.SetMembershipResponse
280, // 387: state.v1.StateStoreService.RemoveMembership:output_type -> state.v1.RemoveMembershipResponse
282, // 388: state.v1.StateStoreService.AssignAgent:output_type -> state.v1.AssignAgentResponse
263, // [263:389] is the sub-list for method output_type
137, // [137:263] is the sub-list for method input_type
137, // [137:137] is the sub-list for extension type_name
137, // [137:137] is the sub-list for extension extendee
0, // [0:137] is the sub-list for field type_name
295, // 134: state.v1.TaskModelsResponse.aliases:type_name -> state.v1.TaskModelsResponse.AliasesEntry
296, // 135: state.v1.TaskModelsResponse.providers:type_name -> state.v1.TaskModelsResponse.ProvidersEntry
297, // 136: state.v1.CallerModelsResponse.aliases:type_name -> state.v1.CallerModelsResponse.AliasesEntry
290, // 137: state.v1.TaskModelsResponse.ProvidersEntry.value:type_name -> state.v1.ModelProvider
283, // 138: state.v1.StateStoreService.RecentLogs:input_type -> state.v1.RecentLogsRequest
229, // 139: state.v1.StateStoreService.InstallPackage:input_type -> state.v1.InstallPackageRequest
232, // 140: state.v1.StateStoreService.ListCatalogue:input_type -> state.v1.ListCatalogueRequest
234, // 141: state.v1.StateStoreService.InstallFromCatalogue:input_type -> state.v1.InstallFromCatalogueRequest
236, // 142: state.v1.StateStoreService.GetInstalledPackage:input_type -> state.v1.GetInstalledPackageRequest
238, // 143: state.v1.StateStoreService.ListInstalledPackages:input_type -> state.v1.ListInstalledPackagesRequest
240, // 144: state.v1.StateStoreService.AcceptPackageAuthority:input_type -> state.v1.AcceptPackageAuthorityRequest
242, // 145: state.v1.StateStoreService.RemoveInstalledPackage:input_type -> state.v1.RemoveInstalledPackageRequest
0, // 146: state.v1.StateStoreService.RegisterTaskGrant:input_type -> state.v1.RegisterTaskGrantRequest
2, // 147: state.v1.StateStoreService.RevokeTaskGrant:input_type -> state.v1.RevokeTaskGrantRequest
4, // 148: state.v1.StateStoreService.ResolveTaskGrant:input_type -> state.v1.ResolveTaskGrantRequest
8, // 149: state.v1.StateStoreService.ListIdentities:input_type -> state.v1.ListIdentitiesRequest
10, // 150: state.v1.StateStoreService.GetIdentity:input_type -> state.v1.GetIdentityRequest
12, // 151: state.v1.StateStoreService.CreateIdentity:input_type -> state.v1.CreateIdentityRequest
13, // 152: state.v1.StateStoreService.RenameIdentity:input_type -> state.v1.RenameIdentityRequest
14, // 153: state.v1.StateStoreService.SuspendIdentity:input_type -> state.v1.SuspendIdentityRequest
15, // 154: state.v1.StateStoreService.ReactivateIdentity:input_type -> state.v1.ReactivateIdentityRequest
16, // 155: state.v1.StateStoreService.RetireIdentity:input_type -> state.v1.RetireIdentityRequest
22, // 156: state.v1.StateStoreService.ResolveIdentitySubject:input_type -> state.v1.ResolveIdentitySubjectRequest
24, // 157: state.v1.StateStoreService.BindIdentitySubject:input_type -> state.v1.BindIdentitySubjectRequest
27, // 158: state.v1.StateStoreService.AddPersonalToken:input_type -> state.v1.AddPersonalTokenRequest
29, // 159: state.v1.StateStoreService.ListPersonalTokens:input_type -> state.v1.ListPersonalTokensRequest
31, // 160: state.v1.StateStoreService.RevokePersonalToken:input_type -> state.v1.RevokePersonalTokenRequest
47, // 161: state.v1.StateStoreService.EnqueueIssue:input_type -> state.v1.EnqueueIssueRequest
51, // 162: state.v1.StateStoreService.EnqueueChatTask:input_type -> state.v1.EnqueueChatTaskRequest
49, // 163: state.v1.StateStoreService.ActiveTasksByOrigin:input_type -> state.v1.ActiveTasksByOriginRequest
53, // 164: state.v1.StateStoreService.ClaimNext:input_type -> state.v1.ClaimNextRequest
55, // 165: state.v1.StateStoreService.ClaimByIssue:input_type -> state.v1.ClaimByIssueRequest
57, // 166: state.v1.StateStoreService.Transition:input_type -> state.v1.TransitionRequest
73, // 167: state.v1.StateStoreService.Update:input_type -> state.v1.UpdateRequest
59, // 168: state.v1.StateStoreService.StartStep:input_type -> state.v1.StartStepRequest
286, // 169: state.v1.StateStoreService.RecordUsage:input_type -> state.v1.RecordUsageRequest
288, // 170: state.v1.StateStoreService.TaskModels:input_type -> state.v1.TaskModelsRequest
291, // 171: state.v1.StateStoreService.CallerModels:input_type -> state.v1.CallerModelsRequest
61, // 172: state.v1.StateStoreService.FinishStep:input_type -> state.v1.FinishStepRequest
63, // 173: state.v1.StateStoreService.CancelExecution:input_type -> state.v1.CancelExecutionRequest
66, // 174: state.v1.StateStoreService.ListSteps:input_type -> state.v1.ListStepsRequest
69, // 175: state.v1.StateStoreService.GetHarnessSecret:input_type -> state.v1.GetHarnessSecretRequest
71, // 176: state.v1.StateStoreService.PutHarnessSecret:input_type -> state.v1.PutHarnessSecretRequest
75, // 177: state.v1.StateStoreService.Requeue:input_type -> state.v1.RequeueRequest
77, // 178: state.v1.StateStoreService.ParkTask:input_type -> state.v1.ParkTaskRequest
79, // 179: state.v1.StateStoreService.RecoverStale:input_type -> state.v1.RecoverStaleRequest
81, // 180: state.v1.StateStoreService.ArchiveTask:input_type -> state.v1.ArchiveTaskRequest
83, // 181: state.v1.StateStoreService.RetryTask:input_type -> state.v1.RetryTaskRequest
85, // 182: state.v1.StateStoreService.RespondReviewGate:input_type -> state.v1.RespondReviewGateRequest
87, // 183: state.v1.StateStoreService.BeginRemediation:input_type -> state.v1.BeginRemediationRequest
89, // 184: state.v1.StateStoreService.UpdateReviewPayload:input_type -> state.v1.UpdateReviewPayloadRequest
91, // 185: state.v1.StateStoreService.SetReviewCursors:input_type -> state.v1.SetReviewCursorsRequest
93, // 186: state.v1.StateStoreService.TaskByIssue:input_type -> state.v1.TaskByIssueRequest
95, // 187: state.v1.StateStoreService.OpenTaskByPR:input_type -> state.v1.OpenTaskByPRRequest
97, // 188: state.v1.StateStoreService.TaskByID:input_type -> state.v1.TaskByIDRequest
99, // 189: state.v1.StateStoreService.OpenPRs:input_type -> state.v1.OpenPRsRequest
101, // 190: state.v1.StateStoreService.ClearTerminalTasks:input_type -> state.v1.ClearTerminalTasksRequest
103, // 191: state.v1.StateStoreService.Tasks:input_type -> state.v1.TasksRequest
105, // 192: state.v1.StateStoreService.StatusCounts:input_type -> state.v1.StatusCountsRequest
107, // 193: state.v1.StateStoreService.InsertEvent:input_type -> state.v1.InsertEventRequest
109, // 194: state.v1.StateStoreService.EventsSince:input_type -> state.v1.EventsSinceRequest
111, // 195: state.v1.StateStoreService.TaskEvents:input_type -> state.v1.TaskEventsRequest
113, // 196: state.v1.StateStoreService.WorkflowStats:input_type -> state.v1.WorkflowStatsRequest
115, // 197: state.v1.StateStoreService.StageStats:input_type -> state.v1.StageStatsRequest
117, // 198: state.v1.StateStoreService.TokensByDay:input_type -> state.v1.TokensByDayRequest
120, // 199: state.v1.StateStoreService.PutConfigSnapshot:input_type -> state.v1.PutConfigSnapshotRequest
122, // 200: state.v1.StateStoreService.GetConfigSnapshot:input_type -> state.v1.GetConfigSnapshotRequest
125, // 201: state.v1.StateStoreService.PutChannelStatus:input_type -> state.v1.PutChannelStatusRequest
127, // 202: state.v1.StateStoreService.ListChannelStatus:input_type -> state.v1.ListChannelStatusRequest
130, // 203: state.v1.StateStoreService.PutApplyStatus:input_type -> state.v1.PutApplyStatusRequest
132, // 204: state.v1.StateStoreService.ListApplyStatus:input_type -> state.v1.ListApplyStatusRequest
141, // 205: state.v1.StateStoreService.PutPresence:input_type -> state.v1.PutPresenceRequest
136, // 206: state.v1.StateStoreService.RecordCaptureRefusal:input_type -> state.v1.RecordCaptureRefusalRequest
138, // 207: state.v1.StateStoreService.ListCaptureRefusals:input_type -> state.v1.ListCaptureRefusalsRequest
143, // 208: state.v1.StateStoreService.ListPresence:input_type -> state.v1.ListPresenceRequest
146, // 209: state.v1.StateStoreService.ReadTaskLog:input_type -> state.v1.ReadTaskLogRequest
148, // 210: state.v1.StateStoreService.StreamTaskLogContent:input_type -> state.v1.StreamTaskLogContentRequest
150, // 211: state.v1.StateStoreService.InsertCapture:input_type -> state.v1.InsertCaptureRequest
152, // 212: state.v1.StateStoreService.StreamCaptures:input_type -> state.v1.StreamCapturesRequest
154, // 213: state.v1.StateStoreService.InsertMapping:input_type -> state.v1.InsertMappingRequest
156, // 214: state.v1.StateStoreService.GetMapping:input_type -> state.v1.GetMappingRequest
158, // 215: state.v1.StateStoreService.ListMappings:input_type -> state.v1.ListMappingsRequest
160, // 216: state.v1.StateStoreService.UpdateMapping:input_type -> state.v1.UpdateMappingRequest
162, // 217: state.v1.StateStoreService.DeleteMapping:input_type -> state.v1.DeleteMappingRequest
164, // 218: state.v1.StateStoreService.RecordMappingMatch:input_type -> state.v1.RecordMappingMatchRequest
166, // 219: state.v1.StateStoreService.InsertEventType:input_type -> state.v1.InsertEventTypeRequest
168, // 220: state.v1.StateStoreService.UpdateEventType:input_type -> state.v1.UpdateEventTypeRequest
170, // 221: state.v1.StateStoreService.DeleteEventType:input_type -> state.v1.DeleteEventTypeRequest
172, // 222: state.v1.StateStoreService.ListEventTypes:input_type -> state.v1.ListEventTypesRequest
174, // 223: state.v1.StateStoreService.InsertBinding:input_type -> state.v1.InsertBindingRequest
176, // 224: state.v1.StateStoreService.GetBinding:input_type -> state.v1.GetBindingRequest
178, // 225: state.v1.StateStoreService.ListBindings:input_type -> state.v1.ListBindingsRequest
212, // 226: state.v1.StateStoreService.ListDispatches:input_type -> state.v1.ListDispatchesRequest
180, // 227: state.v1.StateStoreService.UpdateBinding:input_type -> state.v1.UpdateBindingRequest
182, // 228: state.v1.StateStoreService.DeleteBinding:input_type -> state.v1.DeleteBindingRequest
184, // 229: state.v1.StateStoreService.ApproveBinding:input_type -> state.v1.ApproveBindingRequest
192, // 230: state.v1.StateStoreService.PauseBinding:input_type -> state.v1.PauseBindingRequest
194, // 231: state.v1.StateStoreService.ResumeBinding:input_type -> state.v1.ResumeBindingRequest
196, // 232: state.v1.StateStoreService.InsertSource:input_type -> state.v1.InsertSourceRequest
198, // 233: state.v1.StateStoreService.GetSource:input_type -> state.v1.GetSourceRequest
200, // 234: state.v1.StateStoreService.ListSources:input_type -> state.v1.ListSourcesRequest
202, // 235: state.v1.StateStoreService.SetSourceSigning:input_type -> state.v1.SetSourceSigningRequest
204, // 236: state.v1.StateStoreService.SetSourceSecret:input_type -> state.v1.SetSourceSecretRequest
186, // 237: state.v1.StateStoreService.SetSourceName:input_type -> state.v1.SetSourceNameRequest
188, // 238: state.v1.StateStoreService.SetSourceDeliveryHeader:input_type -> state.v1.SetSourceDeliveryHeaderRequest
190, // 239: state.v1.StateStoreService.DeleteSource:input_type -> state.v1.DeleteSourceRequest
206, // 240: state.v1.StateStoreService.ArmedBindingsForSource:input_type -> state.v1.ArmedBindingsForSourceRequest
208, // 241: state.v1.StateStoreService.RecordDispatch:input_type -> state.v1.RecordDispatchRequest
210, // 242: state.v1.StateStoreService.SetDispatchTask:input_type -> state.v1.SetDispatchTaskRequest
215, // 243: state.v1.StateStoreService.RecordPlaybookDispatch:input_type -> state.v1.RecordPlaybookDispatchRequest
217, // 244: state.v1.StateStoreService.DeletePlaybookDispatches:input_type -> state.v1.DeletePlaybookDispatchesRequest
219, // 245: state.v1.StateStoreService.StreamUndispatchedCaptures:input_type -> state.v1.StreamUndispatchedCapturesRequest
221, // 246: state.v1.StateStoreService.EnqueueBindingTask:input_type -> state.v1.EnqueueBindingTaskRequest
223, // 247: state.v1.StateStoreService.EnqueueCallTask:input_type -> state.v1.EnqueueCallTaskRequest
225, // 248: state.v1.StateStoreService.WorkflowCallStatus:input_type -> state.v1.WorkflowCallStatusRequest
244, // 249: state.v1.StateStoreService.GetPrincipal:input_type -> state.v1.GetPrincipalRequest
249, // 250: state.v1.StateStoreService.ListPolicies:input_type -> state.v1.ListPoliciesRequest
251, // 251: state.v1.StateStoreService.PutPolicy:input_type -> state.v1.PutPolicyRequest
253, // 252: state.v1.StateStoreService.DeletePolicy:input_type -> state.v1.DeletePolicyRequest
255, // 253: state.v1.StateStoreService.EnsureShippedOrgPolicies:input_type -> state.v1.EnsureShippedOrgPoliciesRequest
258, // 254: state.v1.StateStoreService.RecordDenial:input_type -> state.v1.RecordDenialRequest
260, // 255: state.v1.StateStoreService.ListDenials:input_type -> state.v1.ListDenialsRequest
265, // 256: state.v1.StateStoreService.ListOrgs:input_type -> state.v1.ListOrgsRequest
267, // 257: state.v1.StateStoreService.GetOrg:input_type -> state.v1.GetOrgRequest
269, // 258: state.v1.StateStoreService.CreateOrg:input_type -> state.v1.CreateOrgRequest
271, // 259: state.v1.StateStoreService.ListWorkspaces:input_type -> state.v1.ListWorkspacesRequest
273, // 260: state.v1.StateStoreService.CreateWorkspace:input_type -> state.v1.CreateWorkspaceRequest
275, // 261: state.v1.StateStoreService.ListMembers:input_type -> state.v1.ListMembersRequest
277, // 262: state.v1.StateStoreService.SetMembership:input_type -> state.v1.SetMembershipRequest
279, // 263: state.v1.StateStoreService.RemoveMembership:input_type -> state.v1.RemoveMembershipRequest
281, // 264: state.v1.StateStoreService.AssignAgent:input_type -> state.v1.AssignAgentRequest
284, // 265: state.v1.StateStoreService.RecentLogs:output_type -> state.v1.RecentLogsResponse
230, // 266: state.v1.StateStoreService.InstallPackage:output_type -> state.v1.InstallPackageResponse
233, // 267: state.v1.StateStoreService.ListCatalogue:output_type -> state.v1.ListCatalogueResponse
235, // 268: state.v1.StateStoreService.InstallFromCatalogue:output_type -> state.v1.InstallFromCatalogueResponse
237, // 269: state.v1.StateStoreService.GetInstalledPackage:output_type -> state.v1.GetInstalledPackageResponse
239, // 270: state.v1.StateStoreService.ListInstalledPackages:output_type -> state.v1.ListInstalledPackagesResponse
241, // 271: state.v1.StateStoreService.AcceptPackageAuthority:output_type -> state.v1.AcceptPackageAuthorityResponse
243, // 272: state.v1.StateStoreService.RemoveInstalledPackage:output_type -> state.v1.RemoveInstalledPackageResponse
1, // 273: state.v1.StateStoreService.RegisterTaskGrant:output_type -> state.v1.RegisterTaskGrantResponse
3, // 274: state.v1.StateStoreService.RevokeTaskGrant:output_type -> state.v1.RevokeTaskGrantResponse
5, // 275: state.v1.StateStoreService.ResolveTaskGrant:output_type -> state.v1.ResolveTaskGrantResponse
9, // 276: state.v1.StateStoreService.ListIdentities:output_type -> state.v1.ListIdentitiesResponse
11, // 277: state.v1.StateStoreService.GetIdentity:output_type -> state.v1.GetIdentityResponse
17, // 278: state.v1.StateStoreService.CreateIdentity:output_type -> state.v1.CreateIdentityResponse
18, // 279: state.v1.StateStoreService.RenameIdentity:output_type -> state.v1.RenameIdentityResponse
19, // 280: state.v1.StateStoreService.SuspendIdentity:output_type -> state.v1.SuspendIdentityResponse
20, // 281: state.v1.StateStoreService.ReactivateIdentity:output_type -> state.v1.ReactivateIdentityResponse
21, // 282: state.v1.StateStoreService.RetireIdentity:output_type -> state.v1.RetireIdentityResponse
23, // 283: state.v1.StateStoreService.ResolveIdentitySubject:output_type -> state.v1.ResolveIdentitySubjectResponse
25, // 284: state.v1.StateStoreService.BindIdentitySubject:output_type -> state.v1.BindIdentitySubjectResponse
28, // 285: state.v1.StateStoreService.AddPersonalToken:output_type -> state.v1.AddPersonalTokenResponse
30, // 286: state.v1.StateStoreService.ListPersonalTokens:output_type -> state.v1.ListPersonalTokensResponse
32, // 287: state.v1.StateStoreService.RevokePersonalToken:output_type -> state.v1.RevokePersonalTokenResponse
48, // 288: state.v1.StateStoreService.EnqueueIssue:output_type -> state.v1.EnqueueIssueResponse
52, // 289: state.v1.StateStoreService.EnqueueChatTask:output_type -> state.v1.EnqueueChatTaskResponse
50, // 290: state.v1.StateStoreService.ActiveTasksByOrigin:output_type -> state.v1.ActiveTasksByOriginResponse
54, // 291: state.v1.StateStoreService.ClaimNext:output_type -> state.v1.ClaimNextResponse
56, // 292: state.v1.StateStoreService.ClaimByIssue:output_type -> state.v1.ClaimByIssueResponse
58, // 293: state.v1.StateStoreService.Transition:output_type -> state.v1.TransitionResponse
74, // 294: state.v1.StateStoreService.Update:output_type -> state.v1.UpdateResponse
60, // 295: state.v1.StateStoreService.StartStep:output_type -> state.v1.StartStepResponse
287, // 296: state.v1.StateStoreService.RecordUsage:output_type -> state.v1.RecordUsageResponse
289, // 297: state.v1.StateStoreService.TaskModels:output_type -> state.v1.TaskModelsResponse
292, // 298: state.v1.StateStoreService.CallerModels:output_type -> state.v1.CallerModelsResponse
62, // 299: state.v1.StateStoreService.FinishStep:output_type -> state.v1.FinishStepResponse
64, // 300: state.v1.StateStoreService.CancelExecution:output_type -> state.v1.CancelExecutionResponse
67, // 301: state.v1.StateStoreService.ListSteps:output_type -> state.v1.ListStepsResponse
70, // 302: state.v1.StateStoreService.GetHarnessSecret:output_type -> state.v1.GetHarnessSecretResponse
72, // 303: state.v1.StateStoreService.PutHarnessSecret:output_type -> state.v1.PutHarnessSecretResponse
76, // 304: state.v1.StateStoreService.Requeue:output_type -> state.v1.RequeueResponse
78, // 305: state.v1.StateStoreService.ParkTask:output_type -> state.v1.ParkTaskResponse
80, // 306: state.v1.StateStoreService.RecoverStale:output_type -> state.v1.RecoverStaleResponse
82, // 307: state.v1.StateStoreService.ArchiveTask:output_type -> state.v1.ArchiveTaskResponse
84, // 308: state.v1.StateStoreService.RetryTask:output_type -> state.v1.RetryTaskResponse
86, // 309: state.v1.StateStoreService.RespondReviewGate:output_type -> state.v1.RespondReviewGateResponse
88, // 310: state.v1.StateStoreService.BeginRemediation:output_type -> state.v1.BeginRemediationResponse
90, // 311: state.v1.StateStoreService.UpdateReviewPayload:output_type -> state.v1.UpdateReviewPayloadResponse
92, // 312: state.v1.StateStoreService.SetReviewCursors:output_type -> state.v1.SetReviewCursorsResponse
94, // 313: state.v1.StateStoreService.TaskByIssue:output_type -> state.v1.TaskByIssueResponse
96, // 314: state.v1.StateStoreService.OpenTaskByPR:output_type -> state.v1.OpenTaskByPRResponse
98, // 315: state.v1.StateStoreService.TaskByID:output_type -> state.v1.TaskByIDResponse
100, // 316: state.v1.StateStoreService.OpenPRs:output_type -> state.v1.OpenPRsResponse
102, // 317: state.v1.StateStoreService.ClearTerminalTasks:output_type -> state.v1.ClearTerminalTasksResponse
104, // 318: state.v1.StateStoreService.Tasks:output_type -> state.v1.TasksResponse
106, // 319: state.v1.StateStoreService.StatusCounts:output_type -> state.v1.StatusCountsResponse
108, // 320: state.v1.StateStoreService.InsertEvent:output_type -> state.v1.InsertEventResponse
110, // 321: state.v1.StateStoreService.EventsSince:output_type -> state.v1.EventsSinceResponse
112, // 322: state.v1.StateStoreService.TaskEvents:output_type -> state.v1.TaskEventsResponse
114, // 323: state.v1.StateStoreService.WorkflowStats:output_type -> state.v1.WorkflowStatsResponse
116, // 324: state.v1.StateStoreService.StageStats:output_type -> state.v1.StageStatsResponse
118, // 325: state.v1.StateStoreService.TokensByDay:output_type -> state.v1.TokensByDayResponse
121, // 326: state.v1.StateStoreService.PutConfigSnapshot:output_type -> state.v1.PutConfigSnapshotResponse
123, // 327: state.v1.StateStoreService.GetConfigSnapshot:output_type -> state.v1.GetConfigSnapshotResponse
126, // 328: state.v1.StateStoreService.PutChannelStatus:output_type -> state.v1.PutChannelStatusResponse
128, // 329: state.v1.StateStoreService.ListChannelStatus:output_type -> state.v1.ListChannelStatusResponse
131, // 330: state.v1.StateStoreService.PutApplyStatus:output_type -> state.v1.PutApplyStatusResponse
133, // 331: state.v1.StateStoreService.ListApplyStatus:output_type -> state.v1.ListApplyStatusResponse
142, // 332: state.v1.StateStoreService.PutPresence:output_type -> state.v1.PutPresenceResponse
137, // 333: state.v1.StateStoreService.RecordCaptureRefusal:output_type -> state.v1.RecordCaptureRefusalResponse
140, // 334: state.v1.StateStoreService.ListCaptureRefusals:output_type -> state.v1.ListCaptureRefusalsResponse
144, // 335: state.v1.StateStoreService.ListPresence:output_type -> state.v1.ListPresenceResponse
147, // 336: state.v1.StateStoreService.ReadTaskLog:output_type -> state.v1.ReadTaskLogResponse
149, // 337: state.v1.StateStoreService.StreamTaskLogContent:output_type -> state.v1.StreamTaskLogContentResponse
151, // 338: state.v1.StateStoreService.InsertCapture:output_type -> state.v1.InsertCaptureResponse
153, // 339: state.v1.StateStoreService.StreamCaptures:output_type -> state.v1.StreamCapturesResponse
155, // 340: state.v1.StateStoreService.InsertMapping:output_type -> state.v1.InsertMappingResponse
157, // 341: state.v1.StateStoreService.GetMapping:output_type -> state.v1.GetMappingResponse
159, // 342: state.v1.StateStoreService.ListMappings:output_type -> state.v1.ListMappingsResponse
161, // 343: state.v1.StateStoreService.UpdateMapping:output_type -> state.v1.UpdateMappingResponse
163, // 344: state.v1.StateStoreService.DeleteMapping:output_type -> state.v1.DeleteMappingResponse
165, // 345: state.v1.StateStoreService.RecordMappingMatch:output_type -> state.v1.RecordMappingMatchResponse
167, // 346: state.v1.StateStoreService.InsertEventType:output_type -> state.v1.InsertEventTypeResponse
169, // 347: state.v1.StateStoreService.UpdateEventType:output_type -> state.v1.UpdateEventTypeResponse
171, // 348: state.v1.StateStoreService.DeleteEventType:output_type -> state.v1.DeleteEventTypeResponse
173, // 349: state.v1.StateStoreService.ListEventTypes:output_type -> state.v1.ListEventTypesResponse
175, // 350: state.v1.StateStoreService.InsertBinding:output_type -> state.v1.InsertBindingResponse
177, // 351: state.v1.StateStoreService.GetBinding:output_type -> state.v1.GetBindingResponse
179, // 352: state.v1.StateStoreService.ListBindings:output_type -> state.v1.ListBindingsResponse
214, // 353: state.v1.StateStoreService.ListDispatches:output_type -> state.v1.ListDispatchesResponse
181, // 354: state.v1.StateStoreService.UpdateBinding:output_type -> state.v1.UpdateBindingResponse
183, // 355: state.v1.StateStoreService.DeleteBinding:output_type -> state.v1.DeleteBindingResponse
185, // 356: state.v1.StateStoreService.ApproveBinding:output_type -> state.v1.ApproveBindingResponse
193, // 357: state.v1.StateStoreService.PauseBinding:output_type -> state.v1.PauseBindingResponse
195, // 358: state.v1.StateStoreService.ResumeBinding:output_type -> state.v1.ResumeBindingResponse
197, // 359: state.v1.StateStoreService.InsertSource:output_type -> state.v1.InsertSourceResponse
199, // 360: state.v1.StateStoreService.GetSource:output_type -> state.v1.GetSourceResponse
201, // 361: state.v1.StateStoreService.ListSources:output_type -> state.v1.ListSourcesResponse
203, // 362: state.v1.StateStoreService.SetSourceSigning:output_type -> state.v1.SetSourceSigningResponse
205, // 363: state.v1.StateStoreService.SetSourceSecret:output_type -> state.v1.SetSourceSecretResponse
187, // 364: state.v1.StateStoreService.SetSourceName:output_type -> state.v1.SetSourceNameResponse
189, // 365: state.v1.StateStoreService.SetSourceDeliveryHeader:output_type -> state.v1.SetSourceDeliveryHeaderResponse
191, // 366: state.v1.StateStoreService.DeleteSource:output_type -> state.v1.DeleteSourceResponse
207, // 367: state.v1.StateStoreService.ArmedBindingsForSource:output_type -> state.v1.ArmedBindingsForSourceResponse
209, // 368: state.v1.StateStoreService.RecordDispatch:output_type -> state.v1.RecordDispatchResponse
211, // 369: state.v1.StateStoreService.SetDispatchTask:output_type -> state.v1.SetDispatchTaskResponse
216, // 370: state.v1.StateStoreService.RecordPlaybookDispatch:output_type -> state.v1.RecordPlaybookDispatchResponse
218, // 371: state.v1.StateStoreService.DeletePlaybookDispatches:output_type -> state.v1.DeletePlaybookDispatchesResponse
220, // 372: state.v1.StateStoreService.StreamUndispatchedCaptures:output_type -> state.v1.StreamUndispatchedCapturesResponse
222, // 373: state.v1.StateStoreService.EnqueueBindingTask:output_type -> state.v1.EnqueueBindingTaskResponse
224, // 374: state.v1.StateStoreService.EnqueueCallTask:output_type -> state.v1.EnqueueCallTaskResponse
226, // 375: state.v1.StateStoreService.WorkflowCallStatus:output_type -> state.v1.WorkflowCallStatusResponse
247, // 376: state.v1.StateStoreService.GetPrincipal:output_type -> state.v1.GetPrincipalResponse
250, // 377: state.v1.StateStoreService.ListPolicies:output_type -> state.v1.ListPoliciesResponse
252, // 378: state.v1.StateStoreService.PutPolicy:output_type -> state.v1.PutPolicyResponse
254, // 379: state.v1.StateStoreService.DeletePolicy:output_type -> state.v1.DeletePolicyResponse
256, // 380: state.v1.StateStoreService.EnsureShippedOrgPolicies:output_type -> state.v1.EnsureShippedOrgPoliciesResponse
259, // 381: state.v1.StateStoreService.RecordDenial:output_type -> state.v1.RecordDenialResponse
261, // 382: state.v1.StateStoreService.ListDenials:output_type -> state.v1.ListDenialsResponse
266, // 383: state.v1.StateStoreService.ListOrgs:output_type -> state.v1.ListOrgsResponse
268, // 384: state.v1.StateStoreService.GetOrg:output_type -> state.v1.GetOrgResponse
270, // 385: state.v1.StateStoreService.CreateOrg:output_type -> state.v1.CreateOrgResponse
272, // 386: state.v1.StateStoreService.ListWorkspaces:output_type -> state.v1.ListWorkspacesResponse
274, // 387: state.v1.StateStoreService.CreateWorkspace:output_type -> state.v1.CreateWorkspaceResponse
276, // 388: state.v1.StateStoreService.ListMembers:output_type -> state.v1.ListMembersResponse
278, // 389: state.v1.StateStoreService.SetMembership:output_type -> state.v1.SetMembershipResponse
280, // 390: state.v1.StateStoreService.RemoveMembership:output_type -> state.v1.RemoveMembershipResponse
282, // 391: state.v1.StateStoreService.AssignAgent:output_type -> state.v1.AssignAgentResponse
265, // [265:392] is the sub-list for method output_type
138, // [138:265] is the sub-list for method input_type
138, // [138:138] is the sub-list for extension type_name
138, // [138:138] is the sub-list for extension extendee
0, // [0:138] is the sub-list for field type_name
}
func init() { file_state_v1_state_proto_init() }
@@ -17652,7 +17745,7 @@ func file_state_v1_state_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_state_v1_state_proto_rawDesc), len(file_state_v1_state_proto_rawDesc)),
NumEnums: 0,
NumMessages: 295,
NumMessages: 298,
NumExtensions: 0,
NumServices: 1,
},
@@ -52,6 +52,7 @@ const (
StateStoreService_StartStep_FullMethodName = "/state.v1.StateStoreService/StartStep"
StateStoreService_RecordUsage_FullMethodName = "/state.v1.StateStoreService/RecordUsage"
StateStoreService_TaskModels_FullMethodName = "/state.v1.StateStoreService/TaskModels"
StateStoreService_CallerModels_FullMethodName = "/state.v1.StateStoreService/CallerModels"
StateStoreService_FinishStep_FullMethodName = "/state.v1.StateStoreService/FinishStep"
StateStoreService_CancelExecution_FullMethodName = "/state.v1.StateStoreService/CancelExecution"
StateStoreService_ListSteps_FullMethodName = "/state.v1.StateStoreService/ListSteps"
@@ -213,6 +214,9 @@ type StateStoreServiceClient interface {
// org may use and the org's own providers. The org is the task's, never
// the caller's.
TaskModels(ctx context.Context, in *TaskModelsRequest, opts ...grpc.CallOption) (*TaskModelsResponse, error)
// CallerModels answers the model aliases the caller's org may use. The org
// is the calling principal's; a call with none is the system org's.
CallerModels(ctx context.Context, in *CallerModelsRequest, opts ...grpc.CallOption) (*CallerModelsResponse, error)
FinishStep(ctx context.Context, in *FinishStepRequest, opts ...grpc.CallOption) (*FinishStepResponse, error)
// Cancellation. Deliberately administrative (deny-by-default for a
// task-scoped grant): a cancel is a dashboard, API and dispatch action
@@ -727,6 +731,16 @@ func (c *stateStoreServiceClient) TaskModels(ctx context.Context, in *TaskModels
return out, nil
}
func (c *stateStoreServiceClient) CallerModels(ctx context.Context, in *CallerModelsRequest, opts ...grpc.CallOption) (*CallerModelsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CallerModelsResponse)
err := c.cc.Invoke(ctx, StateStoreService_CallerModels_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *stateStoreServiceClient) FinishStep(ctx context.Context, in *FinishStepRequest, opts ...grpc.CallOption) (*FinishStepResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FinishStepResponse)
@@ -1750,6 +1764,9 @@ type StateStoreServiceServer interface {
// org may use and the org's own providers. The org is the task's, never
// the caller's.
TaskModels(context.Context, *TaskModelsRequest) (*TaskModelsResponse, error)
// CallerModels answers the model aliases the caller's org may use. The org
// is the calling principal's; a call with none is the system org's.
CallerModels(context.Context, *CallerModelsRequest) (*CallerModelsResponse, error)
FinishStep(context.Context, *FinishStepRequest) (*FinishStepResponse, error)
// Cancellation. Deliberately administrative (deny-by-default for a
// task-scoped grant): a cancel is a dashboard, API and dispatch action
@@ -2033,6 +2050,9 @@ func (UnimplementedStateStoreServiceServer) RecordUsage(context.Context, *Record
func (UnimplementedStateStoreServiceServer) TaskModels(context.Context, *TaskModelsRequest) (*TaskModelsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method TaskModels not implemented")
}
func (UnimplementedStateStoreServiceServer) CallerModels(context.Context, *CallerModelsRequest) (*CallerModelsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method CallerModels not implemented")
}
func (UnimplementedStateStoreServiceServer) FinishStep(context.Context, *FinishStepRequest) (*FinishStepResponse, error) {
return nil, status.Error(codes.Unimplemented, "method FinishStep not implemented")
}
@@ -2927,6 +2947,24 @@ func _StateStoreService_TaskModels_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_CallerModels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CallerModelsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StateStoreServiceServer).CallerModels(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: StateStoreService_CallerModels_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StateStoreServiceServer).CallerModels(ctx, req.(*CallerModelsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_FinishStep_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FinishStepRequest)
if err := dec(in); err != nil {
@@ -4719,6 +4757,10 @@ var StateStoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "TaskModels",
Handler: _StateStoreService_TaskModels_Handler,
},
{
MethodName: "CallerModels",
Handler: _StateStoreService_CallerModels_Handler,
},
{
MethodName: "FinishStep",
Handler: _StateStoreService_FinishStep_Handler,
+5
View File
@@ -47,6 +47,11 @@ func (a *LocalChatAdapter) Snapshot(ctx context.Context) (ChatSnapshot, error) {
s := ChatSnapshot{Sessions: sessions, Models: []string{}, Providers: []string{}, Personas: []string{}, ModelsByProvider: map[string][]string{}, ActivePersonas: map[string]string{}, RestartAvailable: a.Router.Restart != nil, CancellationAvailable: a.Turns != nil, PersonasAvailable: a.Personas != nil, VoiceAvailable: a.VoiceAvailable, Version: a.Router.Version}
if a.Models != nil {
s.Models = slices.Clone(a.Models.Models())
if manager, ok := a.Models.(OrgModelManager); ok {
if s.Models, err = manager.ModelsFor(ctx); err != nil {
return ChatSnapshot{}, err
}
}
s.ActiveModel = a.Models.ActiveAlias()
}
if a.Personas != nil {
+20 -1
View File
@@ -67,6 +67,14 @@ type ModelManager interface {
SetActiveModel(ctx context.Context, alias string) error
}
// OrgModelManager is the optional org-aware extension: the aliases and the
// active model for the org of the principal ctx carries.
type OrgModelManager interface {
ModelManager
ModelsFor(ctx context.Context) ([]string, error)
ModelFor(ctx context.Context) (string, error)
}
// ModelDetails is the catalog metadata rendered after an interactive model
// selection. Limits are zero when the upstream catalog does not publish them.
type ModelDetails = messaging.ModelDetails
@@ -497,7 +505,10 @@ func (r *Router) handleModel(ctx context.Context, arg string) (string, error) {
return "Model switching is not configured.", nil
}
if arg == "" {
models := r.Models.Models()
models, err := r.chatModels(ctx)
if err != nil {
return fmt.Sprintf("Cannot list models: %v", err), nil
}
if len(models) == 0 {
return "No model aliases configured.\nUsage: /model <alias>", nil
}
@@ -519,6 +530,14 @@ func (r *Router) handleModel(ctx context.Context, arg string) (string, error) {
return fmt.Sprintf("Active model set to %s.", arg), nil
}
// chatModels lists the aliases the caller's org may switch between.
func (r *Router) chatModels(ctx context.Context) ([]string, error) {
if manager, ok := r.Models.(OrgModelManager); ok {
return manager.ModelsFor(ctx)
}
return r.Models.Models(), nil
}
// restAfter returns the text after the command token, stripping the
// optional @gateway mention. E.g. for "/spawn Fix the bug", returns
// "Fix the bug".
+6
View File
@@ -310,6 +310,12 @@ func (r *TurnRunner) prepareTurn(ctx context.Context, sessionID string, in Inbou
// adapter can carry a clarify/picker interaction (see WithInteractive).
extraTools = append(extraTools, InteractiveTools(ctx)...)
modelName := r.Models.ActiveModel()
if manager, ok := r.Models.(OrgModelManager); ok {
var err error
if modelName, err = manager.ModelFor(ctx); err != nil {
return preparedTurn{}, err
}
}
modelDetails := ModelDetails{}
if detailed, ok := r.Models.(DetailedModelManager); ok {
modelDetails, _ = detailed.ModelDetails(modelName)
@@ -140,6 +140,16 @@ func (c *Client) TaskModels(ctx context.Context, taskID int64) (config.OrgModels
return config.OrgModels{Org: r.OrgId, Aliases: r.Aliases, Providers: providers}, nil
}
// CallerModels returns the calling principal's org and the aliases it may
// use.
func (c *Client) CallerModels(ctx context.Context) (string, map[string]string, error) {
r, err := c.client.CallerModels(ctx, &pb.CallerModelsRequest{})
if err != nil {
return "", nil, unmapError(err)
}
return r.OrgId, r.Aliases, nil
}
// RecordUsage appends one model call's usage record.
func (c *Client) RecordUsage(ctx context.Context, r usage.Record) error {
_, err := c.client.RecordUsage(ctx, &pb.RecordUsageRequest{Record: usageProto(r)})
+18 -1
View File
@@ -265,7 +265,11 @@ func (s *server) RecordUsage(ctx context.Context, r *pb.RecordUsageRequest) (*pb
if r.Record == nil {
return nil, status.Error(codes.InvalidArgument, "record is required")
}
if err := s.deps.Usage.RecordUsage(ctx, usageValue(r.Record)); err != nil {
record := usageValue(r.Record)
// The caller never names the org: a task's is its row's, which the store
// applies; anything else is the calling principal's.
record.Org = string(org.OrgFromContext(ctx))
if err := s.deps.Usage.RecordUsage(ctx, record); err != nil {
return nil, s.logErr("RecordUsage", err)
}
return &pb.RecordUsageResponse{}, nil
@@ -295,6 +299,19 @@ func (s *server) TaskModels(ctx context.Context, r *pb.TaskModelsRequest) (*pb.T
return &pb.TaskModelsResponse{OrgId: orgID, Aliases: aliases, Providers: out}, nil
}
// CallerModels answers the aliases the calling principal's org may use.
func (s *server) CallerModels(ctx context.Context, _ *pb.CallerModelsRequest) (*pb.CallerModelsResponse, error) {
if s.deps.OrgModels == nil {
return nil, status.Error(codes.Unavailable, "model aliases unavailable")
}
orgID := string(org.OrgFromContext(ctx))
aliases, _, err := s.deps.OrgModels(ctx, orgID)
if err != nil {
return nil, s.logErr("CallerModels", err)
}
return &pb.CallerModelsResponse{OrgId: orgID, Aliases: aliases}, nil
}
// CancelExecution is the one cancel path:
// the store records the cancellation and returns the steps it cancelled; the
// caller delivers it by cancelling the run's in-memory context afterwards.
@@ -16,7 +16,7 @@ func TestRecordUsageAuthority(t *testing.T) {
}{
{"own task", &pb.UsageRecord{TaskId: 7}, true},
{"another task", &pb.UsageRecord{TaskId: 8}, false},
{"no task", &pb.UsageRecord{OrgId: "org-sys"}, false},
{"no task", &pb.UsageRecord{Source: "chat"}, false},
{"no record", nil, false},
} {
t.Run(tt.name, func(t *testing.T) {
@@ -0,0 +1,40 @@
package staterpc
import (
"context"
"testing"
pb "github.com/samcharles93/archie-core/internal/contracts/state/v1"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/usage"
)
type usageCapture struct{ got usage.Record }
func (u *usageCapture) RecordUsage(_ context.Context, r usage.Record) error { u.got = r; return nil }
// Chat usage is billed to the org of the principal the call was made for;
// a call made for nobody is the system org's.
func TestRecordUsageBillsTheCallersOrg(t *testing.T) {
for _, tt := range []struct {
name, caller, want string
}{
{"a principal's call", "acme", "acme"},
{"a call for nobody", "", string(org.DefaultOrgID)},
} {
t.Run(tt.name, func(t *testing.T) {
capture := &usageCapture{}
s := &server{deps: Deps{Usage: capture}}
ctx := context.Background()
if tt.caller != "" {
ctx = org.WithOrg(ctx, org.OrgID(tt.caller))
}
if _, err := s.RecordUsage(ctx, &pb.RecordUsageRequest{Record: &pb.UsageRecord{Source: "chat", Provider: "openai", Model: "m"}}); err != nil {
t.Fatal(err)
}
if capture.got.Org != tt.want {
t.Fatalf("org = %q, want %q", capture.got.Org, tt.want)
}
})
}
}
@@ -9,7 +9,7 @@ import (
func usageProto(r usage.Record) *pb.UsageRecord {
return &pb.UsageRecord{
OrgId: r.Org, Source: string(r.Source), TaskId: r.TaskID, Attempt: int64(r.Attempt),
Source: string(r.Source), TaskId: r.TaskID, Attempt: int64(r.Attempt),
Workflow: r.Workflow, Step: r.Step, Alias: r.Alias, Provider: r.Provider, Model: r.Model,
InputTokens: r.InputTokens, OutputTokens: r.OutputTokens, CachedTokens: r.CachedTokens,
At: timestamppb.New(r.At),
@@ -18,7 +18,7 @@ func usageProto(r usage.Record) *pb.UsageRecord {
func usageValue(r *pb.UsageRecord) usage.Record {
return usage.Record{
Org: r.GetOrgId(), Source: usage.Source(r.GetSource()), TaskID: r.GetTaskId(), Attempt: int(r.GetAttempt()),
Source: usage.Source(r.GetSource()), TaskID: r.GetTaskId(), Attempt: int(r.GetAttempt()),
Workflow: r.GetWorkflow(), Step: r.GetStep(), Alias: r.GetAlias(), Provider: r.GetProvider(), Model: r.GetModel(),
InputTokens: r.GetInputTokens(), OutputTokens: r.GetOutputTokens(), CachedTokens: r.GetCachedTokens(),
At: r.GetAt().AsTime(),
+11 -2
View File
@@ -68,6 +68,9 @@ service StateStoreService {
// org may use and the org's own providers. The org is the task's, never
// the caller's.
rpc TaskModels(TaskModelsRequest) returns (TaskModelsResponse);
// CallerModels answers the model aliases the caller's org may use. The org
// is the calling principal's; a call with none is the system org's.
rpc CallerModels(CallerModelsRequest) returns (CallerModelsResponse);
rpc FinishStep(FinishStepRequest) returns (FinishStepResponse);
// Cancellation. Deliberately administrative (deny-by-default for a
// task-scoped grant): a cancel is a dashboard, API and dispatch action
@@ -1501,9 +1504,10 @@ message RecentLogsRequest { logging.v1.LogQuery query = 1; }
message RecentLogsResponse { logging.v1.LogSnapshot snapshot = 1; }
// UsageRecord mirrors usage.Record. A task's record belongs to the task's
// org, whatever org_id says.
// org; any other belongs to the calling principal's org.
message UsageRecord {
string org_id = 1;
reserved 1;
reserved "org_id";
// source is task, chat or curator.
string source = 2;
int64 task_id = 3;
@@ -1533,3 +1537,8 @@ message ModelProvider {
string base_url = 2;
string api_key_env = 3;
}
message CallerModelsRequest {}
message CallerModelsResponse {
string org_id = 1;
map<string, string> aliases = 2;
}