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
16 changes: 8 additions & 8 deletions .github/workflows/sdk-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: SDK Lint
on:
pull_request:
paths:
- "sdk/**"
- "sdk/python/**"
- "scripts/**"
- ".github/workflows/sdk-lint.yml"

Expand All @@ -22,16 +22,16 @@ jobs:
with:
enable-cache: true
# Install into a repo-root .venv (same as `make sdk-install`), which
# is where sdk/pyrightconfig.json's `venvPath: ".."` expects it. A
# sdk/.venv (uv sync --project) would make basedpyright fail to find
# the venv and exit 3.
# is where sdk/python/pyrightconfig.json's `venvPath: "../.."` expects
# it. A sdk/python/.venv (uv sync --project) would make basedpyright
# fail to find the venv and exit 3.
- name: Install SDK + dev deps
run: |
uv venv
uv pip install -e "./sdk[dev]"
uv pip install -e "./sdk/python[dev]"
- name: Ruff format
run: .venv/bin/ruff format --check sdk scripts
run: .venv/bin/ruff format --check sdk/python scripts
- name: Ruff lint
run: .venv/bin/ruff check sdk scripts
run: .venv/bin/ruff check sdk/python scripts
- name: Basedpyright
run: .venv/bin/basedpyright -p sdk sdk/adrian
run: .venv/bin/basedpyright -p sdk/python sdk/python/adrian
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adrian pre-commit hooks. Run on every `git commit` once `pre-commit
# install` has been run from this repo's root (see CONTRIBUTING.md).
# Scoped to Python files under `sdk/` and `scripts/`.
# Scoped to Python files under `sdk/python/` and `scripts/`.

default_install_hook_types: [pre-commit]
default_language_version:
Expand All @@ -22,9 +22,9 @@ repos:
rev: v0.15.12
hooks:
- id: ruff-format
files: ^(sdk|scripts)/.*\.py$
files: ^(sdk/python|scripts)/.*\.py$
- id: ruff-check
files: ^(sdk|scripts)/.*\.py$
files: ^(sdk/python|scripts)/.*\.py$
args: [--fix]

- repo: local
Expand All @@ -34,6 +34,6 @@ repos:
entry: basedpyright
language: system
types: [python]
files: ^sdk/adrian/.*\.py$
files: ^sdk/python/adrian/.*\.py$
pass_filenames: false
args: [-p, sdk, sdk/adrian]
args: [-p, sdk/python, sdk/python/adrian]
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Thanks for considering a contribution. Adrian is open-source under the [Apache 2

## Local dev setup

The Python SDK lives at `sdk/`. From the repo root:
The Python SDK lives at `sdk/python/` (the TypeScript SDK lives at `sdk/typescript/`). From the repo root:

```sh
make sdk-install # creates .venv and installs sdk + dev deps via uv
Expand All @@ -31,7 +31,7 @@ pre-commit install # wires the git hook

After `pre-commit install`, every `git commit` runs the configured hooks on
staged files: `ruff format`, `ruff check --fix`, `basedpyright` on
`sdk/adrian/`, plus the standard whitespace / YAML / TOML checks. Hooks that
`sdk/python/adrian/`, plus the standard whitespace / YAML / TOML checks. Hooks that
modify files (formatter, autofix) leave the commit aborted; re-stage the files
and commit again.

Expand All @@ -42,7 +42,7 @@ pre-commit run --all-files
```

The config lives at [`.pre-commit-config.yaml`](.pre-commit-config.yaml).
Only Python files under `sdk/` and `scripts/` are in scope.
Only Python files under `sdk/python/` and `scripts/` are in scope.

## Style

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Adrian OSS — top-level developer Makefile
#
# Local-dev convention: every Python entry point goes through the
# project-local ``.venv`` so the bundled ``sdk/`` install (``pip
# install -e ./sdk``) cannot collide with a system-wide ``adrian-sdk``
# wheel from PyPI. ``make sdk-install`` creates the venv and the
# editable install in one shot.
# project-local ``.venv`` so the bundled ``sdk/python/`` install (``pip
# install -e ./sdk/python``) cannot collide with a system-wide
# ``adrian-sdk`` wheel from PyPI. ``make sdk-install`` creates the venv
# and the editable install in one shot.

.PHONY: sdk-install sdk-test sdk-clean help

Expand All @@ -16,18 +16,18 @@ ifndef UV
@exit 1
endif
uv venv --allow-existing
uv pip install -e ./sdk[dev]
uv pip install -e ./sdk/python[dev]
@echo ""
@echo "Adrian SDK installed in .venv. Activate with:"
@echo " source .venv/bin/activate"
@echo ""
@echo "Or run anything via uv: 'uv run python ...'"

sdk-test: ## Run the bundled SDK test suite
uv run --project ./sdk pytest sdk/tests
uv run --project ./sdk/python pytest sdk/python/tests

sdk-clean: ## Remove .venv and SDK build artefacts
rm -rf .venv sdk/.venv sdk/dist sdk/build sdk/*.egg-info
rm -rf .venv sdk/python/.venv sdk/python/dist sdk/python/build sdk/python/*.egg-info

help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
Expand Down
6 changes: 3 additions & 3 deletions backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ tidy:
clean:
rm -rf ./bin

# Sync proto/event.proto from the SDK's canonical copy and regenerate
# Sync proto/event.proto from the repo-root canonical copy and regenerate
# the Go bindings. Strips the buf.validate import and field annotations
# (see proto/README.md). Requires protoc + protoc-gen-go on PATH.
proto-sync:
@echo "Syncing proto/event.proto from sdk/adrian/proto/..."
@echo "Syncing proto/event.proto from ../proto/..."
@sed \
-e '/^import "buf\/validate\/validate.proto";$$/d' \
-e 's| \[(buf\.validate\.field)[^]]*\]||g' \
-e '/^package adrian\.core_api\.v1;$$/a\option go_package = "github.com/secureagentics/Adrian/backend/internal/proto;proto";' \
../sdk/adrian/proto/event.proto > proto/event.proto
../proto/event.proto > proto/event.proto
@$(MAKE) proto-regen

# Regenerate Go bindings from proto/event.proto.
Expand Down
6 changes: 3 additions & 3 deletions backend/proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The wire schema for SDK <-> backend WebSocket frames.

## Layout

- `event.proto` is the Go-side copy of the wire schema. The single source of truth is `sdk/adrian/proto/event.proto` at the repo root.
- `event.proto` is the Go-side copy of the wire schema. The single source of truth is `proto/event.proto` at the repo root.
- The Go-side copy is **stripped** of the `buf.validate` import and field annotations:
- The `import "buf/validate/validate.proto";` line is removed.
- Every `[(buf.validate.field).*]` annotation is removed.
Expand All @@ -15,8 +15,8 @@ The wire schema for SDK <-> backend WebSocket frames.

When the wire schema changes:

1. Edit `sdk/adrian/proto/event.proto` (the source of truth).
2. Regenerate the SDK's Python bindings: `cd sdk && uv run bash tools/regen-proto.sh`.
1. Edit `proto/event.proto` (the source of truth).
2. Regenerate the SDK's Python bindings: `cd sdk/python && uv run bash tools/regen-proto.sh`.
3. Sync the backend copy and regenerate the Go bindings: `cd backend && make proto-sync`.
4. Commit both.

Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions sdk/adrian/proto/buf.gen.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions sdk/adrian/proto/buf.lock

This file was deleted.

5 changes: 0 additions & 5 deletions sdk/adrian/proto/buf.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion sdk/pyrightconfig.json → sdk/python/pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"include": ["adrian", "tests"],
"exclude": ["**/__pycache__", "adrian/proto"],
"venvPath": "..",
"venvPath": "../..",
"venv": ".venv",
"pythonVersion": "3.12",
"pythonPlatform": "Linux",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 12 additions & 1 deletion sdk/tests/test_mcp.py → sdk/python/tests/test_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,23 @@ class TestRebindAcrossModules:
"""

def test_adapter_sessions_bindings_are_patched(self) -> None:
for attr in ("stdio_client", "streamablehttp_client", "sse_client"):
for attr in ("stdio_client", "sse_client"):
fn = getattr(adapter_sessions, attr, None)
assert fn is not None, f"{attr} not present in adapter sessions"
assert getattr(fn, "_adrian_mcp_patched", False), (
f"{attr} in langchain_mcp_adapters.sessions was not rebound"
)
http_names = [
name
for name in ("streamable_http_client", "streamablehttp_client")
if getattr(adapter_sessions, name, None) is not None
]
assert http_names, "no streamable-http client present in adapter sessions"
for name in http_names:
fn = getattr(adapter_sessions, name)
assert getattr(fn, "_adrian_mcp_patched", False), (
f"{name} in langchain_mcp_adapters.sessions was not rebound"
)


class TestPatchIdempotency:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ set -euo pipefail
SDK_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SDK_ROOT"

# Canonical proto lives at the repo-root proto/ (single source of truth);
# the generated bindings are committed under adrian/proto/.
PROTO_DIR="$(cd "$SDK_ROOT/../.." && pwd)/proto"

DEP_DIR="$(mktemp -d)"
trap 'rm -rf "$DEP_DIR"' EXIT

Expand Down Expand Up @@ -48,9 +52,9 @@ protoc \
--plugin=protoc-gen-mypy="$PLUGIN" \
--python_out=adrian/proto \
--mypy_out=adrian/proto \
-I adrian/proto \
-I "$PROTO_DIR" \
-I "$DEP_DIR" \
adrian/proto/event.proto
"$PROTO_DIR/event.proto"

# 5. Rewrite the protoc-generated `from buf.validate import ...` to a relative
# import, so the vendored stubs under adrian/proto/buf/validate/ resolve
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions sdk/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "adrian-typescript",
"private": true,
"description": "Adrian TypeScript SDK monorepo (npm workspaces).",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "npm run build --workspaces --if-present",
"typecheck": "npm run typecheck --workspaces --if-present",
"test": "npm run test --workspaces --if-present"
},
"devDependencies": {
"@types/node": "^25.9.1",
"tsup": "^8.5.1",
"typescript": "^6.0.3",
"vitest": "^4.1.7"
}
}
Empty file.
Empty file.
14 changes: 14 additions & 0 deletions sdk/typescript/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"lib": ["es2023"],
"strict": true,
"declaration": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"verbatimModuleSyntax": true
}
}
Loading