engineering-platform 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. engineering_platform/ENGINEERING_PLATFORM_CONFIG.json +32 -0
  2. engineering_platform/ENGINEERING_PLATFORM_VERSION.json +15 -0
  3. engineering_platform/__init__.py +1 -0
  4. engineering_platform/__main__.py +7 -0
  5. engineering_platform/agent_state.py +530 -0
  6. engineering_platform/agent_trust.py +174 -0
  7. engineering_platform/assets/dashboard.css +1317 -0
  8. engineering_platform/assets/dashboard.js +8534 -0
  9. engineering_platform/assets/dashboard_locales.mjs +4049 -0
  10. engineering_platform/assets/dashboard_status_store.mjs +41 -0
  11. engineering_platform/assets/operations-console/apple-touch-icon-dark.png +0 -0
  12. engineering_platform/assets/operations-console/apple-touch-icon-light.png +0 -0
  13. engineering_platform/assets/operations-console/icon-dark.png +0 -0
  14. engineering_platform/assets/operations-console/icon-light.png +0 -0
  15. engineering_platform/assets/operations-console/icon-transparent.png +0 -0
  16. engineering_platform/assets/operations-console/manifest.webmanifest +11 -0
  17. engineering_platform/capability_preflight.py +285 -0
  18. engineering_platform/capability_review.py +261 -0
  19. engineering_platform/central_data_transfer.py +195 -0
  20. engineering_platform/central_database.py +245 -0
  21. engineering_platform/central_store_migration.py +1672 -0
  22. engineering_platform/codex_capacity.py +81 -0
  23. engineering_platform/codex_chat.py +226 -0
  24. engineering_platform/codex_observability.py +153 -0
  25. engineering_platform/component_lock.py +40 -0
  26. engineering_platform/component_logging.py +420 -0
  27. engineering_platform/console_presentation.py +14 -0
  28. engineering_platform/console_route_ownership.py +83 -0
  29. engineering_platform/contracts/__init__.py +38 -0
  30. engineering_platform/contracts/ep_consumer.py +391 -0
  31. engineering_platform/contracts/models.py +105 -0
  32. engineering_platform/contracts/projection.py +401 -0
  33. engineering_platform/dashboard_browser_validation.py +206 -0
  34. engineering_platform/dashboard_state.py +630 -0
  35. engineering_platform/dashboard_supervisor.swift +105 -0
  36. engineering_platform/dashboard_translation.py +129 -0
  37. engineering_platform/dependabot_producer.py +349 -0
  38. engineering_platform/drift_diagnostics.py +144 -0
  39. engineering_platform/emergency_recovery.py +268 -0
  40. engineering_platform/engineering_memory.py +139 -0
  41. engineering_platform/ep_consumer_credentials.py +473 -0
  42. engineering_platform/evidence_projection.py +213 -0
  43. engineering_platform/execution_activity.py +218 -0
  44. engineering_platform/execution_context.py +132 -0
  45. engineering_platform/execution_errors.py +42 -0
  46. engineering_platform/execution_evidence.py +24 -0
  47. engineering_platform/execution_executor.py +730 -0
  48. engineering_platform/execution_finalization.py +44 -0
  49. engineering_platform/execution_host.py +3306 -0
  50. engineering_platform/execution_lease.py +365 -0
  51. engineering_platform/execution_lifecycle.py +447 -0
  52. engineering_platform/execution_models.py +43 -0
  53. engineering_platform/execution_readiness.py +166 -0
  54. engineering_platform/execution_reporting.py +1607 -0
  55. engineering_platform/execution_repository.py +253 -0
  56. engineering_platform/execution_timeout_policy.py +56 -0
  57. engineering_platform/execution_timing.py +440 -0
  58. engineering_platform/execution_transaction.py +28 -0
  59. engineering_platform/external_producer_binding.py +235 -0
  60. engineering_platform/file_inbox.py +249 -0
  61. engineering_platform/forensic_attribution.py +338 -0
  62. engineering_platform/forensic_attribution_v2.py +134 -0
  63. engineering_platform/forensic_delta.py +299 -0
  64. engineering_platform/golden_scenario.py +63 -0
  65. engineering_platform/historical_dashboard_configuration.py +171 -0
  66. engineering_platform/host_admin.py +199 -0
  67. engineering_platform/host_preflight.py +231 -0
  68. engineering_platform/installation_relocation.py +122 -0
  69. engineering_platform/investigation_ledger.py +89 -0
  70. engineering_platform/legacy_inbox_migration.py +79 -0
  71. engineering_platform/lifecycle_worker.py +223 -0
  72. engineering_platform/live_status.py +267 -0
  73. engineering_platform/local_api.py +209 -0
  74. engineering_platform/local_api_keychain.py +51 -0
  75. engineering_platform/local_repository_binding.py +138 -0
  76. engineering_platform/managed_autonomy.py +509 -0
  77. engineering_platform/managed_codex_runtime.py +105 -0
  78. engineering_platform/parity_context.py +203 -0
  79. engineering_platform/parity_lifecycle_dispatcher.py +488 -0
  80. engineering_platform/platform_admin.py +13 -0
  81. engineering_platform/platform_api.py +428 -0
  82. engineering_platform/platform_bootstrap.py +385 -0
  83. engineering_platform/platform_components.py +65 -0
  84. engineering_platform/platform_version.py +171 -0
  85. engineering_platform/pr_check_repair.py +276 -0
  86. engineering_platform/pr_evidence_backfill.py +278 -0
  87. engineering_platform/producer.py +209 -0
  88. engineering_platform/project_agent.py +366 -0
  89. engineering_platform/project_agent_service.py +244 -0
  90. engineering_platform/project_topology.py +126 -0
  91. engineering_platform/prompt_history.py +591 -0
  92. engineering_platform/provider_context.py +136 -0
  93. engineering_platform/provider_context_benchmark.py +41 -0
  94. engineering_platform/provider_context_scope.py +90 -0
  95. engineering_platform/provider_interruption.py +168 -0
  96. engineering_platform/provider_process_identity.py +80 -0
  97. engineering_platform/provider_readiness.py +138 -0
  98. engineering_platform/provider_recovery.py +647 -0
  99. engineering_platform/provider_usage.py +497 -0
  100. engineering_platform/providers.py +471 -0
  101. engineering_platform/qualification.py +220 -0
  102. engineering_platform/recommendation_handoff.py +238 -0
  103. engineering_platform/report_analysis.py +193 -0
  104. engineering_platform/repository_attachment.py +171 -0
  105. engineering_platform/repository_handoff.py +95 -0
  106. engineering_platform/resources.py +38 -0
  107. engineering_platform/reviewer_evidence.py +70 -0
  108. engineering_platform/schemas/repository-attachment.schema.json +61 -0
  109. engineering_platform/server.py +3679 -0
  110. engineering_platform/server_console_services.py +2024 -0
  111. engineering_platform/server_relay.py +172 -0
  112. engineering_platform/server_service.py +122 -0
  113. engineering_platform/status_model.py +135 -0
  114. engineering_platform/status_reconciliation.py +34 -0
  115. engineering_platform/storage.py +2440 -0
  116. engineering_platform/submission_cli.py +77 -0
  117. engineering_platform/submission_intake.py +45 -0
  118. engineering_platform/submission_service.py +317 -0
  119. engineering_platform/telemetry.py +951 -0
  120. engineering_platform/templates/workspace-config.json +25 -0
  121. engineering_platform/validation_identity.py +50 -0
  122. engineering_platform/validation_profile.py +211 -0
  123. engineering_platform/workspace_preflight.py +263 -0
  124. engineering_platform/worktree_provenance.py +147 -0
  125. engineering_platform/worktree_tooling.py +18 -0
  126. engineering_platform-2.2.0.dist-info/METADATA +18 -0
  127. engineering_platform-2.2.0.dist-info/RECORD +130 -0
  128. engineering_platform-2.2.0.dist-info/WHEEL +5 -0
  129. engineering_platform-2.2.0.dist-info/entry_points.txt +6 -0
  130. engineering_platform-2.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,203 @@
1
+ """Scoped CENTRAL compatibility boundary for Phase-P parity consumers.
2
+
3
+ This module only adapts durable CENTRAL state to the input shapes used by the
4
+ preserved lifecycle and Console. It neither schedules nor executes a run.
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import dataclass
9
+ import json
10
+ from pathlib import Path
11
+ import sqlite3
12
+ from typing import Literal
13
+
14
+ from .execution_context import execution_mode_for
15
+ from .local_repository_binding import resolve_execution_repository
16
+
17
+
18
+ class ParityContextError(ValueError):
19
+ """A stable, fail-closed context construction error."""
20
+
21
+
22
+ ExecutionMode = Literal["MANAGED", "GENESIS"]
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class ParityProjectContext:
27
+ installation_id: str
28
+ data_root: Path
29
+ project_id: str
30
+ repository_id: str
31
+ authority_repository_id: str
32
+ local_repository_root: Path | None
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class HistoricalCandidate:
37
+ """Direct, transport-neutral equivalent of the watcher input envelope."""
38
+
39
+ context: ParityProjectContext
40
+ submission_id: str
41
+ prompt: str
42
+ prompt_digest: str
43
+ producer_id: str
44
+ producer_type: str
45
+ producer_version: str | None
46
+ transport: str
47
+ correlation_id: str | None
48
+ mission_id: str | None
49
+ engineering_action_id: str | None
50
+ constraints: dict[str, object]
51
+ execution_mode: ExecutionMode
52
+
53
+ def producer_envelope(self) -> str:
54
+ """Return the existing validated Producer Submission Envelope shape."""
55
+ producer: dict[str, object] = {"id": self.producer_id, "type": self.producer_type}
56
+ for field, attribute in (("version", "producer_version"), ("correlation_id", "correlation_id"),
57
+ ("mission_id", "mission_id"), ("engineering_action_id", "engineering_action_id")):
58
+ value = getattr(self, attribute)
59
+ if value is not None:
60
+ producer[field] = value
61
+ return json.dumps({
62
+ "contract": {"name": "engineering_platform.producer_submission", "version": "1.0"},
63
+ "submission": {"id": self.submission_id},
64
+ "producer": producer,
65
+ "prompt": {"text": self.prompt},
66
+ }, sort_keys=True)
67
+
68
+
69
+ class ParityProjectStore:
70
+ """Explicit project-bound CENTRAL reader for future P-A/P-B composition."""
71
+
72
+ def __init__(self, connection: sqlite3.Connection, context: ParityProjectContext) -> None:
73
+ self.connection, self.context = connection, context
74
+
75
+ def queued_submissions(self) -> list[dict[str, object]]:
76
+ rows = self.connection.execute(
77
+ "SELECT submission_id,repository_id,state,admission,created_at,prompt_digest "
78
+ "FROM ep_submissions WHERE project_id=? ORDER BY created_at,submission_id",
79
+ (self.context.project_id,),
80
+ ).fetchall()
81
+ return [{"submission_id": str(row[0]), "repository_id": str(row[1]), "state": str(row[2]),
82
+ "admission": str(row[3]), "created_at": str(row[4]), "prompt_digest": str(row[5])}
83
+ for row in rows]
84
+
85
+ def console_queue_projection(self, *, limit: int = 25) -> dict[str, object]:
86
+ """Return title-only FIFO evidence for this project's CENTRAL queue.
87
+
88
+ Transports are admission inputs, not independently visible queues. A
89
+ submission leaves the visible FIFO as soon as the dispatcher claims
90
+ it; terminal records remain durable history rather than queue items.
91
+ """
92
+ rows = self.connection.execute(
93
+ """SELECT s.submission_id,s.transport,s.producer_type,s.created_at
94
+ FROM ep_submissions s
95
+ LEFT JOIN ep_parity_lifecycle_dispatches d ON d.submission_id=s.submission_id
96
+ WHERE s.project_id=? AND s.state='QUEUED' AND s.admission='ADMITTED'
97
+ AND d.submission_id IS NULL
98
+ ORDER BY s.created_at,s.submission_id""",
99
+ (self.context.project_id,),
100
+ ).fetchall()
101
+ items = [
102
+ {
103
+ "submission_id": str(row[0]),
104
+ "filename": str(row[0]),
105
+ "title_kind": "producer_submission",
106
+ "producer_type": str(row[2]),
107
+ "action_intent": "UNSPECIFIED",
108
+ "modified_at": str(row[3]),
109
+ "queue_source": "CENTRAL",
110
+ "transport": str(row[1]),
111
+ }
112
+ for row in rows[:limit]
113
+ ]
114
+ return {"queue_depth": len(rows), "queue_items": items}
115
+
116
+ def dashboard_projection(self) -> dict[str, object]:
117
+ """A deliberately small project-scoped P-B data boundary, not a UI."""
118
+ runs = self.connection.execute(
119
+ "SELECT run_id,state,created_at,updated_at FROM ep_execution_runs WHERE project_id=? ORDER BY created_at DESC",
120
+ (self.context.project_id,),
121
+ ).fetchall()
122
+ return {
123
+ "project_id": self.context.project_id,
124
+ "repository_id": self.context.repository_id,
125
+ "queue": self.queued_submissions(),
126
+ "console_queue": self.console_queue_projection(),
127
+ "runs": [{"run_id": str(row[0]), "state": str(row[1]), "created_at": str(row[2]), "updated_at": str(row[3])} for row in runs],
128
+ "local_execution_available": self.context.local_repository_root is not None,
129
+ }
130
+
131
+ def validate_action_scope(self, *, repository_id: str, run_id: str | None = None) -> None:
132
+ if repository_id != self.context.repository_id:
133
+ raise ParityContextError("PROJECT_REPOSITORY_MISMATCH")
134
+ if run_id is not None and self.connection.execute(
135
+ "SELECT 1 FROM ep_execution_runs WHERE run_id=? AND project_id=?", (run_id, self.context.project_id)
136
+ ).fetchone() is None:
137
+ raise ParityContextError("RUN_OUTSIDE_PROJECT_SCOPE")
138
+
139
+
140
+ def _context_rows(connection: sqlite3.Connection, project_id: str, repository_id: str) -> tuple[str, str]:
141
+ installation = connection.execute("SELECT instance_id FROM ep_installations").fetchone()
142
+ project = connection.execute("SELECT status,attachment_contract FROM ep_project_registrations WHERE project_id=?", (project_id,)).fetchone()
143
+ repository = connection.execute(
144
+ "SELECT project_id,authority_repository_id FROM ep_repository_registrations WHERE repository_id=?", (repository_id,)
145
+ ).fetchone()
146
+ if installation is None or project is None or project[0] != "ACTIVE":
147
+ raise ParityContextError("UNKNOWN_PROJECT")
148
+ if repository is None:
149
+ raise ParityContextError("UNKNOWN_REPOSITORY")
150
+ if str(repository[0]) != project_id:
151
+ raise ParityContextError("PROJECT_REPOSITORY_MISMATCH")
152
+ authority = str(repository[1])
153
+ if connection.execute(
154
+ "SELECT 1 FROM ep_repository_registrations WHERE repository_id=? AND project_id=? AND role='authority'",
155
+ (authority, project_id),
156
+ ).fetchone() is None:
157
+ raise ParityContextError("AUTHORITY_REPOSITORY_INVALID")
158
+ return str(installation[0]), authority
159
+
160
+
161
+ def project_context(
162
+ connection: sqlite3.Connection, *, data_root: Path, project_id: str, repository_id: str,
163
+ require_local_root: bool = True,
164
+ ) -> ParityProjectContext:
165
+ """The sole CENTRAL-to-parity construction path; no ambient project state."""
166
+ installation_id, authority = _context_rows(connection, project_id, repository_id)
167
+ binding = resolve_execution_repository(
168
+ connection, project_id=project_id, repository_id=repository_id, data_root=data_root
169
+ ) if require_local_root else None
170
+ return ParityProjectContext(
171
+ installation_id, data_root.resolve(), project_id, repository_id, authority,
172
+ binding.local_root if binding is not None else None,
173
+ )
174
+
175
+
176
+ def historical_candidate(
177
+ connection: sqlite3.Connection, *, context: ParityProjectContext, submission_id: str,
178
+ ) -> HistoricalCandidate:
179
+ """Adapt one canonical submission without allocating a run or dispatching it."""
180
+ row = connection.execute(
181
+ "SELECT project_id,repository_id,producer_id,producer_type,producer_version,transport,prompt,prompt_digest,"
182
+ "constraints,correlation_id,mission_id,engineering_action_id,state,admission "
183
+ "FROM ep_submissions WHERE submission_id=?", (submission_id,),
184
+ ).fetchone()
185
+ if row is None:
186
+ raise ParityContextError("UNKNOWN_SUBMISSION")
187
+ if str(row[0]) != context.project_id or str(row[1]) != context.repository_id:
188
+ raise ParityContextError("SUBMISSION_OUTSIDE_CONTEXT")
189
+ if tuple(map(str, row[12:14])) != ("QUEUED", "ADMITTED"):
190
+ raise ParityContextError("SUBMISSION_NOT_DISPATCHABLE")
191
+ try:
192
+ constraints = json.loads(str(row[8]))
193
+ except json.JSONDecodeError as error:
194
+ raise ParityContextError("SUBMISSION_CONSTRAINTS_INVALID") from error
195
+ if not isinstance(constraints, dict):
196
+ raise ParityContextError("SUBMISSION_CONSTRAINTS_INVALID")
197
+ mode = execution_mode_for(str(row[6]))
198
+ return HistoricalCandidate(
199
+ context, submission_id, str(row[6]), str(row[7]), str(row[2]), str(row[3]),
200
+ str(row[4]) if row[4] is not None else None, str(row[5]),
201
+ str(row[9]) if row[9] is not None else None, str(row[10]) if row[10] is not None else None,
202
+ str(row[11]) if row[11] is not None else None, constraints, mode,
203
+ )