@hamp10/agentforge 0.2.4 → 0.2.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/OllamaAgent.js +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamp10/agentforge",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "AgentForge worker — connect your machine to agentforge.ai",
5
5
  "type": "module",
6
6
  "bin": {
@@ -156,21 +156,24 @@ export class OllamaAgent extends EventEmitter {
156
156
  return { agentId, workDir };
157
157
  }
158
158
 
159
- async runAgentTask(agentId, task, workDir, sessionId = null, image = null) {
159
+ async runAgentTask(agentId, task, workDir, sessionId = null, image = null, browserProfile = null, actualWorkDir = null, agentModel = null) {
160
160
  const startTime = Date.now();
161
161
  const controller = new AbortController();
162
162
 
163
+ // Use per-agent model override if provided (and not the placeholder 'Default')
164
+ const effectiveModel = (agentModel && agentModel !== 'Default') ? agentModel : this.model;
165
+
163
166
  // Fake proc-like object so worker.js pid checks don't crash
164
167
  const fakeProc = { pid: null };
165
168
  this.activeAgents.set(agentId, { startTime, task, workDir, abort: () => controller.abort(), proc: fakeProc });
166
169
 
167
- console.log(`\nšŸ¦™ [Ollama/${this.model}] Running agent: ${agentId}`);
170
+ console.log(`\nšŸ¦™ [Ollama/${effectiveModel}] Running agent: ${agentId}`);
168
171
  console.log(` Task: ${task}`);
169
172
  console.log(` Working dir: ${workDir}`);
170
173
 
171
174
  // Detect model capabilities
172
- const isQwen3 = this.model.startsWith('qwen3');
173
- const isVision = /vl|vision|llava|minicpm-v|moondream/i.test(this.model);
175
+ const isQwen3 = effectiveModel.startsWith('qwen3');
176
+ const isVision = /vl|vision|llava|minicpm-v|moondream/i.test(effectiveModel);
174
177
 
175
178
  try {
176
179
  // Load conversation history from disk (session persistence)
@@ -209,12 +212,12 @@ export class OllamaAgent extends EventEmitter {
209
212
  for (let turn = 0; turn < MAX_TURNS; turn++) {
210
213
  if (controller.signal.aborted) break;
211
214
 
212
- this.emit('tool_activity', { agentId, event: 'api_call_start', description: `šŸ¦™ Calling ${this.model}...` });
215
+ this.emit('tool_activity', { agentId, event: 'api_call_start', description: `šŸ¦™ Calling ${effectiveModel}...` });
213
216
 
214
217
  let response;
215
218
  try {
216
219
  const requestBody = {
217
- model: this.model,
220
+ model: effectiveModel,
218
221
  messages,
219
222
  tools: TOOLS,
220
223
  tool_choice: 'auto',
@@ -418,7 +421,7 @@ export class OllamaAgent extends EventEmitter {
418
421
  headers: { 'Content-Type': 'application/json' },
419
422
  signal: controller.signal,
420
423
  body: JSON.stringify({
421
- model: this.model,
424
+ model: effectiveModel,
422
425
  messages,
423
426
  stream: true,
424
427
  ...(isQwen3 ? { options: { think: false } } : {})