Implement CommandLayer Python SDK with Ed25519 signing#37
Merged
Conversation
…udit - src/index.ts: remove console.warn, add VerifyResult return type to verify(), add CL_VERIFIER_URL note - src/trust.ts: tighten AJV error type from inline object to AJV ErrorObject - src/schemas.trust-receipt-v1.json: fix additionalProperties enforcement via inline allOf merge - examples/basic-agent.ts: replace hardcoded verifierUrl with env var, add guard for missing key - examples/wrapped-agent-demo.ts: add missing CL_PRIVATE_KEY_PEM guard - examples/full-demo.ts: remove dead proof.hash / proof.key_id references (fields do not exist) - examples/agent-to-agent-verify.ts: import dotenv/config for env var loading - examples/existing-agent-integration.ts: import dotenv/config for env var loading - examples/langchain-agent.ts: no changes needed (already has dotenv/config) - examples/openai-tool-wrapper.ts: import dotenv/config for env var loading - examples/workflow-job-runner.ts: import dotenv/config for env var loading - .env.example: add CL_VERIFIER_URL - python-sdk/commandlayer/__init__.py: replace empty stub with real implementation - python-sdk/pyproject.toml: update version and description, add cryptography dependency - python-sdk/README.md: replace placeholder with real usage docs - docs/examples.md: fix receipt shape example to match actual proof schema - README.md: remove stale npm caveat note
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a complete Python SDK for CommandLayer that enables agents to sign and verify action receipts using Ed25519 cryptography. The implementation mirrors the TypeScript SDK's functionality while following Python conventions.
Key Changes
Python SDK Implementation (
python-sdk/commandlayer/__init__.py):CommandLayerclass withwrap()method to execute functions, record metadata, and sign receipts with Ed25519verify()method to POST receipts to the CommandLayer verifier endpoint_canonicalize()) with sorted keys for deterministic signingcryptographydependency with helpful error messagessignerandagentparameters (agent takes precedence)Schema Updates (
src/schemas.trust-receipt-v1.json):allOfto direct property definitionskid(waskey_id),signer_id(wassigner),alg(wassignature_alg),canonical(wascanonicalization)additionalProperties: falsefor stricter validationDocumentation (
python-sdk/README.md):CommandLayer()constructor,wrap(), andverify()methodsTypeScript SDK Refinements:
VerifyResultinterface for type-safe verification responsesprivateKeyparameter warningconsole.log()withprocess.stdout.write()for cleaner output in examplesdotenv/configfor environment variable loadingProject Configuration:
python-sdk/pyproject.tomlwith version 1.0.0 and proper descriptioncryptodependency group for cryptography package.env.examplewithCL_VERIFIER_URLconfiguration optionImplementation Details
wrap()executionurllibwith 10-second timeouthttps://claude.ai/code/session_01GQcff5HnFcrTbyuwuvsNEv