dap-engine 0.3.0__tar.gz
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.
- dap_engine-0.3.0/.gitignore +87 -0
- dap_engine-0.3.0/PKG-INFO +49 -0
- dap_engine-0.3.0/README.md +28 -0
- dap_engine-0.3.0/pyproject.toml +38 -0
- dap_engine-0.3.0/src/dap_engine/__init__.py +3 -0
- dap_engine-0.3.0/src/dap_engine/__main__.py +80 -0
- dap_engine-0.3.0/src/dap_engine/api/__init__.py +0 -0
- dap_engine-0.3.0/src/dap_engine/api/agents.py +546 -0
- dap_engine-0.3.0/src/dap_engine/api/deps.py +60 -0
- dap_engine-0.3.0/src/dap_engine/api/health.py +20 -0
- dap_engine-0.3.0/src/dap_engine/api/pipelines.py +428 -0
- dap_engine-0.3.0/src/dap_engine/api/projects.py +191 -0
- dap_engine-0.3.0/src/dap_engine/api/runs.py +694 -0
- dap_engine-0.3.0/src/dap_engine/api/runtimes.py +29 -0
- dap_engine-0.3.0/src/dap_engine/api/schemas.py +331 -0
- dap_engine-0.3.0/src/dap_engine/api/settings.py +288 -0
- dap_engine-0.3.0/src/dap_engine/app.py +438 -0
- dap_engine-0.3.0/src/dap_engine/auth/__init__.py +23 -0
- dap_engine-0.3.0/src/dap_engine/auth/admin_users_routes.py +134 -0
- dap_engine-0.3.0/src/dap_engine/auth/api_token_routes.py +345 -0
- dap_engine-0.3.0/src/dap_engine/auth/api_tokens.py +147 -0
- dap_engine-0.3.0/src/dap_engine/auth/audit.py +91 -0
- dap_engine-0.3.0/src/dap_engine/auth/audit_routes.py +125 -0
- dap_engine-0.3.0/src/dap_engine/auth/db.py +135 -0
- dap_engine-0.3.0/src/dap_engine/auth/oauth.py +41 -0
- dap_engine-0.3.0/src/dap_engine/auth/policies.py +64 -0
- dap_engine-0.3.0/src/dap_engine/auth/schemas.py +37 -0
- dap_engine-0.3.0/src/dap_engine/auth/users.py +400 -0
- dap_engine-0.3.0/src/dap_engine/contracts.py +205 -0
- dap_engine-0.3.0/src/dap_engine/execution/__init__.py +30 -0
- dap_engine-0.3.0/src/dap_engine/execution/conditions.py +87 -0
- dap_engine-0.3.0/src/dap_engine/execution/node_executor.py +363 -0
- dap_engine-0.3.0/src/dap_engine/execution/output_parser.py +162 -0
- dap_engine-0.3.0/src/dap_engine/execution/run_orchestrator.py +213 -0
- dap_engine-0.3.0/src/dap_engine/execution/run_registry.py +158 -0
- dap_engine-0.3.0/src/dap_engine/execution/runner.py +422 -0
- dap_engine-0.3.0/src/dap_engine/execution/validator.py +580 -0
- dap_engine-0.3.0/src/dap_engine/persistence/__init__.py +0 -0
- dap_engine-0.3.0/src/dap_engine/persistence/_common.py +24 -0
- dap_engine-0.3.0/src/dap_engine/persistence/agents.py +410 -0
- dap_engine-0.3.0/src/dap_engine/persistence/db.py +179 -0
- dap_engine-0.3.0/src/dap_engine/persistence/migrations.py +739 -0
- dap_engine-0.3.0/src/dap_engine/persistence/models.py +569 -0
- dap_engine-0.3.0/src/dap_engine/persistence/pipelines.py +328 -0
- dap_engine-0.3.0/src/dap_engine/persistence/projects.py +256 -0
- dap_engine-0.3.0/src/dap_engine/persistence/repository.py +101 -0
- dap_engine-0.3.0/src/dap_engine/persistence/runs.py +482 -0
- dap_engine-0.3.0/src/dap_engine/py.typed +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# --- Python ---
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
env/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
*.egg
|
|
12
|
+
dist/
|
|
13
|
+
build/
|
|
14
|
+
.eggs/
|
|
15
|
+
pip-log.txt
|
|
16
|
+
pip-delete-this-directory.txt
|
|
17
|
+
|
|
18
|
+
# uv
|
|
19
|
+
.uv-cache/
|
|
20
|
+
|
|
21
|
+
# Type checkers / linters
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
.ruff_cache/
|
|
24
|
+
.pyright/
|
|
25
|
+
.pytype/
|
|
26
|
+
|
|
27
|
+
# pytest / coverage
|
|
28
|
+
.pytest_cache/
|
|
29
|
+
.coverage
|
|
30
|
+
.coverage.*
|
|
31
|
+
htmlcov/
|
|
32
|
+
.tox/
|
|
33
|
+
.nox/
|
|
34
|
+
coverage.xml
|
|
35
|
+
*.cover
|
|
36
|
+
|
|
37
|
+
# --- Node (dashboard) ---
|
|
38
|
+
node_modules/
|
|
39
|
+
.pnpm-store/
|
|
40
|
+
.next/
|
|
41
|
+
out/
|
|
42
|
+
*.tsbuildinfo
|
|
43
|
+
.turbo/
|
|
44
|
+
|
|
45
|
+
# --- Environment ---
|
|
46
|
+
.env
|
|
47
|
+
.env.local
|
|
48
|
+
.env.*.local
|
|
49
|
+
|
|
50
|
+
# --- DAP local state ---
|
|
51
|
+
.dap/
|
|
52
|
+
*.db
|
|
53
|
+
*.db-journal
|
|
54
|
+
*.db-wal
|
|
55
|
+
*.db-shm
|
|
56
|
+
|
|
57
|
+
# --- Logs ---
|
|
58
|
+
logs/
|
|
59
|
+
*.log
|
|
60
|
+
npm-debug.log*
|
|
61
|
+
pnpm-debug.log*
|
|
62
|
+
|
|
63
|
+
# --- IDE / Agents ---
|
|
64
|
+
.vscode/
|
|
65
|
+
.idea/
|
|
66
|
+
*.swp
|
|
67
|
+
*.swo
|
|
68
|
+
.claude/
|
|
69
|
+
|
|
70
|
+
# --- OS ---
|
|
71
|
+
.DS_Store
|
|
72
|
+
Thumbs.db
|
|
73
|
+
|
|
74
|
+
# --- Cache ---
|
|
75
|
+
.cache/
|
|
76
|
+
.eslintcache
|
|
77
|
+
|
|
78
|
+
# --- Built artefacts ---
|
|
79
|
+
# Dashboard bundle staged into the dap-cli wheel by
|
|
80
|
+
# scripts/build-dashboard-bundle.sh — regenerated on demand from
|
|
81
|
+
# apps/dashboard/.next. The ``.gitkeep`` is retained so hatchling's
|
|
82
|
+
# ``force-include`` always finds the directory; dev wheels built
|
|
83
|
+
# without running the bundle script ship an effectively-empty
|
|
84
|
+
# ``_dashboard/`` and ``dap start`` falls back to "dashboard not
|
|
85
|
+
# bundled".
|
|
86
|
+
apps/cli/src/dap_cli/_dashboard/*
|
|
87
|
+
!apps/cli/src/dap_cli/_dashboard/.gitkeep
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dap-engine
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: DAP engine — FastAPI + LangGraph + SQLAlchemy + SQLite / PostgreSQL
|
|
5
|
+
Requires-Python: >=3.13
|
|
6
|
+
Requires-Dist: alembic>=1.13.3
|
|
7
|
+
Requires-Dist: anyio>=4.6.0
|
|
8
|
+
Requires-Dist: dap-prompt-dsl
|
|
9
|
+
Requires-Dist: dap-runtimes
|
|
10
|
+
Requires-Dist: dap-schemas
|
|
11
|
+
Requires-Dist: fastapi-users[oauth,sqlalchemy]>=15.0.5
|
|
12
|
+
Requires-Dist: fastapi>=0.115.0
|
|
13
|
+
Requires-Dist: langgraph-checkpoint-postgres>=2.0
|
|
14
|
+
Requires-Dist: langgraph-checkpoint-sqlite>=2.0.0
|
|
15
|
+
Requires-Dist: langgraph>=0.2.50
|
|
16
|
+
Requires-Dist: psycopg[binary,pool]>=3.2
|
|
17
|
+
Requires-Dist: pydantic>=2.9.2
|
|
18
|
+
Requires-Dist: sqlalchemy>=2.0.36
|
|
19
|
+
Requires-Dist: uvicorn[standard]>=0.32.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# dap-engine
|
|
23
|
+
|
|
24
|
+
FastAPI + SQLAlchemy 2.0 + SQLite (WAL mode). LangGraph integration w F5.
|
|
25
|
+
|
|
26
|
+
## Endpoints (F0)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
GET /health → service status
|
|
30
|
+
GET /runtimes → list of registered adapters
|
|
31
|
+
GET /runtimes/{id}/health → per-adapter healthcheck
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Run standalone
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv run dap-engine
|
|
38
|
+
# default: 127.0.0.1:7333, db: ./.dap/state.db
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Migrations
|
|
42
|
+
|
|
43
|
+
W F0 schema jest tworzona automatycznie przy starcie engine'u przez
|
|
44
|
+
`Base.metadata.create_all(engine)` (dev mode).
|
|
45
|
+
|
|
46
|
+
Pełne Alembic-based migrations są **planowane na późniejszą iterację**. Repo nie
|
|
47
|
+
zawiera jeszcze scaffoldu Alembic (`alembic.ini`, `alembic/env.py`), więc
|
|
48
|
+
komendy `alembic revision` / `alembic upgrade` nie będą działać dopóki ten
|
|
49
|
+
config nie zostanie dodany.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# dap-engine
|
|
2
|
+
|
|
3
|
+
FastAPI + SQLAlchemy 2.0 + SQLite (WAL mode). LangGraph integration w F5.
|
|
4
|
+
|
|
5
|
+
## Endpoints (F0)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
GET /health → service status
|
|
9
|
+
GET /runtimes → list of registered adapters
|
|
10
|
+
GET /runtimes/{id}/health → per-adapter healthcheck
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Run standalone
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv run dap-engine
|
|
17
|
+
# default: 127.0.0.1:7333, db: ./.dap/state.db
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Migrations
|
|
21
|
+
|
|
22
|
+
W F0 schema jest tworzona automatycznie przy starcie engine'u przez
|
|
23
|
+
`Base.metadata.create_all(engine)` (dev mode).
|
|
24
|
+
|
|
25
|
+
Pełne Alembic-based migrations są **planowane na późniejszą iterację**. Repo nie
|
|
26
|
+
zawiera jeszcze scaffoldu Alembic (`alembic.ini`, `alembic/env.py`), więc
|
|
27
|
+
komendy `alembic revision` / `alembic upgrade` nie będą działać dopóki ten
|
|
28
|
+
config nie zostanie dodany.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dap-engine"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "DAP engine — FastAPI + LangGraph + SQLAlchemy + SQLite / PostgreSQL"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"dap-schemas",
|
|
9
|
+
"dap-runtimes",
|
|
10
|
+
"dap-prompt-dsl",
|
|
11
|
+
"fastapi>=0.115.0",
|
|
12
|
+
"uvicorn[standard]>=0.32.0",
|
|
13
|
+
"sqlalchemy>=2.0.36",
|
|
14
|
+
"alembic>=1.13.3",
|
|
15
|
+
"pydantic>=2.9.2",
|
|
16
|
+
"anyio>=4.6.0",
|
|
17
|
+
"langgraph>=0.2.50",
|
|
18
|
+
"langgraph-checkpoint-sqlite>=2.0.0",
|
|
19
|
+
# PostgreSQL backend (optional — only used when DAP_DATABASE_URL points to pg)
|
|
20
|
+
"psycopg[binary,pool]>=3.2",
|
|
21
|
+
"langgraph-checkpoint-postgres>=2.0",
|
|
22
|
+
# Auth (v0.3 — see #299).
|
|
23
|
+
# `fastapi-users[sqlalchemy]` pulls aiosqlite already; the `oauth`
|
|
24
|
+
# extra adds httpx-oauth for the GitHub + Google providers wired in
|
|
25
|
+
# the OAuth sub-PR. Explicit pin so `--frozen` installs catch
|
|
26
|
+
# breaking minor bumps in pre-commit hooks.
|
|
27
|
+
"fastapi-users[sqlalchemy,oauth]>=15.0.5",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
dap-engine = "dap_engine.__main__:main"
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["hatchling"]
|
|
35
|
+
build-backend = "hatchling.build"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/dap_engine"]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Standalone entrypoint: `uv run dap-engine` lub `python -m dap_engine`."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
import uvicorn
|
|
9
|
+
|
|
10
|
+
from dap_engine.app import EngineConfig, create_app, parse_cors_origins
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> None:
|
|
14
|
+
logging.basicConfig(
|
|
15
|
+
level=logging.INFO,
|
|
16
|
+
format="%(asctime)s %(levelname)-7s %(name)s | %(message)s",
|
|
17
|
+
datefmt="%H:%M:%S",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
config = EngineConfig(
|
|
21
|
+
db_path=os.environ.get("DAP_DB_PATH", "./.dap/state.db"),
|
|
22
|
+
# DAP_DATABASE_URL overrides db_path when set.
|
|
23
|
+
# postgresql+asyncpg://user:pass@host:port/db → PostgreSQL backend
|
|
24
|
+
# Leave unset to keep SQLite (default for local dev).
|
|
25
|
+
database_url=os.environ.get("DAP_DATABASE_URL"),
|
|
26
|
+
host=os.environ.get("DAP_ENGINE_HOST", "127.0.0.1"),
|
|
27
|
+
port=int(os.environ.get("DAP_ENGINE_PORT", "7333")),
|
|
28
|
+
dry_run_budget_usd=float(os.environ.get("DAP_DRY_RUN_BUDGET_USD", "0.50")),
|
|
29
|
+
# PG checkpointer pool sizing — only used when DAP_DATABASE_URL is set.
|
|
30
|
+
pg_pool_min_size=int(os.environ.get("DAP_PG_POOL_MIN_SIZE", "4")),
|
|
31
|
+
pg_pool_max_size=int(os.environ.get("DAP_PG_POOL_MAX_SIZE", "10")),
|
|
32
|
+
# Comma-separated CORS allow-list — None falls back to the local-dev
|
|
33
|
+
# default in EngineConfig (#259).
|
|
34
|
+
cors_origins=parse_cors_origins(os.environ.get("DAP_CORS_ORIGINS")),
|
|
35
|
+
# Auth (#299). When unset, the lifespan generates a per-process
|
|
36
|
+
# random — fine for a single-instance local dev, but multi-worker
|
|
37
|
+
# / multi-replica deployments MUST set DAP_AUTH_JWT_SECRET so all
|
|
38
|
+
# workers validate tokens against the same key.
|
|
39
|
+
auth_jwt_secret=os.environ.get("DAP_AUTH_JWT_SECRET"),
|
|
40
|
+
auth_access_ttl_seconds=int(os.environ.get("DAP_AUTH_ACCESS_TTL_SECONDS", "900")),
|
|
41
|
+
# Reset-token logging — opt-in dev convenience documented on
|
|
42
|
+
# ``EngineConfig.auth_log_reset_tokens``. Off unless the env
|
|
43
|
+
# var is set to a truthy string. The /admin/settings page
|
|
44
|
+
# surfaces the resulting value with an amber warning when it's
|
|
45
|
+
# on.
|
|
46
|
+
auth_log_reset_tokens=os.environ.get("DAP_AUTH_LOG_RESET_TOKENS", "").strip().lower()
|
|
47
|
+
in ("1", "true", "yes", "on"),
|
|
48
|
+
# When set, OAuth callbacks redirect the browser here with the
|
|
49
|
+
# JWT in ``?token=`` instead of returning JSON (#300, sub-B5).
|
|
50
|
+
# The dashboard's ``/api/auth/oauth/callback`` reads it and
|
|
51
|
+
# promotes it to an httpOnly cookie.
|
|
52
|
+
#
|
|
53
|
+
# Normalise blank / whitespace-only values to ``None`` — an
|
|
54
|
+
# operator who exports the var but leaves it empty would
|
|
55
|
+
# otherwise hand fastapi-users an invalid empty redirect_url
|
|
56
|
+
# (Copilot review on PR #326).
|
|
57
|
+
auth_oauth_redirect_url=(os.environ.get("DAP_AUTH_OAUTH_REDIRECT_URL", "").strip() or None),
|
|
58
|
+
# OAuth (#299, sub-A2). Each provider activates only when both
|
|
59
|
+
# client_id and client_secret are set; missing or partially-set
|
|
60
|
+
# credentials are ignored without a startup error so a self-host
|
|
61
|
+
# install can run with email+password only.
|
|
62
|
+
oauth_github_client_id=os.environ.get("DAP_OAUTH_GITHUB_CLIENT_ID"),
|
|
63
|
+
oauth_github_client_secret=os.environ.get("DAP_OAUTH_GITHUB_CLIENT_SECRET"),
|
|
64
|
+
oauth_google_client_id=os.environ.get("DAP_OAUTH_GOOGLE_CLIENT_ID"),
|
|
65
|
+
oauth_google_client_secret=os.environ.get("DAP_OAUTH_GOOGLE_CLIENT_SECRET"),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
app = create_app(config)
|
|
69
|
+
|
|
70
|
+
uvicorn.run(
|
|
71
|
+
app,
|
|
72
|
+
host=config.host,
|
|
73
|
+
port=config.port,
|
|
74
|
+
log_level="info",
|
|
75
|
+
access_log=False,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
main()
|
|
File without changes
|