Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Code inside template literals in task descriptions is incorrectly executed #175

Open
dannleft opened this issue Dec 18, 2024 · 0 comments
Labels
bug Something isn't working playground Pertains to the interactive examples or sandbox environments that allow for testing or playing with

Comments

@dannleft
Copy link
Collaborator

Descripción:

Describe the Bug

When adding example code within a template literal or string in the description attribute of a task, KaibanJS incorrectly interprets the code as executable, resulting in errors such as "X is not defined" if the example contains references to undefined variables.


KaibanJS Team Config

Provide a playground link or configuration file to reproduce the issue:

import { Agent, Task, Team } from 'kaibanjs';

// Define agent
const exampleAgent = new Agent({
    name: 'ExampleAgent',
    role: 'QA Specialist',
    goal: 'Analyze code and validate standards.',
    background: 'Testing Specialist',
    tools: [],
});

// Define task
const exampleTask = new Task({
    description: `
    Review the following example:
    \`\`\`javascript
    const complianceTeam = new Team({
        name: 'Compliance Team',
        agents: [syntaxChecker],
        tasks: [checkSyntaxTask],
    });
    \`\`\`
    Ensure the code adheres to KaibanJS standards.
    `,
    expectedOutput: 'Valid report based on code analysis.',
    agent: exampleAgent,
});

// Define team
const qaTeam = new Team({
    name: 'Example QA Team',
    agents: [exampleAgent],
    tasks: [exampleTask],
    inputs: {
        Code: 'Example code here',
        Context: 'Review compliance of tasks and teams.',
    },
});

qaTeam.start();

Steps to Reproduce

  1. Create a Task with a description that includes example code wrapped in a template literal.
  2. Add JavaScript code examples inside the description, formatted with backticks for clarity.
  3. Execute the team using team.start().
  4. Observe the runtime error where the example code (e.g., complianceTeam) is executed instead of treated as plain text.

Current vs. Expected Behavior

  • Current Behavior: Code examples written inside description strings or template literals are interpreted and executed, causing errors like "X is not defined."
  • Expected Behavior: KaibanJS should treat code examples in strings or template literals as plain text and not attempt to execute them.

Environment

  • Framework/Library: Node.js + KaibanJS
  • KaibanJS Version: 0.1.0
  • JavaScript Runtime: Node.js 18.x
@dannleft dannleft added bug Something isn't working playground Pertains to the interactive examples or sandbox environments that allow for testing or playing with labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working playground Pertains to the interactive examples or sandbox environments that allow for testing or playing with
Projects
None yet
Development

No branches or pull requests

1 participant