Commit Graph
203 Commits
Author SHA1 Message Date
Matthew Meszaros 0fb3147244 feat: add the AI-variable config model, encode/decode, generate client, and useGenerateAIVariable hook for the block preview button 2026-07-22 17:05:08 +02:00
Matthew Meszaros bb6cb330b6 feat: add the custom-field-keys web client and useCustomFieldKeys hook that feed real org fields into the variable picker 2026-07-22 17:04:51 +02:00
Matthew Meszaros 029ebf7d3b feat: add shared template-variable catalog in web/src/lib/templateVars.ts as the single source for standard merge fields across editors, templates, and preview 2026-07-22 17:04:51 +02:00
Matthew Meszaros bb040828b1 feat: rework automation AI steps to mirror campaign step types with one agentic AI step plus an AI switch, per-case switch handles on the canvas, a Stop node, and a step-type add menu 2026-07-22 10:58:35 +02:00
Matthew Meszaros f48ae60476 feat: build the ai step editors and smooth out the flow lines 2026-07-21 17:35:11 +02:00
Matthew Meszaros a44b7b0215 feat: add the unified ai step and ai switch to automations 2026-07-21 17:35:11 +02:00
Matthew Meszaros f898e4975f fix: show the real plan badge, mailbox tags and live sidebar stats 2026-07-21 17:35:11 +02:00
Matthew Meszaros 07c6ae0aa7 feat: kill the settings autosave PUT storm: useAutosave becomes single-flight (the change effect re-arms every render because save is an inline closure, and with the baseline only moving after the response every render during an in-flight save fired another request; concurrent callers now share one in-flight promise and a trailing loop picks up edits made while saving), the notifications settings page hydrates its draft from the server exactly once so refetches never stomp or re-trigger mid-save, and the preferences PUT writes its echoed envelope into the react-query cache instead of invalidating (no more refetch per save) 2026-07-20 08:17:50 +02:00
Matthew Meszaros 85ab4ad7b5 feat: replace the notification email cadence enum with a configurable bundling window and drop the instant mode entirely: email_digest_minutes (30 minute floor, 30 default, 1440 max, constants in config) replaces email_digest with no per-event option or NOTIFICATION_EMAIL_ALLOW_INSTANT escape hatch, the handler validates the range and email_delivery now returns min/max minutes so clients render the bounds, the web settings page offers window presets (30m/1h/3h/daily) plus a Custom minutes NumberInput and iOS swaps the cadence menu for window presets including the server value when it matches none, the repo clamps stored values on read, and the guide plus deployment guide describe the window and keep only the NOTIFICATION_EMAIL_DAILY_CAP env 2026-07-20 08:01:22 +02:00
Matthew Meszaros 682ef3ac24 feat: cost guards on the notification email channel: the per-event instant cadence becomes self-host opt-in (NOTIFICATION_EMAIL_ALLOW_INSTANT, default off - PUT rejects it, stored values read back as smart, holds degrade to smart) with the capability exposed as email_delivery on the preferences GET so web and iOS hide the option on hosted deploys, each user gets a rolling 24h budget of non-security notification emails (NOTIFICATION_EMAIL_DAILY_CAP, default 25, 0 unlimited) counted off sent rows with over-budget alerts skipped to the in-app feed while security sign-ins always send, and coalesced group emails re-verify org membership at flush time so a member removed during the hold is dropped from To; deployment guide documents the three envs and the guide notes both limits 2026-07-20 07:44:43 +02:00
Matthew Meszaros 5d930057d9 feat: harden the notifications settings page against version skew: normalizeNotificationPreferences mirrors the backend defaults merge on the client (missing billing_alert/team_activity/email_digest filled with defaults, invalid cadence coerced to smart) and the page normalizes the fetched preferences before drafting, so an older backend or cached response can no longer crash the category rows 2026-07-20 07:36:17 +02:00
Matthew Meszaros 0186ed5c78 feat: web notification center + digest settings: the bell dropdown becomes a real notification center with per-category icon chips and tones, Today/Yesterday/Earlier group headers, compact relative timestamps, unread accent styling, All/Unread filter pills, first-load skeleton, empty state and a settings footer link; the settings page gains Billing and Team category sections and an Email delivery section using the shared OptionSelect radio idiom (Instant/Smart with Recommended badge/Hourly/Daily) riding the same autosave PUT, with the read-in-app/security-immediate/shared-email note; the preferences model adds billing_alert, team_activity and the email_digest union, and OptionSelect labels widen to ReactNode for the badge 2026-07-20 07:21:20 +02:00
Matthew Meszaros 296e781ce5 feat: scoped Auto in the dashboard From menu: filtering by a mailbox tag turns the Auto row into Auto in <tag> previewing the best-scored member, the pick carries the tag through onChange into ComposeWindow state and the send request's from_tag_id, and the collapsed From row chip reads auto with the tag title while the resolved-signature preview resolves to the best mailbox within the tag 2026-07-20 05:28:05 +02:00
Matthew Meszaros c53225e6f3 feat: undo send in the dashboard: instant compose and reply sends feed a new outbox store and an amber header pill counting down to the server scheduled_at with inline Cancel plus a portaled dropdown listing every pending send with per-row cancel, cancelling a compose reopens the docked composer from a full draft seed and cancelling a reply navigates to the thread and reopens the reply composer prefilled via a restore handoff, 404 collapses to Already sent, and the profile settings page gains an autosaved Undo window NumberInput (5-120s) wired to PUT /auth/me/send-preferences patching the cached /auth/me user 2026-07-19 18:56:55 +02:00
Matthew Meszaros e46fc1cd3e feat: make the composer picker search feel alive: contact searches debounce 300ms and keep previous results on screen while the next query loads (new useDebouncedValue hook + keepPrevious option on useSearchContacts), the browse panel and From menu ease their height with a ResizeObserver-driven AnimatedHeight instead of snapping, in-flight searches show a spinner in the search box plus shimmer skeleton rows on first load, FilterMenu closes itself on any outside click or Escape (its trigger lives inside a data-floating panel the shared hook ignores, so opening the sibling filter now closes the other), and the browse panel widens to 400px 2026-07-19 18:36:31 +02:00
Matthew Meszaros 5fae462bb2 feat: bulk tag mailboxes from the list's selection bar: a Tags popover with an Add/Remove segmented toggle, tag search, checkbox rows with colored dots, an inline Create-tag row (POSTs /tags cycling the editor's palette and updates the profile cache), and an apply button that hits the new PATCH /emails/tags bulk endpoint, invalidates the emails queries, and keeps the row selection for chaining 2026-07-19 16:13:58 +02:00
Matthew Meszaros e7144a439d feat: upgrade the AI usage view: the daily bars become a smoothed dithered area graph with a 7d/30d/90d range switcher (breakdowns follow the range, previous data held while the new range loads so nothing flashes), and limit cells drop the boxy stepper input for a big inline-editable value with a dashed-underline affordance, the dithered slider, quiet text presets, and a No cap idle state 2026-07-19 13:50:03 +02:00
Matthew Meszaros f7a1027367 feat: add workspace-shared assistant history: a manage_settings toggle on the organization (assistant_shared_history, off by default) makes every conversation visible to and continuable by every member with the use-AI permission — the service resolves a session to its owner's rows so open/continue/approve/delete all work cross-member while credits still charge the acting member, the org-wide listing joins owner names for attribution in the history rail, the workspace settings page gains the AI assistant section with the toggle and an explicit exposure warning, and the assistant guide's access and privacy sections describe both modes 2026-07-19 13:22:56 +02:00
Matthew Meszaros 68e3ca6b6b feat: extend the per-member AI limit to all three windows: member_limit_daily and member_limit_weekly join the monthly ceiling on org_ai_settings, MemberSpentInWindows sums the acting member's debits per window in one query, checkSpendLimits enforces day/week/month member ceilings with window-specific 429 messages, and the billing card's Per-member limits row grows the same three fields as the workspace caps 2026-07-19 13:22:56 +02:00
Matthew Meszaros 458234cd5d feat: add clear-all assistant history: DELETE /ai/sessions wipes every conversation the member owns in the workspace (transcripts cascade, count returned, audited as an ai_session delete with clear_history metadata), the history rail gains a Clear history footer action behind the in-app confirm that also closes all session-backed tabs, and the assistant guide documents access gating, per-member limits, privacy, and both delete paths 2026-07-19 11:05:18 +02:00
Matthew Meszaros f4014b8b73 feat: add a per-member monthly AI credit limit to the org spend controls: new member_limit_monthly on org_ai_settings flows through the settings repo, PATCH endpoint, and billing UI (its own Per-member limit field on the AI usage card), and checkSpendLimits enforces it by summing the acting member's debits this calendar month via the ledger's actor attribution (new MemberSpentSince query on the partial index from migration 000073), returning a 429-mapped member-limit error while unattributed scheduled work stays exempt 2026-07-19 11:05:18 +02:00
Matthew Meszaros 7ef7d90d8c feat: introduce the Use AI organization permission (bit 15, the last of the 16-bit mask) gating every AI surface: assistant session routes, generation write/edit, and the compose and reply draft endpoints get a member-permission layer (API keys re-check their existing bit), migration 000073 backfills the bit onto all existing roles and member overrides so nobody loses access, defaults grant it to admin and manager but not viewer, and the web mirrors it in the permission catalog with gating on the header spark button, Cmd+I, the panel itself, and the AI drafting caret (plus team-roles and endpoint-map docs) 2026-07-19 11:04:58 +02:00
Matthew Meszaros bacbf5552f feat: upgrade the assistant's full-screen history rail: conversations group under Today/Yesterday/This week/Earlier sections, a search field filters them by title, each row gets a hover (always-visible on touch) delete action behind the in-app confirm that also closes the conversation's open tab and invalidates the list, the New chat button shows its Alt+N kbd chip, and the guide documents deletion and search 2026-07-19 10:50:33 +02:00
Matthew Meszaros 8eb2824ac4 feat: render the assistant's stream like a live agent and surface its keybindings in the panel: text_delta chunks append to a live-flagged trailing block that the closing full-text event replaces, the trailing block of a running turn types itself out through a rAF SmoothText typewriter with the blinking caret so even chunky providers read as continuous generation, and the empty state gains kbd chips for toggle, new chat, pop out, and minimize plus an all-shortcuts link into the shortcuts dialog 2026-07-19 10:42:10 +02:00
Matthew Meszaros 633615c341 feat: move the compose-drafts invalidation from useMutation onSuccess into the mutationFn promise chain, because closing the composer fires the save and unmounts in the same tick and observer callbacks are skipped after unmount, which left the rail's Drafts list stale until a full reload 2026-07-19 10:31:20 +02:00
Matthew Meszaros 6f8db3ae05 feat: de-template the cold-email humanizer (drop the quotable example asks and subject that models parroted verbatim, add a VARIATION section mandating a fresh skeleton per email and capping punchy standalone lines at one) and add compose drafts: autosaved per-user working copies (client-generated ids, idempotent PUT on a 1.2s debounce, migration 000072) with Saving/Saved in the window header, close-keeps-draft instead of the discard confirm, delete on send or when emptied, and a Drafts list under the rail Compose button to resume or delete, documented in the guide and endpoints scope map 2026-07-19 08:52:56 +02:00
Matthew Meszaros 6ce5ebe900 feat: make compose AI drafting grounded and agentic: POST /unibox/compose/draft assembles the recipient's contact 360, the full correspondence history with the address, and the org voice profile into the prompt (2-credit minimum, reason compose_draft, usage settle, refund on provider failure), and when the purpose is genuinely unknowable the model returns a clarifying question instead of inventing a pitch; the draft bar gains a question phase (answer inline and it writes), the review card reports exactly what the draft was grounded in, and the composer nudges to Settings > Workspace with a link when no voice profile is set; docs cover the endpoint, credits row, and guide behavior 2026-07-19 08:37:39 +02:00
Matthew Meszaros a5982808fd feat: stop the inbox flashing on scope and route switches by keeping previous unibox search pages as placeholder data while the new key loads (no more full-pane skeleton flash) and holding overview counts in cache for 30 minutes so the header stats stop rolling up from zero, and flatten the compose header to a quiet single-line bar that shows just the recipient (or New email) with the icon chip and subtitle removed 2026-07-19 08:25:06 +02:00
Matthew Meszaros 44bfe7840f feat: add the compose web API layer (candidates + send clients, hooks with unibox invalidation, address/direction params on unibox search), a global useComposeStore zustand store so any surface can open the composer, and configurable draft row label/cost on TextareaAICaret so compose can say Draft this email with AI instead of the reply wording 2026-07-19 07:38:48 +02:00
Matthew Meszaros 1823f03a80 feat: live usage-based credit feedback — every fresh debit publishes BILLING_CREDITS_CHANGED through the creditwatch monitor so the header meter counts down in real time (AnimatedNumber tween, plus client-side invalidation on write/edit/draft success), generation responses now return the real credits_charged and tokens_used from the usage settle and every AI surface shows the true cost instead of flat labels, and the composer AI became overlay-based: the draft bar floats over the body instead of pushing layout, a sky sheen sweeps the input while the model writes, and the selection being rewritten is painted with pulsing highlight rects that grow as the rewrite types in 2026-07-18 16:30:05 +02:00
Matthew Meszaros 5178acd874 feat: in-composer AI writing experience — select text in the unibox reply textarea or the campaign TipTap editor and a floating Edit-with-AI pill opens quick actions (improve, shorten, expand, fix grammar, friendlier, more formal) plus free instructions backed by a new fenced /generation/edit endpoint (1 credit, idempotent, refund on failure, prompt-injection fencing around the passage), rewrites type themselves in with undo/again/done review, and Draft reply now runs through an inline draft bar with staged shimmer status and Keep/Adjust/Retry/Discard instead of a toast 2026-07-18 11:55:37 +02:00
Matthew Meszaros 4f9e6e6282 feat: full attribution on every AI credit charge — new actor_user_id + context jsonb columns on the transaction log (migration 000070), a typed models.CreditContext carried via request context (models.WithCreditMeta) so base charges, usage settles, web-search fees, and refunds all inherit it without signature churn, wired at every spend site (campaign switches record campaign/step/contact, automation nodes and Ask AI record automation/node/run and the question asked, reply drafts and inbox agent record the thread, the dashboard agent records the session, research records contact/run, and manual features record the triggering user), rendered as a detail line with token counts in the billing transaction log with corrected reason labels, and documented in the AI credits guide 2026-07-18 08:52:16 +02:00
Matthew Meszaros 163d3057de feat: add web-search and extended-thinking capabilities to the campaign switch AI decider — a per-step web lookup about the contact's company (query derived from contact fields only, results fenced as untrusted, +1 credit charged only when results land, wired through a new tasks SetAISearch) and a thinking toggle that routes to the stronger model tier with a 2048-token budget priced through usage metering, with editor toggles under Capabilities and sequences/ai-credits docs 2026-07-18 08:42:08 +02:00
Matthew Meszaros 053ca6a71d feat: usage-based AI credit system — every AI call reserves its flat minimum then settles the real token cost per model (light 1500/standard 400 tokens per credit, drain-to-zero overage settle wired into writing assistant, reply drafts, dashboard agent, inbox agent, research, automation nodes, and campaign switches), org spend controls in a new org_ai_settings table (day/week/month hard limits enforced in Consume, low-balance alert threshold, auto top-up config), a credit-watch monitor hook that fires BILLING_CREDITS_LOW realtime alerts once per day and buys the configured pack off-session via a new Stripe AutoTopUpCredits (idempotent on the PaymentIntent, bounded per month, Redis-locked), GET /subscription/credits/usage + GET/PATCH settings endpoints, and an AI usage & spend controls billing card (spend vs limits, 30-day chart, per-feature and per-model breakdowns, limits/reminder/auto-top-up form) with a realtime low-credit toast 2026-07-18 08:39:41 +02:00
Matthew Meszaros f36c1a5001 feat: replace the campaign AI step with a Switch step — a multi-way router whose cases are rows on the canvas node, each with its own draggable source dot (per-case ai_label branches wired by handle, retarget on re-drag, purple case edges with no IF boxes, bottom dot as the otherwise fallback), decided per contact by an AI prompt (1 credit, fenced context, same credit lifecycle) or a free deterministic template-value match, with a mode toggle + case list editor (stale case paths healed on save), drag-to-empty-canvas creating the target and wiring the case, and sequences/ai-credits/automation docs rewritten for the switch 2026-07-18 05:42:50 +02:00
Matthew Meszaros 4399bb8e82 feat: collapse the campaign AI step to a prompt plus draggable named outcome paths — the connections drawn out of the step are the choice set (outcome names live on the ai_label branch conditions, deduped per step and read at run time), drop the ai_labels/ai_output_fields/ai_actions config and the whole AI action palette (side effects are ordinary action steps placed on the chosen path), and fence the contact's email, profile fields, and automation event data as untrusted content in every campaign and automation AI prompt so injected instructions inside replies are ignored 2026-07-18 05:18:24 +02:00
Matthew Meszaros 2945974ca7 feat: build the campaign AI step editor and canvas routing — instruction with contact variables, label/output-field lists, an AI action palette reusing the extracted ActionConfigFields with per-action when-hints and AI-picked tag/label choice sets with max-pick caps, what-AI-can-see context toggles, and AI-label connection paths with inline new-label creation that writes the label back to the step 2026-07-17 16:26:50 +00:00
Matthew Meszaros fd2994bdd8 feat: build the automations builder UI for AI branching — an Ask AI (yes/no) condition field with prompt textarea, event-variable chips and credit note, per-label connection routing on AI classify nodes via a node-editor "Route connections by label" section with purple label edges, and stale label-edge healing on save 2026-07-17 16:26:42 +00:00
Matthew Meszaros 1e1e357c06 feat: add a 0-100 deliverability score plus per-provider seed placement and per-domain warmup placement breakdowns to GET /analytics/deliverability, surface them on a customizable deliverability dashboard (toggleable sections + persisted view), and document the new fields in the guides and API reference 2026-07-16 17:55:34 +02:00
Matthew Meszaros 79c43e2168 feat: add free_model to the agent stream event and transcript client types 2026-07-15 18:52:07 +02:00
Matthew Meszaros 684152d699 feat: add the agent transcript client and hydrated turn and block types used to rehydrate a reopened assistant conversation 2026-07-15 17:54:16 +02:00
Matthew Meszaros e7414f9f3b feat: surface the Done lead status in the campaign Leads table pill and the progress strip as a distinct indigo state 2026-07-15 17:54:03 +02:00
Matthew Meszaros 56de65380b feat: inbox agent that drafts a suggested unibox reply on inbound human replies for human approve/edit/discard - paid + per-org opt-in (organizations.inbox_agent_enabled) feature where the consumer's reply hook, on a non-automated reply, detaches a goroutine (panic-contained, never blocks ingest) that checks entitlement, dedupes via ai_thread_drafts partial unique indexes (one pending per thread, unique source_message_id), pre-checks balance, grounds a reply in the thread history + org voice + skills via generation.Provider.Complete, reserves a draft row then charges 5 credits (idempotency inbox_agent:<draft.ID>, row unwound on a fresh context if the charge fails so no unpaid draft lingers), and emits an org-scoped AI_DRAFT_READY event gated on access_unibox; the agent never sends - only a human POST to /unibox/agent-drafts/:id/approve sends through the normal reply path, claiming pending->approved before send with an approved->pending revert on send failure, alongside list + discard endpoints; plus the unibox awaiting_agent_draft badge + agent_drafts search scope, an AgentDraftCard in the thread view with inline-editable approve-and-send/discard, the workspace settings opt-in toggle, CanUseInboxAgent paid gate, migration 000065, and docs (inbox-agent guide, endpoints, realtime) 2026-07-14 06:13:27 +02:00
Matthew Meszaros a067bf5922 feat: AI action nodes in automations - ai_classify/ai_extract/ai_generate run one generation.Provider completion per node over the event data and merge the result back as a variable (ai_class, output_keys[], ai_text) so downstream conditions branch on it, charging 1 credit per node with a run_id+node_id idempotency key, refund on provider failure, out-of-credits fails only that node while the run continues, and a per-automation ai_credit_failures counter (migration 000064) auto-pauses a flow after 20 consecutive credit misses; classify/extract run deterministic (temperature 0), dry-run executes AI nodes for real and is charged but never touches the auto-pause lifecycle, provider + credit ledger wired into both backend and consumer integration services, plus the reply-classifier Layer 3 ported off its bespoke OpenAI client onto the platform provider via an injected ModelClassifyFunc (platform-paid, deterministic), a CompletionRequest.Temperature primitive threaded through the OpenAI and Anthropic providers, the flow builder palette/config panels/validation for the three AI steps, and a new AI-steps-in-automations guide 2026-07-14 05:30:55 +02:00
Matthew Meszaros 2aec6745fa feat: connect external MCP servers whose tools the AI assistant can use - ai_mcp_servers table with bearer tokens sealed by the org DEK cipher (never returned) and SSRF-validated https urls, a dependency-free streamable-HTTP JSON-RPC client (initialize/tools/list/tools/call over safehttp dial-time IP blocking with SSE+JSON handling and body caps), an mcp service that discovers tools on connect and contributes only enabled servers' tools to the dashboard agent as namespaced mcp_<server>_<tool> defs that are always write-class and never auto-allowed, a registry DynamicToolSource hook so per-org tools join the agent's tool set and resume executes them through ToolDefs, /ai/connections CRUD gated on manage_settings with an mcp_server audit entity and spine, a Connections settings page to add servers and review/enable discovered tools, and docs 2026-07-13 20:05:24 +02:00
Matthew Meszaros a2f50b6572 feat: org AI skills (playbooks) that every AI feature loads and follows - ai_skills table (org-scoped, unique name per org, 32KB content cap) with a skills service exposing CRUD plus an enabled-skills preamble injected into the dashboard agent, contact research, and reply-draft prompts and a load_skill read-tool that returns a playbook's full content by name, /ai/skills CRUD gated on manage_settings (JWT) or the AI_AGENT scope (API) with an ai_skill audit entity and spine entry, an AI skills settings page (list rows opening a right-side drawer with name, one-line description, enable toggle, and a markdown body), and docs with two example playbooks 2026-07-13 19:46:25 +02:00
Matthew Meszaros f48d51bf16 feat: AI contact research agent that gathers cited web findings per contact with sync and background-batch runs - contact_research_runs table plus a strict save_research schema (every signal and public_artifact must carry a url, confidence high/medium/low, signals<=5 hooks<=3, reject-and-reprompt once then fail), a text/template runtime prompt injecting org voice, contact record, objective, and 5-search/6-fetch budgets, a research service that drives search_web/fetch_url through the provider loop and charges 2 credits on save (billable even for nothing_found, refund-free since charged only on save, balance and abuse-cap pre-checked so a capped org never does free work), POST/GET /contacts/:id/research plus a 500-cap /contacts/research/batch draining through a bounded pool of 4 workers over FOR-UPDATE-SKIP-LOCKED claims (no new Kafka), an org-scoped AI_RESEARCH_PROGRESS realtime event gated to view_contacts, APIPermAIResearch bit 23, a ContactEdit Research tab and a ContactsTable bulk Research action, and docs; also org-scopes every credit and research idempotency key so a client-supplied Idempotency-Key can never replay across tenants 2026-07-13 19:34:11 +02:00
Matthew Meszaros 8d208d8c41 feat: org voice profile grounding every AI writing surface plus context-grounded unibox reply drafts - organizations gains product_description/icp_notes/voice_profile (000059) with a manage_settings workspace settings section, generation.BuildVoiceRules and BuildReplyRules fold the humanizer rules and org grounding into every prompt, WritingGenerator.GenerateWriting now takes a VoiceContext and a provider.Complete primitive powers single completions, POST /unibox/reply/draft assembles thread history plus the counterpart contact (custom fields and campaigns) plus the voice profile into a reply-tuned prompt that charges 2 credits with refund-on-failure and a client idempotency key and never sends, a Draft reply button fills the composer, and docs cover the voice profile and AI reply drafts 2026-07-13 19:04:57 +02:00
Matthew Meszaros 7f425c1624 feat: dashboard-wide AI assistant with streamed tool-use runs, per-action approvals, and per-iteration credits - agent_sessions/agent_messages/ai_tool_policies migration, aiagent service runs the M2 registry through the provider loop over a resumable jsonb transcript, streams text/tool-step/approval/done events over SSE, gates write tools behind approve/deny/always-allow (send always per-action) and charges 1 credit per iteration (budget 20, refund on provider failure, out-of-credits 402 insufficient_credits, cap 429 usage_cap_exceeded) with a resume-safe idempotency namespace, provider PreIteration budget hook, /ai/sessions endpoints (cursor list + two SSE runs) gated by membership with tools bound to the member's org-permission bits, APIPermAIAgent bit 22, ai_session audit entity + spine, and a right-side resizable panel (Cmd+I / sparkle button) with streamed text, collapsible tool steps, inline approval and draft-artifact deep-link cards, stop, new chat, and a credits/budget meter; tenancy enforced at the SQL layer and docs for the assistant, endpoints, permissions, and error codes 2026-07-13 18:46:43 +02:00
Matthew Meszaros 5d6ed2a068 feat: AI credit economy with monthly plan grants, non-expiring purchased top-ups, and Stripe billing - two-pool credit_ledger (monthly allowance reset each cycle on invoice.paid, purchased pool via checkout mode=payment fulfilled webhook-only), consume drains monthly-then-purchased, 3 fixed top-up packs, /subscription/credits balance+checkout+paginated transactions gated on manage_billing, one-time trial grant, billing credits card with balance ring and pack buttons, credit_purchase/credit_grant audit entities and spine, wired plan.monthly_credits through pg_plan reads/writes, retry-safe webhook idempotency, and an AI credits guide 2026-07-13 17:40:20 +02:00