backend-manager 5.0.0 → 5.0.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/.nvmrc CHANGED
@@ -1 +1 @@
1
- v18/*
1
+ v22/*
package/CHANGELOG.md CHANGED
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
17
17
  ---#
18
18
  # [5.0.0] - 2025-07-10
19
19
  ### ⚠️ BREAKING
20
+ - Node.js version requirement is now `22`.
20
21
  - `Manager.init()` no longer wraps the initializeApp() in `try/catch` block.
21
22
  - `Settings()` API tries to look for a method-specific file first (e.g., `name/get.js`, `name/post.js`, etc.) before falling back to `name/index.js`. This allows for more modular and organized code structure. Also, `name.js` is no longer valid, we now look for `name/index.js` this is to make it consistent with the `Middleware()` API.
22
23
  - `Middleware()` API now tries to load method-specific files (e.g., `name/get.js`, `name/post.js`, etc.) before falling back to `name/index.js`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "prepare:watch": "nodemon -w ./src -e '*' --exec 'npm run prepare'"
20
20
  },
21
21
  "engines": {
22
- "node": "18"
22
+ "node": "22"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -290,7 +290,7 @@ Manager.prototype.init = function (exporter, options) {
290
290
  self.storage();
291
291
  }
292
292
 
293
- // Fetch stats (only once per process run)
293
+ // Fetch stats
294
294
  if (self.assistant.isDevelopment() && options.fetchStats) {
295
295
  setTimeout(function () {
296
296
  self.assistant.log('Fetching meta/stats...');
@@ -10,6 +10,7 @@ const mimeTypes = require('mime-types');
10
10
  const DEFAULT_MODEL = 'gpt-4o';
11
11
  const MODERATION_MODEL = 'omni-moderation-latest';
12
12
 
13
+ // OpenAI model pricing table
13
14
  // https://platform.openai.com/docs/pricing
14
15
  const MODEL_TABLE = {
15
16
  // Jul 11, 2025
@@ -85,6 +86,14 @@ const MODEL_TABLE = {
85
86
  json: true,
86
87
  },
87
88
  },
89
+ 'o4-mini': {
90
+ input: 1.10,
91
+ output: 4.40,
92
+ provider: 'openai',
93
+ features: {
94
+ json: true,
95
+ },
96
+ },
88
97
  'o1-preview': {
89
98
  input: 15.00,
90
99
  output: 60.00,
@@ -195,6 +204,9 @@ OpenAI.prototype.request = function (options) {
195
204
  // Format schema
196
205
  options.schema = options.schema || undefined;
197
206
 
207
+ // Reasons
208
+ options.reasoning = options.reasoning || undefined;
209
+
198
210
  // Format prompt
199
211
  options.prompt = options.prompt || {};
200
212
  options.prompt.path = options.prompt.path || '';
@@ -592,8 +604,11 @@ function attemptRequest(options, self, prompt, message, user, moderation, attemp
592
604
  // metadata: {}
593
605
  // }
594
606
 
607
+ // Get output
608
+ const output = r.output;
609
+
595
610
  // Ensure content is set
596
- const content = r.output[0].content;
611
+ const content = output.find((o) => o.type === 'message')?.content || [];
597
612
 
598
613
  // Trim and combine all output text
599
614
  const outputText = content
@@ -708,6 +723,7 @@ function makeRequest(mode, options, self, prompt, message, user, _log) {
708
723
  temperature: options.temperature,
709
724
  max_output_tokens: options.maxTokens,
710
725
  text: resolveFormatting(options),
726
+ reasoning: resolveReasoning(options),
711
727
  }
712
728
  }
713
729
 
@@ -768,4 +784,17 @@ function resolveFormatting(options) {
768
784
  return undefined;
769
785
  }
770
786
 
787
+ function resolveReasoning(options) {
788
+ // If reasoning is set, return reasoning format
789
+ if (options.reasoning) {
790
+ return {
791
+ effort: options.reasoning.effort || 'medium',
792
+ // summary: options.reasoning.summary || 'concise',
793
+ };
794
+ }
795
+
796
+ // Other, return undefined
797
+ return undefined;
798
+ }
799
+
771
800
  module.exports = OpenAI;