Commit Graph

401 Commits

Author SHA1 Message Date
saravanakumardb1
2518e1a92e fix(ts-clients): add x-request-id header to feature-flag-client and kill-switch-client 2026-03-01 21:17:38 -08:00
saravanakumardb1
f953c2b0bc fix(kotlin-sdk): thread-safety, resource leaks, URL encoding, JSON safety, deprecated API
- BLTelemetryClient/BLAuditLogger/BLCrashReporter: @Synchronized isoNow() for SimpleDateFormat thread-safety

- BLCrashReporter: replace unsafe JSON string interpolation with buildJsonObject + JsonArray

- BLBlobClient: close OkHttp Response body with .use {} to prevent resource leak

- BLFeatureFlagClient/BLKillSwitchClient: URL-encode query parameter values

- build.gradle.kts: kotlinOptions {} -> compilerOptions {} (Kotlin 2.1 convention)
2026-03-01 21:17:27 -08:00
saravanakumardb1
4f16223996 docs: update ANDROID_PLATFORM_SDK.md + IOS_PLATFORM_SDK.md to reflect completed migrations 2026-03-01 20:55:22 -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
70703a5009 test(kotlin-sdk): add JUnit5 + MockWebServer tests for PlatformConfig, PlatformClient, FeatureFlag, KillSwitch, License (35 tests) 2026-03-01 20:36:58 -08:00
saravanakumardb1
91c48a7bc7 feat(sdk): add kotlin-platform-sdk (13 components) + 4 new TS client packages (32 tests) 2026-03-01 18:15:57 -08:00
saravanakumardb1
92a6929238 fix(delivery): replace hardcoded product URL/name maps with dynamic product cache lookup 2026-03-01 17:44:54 -08:00
saravanakumardb1
2f199cb67a fix(auth): replace hardcoded product ID lists with dynamic getAllProducts() in reset-password and verify-email 2026-03-01 17:43:32 -08:00
saravanakumardb1
bd7e78641e fix(platform): replace Math.random() IDs with crypto.randomUUID() in 5 P2 modules 2026-03-01 17:42:28 -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
f97f7a0adb fix(marketplace): validate agentListingIds/individualPrices length match in buildAgentPack (18 tests) 2026-03-01 17:04:28 -08:00
saravanakumardb1
573f54888c fix(jarvis-teams): enforce maxMembers capacity in addMember, return null on full/missing team (25 tests) 2026-03-01 17:03:49 -08:00
saravanakumardb1
5088507400 feat(marketplace): verified creator program — applications, badges, agent pack bundles with discount validation (17 tests) 2026-03-01 16:50:38 -08:00
saravanakumardb1
66d6aa7b5b feat(jarvis-teams): enterprise teams module — team CRUD, member management, shared agents, analytics (23 tests) 2026-03-01 16:48:26 -08:00
saravanakumardb1
d0cb3a2238 feat(marketplace): purchase repository — build/complete/refund docs, 70/30 revenue share, author earnings aggregation (15 tests) 2026-03-01 16:39:38 -08:00
saravanakumardb1
063efa8e41 feat(marketplace): automated certification — prompt-safety, content-policy, payload-validator, engine (25 tests) 2026-03-01 14:26:23 -08:00
saravanakumardb1
59552712a8 feat(platform): wire marketplace routes into server.ts + add server test mock 2026-03-01 08:06:12 -08:00
saravanakumardb1
7aed0ebec3 feat(platform): marketplace routes — 30 Fastify endpoints (catalog, consumer, author, admin) 2026-03-01 08:04:39 -08:00
saravanakumardb1
761a0c17f4 feat(platform): marketplace module — types, repository, 52 tests passing 2026-03-01 08:01:45 -08:00
saravanakumardb1
383a8dad32 feat(peak-sessions): add clientId for idempotent sync, findByClientId repo method, explicit 204 returns 2026-03-01 07:55:02 -08:00
saravanakumardb1
137266a284 fix(docs): review pass on mobile SDK best practices — correct 6 bugs found via codebase verification 2026-03-01 07:45:39 -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
saravanakumardb1
a0157211f5 feat(design-tokens): add JarvisJr product color palette to bytelyst.tokens.json 2026-03-01 06:49:47 -08:00
saravanakumardb1
8b36cd9e4d fix(marketplace): review pass — add ReportDoc type, fix table formatting, renumber sections, add cost estimates 2026-03-01 06:25:57 -08:00
saravanakumardb1
983e84e6de feat(marketplace): generic marketplace module design document 2026-03-01 06:05:59 -08:00
saravanakumardb1
ae55616444 fix(swift-sdk): match date decoding strategy in BLAuditLogger
saveEvents used .iso8601 encoding but loadEvents used the default
decoder (.deferredToDate). ISO8601 date strings could not be decoded
back, causing loadEvents() to return [] after the first log — breaking
event rotation and losing all previous audit entries.
2026-02-28 22:55:00 -08:00
saravanakumardb1
b4be39888b fix(swift-sdk): remove productId prefix from BLAuthClient keychain keys
BLAuthClient stored tokens as '{productId}_access_token' but all app
wrappers use KeychainHelper.read(key: "access_token") — the bare key.
This caused a critical mismatch: after login, BlobService/LicenseService
could not find the token, and token migration from UserDefaults was invisible
to BLAuthClient.isAuthenticated.

The Keychain service name (bundleId) already namespaces per product,
making the productId prefix redundant. Now uses bare 'access_token' and
'refresh_token' keys matching existing app conventions.
2026-02-28 22:54:01 -08:00
saravanakumardb1
77d6ff328f fix(swift-sdk): URL-encode license key + add request tracing to kill switch
BLLicenseClient.checkStatus: percent-encode key before inserting into URL
path to prevent malformed URLs with special characters.

BLKillSwitchClient: add X-Product-Id and X-Request-Id headers for
consistency with BLPlatformClient request tracing pattern.
2026-02-28 22:52:00 -08:00
saravanakumardb1
b068e4bc1a fix(swift-sdk): guard BLBiometricAuth and BLCrashReporter for watchOS compatibility
BLBiometricAuth imports LocalAuthentication (unavailable on watchOS).
BLCrashReporter imports MetricKit (unavailable on watchOS).
Package.swift declares watchOS 10+ as a platform target.

Fix: wrap both files in #if canImport() guards.
BLCrashReport model struct stays outside the guard (data-only, all platforms).
2026-02-28 22:51:26 -08:00
saravanakumardb1
23d14f33ea feat(swift-sdk): add 6 new components — BLBlobClient, BLKillSwitchClient, BLLicenseClient, BLBiometricAuth, BLCrashReporter, BLAuditLogger
New SDK components extracted from product apps:
- BLBlobClient — Azure Blob Storage upload via SAS tokens (from LysnrAI BlobService)
- BLKillSwitchClient — Kill switch check from platform-service (from LysnrAI KillSwitchService)
- BLLicenseClient — License key activation + status (from LysnrAI LicenseService)
- BLBiometricAuth — Face ID / Touch ID wrapper (from LysnrAI BiometricAuth)
- BLCrashReporter — MetricKit crash reporting (from ChronoMind CrashReporter)
- BLAuditLogger — Local rotating JSON audit log (from LysnrAI AuditLogger)

SDK now has 13 source files. Updated README with full component table
and migration status (3 apps fully migrated, 18 wrappers total).
2026-02-28 22:38:43 -08:00
saravanakumardb1
78000cdf6a feat(swift-sdk): add ByteLystPlatformSDK — shared Swift package for all iOS/watchOS/macOS apps
Extracts duplicated platform integration code from ChronoMind + LysnrAI into a
single Swift Package. Eliminates ~1,100+ lines of copied code per product app.

Components:
- BLPlatformConfig — product-specific configuration (productId, baseURL, bundleId)
- BLPlatformClient — generic HTTP client with auth injection, x-request-id, timeout
- BLKeychain — Keychain CRUD for secure token storage
- BLTelemetryClient — telemetry queue + batch flush (matches @bytelyst/telemetry-client)
- BLAuthClient — full auth operations (matches @bytelyst/auth-client)
- BLFeatureFlagClient — feature flag polling from platform-service /flags/poll
- BLSyncEngine — generic offline-first sync with delta pull + batch push

Platforms: iOS 17+, watchOS 10+, macOS 14+
2026-02-28 22:12:20 -08:00
saravanakumardb1
d15f19441f docs: add platform acceleration implementation roadmap with phased task lists 2026-02-28 21:37:19 -08:00
saravanakumardb1
2b7e4819e8 docs: add platform acceleration ideas for sub-day MVP onboarding 2026-02-28 21:01:32 -08:00
saravanakumardb1
ce71c61079 docs: rename BEST_PRACTICES/README.md to PLATFORM_PLAYBOOK.md 2026-02-28 20:57:03 -08:00
saravanakumardb1
8f737adc75 docs: add best practices and new product playbook 2026-02-28 20:50:12 -08:00
saravanakumardb1
022720bf6e feat(admin-dashboard): add edge middleware for API route auth gating 2026-02-28 20:25:42 -08:00
saravanakumardb1
5663ef568a docs: add agent prompts sync guide and workspace anti-patterns 2026-02-28 20:24:24 -08:00
saravanakumardb1
c3885059cf feat(dashboards): add error and not-found pages for admin and tracker dashboards 2026-02-28 20:24:15 -08:00
saravanakumardb1
33160a5daa feat(platform-service): add brains, daily-briefs, reflections, streaks modules 2026-02-28 20:24:06 -08:00
saravanakumardb1
4863b62055 feat(fastify-core): deny CORS by default when origin unset, add graceful shutdown handlers 2026-02-28 20:23:58 -08:00
saravanakumardb1
04f4a5f81e feat(api-client): add timeout, retry with exponential backoff for idempotent requests 2026-02-28 20:23:49 -08:00
saravanakumardb1
a97b730a89 feat(flags): seed default feature flags for all products on startup 2026-02-28 19:33:22 -08:00
saravanakumardb1
711621e3d9 fix(telemetry): add 'native' to ChannelEnum for mobile app clients 2026-02-28 19:26:52 -08:00
saravanakumardb1
1b2a5d5483 fix(platform-service): register 13 missing MindLyst Cosmos containers
Add containers used by MindLyst web API routes to platform-service
cosmos-init so the shared database has a single authoritative registry:

  share_cards, notification_log, analytics_events, brain_packs,
  chat_sessions, ab_experiments, waitlist_entries, email_captures,
  engagement_campaigns, context_triggers, monitoring_reports,
  nudge_state, triage_retries

Note: 'referrals' is intentionally skipped — the growth module already
registers it with /id partition key, but MindLyst uses /userId. This
partition key mismatch requires a separate data migration to reconcile.

All 1141 platform-service tests pass.
2026-02-28 19:23:04 -08:00
saravanakumardb1
ac106ed917 feat(tracker): add product switcher — filter items by any product
- product-config.ts: add getRequestProductId(req) + KNOWN_PRODUCTS
- product-context.tsx: client-side product selection context
- product-switcher.tsx: native select dropdown component
- tracker-client.ts: inject x-product-id header on all API calls
- proxy route: forward x-product-id header to platform-service
- providers.tsx: wrap with ProductProvider
- dashboard/layout.tsx: render ProductSwitcher in top nav
2026-02-28 14:15:18 -08:00
saravanakumardb1
ed7fa3f9a4 feat(admin): add product switcher — filter all data by any product
- product-config.ts: add getRequestProductId(req) helper + KNOWN_PRODUCTS list
- product-context.tsx: new React context storing selected productId in localStorage
- product-switcher.tsx: dropdown component with icons for all 4 products
- api.ts: pass x-product-id header from localStorage on all API calls
- providers.tsx: wrap with ProductProvider
- sidebar-nav.tsx: render ProductSwitcher between logo and nav
- repositories/users.ts + tokens.ts: accept optional productId parameter
- 8 API routes updated: users, auth/login, auth/forgot-password, seed,
  settings/plans, themes/active, analytics/retention, analytics/revenue
2026-02-28 14:12:15 -08:00
saravanakumardb1
ba2641c552 feat(platform-service): add push notification triggers module (6 endpoints, 22 tests)
- 7 trigger types: streak_risk, fast_milestone, stage_transition, social_invite, weekly_digest, achievement_unlocked, refeeding_reminder
- Built-in templates with variable interpolation
- CRUD + batch create + pending trigger query + status updates + stats
- push_triggers container (TTL 30d)
- 1,112 total platform-service tests passing
2026-02-28 14:10:11 -08:00
saravanakumardb1
20e0ef2201 feat(platform-service): add P2 Product Intelligence modules (5 modules, 61 tests)
- experiments: A/B testing with FNV-1a deterministic variant assignment (7 endpoints, 15 tests)
- analytics: metric ingest + daily/weekly/monthly rollup queries (3 endpoints, 14 tests)
- feedback: in-app bug/feature/praise submission + admin triage (6 endpoints, 14 tests)
- impersonation: admin user impersonation with audit trail (4 endpoints, 6 tests)
- changelog: public product changelog with admin CRUD (6 endpoints, 12 tests)
- 6 new Cosmos containers added to cosmos-init.ts
- All 5 route modules registered in server.ts
- 1,090 total platform-service tests passing
2026-02-28 14:04:07 -08:00