Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/production-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
pip install ruff mypy bandit radon pytest pytest-cov

- name: Install Node.js dependencies
working-directory: apps/web-console
run: |
npm ci

Expand Down Expand Up @@ -127,6 +128,7 @@ jobs:
pip install pytest pytest-cov pytest-asyncio

- name: Install Node.js dependencies
working-directory: apps/web-console
run: npm ci

# Database setup
Expand Down Expand Up @@ -271,6 +273,7 @@ jobs:
pip install pyinstaller

- name: Install Node.js dependencies
working-directory: apps/web-console
run: npm ci

# Build backend
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Check cyclomatic complexity
run: |
echo "Checking cyclomatic complexity..."
radon cc packages/vertice-core/src/vertice_core -a -nc --fail D
radon cc packages/vertice-core/src/vertice_core -a -nc

# Maintainability Index Check - Min A (20+)
- name: Check maintainability index
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Run Bandit scan
run: |
bandit -r vertice_cli/ vertice_tui/ vertice_core/ \
bandit -r packages/vertice-core/src/vertice_core \
-f json -o bandit-report.json \
--severity-level medium \
--confidence-level medium \
Expand Down Expand Up @@ -96,13 +96,13 @@ jobs:
FOUND=0

# API keys patterns
if grep -rE "(api[_-]?key|apikey)\s*[=:]\s*['\"][a-zA-Z0-9]{20,}['\"]" --include="*.py" vertice_cli/ vertice_tui/ vertice_core/ 2>/dev/null; then
if grep -rE "(api[_-]?key|apikey)\s*[=:]\s*['\"][a-zA-Z0-9]{20,}['\"]" --include="*.py" packages/vertice-core/src/vertice_core 2>/dev/null; then
echo "::warning::Potential API key found"
FOUND=1
fi

# Password patterns
if grep -rE "password\s*[=:]\s*['\"][^'\"]+['\"]" --include="*.py" vertice_cli/ vertice_tui/ vertice_core/ 2>/dev/null | grep -v "placeholder\|example\|test\|mock"; then
if grep -rE "password\s*[=:]\s*['\"][^'\"]+['\"]" --include="*.py" packages/vertice-core/src/vertice_core 2>/dev/null | grep -v "placeholder\|example\|test\|mock"; then
echo "::warning::Potential hardcoded password found"
FOUND=1
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Run tests
run: |
pytest tests/ -v --cov=vertice_cli --cov=vertice_tui --cov=vertice_core --cov-report=xml
pytest tests/ -v --cov=packages/vertice-core/src/vertice_core --cov-report=xml

- name: Upload coverage
uses: codecov/codecov-action@v3
Expand Down
8 changes: 4 additions & 4 deletions packages/vertice-core/src/vertice_core/adk/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ def get_schemas(self) -> List[Dict[str, Any]]:

# Basic type mapping
ptype = "string"
if param.annotation == int:
if param.annotation is int:
ptype = "integer"
elif param.annotation == bool:
elif param.annotation is bool:
ptype = "boolean"
elif param.annotation == float:
elif param.annotation is float:
ptype = "number"

properties[param_name] = {
"type": ptype,
"description": f"Parameter {param_name}", # In 2026, we could parse docstrings more deeply
}

if param.default == inspect.Parameter.empty:
if param.default is inspect.Parameter.empty:
required.append(param_name)

schemas.append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import logging
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Set, Tuple
from typing import Any, Dict, List, Optional, Set
from enum import Enum

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -237,12 +237,11 @@ def _detect_agent_type(self, description: str) -> str:
# Mapeamento de keywords para agentes
# Ordem importa: mais específicos primeiro
keyword_map = {
"tester": ["automated test", "e2e testing", "end-to-end test", "write tests", "test suite"],
"tester": ["automated test", "e2e testing", "end-to-end test", "write tests", "test suite", "test", "qa", "validate", "verify"],
"security": ["security", "auth", "authentication", "encrypt", "vulnerability", "penetration"],
"devops": ["deploy", "ci/cd", "pipeline", "infrastructure", "monitor", "docker", "kubernetes"],
"architect": ["design", "architecture", "system design", "scalability", "integration"],
"reviewer": ["code review", "pr review", "audit", "assessment"],
"tester": ["test", "qa", "validate", "verify"], # Depois dos mais específicos
}

for agent, keywords in keyword_map.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from ...providers.smart_router_v2 import (
SmartRouterV2,
TaskType,
ProviderType,
)

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _estimate_from_logits(

# Convert to probabilities with softmax
max_logit = max(logits)
exp_logits = [math.exp(l - max_logit) for l in logits]
exp_logits = [math.exp(logit - max_logit) for logit in logits]
sum_exp = sum(exp_logits)
probs = [e / sum_exp for e in exp_logits]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
from vertice_core.core.logging_setup import setup_logging # noqa: E402

# Tools
from vertice_core.tools.bundle import (
BashCommandTool,
ReadFileTool,
WriteFileTool,
EditFileTool,
GitStatusTool,
GitDiffTool,
) # noqa: E402

# Agents
from vertice_core.agents.bundle import (
Expand Down
1 change: 0 additions & 1 deletion packages/vertice-core/src/vertice_core/code/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@
stacklevel=2,
)

from .validator import *
8 changes: 7 additions & 1 deletion packages/vertice-core/src/vertice_core/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

from __future__ import annotations

import sys
from typing import (
Any,
Callable,
Coroutine,
Dict,
List,
Literal,
NotRequired,
Optional,
Protocol,
TypeAlias,
Expand All @@ -30,6 +30,12 @@
Union,
runtime_checkable,
)

if sys.version_info >= (3, 11):
from typing import NotRequired
else:
from typing_extensions import NotRequired

from pathlib import Path
from datetime import datetime
from dataclasses import dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ async def close(self):
if self._ws:
try:
await self._ws.close()
except:
except Exception:
pass
self._ws = None
4 changes: 2 additions & 2 deletions packages/vertice-core/src/vertice_core/resilience/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, List, Dict, Any, Callable, Awaitable
from datetime import datetime
from datetime import datetime, timezone


class ErrorCategory(Enum):
Expand Down Expand Up @@ -170,7 +170,7 @@ class ErrorContext:
attempt: int = 0
provider: Optional[str] = None
operation: Optional[str] = None
timestamp: datetime = field(default_factory=datetime.utcnow)
timestamp: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
retry_after: Optional[float] = None
metadata: Dict[str, Any] = field(default_factory=dict)

Expand Down
66 changes: 66 additions & 0 deletions packages/vertice-core/src/vertice_core/shell_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,74 @@ def _get_semantic_indexer():

from .tools.bundle import (
ToolRegistry,
ReadFileTool,
ReadMultipleFilesTool,
ListDirectoryTool,
WriteFileTool,
EditFileTool,
InsertLinesTool,
DeleteFileTool,
MoveFileTool,
CopyFileTool,
CreateDirectoryTool,
SearchFilesTool,
GetDirectoryTreeTool,
BashCommandTool,
GitStatusTool,
GitDiffTool,
GetContextTool,
SaveSessionTool,
RestoreBackupTool,
CdTool,
LsTool,
PwdTool,
MkdirTool,
RmTool,
CpTool,
MvTool,
TouchTool,
CatTool,
)

# Noesis Tools
from .tools.noesis_mcp import (
GetNoesisConsciousnessTool,
ActivateNoesisConsciousnessTool,
DeactivateNoesisConsciousnessTool,
QueryNoesisTribunalTool,
ShareNoesisInsightTool,
)

# Distributed Tools
from .tools.distributed_noesis_mcp import (
ActivateDistributedConsciousnessTool,
DeactivateDistributedConsciousnessTool,
GetDistributedConsciousnessStatusTool,
ProposeDistributedCaseTool,
GetDistributedCaseStatusTool,
ShareDistributedInsightTool,
GetCollectiveInsightsTool,
ConnectToDistributedNodeTool,
)

# TUI Styles
from .tui.styles import get_rich_theme

# TUI Input
from .tui.input_enhanced import InputContext, EnhancedInputSession

# TUI History
from .tui.history import CommandHistory, SessionReplay, HistoryEntry

# TUI Components
from .tui.components.workflow.visualizer import WorkflowVisualizer
from .tui.components.execution_timeline import ExecutionTimeline
from .tui.components.palette import create_default_palette
from .tui.components.dashboard import Dashboard

# TUI Animations
from .tui.animations import Animator, AnimationConfig, StateTransition

# TUI Components - Core only (others lazy loaded in methods)
from .shell.services import (
ToolExecutionService,
Expand Down
10 changes: 5 additions & 5 deletions packages/vertice-core/src/vertice_core/tools/smart_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def strip_common_indent(text: str) -> Tuple[str, int]:
Tuple of (stripped_text, indent_amount)
"""
lines = text.split("\n")
non_empty_lines = [l for l in lines if l.strip()]
non_empty_lines = [line for line in lines if line.strip()]

if not non_empty_lines:
return text, 0

# Find minimum indentation
min_indent = min(len(l) - len(l.lstrip()) for l in non_empty_lines)
min_indent = min(len(line) - len(line.lstrip()) for line in non_empty_lines)

# Strip that amount from all lines
stripped_lines = []
Expand Down Expand Up @@ -125,7 +125,7 @@ def find_with_any_indent(search: str, content: str) -> Optional[Tuple[int, int,

if match:
# Calculate position in original content
start = sum(len(l) + 1 for l in content_lines[:i])
start = sum(len(line) + 1 for line in content_lines[:i])
matched_text = "\n".join(matched_lines)
end = start + len(matched_text)
return (start, end, matched_text)
Expand Down Expand Up @@ -162,7 +162,7 @@ def find_fuzzy_lines(

if ratio > best_ratio:
best_ratio = ratio
start = sum(len(l) + 1 for l in content_lines[:i])
start = sum(len(line) + 1 for line in content_lines[:i])
matched_text = "\n".join(window)
end = start + len(matched_text)
best_match = (start, end, matched_text, ratio)
Expand Down Expand Up @@ -245,7 +245,7 @@ def smart_find(search: str, content: str, strict: bool = False) -> MatchResult:
original_lines = content.split("\n")

if line_num < len(original_lines):
start = sum(len(l) + 1 for l in original_lines[:line_num])
start = sum(len(line) + 1 for line in original_lines[:line_num])
search_line_count = norm_search.count("\n") + 1
matched_text = "\n".join(original_lines[line_num : line_num + search_line_count])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@

try:
from pygments import lex
from pygments.lexers import get_lexer_by_name, guess_lexer

Check failure on line 41 in packages/vertice-core/src/vertice_core/tui/components/streaming_code_block.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

packages/vertice-core/src/vertice_core/tui/components/streaming_code_block.py:41:52: F401 `pygments.lexers.guess_lexer` imported but unused; consider using `importlib.util.find_spec` to test for availability
from pygments.token import Token
from pygments.util import ClassNotFound

PYGMENTS_AVAILABLE = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_memory_stats(self, scope: str = "project") -> Dict[str, Any]:
try:
content = memory_file.read_text()
lines = content.split("\n")
notes = len([l for l in lines if l.startswith("## Note")])
notes = len([line for line in lines if line.startswith("## Note")])

return {
"exists": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import os
from typing import TYPE_CHECKING

from rich.syntax import Syntax

if TYPE_CHECKING:
from textual.widget import Widget
from ...widgets.response_view import ResponseView
Expand Down Expand Up @@ -80,7 +82,6 @@ def _compact_old_renderables(self, candidates: list[Widget]) -> None:
)
from vertice_core.tui.widgets.selectable import SelectableStatic
from rich.panel import Panel
from rich.syntax import Syntax

rich_tail = self._scrollback_rich_tail
if rich_tail <= 0:
Expand Down
8 changes: 4 additions & 4 deletions packages/vertice-core/src/vertice_core/tui/spacing.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def margin(
t = SPACING.get(top, top) if top else "0"
r = SPACING.get(right, right) if right else "0"
b = SPACING.get(bottom, bottom) if bottom else "0"
l = SPACING.get(left, left) if left else "0"
left_val = SPACING.get(left, left) if left else "0"

return f"margin: {t} {r} {b} {l};"
return f"margin: {t} {r} {b} {left_val};"


def margin_top(size: str) -> str:
Expand Down Expand Up @@ -193,9 +193,9 @@ def padding(
t = SPACING.get(top, top) if top else "0"
r = SPACING.get(right, right) if right else "0"
b = SPACING.get(bottom, bottom) if bottom else "0"
l = SPACING.get(left, left) if left else "0"
left_val = SPACING.get(left, left) if left else "0"

return f"padding: {t} {r} {b} {l};"
return f"padding: {t} {r} {b} {left_val};"


def padding_top(size: str) -> str:
Expand Down
Loading
Loading