repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
QwenPaw
src/qwenpaw/app/approvals/service.py
.py
# -*- coding: utf-8 -*- """Approval service for sensitive tool execution. The ``ApprovalService`` is the single central store for pending / completed approval records. Approval is granted exclusively via the ``/daemon approve`` command in the chat interface. """ from __future__ import annotations import asyncio imp...
596
19,718
gpt-pilot
main.py
.py
#!/usr/bin/env python import os.path import sys try: from core.cli.main import run_pythagora except ImportError as err: pythagora_root = os.path.dirname(__file__) venv_path = os.path.join(pythagora_root, "venv") requirements_path = os.path.join(pythagora_root, "requirements.txt") if sys.prefix == s...
31
1,245
gpt-pilot
core/disk/vfs.py
.py
import os import os.path from hashlib import sha1 from pathlib import Path from core.disk.ignore import IgnoreMatcher from core.log import get_logger log = get_logger(__name__) class VirtualFileSystem: def save(self, path: str, content: str): """ Save content to a file. Use for both new and upda...
189
5,861
gpt-pilot
core/disk/ignore.py
.py
import os.path from fnmatch import fnmatch from typing import Optional class IgnoreMatcher: """ A class to match paths against a list of ignore patterns or file attributes (size, type). """ def __init__( self, root_path: str, ignore_paths: list[str], *, ign...
126
4,046
gpt-pilot
core/log/__init__.py
.py
import os from collections import deque from logging import FileHandler, Formatter, Logger, StreamHandler, getLogger from core.config import LogConfig from core.config.constants import LOGS_LINE_LIMIT class LineCountLimitedFileHandler(FileHandler): """ A file handler that limits the number of lines in the lo...
112
3,571
gpt-pilot
core/llm/convo.py
.py
from copy import deepcopy from typing import Any, Iterator, Optional class Convo: """ A conversation between a user and a Large Language Model (LLM) assistant. Holds messages and an optional metadata log (list of dicts with prompt information). """ ROLES = ["system", "user", "assistant", "fu...
171
5,376
gpt-pilot
core/llm/parser.py
.py
import json import re from enum import Enum from typing import List, Optional, Union from pydantic import BaseModel, ValidationError, create_model class CodeBlock(BaseModel): description: str content: str class ParsedBlocks(BaseModel): original_response: str blocks: List[CodeBlock] class Descript...
227
7,186
gpt-pilot
core/llm/azure_client.py
.py
from httpx import Timeout from openai import AsyncAzureOpenAI from core.config import LLMProvider from core.llm.openai_client import OpenAIClient from core.log import get_logger log = get_logger(__name__) class AzureClient(OpenAIClient): provider = LLMProvider.AZURE stream_options = None def _init_clie...
30
903
gpt-pilot
core/llm/request_log.py
.py
from datetime import datetime from enum import Enum from typing import Any from pydantic import BaseModel, Field from core.config import LLMProvider class LLMRequestStatus(str, Enum): SUCCESS = "success" ERROR = "error" class LLMRequestLog(BaseModel): provider: LLMProvider model: str temperatu...
31
755
gpt-pilot
core/llm/openai_client.py
.py
import datetime import re from typing import Optional import tiktoken from httpx import Timeout from openai import AsyncOpenAI, RateLimitError from core.config import LLMProvider from core.llm.base import BaseLLMClient from core.llm.convo import Convo from core.log import get_logger log = get_logger(__name__) tokeni...
121
4,187
gpt-pilot
core/llm/groq_client.py
.py
import datetime from typing import Optional import tiktoken from groq import AsyncGroq, RateLimitError from httpx import Timeout from core.config import LLMProvider from core.llm.base import BaseLLMClient from core.llm.convo import Convo from core.log import get_logger log = get_logger(__name__) tokenizer = tiktoken...
94
3,005
gpt-pilot
core/llm/relace_client.py
.py
from typing import Optional import httpx from httpx import AsyncClient from core.config import LLMProvider from core.llm.base import BaseLLMClient from core.llm.convo import Convo from core.log import get_logger log = get_logger(__name__) class RelaceClient(BaseLLMClient): provider = LLMProvider.RELACE de...
63
2,194
gpt-pilot
core/llm/prompt.py
.py
from os.path import isdir from typing import Any, Optional from jinja2 import BaseLoader, Environment, FileSystemLoader, StrictUndefined, TemplateNotFound class FormatTemplate: def __call__(self, template: str, **kwargs: dict[str, Any]) -> str: return template.format(**kwargs) class BaseJinjaTemplate: ...
49
1,525
gpt-pilot
core/llm/base.py
.py
import asyncio import datetime import json import sys from enum import Enum from time import time from typing import Any, Callable, Optional, Tuple import httpx import tiktoken from httpx import AsyncClient from core.config import LLMConfig, LLMProvider from core.llm.convo import Convo from core.llm.request_log impor...
460
20,115
gpt-pilot
core/llm/anthropic_client.py
.py
import asyncio import datetime import zoneinfo from typing import Optional, Tuple from anthropic import AsyncAnthropic, RateLimitError from httpx import Timeout from core.config import LLMProvider from core.llm.convo import Convo from core.log import get_logger from .base import BaseLLMClient log = get_logger(__nam...
155
5,649
gpt-pilot
core/proc/exec_log.py
.py
from datetime import datetime, timezone from typing import Optional from pydantic import BaseModel, Field class ExecLog(BaseModel): started_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)) duration: float = Field(description="The duration of the command/process run in seconds") cm...
22
1,109
gpt-pilot
core/proc/process_manager.py
.py
import asyncio import signal import sys import time from copy import deepcopy from dataclasses import dataclass from os import environ from os.path import abspath, join from typing import Callable, Optional from uuid import UUID, uuid4 import psutil from core.log import get_logger log = get_logger(__name__) NONBLOC...
280
9,329
gpt-pilot
core/state/state_manager.py
.py
import asyncio import os.path import re import traceback from contextlib import asynccontextmanager from typing import TYPE_CHECKING, Optional from urllib.parse import urljoin from uuid import UUID, uuid4 import httpx from sqlalchemy import Row, inspect, select from sqlalchemy.exc import PendingRollbackError from tena...
1,047
41,630
gpt-pilot
core/telemetry/__init__.py
.py
import sys import time import traceback from copy import deepcopy from os import getenv from pathlib import Path from typing import Any import httpx from core.config import get_config from core.config.user_settings import settings from core.config.version import get_version from core.log import get_logger log = get_...
401
13,438
gpt-pilot
core/config/__init__.py
.py
from enum import Enum from os.path import abspath, dirname, isdir, join from typing import Any, Literal, Optional, Union from pydantic import BaseModel, ConfigDict, Field, field_validator from typing_extensions import Annotated from core.config.constants import LOGS_LINE_LIMIT ROOT_DIR = abspath(join(dirname(__file_...
545
16,296
gpt-pilot
core/config/constants.py
.py
CONVO_ITERATIONS_LIMIT = 8 LOGS_LINE_LIMIT = 20000
3
51
gpt-pilot
core/config/version.py
.py
import re from os.path import abspath, basename, dirname, isdir, isfile, join from typing import Optional GIT_DIR_PATH = abspath(join(dirname(__file__), "..", "..", ".git")) def get_git_commit() -> Optional[str]: """ Return the current git commit (if running from a repo). :return: commit hash or None if...
111
2,771
gpt-pilot
core/config/magic_words.py
.py
PROBLEM_IDENTIFIED = "PROBLEM_IDENTIFIED" ADD_LOGS = "ADD_LOGS" ALWAYS_RELEVANT_FILES = [ "client/src/App.tsx", ] GITIGNORE_CONTENT = """# Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* node_modules dist dist-ssr *.local # Editor directories and files .vscode/* !.v...
38
499
gpt-pilot
core/config/env_importer.py
.py
from os.path import dirname, exists, join from dotenv import dotenv_values from core.config import Config, LLMProvider, ProviderConfig, loader def import_from_dotenv(new_config_path: str) -> bool: """ Import configuration from old gpt-pilot .env file and save it to a new format. If the configuration is...
92
3,033
gpt-pilot
core/config/user_settings.py
.py
import sys from os import getenv, makedirs from pathlib import Path from uuid import uuid4 from pydantic import BaseModel, Field, PrivateAttr from core.log import get_logger log = get_logger(__name__) SETTINGS_APP_NAME = "GPT Pilot" DEFAULT_TELEMETRY_ENDPOINT = "https://api.pythagora.io/telemetry" class Telemetr...
95
2,906
gpt-pilot
core/config/actions.py
.py
BH_START_BUG_HUNT = "Start bug hunt for task #{}" BH_WAIT_BUG_REP_INSTRUCTIONS = "Awaiting bug reproduction instructions for task #{}" BH_START_USER_TEST = "Start user testing for task #{}" BH_STARTING_PAIR_PROGRAMMING = "Start pair programming for task #{}" CM_UPDATE_FILES = "Updating files" DEV_WAIT_TEST = "Awaiti...
59
2,362
gpt-pilot
core/utils/text.py
.py
""" Text processing utility functions. """ def trim_logs(logs: str) -> str: """ Trim logs by removing everything after specific marker phrases. This function cuts off the string at the first occurrence of "Here are the backend logs" or "Here are the frontend logs". :param logs: Log text to trim ...
43
1,170
gpt-pilot
core/cli/main.py
.py
import asyncio import atexit import gc import signal import sys import traceback from argparse import Namespace from asyncio import run from core.config.actions import FE_ITERATION_DONE try: import sentry_sdk SENTRY_AVAILABLE = True except ImportError: SENTRY_AVAILABLE = False from core.agents.orchestra...
439
14,526
gpt-pilot
core/cli/helpers.py
.py
import json import os import os.path import sys from argparse import ArgumentParser, ArgumentTypeError, Namespace from difflib import unified_diff from typing import Optional from urllib.parse import urlparse from uuid import UUID from core.config import Config, LLMProvider, LocalIPCConfig, ProviderConfig, UIAdapter, ...
963
36,271
gpt-pilot
core/templates/vite_react.py
.py
from .base import BaseProjectTemplate, NoOptions class ViteReactProjectTemplate(BaseProjectTemplate): stack = "backend" name = "vite_react" path = "vite_react" description = "Vite + React + Tailwind CSS + TypeScript + Shadcn + Nodejs + Mongo" file_descriptions = { "client/components.json":...
124
16,617
gpt-pilot
core/templates/render.py
.py
from __future__ import annotations import os from os import walk from os.path import join, relpath from pathlib import Path from typing import Any, Callable from jinja2 import Environment, FileSystemLoader def escape_string(str: str) -> str: """ Escape special characters in a string :param str: The str...
136
5,115
gpt-pilot
core/templates/registry.py
.py
from enum import Enum from core.log import get_logger # from .javascript_react import JavascriptReactProjectTemplate # from .node_express_mongoose import NodeExpressMongooseProjectTemplate from .vite_react import ViteReactProjectTemplate from .vite_react_swagger import ViteReactSwaggerProjectTemplate # from .react_e...
31
1,103
gpt-pilot
core/templates/javascript_react.py
.py
from .base import BaseProjectTemplate, NoOptions class JavascriptReactProjectTemplate(BaseProjectTemplate): stack = "frontend" name = "javascript_react" path = "javascript_react" description = "React web app using Vite devserver/bundler" file_descriptions = { "vite.config.js": "Configurati...
36
2,564
gpt-pilot
core/templates/node_express_mongoose.py
.py
from .base import BaseProjectTemplate, NoOptions class NodeExpressMongooseProjectTemplate(BaseProjectTemplate): stack = "backend" name = "node_express_mongoose" path = "node_express_mongoose" description = "Node + Express + MongoDB web app with session-based authentication, EJS views and Bootstrap 5" ...
42
5,524
gpt-pilot
core/templates/vite_react_swagger.py
.py
from .base import BaseProjectTemplate, NoOptions class ViteReactSwaggerProjectTemplate(BaseProjectTemplate): stack = "backend" name = "vite_react_swagger" path = "vite_react_swagger" description = "Vite + React + Tailwind CSS + TypeScript + Shadcn" file_descriptions = { "client/components....
109
12,818
gpt-pilot
core/templates/react_express.py
.py
from enum import Enum from typing import Optional from pydantic import BaseModel, Field from core.log import get_logger from .base import BaseProjectTemplate log = get_logger(__name__) class DatabaseType(str, Enum): SQL = "sql" NOSQL = "nosql" NONE = "none" class TemplateOptions(BaseModel): db_t...
123
11,711
gpt-pilot
core/templates/base.py
.py
import asyncio from json import loads from os.path import dirname, join from typing import TYPE_CHECKING, Any, Optional, Type from uuid import uuid4 from pydantic import BaseModel from core.log import get_logger from core.templates.render import Renderer if TYPE_CHECKING: from core.proc.process_manager import Pr...
151
4,870
gpt-pilot
core/templates/example_project.py
.py
from core.db.models import Complexity EXAMPLE_PROJECT_DESCRIPTION = """ The application is a simple ToDo app built using React. Its primary function is to allow users to manage a list of tasks (todos). Each task has a description and a state (open or completed, with the default state being open). The application is fr...
84
5,631
gpt-pilot
core/templates/tree/add_raw_tags.py
.py
import os import sys def add_raw_tags_to_file(file_path): """Add {% raw %} at the beginning and {% endraw %} at the end of the file, if not already present.""" try: # Open the file and read the contents with open(file_path, "r", encoding="utf-8") as file: content = file.read() ...
57
1,846
gpt-pilot
core/db/setup.py
.py
from os.path import dirname, join from alembic import command from alembic.config import Config from core.config import DBConfig from core.log import get_logger log = get_logger(__name__) def _async_to_sync_db_scheme(url: str) -> str: """ Convert an async database URL to a synchronous one. This is nee...
50
1,399
gpt-pilot
core/db/session.py
.py
from sqlalchemy import event from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from core.config import DBConfig from core.log import get_logger log = get_logger(__name__) class SessionManager: """ Async-aware context manager for database session. Usage: >>> c...
77
2,694
gpt-pilot
core/db/v0importer.py
.py
from json import loads from os.path import exists from pathlib import Path from uuid import UUID, uuid4 import aiosqlite from core.db.models import Branch, Project, ProjectState from core.db.models.project_state import TaskStatus from core.db.session import SessionManager from core.disk.vfs import MemoryVFS from core...
275
10,476
gpt-pilot
core/db/fix_migrations.py
.py
#!/usr/bin/env python import os import sqlite3 from pathlib import Path from typing import Optional from alembic import command from alembic.config import Config from alembic.script import ScriptDirectory def get_latest_revision(alembic_cfg: Config) -> Optional[str]: """Get the most recent revision from availabl...
91
2,851
gpt-pilot
core/db/models/llm_request.py
.py
from datetime import datetime from typing import TYPE_CHECKING, Optional from uuid import UUID from sqlalchemy import ForeignKey, inspect from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.models import Base from ...
83
3,167
gpt-pilot
core/db/models/chat_convo.py
.py
from datetime import datetime from typing import TYPE_CHECKING, Optional from uuid import UUID, uuid4 from sqlalchemy import ForeignKey, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.models import Base...
49
1,863
gpt-pilot
core/db/models/specification.py
.py
from copy import deepcopy from typing import TYPE_CHECKING, Optional from sqlalchemy import delete, distinct, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from core.db.models import Base if TYPE_CHECKING: from core.db.models import ProjectS...
89
3,149
gpt-pilot
core/db/models/__init__.py
.py
# Pythagora database models # # Always import models from this module to ensure the SQLAlchemy registry # is correctly populated. from .base import Base from .branch import Branch from .chat_convo import ChatConvo from .chat_message import ChatMessage from .exec_log import ExecLog from .file import File from .file_con...
36
831
gpt-pilot
core/db/models/knowledge_base.py
.py
from copy import deepcopy from typing import TYPE_CHECKING from sqlalchemy import JSON, delete, distinct, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from core.db.models.base import Base if TYPE_CHECKING: from core.db.models import Project...
62
2,316
gpt-pilot
core/db/models/chat_message.py
.py
from datetime import datetime from typing import Optional from uuid import UUID, uuid4 from sqlalchemy import ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.models import Base, ChatConvo class ChatMessage(Base): __tablename__ = "chat_messag...
24
885
gpt-pilot
core/db/models/exec_log.py
.py
from datetime import datetime from typing import TYPE_CHECKING, Optional from uuid import UUID from sqlalchemy import ForeignKey, inspect from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.models import Base from core.proc.exec_log import ExecLog as ExecLogData...
73
2,673
gpt-pilot
core/db/models/project.py
.py
import re from datetime import datetime from typing import TYPE_CHECKING, Optional, Union from unicodedata import normalize from uuid import UUID, uuid4 from sqlalchemy import Row, and_, delete, inspect, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationsh...
178
6,339
gpt-pilot
core/db/models/project_state.py
.py
from copy import deepcopy from datetime import datetime from typing import TYPE_CHECKING, Optional, Union from uuid import UUID, uuid4 from sqlalchemy import ForeignKey, UniqueConstraint, and_, delete, inspect, or_, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, load_only, ma...
1,079
40,984
gpt-pilot
core/db/models/file.py
.py
import re from typing import TYPE_CHECKING, Optional from uuid import UUID from sqlalchemy import ForeignKey, UniqueConstraint, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from core.db.models import Base if TYPE_CHECKING: from core.db.mode...
86
3,135
gpt-pilot
core/db/models/branch.py
.py
from datetime import datetime from typing import TYPE_CHECKING, Optional, Union from uuid import UUID, uuid4 from sqlalchemy import ForeignKey, inspect, select from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.models import Base if TYPE_CHECKING: from sql...
90
3,339
gpt-pilot
core/db/models/user_input.py
.py
from datetime import datetime from typing import TYPE_CHECKING, Optional from uuid import UUID from sqlalchemy import ForeignKey, and_, delete, inspect, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.sql import func from core.db.mo...
82
3,084
gpt-pilot
core/db/models/base.py
.py
# DeclarativeBase enables declarative configuration of # database models within SQLAlchemy. # # It also sets up a registry for the classes that inherit from it, # so that SQLAlechemy understands how they map to database tables. from sqlalchemy import MetaData from sqlalchemy.ext.asyncio import AsyncAttrs from sqlalche...
37
1,201
gpt-pilot
core/db/models/file_content.py
.py
from typing import TYPE_CHECKING from sqlalchemy import delete, distinct, select from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.orm import Mapped, mapped_column, relationship from core.db.models import Base if TYPE_CHECKING: from core.db.models import File class FileContent(Base): __tablen...
63
2,072
gpt-pilot
core/ui/ipc_client.py
.py
import asyncio import json from enum import Enum from typing import Optional, Union from pydantic import BaseModel, ValidationError from core.config import LocalIPCConfig from core.log import get_logger from core.ui.base import UIBase, UIClosedError, UISource, UserInput, UserInterruptError VSCODE_EXTENSION_HOST = "l...
691
21,703
gpt-pilot
core/ui/console.py
.py
from typing import Optional from prompt_toolkit.shortcuts import PromptSession from core.log import get_logger from core.ui.base import UIBase, UIClosedError, UISource, UserInput, UserInterruptError log = get_logger(__name__) class PlainConsoleUI(UIBase): """ UI adapter for plain (no color) console output....
273
7,105
gpt-pilot
core/ui/api_server.py
.py
import asyncio import uuid from typing import Awaitable, Callable, Dict, Optional from uuid import uuid4 from pydantic import ValidationError from sqlalchemy import select from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.cli.helpers import ( calculate_pr_changes, chang...
776
32,959
gpt-pilot
core/ui/base.py
.py
from enum import Enum from typing import Optional from pydantic import BaseModel class ProjectStage(str, Enum): PROJECT_NAME = "project_name" PROJECT_DESCRIPTION = "project_description" SPECS_STARTED = "specs_started" SPECS_FINISHED = "specs_finished" FRONTEND_STARTED = "frontend_started" FRO...
581
17,084
gpt-pilot
core/ui/virtual.py
.py
from typing import Optional from core.log import get_logger from core.ui.base import UIBase, UISource, UserInput log = get_logger(__name__) class VirtualUI(UIBase): """ Testing UI adapter. """ def __init__(self, inputs: list[dict[str, str]]): self.virtual_inputs = [UserInput(**input) for in...
254
6,155
gpt-pilot
core/agents/convo.py
.py
import json import sys from copy import deepcopy from typing import TYPE_CHECKING, Optional import jsonref from pydantic import BaseModel from core.config import get_config from core.llm.convo import Convo from core.llm.prompt import JinjaFileTemplate from core.log import get_logger if TYPE_CHECKING: from core.a...
136
4,646
gpt-pilot
core/agents/external_docs.py
.py
import asyncio from urllib.parse import urljoin import httpx from pydantic import BaseModel from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.config import EXTERNAL_DOCUMENTATION_API from core.llm.parser import JSONParser from core...
174
6,733
gpt-pilot
core/agents/code_monkey.py
.py
import asyncio import re from enum import Enum from typing import Optional from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.mixins import FileDiffMixin from core.agents.response import AgentResponse, ResponseType from core.config im...
233
9,030
gpt-pilot
core/agents/problem_solver.py
.py
from typing import Optional from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.agents.troubleshooter import IterationPromptMixin from core.db.models.project_state import IterationStatus from cor...
130
5,357
gpt-pilot
core/agents/developer.py
.py
import json from enum import Enum from typing import Annotated, Literal, Union from uuid import UUID, uuid4 from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.mixins import ChatWithBreakdownMixin, RelevantFilesMixin from core.agents.r...
485
20,028
gpt-pilot
core/agents/frontend.py
.py
import asyncio import json import os import sys from urllib.parse import urljoin import httpx from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.git import GitMixin from core.agents.mixins import FileDiffMixin from core.agents.response import AgentResponse from core.cli.h...
603
27,297
gpt-pilot
core/agents/legacy_handler.py
.py
from core.agents.base import BaseAgent from core.agents.response import AgentResponse class LegacyHandler(BaseAgent): agent_type = "legacy-handler" display_name = "Legacy Handler" async def run(self) -> AgentResponse: if self.data["type"] == "review_task": self.next_state.complete_ste...
15
476
gpt-pilot
core/agents/spec_writer.py
.py
import secrets from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse, ResponseType from core.config import DEFAULT_AGENT_NAME, SPEC_WRITER_AGENT_NAME from core.config.actions import SPEC_CHANGE_FEATURE_STEP_NAME, SPEC_CHANGE_STEP_NAME, SPEC_CREAT...
357
15,309
gpt-pilot
core/agents/human_input.py
.py
from core.agents.base import BaseAgent from core.agents.response import AgentResponse, ResponseType from core.config.actions import CONTINUE_WHEN_DONE, HUMAN_INTERVENTION_QUESTION class HumanInput(BaseAgent): agent_type = "human-input" display_name = "Human Input" async def run(self) -> AgentResponse: ...
42
1,738
gpt-pilot
core/agents/executor.py
.py
from datetime import datetime, timezone from typing import Optional from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.config.actions import EX_RUN_COMMAND, EX_SKIP_COMMAND, RUN_COMMAND from cor...
182
6,225
gpt-pilot
core/agents/task_completer.py
.py
from core.agents.base import BaseAgent from core.agents.git import GitMixin from core.agents.response import AgentResponse from core.config.actions import TC_TASK_DONE from core.log import get_logger from core.telemetry import telemetry log = get_logger(__name__) class TaskCompleter(BaseAgent, GitMixin): agent_t...
59
2,224
gpt-pilot
core/agents/tech_writer.py
.py
from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.config.actions import TW_WRITE from core.db.models.project_state import TaskStatus from core.log import get_logger from core.ui.base import success_source log = get_logger(__name__) ...
60
2,435
gpt-pilot
core/agents/git.py
.py
import os from typing import Optional from core.agents.convo import AgentConvo from core.config.magic_words import GITIGNORE_CONTENT from core.ui.base import pythagora_source class GitMixin: """ Mixin class for git commands """ async def check_git_installed(self) -> bool: """Check if git is ...
168
6,280
gpt-pilot
core/agents/architect.py
.py
import json from enum import Enum from typing import Any, Optional from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.db.models import Specification from core.llm.parser import JSONParser from c...
295
11,377
gpt-pilot
core/agents/error_handler.py
.py
from uuid import uuid4 from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.db.models.project_state import IterationStatus from core.log import get_logger log = get_logger(__name__) class ErrorHandler(BaseAgent): """ Error h...
122
4,795
gpt-pilot
core/agents/mixins.py
.py
import asyncio import json from typing import List, Optional from pydantic import BaseModel, Field from core.agents.convo import AgentConvo from core.agents.response import AgentResponse from core.cli.helpers import get_line_changes from core.config import GET_RELEVANT_FILES_AGENT_NAME, TASK_BREAKDOWN_AGENT_NAME, TRO...
209
7,559
gpt-pilot
core/agents/importer.py
.py
from uuid import uuid4 from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.response import AgentResponse, ResponseType from core.db.models import Complexity from core.llm.parser import JSONParser from core.log import get_logger from core.telemetry import telemetry from core...
98
3,658
gpt-pilot
core/agents/wizard.py
.py
import json from urllib.parse import urljoin from uuid import uuid4 import httpx from sqlalchemy import inspect from core.agents.base import BaseAgent from core.agents.response import AgentResponse from core.cli.helpers import capture_exception from core.config import PYTHAGORA_API from core.config.actions import FE_...
175
7,274
gpt-pilot
core/agents/tech_lead.py
.py
import asyncio from uuid import uuid4 from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.mixins import RelevantFilesMixin from core.agents.response import AgentResponse from core.config import TECH_LEAD_EPIC_BREAKDOWN, TECH_LEAD_PLANN...
464
18,852
gpt-pilot
core/agents/orchestrator.py
.py
import asyncio import json import os import re from typing import List, Optional, Union from core.agents.architect import Architect from core.agents.base import BaseAgent from core.agents.bug_hunter import BugHunter from core.agents.code_monkey import CodeMonkey from core.agents.developer import Developer from core.ag...
642
30,705
gpt-pilot
core/agents/troubleshooter.py
.py
import json from typing import Optional from uuid import uuid4 from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.mixins import ChatWithBreakdownMixin, IterationPromptMixin, RelevantFilesMixin, TestSteps from core.agents.response impo...
435
18,095
gpt-pilot
core/agents/base.py
.py
from typing import Any, Callable, Optional from core.agents.response import AgentResponse from core.config import get_config from core.db.models import ProjectState from core.llm.base import BaseLLMClient, LLMError from core.log import get_logger from core.proc.process_manager import ProcessManager from core.state.sta...
232
8,346
gpt-pilot
core/agents/response.py
.py
from enum import Enum from typing import TYPE_CHECKING, Optional from core.log import get_logger if TYPE_CHECKING: from core.agents.base import BaseAgent from core.agents.error_handler import ErrorHandler log = get_logger(__name__) class ResponseType(str, Enum): DONE = "done" """Agent has finished...
111
3,441
gpt-pilot
core/agents/bug_hunter.py
.py
import asyncio import json from enum import Enum from pydantic import BaseModel, Field from core.agents.base import BaseAgent from core.agents.convo import AgentConvo from core.agents.mixins import ChatWithBreakdownMixin, TestSteps from core.agents.response import AgentResponse from core.config import CHECK_LOGS_AGEN...
412
19,245
gpt-pilot
tests/conftest.py
.py
import os from typing import Callable from unittest.mock import AsyncMock, MagicMock, patch import pytest import pytest_asyncio from core.config import DBConfig from core.db.models import Base from core.db.session import SessionManager from core.state.state_manager import StateManager @pytest.fixture(autouse=True) ...
92
2,738
gpt-pilot
tests/disk/test_vfs.py
.py
from os.path import exists, join from core.disk.ignore import IgnoreMatcher from core.disk.vfs import LocalDiskVFS, MemoryVFS def test_memory_vfs(): vfs = MemoryVFS() assert vfs.list() == [] vfs.save("test.txt", "hello world") assert vfs.read("test.txt") == "hello world" assert vfs.list() == ["...
89
2,507
gpt-pilot
tests/disk/test_ignore.py
.py
from io import StringIO from os.path import join from unittest.mock import MagicMock, patch import pytest from core.disk.ignore import IgnoreMatcher @pytest.mark.parametrize( ("path", "expected"), [ ("test.py", False), ("test.pyc", True), (join("module", "test.py"), False), (...
73
2,070
gpt-pilot
tests/log/test_log.py
.py
from os.path import join from core.config import LogConfig from core.log import get_logger, setup def test_file_handler(tmp_path): output = join(tmp_path, "test.log") cfg = LogConfig(level="DEBUG", output=output) setup(cfg, force=True) logger = get_logger("core") logger.debug("debug message") ...
41
1,088
gpt-pilot
tests/llm/test_convo.py
.py
import pytest from core.llm.convo import Convo def test_convo_constructor_without_content(): convo = Convo() assert convo.messages == [] def test_convo_constructor_with_content(): convo = Convo("Hello, world!") assert len(convo.messages) == 1 assert convo.messages[0]["role"] == "system" ass...
297
8,370
gpt-pilot
tests/llm/test_openai.py
.py
from unittest.mock import AsyncMock, MagicMock, call, patch import openai import pytest from core.config import LLMConfig from core.llm.base import APIError from core.llm.convo import Convo from core.llm.openai_client import OpenAIClient from core.state.state_manager import StateManager async def mock_response_gene...
284
9,343
gpt-pilot
tests/llm/test_prompt.py
.py
import pytest from jinja2 import UndefinedError from core.llm.prompt import FormatTemplate, JinjaFileTemplate, JinjaStringTemplate def test_format_template(): template = FormatTemplate() assert ( template( "hello {name}, you are {age:.2f} bn years old", name="world", ...
60
1,360
gpt-pilot
tests/llm/test_parser.py
.py
from enum import Enum from typing import Tuple import pytest from pydantic import BaseModel, field_validator from core.llm.parser import CodeBlockParser, EnumParser, JSONParser, MultiCodeBlockParser, OptionalCodeBlockParser @pytest.mark.parametrize( ("input", "expected"), [ ("", []), ("some ...
207
5,627
gpt-pilot
tests/integration/llm/test_openai.py
.py
from json import loads from os import getenv import pytest from core.config import LLMConfig, LLMProvider from core.llm.base import APIError from core.llm.convo import Convo from core.llm.openai_client import OpenAIClient run_integration_tests = getenv("INTEGRATION_TESTS", "").lower() if run_integration_tests not in...
120
3,202
gpt-pilot
tests/integration/llm/test_anthropic.py
.py
from json import loads from os import getenv import pytest from core.config import LLMConfig, LLMProvider from core.llm.anthropic_client import AnthropicClient from core.llm.base import APIError from core.llm.convo import Convo from core.llm.request_log import LLMRequestStatus run_integration_tests = getenv("INTEGRA...
121
3,286
gpt-pilot
tests/integration/llm/test_groq.py
.py
from json import loads from os import getenv import pytest from core.config import LLMConfig, LLMProvider from core.llm.base import APIError from core.llm.convo import Convo from core.llm.groq_client import GroqClient run_integration_tests = getenv("INTEGRATION_TESTS", "").lower() if run_integration_tests not in ["t...
123
3,206
gpt-pilot
tests/proc/test_process_manager.py
.py
from os import getenv, makedirs from os.path import join from sys import platform from unittest.mock import patch import pytest from psutil import Process from core.proc.process_manager import LocalProcess, ProcessManager @pytest.mark.skip @pytest.mark.asyncio async def test_local_process_start_terminate(tmp_path):...
151
3,656
gpt-pilot
tests/state/test_state_manager.py
.py
import os from unittest.mock import AsyncMock, MagicMock, patch import pytest from core.config import FileSystemConfig from core.state.state_manager import StateManager @pytest.mark.asyncio async def test_list_projects_empty(testmanager): sm = StateManager(testmanager) projects = await sm.list_projects() ...
226
8,268
gpt-pilot
tests/telemetry/test_telemetry.py
.py
from unittest.mock import AsyncMock, MagicMock, patch import httpx import pytest import pytest_asyncio from core.config import loader from core.telemetry import Telemetry @pytest_asyncio.fixture async def mock_httpx_post(): with patch("core.telemetry.httpx") as mock_httpx: mock_httpx.RequestError = http...
279
9,089