Skip to content

Commit bc1312e

Browse files
committed
Reformat all source and test files with ruff single-quote style
- Apply consistent single-quote style across 63 files in source, tests, and build configuration - Wrap long lines per ruff formatting rules for improved readability
1 parent b63d563 commit bc1312e

63 files changed

Lines changed: 3857 additions & 2712 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

setup.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
from setuptools import find_packages, setup
44

5-
GRAPHQLITE_DEPS = ["graphqlite>=0.4.4", "pysqlite3>=0.6.0"]
6-
DEV_DEPS = [*GRAPHQLITE_DEPS, "pytest>=7", "pytest-cov>=4", "ruff>=0.4", "mypy>=1"]
5+
GRAPHQLITE_DEPS = ['graphqlite>=0.4.4', 'pysqlite3>=0.6.0']
6+
DEV_DEPS = [*GRAPHQLITE_DEPS, 'pytest>=7', 'pytest-cov>=4', 'ruff>=0.4', 'mypy>=1']
77

88

99
setup(
10-
name="teaagent",
11-
version="0.1.0",
12-
description="Minimal P0 agent harness with governance-first defaults.",
10+
name='teaagent',
11+
version='0.1.0',
12+
description='Minimal P0 agent harness with governance-first defaults.',
1313
packages=find_packages(),
14-
python_requires=">=3.9",
14+
python_requires='>=3.9',
1515
install_requires=[],
16-
extras_require={"graphqlite": GRAPHQLITE_DEPS, "dev": DEV_DEPS},
17-
entry_points={"console_scripts": ["teaagent=teaagent.cli:main"]},
16+
extras_require={'graphqlite': GRAPHQLITE_DEPS, 'dev': DEV_DEPS},
17+
entry_points={'console_scripts': ['teaagent=teaagent.cli:main']},
1818
)

teaagent/__init__.py

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Governance-first agent harness."""
22

3-
__version__ = "0.1.0"
3+
__version__ = '0.1.0'
44

55
from teaagent.aibom import AIBOMManifest, build_aibom
66
from teaagent.audit import AuditLogger
@@ -79,87 +79,87 @@
7979
)
8080

8181
__all__ = [
82-
"AIBOMManifest",
83-
"AgentRunner",
84-
"ApprovalPolicy",
85-
"ApprovalRequest",
86-
"AuditLogger",
87-
"ChatAgentConfig",
88-
"ClarificationResult",
89-
"CodeModeResult",
90-
"ContextCompactor",
91-
"Decision",
92-
"Document",
93-
"EvalCase",
94-
"EvalReport",
95-
"FinalAnswer",
96-
"GraphEdge",
97-
"GraphQLiteConfig",
98-
"GraphQLiteGraphStore",
99-
"GraphQLiteRuntimeError",
100-
"GraphQLiteUnavailableError",
101-
"Heartbeat",
102-
"InMemoryRetriever",
103-
"IntentScore",
104-
"KnowledgeGraph",
105-
"LLMConfigurationError",
106-
"LLMHTTPError",
107-
"LLMMessage",
108-
"LLMRequest",
109-
"LLMResponse",
110-
"MemoryCatalog",
111-
"MemoryEntry",
112-
"ModelRoute",
113-
"ModelDecisionEngine",
114-
"PermissionMode",
115-
"PortabilityResult",
116-
"PreflightReport",
117-
"PromptBundle",
118-
"ProviderProfile",
119-
"ProviderConfig",
120-
"ReadinessReport",
121-
"RunBudget",
122-
"RunStore",
123-
"RunSummary",
124-
"SkillReviewResult",
125-
"StatelessMCPRequest",
126-
"StatelessMCPResponse",
127-
"ToolAnnotations",
128-
"ToolRegistry",
129-
"ToolRequest",
130-
"TraceRecorder",
131-
"UltraworkStore",
132-
"UnsafeCodeError",
133-
"WorkerRecord",
134-
"WorkspaceToolConfig",
135-
"agentic_retrieve",
136-
"assess_managed_agent_readiness",
137-
"assess_provider_portability",
138-
"available_providers",
139-
"assemble_agent_prompt",
140-
"build_aibom",
141-
"build_mcp_http_server",
142-
"build_task_spec",
143-
"build_workspace_tool_registry",
144-
"check_graphqlite_runtime",
145-
"check_llm_configuration",
146-
"clarify_task",
147-
"classify_task",
148-
"create_llm_adapter",
149-
"execute_code_mode",
150-
"ensure_sqlite_extension_loading",
151-
"graph_retrieve",
152-
"handle_mcp_request",
153-
"handle_stateless_tool_request",
154-
"parse_model_decision",
155-
"parse_permission_mode",
156-
"preflight",
157-
"review_skill",
158-
"route_model",
159-
"register_subagent_tool",
160-
"register_workspace_tools",
161-
"serve_mcp_http",
162-
"serve_mcp_stdio",
163-
"run_chat_agent",
164-
"run_eval",
82+
'AIBOMManifest',
83+
'AgentRunner',
84+
'ApprovalPolicy',
85+
'ApprovalRequest',
86+
'AuditLogger',
87+
'ChatAgentConfig',
88+
'ClarificationResult',
89+
'CodeModeResult',
90+
'ContextCompactor',
91+
'Decision',
92+
'Document',
93+
'EvalCase',
94+
'EvalReport',
95+
'FinalAnswer',
96+
'GraphEdge',
97+
'GraphQLiteConfig',
98+
'GraphQLiteGraphStore',
99+
'GraphQLiteRuntimeError',
100+
'GraphQLiteUnavailableError',
101+
'Heartbeat',
102+
'InMemoryRetriever',
103+
'IntentScore',
104+
'KnowledgeGraph',
105+
'LLMConfigurationError',
106+
'LLMHTTPError',
107+
'LLMMessage',
108+
'LLMRequest',
109+
'LLMResponse',
110+
'MemoryCatalog',
111+
'MemoryEntry',
112+
'ModelRoute',
113+
'ModelDecisionEngine',
114+
'PermissionMode',
115+
'PortabilityResult',
116+
'PreflightReport',
117+
'PromptBundle',
118+
'ProviderProfile',
119+
'ProviderConfig',
120+
'ReadinessReport',
121+
'RunBudget',
122+
'RunStore',
123+
'RunSummary',
124+
'SkillReviewResult',
125+
'StatelessMCPRequest',
126+
'StatelessMCPResponse',
127+
'ToolAnnotations',
128+
'ToolRegistry',
129+
'ToolRequest',
130+
'TraceRecorder',
131+
'UltraworkStore',
132+
'UnsafeCodeError',
133+
'WorkerRecord',
134+
'WorkspaceToolConfig',
135+
'agentic_retrieve',
136+
'assess_managed_agent_readiness',
137+
'assess_provider_portability',
138+
'available_providers',
139+
'assemble_agent_prompt',
140+
'build_aibom',
141+
'build_mcp_http_server',
142+
'build_task_spec',
143+
'build_workspace_tool_registry',
144+
'check_graphqlite_runtime',
145+
'check_llm_configuration',
146+
'clarify_task',
147+
'classify_task',
148+
'create_llm_adapter',
149+
'execute_code_mode',
150+
'ensure_sqlite_extension_loading',
151+
'graph_retrieve',
152+
'handle_mcp_request',
153+
'handle_stateless_tool_request',
154+
'parse_model_decision',
155+
'parse_permission_mode',
156+
'preflight',
157+
'review_skill',
158+
'route_model',
159+
'register_subagent_tool',
160+
'register_workspace_tools',
161+
'serve_mcp_http',
162+
'serve_mcp_stdio',
163+
'run_chat_agent',
164+
'run_eval',
165165
]

teaagent/aibom.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ class AIBOMManifest:
2222

2323
def to_dict(self) -> dict[str, Any]:
2424
return {
25-
"schema_version": "teaagent.ai-bom.v1",
26-
"components": [
25+
'schema_version': 'teaagent.ai-bom.v1',
26+
'components': [
2727
{
28-
"kind": component.kind,
29-
"name": component.name,
30-
"version": component.version,
31-
"digest": component.digest,
32-
"metadata": component.metadata,
28+
'kind': component.kind,
29+
'name': component.name,
30+
'version': component.version,
31+
'digest': component.digest,
32+
'metadata': component.metadata,
3333
}
3434
for component in self.components
3535
],
@@ -41,10 +41,10 @@ def to_json(self) -> str:
4141

4242
def sha256_file(path: Path) -> str:
4343
digest = hashlib.sha256()
44-
with path.open("rb") as handle:
45-
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
44+
with path.open('rb') as handle:
45+
for chunk in iter(lambda: handle.read(1024 * 1024), b''):
4646
digest.update(chunk)
47-
return "sha256:" + digest.hexdigest()
47+
return 'sha256:' + digest.hexdigest()
4848

4949

5050
def build_aibom(
@@ -56,31 +56,33 @@ def build_aibom(
5656
) -> AIBOMManifest:
5757
components = [
5858
AIBOMComponent(
59-
kind="model",
59+
kind='model',
6060
name=model,
6161
version=model_version,
62-
digest="unavailable",
62+
digest='unavailable',
6363
)
6464
]
6565
for skill_path in skill_paths:
66-
skill_file = skill_path / "SKILL.md" if skill_path.is_dir() else skill_path
66+
skill_file = skill_path / 'SKILL.md' if skill_path.is_dir() else skill_path
6767
components.append(
6868
AIBOMComponent(
69-
kind="skill",
70-
name=skill_path.parent.name if skill_path.name == "SKILL.md" else skill_path.name,
71-
version="unversioned",
69+
kind='skill',
70+
name=skill_path.parent.name
71+
if skill_path.name == 'SKILL.md'
72+
else skill_path.name,
73+
version='unversioned',
7274
digest=sha256_file(skill_file),
73-
metadata={"path": str(skill_file)},
75+
metadata={'path': str(skill_file)},
7476
)
7577
)
7678
if mcp_server_card is not None:
7779
components.append(
7880
AIBOMComponent(
79-
kind="mcp_server_card",
81+
kind='mcp_server_card',
8082
name=mcp_server_card.name,
81-
version="unversioned",
83+
version='unversioned',
8284
digest=sha256_file(mcp_server_card),
83-
metadata={"path": str(mcp_server_card)},
85+
metadata={'path': str(mcp_server_card)},
8486
)
8587
)
8688
return AIBOMManifest(components=components)

teaagent/audit.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@
99
from typing import Any, Optional
1010
from uuid import uuid4
1111

12-
AUDIT_REDACTED = "[redacted]"
13-
AUDIT_TRUNCATED = "[truncated]"
12+
AUDIT_REDACTED = '[redacted]'
13+
AUDIT_TRUNCATED = '[truncated]'
1414
MAX_AUDIT_STRING_LENGTH = 20_000
15-
SENSITIVE_KEY_PARTS = ("api_key", "authorization", "credential", "password", "secret", "token")
15+
SENSITIVE_KEY_PARTS = (
16+
'api_key',
17+
'authorization',
18+
'credential',
19+
'password',
20+
'secret',
21+
'token',
22+
)
1623

1724

1825
def utc_now() -> str:
@@ -30,11 +37,11 @@ class AuditEvent:
3037
def to_json(self) -> str:
3138
return json.dumps(
3239
{
33-
"event_id": self.event_id,
34-
"event_type": self.event_type,
35-
"run_id": self.run_id,
36-
"created_at": self.created_at,
37-
"payload": self.payload,
40+
'event_id': self.event_id,
41+
'event_type': self.event_type,
42+
'run_id': self.run_id,
43+
'created_at': self.created_at,
44+
'payload': self.payload,
3845
},
3946
sort_keys=True,
4047
)
@@ -55,12 +62,14 @@ def add_sink(self, sink: Callable[[AuditEvent], None]) -> None:
5562
self._sinks.append(sink)
5663

5764
def record(self, event_type: str, run_id: str, **payload: Any) -> AuditEvent:
58-
event = AuditEvent(event_type=event_type, run_id=run_id, payload=redact_audit_payload(payload))
65+
event = AuditEvent(
66+
event_type=event_type, run_id=run_id, payload=redact_audit_payload(payload)
67+
)
5968
with self._lock:
6069
self.events.append(event)
6170
if self.path is not None:
62-
with self.path.open("a", encoding="utf-8") as handle:
63-
handle.write(event.to_json() + "\n")
71+
with self.path.open('a', encoding='utf-8') as handle:
72+
handle.write(event.to_json() + '\n')
6473
sinks = list(self._sinks)
6574
for sink in sinks:
6675
sink(event)
@@ -75,16 +84,19 @@ def redact_audit_value(key: str, value: Any) -> Any:
7584
if is_sensitive_key(key):
7685
return AUDIT_REDACTED
7786
if isinstance(value, dict):
78-
return {str(child_key): redact_audit_value(str(child_key), child_value) for child_key, child_value in value.items()}
87+
return {
88+
str(child_key): redact_audit_value(str(child_key), child_value)
89+
for child_key, child_value in value.items()
90+
}
7991
if isinstance(value, list):
80-
return [redact_audit_value("", item) for item in value]
92+
return [redact_audit_value('', item) for item in value]
8193
if isinstance(value, tuple):
82-
return [redact_audit_value("", item) for item in value]
94+
return [redact_audit_value('', item) for item in value]
8395
if isinstance(value, str) and len(value) > MAX_AUDIT_STRING_LENGTH:
8496
return value[:MAX_AUDIT_STRING_LENGTH] + AUDIT_TRUNCATED
8597
return value
8698

8799

88100
def is_sensitive_key(key: str) -> bool:
89-
normalized = key.lower().replace("-", "_")
101+
normalized = key.lower().replace('-', '_')
90102
return any(part in normalized for part in SENSITIVE_KEY_PARTS)

teaagent/budget.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class RunBudget:
1111

1212
def validate(self) -> None:
1313
if self.max_iterations < 1:
14-
raise ValueError("max_iterations must be >= 1")
14+
raise ValueError('max_iterations must be >= 1')
1515
if self.max_tool_calls < 0:
16-
raise ValueError("max_tool_calls must be >= 0")
16+
raise ValueError('max_tool_calls must be >= 0')
1717
if self.max_estimated_cost_cents < 0:
18-
raise ValueError("max_estimated_cost_cents must be >= 0")
18+
raise ValueError('max_estimated_cost_cents must be >= 0')

0 commit comments

Comments
 (0)