AI-Engineer-Foundation / agent-protocol

Common interface for interacting with AI agents. The protocol is tech stack agnostic - you can use it with any framework for building agents.
https://agentprotocol.ai
MIT License
999 stars 120 forks source link

update use of nullish coalescing in agent.ts #90

Closed vinuch closed 10 months ago

vinuch commented 11 months ago

Pull Request

Description

Issue: This pull request contains a fix for JS SDK - Bug: build error for more details reference this issue #87

Reason: The issue in the code was related to the misuse of the nullish coalescing operator (??). The nullish coalescing operator is designed to provide a default value only when the left operand is null or undefined. In this case, the code task.artifacts != null ?? [] inadvertently used the nullish coalescing operator with a non-null value (task.artifacts != null), leading to a boolean result (true or false) instead of an array.

Changes: updated the code to use the nullish coalescing operator (??) correctly, providing a default value of an empty array when task.artifacts is null or undefined

Checklist

Please review and check the following items to ensure your pull request can be processed smoothly:

References, Fixes and Closes

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **agentprotocolai** | ⬜️ Ignored ([Inspect](https://vercel.com/ai-engineers-foundation/agentprotocolai/B8kfdqtnaSfWw5BX7xScGdXg98i8)) | [Visit Preview](https://agentprotocolai-git-fork-vinuch-main-ai-engineers-foundation.vercel.app) | | Dec 23, 2023 7:59am |
hackgoofer commented 10 months ago

Hi, favoring a similar PR: https://github.com/AI-Engineer-Foundation/agent-protocol/pull/88 because it also introduces cleanup for the build/publish flow.

Thank you for submitting your first PR. Hoping to see more of your work! <3