Skip to content
Merged

Test #728

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f99277e
feat(measurement-jobs): free-tier card gate (setup mode) + instant ba…
sweetmantech Jun 16, 2026
158a1d4
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 16, 2026
5fa5e3a
fix(songstats-backfill): backoff on 429 + defer instead of churn (cha…
sweetmantech Jun 16, 2026
1e9deac
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 16, 2026
5f45946
refactor(songstats): remove local quota ledger + budget gate (chat#17…
sweetmantech Jun 16, 2026
5472795
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 16, 2026
f24d4c7
feat: POST /api/catalogs (create + materialize from valuation snapsho…
sweetmantech Jun 18, 2026
ace0b01
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 18, 2026
a520a1d
fix: LEFT-join artists in catalog-songs read (materialized tracks wer…
sweetmantech Jun 18, 2026
76b5739
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 18, 2026
709ea0c
feat: add X (Twitter) + LinkedIn to the Composio connector whitelist …
sweetmantech Jun 18, 2026
8a3c3cb
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 18, 2026
66cc2fe
chore: remove unused ALLOWED_ARTIST_CONNECTORS from api (chat#1793) (…
sweetmantech Jun 18, 2026
79c22da
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 18, 2026
6fc10cc
fix: enrich valuation-captured songs (artists + notes) so they render…
sweetmantech Jun 18, 2026
0e42d02
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 18, 2026
2fa7029
fix(tasks): let admins fetch any task by id alone (cross-account read…
sweetmantech Jun 19, 2026
bd2ae10
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 19, 2026
cdb34d0
feat(connectors): POST /api/connectors/files — stage images for Linke…
sweetmantech Jun 20, 2026
acae4d8
Merge main into test (sync #692 Songstats work)
sweetmantech Jun 23, 2026
2a7af68
feat(artists): account_id override for DELETE /api/artists/{id} (#693)
sweetmantech Jun 23, 2026
8c962ef
Merge main into test (sync #696)
sweetmantech Jun 23, 2026
8b6a3bb
feat(chats): admins (RECOUP_ORG) can access any chat — read + write (…
sweetmantech Jun 23, 2026
03e0ef5
Enforce account_api_keys.expires_at in x-api-key auth (chat#1813) (#700)
sweetmantech Jun 24, 2026
bff29ae
Merge branch 'main' into test
sweetmantech Jun 24, 2026
78bd71b
refactor(chat): extract shared buildRunAgentInput (chat#1813) (#701)
sweetmantech Jun 24, 2026
2209b7d
Re-point POST /api/chat/generate onto runAgentWorkflow + ephemeral ke…
sweetmantech Jun 24, 2026
af7eaa5
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 24, 2026
b84e4a1
Merge remote-tracking branch 'origin/main' into HEAD
sweetmantech Jun 24, 2026
4c09cf0
Retire OpenClaw prompt_sandbox → run-sandbox-command bridge (chat#181…
sweetmantech Jun 24, 2026
f1ade64
Merge remote-tracking branch 'origin/main' into HEAD
sweetmantech Jun 24, 2026
4ecca44
feat: POST /api/emails + route ephemeral key to RECOUP_API_KEY (#1815…
sweetmantech Jun 25, 2026
27f0532
Merge origin/main into test (sync after #709 test→main promotion)
sweetmantech Jun 25, 2026
6d9e74e
fix(skills): install the renamed global skills into sandboxes (chat#1…
sweetmantech Jun 25, 2026
a463e59
Merge origin/main into test (sync after #713 test→main promotion)
sweetmantech Jun 25, 2026
18d20f7
feat(emails): make `to` and `subject` optional on POST /api/emails (#…
sweetmantech Jun 25, 2026
d981536
chore: remove POST /api/notifications (superseded by /api/emails) (#711)
sweetmantech Jun 25, 2026
cae9f35
Merge origin/main into test (sync for #715 promotion)
sweetmantech Jun 25, 2026
be2abcc
fix: repoint dead .com hosts to live .dev (recoupable/chat#1819 §A+§B…
sweetmantech Jun 29, 2026
0e0bac0
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 29, 2026
e6610b4
fix: repoint remaining .com refs missed by api#719 (domain cutover) (…
sweetmantech Jun 30, 2026
bdcd796
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 30, 2026
c5e3e1f
Merge remote-tracking branch 'origin/main' into test
sweetmantech Jun 30, 2026
8a3d084
fix(chat/runs): install global skills in the headless run path (#722)
sweetmantech Jun 30, 2026
71c920e
Merge origin/main into test (sync after #727 test->main release)
sweetmantech Jun 30, 2026
d7b06ce
HOLD MERGE — api brand email → @recoupable.dev (+ inbound @mail.recou…
sweetmantech Jun 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/emails/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function OPTIONS() {
* POST /api/emails
*
* Sends an email to one or more explicit recipients via Resend. Emails are sent
* from `Agent by Recoup <agent@recoupable.com>`. Account-scoped — requires
* from `Agent by Recoup <agent@recoupable.dev>`. Account-scoped — requires
* authentication via x-api-key header or Authorization Bearer token.
*
* Body parameters:
Expand Down
2 changes: 1 addition & 1 deletion lib/composio/toolRouter/getSharedAccountConnections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const SHARED_ACCOUNT_ID = "recoup-shared-767f498e-e1e9-43c6-a152-a96ae3bd8d07";
* Get Google Drive/Sheets/Docs connections from the shared Recoupable account.
*
* When a customer doesn't want to grant full Google Drive access,
* they can share specific files with shared@recoupable.com instead.
* they can share specific files with shared@recoupable.dev instead.
* This function fetches the shared account's connections so they
* can be used as a fallback in tool router sessions.
*
Expand Down
8 changes: 4 additions & 4 deletions lib/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export const PRIVY_PROJECT_SECRET = process.env.PRIVY_PROJECT_SECRET;
/** Base URL for the public API documentation site */
export const DOCS_BASE_URL = "https://docs.recoupable.dev";

/** Domain for receiving inbound emails (e.g., support@mail.recoupable.com) */
export const INBOUND_EMAIL_DOMAIN = "@mail.recoupable.com";
/** Domain for receiving inbound emails (e.g., support@recoupable.dev) */
export const INBOUND_EMAIL_DOMAIN = "@recoupable.dev";

/** Domain for sending outbound emails (e.g., support@recoupable.com) */
export const OUTBOUND_EMAIL_DOMAIN = "@recoupable.com";
/** Domain for sending outbound emails (e.g., support@recoupable.dev) */
export const OUTBOUND_EMAIL_DOMAIN = "@recoupable.dev";

/** Default from address for outbound emails */
export const RECOUP_FROM_EMAIL = `Agent by Recoup <agent${OUTBOUND_EMAIL_DOMAIN}>`;
Expand Down
2 changes: 1 addition & 1 deletion lib/emails/__tests__/processAndSendEmail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("processAndSendEmail", () => {
}
expect(mockSendEmailWithResend).toHaveBeenCalledWith(
expect.objectContaining({
from: "Agent by Recoup <agent@recoupable.com>",
from: "Agent by Recoup <agent@recoupable.dev>",
to: ["user@example.com"],
subject: "Test",
html: expect.stringContaining("Hello world"),
Expand Down
45 changes: 21 additions & 24 deletions lib/emails/inbound/__tests__/getFromWithName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,78 @@ import { getFromWithName } from "../getFromWithName";

describe("getFromWithName", () => {
describe("outbound domain conversion", () => {
it("converts inbound @mail.recoupable.com to outbound @recoupable.com", () => {
const result = getFromWithName(["support@mail.recoupable.com"]);
it("converts inbound @recoupable.dev to outbound @recoupable.dev", () => {
const result = getFromWithName(["support@recoupable.dev"]);

expect(result).toBe("Support by Recoup <support@recoupable.com>");
expect(result).toBe("Support by Recoup <support@recoupable.dev>");
});

it("preserves the email name when converting domains", () => {
const result = getFromWithName(["agent@mail.recoupable.com"]);
const result = getFromWithName(["agent@recoupable.dev"]);

expect(result).toBe("Agent by Recoup <agent@recoupable.com>");
expect(result).toBe("Agent by Recoup <agent@recoupable.dev>");
});
});

describe("finding inbound email", () => {
it("finds recoup email in to array", () => {
const result = getFromWithName(["hello@mail.recoupable.com"]);
const result = getFromWithName(["hello@recoupable.dev"]);

expect(result).toBe("Hello by Recoup <hello@recoupable.com>");
expect(result).toBe("Hello by Recoup <hello@recoupable.dev>");
});

it("finds recoup email among multiple to addresses", () => {
const result = getFromWithName([
"other@example.com",
"support@mail.recoupable.com",
"support@recoupable.dev",
"another@example.com",
]);

expect(result).toBe("Support by Recoup <support@recoupable.com>");
expect(result).toBe("Support by Recoup <support@recoupable.dev>");
});

it("falls back to cc array when not in to array", () => {
const result = getFromWithName(["other@example.com"], ["support@mail.recoupable.com"]);
const result = getFromWithName(["other@example.com"], ["support@recoupable.dev"]);

expect(result).toBe("Support by Recoup <support@recoupable.com>");
expect(result).toBe("Support by Recoup <support@recoupable.dev>");
});

it("prefers to array over cc array", () => {
const result = getFromWithName(
["to-agent@mail.recoupable.com"],
["cc-agent@mail.recoupable.com"],
);
const result = getFromWithName(["to-agent@recoupable.dev"], ["cc-agent@recoupable.dev"]);

expect(result).toBe("To-agent by Recoup <to-agent@recoupable.com>");
expect(result).toBe("To-agent by Recoup <to-agent@recoupable.dev>");
});

it("handles case-insensitive domain matching", () => {
const result = getFromWithName(["Support@MAIL.RECOUPABLE.COM"]);
const result = getFromWithName(["Support@RECOUPABLE.DEV"]);

expect(result).toBe("Support by Recoup <Support@recoupable.com>");
expect(result).toBe("Support by Recoup <Support@recoupable.dev>");
});
});

describe("error handling", () => {
it("throws error when no recoup email found in to or cc", () => {
expect(() => getFromWithName(["other@example.com"])).toThrow(
"No email found ending with @mail.recoupable.com",
"No email found ending with @recoupable.dev",
);
});

it("throws error when arrays are empty", () => {
expect(() => getFromWithName([])).toThrow("No email found ending with @mail.recoupable.com");
expect(() => getFromWithName([])).toThrow("No email found ending with @recoupable.dev");
});
});

describe("name formatting", () => {
it("capitalizes first letter of name", () => {
const result = getFromWithName(["lowercase@mail.recoupable.com"]);
const result = getFromWithName(["lowercase@recoupable.dev"]);

expect(result).toBe("Lowercase by Recoup <lowercase@recoupable.com>");
expect(result).toBe("Lowercase by Recoup <lowercase@recoupable.dev>");
});

it("preserves rest of name casing", () => {
const result = getFromWithName(["myAgent@mail.recoupable.com"]);
const result = getFromWithName(["myAgent@recoupable.dev"]);

expect(result).toBe("MyAgent by Recoup <myAgent@recoupable.com>");
expect(result).toBe("MyAgent by Recoup <myAgent@recoupable.dev>");
});
});
});
2 changes: 1 addition & 1 deletion lib/emails/inbound/getFromWithName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { OUTBOUND_EMAIL_DOMAIN, INBOUND_EMAIL_DOMAIN } from "@/lib/const";
*
* @param toEmails - Array of email addresses from the 'to' field
* @param ccEmails - Optional array of email addresses from the 'cc' field (fallback)
* @returns Formatted email address with display name (e.g., "Support by Recoup <support@recoupable.com>")
* @returns Formatted email address with display name (e.g., "Support by Recoup <support@recoupable.dev>")
* @throws Error if no email ending with the inbound domain is found in either array
*/
export function getFromWithName(toEmails: string[], ccEmails: string[] = []): string {
Expand Down
2 changes: 1 addition & 1 deletion lib/emails/isTestEmail.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Returns true if the email is a test email
export const isTestEmail = (email: string): boolean => {
return email === "sweetmantech@gmail.com" || email === "sidney@recoupable.com";
return email === "sweetmantech@gmail.com" || email === "sidney@recoupable.dev";
};
2 changes: 1 addition & 1 deletion lib/emails/sendEmailHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { processAndSendEmail } from "@/lib/emails/processAndSendEmail";
* Handler for POST /api/emails.
*
* Sends an email to the explicit recipients in the request body via Resend
* (from `Agent by Recoup <agent@recoupable.com>`), reusing the same
* (from `Agent by Recoup <agent@recoupable.dev>`), reusing the same
* `processAndSendEmail` domain function as the `send_email` MCP tool.
* Account-scoped: requires authentication via x-api-key or Authorization Bearer.
* Body validation, auth, and the recipient restriction all live in
Expand Down
6 changes: 3 additions & 3 deletions lib/sandbox/__tests__/resolveGitUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("resolveGitUser", () => {
const gitUser = await resolveGitUser(ACCOUNT_ID);

expect(gitUser.name).toBe("Ada Lovelace");
expect(gitUser.email).toBe(`${ACCOUNT_ID}@users.noreply.recoupable.com`);
expect(gitUser.email).toBe(`${ACCOUNT_ID}@users.noreply.recoupable.dev`);
});

it("falls back on both fields when nothing is on file", async () => {
Expand All @@ -64,7 +64,7 @@ describe("resolveGitUser", () => {

expect(gitUser).toEqual({
name: `recoupable-${ACCOUNT_ID.slice(0, 8)}`,
email: `${ACCOUNT_ID}@users.noreply.recoupable.com`,
email: `${ACCOUNT_ID}@users.noreply.recoupable.dev`,
});
});

Expand All @@ -78,6 +78,6 @@ describe("resolveGitUser", () => {

const gitUser = await resolveGitUser(ACCOUNT_ID);

expect(gitUser.email).toBe(`${ACCOUNT_ID}@users.noreply.recoupable.com`);
expect(gitUser.email).toBe(`${ACCOUNT_ID}@users.noreply.recoupable.dev`);
});
});
2 changes: 1 addition & 1 deletion lib/sandbox/resolveGitUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function resolveGitUser(accountId: string): Promise<GitUser> {
const emailRow = emails.find(row => typeof row.email === "string" && row.email.length > 0);

const name = account?.name?.trim() || `recoupable-${accountId.slice(0, 8)}`;
const email = emailRow?.email ?? `${accountId}@users.noreply.recoupable.com`;
const email = emailRow?.email ?? `${accountId}@users.noreply.recoupable.dev`;

return { name, email };
}
Loading