@vfarcic/dot-ai 0.183.0 → 0.185.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"host-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/host-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAC;AAkBlC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;CAClD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,QAAQ,EAAE,eAAe,EAAE,EAC3B,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,GAAG,KACV,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7B,qBAAa,YAAa,YAAW,UAAU;IAC7C,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAkB;IACjD,OAAO,CAAC,SAAS,CAAU;;IAM3B,kBAAkB,CAAC,OAAO,EAAE,eAAe;IAI3C,aAAa,IAAI,OAAO;IAIxB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,YAAY,IAAI,MAAM;IAItB,OAAO,CAAC,iBAAiB;IAwBnB,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAkB,EAC7B,iBAAiB,CAAC,EAAE;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,C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;;OAUG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAmN/D"}
@@ -293,18 +293,55 @@ class HostProvider {
293
293
  throw new Error(`Host sampling error in tool loop: ${message}`);
294
294
  }
295
295
  }
296
- const lastMessage = messages[messages.length - 1];
297
- const lastContent = typeof lastMessage.content === 'string'
298
- ? lastMessage.content
299
- : (lastMessage.content?.text ?? '');
300
- return {
301
- finalMessage: lastContent,
302
- iterations,
303
- toolCallsExecuted,
304
- totalTokens: { input: 0, output: 0 },
305
- status: 'timeout',
306
- completionReason: 'max_iterations',
307
- };
296
+ // Max iterations reached - make one final wrap-up call WITHOUT tools
297
+ // to force the AI to summarize findings rather than continue investigating
298
+ const wrapUpMessage = 'You have reached the maximum number of investigation steps. Please provide your final summary NOW in the required JSON format based on all findings gathered so far. Do not request any more tool calls.';
299
+ messages.push({
300
+ role: 'user',
301
+ content: { type: 'text', text: wrapUpMessage },
302
+ });
303
+ try {
304
+ // Make final call WITHOUT tools in system prompt - use base system prompt only
305
+ const wrapUpResult = await HostProvider.samplingHandler(messages, config.systemPrompt, // Original system prompt without tool definitions
306
+ {
307
+ operation: config.operation,
308
+ evaluationContext: config.evaluationContext,
309
+ interaction_id: config.interaction_id,
310
+ });
311
+ let wrapUpContent = '';
312
+ if (typeof wrapUpResult.content === 'object' && wrapUpResult.content.type === 'text') {
313
+ wrapUpContent = wrapUpResult.content.text;
314
+ }
315
+ else if (typeof wrapUpResult.content === 'string') {
316
+ wrapUpContent = wrapUpResult.content;
317
+ }
318
+ else {
319
+ wrapUpContent = JSON.stringify(wrapUpResult.content);
320
+ }
321
+ return {
322
+ finalMessage: wrapUpContent,
323
+ iterations: iterations + 1, // Include wrap-up iteration
324
+ toolCallsExecuted,
325
+ totalTokens: { input: 0, output: 0 },
326
+ status: 'timeout',
327
+ completionReason: 'max_iterations',
328
+ };
329
+ }
330
+ catch (error) {
331
+ // If wrap-up call fails, fall back to last message
332
+ const lastMessage = messages[messages.length - 2]; // -2 because we added wrap-up message
333
+ const lastContent = typeof lastMessage.content === 'string'
334
+ ? lastMessage.content
335
+ : (lastMessage.content?.text ?? '');
336
+ return {
337
+ finalMessage: lastContent,
338
+ iterations,
339
+ toolCallsExecuted,
340
+ totalTokens: { input: 0, output: 0 },
341
+ status: 'timeout',
342
+ completionReason: 'max_iterations',
343
+ };
344
+ }
308
345
  }, (result) => ({
309
346
  inputTokens: result.totalTokens.input,
310
347
  outputTokens: result.totalTokens.output,
@@ -1 +1 @@
1
- {"version":3,"file":"vercel-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/vercel-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAiBlC,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,aAAa,CAAM;gBAEf,MAAM,EAAE,gBAAgB;IAWpC,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,eAAe;IAsFvB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,YAAY,IAAI,MAAM;IAItB,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,iBAAiB;IAyBnB,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAkB,EAC7B,iBAAiB,CAAC,EAAE;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,CAAC;IAoJtB;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAiW/D"}
1
+ {"version":3,"file":"vercel-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/vercel-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAiBlC,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,aAAa,CAAM;gBAEf,MAAM,EAAE,gBAAgB;IAWpC,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,eAAe;IAsFvB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,YAAY,IAAI,MAAM;IAItB,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,iBAAiB;IAyBnB,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAkB,EAC7B,iBAAiB,CAAC,EAAE;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,CAAC;IAoJtB;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA6a/D"}
@@ -503,6 +503,69 @@ class VercelProvider {
503
503
  }
504
504
  }
505
505
  }
506
+ // Check if we hit max iterations without a proper summary
507
+ // If so, make one final wrap-up call WITHOUT tools to force summary generation
508
+ const stepsUsed = result.steps?.length || 0;
509
+ const hasProperSummary = finalText && finalText.includes('{') && finalText.includes('}');
510
+ if (stepsUsed >= maxIterations && !hasProperSummary) {
511
+ try {
512
+ // Build wrap-up messages with full conversation history
513
+ const wrapUpMessages = [];
514
+ // Add system message for Anthropic providers
515
+ if (this.providerType === 'anthropic' ||
516
+ this.providerType === 'anthropic_opus' ||
517
+ this.providerType === 'anthropic_haiku') {
518
+ wrapUpMessages.push({
519
+ role: 'system',
520
+ content: config.systemPrompt,
521
+ });
522
+ }
523
+ // Add original user message
524
+ wrapUpMessages.push({
525
+ role: 'user',
526
+ content: config.userMessage,
527
+ });
528
+ // Add conversation history from steps
529
+ for (const step of result.steps || []) {
530
+ if (step.text) {
531
+ wrapUpMessages.push({
532
+ role: 'assistant',
533
+ content: step.text,
534
+ });
535
+ }
536
+ // Add tool results as user messages
537
+ for (const toolResult of step.toolResults || []) {
538
+ wrapUpMessages.push({
539
+ role: 'user',
540
+ content: `Tool result from ${toolResult.toolName}: ${JSON.stringify(toolResult.output || toolResult)}`,
541
+ });
542
+ }
543
+ }
544
+ // Add wrap-up instruction
545
+ wrapUpMessages.push({
546
+ role: 'user',
547
+ content: 'You have reached the maximum number of investigation steps. Please provide your final summary NOW in the required JSON format based on all findings gathered so far. Do not request any more tool calls.',
548
+ });
549
+ // Make final call WITHOUT tools
550
+ const wrapUpConfig = {
551
+ model: this.modelInstance,
552
+ messages: wrapUpMessages,
553
+ // NO tools - forces text response
554
+ };
555
+ // Add system parameter for non-Anthropic providers
556
+ if (this.providerType !== 'anthropic' &&
557
+ this.providerType !== 'anthropic_opus' &&
558
+ this.providerType !== 'anthropic_haiku') {
559
+ wrapUpConfig.system = config.systemPrompt;
560
+ }
561
+ const wrapUpResult = await (0, ai_1.generateText)(wrapUpConfig);
562
+ finalText = wrapUpResult.text || finalText;
563
+ }
564
+ catch (wrapUpError) {
565
+ // If wrap-up fails, continue with whatever we have
566
+ console.warn('Wrap-up call failed, using existing response:', wrapUpError);
567
+ }
568
+ }
506
569
  // Log processed summary response (keep existing functionality)
507
570
  if (this.debugMode && debugFiles === null) {
508
571
  // Only log summary if we haven't already logged raw response
@@ -47,6 +47,7 @@ export interface QueryOutput {
47
47
  iterations: number;
48
48
  sessionId?: string;
49
49
  visualizationUrl?: string;
50
+ guidance: string;
50
51
  error?: {
51
52
  code: string;
52
53
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,sBAAsB,iWAAuV,CAAC;AAG3X,eAAO,MAAM,uBAAuB;;;CAGnC,CAAC;AAGF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,GAAG,CAAC;QACX,MAAM,EAAE,GAAG,CAAC;KACb,CAAC,CAAC;IAEH,mBAAmB,CAAC,EAAE;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,EAAE,KAAK,CAAC;YACpB,EAAE,EAAE,MAAM,CAAC;YACX,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;YACtD,OAAO,EAAE,GAAG,CAAC;SACd,CAAC,CAAC;QACH,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAGD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,E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G,CAAC;SACd,CAAC,CAAC;QACH,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAGD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAgED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA4I7D"}
@@ -166,7 +166,7 @@ async function handleQueryTool(args) {
166
166
  userMessage: intent,
167
167
  tools: [...capability_tools_1.CAPABILITY_TOOLS, ...resource_tools_1.RESOURCE_TOOLS, ...KUBECTL_READONLY_TOOLS],
168
168
  toolExecutor: executeQueryTools,
169
- maxIterations: 10,
169
+ maxIterations: 30,
170
170
  operation: 'query',
171
171
  evaluationContext: {
172
172
  user_intent: intent
@@ -198,17 +198,17 @@ async function handleQueryTool(args) {
198
198
  sessionId: session.sessionId,
199
199
  ...(visualizationUrl && { visualizationUrl })
200
200
  });
201
- // Append visualization URL to summary so agents display it to users
202
- const summaryWithUrl = visualizationUrl
203
- ? `${summary}\n\nšŸ“Š **View visualization**: ${visualizationUrl}`
204
- : summary;
201
+ const guidance = visualizationUrl
202
+ ? 'Present the summary to the user. Include the visualizationUrl at the end of your response.'
203
+ : 'Present the summary to the user.';
205
204
  const output = {
206
205
  success: true,
207
- summary: summaryWithUrl,
206
+ summary,
208
207
  toolsUsed,
209
208
  iterations: result.iterations,
210
209
  sessionId: session.sessionId,
211
- ...(visualizationUrl && { visualizationUrl })
210
+ ...(visualizationUrl && { visualizationUrl }),
211
+ guidance
212
212
  };
213
213
  return {
214
214
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vfarcic/dot-ai",
3
- "version": "0.183.0",
3
+ "version": "0.185.0",
4
4
  "description": "AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance",
5
5
  "mcpName": "io.github.vfarcic/dot-ai",
6
6
  "main": "dist/index.js",
@@ -196,8 +196,8 @@ git commit -m "docs(prd-[number]): close PRD #[number] - [brief reason] [skip ci
196
196
 
197
197
  Closes #[number]"
198
198
 
199
- # Push to remote
200
- git push origin main
199
+ # Pull latest and push to remote
200
+ git pull --rebase origin main && git push origin main
201
201
  ```
202
202
 
203
203
  **Important**:
@@ -187,8 +187,8 @@ git commit -m "docs(prd-[issue-id]): create PRD #[issue-id] - [feature-name] [sk
187
187
  - Added to ROADMAP.md ([timeframe] section)
188
188
  - Ready for implementation"
189
189
 
190
- # Push to main
191
- git push origin main
190
+ # Pull latest and push to main
191
+ git pull --rebase origin main && git push origin main
192
192
  ```
193
193
 
194
194
  **Confirmation Message:**
@@ -46,7 +46,7 @@ Complete the PRD implementation workflow including branch management, pull reque
46
46
  - [ ] **Use skip CI commit message**: Include CI skip pattern in commit message to avoid unnecessary CI runs
47
47
  - Common patterns: `[skip ci]`, `[ci skip]`, `***NO_CI***`, `[skip actions]`
48
48
  - Check project's CI configuration for the correct pattern
49
- - [ ] **Push to remote**: `git push origin main` to sync changes
49
+ - [ ] **Push to remote**: `git pull --rebase origin main && git push origin main` to sync changes
50
50
 
51
51
  **For Code Implementation Completions:**
52
52
  - [ ] **Create feature branch**: `git checkout -b feature/prd-[issue-id]-[feature-name]`