@game_ryo/lsji 1.2.1 → 1.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@game_ryo/lsji",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "A general-purpose reinforcement learning agent framework (Node.js) with LLM agent capabilities",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -53,6 +53,22 @@ export function createBudgetController(config = {}) {
53
53
  };
54
54
  },
55
55
 
56
+ /**
57
+ * Record cost/usage after operation (alias for recordUsage)
58
+ * Supports both recordCost(budgetId, usage) and recordCost({ budgetId, ...usage })
59
+ */
60
+ recordCost(budgetId, usage) {
61
+ // Handle both calling conventions:
62
+ // 1. recordCost(budgetId, usageObj)
63
+ // 2. recordCost({ budgetId, ...usageObj })
64
+ if (usage === undefined && budgetId && typeof budgetId === 'object') {
65
+ // Called as recordCost({ budgetId, ...usage })
66
+ const obj = budgetId;
67
+ return this.recordUsage(obj.budgetId, obj);
68
+ }
69
+ return this.recordUsage(budgetId, usage);
70
+ },
71
+
56
72
  /**
57
73
  * Reset run budget
58
74
  */
package/src/index.js CHANGED
@@ -96,4 +96,4 @@ export {
96
96
  } from './llm/plugins/index.js';
97
97
 
98
98
  // Version
99
- export const VERSION = '1.2.1';
99
+ export const VERSION = '1.2.3';
@@ -138,13 +138,16 @@ export function createApp(config = {}) {
138
138
  toolRegistry.register({ ...tool, category: 'plugin' });
139
139
  }
140
140
 
141
- // Create LLM agent
141
+ // Create LLM agent with API key from request
142
+ const finalApiKey = llm.apiKey || process.env[llm.provider === 'gemini' ? 'GEMINI_API_KEY' : llm.provider === 'openai' ? 'OPENAI_API_KEY' : llm.provider === 'anthropic' ? 'ANTHROPIC_API_KEY' : ''];
143
+ const storageConfig = { type: config.storage?.type || 'sqlite', options: config.storage?.options || {} };
142
144
  const agent = await createLLMAgent({
143
- llm,
144
- execution: { storage: { type: config.storage?.type || 'sqlite', options: config.storage?.options || {} } },
145
- hitl: { enabled: hitl.enabled !== false, defaultTimeout: 300000 },
145
+ llm: { ...llm, apiKey: finalApiKey },
146
+ storage: storageConfig,
147
+ execution: { storage: storageConfig },
148
+ hitl: { enabled: hitl.enabled !== false, defaultTimeout: 300000, store: storageConfig },
146
149
  budget,
147
- memory: { conversation: true, episodic: true },
150
+ memory: { conversation: true, episodic: true, semantic: true },
148
151
  tools: { custom: toolRegistry },
149
152
  });
150
153