Commit Graph

83 Commits

Author SHA1 Message Date
saravanakumardb1
15e24e5710 feat(platform): Phase 1 — Durable Event Bus + Worker Runtime
- New module: event-subscriptions/ (types, repository, routes, 15 tests)
  - Subscription CRUD: create/list/get/update/delete event subscriptions
  - DLQ: list/retry/delete/purge dead-letter queue entries
  - Event replay: POST /events/replay by topic + time range
- New lib: event-dispatcher.ts — subscription-driven dispatch with retry + DLQ
- New lib: event-store-bridge.ts — persistent event log for replay capability
- Worker runtime hardening (jobs/runner.ts):
  - Concurrency limit (MAX_CONCURRENT_JOBS=5)
  - Stuck-job recovery (10min threshold)
  - Graceful shutdown (30s drain)
  - Active job tracking + diagnostics (getActiveJobs/getActiveJobCount)
  - Per-job dedup (skip if already running)
- Wired dispatcher + event-subscriptions into server.ts startup
- Cosmos containers: event_subscriptions, event_dlq, event_log
- 1,293 tests passing (15 new)
2026-03-20 03:12:54 -07:00
saravanakumardb1
3a14f87814 chore(platform-service): wire P2+P3 modules into server + cosmos-init
- server.ts: register cdnRoutes, searchRoutes, dunningRoutes (P2)
- server.ts: register tenantRoutes, retentionRoutes, backupRoutes, apiVersioningRoutes (P3)
- cosmos-init.ts: 17 new containers across 7 modules:
  CDN: cdn_assets, cdn_purge_requests, cdn_origin_configs
  Search: search_index, search_suggestions
  Dunning: dunning_campaigns, dunning_policies
  Tenants: tenants, tenant_members, tenant_invites
  Retention: retention_policies, retention_jobs
  Backups: backups, restores, backup_configs
  API Versioning: api_versions, api_version_pins
- Total platform-service modules: ~41, tests: 1239
2026-03-19 23:50:38 -07:00
saravanakumardb1
652a8e5d15 fix(platform-service): missing cosmos containers + NaN guard in cross-product limit
- cosmos-init.ts: add onboarding_events + onboarding_completions containers
  (onboarding repository references them but they were never registered)
- telemetry cross-product route: parseInt(limit) could produce NaN when
  given non-numeric input — now clamps to 1-100 with default 20
2026-03-19 22:20:31 -07:00
saravanakumardb1
1fe1e75999 feat(platform-service): auto-registration on first request (Phase 4.1) — 8 tests
Zero-touch product provisioning: when a request arrives with an unknown
productId and a valid JWT, auto-create a minimal ProductDoc instead of
rejecting. Enables new products to use platform-service immediately.

- auto-register.ts: auto-create ProductDoc with sensible defaults
- Rate limited: max 10 auto-registrations per minute
- Requires valid JWT (unauthenticated requests still rejected)
- Audit logged as product.auto_registered
- request-context.ts: exported extractProductIdAsync with auto-register
- 8 tests: register, duplicate, format validation, rate limit
2026-03-19 22:00:57 -07:00
saravanakumardb1
0f299231cc feat(platform-service): declarative YAML module loader (4.4) — 34 tests
New files:
- src/lib/declarative-schema.ts — YAML schema + Zod validation
  - ModuleSchema, FieldSchema, EndpointSchema
  - fieldToZodSchema, buildCreateSchema, buildUpdateSchema, defaultEndpoints

- src/lib/declarative-loader.ts — runtime route generator
  - parseModuleYaml, registerModuleRoutes, loadDeclarativeModules
  - MemoryStore with filtering, sorting, pagination
  - Auth enforcement (none/user/admin), custom endpoint support

- src/lib/declarative-loader.test.ts — 34 tests
  - Schema validation, field conversion, endpoint generation
  - MemoryStore CRUD, route integration with full lifecycle

Dependency: yaml (npm)
2026-03-19 21:16:58 -07:00
saravanakumardb1
1ad8660dd8 fix(platform): fix 2 type errors found in typecheck sweep
- api-key-auth.ts: Record<string, unknown> → FilterMap (import from @bytelyst/datastore)
- reviews/notifications.ts: raw subject/html/text → templateId + variables (match dispatchEmail signature)
2026-03-19 19:02:57 -07:00
root
d93ada4037 docs(config): align rate limit settings 2026-03-15 09:42:42 +00:00
root
e4bff5a2fe feat(platform-service): add support case management foundation 2026-03-15 09:39:20 +00:00
root
14346fbd5d feat(ratelimit): back api throttles with datastore 2026-03-15 09:37:03 +00:00
root
8b99b7a9a7 feat(platform-service): add scim provisioning foundation 2026-03-15 09:36:27 +00:00
root
66d0bf53a9 feat(platform-service): add shared knowledge foundation 2026-03-15 09:33:17 +00:00
root
728d8f2484 feat(platform-service): add ai budget governance 2026-03-15 09:30:16 +00:00
root
3f06427038 feat(platform-service): add agent evaluation governance 2026-03-15 09:26:40 +00:00
root
8d78b6ce59 feat(api-key): audit security events 2026-03-15 09:24:01 +00:00
root
95261acb92 feat(api-key): log auth and throttling rejects 2026-03-15 09:06:51 +00:00
root
798c1b9fad feat(platform-service): add agent registry foundation 2026-03-15 09:05:39 +00:00
root
57abfa5b03 feat(api-key): add per-product throttling 2026-03-15 06:26:42 +00:00
root
8240f6060d feat(api-key): restrict ops routes to service tokens 2026-03-15 06:24:08 +00:00
root
eac633e1e7 fix(api-key): enforce machine token policy 2026-03-15 06:16:15 +00:00
root
3398d1400f feat(platform-service): add human review queue 2026-03-15 06:08:23 +00:00
root
33c5a5a5ce feat(platform-service): add org workspace foundation 2026-03-15 06:03:08 +00:00
root
841d2f5129 fix(api-key): enforce requested product binding 2026-03-15 06:01:17 +00:00
root
a76b932502 feat(platform-service): add durable run tracking 2026-03-14 16:08:07 +00:00
root
885ee2d504 feat(events): add durable event bus worker path 2026-03-14 16:02:40 +00:00
root
8de22f9f22 feat(platform-service): allow scoped api keys on webhook routes 2026-03-14 15:38:42 +00:00
root
0ad6703961 feat(platform-service): add api key auth context and throttling guard 2026-03-14 14:55:23 +00:00
root
114240c79a feat(platform-service): add telegram and slack delivery 2026-03-14 06:01:59 +00:00
root
db9ae4a573 feat(platform-service): add smtp email delivery and postal setup 2026-03-14 05:52:28 +00:00
root
19b58b3ea0 Fix prototype service runtime dependencies 2026-03-14 05:32:21 +00:00
saravanakumardb1
362b915ea9 feat(auth): SmartAuth backend core — OAuth, MFA, passkeys, device trust, login events
Phase 0A: OneAuth schema extension — UserDoc evolution + auth_providers container
Phase 0B: Progressive lockout + IP rate limiting on login
Phase 1A-1B: Google/Microsoft/Apple OAuth + account linking
Phase 1D: Enhanced /auth/me — products, providers, MFA status
Phase 2A-2C: TOTP MFA + challenge flow + admin policies
Phase 3A-3B: WebAuthn passkeys + device trust
Phase 4A: Login events + rule-based risk scoring

New sub-modules: oauth/, mfa/, passkeys/, devices/, login-events/
New containers: auth_providers, auth_mfa, auth_mfa_policies, auth_passkeys, auth_devices, auth_login_events
Tests: 37 new (946 total, all passing), typecheck clean
2026-03-12 10:55:41 -07:00
saravanakumardb1
d80cf075a3 fix(diagnostics): add missing session_replays and performance_profiles cosmos containers [BUG-1] 2026-03-03 12:24:05 -08:00
saravanakumardb1
eab854375e feat(ai-diagnostics): add proactive alerts API and complete [4.3] 2026-03-03 12:17:11 -08:00
saravanakumardb1
97b3ffb21d feat(ai-diagnostics): add LLM analyzer with prompts and insight generation [2.1-2.2] 2026-03-03 11:52:12 -08:00
saravanakumardb1
50b7e22985 feat(ai-diagnostics): add Azure OpenAI embedding pipeline [1.2.1] 2026-03-03 11:47:12 -08:00
saravanakumardb1
a9b224749c feat(ab-testing): add experiment types and cosmos containers [1.1] 2026-03-03 11:44:33 -08:00
saravanakumardb1
4de01269b5 feat(ai-diagnostics): add error clustering types and cosmos containers [1.1.1-1.1.2] 2026-03-03 11:44:23 -08:00
saravanakumardb1
8e90358960 feat(platform): PII Redaction library (Appendix D.1)
- 8 PII patterns: email, SSN, credit card, phone, IP, password/token, JWT, API key
- redactPII() for string redaction
- redactObject() for recursive object redaction
- redactLogMessage() for log entries with context
- containsPII() and getPIITypes() detection helpers
- Custom pattern registration
- Preset configurations: minimal, standard, aggressive
2026-03-03 09:37:53 -08:00
saravanakumardb1
4bf18f4d4f feat(platform-service): Phase 4.4 - Push notification wiring (FCM/APNS)
- push-notifications.ts: FCM and APNS delivery services
- Device token registration/management
- sendPushNotification() for bulk delivery
- Automatic token deactivation on APNS 410 responses
2026-03-03 08:05:21 -08:00
saravanakumardb1
1b11db3f6f feat(broadcasts,surveys): Phase 1 complete - backend modules
- broadcasts/types.ts: Broadcast, BroadcastTarget, BroadcastMetrics, InAppMessage
- broadcasts/repository.ts: CRUD + delivery tracking + read receipts
- broadcasts/targeting.ts: evaluateTarget(), semver, FNV-1a hash
- broadcasts/routes.ts: Admin CRUD + public endpoints (14 routes)
- surveys/types.ts: Survey, Question, SurveyResponse, conditional logic
- surveys/repository.ts: CRUD + analytics + CSV export
- surveys/routes.ts: Admin CRUD + public endpoints (13 routes)
- cosmos-init.ts: 7 new containers with TTL policies
- server.ts: Register broadcastRoutes + surveyRoutes

Implements Phase 1 of platform_BROADCAST_SURVEY_ROADMAP.md
2026-03-02 23:51:23 -08:00
saravanakumardb1
dea1521dd5 feat(diagnostics): add 4 Cosmos containers (sessions, traces, logs, screenshots) with TTL 2026-03-02 23:32:49 -08:00
saravanakumardb1
e943f14608 fix(marketplace): prevent duplicate votes with vote tracking collection
- Add marketplace_votes container to cosmos-init.ts
- Add MarketplaceVoteDoc type and vote repository functions
- Fix vote endpoint to toggle votes (prevent unlimited voting)
- Fix listMyReports to filter by productId for data isolation
- Update report routes to pass productId to listMyReports
2026-03-02 10:12:33 -08:00
saravanakumardb1
3e05260a6f feat(marketplace): generic template marketplace with listings, reviews, installs, certification 2026-03-02 10:02:54 -08:00
saravanakumardb1
7ca2139418 refactor(storage): migrate to storage abstraction 2026-03-02 09:07:33 -08:00
saravanakumardb1
4d126cb051 feat(platform-service): migrate 6 repositories to @bytelyst/datastore (flags, settings, comments, votes, products, themes) — 756/756 tests pass 2026-03-02 00:51:03 -08:00
saravanakumardb1
b33d3cf2b3 feat(platform): add webhook subscriptions module, DB migration runner, Swagger UI — complete 23/25 roadmap items 2026-03-01 23:38:48 -08:00
saravanakumardb1
24d7896599 refactor(platform-service): migrate product-specific modules to product repo backends
Remove 23 product-specific module directories from platform-service:
- ChronoMind: timers, routines, households, shared-timers, webhooks
- JarvisJr: jarvis-agents, jarvis-sessions, jarvis-memory, jarvis-teams, marketplace
- NomGap: fasting-sessions, fasting-protocols, body-stages, social-fasting, meal-log, push-triggers
- PeakPulse: peak-sessions, peak-routes
- MindLyst: brains, memory, reflections, daily-briefs, streaks

Update server.ts: remove product module imports and registrations
Update cosmos-init.ts: remove product-specific container definitions
Clean up server.test.ts: remove 5 stale vi.mock() calls
Update AGENTS.md: add section 13 (product backends), update test counts

Platform-service tests: 759 passing (platform-common only)
Product backends: PeakPulse 32, ChronoMind 171, JarvisJr 198, NomGap 152, MindLyst 59
2026-03-01 20:38:32 -08:00
saravanakumardb1
a2461fc26a fix(platform): replace 3 console.* calls with process.stdout/stderr in cosmos-init + server startup 2026-03-01 17:41:02 -08:00
saravanakumardb1
d10b898ba5 feat(peak-routes): add PeakPulse track point storage module — types, repository, routes, 10 tests 2026-03-01 07:40:19 -08:00
saravanakumardb1
b20e1c6165 feat(peak-sessions): add PeakPulse session sync module — types, repository, routes, 20 tests 2026-03-01 07:12:28 -08:00
saravanakumardb1
dcabe46de2 feat(jarvis): add jarvis-agents, jarvis-sessions, jarvis-memory modules (63 tests) 2026-03-01 07:09:12 -08:00