@databutton/firebase-types 1.85.24 → 1.85.25

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.
@@ -65,6 +65,7 @@ export declare enum CollectionName {
65
65
  THREADS = "threads",
66
66
  UPGRADE_REQUESTS = "upgrade-requests",
67
67
  USAGE_RECORDS = "usage-records",
68
+ AI_USAGE_RECORDS = "ai-usage-records",
68
69
  USER_SEGMENTS = "user-segments",
69
70
  VERSIONS = "versions",
70
71
  VIEWERS = "viewers",
@@ -66,6 +66,7 @@ export var CollectionName;
66
66
  CollectionName["THREADS"] = "threads";
67
67
  CollectionName["UPGRADE_REQUESTS"] = "upgrade-requests";
68
68
  CollectionName["USAGE_RECORDS"] = "usage-records";
69
+ CollectionName["AI_USAGE_RECORDS"] = "ai-usage-records";
69
70
  CollectionName["USER_SEGMENTS"] = "user-segments";
70
71
  CollectionName["VERSIONS"] = "versions";
71
72
  CollectionName["VIEWERS"] = "viewers";
@@ -1717,6 +1717,7 @@ export interface PublicUsernameRecord {
1717
1717
  }
1718
1718
  export interface CreditTransactionRecord {
1719
1719
  customerId: string;
1720
+ comment?: string | null;
1720
1721
  amountInCents: number;
1721
1722
  createdAt: Timestamp;
1722
1723
  projectId: string | null;
@@ -1950,4 +1951,72 @@ export interface ProjectPlan {
1950
1951
  previewComponentCode: string | null;
1951
1952
  projectTemplateId: string;
1952
1953
  }
1954
+ export interface AiUsageRecord {
1955
+ /**
1956
+ * Who the usage should consume credits from.
1957
+ * Usually the project owner
1958
+ */
1959
+ customerId: string;
1960
+ /**
1961
+ * Who performed the action that triggered the usage record
1962
+ * Can be both owner of the project, a collaborator, or someone from support
1963
+ */
1964
+ performedBy: PerformedBy;
1965
+ /**
1966
+ * If the usage is associated with a project
1967
+ * we track it, so customers can see which apps are using most credits
1968
+ */
1969
+ projectId: string | null;
1970
+ /**
1971
+ * Timestamp when the usage was recorded
1972
+ */
1973
+ recordedAt: Timestamp;
1974
+ /**
1975
+ * In case we need to differentiate between different types of usage
1976
+ */
1977
+ type: "agent";
1978
+ /**
1979
+ * Type of prompt used
1980
+ */
1981
+ promptType: "chat" | "one-shot" | "structured-output";
1982
+ /**
1983
+ * Total cost in USD for us
1984
+ */
1985
+ totalCostUsd: number;
1986
+ streak: {
1987
+ /**
1988
+ * Identifier for the streak
1989
+ * Usually set to the user message that triggered the streak
1990
+ */
1991
+ id: string;
1992
+ /**
1993
+ * Number of iterations in the streak
1994
+ */
1995
+ iterations: number;
1996
+ };
1997
+ agent: {
1998
+ id: string;
1999
+ model: {
2000
+ provider: "openai" | "anthropic" | "google";
2001
+ identifier: string;
2002
+ };
2003
+ contextWindow: {
2004
+ name: "low" | "standard" | "high";
2005
+ sizeInTokens: number;
2006
+ };
2007
+ };
2008
+ entries: AiUageRecordEntry[];
2009
+ }
2010
+ export interface AiUageRecordEntry {
2011
+ costUsd: number;
2012
+ toolCalls: string[];
2013
+ provider: "openai" | "anthropic" | "google" | "morph" | "perplexity";
2014
+ identifier: string;
2015
+ finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call" | "cancelled_by_user";
2016
+ /**
2017
+ * Usage reported by the provider in their own format.
2018
+ * Only used for debugging purposes and potentially correcting misreporting
2019
+ */
2020
+ rawUsage: object;
2021
+ }
1953
2022
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databutton/firebase-types",
3
- "version": "1.85.24",
3
+ "version": "1.85.25",
4
4
  "main": "lib/types/published/index.js",
5
5
  "type": "module",
6
6
  "engines": {