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
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
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.