@miradorlabs/web-grpc 4.17.0 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,46 @@ export function adminUsageGroupSortToJSON(object: AdminUsageGroupSort): string {
145
145
  }
146
146
  }
147
147
 
148
+ /** AITask mirrors ai.api.v1.AITask: an AI job a revision configures. */
149
+ export enum AITask {
150
+ AI_TASK_UNSPECIFIED = 0,
151
+ AI_TASK_SESSION_INSIGHT = 1,
152
+ AI_TASK_PROJECT_INSIGHT = 2,
153
+ UNRECOGNIZED = -1,
154
+ }
155
+
156
+ export function aITaskFromJSON(object: any): AITask {
157
+ switch (object) {
158
+ case 0:
159
+ case "AI_TASK_UNSPECIFIED":
160
+ return AITask.AI_TASK_UNSPECIFIED;
161
+ case 1:
162
+ case "AI_TASK_SESSION_INSIGHT":
163
+ return AITask.AI_TASK_SESSION_INSIGHT;
164
+ case 2:
165
+ case "AI_TASK_PROJECT_INSIGHT":
166
+ return AITask.AI_TASK_PROJECT_INSIGHT;
167
+ case -1:
168
+ case "UNRECOGNIZED":
169
+ default:
170
+ return AITask.UNRECOGNIZED;
171
+ }
172
+ }
173
+
174
+ export function aITaskToJSON(object: AITask): string {
175
+ switch (object) {
176
+ case AITask.AI_TASK_UNSPECIFIED:
177
+ return "AI_TASK_UNSPECIFIED";
178
+ case AITask.AI_TASK_SESSION_INSIGHT:
179
+ return "AI_TASK_SESSION_INSIGHT";
180
+ case AITask.AI_TASK_PROJECT_INSIGHT:
181
+ return "AI_TASK_PROJECT_INSIGHT";
182
+ case AITask.UNRECOGNIZED:
183
+ default:
184
+ return "UNRECOGNIZED";
185
+ }
186
+ }
187
+
148
188
  export interface GetAdminStatusRequest {
149
189
  }
150
190
 
@@ -541,6 +581,126 @@ export interface UserDetails {
541
581
  name: string;
542
582
  }
543
583
 
584
+ export interface ListAITasksRequest {
585
+ }
586
+
587
+ export interface ListAITasksResponse {
588
+ status:
589
+ | ResponseStatus
590
+ | undefined;
591
+ /** In AITask order. */
592
+ tasks: AITaskDefinition[];
593
+ }
594
+
595
+ /**
596
+ * AITaskDefinition mirrors ai.api.v1.AITaskDefinition: one job as staff configure it, its name and description from
597
+ * code, its active revision, and the code-owned parts its prompt is sent with.
598
+ */
599
+ export interface AITaskDefinition {
600
+ task: AITask;
601
+ /** "Session insights", "Project insights". */
602
+ displayName: string;
603
+ /** One sentence on what the job does. */
604
+ description: string;
605
+ /** Unset when no revision is active: the job runs built_in_instruction on its chart model. */
606
+ activation:
607
+ | AITaskActivation
608
+ | undefined;
609
+ /** The answer's JSON schema, read-only. */
610
+ schemaJson: string;
611
+ /** Text the job appends to the prompt (the enum vocabularies), read-only; empty when it appends none. */
612
+ appendedInstruction: string;
613
+ /**
614
+ * The prompt the job runs while no revision is active, read-only: the code's embedded prompt, byte for byte, sent
615
+ * followed by appended_instruction on the model in the job's deploy config, which is not served here.
616
+ */
617
+ builtInInstruction: string;
618
+ }
619
+
620
+ /** AITaskActivation is a job's active revision and who activated it, when. */
621
+ export interface AITaskActivation {
622
+ revision:
623
+ | AITaskRevision
624
+ | undefined;
625
+ /** The Mirador account user id. */
626
+ activatedByUserId: string;
627
+ activateTime: Date | undefined;
628
+ }
629
+
630
+ /** AITaskRevision is one saved, immutable revision of a job's model and prompt. */
631
+ export interface AITaskRevision {
632
+ id: string;
633
+ task: AITask;
634
+ /** Counts the job's revisions from 1, for display ("v7"). */
635
+ number: number;
636
+ model: string;
637
+ /** The base prompt, byte for byte; the job sends it followed by its appended_instruction. */
638
+ instruction: string;
639
+ note: string;
640
+ /** The Mirador account user id. */
641
+ createdByUserId: string;
642
+ createTime: Date | undefined;
643
+ }
644
+
645
+ export interface ListAITaskRevisionsRequest {
646
+ /** The parent: UNSPECIFIED or an unknown value is a validation error. */
647
+ task: AITask;
648
+ /** The server default (10) when 0, coerced to 20 above it; negative is a validation error. */
649
+ pageSize: number;
650
+ /** From a prior response with the same task; any other token is a validation error. */
651
+ pageToken: string;
652
+ }
653
+
654
+ export interface ListAITaskRevisionsResponse {
655
+ status: ResponseStatus | undefined;
656
+ revisions: AITaskRevision[];
657
+ /** Empty once the last page has been returned. */
658
+ nextPageToken: string;
659
+ }
660
+
661
+ export interface CreateAITaskRevisionRequest {
662
+ /** UNSPECIFIED or an unknown value is a validation error. */
663
+ task: AITask;
664
+ /**
665
+ * A model the environment's serving endpoint serves, as "<publisher>/<model>": two non-empty parts of ASCII
666
+ * letters, digits and . _ - @ :, at most 128 bytes; anything else is a validation error. Only its shape is checked.
667
+ */
668
+ model: string;
669
+ /**
670
+ * Valid UTF-8 without NUL, non-blank, at most 64 KiB, stored byte for byte; anything else is a validation error.
671
+ * The job sends it followed by appended_instruction.
672
+ */
673
+ instruction: string;
674
+ /** What changed and why: valid UTF-8 without NUL, at most 1 KiB; anything else is a validation error. */
675
+ note: string;
676
+ }
677
+
678
+ export interface CreateAITaskRevisionResponse {
679
+ status: ResponseStatus | undefined;
680
+ revision: AITaskRevision | undefined;
681
+ }
682
+
683
+ export interface ActivateAITaskRevisionRequest {
684
+ /** UNSPECIFIED or an unknown value is a validation error. */
685
+ task: AITask;
686
+ /** A revision of task; a malformed id is a validation error, another job's revision or an unknown id is not found. */
687
+ revisionId: string;
688
+ }
689
+
690
+ export interface ActivateAITaskRevisionResponse {
691
+ status: ResponseStatus | undefined;
692
+ activation: AITaskActivation | undefined;
693
+ }
694
+
695
+ export interface DeactivateAITaskRevisionRequest {
696
+ /** UNSPECIFIED or an unknown value is a validation error. */
697
+ task: AITask;
698
+ }
699
+
700
+ export interface DeactivateAITaskRevisionResponse {
701
+ status: ResponseStatus | undefined;
702
+ }
703
+
544
704
  function createBaseGetAdminStatusRequest(): GetAdminStatusRequest {
545
705
  return {};
546
706
  }
@@ -5196,160 +5356,1586 @@ export const UserDetails: MessageFns<UserDetails> = {
5196
5356
  },
5197
5357
  };
5198
5358
 
5199
- /**
5200
- * AdminGatewayService is the browser-facing surface of the admin tools, across every domain, which only
5201
- * Mirador staff (a verified mirador.org primary email) may use. The gateway's admin gate admits every RPC
5202
- * here except GetAdminStatus, which tells the frontend whether to show the admin tools at all.
5203
- */
5204
- export interface AdminGatewayService {
5205
- /** GetAdminStatus reports whether the authenticated caller may use the admin tools. */
5206
- GetAdminStatus(request: GetAdminStatusRequest, metadata?: Metadata): Promise<GetAdminStatusResponse>;
5207
- /** Beta invite codes for this gateway's product. */
5208
- GenerateInviteCodes(request: GenerateInviteCodesRequest, metadata?: Metadata): Promise<GenerateInviteCodesResponse>;
5209
- ListInviteCodes(request: ListInviteCodesRequest, metadata?: Metadata): Promise<ListInviteCodesResponse>;
5210
- /** SendInviteCodeEmail emails one available code to an address and records when and to whom it was sent. */
5211
- SendInviteCodeEmail(request: SendInviteCodeEmailRequest, metadata?: Metadata): Promise<SendInviteCodeEmailResponse>;
5212
- /**
5213
- * Staff set a global AI name's display name for every organization. An update makes the name MANUAL; the
5214
- * model processor never overwrites it. The tables are read through ReferenceGatewayService.
5215
- */
5216
- UpdateAIProvider(request: UpdateAIProviderRequest, metadata?: Metadata): Promise<UpdateAIProviderResponse>;
5217
- UpdateAIModel(request: UpdateAIModelRequest, metadata?: Metadata): Promise<UpdateAIModelResponse>;
5218
- UpdateAIEffort(request: UpdateAIEffortRequest, metadata?: Metadata): Promise<UpdateAIEffortResponse>;
5219
- UpdateAIBiller(request: UpdateAIBillerRequest, metadata?: Metadata): Promise<UpdateAIBillerResponse>;
5220
- /**
5221
- * Each Confirm<X> confirms every unreviewed name in the groups a List<X>Groups filter keeps (on every page),
5222
- * as one Update<X> per name would; it proxies telemetry.api.v1.TelemetryAdminService's Confirm<X>. It
5223
- * confirms what matches when it runs: compare confirmed_name_count with the count shown. Names are global: an
5224
- * unset observation also confirms groups none of the organizations reported. Observation OBSERVED keeps only
5225
- * the groups they reported, and still confirms every unreviewed name in them, including a spelling in the same
5226
- * group none of them reported.
5227
- */
5228
- ConfirmAIProviders(request: ConfirmAIProvidersRequest, metadata?: Metadata): Promise<ConfirmAIProvidersResponse>;
5229
- ConfirmAIModels(request: ConfirmAIModelsRequest, metadata?: Metadata): Promise<ConfirmAIModelsResponse>;
5230
- ConfirmAIEfforts(request: ConfirmAIEffortsRequest, metadata?: Metadata): Promise<ConfirmAIEffortsResponse>;
5231
- ConfirmAIBillers(request: ConfirmAIBillersRequest, metadata?: Metadata): Promise<ConfirmAIBillersResponse>;
5232
- /**
5233
- * Every Terma relay across the fleet with its latest heartbeat in full, one row per (organization, project, user,
5234
- * host), most recently seen first (keyset-paginated); it proxies
5235
- * telemetry.api.v1.TelemetryAdminService.ListRelayHeartbeats. Rows carry ids, not names.
5236
- */
5237
- ListRelayHeartbeats(
5238
- request: ListAdminRelayHeartbeatsRequest,
5239
- metadata?: Metadata,
5240
- ): Promise<ListAdminRelayHeartbeatsResponse>;
5241
- /**
5242
- * AI usage summed across every organization over whole UTC days, grouped by the dimensions asked for (none is one
5243
- * row, the totals), numbered pages; it proxies ai.api.v1.AIAdminService.ListUsageGroups. Rows carry ids, not names.
5244
- */
5245
- ListUsageGroups(request: ListAdminUsageGroupsRequest, metadata?: Metadata): Promise<ListAdminUsageGroupsResponse>;
5246
- /**
5247
- * ResolveOrgDetails resolves organization ids to their names, in batch, across every organization of this gateway's
5248
- * product. Unknown ids, and ids of another product, are left out; it never errors on them. A malformed id, or more
5249
- * than 1000 ids, is a validation error. It proxies account.api.v1.AccountAdminService.ResolveOrgDetails.
5250
- */
5251
- ResolveOrgDetails(request: ResolveOrgDetailsRequest, metadata?: Metadata): Promise<ResolveOrgDetailsResponse>;
5252
- /**
5253
- * ResolveProjectDetails resolves project (team) ids to their names, in batch, across every organization of this
5254
- * gateway's product, deleted projects included. Unknown ids, and ids of another product, are left out; it never
5255
- * errors on them. A malformed id, or more than 1000 ids, is a validation error. It proxies
5256
- * account.api.v1.AccountAdminService.ResolveProjectDetails.
5257
- */
5258
- ResolveProjectDetails(
5259
- request: ResolveProjectDetailsRequest,
5260
- metadata?: Metadata,
5261
- ): Promise<ResolveProjectDetailsResponse>;
5262
- /**
5263
- * ResolveUserDetails resolves one user's email address and name, on demand. An unknown user, or one of another
5264
- * product, is NOT_FOUND; a malformed or empty id is a validation error; a user directory outage is UNAVAILABLE. It
5265
- * proxies account.api.v1.AccountAdminService.ResolveUserDetails.
5266
- */
5267
- ResolveUserDetails(request: ResolveUserDetailsRequest, metadata?: Metadata): Promise<ResolveUserDetailsResponse>;
5359
+ function createBaseListAITasksRequest(): ListAITasksRequest {
5360
+ return {};
5268
5361
  }
5269
5362
 
5270
- export const AdminGatewayServiceServiceName = "gateway.web.v1.AdminGatewayService";
5271
- export class AdminGatewayServiceClientImpl implements AdminGatewayService {
5272
- private readonly rpc: Rpc;
5273
- private readonly service: string;
5274
- constructor(rpc: Rpc, opts?: { service?: string }) {
5275
- this.service = opts?.service || AdminGatewayServiceServiceName;
5276
- this.rpc = rpc;
5277
- this.GetAdminStatus = this.GetAdminStatus.bind(this);
5278
- this.GenerateInviteCodes = this.GenerateInviteCodes.bind(this);
5279
- this.ListInviteCodes = this.ListInviteCodes.bind(this);
5280
- this.SendInviteCodeEmail = this.SendInviteCodeEmail.bind(this);
5281
- this.UpdateAIProvider = this.UpdateAIProvider.bind(this);
5282
- this.UpdateAIModel = this.UpdateAIModel.bind(this);
5283
- this.UpdateAIEffort = this.UpdateAIEffort.bind(this);
5284
- this.UpdateAIBiller = this.UpdateAIBiller.bind(this);
5285
- this.ConfirmAIProviders = this.ConfirmAIProviders.bind(this);
5286
- this.ConfirmAIModels = this.ConfirmAIModels.bind(this);
5287
- this.ConfirmAIEfforts = this.ConfirmAIEfforts.bind(this);
5288
- this.ConfirmAIBillers = this.ConfirmAIBillers.bind(this);
5289
- this.ListRelayHeartbeats = this.ListRelayHeartbeats.bind(this);
5290
- this.ListUsageGroups = this.ListUsageGroups.bind(this);
5291
- this.ResolveOrgDetails = this.ResolveOrgDetails.bind(this);
5292
- this.ResolveProjectDetails = this.ResolveProjectDetails.bind(this);
5293
- this.ResolveUserDetails = this.ResolveUserDetails.bind(this);
5294
- }
5295
- GetAdminStatus(request: GetAdminStatusRequest, metadata?: Metadata): Promise<GetAdminStatusResponse> {
5296
- const data = GetAdminStatusRequest.encode(request).finish();
5297
- const promise = this.rpc.request(this.service, "GetAdminStatus", data, metadata);
5298
- return promise.then((data) => GetAdminStatusResponse.decode(new BinaryReader(data)));
5299
- }
5300
-
5301
- GenerateInviteCodes(request: GenerateInviteCodesRequest, metadata?: Metadata): Promise<GenerateInviteCodesResponse> {
5302
- const data = GenerateInviteCodesRequest.encode(request).finish();
5303
- const promise = this.rpc.request(this.service, "GenerateInviteCodes", data, metadata);
5304
- return promise.then((data) => GenerateInviteCodesResponse.decode(new BinaryReader(data)));
5305
- }
5306
-
5307
- ListInviteCodes(request: ListInviteCodesRequest, metadata?: Metadata): Promise<ListInviteCodesResponse> {
5308
- const data = ListInviteCodesRequest.encode(request).finish();
5309
- const promise = this.rpc.request(this.service, "ListInviteCodes", data, metadata);
5310
- return promise.then((data) => ListInviteCodesResponse.decode(new BinaryReader(data)));
5311
- }
5363
+ export const ListAITasksRequest: MessageFns<ListAITasksRequest> = {
5364
+ encode(_: ListAITasksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5365
+ return writer;
5366
+ },
5312
5367
 
5313
- SendInviteCodeEmail(request: SendInviteCodeEmailRequest, metadata?: Metadata): Promise<SendInviteCodeEmailResponse> {
5314
- const data = SendInviteCodeEmailRequest.encode(request).finish();
5315
- const promise = this.rpc.request(this.service, "SendInviteCodeEmail", data, metadata);
5316
- return promise.then((data) => SendInviteCodeEmailResponse.decode(new BinaryReader(data)));
5317
- }
5368
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAITasksRequest {
5369
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5370
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5371
+ if (previousRecursionDepth >= 100) {
5372
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5373
+ }
5374
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5375
+ try {
5376
+ const end = length === undefined ? reader.len : reader.pos + length;
5377
+ const message = createBaseListAITasksRequest();
5378
+ while (reader.pos < end) {
5379
+ const tag = reader.uint32();
5380
+ switch (tag >>> 3) {
5381
+ }
5382
+ if ((tag & 7) === 4 || tag === 0) {
5383
+ break;
5384
+ }
5385
+ reader.skip(tag & 7);
5386
+ }
5387
+ return message;
5388
+ } finally {
5389
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5390
+ }
5391
+ },
5318
5392
 
5319
- UpdateAIProvider(request: UpdateAIProviderRequest, metadata?: Metadata): Promise<UpdateAIProviderResponse> {
5320
- const data = UpdateAIProviderRequest.encode(request).finish();
5321
- const promise = this.rpc.request(this.service, "UpdateAIProvider", data, metadata);
5322
- return promise.then((data) => UpdateAIProviderResponse.decode(new BinaryReader(data)));
5323
- }
5393
+ fromJSON(_: any): ListAITasksRequest {
5394
+ return {};
5395
+ },
5324
5396
 
5325
- UpdateAIModel(request: UpdateAIModelRequest, metadata?: Metadata): Promise<UpdateAIModelResponse> {
5326
- const data = UpdateAIModelRequest.encode(request).finish();
5327
- const promise = this.rpc.request(this.service, "UpdateAIModel", data, metadata);
5328
- return promise.then((data) => UpdateAIModelResponse.decode(new BinaryReader(data)));
5329
- }
5397
+ toJSON(_: ListAITasksRequest): unknown {
5398
+ const obj: any = {};
5399
+ return obj;
5400
+ },
5330
5401
 
5331
- UpdateAIEffort(request: UpdateAIEffortRequest, metadata?: Metadata): Promise<UpdateAIEffortResponse> {
5332
- const data = UpdateAIEffortRequest.encode(request).finish();
5333
- const promise = this.rpc.request(this.service, "UpdateAIEffort", data, metadata);
5334
- return promise.then((data) => UpdateAIEffortResponse.decode(new BinaryReader(data)));
5335
- }
5402
+ create<I extends Exact<DeepPartial<ListAITasksRequest>, I>>(base?: I): ListAITasksRequest {
5403
+ return ListAITasksRequest.fromPartial(base ?? ({} as any));
5404
+ },
5405
+ fromPartial<I extends Exact<DeepPartial<ListAITasksRequest>, I>>(_: I): ListAITasksRequest {
5406
+ const message = createBaseListAITasksRequest();
5407
+ return message;
5408
+ },
5409
+ };
5336
5410
 
5337
- UpdateAIBiller(request: UpdateAIBillerRequest, metadata?: Metadata): Promise<UpdateAIBillerResponse> {
5338
- const data = UpdateAIBillerRequest.encode(request).finish();
5339
- const promise = this.rpc.request(this.service, "UpdateAIBiller", data, metadata);
5340
- return promise.then((data) => UpdateAIBillerResponse.decode(new BinaryReader(data)));
5341
- }
5411
+ function createBaseListAITasksResponse(): ListAITasksResponse {
5412
+ return { status: undefined, tasks: [] };
5413
+ }
5342
5414
 
5343
- ConfirmAIProviders(request: ConfirmAIProvidersRequest, metadata?: Metadata): Promise<ConfirmAIProvidersResponse> {
5344
- const data = ConfirmAIProvidersRequest.encode(request).finish();
5345
- const promise = this.rpc.request(this.service, "ConfirmAIProviders", data, metadata);
5346
- return promise.then((data) => ConfirmAIProvidersResponse.decode(new BinaryReader(data)));
5347
- }
5415
+ export const ListAITasksResponse: MessageFns<ListAITasksResponse> = {
5416
+ encode(message: ListAITasksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5417
+ if (message.status !== undefined) {
5418
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
5419
+ }
5420
+ for (const v of message.tasks) {
5421
+ AITaskDefinition.encode(v!, writer.uint32(18).fork()).join();
5422
+ }
5423
+ return writer;
5424
+ },
5348
5425
 
5349
- ConfirmAIModels(request: ConfirmAIModelsRequest, metadata?: Metadata): Promise<ConfirmAIModelsResponse> {
5350
- const data = ConfirmAIModelsRequest.encode(request).finish();
5351
- const promise = this.rpc.request(this.service, "ConfirmAIModels", data, metadata);
5352
- return promise.then((data) => ConfirmAIModelsResponse.decode(new BinaryReader(data)));
5426
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAITasksResponse {
5427
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5428
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5429
+ if (previousRecursionDepth >= 100) {
5430
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5431
+ }
5432
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5433
+ try {
5434
+ const end = length === undefined ? reader.len : reader.pos + length;
5435
+ const message = createBaseListAITasksResponse();
5436
+ while (reader.pos < end) {
5437
+ const tag = reader.uint32();
5438
+ switch (tag >>> 3) {
5439
+ case 1: {
5440
+ if (tag !== 10) {
5441
+ break;
5442
+ }
5443
+
5444
+ message.status = ResponseStatus.decode(reader, reader.uint32());
5445
+ continue;
5446
+ }
5447
+ case 2: {
5448
+ if (tag !== 18) {
5449
+ break;
5450
+ }
5451
+
5452
+ message.tasks.push(AITaskDefinition.decode(reader, reader.uint32()));
5453
+ continue;
5454
+ }
5455
+ }
5456
+ if ((tag & 7) === 4 || tag === 0) {
5457
+ break;
5458
+ }
5459
+ reader.skip(tag & 7);
5460
+ }
5461
+ return message;
5462
+ } finally {
5463
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5464
+ }
5465
+ },
5466
+
5467
+ fromJSON(object: any): ListAITasksResponse {
5468
+ return {
5469
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
5470
+ tasks: globalThis.Array.isArray(object?.tasks) ? object.tasks.map((e: any) => AITaskDefinition.fromJSON(e)) : [],
5471
+ };
5472
+ },
5473
+
5474
+ toJSON(message: ListAITasksResponse): unknown {
5475
+ const obj: any = {};
5476
+ if (message.status !== undefined) {
5477
+ obj.status = ResponseStatus.toJSON(message.status);
5478
+ }
5479
+ if (message.tasks?.length) {
5480
+ obj.tasks = message.tasks.map((e) => AITaskDefinition.toJSON(e));
5481
+ }
5482
+ return obj;
5483
+ },
5484
+
5485
+ create<I extends Exact<DeepPartial<ListAITasksResponse>, I>>(base?: I): ListAITasksResponse {
5486
+ return ListAITasksResponse.fromPartial(base ?? ({} as any));
5487
+ },
5488
+ fromPartial<I extends Exact<DeepPartial<ListAITasksResponse>, I>>(object: I): ListAITasksResponse {
5489
+ const message = createBaseListAITasksResponse();
5490
+ message.status = (object.status !== undefined && object.status !== null)
5491
+ ? ResponseStatus.fromPartial(object.status)
5492
+ : undefined;
5493
+ message.tasks = object.tasks?.map((e) => AITaskDefinition.fromPartial(e)) || [];
5494
+ return message;
5495
+ },
5496
+ };
5497
+
5498
+ function createBaseAITaskDefinition(): AITaskDefinition {
5499
+ return {
5500
+ task: 0,
5501
+ displayName: "",
5502
+ description: "",
5503
+ activation: undefined,
5504
+ schemaJson: "",
5505
+ appendedInstruction: "",
5506
+ builtInInstruction: "",
5507
+ };
5508
+ }
5509
+
5510
+ export const AITaskDefinition: MessageFns<AITaskDefinition> = {
5511
+ encode(message: AITaskDefinition, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5512
+ if (message.task !== 0) {
5513
+ writer.uint32(8).int32(message.task);
5514
+ }
5515
+ if (message.displayName !== "") {
5516
+ writer.uint32(18).string(message.displayName);
5517
+ }
5518
+ if (message.description !== "") {
5519
+ writer.uint32(26).string(message.description);
5520
+ }
5521
+ if (message.activation !== undefined) {
5522
+ AITaskActivation.encode(message.activation, writer.uint32(34).fork()).join();
5523
+ }
5524
+ if (message.schemaJson !== "") {
5525
+ writer.uint32(42).string(message.schemaJson);
5526
+ }
5527
+ if (message.appendedInstruction !== "") {
5528
+ writer.uint32(50).string(message.appendedInstruction);
5529
+ }
5530
+ if (message.builtInInstruction !== "") {
5531
+ writer.uint32(58).string(message.builtInInstruction);
5532
+ }
5533
+ return writer;
5534
+ },
5535
+
5536
+ decode(input: BinaryReader | Uint8Array, length?: number): AITaskDefinition {
5537
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5538
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5539
+ if (previousRecursionDepth >= 100) {
5540
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5541
+ }
5542
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5543
+ try {
5544
+ const end = length === undefined ? reader.len : reader.pos + length;
5545
+ const message = createBaseAITaskDefinition();
5546
+ while (reader.pos < end) {
5547
+ const tag = reader.uint32();
5548
+ switch (tag >>> 3) {
5549
+ case 1: {
5550
+ if (tag !== 8) {
5551
+ break;
5552
+ }
5553
+
5554
+ message.task = reader.int32() as any;
5555
+ continue;
5556
+ }
5557
+ case 2: {
5558
+ if (tag !== 18) {
5559
+ break;
5560
+ }
5561
+
5562
+ message.displayName = reader.string();
5563
+ continue;
5564
+ }
5565
+ case 3: {
5566
+ if (tag !== 26) {
5567
+ break;
5568
+ }
5569
+
5570
+ message.description = reader.string();
5571
+ continue;
5572
+ }
5573
+ case 4: {
5574
+ if (tag !== 34) {
5575
+ break;
5576
+ }
5577
+
5578
+ message.activation = AITaskActivation.decode(reader, reader.uint32());
5579
+ continue;
5580
+ }
5581
+ case 5: {
5582
+ if (tag !== 42) {
5583
+ break;
5584
+ }
5585
+
5586
+ message.schemaJson = reader.string();
5587
+ continue;
5588
+ }
5589
+ case 6: {
5590
+ if (tag !== 50) {
5591
+ break;
5592
+ }
5593
+
5594
+ message.appendedInstruction = reader.string();
5595
+ continue;
5596
+ }
5597
+ case 7: {
5598
+ if (tag !== 58) {
5599
+ break;
5600
+ }
5601
+
5602
+ message.builtInInstruction = reader.string();
5603
+ continue;
5604
+ }
5605
+ }
5606
+ if ((tag & 7) === 4 || tag === 0) {
5607
+ break;
5608
+ }
5609
+ reader.skip(tag & 7);
5610
+ }
5611
+ return message;
5612
+ } finally {
5613
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5614
+ }
5615
+ },
5616
+
5617
+ fromJSON(object: any): AITaskDefinition {
5618
+ return {
5619
+ task: isSet(object.task) ? aITaskFromJSON(object.task) : 0,
5620
+ displayName: isSet(object.displayName)
5621
+ ? globalThis.String(object.displayName)
5622
+ : isSet(object.display_name)
5623
+ ? globalThis.String(object.display_name)
5624
+ : "",
5625
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
5626
+ activation: isSet(object.activation) ? AITaskActivation.fromJSON(object.activation) : undefined,
5627
+ schemaJson: isSet(object.schemaJson)
5628
+ ? globalThis.String(object.schemaJson)
5629
+ : isSet(object.schema_json)
5630
+ ? globalThis.String(object.schema_json)
5631
+ : "",
5632
+ appendedInstruction: isSet(object.appendedInstruction)
5633
+ ? globalThis.String(object.appendedInstruction)
5634
+ : isSet(object.appended_instruction)
5635
+ ? globalThis.String(object.appended_instruction)
5636
+ : "",
5637
+ builtInInstruction: isSet(object.builtInInstruction)
5638
+ ? globalThis.String(object.builtInInstruction)
5639
+ : isSet(object.built_in_instruction)
5640
+ ? globalThis.String(object.built_in_instruction)
5641
+ : "",
5642
+ };
5643
+ },
5644
+
5645
+ toJSON(message: AITaskDefinition): unknown {
5646
+ const obj: any = {};
5647
+ if (message.task !== 0) {
5648
+ obj.task = aITaskToJSON(message.task);
5649
+ }
5650
+ if (message.displayName !== "") {
5651
+ obj.displayName = message.displayName;
5652
+ }
5653
+ if (message.description !== "") {
5654
+ obj.description = message.description;
5655
+ }
5656
+ if (message.activation !== undefined) {
5657
+ obj.activation = AITaskActivation.toJSON(message.activation);
5658
+ }
5659
+ if (message.schemaJson !== "") {
5660
+ obj.schemaJson = message.schemaJson;
5661
+ }
5662
+ if (message.appendedInstruction !== "") {
5663
+ obj.appendedInstruction = message.appendedInstruction;
5664
+ }
5665
+ if (message.builtInInstruction !== "") {
5666
+ obj.builtInInstruction = message.builtInInstruction;
5667
+ }
5668
+ return obj;
5669
+ },
5670
+
5671
+ create<I extends Exact<DeepPartial<AITaskDefinition>, I>>(base?: I): AITaskDefinition {
5672
+ return AITaskDefinition.fromPartial(base ?? ({} as any));
5673
+ },
5674
+ fromPartial<I extends Exact<DeepPartial<AITaskDefinition>, I>>(object: I): AITaskDefinition {
5675
+ const message = createBaseAITaskDefinition();
5676
+ message.task = object.task ?? 0;
5677
+ message.displayName = object.displayName ?? "";
5678
+ message.description = object.description ?? "";
5679
+ message.activation = (object.activation !== undefined && object.activation !== null)
5680
+ ? AITaskActivation.fromPartial(object.activation)
5681
+ : undefined;
5682
+ message.schemaJson = object.schemaJson ?? "";
5683
+ message.appendedInstruction = object.appendedInstruction ?? "";
5684
+ message.builtInInstruction = object.builtInInstruction ?? "";
5685
+ return message;
5686
+ },
5687
+ };
5688
+
5689
+ function createBaseAITaskActivation(): AITaskActivation {
5690
+ return { revision: undefined, activatedByUserId: "", activateTime: undefined };
5691
+ }
5692
+
5693
+ export const AITaskActivation: MessageFns<AITaskActivation> = {
5694
+ encode(message: AITaskActivation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5695
+ if (message.revision !== undefined) {
5696
+ AITaskRevision.encode(message.revision, writer.uint32(10).fork()).join();
5697
+ }
5698
+ if (message.activatedByUserId !== "") {
5699
+ writer.uint32(18).string(message.activatedByUserId);
5700
+ }
5701
+ if (message.activateTime !== undefined) {
5702
+ Timestamp.encode(toTimestamp(message.activateTime), writer.uint32(26).fork()).join();
5703
+ }
5704
+ return writer;
5705
+ },
5706
+
5707
+ decode(input: BinaryReader | Uint8Array, length?: number): AITaskActivation {
5708
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5709
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5710
+ if (previousRecursionDepth >= 100) {
5711
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5712
+ }
5713
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5714
+ try {
5715
+ const end = length === undefined ? reader.len : reader.pos + length;
5716
+ const message = createBaseAITaskActivation();
5717
+ while (reader.pos < end) {
5718
+ const tag = reader.uint32();
5719
+ switch (tag >>> 3) {
5720
+ case 1: {
5721
+ if (tag !== 10) {
5722
+ break;
5723
+ }
5724
+
5725
+ message.revision = AITaskRevision.decode(reader, reader.uint32());
5726
+ continue;
5727
+ }
5728
+ case 2: {
5729
+ if (tag !== 18) {
5730
+ break;
5731
+ }
5732
+
5733
+ message.activatedByUserId = reader.string();
5734
+ continue;
5735
+ }
5736
+ case 3: {
5737
+ if (tag !== 26) {
5738
+ break;
5739
+ }
5740
+
5741
+ message.activateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5742
+ continue;
5743
+ }
5744
+ }
5745
+ if ((tag & 7) === 4 || tag === 0) {
5746
+ break;
5747
+ }
5748
+ reader.skip(tag & 7);
5749
+ }
5750
+ return message;
5751
+ } finally {
5752
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5753
+ }
5754
+ },
5755
+
5756
+ fromJSON(object: any): AITaskActivation {
5757
+ return {
5758
+ revision: isSet(object.revision) ? AITaskRevision.fromJSON(object.revision) : undefined,
5759
+ activatedByUserId: isSet(object.activatedByUserId)
5760
+ ? globalThis.String(object.activatedByUserId)
5761
+ : isSet(object.activated_by_user_id)
5762
+ ? globalThis.String(object.activated_by_user_id)
5763
+ : "",
5764
+ activateTime: isSet(object.activateTime)
5765
+ ? fromJsonTimestamp(object.activateTime)
5766
+ : isSet(object.activate_time)
5767
+ ? fromJsonTimestamp(object.activate_time)
5768
+ : undefined,
5769
+ };
5770
+ },
5771
+
5772
+ toJSON(message: AITaskActivation): unknown {
5773
+ const obj: any = {};
5774
+ if (message.revision !== undefined) {
5775
+ obj.revision = AITaskRevision.toJSON(message.revision);
5776
+ }
5777
+ if (message.activatedByUserId !== "") {
5778
+ obj.activatedByUserId = message.activatedByUserId;
5779
+ }
5780
+ if (message.activateTime !== undefined) {
5781
+ obj.activateTime = message.activateTime.toISOString();
5782
+ }
5783
+ return obj;
5784
+ },
5785
+
5786
+ create<I extends Exact<DeepPartial<AITaskActivation>, I>>(base?: I): AITaskActivation {
5787
+ return AITaskActivation.fromPartial(base ?? ({} as any));
5788
+ },
5789
+ fromPartial<I extends Exact<DeepPartial<AITaskActivation>, I>>(object: I): AITaskActivation {
5790
+ const message = createBaseAITaskActivation();
5791
+ message.revision = (object.revision !== undefined && object.revision !== null)
5792
+ ? AITaskRevision.fromPartial(object.revision)
5793
+ : undefined;
5794
+ message.activatedByUserId = object.activatedByUserId ?? "";
5795
+ message.activateTime = object.activateTime ?? undefined;
5796
+ return message;
5797
+ },
5798
+ };
5799
+
5800
+ function createBaseAITaskRevision(): AITaskRevision {
5801
+ return {
5802
+ id: "",
5803
+ task: 0,
5804
+ number: 0,
5805
+ model: "",
5806
+ instruction: "",
5807
+ note: "",
5808
+ createdByUserId: "",
5809
+ createTime: undefined,
5810
+ };
5811
+ }
5812
+
5813
+ export const AITaskRevision: MessageFns<AITaskRevision> = {
5814
+ encode(message: AITaskRevision, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
5815
+ if (message.id !== "") {
5816
+ writer.uint32(10).string(message.id);
5817
+ }
5818
+ if (message.task !== 0) {
5819
+ writer.uint32(16).int32(message.task);
5820
+ }
5821
+ if (message.number !== 0) {
5822
+ writer.uint32(24).int32(message.number);
5823
+ }
5824
+ if (message.model !== "") {
5825
+ writer.uint32(34).string(message.model);
5826
+ }
5827
+ if (message.instruction !== "") {
5828
+ writer.uint32(42).string(message.instruction);
5829
+ }
5830
+ if (message.note !== "") {
5831
+ writer.uint32(50).string(message.note);
5832
+ }
5833
+ if (message.createdByUserId !== "") {
5834
+ writer.uint32(58).string(message.createdByUserId);
5835
+ }
5836
+ if (message.createTime !== undefined) {
5837
+ Timestamp.encode(toTimestamp(message.createTime), writer.uint32(66).fork()).join();
5838
+ }
5839
+ return writer;
5840
+ },
5841
+
5842
+ decode(input: BinaryReader | Uint8Array, length?: number): AITaskRevision {
5843
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
5844
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
5845
+ if (previousRecursionDepth >= 100) {
5846
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
5847
+ }
5848
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
5849
+ try {
5850
+ const end = length === undefined ? reader.len : reader.pos + length;
5851
+ const message = createBaseAITaskRevision();
5852
+ while (reader.pos < end) {
5853
+ const tag = reader.uint32();
5854
+ switch (tag >>> 3) {
5855
+ case 1: {
5856
+ if (tag !== 10) {
5857
+ break;
5858
+ }
5859
+
5860
+ message.id = reader.string();
5861
+ continue;
5862
+ }
5863
+ case 2: {
5864
+ if (tag !== 16) {
5865
+ break;
5866
+ }
5867
+
5868
+ message.task = reader.int32() as any;
5869
+ continue;
5870
+ }
5871
+ case 3: {
5872
+ if (tag !== 24) {
5873
+ break;
5874
+ }
5875
+
5876
+ message.number = reader.int32();
5877
+ continue;
5878
+ }
5879
+ case 4: {
5880
+ if (tag !== 34) {
5881
+ break;
5882
+ }
5883
+
5884
+ message.model = reader.string();
5885
+ continue;
5886
+ }
5887
+ case 5: {
5888
+ if (tag !== 42) {
5889
+ break;
5890
+ }
5891
+
5892
+ message.instruction = reader.string();
5893
+ continue;
5894
+ }
5895
+ case 6: {
5896
+ if (tag !== 50) {
5897
+ break;
5898
+ }
5899
+
5900
+ message.note = reader.string();
5901
+ continue;
5902
+ }
5903
+ case 7: {
5904
+ if (tag !== 58) {
5905
+ break;
5906
+ }
5907
+
5908
+ message.createdByUserId = reader.string();
5909
+ continue;
5910
+ }
5911
+ case 8: {
5912
+ if (tag !== 66) {
5913
+ break;
5914
+ }
5915
+
5916
+ message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5917
+ continue;
5918
+ }
5919
+ }
5920
+ if ((tag & 7) === 4 || tag === 0) {
5921
+ break;
5922
+ }
5923
+ reader.skip(tag & 7);
5924
+ }
5925
+ return message;
5926
+ } finally {
5927
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
5928
+ }
5929
+ },
5930
+
5931
+ fromJSON(object: any): AITaskRevision {
5932
+ return {
5933
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
5934
+ task: isSet(object.task) ? aITaskFromJSON(object.task) : 0,
5935
+ number: isSet(object.number) ? globalThis.Number(object.number) : 0,
5936
+ model: isSet(object.model) ? globalThis.String(object.model) : "",
5937
+ instruction: isSet(object.instruction) ? globalThis.String(object.instruction) : "",
5938
+ note: isSet(object.note) ? globalThis.String(object.note) : "",
5939
+ createdByUserId: isSet(object.createdByUserId)
5940
+ ? globalThis.String(object.createdByUserId)
5941
+ : isSet(object.created_by_user_id)
5942
+ ? globalThis.String(object.created_by_user_id)
5943
+ : "",
5944
+ createTime: isSet(object.createTime)
5945
+ ? fromJsonTimestamp(object.createTime)
5946
+ : isSet(object.create_time)
5947
+ ? fromJsonTimestamp(object.create_time)
5948
+ : undefined,
5949
+ };
5950
+ },
5951
+
5952
+ toJSON(message: AITaskRevision): unknown {
5953
+ const obj: any = {};
5954
+ if (message.id !== "") {
5955
+ obj.id = message.id;
5956
+ }
5957
+ if (message.task !== 0) {
5958
+ obj.task = aITaskToJSON(message.task);
5959
+ }
5960
+ if (message.number !== 0) {
5961
+ obj.number = Math.round(message.number);
5962
+ }
5963
+ if (message.model !== "") {
5964
+ obj.model = message.model;
5965
+ }
5966
+ if (message.instruction !== "") {
5967
+ obj.instruction = message.instruction;
5968
+ }
5969
+ if (message.note !== "") {
5970
+ obj.note = message.note;
5971
+ }
5972
+ if (message.createdByUserId !== "") {
5973
+ obj.createdByUserId = message.createdByUserId;
5974
+ }
5975
+ if (message.createTime !== undefined) {
5976
+ obj.createTime = message.createTime.toISOString();
5977
+ }
5978
+ return obj;
5979
+ },
5980
+
5981
+ create<I extends Exact<DeepPartial<AITaskRevision>, I>>(base?: I): AITaskRevision {
5982
+ return AITaskRevision.fromPartial(base ?? ({} as any));
5983
+ },
5984
+ fromPartial<I extends Exact<DeepPartial<AITaskRevision>, I>>(object: I): AITaskRevision {
5985
+ const message = createBaseAITaskRevision();
5986
+ message.id = object.id ?? "";
5987
+ message.task = object.task ?? 0;
5988
+ message.number = object.number ?? 0;
5989
+ message.model = object.model ?? "";
5990
+ message.instruction = object.instruction ?? "";
5991
+ message.note = object.note ?? "";
5992
+ message.createdByUserId = object.createdByUserId ?? "";
5993
+ message.createTime = object.createTime ?? undefined;
5994
+ return message;
5995
+ },
5996
+ };
5997
+
5998
+ function createBaseListAITaskRevisionsRequest(): ListAITaskRevisionsRequest {
5999
+ return { task: 0, pageSize: 0, pageToken: "" };
6000
+ }
6001
+
6002
+ export const ListAITaskRevisionsRequest: MessageFns<ListAITaskRevisionsRequest> = {
6003
+ encode(message: ListAITaskRevisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6004
+ if (message.task !== 0) {
6005
+ writer.uint32(8).int32(message.task);
6006
+ }
6007
+ if (message.pageSize !== 0) {
6008
+ writer.uint32(16).int32(message.pageSize);
6009
+ }
6010
+ if (message.pageToken !== "") {
6011
+ writer.uint32(26).string(message.pageToken);
6012
+ }
6013
+ return writer;
6014
+ },
6015
+
6016
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAITaskRevisionsRequest {
6017
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6018
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6019
+ if (previousRecursionDepth >= 100) {
6020
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6021
+ }
6022
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6023
+ try {
6024
+ const end = length === undefined ? reader.len : reader.pos + length;
6025
+ const message = createBaseListAITaskRevisionsRequest();
6026
+ while (reader.pos < end) {
6027
+ const tag = reader.uint32();
6028
+ switch (tag >>> 3) {
6029
+ case 1: {
6030
+ if (tag !== 8) {
6031
+ break;
6032
+ }
6033
+
6034
+ message.task = reader.int32() as any;
6035
+ continue;
6036
+ }
6037
+ case 2: {
6038
+ if (tag !== 16) {
6039
+ break;
6040
+ }
6041
+
6042
+ message.pageSize = reader.int32();
6043
+ continue;
6044
+ }
6045
+ case 3: {
6046
+ if (tag !== 26) {
6047
+ break;
6048
+ }
6049
+
6050
+ message.pageToken = reader.string();
6051
+ continue;
6052
+ }
6053
+ }
6054
+ if ((tag & 7) === 4 || tag === 0) {
6055
+ break;
6056
+ }
6057
+ reader.skip(tag & 7);
6058
+ }
6059
+ return message;
6060
+ } finally {
6061
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6062
+ }
6063
+ },
6064
+
6065
+ fromJSON(object: any): ListAITaskRevisionsRequest {
6066
+ return {
6067
+ task: isSet(object.task) ? aITaskFromJSON(object.task) : 0,
6068
+ pageSize: isSet(object.pageSize)
6069
+ ? globalThis.Number(object.pageSize)
6070
+ : isSet(object.page_size)
6071
+ ? globalThis.Number(object.page_size)
6072
+ : 0,
6073
+ pageToken: isSet(object.pageToken)
6074
+ ? globalThis.String(object.pageToken)
6075
+ : isSet(object.page_token)
6076
+ ? globalThis.String(object.page_token)
6077
+ : "",
6078
+ };
6079
+ },
6080
+
6081
+ toJSON(message: ListAITaskRevisionsRequest): unknown {
6082
+ const obj: any = {};
6083
+ if (message.task !== 0) {
6084
+ obj.task = aITaskToJSON(message.task);
6085
+ }
6086
+ if (message.pageSize !== 0) {
6087
+ obj.pageSize = Math.round(message.pageSize);
6088
+ }
6089
+ if (message.pageToken !== "") {
6090
+ obj.pageToken = message.pageToken;
6091
+ }
6092
+ return obj;
6093
+ },
6094
+
6095
+ create<I extends Exact<DeepPartial<ListAITaskRevisionsRequest>, I>>(base?: I): ListAITaskRevisionsRequest {
6096
+ return ListAITaskRevisionsRequest.fromPartial(base ?? ({} as any));
6097
+ },
6098
+ fromPartial<I extends Exact<DeepPartial<ListAITaskRevisionsRequest>, I>>(object: I): ListAITaskRevisionsRequest {
6099
+ const message = createBaseListAITaskRevisionsRequest();
6100
+ message.task = object.task ?? 0;
6101
+ message.pageSize = object.pageSize ?? 0;
6102
+ message.pageToken = object.pageToken ?? "";
6103
+ return message;
6104
+ },
6105
+ };
6106
+
6107
+ function createBaseListAITaskRevisionsResponse(): ListAITaskRevisionsResponse {
6108
+ return { status: undefined, revisions: [], nextPageToken: "" };
6109
+ }
6110
+
6111
+ export const ListAITaskRevisionsResponse: MessageFns<ListAITaskRevisionsResponse> = {
6112
+ encode(message: ListAITaskRevisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6113
+ if (message.status !== undefined) {
6114
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
6115
+ }
6116
+ for (const v of message.revisions) {
6117
+ AITaskRevision.encode(v!, writer.uint32(18).fork()).join();
6118
+ }
6119
+ if (message.nextPageToken !== "") {
6120
+ writer.uint32(26).string(message.nextPageToken);
6121
+ }
6122
+ return writer;
6123
+ },
6124
+
6125
+ decode(input: BinaryReader | Uint8Array, length?: number): ListAITaskRevisionsResponse {
6126
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6127
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6128
+ if (previousRecursionDepth >= 100) {
6129
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6130
+ }
6131
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6132
+ try {
6133
+ const end = length === undefined ? reader.len : reader.pos + length;
6134
+ const message = createBaseListAITaskRevisionsResponse();
6135
+ while (reader.pos < end) {
6136
+ const tag = reader.uint32();
6137
+ switch (tag >>> 3) {
6138
+ case 1: {
6139
+ if (tag !== 10) {
6140
+ break;
6141
+ }
6142
+
6143
+ message.status = ResponseStatus.decode(reader, reader.uint32());
6144
+ continue;
6145
+ }
6146
+ case 2: {
6147
+ if (tag !== 18) {
6148
+ break;
6149
+ }
6150
+
6151
+ message.revisions.push(AITaskRevision.decode(reader, reader.uint32()));
6152
+ continue;
6153
+ }
6154
+ case 3: {
6155
+ if (tag !== 26) {
6156
+ break;
6157
+ }
6158
+
6159
+ message.nextPageToken = reader.string();
6160
+ continue;
6161
+ }
6162
+ }
6163
+ if ((tag & 7) === 4 || tag === 0) {
6164
+ break;
6165
+ }
6166
+ reader.skip(tag & 7);
6167
+ }
6168
+ return message;
6169
+ } finally {
6170
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6171
+ }
6172
+ },
6173
+
6174
+ fromJSON(object: any): ListAITaskRevisionsResponse {
6175
+ return {
6176
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
6177
+ revisions: globalThis.Array.isArray(object?.revisions)
6178
+ ? object.revisions.map((e: any) => AITaskRevision.fromJSON(e))
6179
+ : [],
6180
+ nextPageToken: isSet(object.nextPageToken)
6181
+ ? globalThis.String(object.nextPageToken)
6182
+ : isSet(object.next_page_token)
6183
+ ? globalThis.String(object.next_page_token)
6184
+ : "",
6185
+ };
6186
+ },
6187
+
6188
+ toJSON(message: ListAITaskRevisionsResponse): unknown {
6189
+ const obj: any = {};
6190
+ if (message.status !== undefined) {
6191
+ obj.status = ResponseStatus.toJSON(message.status);
6192
+ }
6193
+ if (message.revisions?.length) {
6194
+ obj.revisions = message.revisions.map((e) => AITaskRevision.toJSON(e));
6195
+ }
6196
+ if (message.nextPageToken !== "") {
6197
+ obj.nextPageToken = message.nextPageToken;
6198
+ }
6199
+ return obj;
6200
+ },
6201
+
6202
+ create<I extends Exact<DeepPartial<ListAITaskRevisionsResponse>, I>>(base?: I): ListAITaskRevisionsResponse {
6203
+ return ListAITaskRevisionsResponse.fromPartial(base ?? ({} as any));
6204
+ },
6205
+ fromPartial<I extends Exact<DeepPartial<ListAITaskRevisionsResponse>, I>>(object: I): ListAITaskRevisionsResponse {
6206
+ const message = createBaseListAITaskRevisionsResponse();
6207
+ message.status = (object.status !== undefined && object.status !== null)
6208
+ ? ResponseStatus.fromPartial(object.status)
6209
+ : undefined;
6210
+ message.revisions = object.revisions?.map((e) => AITaskRevision.fromPartial(e)) || [];
6211
+ message.nextPageToken = object.nextPageToken ?? "";
6212
+ return message;
6213
+ },
6214
+ };
6215
+
6216
+ function createBaseCreateAITaskRevisionRequest(): CreateAITaskRevisionRequest {
6217
+ return { task: 0, model: "", instruction: "", note: "" };
6218
+ }
6219
+
6220
+ export const CreateAITaskRevisionRequest: MessageFns<CreateAITaskRevisionRequest> = {
6221
+ encode(message: CreateAITaskRevisionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6222
+ if (message.task !== 0) {
6223
+ writer.uint32(8).int32(message.task);
6224
+ }
6225
+ if (message.model !== "") {
6226
+ writer.uint32(18).string(message.model);
6227
+ }
6228
+ if (message.instruction !== "") {
6229
+ writer.uint32(26).string(message.instruction);
6230
+ }
6231
+ if (message.note !== "") {
6232
+ writer.uint32(34).string(message.note);
6233
+ }
6234
+ return writer;
6235
+ },
6236
+
6237
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateAITaskRevisionRequest {
6238
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6239
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6240
+ if (previousRecursionDepth >= 100) {
6241
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6242
+ }
6243
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6244
+ try {
6245
+ const end = length === undefined ? reader.len : reader.pos + length;
6246
+ const message = createBaseCreateAITaskRevisionRequest();
6247
+ while (reader.pos < end) {
6248
+ const tag = reader.uint32();
6249
+ switch (tag >>> 3) {
6250
+ case 1: {
6251
+ if (tag !== 8) {
6252
+ break;
6253
+ }
6254
+
6255
+ message.task = reader.int32() as any;
6256
+ continue;
6257
+ }
6258
+ case 2: {
6259
+ if (tag !== 18) {
6260
+ break;
6261
+ }
6262
+
6263
+ message.model = reader.string();
6264
+ continue;
6265
+ }
6266
+ case 3: {
6267
+ if (tag !== 26) {
6268
+ break;
6269
+ }
6270
+
6271
+ message.instruction = reader.string();
6272
+ continue;
6273
+ }
6274
+ case 4: {
6275
+ if (tag !== 34) {
6276
+ break;
6277
+ }
6278
+
6279
+ message.note = reader.string();
6280
+ continue;
6281
+ }
6282
+ }
6283
+ if ((tag & 7) === 4 || tag === 0) {
6284
+ break;
6285
+ }
6286
+ reader.skip(tag & 7);
6287
+ }
6288
+ return message;
6289
+ } finally {
6290
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6291
+ }
6292
+ },
6293
+
6294
+ fromJSON(object: any): CreateAITaskRevisionRequest {
6295
+ return {
6296
+ task: isSet(object.task) ? aITaskFromJSON(object.task) : 0,
6297
+ model: isSet(object.model) ? globalThis.String(object.model) : "",
6298
+ instruction: isSet(object.instruction) ? globalThis.String(object.instruction) : "",
6299
+ note: isSet(object.note) ? globalThis.String(object.note) : "",
6300
+ };
6301
+ },
6302
+
6303
+ toJSON(message: CreateAITaskRevisionRequest): unknown {
6304
+ const obj: any = {};
6305
+ if (message.task !== 0) {
6306
+ obj.task = aITaskToJSON(message.task);
6307
+ }
6308
+ if (message.model !== "") {
6309
+ obj.model = message.model;
6310
+ }
6311
+ if (message.instruction !== "") {
6312
+ obj.instruction = message.instruction;
6313
+ }
6314
+ if (message.note !== "") {
6315
+ obj.note = message.note;
6316
+ }
6317
+ return obj;
6318
+ },
6319
+
6320
+ create<I extends Exact<DeepPartial<CreateAITaskRevisionRequest>, I>>(base?: I): CreateAITaskRevisionRequest {
6321
+ return CreateAITaskRevisionRequest.fromPartial(base ?? ({} as any));
6322
+ },
6323
+ fromPartial<I extends Exact<DeepPartial<CreateAITaskRevisionRequest>, I>>(object: I): CreateAITaskRevisionRequest {
6324
+ const message = createBaseCreateAITaskRevisionRequest();
6325
+ message.task = object.task ?? 0;
6326
+ message.model = object.model ?? "";
6327
+ message.instruction = object.instruction ?? "";
6328
+ message.note = object.note ?? "";
6329
+ return message;
6330
+ },
6331
+ };
6332
+
6333
+ function createBaseCreateAITaskRevisionResponse(): CreateAITaskRevisionResponse {
6334
+ return { status: undefined, revision: undefined };
6335
+ }
6336
+
6337
+ export const CreateAITaskRevisionResponse: MessageFns<CreateAITaskRevisionResponse> = {
6338
+ encode(message: CreateAITaskRevisionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6339
+ if (message.status !== undefined) {
6340
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
6341
+ }
6342
+ if (message.revision !== undefined) {
6343
+ AITaskRevision.encode(message.revision, writer.uint32(18).fork()).join();
6344
+ }
6345
+ return writer;
6346
+ },
6347
+
6348
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateAITaskRevisionResponse {
6349
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6350
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6351
+ if (previousRecursionDepth >= 100) {
6352
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6353
+ }
6354
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6355
+ try {
6356
+ const end = length === undefined ? reader.len : reader.pos + length;
6357
+ const message = createBaseCreateAITaskRevisionResponse();
6358
+ while (reader.pos < end) {
6359
+ const tag = reader.uint32();
6360
+ switch (tag >>> 3) {
6361
+ case 1: {
6362
+ if (tag !== 10) {
6363
+ break;
6364
+ }
6365
+
6366
+ message.status = ResponseStatus.decode(reader, reader.uint32());
6367
+ continue;
6368
+ }
6369
+ case 2: {
6370
+ if (tag !== 18) {
6371
+ break;
6372
+ }
6373
+
6374
+ message.revision = AITaskRevision.decode(reader, reader.uint32());
6375
+ continue;
6376
+ }
6377
+ }
6378
+ if ((tag & 7) === 4 || tag === 0) {
6379
+ break;
6380
+ }
6381
+ reader.skip(tag & 7);
6382
+ }
6383
+ return message;
6384
+ } finally {
6385
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6386
+ }
6387
+ },
6388
+
6389
+ fromJSON(object: any): CreateAITaskRevisionResponse {
6390
+ return {
6391
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
6392
+ revision: isSet(object.revision) ? AITaskRevision.fromJSON(object.revision) : undefined,
6393
+ };
6394
+ },
6395
+
6396
+ toJSON(message: CreateAITaskRevisionResponse): unknown {
6397
+ const obj: any = {};
6398
+ if (message.status !== undefined) {
6399
+ obj.status = ResponseStatus.toJSON(message.status);
6400
+ }
6401
+ if (message.revision !== undefined) {
6402
+ obj.revision = AITaskRevision.toJSON(message.revision);
6403
+ }
6404
+ return obj;
6405
+ },
6406
+
6407
+ create<I extends Exact<DeepPartial<CreateAITaskRevisionResponse>, I>>(base?: I): CreateAITaskRevisionResponse {
6408
+ return CreateAITaskRevisionResponse.fromPartial(base ?? ({} as any));
6409
+ },
6410
+ fromPartial<I extends Exact<DeepPartial<CreateAITaskRevisionResponse>, I>>(object: I): CreateAITaskRevisionResponse {
6411
+ const message = createBaseCreateAITaskRevisionResponse();
6412
+ message.status = (object.status !== undefined && object.status !== null)
6413
+ ? ResponseStatus.fromPartial(object.status)
6414
+ : undefined;
6415
+ message.revision = (object.revision !== undefined && object.revision !== null)
6416
+ ? AITaskRevision.fromPartial(object.revision)
6417
+ : undefined;
6418
+ return message;
6419
+ },
6420
+ };
6421
+
6422
+ function createBaseActivateAITaskRevisionRequest(): ActivateAITaskRevisionRequest {
6423
+ return { task: 0, revisionId: "" };
6424
+ }
6425
+
6426
+ export const ActivateAITaskRevisionRequest: MessageFns<ActivateAITaskRevisionRequest> = {
6427
+ encode(message: ActivateAITaskRevisionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6428
+ if (message.task !== 0) {
6429
+ writer.uint32(8).int32(message.task);
6430
+ }
6431
+ if (message.revisionId !== "") {
6432
+ writer.uint32(18).string(message.revisionId);
6433
+ }
6434
+ return writer;
6435
+ },
6436
+
6437
+ decode(input: BinaryReader | Uint8Array, length?: number): ActivateAITaskRevisionRequest {
6438
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6439
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6440
+ if (previousRecursionDepth >= 100) {
6441
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6442
+ }
6443
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6444
+ try {
6445
+ const end = length === undefined ? reader.len : reader.pos + length;
6446
+ const message = createBaseActivateAITaskRevisionRequest();
6447
+ while (reader.pos < end) {
6448
+ const tag = reader.uint32();
6449
+ switch (tag >>> 3) {
6450
+ case 1: {
6451
+ if (tag !== 8) {
6452
+ break;
6453
+ }
6454
+
6455
+ message.task = reader.int32() as any;
6456
+ continue;
6457
+ }
6458
+ case 2: {
6459
+ if (tag !== 18) {
6460
+ break;
6461
+ }
6462
+
6463
+ message.revisionId = reader.string();
6464
+ continue;
6465
+ }
6466
+ }
6467
+ if ((tag & 7) === 4 || tag === 0) {
6468
+ break;
6469
+ }
6470
+ reader.skip(tag & 7);
6471
+ }
6472
+ return message;
6473
+ } finally {
6474
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6475
+ }
6476
+ },
6477
+
6478
+ fromJSON(object: any): ActivateAITaskRevisionRequest {
6479
+ return {
6480
+ task: isSet(object.task) ? aITaskFromJSON(object.task) : 0,
6481
+ revisionId: isSet(object.revisionId)
6482
+ ? globalThis.String(object.revisionId)
6483
+ : isSet(object.revision_id)
6484
+ ? globalThis.String(object.revision_id)
6485
+ : "",
6486
+ };
6487
+ },
6488
+
6489
+ toJSON(message: ActivateAITaskRevisionRequest): unknown {
6490
+ const obj: any = {};
6491
+ if (message.task !== 0) {
6492
+ obj.task = aITaskToJSON(message.task);
6493
+ }
6494
+ if (message.revisionId !== "") {
6495
+ obj.revisionId = message.revisionId;
6496
+ }
6497
+ return obj;
6498
+ },
6499
+
6500
+ create<I extends Exact<DeepPartial<ActivateAITaskRevisionRequest>, I>>(base?: I): ActivateAITaskRevisionRequest {
6501
+ return ActivateAITaskRevisionRequest.fromPartial(base ?? ({} as any));
6502
+ },
6503
+ fromPartial<I extends Exact<DeepPartial<ActivateAITaskRevisionRequest>, I>>(
6504
+ object: I,
6505
+ ): ActivateAITaskRevisionRequest {
6506
+ const message = createBaseActivateAITaskRevisionRequest();
6507
+ message.task = object.task ?? 0;
6508
+ message.revisionId = object.revisionId ?? "";
6509
+ return message;
6510
+ },
6511
+ };
6512
+
6513
+ function createBaseActivateAITaskRevisionResponse(): ActivateAITaskRevisionResponse {
6514
+ return { status: undefined, activation: undefined };
6515
+ }
6516
+
6517
+ export const ActivateAITaskRevisionResponse: MessageFns<ActivateAITaskRevisionResponse> = {
6518
+ encode(message: ActivateAITaskRevisionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6519
+ if (message.status !== undefined) {
6520
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
6521
+ }
6522
+ if (message.activation !== undefined) {
6523
+ AITaskActivation.encode(message.activation, writer.uint32(18).fork()).join();
6524
+ }
6525
+ return writer;
6526
+ },
6527
+
6528
+ decode(input: BinaryReader | Uint8Array, length?: number): ActivateAITaskRevisionResponse {
6529
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6530
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6531
+ if (previousRecursionDepth >= 100) {
6532
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6533
+ }
6534
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6535
+ try {
6536
+ const end = length === undefined ? reader.len : reader.pos + length;
6537
+ const message = createBaseActivateAITaskRevisionResponse();
6538
+ while (reader.pos < end) {
6539
+ const tag = reader.uint32();
6540
+ switch (tag >>> 3) {
6541
+ case 1: {
6542
+ if (tag !== 10) {
6543
+ break;
6544
+ }
6545
+
6546
+ message.status = ResponseStatus.decode(reader, reader.uint32());
6547
+ continue;
6548
+ }
6549
+ case 2: {
6550
+ if (tag !== 18) {
6551
+ break;
6552
+ }
6553
+
6554
+ message.activation = AITaskActivation.decode(reader, reader.uint32());
6555
+ continue;
6556
+ }
6557
+ }
6558
+ if ((tag & 7) === 4 || tag === 0) {
6559
+ break;
6560
+ }
6561
+ reader.skip(tag & 7);
6562
+ }
6563
+ return message;
6564
+ } finally {
6565
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6566
+ }
6567
+ },
6568
+
6569
+ fromJSON(object: any): ActivateAITaskRevisionResponse {
6570
+ return {
6571
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
6572
+ activation: isSet(object.activation) ? AITaskActivation.fromJSON(object.activation) : undefined,
6573
+ };
6574
+ },
6575
+
6576
+ toJSON(message: ActivateAITaskRevisionResponse): unknown {
6577
+ const obj: any = {};
6578
+ if (message.status !== undefined) {
6579
+ obj.status = ResponseStatus.toJSON(message.status);
6580
+ }
6581
+ if (message.activation !== undefined) {
6582
+ obj.activation = AITaskActivation.toJSON(message.activation);
6583
+ }
6584
+ return obj;
6585
+ },
6586
+
6587
+ create<I extends Exact<DeepPartial<ActivateAITaskRevisionResponse>, I>>(base?: I): ActivateAITaskRevisionResponse {
6588
+ return ActivateAITaskRevisionResponse.fromPartial(base ?? ({} as any));
6589
+ },
6590
+ fromPartial<I extends Exact<DeepPartial<ActivateAITaskRevisionResponse>, I>>(
6591
+ object: I,
6592
+ ): ActivateAITaskRevisionResponse {
6593
+ const message = createBaseActivateAITaskRevisionResponse();
6594
+ message.status = (object.status !== undefined && object.status !== null)
6595
+ ? ResponseStatus.fromPartial(object.status)
6596
+ : undefined;
6597
+ message.activation = (object.activation !== undefined && object.activation !== null)
6598
+ ? AITaskActivation.fromPartial(object.activation)
6599
+ : undefined;
6600
+ return message;
6601
+ },
6602
+ };
6603
+
6604
+ function createBaseDeactivateAITaskRevisionRequest(): DeactivateAITaskRevisionRequest {
6605
+ return { task: 0 };
6606
+ }
6607
+
6608
+ export const DeactivateAITaskRevisionRequest: MessageFns<DeactivateAITaskRevisionRequest> = {
6609
+ encode(message: DeactivateAITaskRevisionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6610
+ if (message.task !== 0) {
6611
+ writer.uint32(8).int32(message.task);
6612
+ }
6613
+ return writer;
6614
+ },
6615
+
6616
+ decode(input: BinaryReader | Uint8Array, length?: number): DeactivateAITaskRevisionRequest {
6617
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6618
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6619
+ if (previousRecursionDepth >= 100) {
6620
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6621
+ }
6622
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6623
+ try {
6624
+ const end = length === undefined ? reader.len : reader.pos + length;
6625
+ const message = createBaseDeactivateAITaskRevisionRequest();
6626
+ while (reader.pos < end) {
6627
+ const tag = reader.uint32();
6628
+ switch (tag >>> 3) {
6629
+ case 1: {
6630
+ if (tag !== 8) {
6631
+ break;
6632
+ }
6633
+
6634
+ message.task = reader.int32() as any;
6635
+ continue;
6636
+ }
6637
+ }
6638
+ if ((tag & 7) === 4 || tag === 0) {
6639
+ break;
6640
+ }
6641
+ reader.skip(tag & 7);
6642
+ }
6643
+ return message;
6644
+ } finally {
6645
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6646
+ }
6647
+ },
6648
+
6649
+ fromJSON(object: any): DeactivateAITaskRevisionRequest {
6650
+ return { task: isSet(object.task) ? aITaskFromJSON(object.task) : 0 };
6651
+ },
6652
+
6653
+ toJSON(message: DeactivateAITaskRevisionRequest): unknown {
6654
+ const obj: any = {};
6655
+ if (message.task !== 0) {
6656
+ obj.task = aITaskToJSON(message.task);
6657
+ }
6658
+ return obj;
6659
+ },
6660
+
6661
+ create<I extends Exact<DeepPartial<DeactivateAITaskRevisionRequest>, I>>(base?: I): DeactivateAITaskRevisionRequest {
6662
+ return DeactivateAITaskRevisionRequest.fromPartial(base ?? ({} as any));
6663
+ },
6664
+ fromPartial<I extends Exact<DeepPartial<DeactivateAITaskRevisionRequest>, I>>(
6665
+ object: I,
6666
+ ): DeactivateAITaskRevisionRequest {
6667
+ const message = createBaseDeactivateAITaskRevisionRequest();
6668
+ message.task = object.task ?? 0;
6669
+ return message;
6670
+ },
6671
+ };
6672
+
6673
+ function createBaseDeactivateAITaskRevisionResponse(): DeactivateAITaskRevisionResponse {
6674
+ return { status: undefined };
6675
+ }
6676
+
6677
+ export const DeactivateAITaskRevisionResponse: MessageFns<DeactivateAITaskRevisionResponse> = {
6678
+ encode(message: DeactivateAITaskRevisionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
6679
+ if (message.status !== undefined) {
6680
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
6681
+ }
6682
+ return writer;
6683
+ },
6684
+
6685
+ decode(input: BinaryReader | Uint8Array, length?: number): DeactivateAITaskRevisionResponse {
6686
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
6687
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
6688
+ if (previousRecursionDepth >= 100) {
6689
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
6690
+ }
6691
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
6692
+ try {
6693
+ const end = length === undefined ? reader.len : reader.pos + length;
6694
+ const message = createBaseDeactivateAITaskRevisionResponse();
6695
+ while (reader.pos < end) {
6696
+ const tag = reader.uint32();
6697
+ switch (tag >>> 3) {
6698
+ case 1: {
6699
+ if (tag !== 10) {
6700
+ break;
6701
+ }
6702
+
6703
+ message.status = ResponseStatus.decode(reader, reader.uint32());
6704
+ continue;
6705
+ }
6706
+ }
6707
+ if ((tag & 7) === 4 || tag === 0) {
6708
+ break;
6709
+ }
6710
+ reader.skip(tag & 7);
6711
+ }
6712
+ return message;
6713
+ } finally {
6714
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
6715
+ }
6716
+ },
6717
+
6718
+ fromJSON(object: any): DeactivateAITaskRevisionResponse {
6719
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
6720
+ },
6721
+
6722
+ toJSON(message: DeactivateAITaskRevisionResponse): unknown {
6723
+ const obj: any = {};
6724
+ if (message.status !== undefined) {
6725
+ obj.status = ResponseStatus.toJSON(message.status);
6726
+ }
6727
+ return obj;
6728
+ },
6729
+
6730
+ create<I extends Exact<DeepPartial<DeactivateAITaskRevisionResponse>, I>>(
6731
+ base?: I,
6732
+ ): DeactivateAITaskRevisionResponse {
6733
+ return DeactivateAITaskRevisionResponse.fromPartial(base ?? ({} as any));
6734
+ },
6735
+ fromPartial<I extends Exact<DeepPartial<DeactivateAITaskRevisionResponse>, I>>(
6736
+ object: I,
6737
+ ): DeactivateAITaskRevisionResponse {
6738
+ const message = createBaseDeactivateAITaskRevisionResponse();
6739
+ message.status = (object.status !== undefined && object.status !== null)
6740
+ ? ResponseStatus.fromPartial(object.status)
6741
+ : undefined;
6742
+ return message;
6743
+ },
6744
+ };
6745
+
6746
+ /**
6747
+ * AdminGatewayService is the browser-facing surface of the admin tools, across every domain, which only
6748
+ * Mirador staff (a verified mirador.org primary email) may use. The gateway's admin gate admits every RPC
6749
+ * here except GetAdminStatus, which tells the frontend whether to show the admin tools at all.
6750
+ */
6751
+ export interface AdminGatewayService {
6752
+ /** GetAdminStatus reports whether the authenticated caller may use the admin tools. */
6753
+ GetAdminStatus(request: GetAdminStatusRequest, metadata?: Metadata): Promise<GetAdminStatusResponse>;
6754
+ /** Beta invite codes for this gateway's product. */
6755
+ GenerateInviteCodes(request: GenerateInviteCodesRequest, metadata?: Metadata): Promise<GenerateInviteCodesResponse>;
6756
+ ListInviteCodes(request: ListInviteCodesRequest, metadata?: Metadata): Promise<ListInviteCodesResponse>;
6757
+ /** SendInviteCodeEmail emails one available code to an address and records when and to whom it was sent. */
6758
+ SendInviteCodeEmail(request: SendInviteCodeEmailRequest, metadata?: Metadata): Promise<SendInviteCodeEmailResponse>;
6759
+ /**
6760
+ * Staff set a global AI name's display name for every organization. An update makes the name MANUAL; the
6761
+ * model processor never overwrites it. The tables are read through ReferenceGatewayService.
6762
+ */
6763
+ UpdateAIProvider(request: UpdateAIProviderRequest, metadata?: Metadata): Promise<UpdateAIProviderResponse>;
6764
+ UpdateAIModel(request: UpdateAIModelRequest, metadata?: Metadata): Promise<UpdateAIModelResponse>;
6765
+ UpdateAIEffort(request: UpdateAIEffortRequest, metadata?: Metadata): Promise<UpdateAIEffortResponse>;
6766
+ UpdateAIBiller(request: UpdateAIBillerRequest, metadata?: Metadata): Promise<UpdateAIBillerResponse>;
6767
+ /**
6768
+ * Each Confirm<X> confirms every unreviewed name in the groups a List<X>Groups filter keeps (on every page),
6769
+ * as one Update<X> per name would; it proxies telemetry.api.v1.TelemetryAdminService's Confirm<X>. It
6770
+ * confirms what matches when it runs: compare confirmed_name_count with the count shown. Names are global: an
6771
+ * unset observation also confirms groups none of the organizations reported. Observation OBSERVED keeps only
6772
+ * the groups they reported, and still confirms every unreviewed name in them, including a spelling in the same
6773
+ * group none of them reported.
6774
+ */
6775
+ ConfirmAIProviders(request: ConfirmAIProvidersRequest, metadata?: Metadata): Promise<ConfirmAIProvidersResponse>;
6776
+ ConfirmAIModels(request: ConfirmAIModelsRequest, metadata?: Metadata): Promise<ConfirmAIModelsResponse>;
6777
+ ConfirmAIEfforts(request: ConfirmAIEffortsRequest, metadata?: Metadata): Promise<ConfirmAIEffortsResponse>;
6778
+ ConfirmAIBillers(request: ConfirmAIBillersRequest, metadata?: Metadata): Promise<ConfirmAIBillersResponse>;
6779
+ /**
6780
+ * Every Terma relay across the fleet with its latest heartbeat in full, one row per (organization, project, user,
6781
+ * host), most recently seen first (keyset-paginated); it proxies
6782
+ * telemetry.api.v1.TelemetryAdminService.ListRelayHeartbeats. Rows carry ids, not names.
6783
+ */
6784
+ ListRelayHeartbeats(
6785
+ request: ListAdminRelayHeartbeatsRequest,
6786
+ metadata?: Metadata,
6787
+ ): Promise<ListAdminRelayHeartbeatsResponse>;
6788
+ /**
6789
+ * AI usage summed across every organization over whole UTC days, grouped by the dimensions asked for (none is one
6790
+ * row, the totals), numbered pages; it proxies ai.api.v1.AIAdminService.ListUsageGroups. Rows carry ids, not names.
6791
+ */
6792
+ ListUsageGroups(request: ListAdminUsageGroupsRequest, metadata?: Metadata): Promise<ListAdminUsageGroupsResponse>;
6793
+ /**
6794
+ * ResolveOrgDetails resolves organization ids to their names, in batch, across every organization of this gateway's
6795
+ * product. Unknown ids, and ids of another product, are left out; it never errors on them. A malformed id, or more
6796
+ * than 1000 ids, is a validation error. It proxies account.api.v1.AccountAdminService.ResolveOrgDetails.
6797
+ */
6798
+ ResolveOrgDetails(request: ResolveOrgDetailsRequest, metadata?: Metadata): Promise<ResolveOrgDetailsResponse>;
6799
+ /**
6800
+ * ResolveProjectDetails resolves project (team) ids to their names, in batch, across every organization of this
6801
+ * gateway's product, deleted projects included. Unknown ids, and ids of another product, are left out; it never
6802
+ * errors on them. A malformed id, or more than 1000 ids, is a validation error. It proxies
6803
+ * account.api.v1.AccountAdminService.ResolveProjectDetails.
6804
+ */
6805
+ ResolveProjectDetails(
6806
+ request: ResolveProjectDetailsRequest,
6807
+ metadata?: Metadata,
6808
+ ): Promise<ResolveProjectDetailsResponse>;
6809
+ /**
6810
+ * ResolveUserDetails resolves one user's email address and name, on demand. An unknown user, or one of another
6811
+ * product, is NOT_FOUND; a malformed or empty id is a validation error; a user directory outage is UNAVAILABLE. It
6812
+ * proxies account.api.v1.AccountAdminService.ResolveUserDetails.
6813
+ */
6814
+ ResolveUserDetails(request: ResolveUserDetailsRequest, metadata?: Metadata): Promise<ResolveUserDetailsResponse>;
6815
+ /**
6816
+ * The AI jobs' models and prompts, each saved as immutable revisions with at most one active revision per job; they proxy
6817
+ * ai.api.v1.AIAdminService's RPCs of the same names. ListAITasks lists every configurable job with its name,
6818
+ * description, active revision, built-in prompt and the parts that stay code. Accepted risk: unpaged (proto_api_test unpagedLists):
6819
+ * one row per job, two today; the upgrade path is token paging if it ever passes 50.
6820
+ */
6821
+ ListAITasks(request: ListAITasksRequest, metadata?: Metadata): Promise<ListAITasksResponse>;
6822
+ /** ListAITaskRevisions lists one job's revisions, newest number first, with their full prompt. */
6823
+ ListAITaskRevisions(request: ListAITaskRevisionsRequest, metadata?: Metadata): Promise<ListAITaskRevisionsResponse>;
6824
+ /**
6825
+ * CreateAITaskRevision saves a new revision, numbered after the job's newest, as the caller; it does not activate
6826
+ * it. A concurrent save that takes the same number is a conflict: retry.
6827
+ */
6828
+ CreateAITaskRevision(
6829
+ request: CreateAITaskRevisionRequest,
6830
+ metadata?: Metadata,
6831
+ ): Promise<CreateAITaskRevisionResponse>;
6832
+ /**
6833
+ * ActivateAITaskRevision makes a revision of the job active, as the caller; activating an older one is a rollback.
6834
+ * A job that reads revisions picks it up on its next tick; until the insight jobs do, they keep their chart model
6835
+ * and embedded prompt. Last write wins.
6836
+ */
6837
+ ActivateAITaskRevision(
6838
+ request: ActivateAITaskRevisionRequest,
6839
+ metadata?: Metadata,
6840
+ ): Promise<ActivateAITaskRevisionResponse>;
6841
+ /**
6842
+ * DeactivateAITaskRevision clears the job's active revision, as the caller, so the job runs its built-in prompt
6843
+ * again; its revisions stay in the history, and with none active it changes nothing. Last write wins.
6844
+ */
6845
+ DeactivateAITaskRevision(
6846
+ request: DeactivateAITaskRevisionRequest,
6847
+ metadata?: Metadata,
6848
+ ): Promise<DeactivateAITaskRevisionResponse>;
6849
+ }
6850
+
6851
+ export const AdminGatewayServiceServiceName = "gateway.web.v1.AdminGatewayService";
6852
+ export class AdminGatewayServiceClientImpl implements AdminGatewayService {
6853
+ private readonly rpc: Rpc;
6854
+ private readonly service: string;
6855
+ constructor(rpc: Rpc, opts?: { service?: string }) {
6856
+ this.service = opts?.service || AdminGatewayServiceServiceName;
6857
+ this.rpc = rpc;
6858
+ this.GetAdminStatus = this.GetAdminStatus.bind(this);
6859
+ this.GenerateInviteCodes = this.GenerateInviteCodes.bind(this);
6860
+ this.ListInviteCodes = this.ListInviteCodes.bind(this);
6861
+ this.SendInviteCodeEmail = this.SendInviteCodeEmail.bind(this);
6862
+ this.UpdateAIProvider = this.UpdateAIProvider.bind(this);
6863
+ this.UpdateAIModel = this.UpdateAIModel.bind(this);
6864
+ this.UpdateAIEffort = this.UpdateAIEffort.bind(this);
6865
+ this.UpdateAIBiller = this.UpdateAIBiller.bind(this);
6866
+ this.ConfirmAIProviders = this.ConfirmAIProviders.bind(this);
6867
+ this.ConfirmAIModels = this.ConfirmAIModels.bind(this);
6868
+ this.ConfirmAIEfforts = this.ConfirmAIEfforts.bind(this);
6869
+ this.ConfirmAIBillers = this.ConfirmAIBillers.bind(this);
6870
+ this.ListRelayHeartbeats = this.ListRelayHeartbeats.bind(this);
6871
+ this.ListUsageGroups = this.ListUsageGroups.bind(this);
6872
+ this.ResolveOrgDetails = this.ResolveOrgDetails.bind(this);
6873
+ this.ResolveProjectDetails = this.ResolveProjectDetails.bind(this);
6874
+ this.ResolveUserDetails = this.ResolveUserDetails.bind(this);
6875
+ this.ListAITasks = this.ListAITasks.bind(this);
6876
+ this.ListAITaskRevisions = this.ListAITaskRevisions.bind(this);
6877
+ this.CreateAITaskRevision = this.CreateAITaskRevision.bind(this);
6878
+ this.ActivateAITaskRevision = this.ActivateAITaskRevision.bind(this);
6879
+ this.DeactivateAITaskRevision = this.DeactivateAITaskRevision.bind(this);
6880
+ }
6881
+ GetAdminStatus(request: GetAdminStatusRequest, metadata?: Metadata): Promise<GetAdminStatusResponse> {
6882
+ const data = GetAdminStatusRequest.encode(request).finish();
6883
+ const promise = this.rpc.request(this.service, "GetAdminStatus", data, metadata);
6884
+ return promise.then((data) => GetAdminStatusResponse.decode(new BinaryReader(data)));
6885
+ }
6886
+
6887
+ GenerateInviteCodes(request: GenerateInviteCodesRequest, metadata?: Metadata): Promise<GenerateInviteCodesResponse> {
6888
+ const data = GenerateInviteCodesRequest.encode(request).finish();
6889
+ const promise = this.rpc.request(this.service, "GenerateInviteCodes", data, metadata);
6890
+ return promise.then((data) => GenerateInviteCodesResponse.decode(new BinaryReader(data)));
6891
+ }
6892
+
6893
+ ListInviteCodes(request: ListInviteCodesRequest, metadata?: Metadata): Promise<ListInviteCodesResponse> {
6894
+ const data = ListInviteCodesRequest.encode(request).finish();
6895
+ const promise = this.rpc.request(this.service, "ListInviteCodes", data, metadata);
6896
+ return promise.then((data) => ListInviteCodesResponse.decode(new BinaryReader(data)));
6897
+ }
6898
+
6899
+ SendInviteCodeEmail(request: SendInviteCodeEmailRequest, metadata?: Metadata): Promise<SendInviteCodeEmailResponse> {
6900
+ const data = SendInviteCodeEmailRequest.encode(request).finish();
6901
+ const promise = this.rpc.request(this.service, "SendInviteCodeEmail", data, metadata);
6902
+ return promise.then((data) => SendInviteCodeEmailResponse.decode(new BinaryReader(data)));
6903
+ }
6904
+
6905
+ UpdateAIProvider(request: UpdateAIProviderRequest, metadata?: Metadata): Promise<UpdateAIProviderResponse> {
6906
+ const data = UpdateAIProviderRequest.encode(request).finish();
6907
+ const promise = this.rpc.request(this.service, "UpdateAIProvider", data, metadata);
6908
+ return promise.then((data) => UpdateAIProviderResponse.decode(new BinaryReader(data)));
6909
+ }
6910
+
6911
+ UpdateAIModel(request: UpdateAIModelRequest, metadata?: Metadata): Promise<UpdateAIModelResponse> {
6912
+ const data = UpdateAIModelRequest.encode(request).finish();
6913
+ const promise = this.rpc.request(this.service, "UpdateAIModel", data, metadata);
6914
+ return promise.then((data) => UpdateAIModelResponse.decode(new BinaryReader(data)));
6915
+ }
6916
+
6917
+ UpdateAIEffort(request: UpdateAIEffortRequest, metadata?: Metadata): Promise<UpdateAIEffortResponse> {
6918
+ const data = UpdateAIEffortRequest.encode(request).finish();
6919
+ const promise = this.rpc.request(this.service, "UpdateAIEffort", data, metadata);
6920
+ return promise.then((data) => UpdateAIEffortResponse.decode(new BinaryReader(data)));
6921
+ }
6922
+
6923
+ UpdateAIBiller(request: UpdateAIBillerRequest, metadata?: Metadata): Promise<UpdateAIBillerResponse> {
6924
+ const data = UpdateAIBillerRequest.encode(request).finish();
6925
+ const promise = this.rpc.request(this.service, "UpdateAIBiller", data, metadata);
6926
+ return promise.then((data) => UpdateAIBillerResponse.decode(new BinaryReader(data)));
6927
+ }
6928
+
6929
+ ConfirmAIProviders(request: ConfirmAIProvidersRequest, metadata?: Metadata): Promise<ConfirmAIProvidersResponse> {
6930
+ const data = ConfirmAIProvidersRequest.encode(request).finish();
6931
+ const promise = this.rpc.request(this.service, "ConfirmAIProviders", data, metadata);
6932
+ return promise.then((data) => ConfirmAIProvidersResponse.decode(new BinaryReader(data)));
6933
+ }
6934
+
6935
+ ConfirmAIModels(request: ConfirmAIModelsRequest, metadata?: Metadata): Promise<ConfirmAIModelsResponse> {
6936
+ const data = ConfirmAIModelsRequest.encode(request).finish();
6937
+ const promise = this.rpc.request(this.service, "ConfirmAIModels", data, metadata);
6938
+ return promise.then((data) => ConfirmAIModelsResponse.decode(new BinaryReader(data)));
5353
6939
  }
5354
6940
 
5355
6941
  ConfirmAIEfforts(request: ConfirmAIEffortsRequest, metadata?: Metadata): Promise<ConfirmAIEffortsResponse> {
@@ -5399,6 +6985,45 @@ export class AdminGatewayServiceClientImpl implements AdminGatewayService {
5399
6985
  const promise = this.rpc.request(this.service, "ResolveUserDetails", data, metadata);
5400
6986
  return promise.then((data) => ResolveUserDetailsResponse.decode(new BinaryReader(data)));
5401
6987
  }
6988
+
6989
+ ListAITasks(request: ListAITasksRequest, metadata?: Metadata): Promise<ListAITasksResponse> {
6990
+ const data = ListAITasksRequest.encode(request).finish();
6991
+ const promise = this.rpc.request(this.service, "ListAITasks", data, metadata);
6992
+ return promise.then((data) => ListAITasksResponse.decode(new BinaryReader(data)));
6993
+ }
6994
+
6995
+ ListAITaskRevisions(request: ListAITaskRevisionsRequest, metadata?: Metadata): Promise<ListAITaskRevisionsResponse> {
6996
+ const data = ListAITaskRevisionsRequest.encode(request).finish();
6997
+ const promise = this.rpc.request(this.service, "ListAITaskRevisions", data, metadata);
6998
+ return promise.then((data) => ListAITaskRevisionsResponse.decode(new BinaryReader(data)));
6999
+ }
7000
+
7001
+ CreateAITaskRevision(
7002
+ request: CreateAITaskRevisionRequest,
7003
+ metadata?: Metadata,
7004
+ ): Promise<CreateAITaskRevisionResponse> {
7005
+ const data = CreateAITaskRevisionRequest.encode(request).finish();
7006
+ const promise = this.rpc.request(this.service, "CreateAITaskRevision", data, metadata);
7007
+ return promise.then((data) => CreateAITaskRevisionResponse.decode(new BinaryReader(data)));
7008
+ }
7009
+
7010
+ ActivateAITaskRevision(
7011
+ request: ActivateAITaskRevisionRequest,
7012
+ metadata?: Metadata,
7013
+ ): Promise<ActivateAITaskRevisionResponse> {
7014
+ const data = ActivateAITaskRevisionRequest.encode(request).finish();
7015
+ const promise = this.rpc.request(this.service, "ActivateAITaskRevision", data, metadata);
7016
+ return promise.then((data) => ActivateAITaskRevisionResponse.decode(new BinaryReader(data)));
7017
+ }
7018
+
7019
+ DeactivateAITaskRevision(
7020
+ request: DeactivateAITaskRevisionRequest,
7021
+ metadata?: Metadata,
7022
+ ): Promise<DeactivateAITaskRevisionResponse> {
7023
+ const data = DeactivateAITaskRevisionRequest.encode(request).finish();
7024
+ const promise = this.rpc.request(this.service, "DeactivateAITaskRevision", data, metadata);
7025
+ return promise.then((data) => DeactivateAITaskRevisionResponse.decode(new BinaryReader(data)));
7026
+ }
5402
7027
  }
5403
7028
 
5404
7029
  interface Rpc {