@browser-ai/core 2.1.0 → 2.1.2

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.
package/dist/index.d.mts CHANGED
@@ -52,6 +52,16 @@ declare class BrowserAIChatLanguageModel implements LanguageModelV3 {
52
52
  * @throws {UnsupportedFunctionalityError} When unsupported features like file input are used
53
53
  */
54
54
  doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
55
+ /**
56
+ * Gets the input usage for the current session, if available
57
+ * @returns The input usage or undefined if not available
58
+ */
59
+ getInputUsage(): number | undefined;
60
+ /**
61
+ * Gets the input quota for the current session, if available
62
+ * @returns The input quota or undefined if not available
63
+ */
64
+ getInputQuota(): number | undefined;
55
65
  /**
56
66
  * Check the availability of the browser AI model
57
67
  * @returns Promise resolving to "unavailable", "available", or "available-after-download"
package/dist/index.d.ts CHANGED
@@ -52,6 +52,16 @@ declare class BrowserAIChatLanguageModel implements LanguageModelV3 {
52
52
  * @throws {UnsupportedFunctionalityError} When unsupported features like file input are used
53
53
  */
54
54
  doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
55
+ /**
56
+ * Gets the input usage for the current session, if available
57
+ * @returns The input usage or undefined if not available
58
+ */
59
+ getInputUsage(): number | undefined;
60
+ /**
61
+ * Gets the input quota for the current session, if available
62
+ * @returns The input quota or undefined if not available
63
+ */
64
+ getInputQuota(): number | undefined;
55
65
  /**
56
66
  * Check the availability of the browser AI model
57
67
  * @returns Promise resolving to "unavailable", "available", or "available-after-download"
package/dist/index.js CHANGED
@@ -912,6 +912,20 @@ var SessionManager = class {
912
912
  }
913
913
  this.session = null;
914
914
  }
915
+ /**
916
+ * Gets the input quota for the current session, if available
917
+ * @returns The input quota or undefined if not available
918
+ */
919
+ getInputQuota() {
920
+ return this.getCurrentSession()?.inputQuota;
921
+ }
922
+ /**
923
+ * Gets the input usage for the current session, if available
924
+ * @returns The input usage or undefined if not available
925
+ */
926
+ getInputUsage() {
927
+ return this.getCurrentSession()?.inputUsage;
928
+ }
915
929
  /**
916
930
  * Prepares merged session options from base config and request options
917
931
  *
@@ -1205,6 +1219,20 @@ var BrowserAIChatLanguageModel = class {
1205
1219
  warnings
1206
1220
  };
1207
1221
  }
1222
+ /**
1223
+ * Gets the input usage for the current session, if available
1224
+ * @returns The input usage or undefined if not available
1225
+ */
1226
+ getInputUsage() {
1227
+ return this.sessionManager.getInputUsage();
1228
+ }
1229
+ /**
1230
+ * Gets the input quota for the current session, if available
1231
+ * @returns The input quota or undefined if not available
1232
+ */
1233
+ getInputQuota() {
1234
+ return this.sessionManager.getInputQuota();
1235
+ }
1208
1236
  /**
1209
1237
  * Check the availability of the browser AI model
1210
1238
  * @returns Promise resolving to "unavailable", "available", or "available-after-download"