@miradorlabs/web-grpc 3.34.0 → 3.36.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.
@@ -454,8 +454,6 @@ export enum AISpendForecastDimension {
454
454
  AI_SPEND_FORECAST_DIMENSION_MODEL = 1,
455
455
  AI_SPEND_FORECAST_DIMENSION_PROVIDER = 2,
456
456
  AI_SPEND_FORECAST_DIMENSION_SOURCE_SYSTEM = 3,
457
- AI_SPEND_FORECAST_DIMENSION_USER = 4,
458
- AI_SPEND_FORECAST_DIMENSION_API_KEY = 5,
459
457
  UNRECOGNIZED = -1,
460
458
  }
461
459
 
@@ -473,12 +471,6 @@ export function aISpendForecastDimensionFromJSON(object: any): AISpendForecastDi
473
471
  case 3:
474
472
  case "AI_SPEND_FORECAST_DIMENSION_SOURCE_SYSTEM":
475
473
  return AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_SOURCE_SYSTEM;
476
- case 4:
477
- case "AI_SPEND_FORECAST_DIMENSION_USER":
478
- return AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_USER;
479
- case 5:
480
- case "AI_SPEND_FORECAST_DIMENSION_API_KEY":
481
- return AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_API_KEY;
482
474
  case -1:
483
475
  case "UNRECOGNIZED":
484
476
  default:
@@ -496,10 +488,6 @@ export function aISpendForecastDimensionToJSON(object: AISpendForecastDimension)
496
488
  return "AI_SPEND_FORECAST_DIMENSION_PROVIDER";
497
489
  case AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_SOURCE_SYSTEM:
498
490
  return "AI_SPEND_FORECAST_DIMENSION_SOURCE_SYSTEM";
499
- case AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_USER:
500
- return "AI_SPEND_FORECAST_DIMENSION_USER";
501
- case AISpendForecastDimension.AI_SPEND_FORECAST_DIMENSION_API_KEY:
502
- return "AI_SPEND_FORECAST_DIMENSION_API_KEY";
503
491
  case AISpendForecastDimension.UNRECOGNIZED:
504
492
  default:
505
493
  return "UNRECOGNIZED";
@@ -1692,14 +1680,23 @@ export interface SpendForecastRequest {
1692
1680
  filter: SpendForecastFilter | undefined;
1693
1681
  }
1694
1682
 
1695
- /** SpendForecastFilter narrows the cost a forecast counts. An empty list does not filter. */
1683
+ /**
1684
+ * SpendForecastFilter narrows the cost a forecast counts: OR within a list, AND across lists, and an empty list does
1685
+ * not filter. source_systems and principals select as DailyActivityRequest.Filter's do, at most 500 entries each.
1686
+ */
1696
1687
  export interface SpendForecastFilter {
1697
1688
  /**
1698
- * OR within the list. UNKNOWN selects every cost off the three named facilities (observed-unknown, never-stamped
1699
- * or an unrecognized facility); UNSPECIFIED is rejected.
1689
+ * UNKNOWN selects every cost off the three named facilities (observed-unknown, never-stamped or an unrecognized
1690
+ * facility); UNSPECIFIED is rejected.
1700
1691
  * [API_METERED, PREPAID_CREDITS, UNKNOWN] is the cost not drawn on a subscription facility.
1701
1692
  */
1702
1693
  fundingModes: AIFundingMode[];
1694
+ sourceSystems: string[];
1695
+ /**
1696
+ * Cost belongs to its user id, else its api key: an api-key principal matches only cost with no user id. A
1697
+ * principal with an empty id selects cost that recorded neither.
1698
+ */
1699
+ principals: DailyActivityPrincipal[];
1703
1700
  }
1704
1701
 
1705
1702
  /**
@@ -1731,7 +1728,17 @@ export interface SpendForecast {
1731
1728
  * projection.expected_usd exactly; a group's low_usd and high_usd do not sum to total's.
1732
1729
  */
1733
1730
  breakdowns: SpendForecastBreakdown[];
1734
- asOf: Date | undefined;
1731
+ asOf:
1732
+ | Date
1733
+ | undefined;
1734
+ /**
1735
+ * The cost per principal, attributed as filter.principals selects it (user id, else api key), for principals with
1736
+ * cost in the month or the replayed history (one absent spent nothing), ascending by (source_system, kind, id).
1737
+ * Partitions total's month_to_date_usd and projection.expected_usd exactly; the entry with kind API_KEY and an
1738
+ * empty id is the cost that recorded neither id. Sent back as a filter principal an entry selects its own cost; one
1739
+ * with an empty source_system needs source_systems [""] beside it, as a filter's empty source means any.
1740
+ */
1741
+ principals: SpendForecastPrincipal[];
1735
1742
  }
1736
1743
 
1737
1744
  export interface SpendForecastBreakdown {
@@ -1746,6 +1753,12 @@ export interface SpendForecastGroup {
1746
1753
  measures: SpendForecastMeasures | undefined;
1747
1754
  }
1748
1755
 
1756
+ /** SpendForecastPrincipal is one principal's cost, on the source system that reported it. */
1757
+ export interface SpendForecastPrincipal {
1758
+ principal: DailyActivityPrincipal | undefined;
1759
+ measures: SpendForecastMeasures | undefined;
1760
+ }
1761
+
1749
1762
  export interface SpendForecastMeasures {
1750
1763
  monthToDateUsd: number;
1751
1764
  /** absent when history_weeks is 0 */
@@ -12048,7 +12061,7 @@ export const SpendForecastRequest: MessageFns<SpendForecastRequest> = {
12048
12061
  };
12049
12062
 
12050
12063
  function createBaseSpendForecastFilter(): SpendForecastFilter {
12051
- return { fundingModes: [] };
12064
+ return { fundingModes: [], sourceSystems: [], principals: [] };
12052
12065
  }
12053
12066
 
12054
12067
  export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
@@ -12056,6 +12069,12 @@ export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
12056
12069
  for (const v of message.fundingModes) {
12057
12070
  writer.uint32(8).int32(v!);
12058
12071
  }
12072
+ for (const v of message.sourceSystems) {
12073
+ writer.uint32(18).string(v!);
12074
+ }
12075
+ for (const v of message.principals) {
12076
+ DailyActivityPrincipal.encode(v!, writer.uint32(26).fork()).join();
12077
+ }
12059
12078
  return writer;
12060
12079
  },
12061
12080
 
@@ -12090,6 +12109,22 @@ export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
12090
12109
 
12091
12110
  break;
12092
12111
  }
12112
+ case 2: {
12113
+ if (tag !== 18) {
12114
+ break;
12115
+ }
12116
+
12117
+ message.sourceSystems.push(reader.string());
12118
+ continue;
12119
+ }
12120
+ case 3: {
12121
+ if (tag !== 26) {
12122
+ break;
12123
+ }
12124
+
12125
+ message.principals.push(DailyActivityPrincipal.decode(reader, reader.uint32()));
12126
+ continue;
12127
+ }
12093
12128
  }
12094
12129
  if ((tag & 7) === 4 || tag === 0) {
12095
12130
  break;
@@ -12109,6 +12144,14 @@ export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
12109
12144
  : globalThis.Array.isArray(object?.funding_modes)
12110
12145
  ? object.funding_modes.map((e: any) => aIFundingModeFromJSON(e))
12111
12146
  : [],
12147
+ sourceSystems: globalThis.Array.isArray(object?.sourceSystems)
12148
+ ? object.sourceSystems.map((e: any) => globalThis.String(e))
12149
+ : globalThis.Array.isArray(object?.source_systems)
12150
+ ? object.source_systems.map((e: any) => globalThis.String(e))
12151
+ : [],
12152
+ principals: globalThis.Array.isArray(object?.principals)
12153
+ ? object.principals.map((e: any) => DailyActivityPrincipal.fromJSON(e))
12154
+ : [],
12112
12155
  };
12113
12156
  },
12114
12157
 
@@ -12117,6 +12160,12 @@ export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
12117
12160
  if (message.fundingModes?.length) {
12118
12161
  obj.fundingModes = message.fundingModes.map((e) => aIFundingModeToJSON(e));
12119
12162
  }
12163
+ if (message.sourceSystems?.length) {
12164
+ obj.sourceSystems = message.sourceSystems;
12165
+ }
12166
+ if (message.principals?.length) {
12167
+ obj.principals = message.principals.map((e) => DailyActivityPrincipal.toJSON(e));
12168
+ }
12120
12169
  return obj;
12121
12170
  },
12122
12171
 
@@ -12126,6 +12175,8 @@ export const SpendForecastFilter: MessageFns<SpendForecastFilter> = {
12126
12175
  fromPartial<I extends Exact<DeepPartial<SpendForecastFilter>, I>>(object: I): SpendForecastFilter {
12127
12176
  const message = createBaseSpendForecastFilter();
12128
12177
  message.fundingModes = object.fundingModes?.map((e) => e) || [];
12178
+ message.sourceSystems = object.sourceSystems?.map((e) => e) || [];
12179
+ message.principals = object.principals?.map((e) => DailyActivityPrincipal.fromPartial(e)) || [];
12129
12180
  return message;
12130
12181
  },
12131
12182
  };
@@ -12140,6 +12191,7 @@ function createBaseSpendForecast(): SpendForecast {
12140
12191
  total: undefined,
12141
12192
  breakdowns: [],
12142
12193
  asOf: undefined,
12194
+ principals: [],
12143
12195
  };
12144
12196
  }
12145
12197
 
@@ -12169,6 +12221,9 @@ export const SpendForecast: MessageFns<SpendForecast> = {
12169
12221
  if (message.asOf !== undefined) {
12170
12222
  Timestamp.encode(toTimestamp(message.asOf), writer.uint32(66).fork()).join();
12171
12223
  }
12224
+ for (const v of message.principals) {
12225
+ SpendForecastPrincipal.encode(v!, writer.uint32(74).fork()).join();
12226
+ }
12172
12227
  return writer;
12173
12228
  },
12174
12229
 
@@ -12249,6 +12304,14 @@ export const SpendForecast: MessageFns<SpendForecast> = {
12249
12304
  message.asOf = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
12250
12305
  continue;
12251
12306
  }
12307
+ case 9: {
12308
+ if (tag !== 74) {
12309
+ break;
12310
+ }
12311
+
12312
+ message.principals.push(SpendForecastPrincipal.decode(reader, reader.uint32()));
12313
+ continue;
12314
+ }
12252
12315
  }
12253
12316
  if ((tag & 7) === 4 || tag === 0) {
12254
12317
  break;
@@ -12293,6 +12356,9 @@ export const SpendForecast: MessageFns<SpendForecast> = {
12293
12356
  : isSet(object.as_of)
12294
12357
  ? fromJsonTimestamp(object.as_of)
12295
12358
  : undefined,
12359
+ principals: globalThis.Array.isArray(object?.principals)
12360
+ ? object.principals.map((e: any) => SpendForecastPrincipal.fromJSON(e))
12361
+ : [],
12296
12362
  };
12297
12363
  },
12298
12364
 
@@ -12322,6 +12388,9 @@ export const SpendForecast: MessageFns<SpendForecast> = {
12322
12388
  if (message.asOf !== undefined) {
12323
12389
  obj.asOf = message.asOf.toISOString();
12324
12390
  }
12391
+ if (message.principals?.length) {
12392
+ obj.principals = message.principals.map((e) => SpendForecastPrincipal.toJSON(e));
12393
+ }
12325
12394
  return obj;
12326
12395
  },
12327
12396
 
@@ -12340,6 +12409,7 @@ export const SpendForecast: MessageFns<SpendForecast> = {
12340
12409
  : undefined;
12341
12410
  message.breakdowns = object.breakdowns?.map((e) => SpendForecastBreakdown.fromPartial(e)) || [];
12342
12411
  message.asOf = object.asOf ?? undefined;
12412
+ message.principals = object.principals?.map((e) => SpendForecastPrincipal.fromPartial(e)) || [];
12343
12413
  return message;
12344
12414
  },
12345
12415
  };
@@ -12518,6 +12588,95 @@ export const SpendForecastGroup: MessageFns<SpendForecastGroup> = {
12518
12588
  },
12519
12589
  };
12520
12590
 
12591
+ function createBaseSpendForecastPrincipal(): SpendForecastPrincipal {
12592
+ return { principal: undefined, measures: undefined };
12593
+ }
12594
+
12595
+ export const SpendForecastPrincipal: MessageFns<SpendForecastPrincipal> = {
12596
+ encode(message: SpendForecastPrincipal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
12597
+ if (message.principal !== undefined) {
12598
+ DailyActivityPrincipal.encode(message.principal, writer.uint32(10).fork()).join();
12599
+ }
12600
+ if (message.measures !== undefined) {
12601
+ SpendForecastMeasures.encode(message.measures, writer.uint32(18).fork()).join();
12602
+ }
12603
+ return writer;
12604
+ },
12605
+
12606
+ decode(input: BinaryReader | Uint8Array, length?: number): SpendForecastPrincipal {
12607
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
12608
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
12609
+ if (previousRecursionDepth >= 100) {
12610
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
12611
+ }
12612
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
12613
+ try {
12614
+ const end = length === undefined ? reader.len : reader.pos + length;
12615
+ const message = createBaseSpendForecastPrincipal();
12616
+ while (reader.pos < end) {
12617
+ const tag = reader.uint32();
12618
+ switch (tag >>> 3) {
12619
+ case 1: {
12620
+ if (tag !== 10) {
12621
+ break;
12622
+ }
12623
+
12624
+ message.principal = DailyActivityPrincipal.decode(reader, reader.uint32());
12625
+ continue;
12626
+ }
12627
+ case 2: {
12628
+ if (tag !== 18) {
12629
+ break;
12630
+ }
12631
+
12632
+ message.measures = SpendForecastMeasures.decode(reader, reader.uint32());
12633
+ continue;
12634
+ }
12635
+ }
12636
+ if ((tag & 7) === 4 || tag === 0) {
12637
+ break;
12638
+ }
12639
+ reader.skip(tag & 7);
12640
+ }
12641
+ return message;
12642
+ } finally {
12643
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
12644
+ }
12645
+ },
12646
+
12647
+ fromJSON(object: any): SpendForecastPrincipal {
12648
+ return {
12649
+ principal: isSet(object.principal) ? DailyActivityPrincipal.fromJSON(object.principal) : undefined,
12650
+ measures: isSet(object.measures) ? SpendForecastMeasures.fromJSON(object.measures) : undefined,
12651
+ };
12652
+ },
12653
+
12654
+ toJSON(message: SpendForecastPrincipal): unknown {
12655
+ const obj: any = {};
12656
+ if (message.principal !== undefined) {
12657
+ obj.principal = DailyActivityPrincipal.toJSON(message.principal);
12658
+ }
12659
+ if (message.measures !== undefined) {
12660
+ obj.measures = SpendForecastMeasures.toJSON(message.measures);
12661
+ }
12662
+ return obj;
12663
+ },
12664
+
12665
+ create<I extends Exact<DeepPartial<SpendForecastPrincipal>, I>>(base?: I): SpendForecastPrincipal {
12666
+ return SpendForecastPrincipal.fromPartial(base ?? ({} as any));
12667
+ },
12668
+ fromPartial<I extends Exact<DeepPartial<SpendForecastPrincipal>, I>>(object: I): SpendForecastPrincipal {
12669
+ const message = createBaseSpendForecastPrincipal();
12670
+ message.principal = (object.principal !== undefined && object.principal !== null)
12671
+ ? DailyActivityPrincipal.fromPartial(object.principal)
12672
+ : undefined;
12673
+ message.measures = (object.measures !== undefined && object.measures !== null)
12674
+ ? SpendForecastMeasures.fromPartial(object.measures)
12675
+ : undefined;
12676
+ return message;
12677
+ },
12678
+ };
12679
+
12521
12680
  function createBaseSpendForecastMeasures(): SpendForecastMeasures {
12522
12681
  return { monthToDateUsd: 0, projection: undefined };
12523
12682
  }
@@ -22557,9 +22716,9 @@ export interface AIGatewayService {
22557
22716
  StreamDailyActivity(request: DailyActivityRequest, metadata?: Metadata): Observable<DailyActivity>;
22558
22717
  /**
22559
22718
  * Live current-UTC-month spend forecast: month-to-date cost and the projected month-end total (a band from
22560
- * replaying recent weeks), for the project and per model, provider, source system, user and api key, off the
22561
- * same daily rollup as StreamDailyActivity; filter.funding_modes forecasts the cost on the listed funding modes. Mirrors
22562
- * telemetry.api.v1.
22719
+ * replaying recent weeks), for the project, per model, provider and source system, and per principal, off the
22720
+ * same daily rollup as StreamDailyActivity; the filter narrows it by funding mode, source system and principal.
22721
+ * Mirrors telemetry.api.v1.
22563
22722
  */
22564
22723
  StreamSpendForecast(request: SpendForecastRequest, metadata?: Metadata): Observable<SpendForecast>;
22565
22724
  /**
@@ -774,9 +774,9 @@ streamDailyActivity: {
774
774
  responseDeserialize: deserialize_gateway_web_v1_DailyActivity,
775
775
  },
776
776
  // Live current-UTC-month spend forecast: month-to-date cost and the projected month-end total (a band from
777
- // replaying recent weeks), for the project and per model, provider, source system, user and api key, off the
778
- // same daily rollup as StreamDailyActivity; filter.funding_modes forecasts the cost on the listed funding modes. Mirrors
779
- // telemetry.api.v1.
777
+ // replaying recent weeks), for the project, per model, provider and source system, and per principal, off the
778
+ // same daily rollup as StreamDailyActivity; the filter narrows it by funding mode, source system and principal.
779
+ // Mirrors telemetry.api.v1.
780
780
  streamSpendForecast: {
781
781
  path: '/gateway.web.v1.AIGatewayService/StreamSpendForecast',
782
782
  requestStream: false,