feat(sdk): context introspection — available_contexts and context_history #383

Open
opened 2026-03-03 23:02:18 +00:00 by forbes · 0 comments
Owner

Summary

Extend context introspection beyond current_context() so addons can list all registered contexts and query recent transition history.

Current state (PARTIAL)

current_context() works and returns a full snapshot (id, label, color, toolbars, breadcrumb, breadcrumbColors). Missing:

  • No available_contexts() to list registered contexts
  • No context_history() to get recent transitions
  • AddonRegistry.contexts() maps context IDs to providing addon names but is not exposed through the SDK

Proposed API

import kindred_sdk as sdk

sdk.available_contexts()
# -> [{"id": "sketcher.edit", "label_template": "...", "color": "#a6e3a1", "priority": 80}, ...]

sdk.context_history(limit=10)
# -> [{"id": "sketcher.edit", "timestamp": 1709500000.0, "duration_ms": 4500}, ...]

Implementation notes

  • available_contexts(): expose registered ContextDefinitions from EditingContextResolver via kcsdk binding
  • context_history(): add a ring buffer in EditingContextResolver that records transitions with timestamps
  • Add both to kindred_sdk/context.py
  • Enables patterns like "show a tip if the user just left sketcher.edit"

Roadmap

v0.2.0 — SDK Core

## Summary Extend context introspection beyond `current_context()` so addons can list all registered contexts and query recent transition history. ## Current state (PARTIAL) `current_context()` works and returns a full snapshot (id, label, color, toolbars, breadcrumb, breadcrumbColors). Missing: - No `available_contexts()` to list registered contexts - No `context_history()` to get recent transitions - `AddonRegistry.contexts()` maps context IDs to providing addon names but is not exposed through the SDK ## Proposed API ```python import kindred_sdk as sdk sdk.available_contexts() # -> [{"id": "sketcher.edit", "label_template": "...", "color": "#a6e3a1", "priority": 80}, ...] sdk.context_history(limit=10) # -> [{"id": "sketcher.edit", "timestamp": 1709500000.0, "duration_ms": 4500}, ...] ``` ## Implementation notes - `available_contexts()`: expose registered ContextDefinitions from EditingContextResolver via kcsdk binding - `context_history()`: add a ring buffer in EditingContextResolver that records transitions with timestamps - Add both to `kindred_sdk/context.py` - Enables patterns like "show a tip if the user just left sketcher.edit" ## Roadmap v0.2.0 — SDK Core
forbes added the enhancement label 2026-03-03 23:02:18 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/create#383