Skip to content

Conversation

@zees-dev
Copy link
Collaborator

Description

Code refactor to put each module behind its respective feature flag.
This will imply that dependents of SDK can pull in specific modules without pulling in the full-sdk; this will reduce WASM size and also remove the dependency on host-functions are are not required by SDK based apps.

AI Description

This pull request introduces several significant changes to the project, including enhancements to the CI workflow, modularization of features in Cargo.toml, updates to example files, and refactoring of error handling across multiple modules.

The most important changes are grouped below by theme.

CI Workflow Enhancements

  • Added get-features and feature-matrix jobs to .github/workflows/ci.yaml for dynamically extracting features from Cargo.toml and testing each feature individually in a matrix strategy. This ensures comprehensive testing of feature combinations.

Modularization and Feature Management

  • Updated Cargo.toml to mark several dependencies (base64, htmd, kuchikiki, regex) as optional and restructured feature definitions to include new features (http, llm, bless-crawl, cgi, socket, memory, rpc). This modularizes the codebase and enables selective inclusion of functionality.
  • Refactored src/lib.rs to conditionally include modules based on enabled features, improving modularity and reducing unnecessary code inclusion.

Example File Updates

  • Updated example files (coingecko_oracle.rs, llm-mcp.rs, llm.rs, web-scrape.rs) to use specific feature-based imports (e.g., blockless_sdk::memory::read_stdin, blockless_sdk::llm::*, blockless_sdk::bless_crawl::*) instead of generic imports. This aligns examples with the new modular structure. [1] [2] [3] [4]

Error Handling Refactor

  • Removed centralized error definitions from src/error.rs and moved specific error types (CGIErrorKind, SocketErrorKind) to their respective modules (src/cgi.rs, src/socket.rs). This decentralizes error handling and improves code organization. [1] [2] [3]

Serialization Improvements

  • Simplified serde attribute usage in src/llm.rs by directly adding serde::Serialize and serde::Deserialize to relevant structs (BlocklessLlm, LlmOptions) without conditional compilation. This makes serialization more straightforward.

@zees-dev zees-dev merged commit 7c7e52e into main Jul 15, 2025
11 checks passed
@zees-dev zees-dev deleted the feat/feature-flags branch July 15, 2025 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants