File size: 2,023 Bytes
81e5fe7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""Contracts the planner consumes from other teams.

`BusinessContext` (+ KeyTerm / DataTableNote / DataColumnNote) is still a LOCAL
STUB owned by the lead (interview / Business Understanding); shape mirrors
AGENT_ARCHITECTURE_CONTEXT_new.md §7.1 and must be reconciled before integration.

`ToolSpec` / `ToolRegistry` / `ToolOutput` are NO LONGER defined here — the tool
team owns them (KM-465). They now live in `src.tools.contracts` and are
re-exported below so existing importers (`registry.py`, the slow-path
`invoker.py` / `schemas.py`) keep working against one shared definition.
"""

from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field

# Canonical tool contracts now owned by the tool team (KM-465). Re-exported here
# for backwards-compatible imports; the definitions live in src.tools.contracts.
from src.tools.contracts import ToolOutput, ToolRegistry, ToolSpec

__all__ = [
    "KeyTerm",
    "DataTableNote",
    "DataColumnNote",
    "BusinessContext",
    "ToolSpec",
    "ToolRegistry",
    "ToolOutput",
]

# --------------------------------------------------------------------------- #
# BusinessContext (lead's contract — §7.1)
# --------------------------------------------------------------------------- #


class KeyTerm(BaseModel):
    term: str
    meaning: str


class DataTableNote(BaseModel):
    table_name: str
    row_represents: str


class DataColumnNote(BaseModel):
    column_name: str
    meaning: str


class BusinessContext(BaseModel):
    project_id: str
    industry: str
    completeness: Literal["partial", "complete"]
    business_description: str
    scale_and_scope: str
    key_terms: list[KeyTerm] = Field(default_factory=list)
    data_overview: list[DataTableNote] = Field(default_factory=list)
    data_column_notes: list[DataColumnNote] = Field(default_factory=list)
    whats_normal: str = ""
    recent_events: str = ""
    things_to_watch_for: str = ""
    open_questions: list[str] = Field(default_factory=list)