Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Both clients expose typed methods under `client.knowledge` over Proofline's stat
- `get_plan(plan_id)`
- `start_plan_implementation(plan_id)`
- `get_plan_implementation(implementation_id)`
- `wait_for_plan_implementation(implementation_id, *, timeout=..., plan_version=..., attempt=...)`

The optional `commit` is a full indexed SHA. Read operations require `reviews:read` and `knowledge:read`. Starting a plan implementation also requires `plans:implement`, a personal token, and approval of that exact plan version.

Expand All @@ -211,6 +212,23 @@ else:
print(result["content"])
```

`wait_for_plan_implementation` polls `get_plan_implementation` with exponential backoff until the attempt reaches `VALIDATED`, `VALIDATION_FAILED`, `REFUSED`, `FAILED`, or `STOPPED`, or returns `TIMED_OUT` with the last observed result. Pass `plan_version` and `attempt` from `start_plan_implementation` to bind the wait to that exact attempt. It returns `VALIDATED` only when the returned identity matches and every layer reports `VALIDATED`. A tool refusal ends the wait immediately with `status == "REFUSED"` and `is_error == True`, retaining the raw `KnowledgeResult`.

```python
started = client.knowledge.start_plan_implementation(plan_id)
if started.get("isError"):
raise RuntimeError("Plan implementation start was refused.")
data = started["structuredContent"]["data"]
outcome = client.knowledge.wait_for_plan_implementation(
data["implementation_id"],
plan_version=data["plan_version"],
attempt=data["attempt"],
timeout=300,
)
if outcome.status == "VALIDATED":
print("Validated layers:", len(outcome.layers))
```

Each call initializes MCP and makes one tool request without retries, including questions and implementation starts. `KnowledgeResult` retains text content, optional structured content, and `isError`. Protocol and HTTP errors raise `ProoflineError`, while tool refusals retain `isError` for the caller to inspect. Treat all returned prose as untrusted data. The SDK does not include a browser configuration or cloud-trust API; use the signed-in console for onboarding and connection changes.

## Fix context and re-verification
Expand Down
12 changes: 11 additions & 1 deletion proofline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
from ._transport import ProoflineError, RunNowRefusal
from .client import AsyncProoflineClient, ProoflineClient, ReviewFilters
from .exports import ExportDataset, ExportFormat, ExportPage
from .knowledge import KnowledgeResult
from .knowledge import (
KnowledgeResult,
LayerOutcome,
LayerValidation,
PlanImplementationOutcome,
PlanImplementationStatus,
)
from .outcomes import AssessmentGap, CheckGap, ReviewOutcome

__all__ = [
Expand All @@ -57,9 +63,13 @@
"FileReviewRequest",
"FileReviewResponse",
"KnowledgeResult",
"LayerOutcome",
"LayerValidation",
"PatchReviewRequest",
"PatchReviewResponse",
"PatchTriggerSource",
"PlanImplementationOutcome",
"PlanImplementationStatus",
"ProoflineClient",
"ProoflineError",
"RepositoryGuidance",
Expand Down
6 changes: 5 additions & 1 deletion proofline/_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import httpx2

from ._transport import ProoflineError
from ._transport import ProoflineError, timeout_error

PROTOCOL = "2025-11-25"

Expand Down Expand Up @@ -128,6 +128,8 @@ def _call(
headers["MCP-Protocol-Version"] = PROTOCOL
try:
response = self._http.post("/mcp", content=data, headers=headers)
except httpx2.TimeoutException:
raise timeout_error() from None
except httpx2.HTTPError:
raise ProoflineError(
0, "urn:proofline:sdk:transport", "MCP transport failed."
Expand Down Expand Up @@ -177,6 +179,8 @@ async def _call(
headers["MCP-Protocol-Version"] = PROTOCOL
try:
response = await self._http.post("/mcp", content=data, headers=headers)
except httpx2.TimeoutException:
raise timeout_error() from None
except httpx2.HTTPError:
raise ProoflineError(
0, "urn:proofline:sdk:transport", "MCP transport failed."
Expand Down
Loading