Commit Graph
494 Commits
Author SHA1 Message Date
Matthew Meszaros 6b05ca8e48 feat: renumber the sequence AI step migration from 000067 to 000068 after merging main, whose email-auth-state migration takes the 000067 slot in the renumbered sequence 2026-07-17 18:29:41 +02:00
Matthew Meszaros 273dd7ce33 feat: merge main (deliverability auth-state sweep, watch-band cold throttle, research roadmap) plus the 000067 email-auth-state migration renumber into the campaign AI step branch 2026-07-17 18:29:06 +02:00
Matthew Meszaros b564b227c0 feat: add automations Ask AI branch condition and ai_classify per-label edges — a prompt-driven yes/no condition evaluated via the metered provider (fail-safe to the no path, run-history errors, dry-run charged without auto-pause), label:<x> edges validated against the classify node's label set and followed only on the matching verdict, and no credit minting on local-provider refunds 2026-07-17 16:26:30 +00:00
Matthew Meszaros d18c5ebe4a feat: execute campaign AI steps in the scheduler path — one metered completion per contact (SetAI-wired provider + credits with per-step idempotency and refund-on-failure) that labels progress, fills contact custom fields which feed the chosen actions' templates, runs AI-picked pre-configured actions with per-decision campaign logging and tag/label choice resolution, grounds decisions in campaign history and the newest inbound reply via LatestInboundFromContact, and hands instant chains back to the scheduler at AI nodes 2026-07-17 16:26:23 +00:00
Matthew Meszaros 27381aa127 feat: branch campaign sequences on the AI step verdict — ai_label/"is" conditions validated as a strict pair and evaluated deterministically at schedule time off the stored label, threaded through FindNextRoutedPair, GetContactProgress, and a new RecordAILabel upsert (no model call in the scheduler polling path) 2026-07-17 16:26:14 +00:00
Matthew Meszaros 1bf517678a feat: add the campaign sequence AI step data layer — "ai" action config with instruction, label set, output fields, AI-decided action palette (tag/label choice sets, when-hints) and context opt-outs, write-time validation caps, and migration 000067 adding campaign_contact_progress.ai_label 2026-07-17 16:26:08 +00:00
Matthew Meszaros f2a56448fd feat: renumber the email auth state migration from 000051 to 000067 to resolve the duplicate-version collision with 000051_referrals that broke cmd/migrate after merging the deliverability auth-sweep into the ai-platform migration range 2026-07-17 18:18:29 +02:00
Matthew Meszaros cd5e1e9cf7 Merge pull request #72 from warmbly/research/warmup-abuse-cold-effectiveness
feat: deliverability research + observe-only SPF/DKIM/DMARC auth state and watch-band cold throttle
2026-07-17 05:29:58 +02:00
Matthew Meszaros 8af92417bd feat: add authDomainOf unit test covering casing, whitespace, subdomains, and malformed addresses for the auth-check sweep domain extraction 2026-07-17 03:23:46 +00:00
Matthew Meszaros 7176bbce3c feat: add dnsauth unit tests covering Result.State() classification (unknown on empty/transient-error, passing on SPF+DMARC, DKIM advisory) and DMARC policy parsing 2026-07-17 03:22:48 +00:00
Matthew Meszaros e5a6643e2f feat: apply the warmup watch-band volume multiplier (0.7x) to cold campaign sends via the shared adjustmentFor helper so a watch-state mailbox slows cold volume before it hard-quarantines 2026-07-17 03:21:29 +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 d0e8bc1c97 feat: add one-command MCP OAuth connect on api.warmbly.com/v1/mcp — RFC 7591 dynamic client registration for public PKCE clients (dcr.go), RFC 9728 protected-resource metadata + WWW-Authenticate challenge via MCPAuthMiddleware, /v1/mcp now accepts an API key or OAuth token, public-client auth with no secret and mandatory PKCE reusing the existing OAuth 2.1 server (nullable-org clients, migration 000066), executable-redirect-scheme hardening on the open register endpoint, plus mcp/oauth/authentication/endpoints docs 2026-07-16 08:57:19 +02:00
Matthew Meszaros fabb1d2a42 feat: broaden the agent tool registry: list_campaign_leads (derived lead statuses + totals, the correct source for cold-lead/follow-up questions), set_campaign_status (approval-gated start/stop), get_dashboard_analytics, list_mailboxes (health + warmup), list_pipelines, list_deals, add_contact_note, and a list_threads description that steers the model to list_campaign_leads and to retry unfiltered before concluding the inbox is empty 2026-07-16 07:50:24 +02:00
Matthew Meszaros 73c80530c3 feat: adapt the OpenAI-compatible provider to the gpt-5.x/o-series request shape at runtime: a 400 naming max_tokens or temperature flips a sticky per-provider flag (max_completion_tokens / omit temperature) and retries, so newer OpenAI models work while Ollama/Groq/OpenRouter keep the legacy params 2026-07-16 07:25:08 +02:00
Matthew Meszaros fd0be6e5ff feat: log the real provider error (org, session, provider, model) and transcript-persist failures server-side when an agent run fails, instead of swallowing them behind the generic provider_error SSE message 2026-07-16 07:18:56 +02:00
Matthew Meszaros a913e73837 feat: seed the sandbox org's AI-credit ledger (plan monthly allowance + a 5000-credit purchased top-up with idempotent grant transactions) so the assistant never reports out-of-credits in the demo; re-seeding refills both pools 2026-07-16 06:52:30 +02:00
Matthew Meszaros e64b0b161d feat: sweep stale OPENAI_API_KEY/AI_LOCAL_MODEL mentions out of comments, the provider-not-configured and warmup-admin error strings, env.example, and the deployment guide now that AI_* is the only config surface 2026-07-16 06:39:07 +02:00
Matthew Meszaros 29e3bb3a64 feat: drop the legacy OPENAI_*/ANTHROPIC_API_KEY/AI_LOCAL_MODEL env fallbacks (no prod deployments exist): AI_PROVIDER/AI_API_KEY/AI_MODEL/AI_BASE_URL/AI_FREE are the only AI vars, empty provider means openai, the anthropic preset and writing client key off AI_API_KEY, and the warmup Batch generator runs only when the selected provider is OpenAI 2026-07-16 06:39:06 +02:00
Matthew Meszaros d8475a1896 feat: render assistant replies as markdown with a dependency-free React renderer (bold, lists, inline code, safe links, fenced code) and prompt the agent to emit that simple subset 2026-07-16 06:28:29 +02:00
Matthew Meszaros 9d76685fb2 feat: add generation.Resolve mapping an AI_PROVIDER preset (openai/openrouter/groq/ollama/anthropic/custom) plus AI_API_KEY/AI_MODEL/AI_BASE_URL/AI_FREE into a provider config, erroring on a base-less custom provider instead of leaking the key to OpenAI 2026-07-16 06:14:19 +02:00
Matthew Meszaros 42b770f0dc feat: add config.GetBoolPtr returning nil when an optional boolean env is unset, so a caller can fall back to its own default 2026-07-16 06:14:19 +02:00
Matthew Meszaros e28d2f6d88 feat: deactivate the base-fixture Acme/Globex demo mailboxes in the sandbox so the worker reconciler stops failing to decrypt their placeholder credentials, leaving only the real Sunrise mailboxes active 2026-07-15 19:19:35 +02:00
Matthew Meszaros a22a51ebcb feat: skip credits for automation AI nodes when running on a free/local model 2026-07-15 18:52:07 +02:00
Matthew Meszaros 8bc782f098 feat: skip credits (and the unpaid-draft unwind) for the inbox agent when running on a free/local model 2026-07-15 18:52:07 +02:00
Matthew Meszaros 96b8e9dcd6 feat: skip credits for contact research runs when running on a free/local model 2026-07-15 18:52:07 +02:00
Matthew Meszaros 44797191b8 feat: skip credits for reply drafts when running on a free/local model 2026-07-15 18:52:07 +02:00
Matthew Meszaros 18a98944ae feat: skip credits for the writing assistant when running on a free/local model, returning the unchanged balance 2026-07-15 18:52:07 +02:00
Matthew Meszaros 59044aedf2 feat: the dashboard agent runs un-metered on a free/local model, streams a free_model signal, and injects the org voice profile into its system prompt so its writing sounds human 2026-07-15 18:51:51 +02:00
Matthew Meszaros b49b07d0f2 feat: persist a free_model flag on the agent session context so a reopened assistant tab keeps the free-model notice 2026-07-15 18:51:51 +02:00
Matthew Meszaros 42f2a9bf77 feat: add generation.BuildAgentVoiceRules - the shared humanizer bans plus the org voice grounding, scoped for the dashboard agent so it does not hijack the agent role 2026-07-15 18:51:51 +02:00
Matthew Meszaros 80452ce4b4 feat: add IsLocal() to the WritingGenerator interface and its hosted writing clients so the writing surfaces can detect a free/local model 2026-07-15 18:51:51 +02:00
Matthew Meszaros 84424fec8f feat: add a free/local model flag to the generation provider - ProviderConfig.Local, Provider.IsLocal(), and a local default model (llama3.1) for OpenAI-compatible endpoints 2026-07-15 18:51:51 +02:00
Matthew Meszaros 1a33b1d604 feat: add config.GetBoolOptional for parsing optional boolean env values such as AI_LOCAL_MODEL 2026-07-15 18:51:51 +02:00
Matthew Meszaros 81bfb41d4e feat: add GET /ai/sessions/:id/messages returning a session transcript hydrated into the client turn and block shape plus any pending approval, so a reopened assistant conversation rehydrates 2026-07-15 17:54:16 +02:00
Matthew Meszaros 22edb6f445 feat: enrich the Sunrise sandbox with realistic history - a send funnel with done, processing, queued, replied and bounced leads, a live unified inbox, a CRM pipeline with deals, tasks and notes, reply templates, notifications, and daily campaign, warmup and email-count rollups 2026-07-15 17:54:16 +02:00
Matthew Meszaros dd7ae4d56c feat: derive a completed (Done) campaign lead status when every email step has been sent with no reply or bounce, across the per-lead search, the lead-status filter, and the campaign lead counts 2026-07-15 17:54:03 +02:00
Matthew Meszaros 98353d9ac7 fix: make-sandbox org owner gets full dashboard access - the sandbox seed inserted the owner organization_members row without a permissions mask so it defaulted to 0 and every org-scoped route 403'd with 'you don't have access to this feature' across the whole dashboard; seed the owner with RolePermissions[RoleOwner] (0xFFFF) exactly like a real signup and repair an existing broken row on re-seed via ON CONFLICT DO UPDATE, plus grant OrganizationMember.HasPermission an owner bypass so an owner is never locked out of their own org regardless of the stored mask (matching the web client which already short-circuits owners) 2026-07-15 06:59:35 +02:00
Matthew Meszaros d038635425 feat: inbox agent skips drafting trivial acknowledgement replies - reuse replyclassify.WorthModeling on the inbound reply snippet so a one-line 'thanks'/'ok, got it' never triggers a paid 5-credit reply draft, threading the reply snippet through the InboxAgentReply hook payload; the org is only charged when there is enough human text to warrant a real reply 2026-07-14 07:32:16 +02:00
Matthew Meszaros 78ff73e45c feat: ground inbox-agent reply drafts in the counterpart contact's CRM record - the inbox agent now folds the replying contact's name, company, and known custom fields into the draft prompt (mirroring the manual unibox reply draft) via an optional ContactReader wired from repository.ContactRepository in both the backend and consumer, best-effort so a lookup miss just drops the grounding, so suggested replies reference what Warmbly already knows about the person 2026-07-14 07:29:56 +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 24a932c439 feat: Warmbly MCP server exposing the tool registry to any MCP client at /api/v1/mcp - a streamable-HTTP JSON-RPC endpoint (initialize/tools/list/tools/call/ping) authenticated by API key, where tools/list reflects only the static tools the key's permission mask allows and tools/call runs them gated by each tool's RequiredAPIPerm, send-class tools are never exposed or callable, per-key rate limits and usage logging apply, and the org's own connected MCP tools are not re-exposed; plus api/mcp.mdx documenting the connection url, bearer auth, the tool catalog, and Claude Code/Desktop and Cursor client configs, linked from endpoints and authentication 2026-07-13 20:11:21 +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 6ad2f13a39 feat: shared AI tool registry (internal/app/aitools) that runs 16 permission-gated tools as the invoking user over existing service-layer calls - Registry+Invocation enforce org-permission bits (JWT) or API-key bits per tool, ToolDefs binds handlers into the provider agent loop and Call powers direct MCP invocation; tools cover contacts (search/get/update/add_tag/remove_tag), CRM (create_task/create_deal), campaigns (list/stats/create_campaign_draft), unibox (list_threads/get_thread/draft_reply, gated on CanUseUnibox, draft never sends), create_automation_draft (disabled), and web search_web + fetch_url (webhook SSRF validator + safehttp dial-block + 2MB cap + html-to-text + 15min Redis cache + rune-safe truncation); every write audits via AuditService.LogAction so the spine refreshes teammates, registry built once in main and exposed on the handler for M3/M8 2026-07-13 18:15:58 +02:00
Matthew Meszaros e07c33d3cd feat: provider-agnostic LLM agent-loop layer (OpenAI-first, Anthropic self-host connector) with RunAgent tool-use loop, approval/resume contract, pluggable web search, and extracted voice-rules builder - generation.Provider.RunAgent executes Go tool handlers over a resumable transcript with a read-auto/write-approve gate, openAIProvider drives it via a lean HTTP client retargetable with OPENAI_BASE_URL for any OpenAI-compatible endpoint and also serves the writing assistant, anthropicProvider mirrors it with tool_use/tool_result multi-turn plus hosted web_search, NewProvider prefers OPENAI_API_KEY, SearchClient supports Serper/SearXNG with a clean not-configured error, and BuildVoiceRules extracts the humanizer prompt for reuse; refreshed stale model ids to sonnet-4-6 and haiku-4-5 2026-07-13 17:52:09 +02:00