@hamp10/agentforge 0.2.4 → 0.2.6

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 +13 -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.6",
4
4
  "description": "AgentForge worker — connect your machine to agentforge.ai",
5
5
  "type": "module",
6
6
  "bin": {
@@ -156,21 +156,27 @@ 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
+ // Strip 'ollama/' prefix — catalog returns IDs like 'ollama/qwen3-vl:8b' but
165
+ // Ollama's API expects bare names like 'qwen3-vl:8b'.
166
+ const rawModel = (agentModel && agentModel !== 'Default') ? agentModel : this.model;
167
+ const effectiveModel = rawModel.startsWith('ollama/') ? rawModel.slice(7) : rawModel;
168
+
163
169
  // Fake proc-like object so worker.js pid checks don't crash
164
170
  const fakeProc = { pid: null };
165
171
  this.activeAgents.set(agentId, { startTime, task, workDir, abort: () => controller.abort(), proc: fakeProc });
166
172
 
167
- console.log(`\n🦙 [Ollama/${this.model}] Running agent: ${agentId}`);
173
+ console.log(`\n🦙 [Ollama/${effectiveModel}] Running agent: ${agentId}`);
168
174
  console.log(` Task: ${task}`);
169
175
  console.log(` Working dir: ${workDir}`);
170
176
 
171
177
  // Detect model capabilities
172
- const isQwen3 = this.model.startsWith('qwen3');
173
- const isVision = /vl|vision|llava|minicpm-v|moondream/i.test(this.model);
178
+ const isQwen3 = effectiveModel.startsWith('qwen3');
179
+ const isVision = /vl|vision|llava|minicpm-v|moondream/i.test(effectiveModel);
174
180
 
175
181
  try {
176
182
  // Load conversation history from disk (session persistence)
@@ -209,12 +215,12 @@ export class OllamaAgent extends EventEmitter {
209
215
  for (let turn = 0; turn < MAX_TURNS; turn++) {
210
216
  if (controller.signal.aborted) break;
211
217
 
212
- this.emit('tool_activity', { agentId, event: 'api_call_start', description: `🦙 Calling ${this.model}...` });
218
+ this.emit('tool_activity', { agentId, event: 'api_call_start', description: `🦙 Calling ${effectiveModel}...` });
213
219
 
214
220
  let response;
215
221
  try {
216
222
  const requestBody = {
217
- model: this.model,
223
+ model: effectiveModel,
218
224
  messages,
219
225
  tools: TOOLS,
220
226
  tool_choice: 'auto',
@@ -418,7 +424,7 @@ export class OllamaAgent extends EventEmitter {
418
424
  headers: { 'Content-Type': 'application/json' },
419
425
  signal: controller.signal,
420
426
  body: JSON.stringify({
421
- model: this.model,
427
+ model: effectiveModel,
422
428
  messages,
423
429
  stream: true,
424
430
  ...(isQwen3 ? { options: { think: false } } : {})