* feat: add generic CalDAV calendar data source
Add @aris/source-caldav package that fetches calendar events from any
CalDAV server via tsdav + ical.js.
- Supports Basic auth and OAuth via explicit authMethod discriminant
- serverUrl provided at construction time, not hardcoded
- Optional timeZone for correct local day boundaries
- Credentials cleared from memory after client login
- Failed calendar fetches logged, not silently dropped
- Login promise cached with retry on failure
Co-authored-by: Ona <no-reply@ona.com>
* fix: deduplicate concurrent fetchEvents calls
Co-authored-by: Ona <no-reply@ona.com>
* fix: timezone-aware signals, low-priority cancelled events
- computeSignals uses startOfDay(timeZone) for 'later today' boundary
- Cancelled events get urgency 0.1, excluded from context inProgress/nextEvent
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
* feat: add post-processor pipeline to FeedEngine
Add FeedPostProcessor type and FeedEnhancement interface.
Post-processors run after item collection on all update
paths (refresh, reactive context, reactive items).
Pipeline is chained — each processor sees items as modified
by the previous one. Enhancement merging handles additional
items, suppression, and grouped items. Throwing processors
are caught and recorded in FeedResult.errors.
Co-authored-by: Ona <no-reply@ona.com>
* docs: document intentional TItems cast in post-processor merge
Co-authored-by: Ona <no-reply@ona.com>
* fix: filter stale item IDs from groups after pipeline
Groups accumulated during the pipeline can reference items
that a later processor suppressed. The engine now strips
stale IDs and drops empty groups before returning.
Co-authored-by: Ona <no-reply@ona.com>
* refactor: use reduce for stale group filtering
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
* feat: replace FeedItem.priority with signals
Remove priority field from FeedItem and engine-level sorting.
Add FeedItemSignals with urgency and timeRelevance fields.
Update all source packages to emit signals instead of priority.
Ranking is now the post-processing layer's responsibility.
Urgency values are unchanged from the old priority values.
Co-authored-by: Ona <no-reply@ona.com>
* fix: use TimeRelevance enum in all tests
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
Add lastFeed() method that returns cached FeedResult within
a configurable TTL (default 5 min). refresh() always fetches
fresh data and updates the cache. Periodic auto-refresh via
recursive setTimeout when engine is started. Reactive updates
reset the timer to avoid redundant fetches.
Co-authored-by: Ona <no-reply@ona.com>
Add listActions() and executeAction() to FeedSource for write
operations back to external services. Actions use arktype schemas
for input validation via StandardSchemaV1.
- ActionDefinition type with optional input schema
- FeedEngine routes actions with existence and ID validation
- Source IDs use reverse-domain format (aris.location, aris.tfl)
- LocationSource: update-location action with schema validation
- TflSource: set-lines-of-interest action with lineId validation
- No-op implementations for sources without actions
Co-authored-by: Ona <no-reply@ona.com>
Sources that cannot provide context now return null
instead of omitting the method. The engine checks the
return value rather than method existence.
Co-authored-by: Ona <no-reply@ona.com>
FeedEngine calls fetchContext then fetchItems with the same
context. Cache events by context.time reference to avoid
duplicate CalDAV round-trips.
Co-authored-by: Ona <no-reply@ona.com>
A transient error on one calendar (e.g. shared calendar
with permission issues) no longer discards results from
all other calendars.
Co-authored-by: Ona <no-reply@ona.com>
Add @aris/source-apple-calendar for fetching iCloud
calendar events via CalDAV using tsdav and ical.js.
- CalendarSource implements FeedSource with fetchItems
and fetchContext for downstream context
- CalendarCredentialProvider interface for token injection
- CalendarDAVClient interface for testability
- iCal parser extracts full event data including
attendees, alarms, organizer, and recurrence
- Priority based on event proximity to current time
Co-authored-by: Ona <no-reply@ona.com>
Manages per-user TflSource instances with individual line
configuration. Implements FeedSourceProvider so it can be
wired into FeedEngineService.
Adds TflSource.setLines() so line config can be mutated
in place, keeping engine references valid.
Also exports ITflApi from @aris/source-tfl for testability.
Co-authored-by: Ona <no-reply@ona.com>
Migrates TFL package from old DataSource interface to new FeedSource
interface for use with FeedEngine.
Changes:
- Rename package from @aris/data-source-tfl to @aris/source-tfl
- Replace TflDataSource class with TflSource implementing FeedSource
- Add dependency on @aris/source-location for LocationKey
- Use normalized priority values (0-1) instead of arbitrary numbers
- Update tests for FeedSource interface
- Update README.md with new package name
Co-authored-by: Ona <no-reply@ona.com>
Introduces FeedEngine that consumes FeedSource instances and manages
the dependency graph for context flow and item collection.
- Validates dependency graph (missing deps, circular references)
- Topologically sorts sources for execution order
- Runs fetchContext() in dependency order, accumulating context
- Runs fetchItems() on all sources with final context
- Supports reactive updates via onContextUpdate/onItemsUpdate
- Graceful error handling (continues after source failures)
Marks DataSource, ContextProvider, ContextBridge, Reconciler, and
FeedController as deprecated in favor of FeedSource + FeedEngine.
Co-authored-by: Ona <no-reply@ona.com>
Implements FeedSource for WeatherKit API. Depends on location source,
provides weather context for downstream sources, and produces weather
feed items.
Co-authored-by: Ona <no-reply@ona.com>
Implements FeedSource interface. Accepts external location pushes,
provides context to downstream sources, does not produce feed items.
Supports configurable history size.
Co-authored-by: Ona <no-reply@ona.com>
Unifies DataSource and ContextProvider into a single interface that
forms a dependency graph. Sources declare dependencies on other sources
and can provide context, feed items, or both.
Deprecates DataSource, ContextProvider, and ContextBridge.
Co-authored-by: Ona <no-reply@ona.com>
- Add WeatherKitClient interface and DefaultWeatherKitClient class
- WeatherKitDataSource accepts either client or credentials
- Simplify tests by injecting mock client directly
- Update fixture generation script to use new client class
Co-authored-by: Ona <no-reply@ona.com>
Implements @aris/data-source-weatherkit for fetching weather data from
Apple WeatherKit REST API.
- WeatherKitDataSource class implementing DataSource interface
- Feed items: current, hourly, daily, and alerts
- Priority adjustment based on weather conditions and alert severity
- Unit conversion (metric/imperial)
- Response validation with arktype
- Test fixtures from real API responses
Co-authored-by: Ona <no-reply@ona.com>
TfL data source for tube, overground, and Elizabeth line alerts.
- Fetches line statuses and filters to minor/major delays and closures
- Sorts alerts by severity, then by proximity to user location
- Caches station data after first fetch
- Uses arktype for API response validation
- Supports API injection for testing
Co-authored-by: Ona <no-reply@ona.com>