#197 Apps: Implement AppContext SDK wrapper
Description
Edit## Parent Epic: #195
## Description
Create the AppContext class that wraps DurableContext with a simplified, app-developer-friendly interface.
## Location
engine/apps/sdk/context.py
## AppContext Class
### Properties
- metadata: AppMetadata (app_id, app_name, version, action_name, tenant_id, workflow_run_id, task_id)
- tenant_id: str
- workflow_run_id: str
- now: datetime (deterministic)
### Checkpointing
- checkpoint(step_name, func, *args, **kwargs) -> T
- Wraps ctx.step() with action-scoped step names
- Returns cached result on replay
### Configuration
- get_config(key, default=None) -> Any
- Dot notation support: 'api.timeout'
- Returns tenant-specific config
### Secrets
- get_secret(secret_name) -> str
- Loads from Vault via tenant installation
- Never logged
### HTTP Requests
- http_request(url, method, headers, json, timeout, checkpoint_name) -> dict
- Wraps tools.http.request with circuit breaker
- Optional checkpoint for idempotency
### Events
- emit_event(event_name, payload) -> None
- Scoped: app.{app_name}.{event_name}
- wait_for_event(step_name, event_name, timeout_seconds) -> dict
- Durable wait for external event
### Timing
- sleep(step_name, duration_seconds) -> None
- Durable sleep via ctx.sleep()
### State
- get_state(key, default=None) -> Any
- set_state(key, value) -> None
### Logging
- log(level, message, **extra)
- debug(), info(), warning(), error() convenience methods
## AppMetadata Dataclass
- app_id, app_name, version
- action_name, tenant_id
- workflow_run_id, task_id
## Testing
- Unit tests for each method
- Mock DurableContext for isolation
- Test checkpoint replay behavior
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...