| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- """Exact field names mirrored from the current Host domain and Agent wire models.
- This module intentionally has no dependency on the parent source tree. The
- visualization stays independently runnable while its tests reject incomplete or
- invented fake records.
- """
- from __future__ import annotations
- SCHEMA_CATALOG: dict[str, tuple[str, ...]] = {
- "ScriptBuildRecord": (
- "id",
- "execution_id",
- "topic_build_id",
- "topic_id",
- "agent_type",
- "agent_config",
- "data_source_url",
- "status",
- "reson_trace_id",
- "is_deleted",
- "is_favorited",
- "summary",
- "error_message",
- "script_direction",
- "build_workflow",
- "paragraph_count",
- "element_count",
- "input_tokens",
- "output_tokens",
- "cost_usd",
- "strategies_config",
- "start_time",
- "end_time",
- ),
- "ScriptBuildInputSnapshotV1": (
- "snapshot_id",
- "script_build_id",
- "execution_id",
- "topic_build_id",
- "topic_id",
- "topic",
- "account",
- "persona_points",
- "section_patterns",
- "strategies",
- "prompt_manifest",
- "datasource_manifest",
- "model_manifest",
- "canonical_sha256",
- "created_at",
- "parent_snapshot_id",
- "parent_snapshot_sha256",
- "business_input_sha256",
- ),
- "InputSnapshotRow": (
- "id",
- "script_build_id",
- "version",
- "canonical_json",
- "canonical_sha256",
- "prompt_manifest_json",
- "schema_version",
- "created_at",
- ),
- "MissionBinding": (
- "binding_id",
- "script_build_id",
- "root_trace_id",
- "input_snapshot_id",
- "active_direction_artifact_version_id",
- "accepted_root_artifact_version_id",
- "engine_version",
- "schema_version",
- "created_at",
- "updated_at",
- "owner_epoch",
- "stop_epoch",
- "owner_instance_id",
- "owner_acquired_at",
- ),
- "MissionOwnerToken": (
- "script_build_id",
- "root_trace_id",
- "owner_epoch",
- "stop_epoch",
- "owner_instance_id",
- ),
- "TaskView": (
- "task_id",
- "goal_id",
- "parent_task_id",
- "display_path",
- "specs",
- "current_spec_version",
- "status",
- "child_task_ids",
- "attempt_ids",
- "validation_ids",
- "decision_ids",
- "repair_count_by_version",
- "blocked_reason",
- "superseded_by",
- "created_at",
- "updated_at",
- ),
- "TaskSpecView": (
- "version",
- "objective",
- "acceptance_criteria",
- "context_refs",
- "created_at",
- ),
- "ScriptTaskContractV1": (
- "schema_version",
- "task_kind",
- "scope_ref",
- "intent_class",
- "objective",
- "input_decision_refs",
- "base_artifact_ref",
- "write_scope",
- "gap_ref",
- "output_schema",
- "criteria",
- "budget",
- "supersedes_decision_ids",
- "candidate_closure_decision_refs",
- "adopted_decision_ids",
- "held_or_rejected_decision_ids",
- "compose_order",
- "comparison_decision_refs",
- ),
- "OperationView": (
- "operation_id",
- "root_trace_id",
- "kind",
- "status",
- "task_ids",
- "attempt_ids",
- "validation_ids",
- "result_ref",
- "execution_epoch",
- "deadline_at",
- "error",
- "started_at",
- "completed_at",
- "created_at",
- "updated_at",
- ),
- "AttemptView": (
- "attempt_id",
- "task_id",
- "spec_version",
- "worker_trace_id",
- "worker_preset",
- "execution_mode",
- "accepted_child_decision_ids",
- "status",
- "operation_id",
- "execution_epoch",
- "continue_from_trace_id",
- "snapshot_id",
- "submission",
- "execution_stats",
- "error",
- "started_at",
- "completed_at",
- "duration_ms",
- "created_at",
- "updated_at",
- ),
- "ValidationView": (
- "validation_id",
- "task_id",
- "attempt_id",
- "spec_version",
- "snapshot_id",
- "validator_trace_id",
- "validator_preset",
- "validation_plan",
- "evidence_queries_used",
- "status",
- "operation_id",
- "execution_epoch",
- "verdict",
- "criterion_results",
- "summary",
- "evidence_refs",
- "unverified_claims",
- "risks",
- "recommendation",
- "execution_stats",
- "error",
- "started_at",
- "completed_at",
- "duration_ms",
- "created_at",
- "updated_at",
- ),
- "PlannerDecisionView": (
- "decision_id",
- "task_id",
- "action",
- "reason",
- "from_status",
- "to_status",
- "attempt_id",
- "validation_id",
- "payload",
- "created_at",
- ),
- "EvidenceRecordV1": (
- "schema_version",
- "evidence_id",
- "source_type",
- "tool_name",
- "query",
- "source_refs",
- "raw_artifact_ref",
- "summary",
- "supports",
- "confidence",
- "limitations",
- "created_at",
- ),
- "ScriptDirectionArtifactV1": (
- "schema_version",
- "goals",
- "criteria",
- "domain_criteria",
- "topic_refs",
- "persona_refs",
- "strategy_refs",
- "evidence_refs",
- "legacy_markdown",
- ),
- "CandidateLineageV1": (
- "scope_ref",
- "input_snapshot_ref",
- "input_closure_digest",
- "base_artifact_ref",
- "base_artifact_digest",
- "base_revision",
- "write_scope",
- "supersedes_decision_ids",
- "source_lineage",
- ),
- "StructureArtifactV1": (
- "schema_version",
- "scope_ref",
- "input_snapshot_ref",
- "input_closure_digest",
- "base_artifact_ref",
- "base_artifact_digest",
- "base_revision",
- "write_scope",
- "supersedes_decision_ids",
- "source_lineage",
- "paragraphs",
- ),
- "ParagraphArtifactV1": (
- "schema_version",
- "scope_ref",
- "input_snapshot_ref",
- "input_closure_digest",
- "base_artifact_ref",
- "base_artifact_digest",
- "base_revision",
- "write_scope",
- "supersedes_decision_ids",
- "source_lineage",
- "paragraphs",
- "elements",
- "paragraph_element_links",
- "change_manifest",
- ),
- "ElementSetArtifactV1": (
- "schema_version",
- "scope_ref",
- "input_snapshot_ref",
- "input_closure_digest",
- "base_artifact_ref",
- "base_artifact_digest",
- "base_revision",
- "write_scope",
- "supersedes_decision_ids",
- "source_lineage",
- "paragraphs",
- "elements",
- "paragraph_element_links",
- "change_manifest",
- ),
- "ComparisonArtifactV1": (
- "schema_version",
- "scope_ref",
- "input_snapshot_ref",
- "input_closure_digest",
- "base_artifact_ref",
- "base_artifact_digest",
- "base_revision",
- "write_scope",
- "supersedes_decision_ids",
- "source_lineage",
- "candidate_artifact_refs",
- "criterion_results",
- "conflicts",
- "recommendation",
- ),
- "StructuredScriptArtifactV1": (
- "schema_version",
- "direction_ref",
- "input_closure_digest",
- "paragraphs",
- "elements",
- "paragraph_element_links",
- "source_artifact_refs",
- "evidence_refs",
- "acceptance_notes",
- ),
- "CandidatePortfolioArtifactV1": (
- "schema_version",
- "adopted_structured_script_ref",
- "candidate_structured_script_refs",
- "accepted_decision_ids",
- "superseded_decision_ids",
- "rejected_or_held_decision_ids",
- "input_closure_digest",
- "unresolved_defects",
- "compose_order",
- ),
- "ArtifactVersion": (
- "artifact_version_id",
- "script_build_id",
- "task_id",
- "attempt_id",
- "spec_version",
- "artifact_type",
- "canonical_sha256",
- "state",
- "artifact",
- "created_at",
- "frozen_at",
- ),
- "ArtifactVersionRow": (
- "id",
- "script_build_id",
- "task_id",
- "attempt_id",
- "spec_version",
- "artifact_type",
- "legacy_branch_id",
- "base_revision",
- "parent_artifact_version_id",
- "canonical_json",
- "canonical_sha256",
- "state",
- "created_at",
- "frozen_at",
- "published_at",
- ),
- "ParagraphRow": (
- "id",
- "script_build_id",
- "branch_id",
- "base_ref_id",
- "paragraph_index",
- "level",
- "parent_id",
- "name",
- "content_range",
- "theme",
- "form",
- "function",
- "feeling",
- "theme_elements",
- "form_elements",
- "function_elements",
- "feeling_elements",
- "description",
- "full_description",
- "is_active",
- "created_at",
- "updated_at",
- ),
- "ElementRow": (
- "id",
- "script_build_id",
- "branch_id",
- "base_ref_id",
- "name",
- "dimension_primary",
- "dimension_secondary",
- "commonality_analysis",
- "topic_support",
- "weight_score",
- "support_elements",
- "is_active",
- "created_at",
- "updated_at",
- ),
- "ParagraphElementLinkRow": (
- "id",
- "script_build_id",
- "branch_id",
- "paragraph_id",
- "element_id",
- ),
- "RootDeliveryManifestV1": (
- "schema_version",
- "direction_ref",
- "candidate_portfolio_ref",
- "structured_script_ref",
- "input_closure_digest",
- "legacy_projection_digest",
- "build_summary",
- "blocking_defects",
- ),
- "LegacyProjectionCanonicalV1": (
- "schema_version",
- "direction",
- "summary",
- "paragraph_count",
- "element_count",
- "link_count",
- "paragraphs",
- "elements",
- "paragraph_element_links",
- ),
- "Publication": (
- "publication_id",
- "script_build_id",
- "publication_type",
- "accept_decision_id",
- "artifact_version_id",
- "expected_sha256",
- "state",
- "attempt_count",
- "publication_revision",
- "last_error_code",
- "last_error_summary",
- "created_at",
- "updated_at",
- "published_at",
- ),
- "PublicationResult": (
- "script_build_id",
- "publication_id",
- "publication_type",
- "state",
- "legacy_projection_digest",
- "committed",
- "post_commit_readback_ok",
- ),
- "HttpCommandRecord": (
- "id",
- "principal_scope_sha256",
- "route_family",
- "idempotency_key",
- "request_fingerprint",
- "preallocated_root_trace_id",
- "resource_id",
- "state",
- "response_status",
- "response_json",
- "created_at",
- "updated_at",
- ),
- }
- ENUM_CATALOG: dict[str, tuple[str, ...]] = {
- "BuildStatus": ("running", "stopping", "success", "failed", "partial", "stopped"),
- "TaskStatus": (
- "pending",
- "running",
- "awaiting_validation",
- "validating",
- "awaiting_decision",
- "needs_replan",
- "waiting_children",
- "completed",
- "superseded",
- "blocked",
- "cancelled",
- ),
- "AttemptStatus": ("running", "submitted", "failed", "stopped", "expired"),
- "ValidationRunStatus": (
- "pending",
- "running",
- "completed",
- "error",
- "stopped",
- "expired",
- ),
- "ValidationVerdict": ("passed", "failed", "inconclusive"),
- "DecisionAction": (
- "accept",
- "repair",
- "retry",
- "revalidate",
- "revise",
- "split",
- "block",
- "unblock",
- "cancel",
- "supersede",
- ),
- "ArtifactState": ("draft", "frozen", "published", "discarded"),
- "PublicationState": ("pending", "publishing", "published", "failed"),
- "ScriptTaskKind": (
- "direction",
- "pattern-retrieval",
- "decode-retrieval",
- "external-retrieval",
- "knowledge-retrieval",
- "structure",
- "paragraph",
- "element-set",
- "compare",
- "compose",
- "candidate-portfolio",
- "root-delivery",
- ),
- }
|