Skip to content

Latest commit

 

History

History
88 lines (72 loc) · 3.97 KB

File metadata and controls

88 lines (72 loc) · 3.97 KB

Architecture

ManagedCode.FileContext is a narrow adapter between ManagedCode.Storage and Microsoft Agent Framework. It keeps storage-provider choice outside the package while adding agent-ready file and Markdown graph context.

System map

flowchart LR
  Agent["Microsoft Agent Framework agent"]
  Provider["FileContextProvider"]
  BuiltIn["FileAccessProvider"]
  Extended["FileContext tools"]
  Adapter["ManagedCodeStorageFileStore"]
  Service["FileContextService"]
  Storage(("IStorage"))
  Markdown["ManagedCode.MarkdownLd.Kb"]

  Agent --> Provider
  Provider --> BuiltIn
  Provider --> Extended
  BuiltIn --> Adapter
  Extended --> Service
  Service --> Adapter
  Adapter --> Storage
  Service --> Storage
  Service --> Markdown
Loading

Invocation flow

sequenceDiagram
  participant Caller
  participant Agent
  participant Provider as FileContextProvider
  participant Tool as File tool
  participant Store as ManagedCodeStorageFileStore
  participant Storage as IStorage

  Caller->>Agent: Run with user request
  Agent->>Provider: InvokingAsync
  Provider-->>Agent: instructions plus standard and extended tools
  Agent->>Tool: selected tool call
  Tool->>Store: normalized relative path
  Store->>Storage: stream or metadata operation
  Storage-->>Store: provider-neutral result
  Store-->>Tool: bounded result
  Tool-->>Agent: observable content or metadata
  Agent-->>Caller: final response
Loading

Modules and contracts

  • ManagedCodeStorageFileStore implements Microsoft AgentFileStore over IStorage. It owns path normalization, prefix isolation, direct-child projection, bounded full reads, and regex scanning.
  • FileContextProvider composes the Microsoft FileAccessProvider with package-owned read-range, metadata, and Markdown graph tools.
  • IFileContext is the direct application API for bounded range reads, metadata, graph search, and graph export.
  • FileContextService streams line windows and metadata, loads scoped Markdown through IStorage, builds a Markdown-LD knowledge graph, and maps results to package-owned records.
  • FileContextServiceCollectionExtensions is the composition root for default and keyed IStorage registrations.

Dependency rules

flowchart TD
  Product["ManagedCode.FileContext"] --> StorageCore["ManagedCode.Storage.Core"]
  Product --> AgentFramework["Microsoft.Agents.AI"]
  Product --> MarkdownLd["ManagedCode.MarkdownLd.Kb"]
  Product --> Extensions["Microsoft.Extensions.*"]
  Tests["ManagedCode.FileContext.Tests"] --> Product
  Tests --> FileSystem["ManagedCode.Storage.FileSystem"]
  Tests --> LlmTck["ManagedCode.LlmTck"]
Loading
  • Product code may depend on ManagedCode.Storage.Core but never a concrete provider.
  • Tests own concrete filesystem storage, LlmTck hosting, and OpenAI-compatible protocol dependencies.
  • Microsoft owns the standard file-access tool names and behavior. This package adapts storage and adds only complementary tools.
  • File contents remain untrusted data and are never elevated to system instructions.

Operational limits

All potentially large operations are controlled by FileContextOptions: full-read bytes, range bytes, files scanned, bytes per searched file, matches per file, total search results, graph documents, graph source bytes, and exported graph characters. Non-seekable cloud streams are supported by sequential streaming.

Start here