Files
Stirling-PDF/engine/src/stirling/contracts/__init__.py
T
ReeceandClaude Opus 4.7 b32a3cf271 Merge origin/main into AI-Form-Fill
Resolution favours main for all conflicts (new orchestrator shape with
artifacts/file_names/conversation_history/resume_with, WorkflowOutcome
enum, RAG, ledger agent, deleted engine/config/.env.example).

Re-wires our three form-fill agents (FormAnalyserAgent, FormFillerAgent,
DocumentExtractorAgent) into the new app layout:
- contracts/__init__.py: adds form-fill exports to __all__
- api/dependencies.py: adds get_form_analyser_agent / get_form_filler_agent / get_document_extractor_agent
- api/app.py: instantiates the three agents in lifespan and registers form_fill_router
- api/routes/__init__.py: exports form_fill_router
- tests/test_stirling_api.py: imports and registers form-fill stubs
- tests/test_stirling_contracts.py: adds back KnowledgeUpdateResponse discriminator test

Form fill remains accessible via its own endpoints (/api/v1/form/ai/analyse,
/fill-batch, /extract). Not wired as an orchestrator delegate — following
main's pattern where orchestrator only routes pdf_edit/pdf_question/user_spec
/math_auditor.

Follow-ups still needed:
- Thread conversation_history into form-fill agent prompts
- Align form-fill response outcomes with WorkflowOutcome enum
- Decide whether engine should return ToolOperationStep plans (main's
  new pattern per #6116) or keep returning fill values directly

All 127 engine tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 13:13:12 +01:00

184 lines
4.2 KiB
Python

from .agent_drafts import (
AgentDraft,
AgentDraftRequest,
AgentDraftResponse,
AgentDraftWorkflowResponse,
AgentRevisionRequest,
AgentRevisionResponse,
AgentRevisionWorkflowResponse,
)
from .agent_specs import AgentSpec, AgentSpecStep, AiToolAgentStep
from .common import (
ArtifactKind,
ConversationMessage,
ExtractedFileText,
PdfContentType,
PdfTextSelection,
StepKind,
SupportedCapability,
ToolOperationStep,
WorkflowOutcome,
format_conversation_history,
)
from .execution import (
AgentExecutionRequest,
CannotContinueExecutionAction,
CompletedExecutionAction,
ExecutionContext,
ExecutionStepResult,
NextExecutionAction,
ToolCallExecutionAction,
)
from .form_fill import (
AnalysedFileResult,
CleanedLabel,
CrossFileRole,
DetectedRole,
DocumentExtractionRequest,
DocumentExtractionResponse,
DocumentText,
FieldMapping,
FileFieldSet,
FileFillRequest,
FileFillResult,
FormAnalysisRequest,
FormAnalysisResponse,
FormField,
FormFillBatchRequest,
FormFillBatchResponse,
KnowledgeEntry,
KnowledgeUpdateResponse,
MultiProfileExtractionResponse,
ProposedProfile,
)
from .health import HealthResponse
from .ledger import (
Discrepancy,
DiscrepancyKind,
Evidence,
Folio,
FolioManifest,
FolioType,
Requisition,
Severity,
Verdict,
)
from .orchestrator import (
ExtractedTextArtifact,
OrchestratorRequest,
OrchestratorResponse,
UnsupportedCapabilityResponse,
WorkflowArtifact,
)
from .pdf_edit import (
EditCannotDoResponse,
EditClarificationRequest,
EditPlanResponse,
PdfEditRequest,
PdfEditResponse,
)
from .pdf_questions import (
NeedContentFileRequest,
PdfQuestionAnswerResponse,
PdfQuestionNeedContentResponse,
PdfQuestionNotFoundResponse,
PdfQuestionRequest,
PdfQuestionResponse,
)
from .rag import (
MAX_INDEX_TEXT_LENGTH,
RagCollectionsResponse,
RagDeleteCollectionResponse,
RagIndexRequest,
RagIndexResponse,
RagSearchRequest,
RagSearchResponse,
RagSearchResultItem,
RagStatusResponse,
)
__all__ = [
"MAX_INDEX_TEXT_LENGTH",
"AgentDraft",
"AgentDraftRequest",
"AgentDraftResponse",
"AgentDraftWorkflowResponse",
"AgentExecutionRequest",
"AgentRevisionRequest",
"AgentRevisionResponse",
"AgentRevisionWorkflowResponse",
"AgentSpec",
"AgentSpecStep",
"AiToolAgentStep",
"AnalysedFileResult",
"ArtifactKind",
"CannotContinueExecutionAction",
"CleanedLabel",
"CompletedExecutionAction",
"ConversationMessage",
"CrossFileRole",
"DetectedRole",
"Discrepancy",
"DiscrepancyKind",
"DocumentExtractionRequest",
"DocumentExtractionResponse",
"DocumentText",
"EditCannotDoResponse",
"EditClarificationRequest",
"EditPlanResponse",
"Evidence",
"ExecutionContext",
"ExecutionStepResult",
"ExtractedFileText",
"ExtractedTextArtifact",
"FieldMapping",
"FileFieldSet",
"FileFillRequest",
"FileFillResult",
"Folio",
"FolioManifest",
"FolioType",
"FormAnalysisRequest",
"FormAnalysisResponse",
"FormField",
"FormFillBatchRequest",
"FormFillBatchResponse",
"format_conversation_history",
"HealthResponse",
"KnowledgeEntry",
"KnowledgeUpdateResponse",
"MultiProfileExtractionResponse",
"NeedContentFileRequest",
"ProposedProfile",
"NextExecutionAction",
"OrchestratorRequest",
"OrchestratorResponse",
"PdfContentType",
"PdfEditRequest",
"PdfEditResponse",
"PdfQuestionAnswerResponse",
"PdfQuestionNeedContentResponse",
"PdfQuestionNotFoundResponse",
"PdfQuestionRequest",
"PdfQuestionResponse",
"PdfTextSelection",
"RagCollectionsResponse",
"RagDeleteCollectionResponse",
"RagIndexRequest",
"RagIndexResponse",
"RagSearchRequest",
"RagSearchResponse",
"RagSearchResultItem",
"RagStatusResponse",
"Requisition",
"Severity",
"StepKind",
"SupportedCapability",
"ToolCallExecutionAction",
"ToolOperationStep",
"UnsupportedCapabilityResponse",
"Verdict",
"WorkflowArtifact",
"WorkflowOutcome",
]