@databutton/firebase-types 1.85.24 → 1.85.26

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