Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- run: pip install build

- run: |
rm -r src/synapt_extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt_extract/prompts || true
rm -r src/synapt/extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt/extract/prompts || true

- run: python -m build

Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

- name: Verify Python package schemas match root schemas
run: |
diff -r schemas packages/python/src/synapt_extract/schemas
diff -r schemas packages/python/src/synapt/extract/schemas
echo "✅ Python package schemas match root schemas"

schema-url-check:
Expand Down Expand Up @@ -205,8 +205,8 @@ jobs:
SOURCE_DATE_EPOCH: "1704067200"
run: |
pip install build
rm -r src/synapt_extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt_extract/prompts || true
rm -r src/synapt/extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt/extract/prompts || true
python -m build --outdir /tmp/py-dist-1
rm -r src/synapt_extract.egg-info build 2>/dev/null || true
python -m build --outdir /tmp/py-dist-2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- run: pip install build

- run: |
rm -r src/synapt_extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt_extract/prompts || true
rm -r src/synapt/extract/prompts 2>/dev/null || true
test -d ../../prompts && cp -r ../../prompts src/synapt/extract/prompts || true

- run: python -m build

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dist/
!tests/security-probes/**/*.js

packages/ts/prompts/
packages/python/src/synapt_extract/prompts/
packages/python/src/synapt/extract/prompts/

__pycache__/
*.pyc
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v0.6.0

Temporal validity role + resolution anchor — additive Stage-1 IL enrichment (config/design/extract-temporal-role-2026-07-14.md). `synapt-extract` (PyPI) bumps to 0.6.0. `@synapt-dev/extract` (npm) carries the same additive-role parity but keeps its version at 0.5.0 for now — the npm version-sync is part of the deferred full-parity effort, not this additive-role slice.

- Added `role` (`effective` | `expiry` | `range` | `superseded` | `point`) to the temporal-ref schema, capturing the validity DIRECTION a date constrains (e.g. "expires April 30" → `expiry`, vs "effective March 2026" → `effective`) — a semantic distinction the source sentence carries but prior extraction dropped
- `role` and `resolved_end` are now BASE-tier on the `temporal_refs` capability (no longer gated behind the separate `temporal_classes` capability) — always available to any caller requesting `temporal_refs`; `type`/`context` remain `temporal_classes`-gated
- `BatchUnit` gained an optional `date` field — the unit's SOURCE date, threaded into Stage-1 as the temporal resolution anchor so partial/relative dates (e.g. "April 30") resolve against the fact's actual source year, not an unanchored guess
- The exported `SynaptTemporalRef` type declares `role` in both Python (`TypedDict`) and TypeScript (`interface`), so the public type matches the runtime emission
- Fixed a prompt-rendering gap where an absent `date` param rendered the literal string "Resolve relative dates using: None." instead of omitting the instruction (wrapped in `{{#if date}}`; supported identically by both prompt renderers)
- `_detect_capabilities`'s `temporal_classes` heuristic now keys on `type` presence only (`resolved_end` no longer implies the gated capability was exercised, since it moved to base tier)
- Published JSON schema (`schemas/temporal-ref/v1.json`, both the repo-root canonical copy and the Python package copy) updated to match — schema-drift-check green
- **ts/py parity — the additive `role` coherence slice IS included** (`@synapt-dev/extract` TypeScript): `schema.ts` types `role`, `builder.ts` emits `role`/`resolved_end` base-tier, `validate.ts` accepts/enum-validates `role` (+ `role === "range"` → `resolved_end`), `finalize.ts` drops the `resolved_end` inference, and the embedded prompt fragment matches the shared file byte-for-byte. TS and Python produce identical schema/validation/finalize output on the same inputs (verified cross-language). The FULL parity effort (a TS `extract_batch`/`batch.ts` port + version-sync) remains the post-validation follow-up per config/design/extract-ts-py-parity-plan-2026-07-15.md — this release only carries the additive-role coherence needed to keep the shared prompt/schema surface consistent.

## v0.5.0

0.5.0 universal host-boundary groundwork.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ console.log(result.validation); // { valid: true, errors: [] }
### Python

```python
from synapt_extract import (
from synapt.extract import (
build_extraction_prompt,
finalize_extraction,
FinalizeContext,
Expand Down Expand Up @@ -124,7 +124,7 @@ const built = builder.build({ name: "synapt_extract_stage1" });
### Python

```python
from synapt_extract import create_extraction_builder
from synapt.extract import create_extraction_builder

builder = (
create_extraction_builder(text, profile="standard")
Expand Down Expand Up @@ -173,7 +173,7 @@ const result = await extractOpenAI(text, new OpenAI(), {

```python
from openai import OpenAI
from synapt_extract import create_extraction_builder, extract_openai
from synapt.extract import create_extraction_builder, extract_openai

builder = (
create_extraction_builder(text)
Expand All @@ -192,7 +192,7 @@ result = await extract_openai(
)
```

The returned result includes `artifactBundle` / `artifact_bundle`. TypeScript exports the Node artifact writer at `@synapt-dev/extract/artifacts`; Python exports `write_artifact_bundle()` from `synapt_extract`.
The returned result includes `artifactBundle` / `artifact_bundle`. TypeScript exports the Node artifact writer at `@synapt-dev/extract/artifacts`; Python exports `write_artifact_bundle()` from `synapt.extract`.

```typescript
import { createExtractionBuilder, extract } from "@synapt-dev/extract";
Expand Down Expand Up @@ -227,7 +227,7 @@ const result = await extract(text, {
```

```python
from synapt_extract import create_extraction_builder, extract
from synapt.extract import create_extraction_builder, extract

builder = (
create_extraction_builder(text)
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ sha256sum *.tgz

# Python (wheel)
cd packages/python
cp -r ../../prompts src/synapt_extract/prompts
cp -r ../../schemas src/synapt_extract/schemas
cp -r ../../prompts src/synapt/extract/prompts
cp -r ../../schemas src/synapt/extract/schemas
SOURCE_DATE_EPOCH=1704067200 python -m build
sha256sum dist/*.whl
```
Expand Down
6 changes: 3 additions & 3 deletions examples/dogfood.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "packages" / "python" / "src"))

import anthropic
from synapt_extract.prompt import build_extraction_prompt
from synapt_extract.finalize import FinalizeContext, finalize_extraction
from synapt_extract.validate import validate_extraction
from synapt.extract.prompt import build_extraction_prompt
from synapt.extract.finalize import FinalizeContext, finalize_extraction
from synapt.extract.validate import validate_extraction

CONVERSATION = """\
Session: Weekly check-in with Marcus, April 22, 2026
Expand Down
8 changes: 4 additions & 4 deletions packages/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pip install synapt-extract
## Quick start

```python
from synapt_extract import (
from synapt.extract import (
build_extraction_prompt,
finalize_extraction,
FinalizeContext,
Expand Down Expand Up @@ -50,7 +50,7 @@ assert result.validation.valid
Use the builder when the model API supports structured output. It resolves capabilities once, then builds the matching prompt, Stage 1 JSON schema, OpenAI response format, finalized packet schema, and optional finalization context.

```python
from synapt_extract import create_extraction_builder
from synapt.extract import create_extraction_builder

builder = (
create_extraction_builder(text, profile="standard")
Expand Down Expand Up @@ -81,7 +81,7 @@ For OpenAI-compatible clients, use the thin adapter instead of writing callbacks

```python
from openai import OpenAI
from synapt_extract import create_extraction_builder, extract_openai
from synapt.extract import create_extraction_builder, extract_openai

builder = (
create_extraction_builder(text)
Expand All @@ -103,7 +103,7 @@ result = await extract_openai(
The returned result includes `artifact_bundle`. `write_artifact_bundle()` can also write a bundle created from any `extract()` result.

```python
from synapt_extract import create_extraction_builder, extract
from synapt.extract import create_extraction_builder, extract

builder = (
create_extraction_builder(text)
Expand Down
8 changes: 4 additions & 4 deletions packages/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "synapt-extract"
version = "0.5.0"
version = "0.6.0"
description = "SynaptExtraction IL v1 -- schema, validation, and finalization"
readme = "README.md"
license = "MIT"
Expand All @@ -21,17 +21,17 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries",
"Typing :: Typed",
]

[project.urls]
Homepage = "https://synapt.dev"
Repository = "https://github.com/synapt-dev/extract"
Documentation = "https://synapt.dev/docs/extract"
Documentation = "https://synapt.dev/schemas/"
Schema = "https://synapt.dev/schemas/extract/v1.json"

[tool.setuptools.packages.find]
where = ["src"]
namespaces = true

[tool.setuptools.package-data]
synapt_extract = ["prompts/**/*.txt", "prompts/**/*.json", "schemas/**/*.json"]
"synapt.extract" = ["prompts/**/*.txt", "prompts/**/*.json", "schemas/**/*.json"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""synapt-extract: SynaptExtraction IL v1 schema, validation, and finalization."""

from synapt_extract.schema import (
from synapt.extract.schema import (
SynaptExtraction,
SynaptEntity,
SynaptGoal,
Expand All @@ -16,9 +16,9 @@
SynaptAssertionSignals,
SynaptTemporalRef,
)
from synapt_extract.validate import validate_extraction, ValidationResult, ValidationError
from synapt_extract.finalize import finalize_extraction, FinalizeContext, FinalizeResult
from synapt_extract.prompt import (
from synapt.extract.validate import validate_extraction, ValidationResult, ValidationError
from synapt.extract.finalize import finalize_extraction, FinalizeContext, FinalizeResult
from synapt.extract.prompt import (
build_extraction_prompt,
capability_embedding_input,
profile_capabilities,
Expand All @@ -27,14 +27,14 @@
CAPABILITY_REGISTRY,
STANDARD_EMBEDDING_INPUTS,
)
from synapt_extract.builder import (
from synapt.extract.builder import (
ExtractionBuilder,
build_finalized_extraction_schema,
build_extraction_schema,
build_extraction_response_format,
create_extraction_builder,
)
from synapt_extract.extract import (
from synapt.extract.extract import (
extract,
normalize_llm_response,
run_extraction,
Expand All @@ -52,15 +52,22 @@
NormalizedLlmResponse,
UsageSummary,
)
from synapt_extract.artifacts import (
from synapt.extract.artifacts import (
create_artifact_bundle,
sha256_text,
write_artifact_bundle,
)
from synapt_extract.openai import (
from synapt.extract.openai import (
extract_openai,
OpenAIExtractResult,
)
from synapt.extract.batch import (
BatchFailureReason,
BatchInferRequest,
BatchUnit,
BatchUnitResult,
extract_batch,
)

__all__ = [
"SynaptExtraction",
Expand Down Expand Up @@ -116,4 +123,9 @@
"write_artifact_bundle",
"extract_openai",
"OpenAIExtractResult",
"BatchFailureReason",
"BatchInferRequest",
"BatchUnit",
"BatchUnitResult",
"extract_batch",
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path
from typing import Any

from synapt_extract.extract import ExtractResult
from synapt.extract.extract import ExtractResult


JsonObject = dict[str, Any]
Expand Down
Loading
Loading