-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/improve io docs #136
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
Feat/improve io docs #136
Conversation
Mesa DescriptionDescriptionPlease provide an explanation of the changes you've made: This PR improves the documentation for file I/O operations in Implementation Checklist
Testing
Docs
Visual ProofPlease provide a screenshot or video demonstrating that your changes work locally: [Drag and drop your screenshot/video here or use the following format:] Related IssueFixes [Github issue link] [If this corresponds to a fix from another Kernel OSS repo, include this:] Fixes [Link to other repo] [Replace with actual issue link, e.g., Fixes https://github.com/username/repo/issues/123] Additional Notes[Any additional context, concerns, or notes for reviewers] Description generated by Mesa. Update settings |
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.
Performed full review of 16ab9dc...07a6eed
Analysis
-
Resource leaks - The upload examples contain commented-out cleanup code (browser deletion) that would cause resource leaks if users copy the code as-is without proper cleanup.
-
Inconsistent standards - There are inconsistencies in markdown formatting (4 vs 3 backticks) and timeout configurations (6s vs 10s) across examples that may cause rendering issues or confusion.
-
Missing error handling - The examples lack robust error handling mechanisms, particularly for network failures when fetching remote resources, which could lead to unreliable code in production.
-
Cleanup code patterns - There's an opportunity to establish a consistent pattern for all examples where cleanup code is always included and active, with explanatory comments about its importance.
Tip
Help
Slash Commands:
/review- Request a full code review/review latest- Review only changes since the last review/describe- Generate PR description. This will update the PR body or issue comment depending on your configuration/help- Get help with Mesa commands and configuration options
1 files reviewed | 0 comments | Edit Agent Settings • Read Docs
browsers/file-io.mdx
Outdated
| asyncio.run(main()) | ||
| ```` | ||
| ```typescript Stagehand v3 |
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.
Can we move Stagehand v3 out of this section? My thought:
Outer section for Downloads
Sub-section for Playwright
Sub-section for Stagehand v3
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.
See here for inspiration of what I am looking for: https://tbd-6fc993ce-feat-improve-io-docs.mintlify.app/integrations/laminar#browser-agent-framework-examples
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.
For Stagehand v3 section I would def mention the two necessary added params you have to add to your Stagehand config:
downloadsPath: DOWNLOAD_DIR,
acceptDownloads: true,
dprevoznik
left a comment
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.
Made some requested changes!
browsers/file-io.mdx
Outdated
| asyncio.run(main()) | ||
| ```` | ||
| ```typescript Stagehand v3 |
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.
See here for inspiration of what I am looking for: https://tbd-6fc993ce-feat-improve-io-docs.mintlify.app/integrations/laminar#browser-agent-framework-examples
browsers/file-io.mdx
Outdated
| console.log("Download triggered"); | ||
|
|
||
| // Wait a bit for the download to complete | ||
| await new Promise((r) => setTimeout(r, 6000)); |
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.
I don't believe you need this since we have the waitFor function
browsers/file-io.mdx
Outdated
| // List files in the download directory to see what was downloaded | ||
| console.log("Checking download directory..."); | ||
| const files = await kernel.browsers.fs.listFiles(kernelBrowser.session_id, { | ||
| path: DOWNLOAD_DIR, | ||
| }); | ||
|
|
||
| if (files.length === 0) { | ||
| console.log("No files found in download directory"); | ||
| } else { |
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.
I don't believe we need to try listing the files first. Since we use waitFor, I believe this is redundant
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.
Actually up to line 307
browsers/file-io.mdx
Outdated
| # await browser.close() | ||
| # kernel.browsers.delete_by_id(kernel_browser.session_id) |
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.
You can uncomment this browser deletion there.
browsers/file-io.mdx
Outdated
| asyncio.run(main()) | ||
| ```` | ||
| ```typescript Stagehand v3 |
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.
For Stagehand v3 section I would def mention the two necessary added params you have to add to your Stagehand config:
downloadsPath: DOWNLOAD_DIR,
acceptDownloads: true,
browsers/file-io.mdx
Outdated
| console.log("Download triggered"); | ||
|
|
||
| const downloadedFile = files[0]; | ||
| console.log(`File found: ${downloadedFile.name}`); | ||
|
|
||
| // Wait for the file to be fully available via Kernel's File I/O APIs | ||
| console.log(`Waiting for file: ${downloadedFile.name}`); |
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.
I think there may be some code missing here about the downloadedFile?
Moved beginning playwright note to info section
removed duplicate language from playwright section
Update formatting + remove config addition step in code snippet for stagehand v3
- Moved playwright specific callout to the end of the code snippets in Playwright section - Added formatting changes for typescript code snippets
dprevoznik
left a comment
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.
LGTM!
Description
Please provide an explanation of the changes you've made:
[Describe what this PR does and why]
Implementation Checklist
Testing
mintlify devworks (see installation here)Docs
Visual Proof
Please provide a screenshot or video demonstrating that your changes work locally:
[Drag and drop your screenshot/video here or use the following format:]
]
[
Related Issue
Fixes [Github issue link]
[If this corresponds to a fix from another Kernel OSS repo, include this:]
Fixes [Link to other repo]
[Replace with actual issue link, e.g., Fixes https://github.com/username/repo/issues/123]
Additional Notes
[Any additional context, concerns, or notes for reviewers]