Skip to content

Conversation

@tsmithsz
Copy link
Contributor

@tsmithsz tsmithsz commented Mar 21, 2025

Problem

Amazon Q Agentic Chat needs the ability to read files and directories from the user's workspace to provide context-aware assistance. Currently, there's no tool available for Amazon Q to access the file system in a controlled and secure manner.

Solution

  • Implemented a new fsRead tool that allows Amazon Q to:
  • Read entire files or specific line ranges
  • List directory contents with configurable depth
  • Handle error cases gracefully with informative messages
  • Enforce size limits (30KB) to prevent excessive memory usage

Testing

FsRead Unit Tests
extensionHostProcess.js:178
    ✔ reads entire file
extensionHostProcess.js:178
    ✔ reads partial lines of a file
extensionHostProcess.js:178
    ✔ lists directory contents up to depth = 1
extensionHostProcess.js:178
    ✔ throws error if path does not exist
extensionHostProcess.js:178
    ✔ throws error if content exceeds 30KB
extensionHostProcess.js:178
    ✔ invalid line range

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tsmithsz tsmithsz requested review from a team as code owners March 21, 2025 18:01
@github-actions
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch 2 times, most recently from 89dbbb4 to 1c46419 Compare March 21, 2025 20:21
@tsmithsz
Copy link
Contributor Author

/retrybuilds

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from 1c46419 to b883c67 Compare March 21, 2025 22:23
@tsmithsz
Copy link
Contributor Author

/retrybuilds

1 similar comment
@tsmithsz
Copy link
Contributor Author

/retrybuilds

@tsmithsz tsmithsz force-pushed the feature/agentic-chat branch from b883c67 to ebf65bf Compare March 24, 2025 18:04
@tsmithsz tsmithsz requested a review from jpinkney-aws March 24, 2025 18:11
@jpinkney-aws jpinkney-aws merged commit 5a51146 into aws:feature/agentic-chat Mar 24, 2025
17 checks passed
* @param maxDepth Maximum depth to descend (0 => just this folder)
* @param customFormatCallback Optional. If given, it will override the default line-formatting
*/
export async function readDirectoryRecursively(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should live in fs.ts. Not related to "workspaces".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants