Expand description
AST host capability.
Wraps tree-sitter parsing, symbol extraction, and outline generation. The implementation is fully wired so AST builtins share one canonical wire format.
§Wire format
- Row/column coordinates are 0-based across all three builtins,
matching tree-sitter’s native
Pointrepresentation.parse_file,symbols, andoutlineshare one convention. parse_fileemits a flat node list withparent_idrather than nested children — keeps the wire JSON-serializable without inflating it with object copies.symbolsandoutlinecarry asignaturestring (e.g."fn foo(bar: i32)") on every entry.
§Languages
language::Language covers the general-purpose languages
(Harn, TypeScript/TSX, JavaScript/JSX, Python, Go, Rust, Java, C, C++,
C#, Ruby, Kotlin, PHP, Scala, Bash, Swift, Zig, Elixir, Lua, Haskell, R)
plus data/markup/config grammars (JSON, YAML, TOML, CSS, HTML, SQL,
Markdown). The latter support the query-driven edit primitives but
carry no symbol-graph projection — see
language::Language::edit_capabilities for the per-language matrix.
Adding/dropping languages requires coordinated schema, fixture, and
host-bridge updates.
Modules§
- api
- Programmatic entry point to the AST builtins. Embedders typically go through the registered builtins, but tests and tools that want strongly-typed access can use these helpers directly.
Structs§
- AstCapability
- AST capability handle. Stateless; tree-sitter parsers are constructed per-call (cheap relative to grammar lookup) so the capability itself has nothing to own.
- AstCapability
With Code Index - AST capability registered with access to the shared code-index state.
- Edit
Capabilities - Which AST-precise edit primitives are available for a language.
- Outline
Item - One node in a hierarchical outline. The
childrenlist nests in document order; see [crate::ast::outline] for the fold algorithm. - Parse
Error - One ERROR / MISSING node from a tree-sitter parse. All row/column coordinates are 0-based, matching tree-sitter’s native Point.
- Parsed
Node - One tree-sitter node, flattened for
parse_file’s wire format. Matchesschemas/ast/parse_file.response.json#/$defs/Node. - Symbol
- A flat symbol record. All row/col coordinates are 0-based, matching tree-sitter native positions.
- Undefined
Name - Reference to an identifier that wasn’t defined within the current
file. Coordinates are 0-based.
kindis"identifier"for value-side references and"type"for type-only references (TypeScript only).
Enums§
- Language
- Languages with tree-sitter grammar support.
- Symbol
Kind - Symbol kind. The wire form is the lowercase string returned by
SymbolKind::as_str.
Constants§
- TEXT_
PATCH_ FALLBACK - The text-level fallback the agent loop should reach for when an
AST-precise edit is unavailable for a file. Surfaced verbatim as the
fallback_suggestionfield on everyunsupported_*edit response so the loop can degrade gracefully without per-call branching.