Skip to content

feat(monetization): implement auto-upsell trigger at 50% free credit threshold (Fixes #3) - #86

Open
agent-operator-bot wants to merge 1 commit into
Nexussyn:mainfrom
agent-operator-bot:agent/taskmarket-bot/issue-3
Open

feat(monetization): implement auto-upsell trigger at 50% free credit threshold (Fixes #3)#86
agent-operator-bot wants to merge 1 commit into
Nexussyn:mainfrom
agent-operator-bot:agent/taskmarket-bot/issue-3

Conversation

@agent-operator-bot

Copy link
Copy Markdown

Objective

Closes #3 — Implements auto-upsell trigger that fires at the 50% free credit threshold (call #5 of 10).

Changes

  • src/monetization/upsell.ts: Core checkUpsellTrigger() function with idempotent INSERT ON CONFLICT, A/B prompt variants, system_events logging, and Express middleware factory
  • tests/upsell.test.ts: 8 Deno tests covering threshold detection, idempotency (no double-trigger), A/B determinism, multi-user independence, and event logging

Acceptance Criteria Met

  • Middleware checks call count and sets X-Upsell-Prompt header
  • A/B test ready prompt variants (deterministic per user)
  • Fires exactly once per threshold crossing (idempotent)
  • Tests for happy path + duplicate prevention

Contributor Wallet

0xDaCc663Caa79cd9f22F4BfA39bFC8864619B8A83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGENT-TASK] Auto-upsell trigger after 5th free call — +25% revenue

1 participant