forked from riyavsinha/marimo-agents
-
Notifications
You must be signed in to change notification settings - Fork 0
[Snyk] Security upgrade ai from 4.3.19 to 5.0.0 #29
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
Open
arthrod
wants to merge
6
commits into
main
Choose a base branch
from
snyk-fix-f620782808c24e0ef3ea91bc0b867cbf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9ae0f4c
support agent cells, registering dfs to globals
riyavsinha 9123c59
Add AI Agent suggestions as background task, and suggestions panel fo…
riyavsinha c365ffe
Add suggestion from panel to notebook on click (#5)
riyavsinha 12a03db
Polish suggestions (#6)
riyavsinha b850bf2
Update README.md
riyavsinha 77a67a3
fix: frontend/package.json to reduce vulnerabilities
snyk-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Marimo LLM Agent Extension | ||
|
|
||
| This fork is a modified version of Marimo with support for executing LLM agents from cells. Some features may interfere with Marimo's original functionality, so use with caution. | ||
|
|
||
| ## Feature overview | ||
|
|
||
| ### Agent Registry | ||
|
|
||
| The agent registry is a new feature that allows users to register LLM agents (e.g. LangChain, LangGraph) with the Marimo UI. The cell input can be set as a plain-text input to the agent, with the cell output representing the agent's response. | ||
|
|
||
| Usage: | ||
|
|
||
|
|
||
| ### Background Datasource Variable Registration | ||
|
|
||
| > [!CAUTION] | ||
| > This function may cause unintended bugs in Marimo's reactivity, since | ||
| > defined variables cannot be statically analyzed. Also, this can be | ||
| > confusing for users if used inappropriately to flood the global scope. | ||
| > Please be mindful of this function. | ||
|
|
||
| This feature allows LLM agents designed to work with this version of Marimo | ||
| to emit variables to the global scope. This is useful for agents that | ||
| make tool calls and want to implicitly assign intermediate fetched data to | ||
| variables. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
frontend/src/components/editor/chrome/panels/suggestions-panel.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import React from "react"; | ||
| import { useAtomValue } from "jotai"; | ||
| import { | ||
| MessageCircleQuestionIcon, | ||
| MessageCircleWarningIcon, | ||
| LightbulbIcon, | ||
| } from "lucide-react"; | ||
| import { suggestionsAtom } from "@/core/suggestions/state"; | ||
| import { cn } from "@/utils/cn"; | ||
| import { PanelEmptyState } from "./empty-state"; | ||
| import { useCellActions } from "@/core/cells/cells"; | ||
| import { useLastFocusedCellId } from "@/core/cells/focus"; | ||
|
|
||
| export const SuggestionsPanel: React.FC = () => { | ||
| const suggestions = useAtomValue(suggestionsAtom); | ||
| const { createNewCell } = useCellActions(); | ||
| const lastFocusedCellId = useLastFocusedCellId(); | ||
|
|
||
| if (!suggestions.length) { | ||
| return ( | ||
| <PanelEmptyState | ||
| icon={<LightbulbIcon />} | ||
| title="No suggestions" | ||
| description="There are currently no suggestions available." | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| const handleSuggestionClick = (title: string) => { | ||
| createNewCell({ | ||
| code: `await mo.ai.agents.run_agent("${title}")`, | ||
| before: false, | ||
| cellId: lastFocusedCellId ?? "__end__", | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-3 p-4 overflow-y-auto"> | ||
| {suggestions.map((suggestion) => ( | ||
| <div | ||
| key={suggestion.id} | ||
| className={cn( | ||
| "rounded-lg border p-4 transition-colors cursor-pointer", | ||
| "hover:border-border-hover", | ||
| suggestion.type === "prompt_warning" && | ||
| "border-orange-500/50 bg-orange-500/10", | ||
| suggestion.type === "prompt_idea" && | ||
| "border-blue-500/50 bg-blue-500/10", | ||
| )} | ||
| onClick={() => handleSuggestionClick(suggestion.title)} | ||
| > | ||
| <div className="flex items-start gap-2"> | ||
| <div className="flex-shrink-0"> | ||
| {suggestion.type === "prompt_warning" ? ( | ||
| <MessageCircleWarningIcon className="h-6 w-6" /> | ||
| ) : ( | ||
| <MessageCircleQuestionIcon className="h-6 w-6" /> | ||
| )} | ||
| </div> | ||
| <div className="flex-1"> | ||
| <h3 className="font-medium">{suggestion.title}</h3> | ||
| <p className="mt-1 text-sm text-muted-foreground"> | ||
| {suggestion.description} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a major version upgrade for the
aipackage, from v4 to v5. Major versions often introduce breaking changes, and Snyk has flagged this as a breaking change.I was unable to find any public documentation, changelog, or migration guide for version
5.0.0of this package. The public npm registry for theaipackage (Vercel AI SDK) only lists versions up to3.x.The application uses the
useCompletionhook fromai/react. It's possible that the API of this hook has changed. For example, theexperimental_throttleoption might have been removed or renamed in this new major version.Given the lack of documentation and the high risk of breaking changes, I recommend thorough testing of all AI-related features before merging this PR. If you have access to a changelog or migration guide, please share it.