codenib.integrations.locagent
¶
LocAgent/OpenHands-compatible tools over CodeNib repository views.
Classes:
| Name | Description |
|---|---|
LocAgentToolProvider |
Serve LocAgent's three repository tools from one |
Functions:
| Name | Description |
|---|---|
get_locagent_tool_schemas |
Return dependency-free OpenAI schemas for the pinned LocAgent tools. |
bind_locagent_tools |
Return the three functions expected by an OpenHands runtime plugin. |
dispatch_locagent_tool_call |
Dispatch a pinned LocAgent/OpenHands tool call without code evaluation. |
LocAgentToolProvider
¶
LocAgentToolProvider(
context: Any,
*,
max_results: int = 5,
context_lines: int = 20,
max_source_lines: int = 220,
max_output_chars: int = 48000,
traversal_max_nodes: int = 80
)
Serve LocAgent's three repository tools from one ServerContext.
Methods:
| Name | Description |
|---|---|
bindings |
Return functions suitable for an OpenHands-style runtime export. |
dispatch |
Execute a function call directly, without IPython string evaluation. |
search_code_snippets |
Search entities, indexed code, or 1-based lines. |
get_entity_contents |
Return deterministic source for exact or disambiguated entities. |
explore_tree_structure |
Traverse CodeNib graph facts under LocAgent relation names. |
explore_graph_structure |
Compatibility wrapper for LocAgent's non-function-calling path. |
Source code in codenib/integrations/locagent.py
bindings
¶
Return functions suitable for an OpenHands-style runtime export.
Source code in codenib/integrations/locagent.py
dispatch
¶
Execute a function call directly, without IPython string evaluation.
Source code in codenib/integrations/locagent.py
search_code_snippets
¶
search_code_snippets(
search_terms: Sequence[str] | None = None,
line_nums: Sequence[int] | int | None = None,
file_path_or_pattern: str | None = "**/*.py",
) -> str
Search entities, indexed code, or 1-based lines.
Source code in codenib/integrations/locagent.py
get_entity_contents
¶
Return deterministic source for exact or disambiguated entities.
Source code in codenib/integrations/locagent.py
explore_tree_structure
¶
explore_tree_structure(
start_entities: Sequence[str],
direction: str = "downstream",
traversal_depth: int = 2,
entity_type_filter: Sequence[str] | None = None,
dependency_type_filter: Sequence[str] | None = None,
) -> str
Traverse CodeNib graph facts under LocAgent relation names.
Source code in codenib/integrations/locagent.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
explore_graph_structure
¶
explore_graph_structure(
start_entities: Sequence[str],
direction: str = "downstream",
traversal_depth: int = 1,
entity_type_filter: Sequence[str] | None = None,
dependency_type_filter: Sequence[str] | None = None,
) -> str
Compatibility wrapper for LocAgent's non-function-calling path.
Source code in codenib/integrations/locagent.py
get_locagent_tool_schemas
¶
Return dependency-free OpenAI schemas for the pinned LocAgent tools.
bind_locagent_tools
¶
bind_locagent_tools(provider: LocAgentToolProvider) -> dict[str, Callable[..., str]]
Return the three functions expected by an OpenHands runtime plugin.
dispatch_locagent_tool_call
¶
dispatch_locagent_tool_call(
provider: LocAgentToolProvider,
name: str,
arguments: Mapping[str, Any] | str | None = None,
) -> str
Dispatch a pinned LocAgent/OpenHands tool call without code evaluation.