Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: agent email client with Outlook layout, rich editor, attachments & forwarding (#7)

Gener73839a674739
diff --git a/.gitignore b/.gitignore
index 69a49e10e..eddb4e4b3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,5 @@ docs/
plans/
.agents/
.claude/
-.impeccable.md
\ No newline at end of file
+.impeccable.md
+.playwright-mcp/
\ No newline at end of file
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5d37de025..e62314cd5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -110,6 +110,33 @@ importers:
'@opennextjs/cloudflare':
specifier: ^1.19.1
+ '@tiptap/extension-color':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected])))
+ '@tiptap/extension-image':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-link':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-placeholder':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-text-align':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-text-style':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-underline':
+ specifier: ^3.22.3
+ version: 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/react':
+ specifier: ^3.22.3
+ '@tiptap/starter-kit':
+ specifier: ^3.22.3
+ version: 3.22.3
better-auth:
specifier: ^1.6.1
@@ -1641,6 +1668,9 @@ packages:
'@poppinss/[email protected]':
resolution: {integrity: sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==}
+ '@remirror/[email protected]':
+ resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==}
+
'@rolldown/[email protected]':
resolution: {integrity: sha512-YYe6aWruPZDtHNpwu7+qAHEMbQ/yRl6atqb/AhznLTnD3UY99Q1jE7ihLSahNWkF4EqRPVC4SiR4O0UkLK02tA==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -2069,6 +2099,180 @@ packages:
'@tailwindcss/[email protected]':
resolution: {integrity: sha512-n4goKQbW8RVXIbNKRB/45LzyUqN451deQK0nzIeauVEqjlI49slUlgKYJM2QyUzap/PcpnS7kzSUmPb1sCRvYQ==}
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Dv9MKK5BDWCF0N2l6/Pxv3JNCce2kwuWf2cKMBc2bEetx0Pn6o7zlFmSxMvYK4UtG1Tw9Yg/ZHi6QOFWK0Zm9Q==}
+ peerDependencies:
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-IaUx3zh7yLHXzIXKL+fw/jzFhsIImdhJyw0lMhe8FfYrefFqXJFYW/sey6+L/e8B3AWvTksPA6VBwefzbH77JA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-tysipHla2zCWr8XNIWRaW9O+7i7/SoEqnRqSRUUi2ailcJjlia+RBy3RykhkgyThrQDStu5KGBS/UvrXwA+O1A==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Y6zQjh0ypDg32HWgICEvmPSKjGLr39k3aDxxt/H0uQEZSfw4smT0hxUyyyjVjx68C6t6MTnwdfz0hPI5lL68vQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-xOmW/b1hgECIE6r3IeZvKn4VVlG3+dfTjCWE6lnnyLaqdNkNhKS1CwUmDZdYNLUS2ryIUtgz5ID1W/8A3PhbiA==}
+ peerDependencies:
+ '@tiptap/extension-list': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-RiQtEjDAPrHpdo6sw6b7fOw/PijqgFIsozKKkGcSeBgWHQuFg7q9OxJTj+l0e60rVwSu/5gmKEEobzM9bX+t2Q==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-wafWTDQOuMKtXpZEuk1PFQmzopabBciNLryL90MB9S03MNLaQQZYLnmYkDBlzAaLAbgF5QiC+2XZQEBQuTVjFQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-eZtOc4Zp5jnlZh4+gvr3JmOa3kPlIU8IbTByDMgXEMdVGZ5cOk+H4TMIlhU0j7j1TMWm8+r1WYtrU9E9ooz9hQ==}
+ peerDependencies:
+ '@tiptap/extension-text-style': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-MCSr1PFPtTd++lA3H1RNgqAczAE59XXJ5wUFIQf2F+/0DPY5q2SU4g5QsNJVxPPft5mrNT4C6ty8xBPrALFEdA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-taXq9Tl5aybdFbptJtFRHX9LFJzbXphAbPp4/vutFyTrBu5meXDxuS+B9pEmE+Or0XcolTlW2nDZB0Tqnr18JQ==}
+ peerDependencies:
+ '@tiptap/extensions': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-0f8b4KZ3XKai8GXWseIYJGdOfQr3evtFbBo3U08zy2aYzMMXWG0zEF7qe5/oiYp2aZ95edjjITnEceviTsZkIg==}
+ peerDependencies:
+ '@floating-ui/dom': ^1.0.0
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-L/Px4UeQEVG/D9WIlcAOIej+4wyIBCMUSYicSR+hW68UsObe4rxVbUas1QgidQKm6DOhoT7U7D4KQHA/Gdg/7A==}
+ peerDependencies:
+ '@tiptap/extensions': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-J0v8I99y9tbvVmgKYKzKP/JYNsWaZYS7avn4rzLft2OhnyTfwt3OoY8DtpHmmi6apSUaCtoWHWta/TmoEfK1nQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-XBHuhiEV2EEhZHpOLcplLqAmBIhJciU3I6AtwmqeEqDC0P114uMEfAO7JGlbBZdCYotNer26PKnu44TBTeNtkw==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-wI2bFzScs+KgWeBH/BtypcVKeYelCyqV0RG8nxsZMWtPrBhqixzNd0Oi3gEKtjSjKUqMQ/kjJAIRuESr5UzlHA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Qpp8c5LOQaNpHrzjqZtoxtIR+8sSqJ7k8v+8anmYw3nxjvt2kpfT28Vd7aWMX55ZS43LaxMx+MkZqbmgUmMP0w==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-LteA4cb4EGCiUtrK2JHvDF/Zg0/YqV4DUyHhAAho+oGEQDupZlsS6m0ia5wQcclkiTLzsoPrwcSNu6RDGQ16wQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-S8/P2o9pv6B3kqLjH2TRWwSAximGbciNc6R8/QcN6HWLYxp0N0JoqN3rZHl9VWIBAGRWc4zkt80dhqrl2xmgfQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-80CNf4oO5y8+LdckT4CyMe1t01EyhpRrQC9H45JW20P7559Nrchp5my3vvMtIAJbpTPPZtcB7LwdzWGKsG5drg==}
+ peerDependencies:
+ '@tiptap/extension-list': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-pKuyj5llu35zd/s2u/H9aydKZjmPRAIK5P1q/YXULhhCNln2RnmuRfQ5NklAqTD3yGciQ2lxDwwf7J6iw3ergA==}
+ peerDependencies:
+ '@tiptap/extension-list': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-rqvv/dtqwbX+8KnPv0eMYp6PnBcuhPMol5cv1GlS8Nq/Cxt68EWGUHBuTFesw+hdnRQLmKwzoO1DlRn7PhxYRQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-orAghtmd+K4Euu4BgI1hG+iZDXBYOyl5YTwiLBc2mQn+pqtZ9LqaH2us4ETwEwNP3/IWXGSAimUZ19nuL+eM2w==}
+ peerDependencies:
+ '@tiptap/extension-list': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-oO7rhfyhEuwm+50s9K3GZPjYyEEEvFAvm1wXopvZnhbkBLydIWImBfrZoC5IQh4/sRDlTIjosV2C+ji5y0tUSg==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-7vbtlDVO00odqCnsMSmA4b6wjL5PFdfExFsdsDO0K0VemqHZ/doIRx/tosNUD1VYSOyKQd8U7efUjkFyVoIPlg==}
+ peerDependencies:
+ '@tiptap/extensions': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-jY2InoUlKkuk5KHoIDGdML1OCA2n6PRHAtxwHNkAmiYh0Khf0zaVPGFpx4dgQrN7W5Q1WE6oBZnjrvy6qb7w0g==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-dG1NHE0yGf7fYiOdabCJuecI2IJ1uogyY/QvZqvPNaxRjZDoXYuGlMtz9jEDiIdQSaPED2MSsS7KkuNFQIEMGg==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-JKmWAogM/LX9ZJmXJQalpcR77wWVtVXdRFgvHGsFomW9WFhZqcnIEDWR2sbpZHWtu8dml6eBQGhdLppJmxeFfA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Q9R7JsTdomP5uUjtPjNKxHT1xoh/i9OJZnmgJLe7FcgZEaPOQ3bWxmKZoLZQfDfZjyB8BtH+Hc7nUvhCMOePxw==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-Ch6CBWRa5w90yYSPUW6x9Py9JdrXMqk3pZ9OIlMYD8A7BqyZGfiHerX7XDMYDS09KjyK3U9XH60/zxYOzXdDLA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-s5eiMq0m5N6N+W7dU6rd60KgZyyCD7FvtPNNswISfPr12EQwJBfbjWwTqd0UKNzA4fNrhQEERXnzORkykttPeA==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-NjfWjZuvrqmpICT+GZWNIjtOdhPyqFKDMtQy7tsQ5rErM9L2ZQdy/+T/BKSO1JdTeBhdg9OP+0yfsqoYp2aT6A==}
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-6MNr6z0PxwfJFs+BKhHcvPNvY+UV1PXgqzTiTM4Z9guml84iVZxv7ZOCSj1dFYTr3Bf1MiOs4hT1yvBFlTfIaQ==}
+ peerDependencies:
+ '@tiptap/core': ^3.22.3
+ '@tiptap/pm': ^3.22.3
+ '@types/react': ^17.0.0 || ^18.0.0 || ^19.0.0
+ '@types/react-dom': ^17.0.0 || ^18.0.0 || ^19.0.0
+ react: ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
+
+ '@tiptap/[email protected]':
+ resolution: {integrity: sha512-vdW/Oo1fdwTL1VOQ5YYbTov00ANeHLquBVEZyL/EkV7Xv5io9rXQsCysJfTSHhiQlyr2MtWFB4+CPGuwXjQWOQ==}
+
'@ts-morph/[email protected]':
resolution: {integrity: sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ==}
@@ -2231,9 +2435,18 @@ packages:
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==}
+
resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==}
+
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
@@ -2269,6 +2482,9 @@ packages:
resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==}
+
resolution: {integrity: sha512-lrpDziQipxCEeK5kWxvljWYhUvOiB2A9izZd9B2AFarYAkqZshb4lPbRs7zKEic6eGtH8V/2qJW+dPp9OtF6bw==}
@@ -2911,6 +3127,9 @@ packages:
typescript:
optional: true
+ resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==}
+
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'}
@@ -3330,6 +3549,10 @@ packages:
resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==}
engines: {node: '>=8.6'}
+ resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
+ engines: {node: '>=0.12'}
+
resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
engines: {node: '>=0.12'}
@@ -3579,6 +3802,10 @@ packages:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+ resolution: {integrity: sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==}
+ engines: {node: '>=6.0.0'}
+
resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==}
engines: {node: '>=8.6.0'}
@@ -4300,6 +4527,12 @@ packages:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
+ resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
+
+ resolution: {integrity: sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA==}
+
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
@@ -4339,6 +4572,10 @@ packages:
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
+ resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==}
+ hasBin: true
+
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
@@ -4401,6 +4638,9 @@ packages:
resolution: {integrity: sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==}
+ resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
+
resolution: {integrity: sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==}
engines: {node: '>= 0.8'}
@@ -4741,6 +4981,9 @@ packages:
resolution: {integrity: sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==}
+
resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==}
@@ -4888,10 +5131,72 @@ packages:
resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==}
+ resolution: {integrity: sha512-LvqH2v7Q2SF6yxatuPP2e8vSUKS/L+xAU7dPDC4RMyHMhZoGDfBC74mYuyYF4gLqOEG758wajtyhNnsTkuhvng==}
+
+ resolution: {integrity: sha512-4SnynYR9TTYaQVXd/ieUvsVV4PDMBzrq2xPUWutHivDuOshZXqQ5rGbZM84HEaXKbLdItse7weMGOUdDVcLKEQ==}
+
+ resolution: {integrity: sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==}
+
+ resolution: {integrity: sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==}
+
+ resolution: {integrity: sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==}
+
+ resolution: {integrity: sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==}
+
+ resolution: {integrity: sha512-7wj4uMjKaXWAQ1CDgxNzNtR9AlsuwzHfdFH1ygEHA2KHF2DOEaXl1CJfNPAKCg9qNEh4rum975QLaCiQPyY6Fw==}
+
+ resolution: {integrity: sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==}
+
+ resolution: {integrity: sha512-D98dm4cQ3Hs6EmjK500TdAOew4Z03EV71ajEFiWra3Upr7diytJsjF4mPV2dW+eK5uNectiRj0xFxYI9NLXDbw==}
+
+ resolution: {integrity: sha512-TImyPXCHPcDsSka2/lwJ6WjTASr4re/qWq1yoTTuLOqfXucwF6VcRa2LWCkM/EyTD1UO3CUwiH8qURJoWJRxwg==}
+
+ resolution: {integrity: sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA==}
+
+ resolution: {integrity: sha512-ELxP4TlX3yr2v5rM7Sb70SqStq5NvI15c0j9j/gjsrO5vaw+fnnpovCLEGIcpeGfifkuqJwl4fon6b+KdrODYQ==}
+
+ resolution: {integrity: sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==}
+
+ resolution: {integrity: sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==}
+
+ resolution: {integrity: sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==}
+
+ resolution: {integrity: sha512-xiun5/3q0w5eRnGYfNlW1uU9W6x5MoFKWwq/0TIRgt09lv7Hcser2QYV8t4muXbEr+Fwo0geYn79Xs4GKywrRQ==}
+ peerDependencies:
+ prosemirror-model: ^1.22.1
+ prosemirror-state: ^1.4.2
+ prosemirror-view: ^1.33.8
+
+ resolution: {integrity: sha512-GxboyN4AMIsoHNtz5uf2r2Ru551i5hWeCMD6E2Ib4Eogqoub0NflniaBPVQ4MrGE5yZ8JV9tUHg9qcZTTrcN4w==}
+
+ resolution: {integrity: sha512-TnKDdohEatgyZNGCDWIdccOHXhYloJwbwU+phw/a23KBvJIR9lWQWW7WHHK3vBdOLDNuF7TaX98GObUZOWkOnA==}
+
resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}
engines: {node: '>= 0.10'}
+ resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -5001,6 +5306,9 @@ packages:
engines: {node: ^20.19.0 || >=22.12.0}
hasBin: true
+ resolution: {integrity: sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==}
+
resolution: {integrity: sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==}
@@ -5410,6 +5718,9 @@ packages:
engines: {node: '>=14.17'}
hasBin: true
+ resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
+
resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==}
@@ -5614,6 +5925,9 @@ packages:
resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==}
+ resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}
+
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
@@ -6733,7 +7047,7 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.14
dependencies:
'@better-auth/utils': 0.4.0
'@better-fetch/fetch': 1.1.21
@@ -6748,38 +7062,38 @@ snapshots:
optionalDependencies:
'@cloudflare/workers-types': 4.20260412.1
dependencies:
'@better-auth/utils': 0.4.0
optionalDependencies:
drizzle-orm: 0.45.2(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected])([email protected])
dependencies:
'@better-auth/utils': 0.4.0
optionalDependencies:
kysely: 0.28.15
dependencies:
'@better-auth/utils': 0.4.0
dependencies:
'@better-auth/utils': 0.4.0
dependencies:
'@better-auth/utils': 0.4.0
dependencies:
'@better-auth/utils': 0.4.0
'@better-fetch/fetch': 1.1.21
@@ -7547,6 +7861,8 @@ snapshots:
'@poppinss/[email protected]': {}
+ '@remirror/[email protected]': {}
+
'@rolldown/[email protected]':
optional: true
@@ -8018,6 +8334,203 @@ snapshots:
postcss: 8.5.9
tailwindcss: 4.2.2
+ dependencies:
+ '@tiptap/pm': 3.22.3
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@floating-ui/dom': 1.7.6
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+ optional: true
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extension-text-style': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extensions': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@floating-ui/dom': 1.7.6
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+ optional: true
+
+ dependencies:
+ '@tiptap/extensions': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+ linkifyjs: 4.3.2
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+
+ dependencies:
+ '@tiptap/extension-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/extensions': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+
+ '@tiptap/[email protected]':
+ dependencies:
+ prosemirror-changeset: 2.4.0
+ prosemirror-collab: 1.3.1
+ prosemirror-commands: 1.7.1
+ prosemirror-dropcursor: 1.8.2
+ prosemirror-gapcursor: 1.4.1
+ prosemirror-history: 1.5.0
+ prosemirror-inputrules: 1.5.1
+ prosemirror-keymap: 1.2.3
+ prosemirror-markdown: 1.13.4
+ prosemirror-menu: 1.3.0
+ prosemirror-model: 1.25.4
+ prosemirror-schema-basic: 1.2.4
+ prosemirror-schema-list: 1.5.1
+ prosemirror-state: 1.4.4
+ prosemirror-tables: 1.8.5
+ prosemirror-trailing-node: 3.0.0([email protected])([email protected])([email protected])
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+ '@types/use-sync-external-store': 0.0.6
+ fast-equals: 5.4.0
+ react: 19.2.5
+ react-dom: 19.2.5([email protected])
+ use-sync-external-store: 1.6.0([email protected])
+ optionalDependencies:
+ '@tiptap/extension-bubble-menu': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-floating-menu': 3.22.3(@floating-ui/[email protected])(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ transitivePeerDependencies:
+ - '@floating-ui/dom'
+
+ '@tiptap/[email protected]':
+ dependencies:
+ '@tiptap/core': 3.22.3(@tiptap/[email protected])
+ '@tiptap/extension-blockquote': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-bold': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-bullet-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-code': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-code-block': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-document': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-dropcursor': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-gapcursor': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-hard-break': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-heading': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-horizontal-rule': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-italic': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-link': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/extension-list-item': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-list-keymap': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-ordered-list': 3.22.3(@tiptap/[email protected](@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected]))
+ '@tiptap/extension-paragraph': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-strike': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-text': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extension-underline': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))
+ '@tiptap/extensions': 3.22.3(@tiptap/[email protected](@tiptap/[email protected]))(@tiptap/[email protected])
+ '@tiptap/pm': 3.22.3
+
'@ts-morph/[email protected]':
dependencies:
fast-glob: 3.3.3
@@ -8197,10 +8710,19 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/linkify-it': 5.0.0
+ '@types/mdurl': 2.0.0
+
dependencies:
'@types/unist': 3.0.3
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -8237,6 +8759,8 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -8603,13 +9127,13 @@ snapshots:
dependencies:
- '@better-auth/memory-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/mongo-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/prisma-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
- '@better-auth/telemetry': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])
+ '@better-auth/memory-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/mongo-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/prisma-adapter': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])
+ '@better-auth/telemetry': 1.6.2(@better-auth/[email protected](@better-auth/[email protected])(@better-fetch/[email protected])(@cloudflare/[email protected])(@opentelemetry/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]))(@better-auth/[email protected])(@better-fetch/[email protected])
'@better-auth/utils': 0.4.0
'@better-fetch/fetch': 1.1.21
'@noble/ciphers': 2.1.1
@@ -8856,6 +9380,8 @@ snapshots:
optionalDependencies:
typescript: 5.9.3
+
dependencies:
path-key: 3.1.1
@@ -9189,6 +9715,8 @@ snapshots:
ansi-colors: 4.1.3
strip-ansi: 6.0.1
+
@@ -9654,6 +10182,8 @@ snapshots:
+
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -10371,6 +10901,12 @@ snapshots:
+ dependencies:
+ uc.micro: 2.1.0
+
+
dependencies:
p-locate: 5.0.0
@@ -10406,6 +10942,15 @@ snapshots:
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
+ dependencies:
+ argparse: 2.0.1
+ entities: 4.5.0
+ linkify-it: 5.0.0
+ mdurl: 2.0.0
+ punycode.js: 2.3.1
+ uc.micro: 2.1.0
+
@@ -10567,6 +11112,8 @@ snapshots:
dependencies:
'@types/mdast': 4.0.4
+
@@ -11075,6 +11622,8 @@ snapshots:
string-width: 7.2.0
strip-ansi: 7.2.0
+
@@ -11215,11 +11764,116 @@ snapshots:
+ dependencies:
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-state: 1.4.4
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-keymap: 1.2.3
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+ rope-sequence: 1.3.4
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-state: 1.4.4
+ w3c-keyname: 2.2.8
+
+ dependencies:
+ '@types/markdown-it': 14.1.2
+ markdown-it: 14.1.1
+ prosemirror-model: 1.25.4
+
+ dependencies:
+ crelt: 1.0.6
+ prosemirror-commands: 1.7.1
+ prosemirror-history: 1.5.0
+ prosemirror-state: 1.4.4
+
+ dependencies:
+ orderedmap: 2.1.1
+
+ dependencies:
+ prosemirror-model: 1.25.4
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-keymap: 1.2.3
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ '@remirror/core-constants': 3.0.0
+ escape-string-regexp: 4.0.0
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-view: 1.41.8
+
+ dependencies:
+ prosemirror-model: 1.25.4
+
+ dependencies:
+ prosemirror-model: 1.25.4
+ prosemirror-state: 1.4.4
+ prosemirror-transform: 1.12.0
+
dependencies:
forwarded: 0.2.0
ipaddr.js: 1.9.1
+
@@ -11376,6 +12030,8 @@ snapshots:
'@rolldown/binding-win32-arm64-msvc': 1.0.0-rc.15
'@rolldown/binding-win32-x64-msvc': 1.0.0-rc.15
+
@@ -11913,6 +12569,8 @@ snapshots:
+
@@ -12141,6 +12799,8 @@ snapshots:
+
diff --git a/src/shared/src/db/queries/email.ts b/src/shared/src/db/queries/email.ts
index 255687fa5..267992e11 100644
--- a/src/shared/src/db/queries/email.ts
+++ b/src/shared/src/db/queries/email.ts
@@ -1,10 +1,10 @@
-import { eq, desc, inArray } from "drizzle-orm";
+import { eq, desc, inArray, and } from "drizzle-orm";
import { emails } from "../schema";
import type { Database } from "../index";
export async function createEmail(
db: Database,
- data: { agentId: string; fromEmail: string; toEmail: string; subject: string; r2Key: string; isWhitelisted: boolean; forwarded: boolean }
+ data: { agentId: string; fromEmail: string; toEmail: string; subject: string; r2Key: string; isWhitelisted: boolean; forwarded: boolean; htmlBody?: string; attachments?: string }
) {
const rows = await db.insert(emails).values(data).returning();
return rows[0]!;
@@ -19,7 +19,23 @@ export async function getEmailsByAgent(db: Database, agentId: string) {
return db.select().from(emails).where(eq(emails.agentId, agentId)).orderBy(desc(emails.createdAt));
}
+export async function getInboxEmails(db: Database, agentId: string, agentEmail: string) {
+ return db.select().from(emails)
+ .where(and(eq(emails.agentId, agentId), eq(emails.toEmail, agentEmail)))
+ .orderBy(desc(emails.createdAt));
+}
+
+export async function getSentEmails(db: Database, agentId: string, agentEmail: string) {
+ return db.select().from(emails)
+ .where(and(eq(emails.agentId, agentId), eq(emails.fromEmail, agentEmail)))
+ .orderBy(desc(emails.createdAt));
+}
+
export async function getEmailsByUser(db: Database, agentIds: string[]) {
if (agentIds.length === 0) return [];
return db.select().from(emails).where(inArray(emails.agentId, agentIds)).orderBy(desc(emails.createdAt));
}
+
+export async function deleteEmail(db: Database, id: string) {
+ return db.delete(emails).where(eq(emails.id, id));
+}
diff --git a/src/shared/src/db/schema.ts b/src/shared/src/db/schema.ts
index 2e8a989aa..1bbaee7e0 100644
--- a/src/shared/src/db/schema.ts
+++ b/src/shared/src/db/schema.ts
@@ -249,6 +249,8 @@ export const emails = sqliteTable("emails", {
r2Key: text("r2_key").notNull(),
isWhitelisted: integer("is_whitelisted", { mode: "boolean" }).notNull().default(false),
forwarded: integer("forwarded", { mode: "boolean" }).notNull().default(false),
+ htmlBody: text("html_body").notNull().default(""),
+ attachments: text("attachments").notNull().default("[]"),
createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),
});
diff --git a/src/shared/src/index.ts b/src/shared/src/index.ts
index 771db3d39..8cae9c2af 100644
--- a/src/shared/src/index.ts
+++ b/src/shared/src/index.ts
@@ -11,6 +11,7 @@ export type {
TaskMessage,
MachineToken,
Email,
+ EmailAttachment,
LoginResponse,
CreateAgentRequest,
WsMessage,
diff --git a/src/shared/src/types.ts b/src/shared/src/types.ts
index 700c5b112..574f680ac 100644
--- a/src/shared/src/types.ts
+++ b/src/shared/src/types.ts
@@ -108,6 +108,13 @@ export interface MachineToken {
created_at: string;
}
+export interface EmailAttachment {
+ key: string;
+ filename: string;
+ size: number;
+ contentType: string;
+}
+
export interface Email {
id: string;
agent_id: string;
@@ -117,6 +124,8 @@ export interface Email {
r2_key: string;
is_whitelisted: boolean;
forwarded: boolean;
+ html_body: string;
+ attachments: EmailAttachment[];
created_at: string;
}
diff --git a/src/shared/test/queries/email.test.ts b/src/shared/test/queries/email.test.ts
new file mode 100644
index 000000000..74e125c74
--- /dev/null
+++ b/src/shared/test/queries/email.test.ts
@@ -0,0 +1,28 @@
+import { describe, it, expect } from "vitest";
+import * as emailQueries from "../../src/db/queries/email";
+
+describe("email query module exports", () => {
+ it("exports getInboxEmails", () => {
+ expect(typeof emailQueries.getInboxEmails).toBe("function");
+ });
+
+ it("exports getSentEmails", () => {
+ expect(typeof emailQueries.getSentEmails).toBe("function");
+ });
+
+ it("exports deleteEmail", () => {
+ expect(typeof emailQueries.deleteEmail).toBe("function");
+ });
+
+ it("exports createEmail", () => {
+ expect(typeof emailQueries.createEmail).toBe("function");
+ });
+
+ it("exports getEmailById", () => {
+ expect(typeof emailQueries.getEmailById).toBe("function");
+ });
+
+ it("exports getEmailsByAgent", () => {
+ expect(typeof emailQueries.getEmailsByAgent).toBe("function");
+ });
+});
diff --git a/src/web/migrations/0001_schema.sql b/src/web/migrations/0001_schema.sql
index 3bfd4e283..3e78a4add 100644
--- a/src/web/migrations/0001_schema.sql
+++ b/src/web/migrations/0001_schema.sql
@@ -146,7 +146,6 @@ CREATE TABLE IF NOT EXISTS agent_task_queue (
result TEXT,
context TEXT,
session_id TEXT,
- work_dir TEXT,
created_at TEXT NOT NULL DEFAULT (datetime('now')),
dispatched_at TEXT,
started_at TEXT,
@@ -169,6 +168,7 @@ CREATE TABLE IF NOT EXISTS task_message (
seq INTEGER NOT NULL,
type TEXT NOT NULL DEFAULT '',
tool TEXT NOT NULL DEFAULT '',
+ call_id TEXT NOT NULL DEFAULT '',
content TEXT NOT NULL DEFAULT '',
input TEXT,
output TEXT NOT NULL DEFAULT '',
@@ -187,6 +187,8 @@ CREATE TABLE IF NOT EXISTS emails (
r2_key TEXT NOT NULL,
is_whitelisted INTEGER NOT NULL DEFAULT 0,
forwarded INTEGER NOT NULL DEFAULT 0,
+ html_body TEXT NOT NULL DEFAULT '',
+ attachments TEXT NOT NULL DEFAULT '[]',
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
diff --git a/src/web/migrations/0002_drop_work_dir.sql b/src/web/migrations/0002_drop_work_dir.sql
deleted file mode 100644
index 4250756ec..000000000
--- a/src/web/migrations/0002_drop_work_dir.sql
+++ /dev/null
@@ -1,4 +0,0 @@
--- Drop the unused work_dir column from agent_task_queue.
--- Deploy code changes first (server/CLI no longer read/write this column),
--- then run this migration.
-ALTER TABLE agent_task_queue DROP COLUMN work_dir;
diff --git a/src/web/migrations/0003_add_call_id.sql b/src/web/migrations/0003_add_call_id.sql
deleted file mode 100644
index 6ec2aea59..000000000
--- a/src/web/migrations/0003_add_call_id.sql
+++ /dev/null
@@ -1,2 +0,0 @@
--- Add call_id column to task_message for pairing tool-use with tool-result.
-ALTER TABLE task_message ADD COLUMN call_id TEXT NOT NULL DEFAULT '';
diff --git a/src/web/package.json b/src/web/package.json
index 60e03200b..81cde78af 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -21,6 +21,15 @@
"@base-ui/react": "^1.3.0",
"@icons-pack/react-simple-icons": "^13.13.0",
"@opennextjs/cloudflare": "^1.19.1",
+ "@tiptap/extension-color": "^3.22.3",
+ "@tiptap/extension-image": "^3.22.3",
+ "@tiptap/extension-link": "^3.22.3",
+ "@tiptap/extension-placeholder": "^3.22.3",
+ "@tiptap/extension-text-align": "^3.22.3",
+ "@tiptap/extension-text-style": "^3.22.3",
+ "@tiptap/extension-underline": "^3.22.3",
+ "@tiptap/react": "^3.22.3",
+ "@tiptap/starter-kit": "^3.22.3",
"better-auth": "^1.6.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/email/page.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/email/page.tsx
index 72938145b..a7326183d 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/email/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/email/page.tsx
@@ -4,13 +4,18 @@ import { useEffect, useState, useCallback } from "react";
import { useParams } from "next/navigation";
import { useWorkspace } from "@/contexts/workspace-context";
import { useAgentContext } from "@/contexts/agent-context";
-import { listEmails, getEmailBody } from "@/lib/api";
-import type { Email } from "@alook/shared";
+import { listEmails, getEmailBody, deleteEmail, sendEmail } from "@/lib/api";
+import type { Email, EmailAttachment } from "@alook/shared";
import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
+import { ConfirmDialog } from "@/components/ui/confirm-dialog";
+import { EmailCompose } from "@/components/email-compose";
import { cn } from "@/lib/utils";
import { toast } from "sonner";
import { Skeleton } from "@/components/ui/skeleton";
-import { Loader2, Mail } from "lucide-react";
+import { Loader2, Mail, Inbox, Send, Plus, Trash2, Forward, Paperclip, File as FileIcon } from "lucide-react";
+
+type Folder = "inbox" | "sent";
function relativeTime(dateStr: string): string {
const date = new Date(dateStr);
@@ -30,19 +35,31 @@ export default function AgentEmailPage() {
const params = useParams();
const agentId = params.id as string;
const { workspaceId } = useWorkspace();
- const { subscribeWs } = useAgentContext();
+ const { agents, subscribeWs } = useAgentContext();
+
+ const agent = agents.find((a) => a.id === agentId);
+ const [folder, setFolder] = useState<Folder>("inbox");
const [emails, setEmails] = useState<Email[]>([]);
const [loading, setLoading] = useState(true);
const [selectedId, setSelectedId] = useState<string | null>(null);
const [body, setBody] = useState<string | null>(null);
const [bodyLoading, setBodyLoading] = useState(false);
+ const [composing, setComposing] = useState(false);
+ const [composeInitial, setComposeInitial] = useState<{
+ to?: string; subject?: string; body?: string; attachments?: EmailAttachment[];
+ }>({});
+
+ const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false);
+ const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
+ const [deleting, setDeleting] = useState(false);
const selected = emails.find((e) => e.id === selectedId) ?? null;
- const loadEmails = useCallback(async () => {
+ const loadEmails = useCallback(async (dir: string) => {
+ setLoading(true);
try {
- const data = await listEmails(agentId, workspaceId);
+ const data = await listEmails(agentId, workspaceId, dir);
setEmails(data);
} catch {
toast.error("Failed to load emails");
@@ -52,19 +69,22 @@ export default function AgentEmailPage() {
}, [agentId, workspaceId]);
useEffect(() => {
- loadEmails();
- }, [loadEmails]);
+ setSelectedId(null);
+ setBody(null);
+ setComposing(false);
+ loadEmails(folder);
+ }, [folder, loadEmails]);
- // Re-fetch when a new email arrives for this agent
useEffect(() => {
return subscribeWs((msg) => {
if (msg.type === "email.received" && msg.agentId === agentId) {
- loadEmails();
+ loadEmails(folder);
}
});
- }, [subscribeWs, agentId, loadEmails]);
+ }, [subscribeWs, agentId, folder, loadEmails]);
const handleSelect = async (emailId: string) => {
+ setComposing(false);
setSelectedId(emailId);
setBody(null);
setBodyLoading(true);
@@ -78,131 +98,301 @@ export default function AgentEmailPage() {
}
};
- if (loading) {
- return (
- <div className="flex flex-1 min-h-0">
- {/* Skeleton email list panel */}
- <div className="w-2/5 min-w-[240px] max-w-[400px] border-r border-border/40">
- {Array.from({ length: 5 }).map((_, i) => (
- <div key={i} className="px-4 py-3 border-b border-border/30">
- <div className="flex items-center justify-between gap-2 mb-1.5">
- <Skeleton className="h-3.5 w-32" />
- <Skeleton className="h-2.5 w-10" />
- </div>
- <Skeleton className="h-3.5 w-48 mb-1.5" />
- <Skeleton className="h-4 w-16 rounded-full" />
- </div>
- ))}
- </div>
- {/* Skeleton detail panel */}
- <div className="flex-1 flex items-center justify-center text-sm text-muted-foreground">
- Select an email to view
- </div>
- </div>
- );
- }
-
- if (emails.length === 0) {
- return (
- <div className="flex flex-col items-center justify-center flex-1 animate-[fade-up_400ms_ease-out_both]">
- <Mail className="size-8 text-muted-foreground mb-3" />
- <p className="text-sm text-muted-foreground">No emails yet.</p>
- <p className="text-xs text-muted-foreground/60 mt-1">
- Emails sent to this agent will appear here.
- </p>
- </div>
- );
- }
+ const handleDelete = async () => {
+ if (!deleteTarget) return;
+ setDeleting(true);
+ try {
+ await deleteEmail(deleteTarget, workspaceId);
+ setEmails((prev) => prev.filter((e) => e.id !== deleteTarget));
+ if (selectedId === deleteTarget) {
+ setSelectedId(null);
+ setBody(null);
+ }
+ toast.success("Email deleted");
+ } catch {
+ toast.error("Failed to delete email");
+ } finally {
+ setDeleting(false);
+ setDeleteConfirmOpen(false);
+ setDeleteTarget(null);
+ }
+ };
+
+ const handleSend = async (to: string, subject: string, htmlBody: string, attachments: EmailAttachment[]): Promise<boolean> => {
+ try {
+ await sendEmail(agentId, to, subject, htmlBody, workspaceId, attachments.length > 0 ? attachments : undefined);
+ toast.success("Email sent");
+ setComposing(false);
+ setFolder("sent");
+ return true;
+ } catch {
+ toast.error("Failed to send email");
+ return false;
+ }
+ };
+
+ const handleForward = (email: Email) => {
+ const fwdSubject = email.subject.startsWith("Fwd:") ? email.subject : `Fwd: ${email.subject}`;
+ const quotedBody = [
+ `<br/><br/>`,
+ `<div style="border-left: 2px solid #ccc; padding-left: 12px; margin-left: 0; color: #666;">`,
+ `<p><strong>From:</strong> ${email.from_email}<br/>`,
+ `<strong>To:</strong> ${email.to_email}<br/>`,
+ `<strong>Date:</strong> ${new Date(email.created_at).toLocaleString()}<br/>`,
+ `<strong>Subject:</strong> ${email.subject}</p>`,
+ email.html_body ? email.html_body : `<pre>${body ?? ""}</pre>`,
+ `</div>`,
+ ].join("");
+
+ setSelectedId(null);
+ setComposeInitial({
+ subject: fwdSubject,
+ body: quotedBody,
+ attachments: email.attachments ?? [],
+ });
+ setComposing(true);
+ };
+
+ const fromAddress = agent?.email_handle ? `${agent.email_handle}@alook.ai` : "";
return (
<div className="flex flex-1 min-h-0">
- {/* Email list panel */}
- <div className="w-2/5 min-w-[240px] max-w-[400px] border-r border-border/40 overflow-y-auto">
- {emails.map((email) => (
+ {/* Column 1: Folder sidebar */}
+ <div className="flex w-[180px] shrink-0 flex-col border-r border-border/40">
+ <div className="p-2">
+ <Button
+ size="sm"
+ className="w-full text-xs h-8 gap-1.5"
+ onClick={() => { setComposeInitial({}); setComposing(true); setSelectedId(null); }}
+ disabled={!agent?.email_handle}
+ title={!agent?.email_handle ? "Configure an email handle in agent settings to send emails" : "Compose new email"}
+ >
+ <Plus className="size-3.5" />
+ New Email
+ </Button>
+ </div>
+ <nav className="flex flex-col gap-0.5 px-2">
<button
- key={email.id}
type="button"
- onClick={() => handleSelect(email.id)}
+ onClick={() => setFolder("inbox")}
className={cn(
- "w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",
- selectedId === email.id
- ? "bg-accent/60"
- : "hover:bg-accent/30"
+ "flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer",
+ folder === "inbox"
+ ? "bg-accent text-foreground font-medium"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
)}
>
- <div className="flex items-center justify-between gap-2 mb-0.5">
- <p className="text-sm font-medium truncate">
- {email.from_email}
- </p>
- <span className="text-[10px] text-muted-foreground shrink-0">
- {relativeTime(email.created_at)}
- </span>
- </div>
- <p className="text-sm truncate">
- {email.subject || "(no subject)"}
+ <Inbox className="size-4 shrink-0" />
+ Inbox
+ </button>
+ <button
+ type="button"
+ onClick={() => setFolder("sent")}
+ className={cn(
+ "flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors cursor-pointer",
+ folder === "sent"
+ ? "bg-accent text-foreground font-medium"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
+ )}
+ >
+ <Send className="size-4 shrink-0" />
+ Sent
+ </button>
+ </nav>
+ </div>
+
+ {/* Column 2: Email list */}
+ <div className="w-[300px] shrink-0 border-r border-border/40 overflow-y-auto">
+ {loading ? (
+ <>
+ {Array.from({ length: 5 }).map((_, i) => (
+ <div key={i} className="px-4 py-3 border-b border-border/30">
+ <div className="flex items-center justify-between gap-2 mb-1.5">
+ <Skeleton className="h-3.5 w-32" />
+ <Skeleton className="h-2.5 w-10" />
+ </div>
+ <Skeleton className="h-3.5 w-48 mb-1.5" />
+ <Skeleton className="h-4 w-16 rounded-full" />
+ </div>
+ ))}
+ </>
+ ) : emails.length === 0 ? (
+ <div className="flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]">
+ <Mail className="size-8 text-muted-foreground/40 mb-3" />
+ <p className="text-sm text-muted-foreground">
+ {folder === "inbox" ? "No emails received yet." : "No emails sent yet."}
</p>
- <div className="mt-1">
- {email.is_whitelisted ? (
- <Badge className="text-[10px] h-4 px-1">triggered</Badge>
- ) : (
- <Badge variant="secondary" className="text-[10px] h-4 px-1">
- forwarded
- </Badge>
+ </div>
+ ) : (
+ emails.map((email) => (
+ <button
+ key={email.id}
+ type="button"
+ onClick={() => handleSelect(email.id)}
+ className={cn(
+ "w-full text-left px-4 py-3 border-b border-border/30 transition-colors duration-150 cursor-pointer",
+ selectedId === email.id
+ ? "bg-accent/60"
+ : "hover:bg-accent/30"
)}
- </div>
- </button>
- ))}
+ >
+ <div className="flex items-center justify-between gap-2 mb-0.5">
+ <p className="text-sm font-medium truncate">
+ {folder === "inbox" ? email.from_email : email.to_email}
+ </p>
+ <span className="text-[10px] text-muted-foreground shrink-0">
+ {relativeTime(email.created_at)}
+ </span>
+ </div>
+ <p className="text-sm truncate text-muted-foreground">
+ {email.subject || "(no subject)"}
+ </p>
+ {folder === "inbox" && (
+ <div className="mt-1">
+ {email.is_whitelisted ? (
+ <Badge className="text-[10px] h-4 px-1">triggered</Badge>
+ ) : (
+ <Badge variant="secondary" className="text-[10px] h-4 px-1">
+ forwarded
+ </Badge>
+ )}
+ </div>
+ )}
+ </button>
+ ))
+ )}
</div>
- {/* Email detail panel */}
- <div className="flex-1 overflow-y-auto">
- {!selected ? (
+ {/* Column 3: Reading pane */}
+ <div className="flex-1 overflow-y-auto flex flex-col min-w-0">
+ {composing ? (
+ <EmailCompose
+ key={JSON.stringify(composeInitial)}
+ fromAddress={fromAddress}
+ onSend={handleSend}
+ onDiscard={() => { setComposing(false); setComposeInitial({}); }}
+ initialTo={composeInitial.to}
+ initialSubject={composeInitial.subject}
+ initialBody={composeInitial.body}
+ initialAttachments={composeInitial.attachments}
+ />
+ ) : !selected ? (
<div className="flex items-center justify-center h-full text-sm text-muted-foreground">
Select an email to view
</div>
) : (
- <div className="p-5 max-w-2xl">
- <h2 className="text-lg font-medium mb-1">
- {selected.subject || "(no subject)"}
- </h2>
- <div className="flex items-center gap-2 mb-4">
- {selected.is_whitelisted ? (
- <Badge className="text-[10px] h-4 px-1">triggered</Badge>
- ) : (
- <Badge variant="secondary" className="text-[10px] h-4 px-1">
- forwarded
- </Badge>
- )}
- </div>
- <div className="text-sm text-muted-foreground space-y-0.5 mb-5">
- <p>
- <span className="font-medium text-foreground">From:</span>{" "}
- {selected.from_email}
- </p>
- <p>
- <span className="font-medium text-foreground">To:</span>{" "}
- {selected.to_email}
- </p>
- <p>
- <span className="font-medium text-foreground">Received:</span>{" "}
- {new Date(selected.created_at).toLocaleString()}
- </p>
+ <div className="flex flex-col h-full">
+ {/* Detail toolbar */}
+ <div className="flex items-center gap-0.5 border-b border-border/40 px-4 py-1.5">
+ <Button
+ variant="ghost"
+ size="icon"
+ className="size-7 text-muted-foreground/60 hover:text-foreground"
+ title="Forward"
+ onClick={() => handleForward(selected)}
+ >
+ <Forward className="size-3.5" />
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="size-7 text-muted-foreground/60 hover:text-destructive"
+ title="Delete"
+ onClick={() => {
+ setDeleteTarget(selected.id);
+ setDeleteConfirmOpen(true);
+ }}
+ >
+ <Trash2 className="size-3.5" />
+ </Button>
</div>
- <div className="rounded-lg border border-border/50 bg-background/50 p-4">
- {bodyLoading ? (
- <div className="flex items-center justify-center py-8">
- <Loader2 className="size-4 animate-spin text-muted-foreground" />
+ {/* Email detail */}
+ <div className="p-5 max-w-2xl">
+ <h2 className="text-lg font-medium mb-1">
+ {selected.subject || "(no subject)"}
+ </h2>
+ {folder === "inbox" && (
+ <div className="flex items-center gap-2 mb-4">
+ {selected.is_whitelisted ? (
+ <Badge className="text-[10px] h-4 px-1">triggered</Badge>
+ ) : (
+ <Badge variant="secondary" className="text-[10px] h-4 px-1">
+ forwarded
+ </Badge>
+ )}
+ </div>
+ )}
+ <div className="text-sm text-muted-foreground space-y-0.5 mb-5">
+ <p>
+ <span className="font-medium text-foreground">From:</span>{" "}
+ {selected.from_email}
+ </p>
+ <p>
+ <span className="font-medium text-foreground">To:</span>{" "}
+ {selected.to_email}
+ </p>
+ <p>
+ <span className="font-medium text-foreground">
+ {folder === "inbox" ? "Received:" : "Sent:"}
+ </span>{" "}
+ {new Date(selected.created_at).toLocaleString()}
+ </p>
+ </div>
+
+ <div className="rounded-lg border border-border/50 bg-background/50 p-4">
+ {bodyLoading ? (
+ <div className="flex items-center justify-center py-8">
+ <Loader2 className="size-4 animate-spin text-muted-foreground" />
+ </div>
+ ) : selected.from_email === fromAddress && selected.html_body ? (
+ <div
+ className="prose prose-sm max-w-none"
+ dangerouslySetInnerHTML={{ __html: selected.html_body }}
+ />
+ ) : (
+ <pre className="text-sm whitespace-pre-wrap font-mono leading-relaxed">
+ {body}
+ </pre>
+ )}
+ </div>
+
+ {selected.attachments && selected.attachments.length > 0 && (
+ <div className="mt-4">
+ <div className="flex items-center gap-1.5 mb-2 text-xs text-muted-foreground">
+ <Paperclip className="size-3" />
+ {selected.attachments.length} attachment{selected.attachments.length > 1 ? "s" : ""}
+ </div>
+ <div className="flex flex-wrap gap-1.5">
+ {selected.attachments.map((att) => (
+ <div
+ key={att.key}
+ className="flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/50 px-2.5 py-1.5 text-xs"
+ >
+ <FileIcon className="size-3 text-muted-foreground shrink-0" />
+ <span className="truncate max-w-[180px]">{att.filename}</span>
+ <span className="text-muted-foreground shrink-0">
+ {att.size < 1024 ? `${att.size} B` : att.size < 1024 * 1024 ? `${(att.size / 1024).toFixed(1)} KB` : `${(att.size / (1024 * 1024)).toFixed(1)} MB`}
+ </span>
+ </div>
+ ))}
+ </div>
</div>
- ) : (
- <pre className="text-sm whitespace-pre-wrap font-mono leading-relaxed">
- {body}
- </pre>
)}
</div>
</div>
)}
</div>
+
+ {/* Delete confirmation dialog */}
+ <ConfirmDialog
+ open={deleteConfirmOpen}
+ onOpenChange={setDeleteConfirmOpen}
+ title="Delete email"
+ description="This will permanently delete this email."
+ loading={deleting}
+ onConfirm={handleDelete}
+ />
</div>
);
}
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
index 9df47ab0a..ba0968b5c 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/layout.tsx
@@ -1,23 +1,24 @@
"use client";
import { useState, type ReactNode } from "react";
-import { useParams, useRouter } from "next/navigation";
+import { useParams, useRouter, usePathname } from "next/navigation";
import Link from "next/link";
import { useAgentContext } from "@/contexts/agent-context";
import { useWorkspace } from "@/contexts/workspace-context";
import { Button } from "@/components/ui/button";
import { ConfirmDialog } from "@/components/ui/confirm-dialog";
import { AgentEditForm } from "@/components/agent-edit-form";
-import { AgentDetailSidebar } from "@/components/agent-detail-sidebar";
import { Skeleton } from "@/components/ui/skeleton";
import { cn } from "@/lib/utils";
-import { Pencil, Trash2, X } from "lucide-react";
+import { Mail, MessageSquare, Pencil, Trash2, X } from "lucide-react";
export default function AgentDetailLayout({ children }: { children: ReactNode }) {
const params = useParams();
const router = useRouter();
+ const pathname = usePathname();
const { slug } = useWorkspace();
const agentId = params.id as string;
+ const isOnChat = pathname.includes(`/agents/${agentId}/chat`);
const { agents, runtimes, handleDeleteAgent, handleUpdateAgent } = useAgentContext();
const agent = agents.find((a) => a.id === agentId);
@@ -51,7 +52,7 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
)}
{agent ? (
<Link
- href={`/w/${slug}/agents/${agentId}/chat`}
+ href={`/w/${slug}/agents/${agentId}/email`}
onClick={() => setEditing(false)}
className="text-sm font-medium truncate hover:text-foreground/80 transition-colors"
>
@@ -76,6 +77,23 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
</Button>
) : (
<>
+ {isOnChat ? (
+ <Link
+ href={`/w/${slug}/agents/${agentId}/email`}
+ className="inline-flex items-center rounded-lg text-xs text-muted-foreground h-7 gap-1 px-2 hover:bg-muted hover:text-foreground transition-all"
+ >
+ <Mail className="size-3" />
+ Email
+ </Link>
+ ) : (
+ <Link
+ href={`/w/${slug}/agents/${agentId}/chat`}
+ className="inline-flex items-center rounded-lg text-xs text-muted-foreground h-7 gap-1 px-2 hover:bg-muted hover:text-foreground transition-all"
+ >
+ <MessageSquare className="size-3" />
+ Chat
+ </Link>
+ )}
<Button
variant="ghost"
size="sm"
@@ -102,7 +120,7 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
)}
</div>
- {/* Content: edit form OR sidebar + children */}
+ {/* Content: edit form OR full-width children */}
{editing && agent ? (
<AgentEditForm
agent={agent}
@@ -121,10 +139,7 @@ export default function AgentDetailLayout({ children }: { children: ReactNode })
}}
/>
) : (
- <div className="flex flex-1 min-h-0">
- <AgentDetailSidebar agentId={agentId} />
- <div className="flex-1 min-w-0 overflow-hidden flex flex-col">{children}</div>
- </div>
+ <div className="flex-1 min-h-0 overflow-hidden flex flex-col">{children}</div>
)}
{/* Delete agent confirmation */}
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/page.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/page.tsx
index b1f4a9d65..ef404f1f5 100644
--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/page.tsx
@@ -6,5 +6,5 @@ export default async function AgentDetailPage({
params: Promise<{ slug: string; id: string }>;
}) {
const { slug, id } = await params;
- redirect(`/w/${slug}/agents/${id}/chat`);
+ redirect(`/w/${slug}/agents/${id}/email`);
}
diff --git a/src/web/src/app/api/email/[id]/route.test.ts b/src/web/src/app/api/email/[id]/route.test.ts
new file mode 100644
index 000000000..d0248d96f
--- /dev/null
+++ b/src/web/src/app/api/email/[id]/route.test.ts
@@ -0,0 +1,81 @@
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { NextRequest } from "next/server";
+
+const mockGetEmailById = vi.fn();
+const mockGetAgentInWorkspace = vi.fn();
+const mockDeleteEmail = vi.fn();
+
+vi.mock("@opennextjs/cloudflare", () => ({
+ getCloudflareContext: vi.fn(() => ({
+ env: { DB: {}, EMAIL_BUCKET: {} },
+ })),
+}));
+
+vi.mock("@alook/shared", () => ({
+ createDb: vi.fn(() => ({})),
+ queries: {
+ email: {
+ getEmailById: (...args: unknown[]) => mockGetEmailById(...args),
+ deleteEmail: (...args: unknown[]) => mockDeleteEmail(...args),
+ },
+ agent: {
+ getAgentInWorkspace: (...args: unknown[]) => mockGetAgentInWorkspace(...args),
+ },
+ },
+}));
+
+vi.mock("@/lib/middleware/auth", () => ({
+ withAuth: vi.fn((handler: any) => async (req: any, ctx?: any) => {
+ const params = ctx?.params instanceof Promise ? await ctx.params : ctx?.params;
+ return handler(req, { userId: "u1", email: "[email protected]", params });
+ }),
+}));
+
+vi.mock("@/lib/middleware/workspace", () => ({
+ withWorkspaceMember: vi.fn(async () => ({ workspaceId: "ws1" })),
+}));
+
+vi.mock("@/lib/middleware/helpers", () => {
+ const { NextResponse } = require("next/server");
+ return {
+ writeJSON: (data: unknown, status = 200) => NextResponse.json(data, { status }),
+ writeError: (message: string, status: number) => NextResponse.json({ error: message }, { status }),
+ };
+});
+
+import { GET, DELETE } from "./route";
+
+describe("DELETE /api/email/[id]", () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it("deletes an email and returns 204", async () => {
+ mockGetEmailById.mockResolvedValue({ id: "e1", agentId: "a1" });
+ mockGetAgentInWorkspace.mockResolvedValue({ id: "a1" });
+ mockDeleteEmail.mockResolvedValue(undefined);
+
+ const req = new NextRequest("http://localhost/api/email/e1?workspace_id=ws1", { method: "DELETE" });
+ const res = await DELETE(req, { params: Promise.resolve({ id: "e1" }) } as any);
+
+ expect(res.status).toBe(204);
+ expect(mockDeleteEmail).toHaveBeenCalledWith({}, "e1");
+ });
+
+ it("returns 404 when email not found", async () => {
+ mockGetEmailById.mockResolvedValue(null);
+
+ const req = new NextRequest("http://localhost/api/email/e1?workspace_id=ws1", { method: "DELETE" });
+ const res = await DELETE(req, { params: Promise.resolve({ id: "e1" }) } as any);
+
+ expect(res.status).toBe(404);
+ });
+
+ it("returns 404 when agent not in workspace", async () => {
+ mockGetEmailById.mockResolvedValue({ id: "e1", agentId: "a1" });
+ mockGetAgentInWorkspace.mockResolvedValue(null);
+
+ const req = new NextRequest("http://localhost/api/email/e1?workspace_id=ws1", { method: "DELETE" });
+ const res = await DELETE(req, { params: Promise.resolve({ id: "e1" }) } as any);
+
+ expect(res.status).toBe(404);
+ });
+});
diff --git a/src/web/src/app/api/email/[id]/route.ts b/src/web/src/app/api/email/[id]/route.ts
index 4684eccc7..a5b9513a0 100644
--- a/src/web/src/app/api/email/[id]/route.ts
+++ b/src/web/src/app/api/email/[id]/route.ts
@@ -23,3 +23,24 @@ export const GET = withAuth(async (req, ctx) => {
return writeJSON(emailToResponse(email));
});
+
+export const DELETE = withAuth(async (req, ctx) => {
+ const ws = await withWorkspaceMember(req, ctx);
+ if (ws instanceof Response) return ws;
+
+ const { env } = getCloudflareContext();
+ const db = createDb((env as Env).DB);
+
+ const id = ctx.params?.id;
+ if (!id) return writeError("email id is required", 400);
+
+ const email = await queries.email.getEmailById(db, id);
+ if (!email) return writeError("email not found", 404);
+
+ const agent = await queries.agent.getAgentInWorkspace(db, email.agentId, ws.workspaceId);
+ if (!agent) return writeError("email not found", 404);
+
+ await queries.email.deleteEmail(db, id);
+
+ return new Response(null, { status: 204 });
+});
diff --git a/src/web/src/app/api/email/route.ts b/src/web/src/app/api/email/route.ts
index b647f86ea..5c9400e74 100644
--- a/src/web/src/app/api/email/route.ts
+++ b/src/web/src/app/api/email/route.ts
@@ -19,6 +19,17 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {
const agent = await queries.agent.getAgentInWorkspace(db, agentId, ws.workspaceId);
if (!agent) return writeError("agent not found in workspace", 404);
- const emails = await queries.email.getEmailsByAgent(db, agentId);
- return writeJSON(emails.map(emailToResponse));
+ const folder = req.nextUrl.searchParams.get("folder");
+ const agentEmail = agent.emailHandle ? `${agent.emailHandle}@alook.ai` : "";
+
+ let emailList;
+ if (folder === "inbox" && agentEmail) {
+ emailList = await queries.email.getInboxEmails(db, agentId, agentEmail);
+ } else if (folder === "sent" && agentEmail) {
+ emailList = await queries.email.getSentEmails(db, agentId, agentEmail);
+ } else {
+ emailList = await queries.email.getEmailsByAgent(db, agentId);
+ }
+
+ return writeJSON(emailList.map(emailToResponse));
});
diff --git a/src/web/src/app/api/email/send/route.test.ts b/src/web/src/app/api/email/send/route.test.ts
new file mode 100644
index 000000000..458dc4acc
--- /dev/null
+++ b/src/web/src/app/api/email/send/route.test.ts
@@ -0,0 +1,199 @@
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { NextRequest } from "next/server";
+
+const mockGetAgentInWorkspace = vi.fn();
+const mockCreateEmail = vi.fn();
+const mockR2Put = vi.fn();
+const mockR2Get = vi.fn();
+const mockSendEmailSend = vi.fn();
+
+vi.mock("@opennextjs/cloudflare", () => ({
+ getCloudflareContext: vi.fn(() => ({
+ env: {
+ DB: {},
+ EMAIL_BUCKET: {
+ put: (...args: unknown[]) => mockR2Put(...args),
+ get: (...args: unknown[]) => mockR2Get(...args),
+ },
+ SEND_EMAIL: { send: (...args: unknown[]) => mockSendEmailSend(...args) },
+ },
+ })),
+}));
+
+vi.mock("@alook/shared", () => ({
+ createDb: vi.fn(() => ({})),
+ queries: {
+ email: {
+ createEmail: (...args: unknown[]) => mockCreateEmail(...args),
+ },
+ agent: {
+ getAgentInWorkspace: (...args: unknown[]) => mockGetAgentInWorkspace(...args),
+ },
+ },
+}));
+
+vi.mock("@/lib/middleware/auth", () => ({
+ withAuth: vi.fn((handler: any) => async (req: any, ctx?: any) => {
+ const params = ctx?.params instanceof Promise ? await ctx.params : ctx?.params;
+ return handler(req, { userId: "u1", email: "[email protected]", params });
+ }),
+}));
+
+vi.mock("@/lib/middleware/workspace", () => ({
+ withWorkspaceMember: vi.fn(async () => ({ workspaceId: "ws1" })),
+}));
+
+vi.mock("@/lib/middleware/helpers", () => {
+ const { NextResponse } = require("next/server");
+ return {
+ writeJSON: (data: unknown, status = 200) => NextResponse.json(data, { status }),
+ writeError: (message: string, status: number) => NextResponse.json({ error: message }, { status }),
+ };
+});
+
+vi.mock("@/lib/api/responses", () => ({
+ emailToResponse: (e: any) => e,
+}));
+
+import { POST } from "./route";
+
+describe("POST /api/email/send", () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it("sends an email and returns the created record", async () => {
+ mockGetAgentInWorkspace.mockResolvedValue({ id: "a1", emailHandle: "test-agent" });
+ mockCreateEmail.mockResolvedValue({
+ id: "e1", agentId: "a1", fromEmail: "[email protected]",
+ toEmail: "[email protected]", subject: "Hello",
+ });
+ mockR2Put.mockResolvedValue(undefined);
+ mockSendEmailSend.mockResolvedValue({ messageId: "msg1" });
+
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({
+ agentId: "a1",
+ subject: "Hello",
+ htmlBody: "<p>Hi there</p>",
+ }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(200);
+ expect(mockSendEmailSend).toHaveBeenCalled();
+ expect(mockR2Put).toHaveBeenCalled();
+ expect(mockCreateEmail).toHaveBeenCalled();
+
+ // Verify single-part message (no boundary)
+ const r2Content = mockR2Put.mock.calls[0]![1] as string;
+ expect(r2Content).toContain("Content-Type: text/html; charset=utf-8");
+ expect(r2Content).not.toContain("multipart");
+ });
+
+ it("sends email with attachments as MIME multipart/mixed", async () => {
+ mockGetAgentInWorkspace.mockResolvedValue({ id: "a1", emailHandle: "test-agent" });
+ mockCreateEmail.mockResolvedValue({ id: "e1" });
+ mockR2Put.mockResolvedValue(undefined);
+ mockSendEmailSend.mockResolvedValue({ messageId: "msg1" });
+ mockR2Get.mockResolvedValue({
+ arrayBuffer: () => Promise.resolve(new TextEncoder().encode("file content").buffer),
+ });
+
+ const attachments = [
+ { key: "emails/drafts/x/doc.txt", filename: "doc.txt", size: 12, contentType: "text/plain" },
+ ];
+
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({
+ agentId: "a1",
+ subject: "With attachment",
+ htmlBody: "<p>See attached</p>",
+ attachments,
+ }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(200);
+
+ // Verify MIME multipart message stored in R2
+ const r2Content = mockR2Put.mock.calls[0]![1] as string;
+ expect(r2Content).toContain("multipart/mixed");
+ expect(r2Content).toContain("Content-Disposition: attachment; filename=\"doc.txt\"");
+ expect(r2Content).toContain("Content-Transfer-Encoding: base64");
+
+ // Verify attachments passed to createEmail
+ const createArgs = mockCreateEmail.mock.calls[0]![1] as any;
+ expect(createArgs.attachments).toBe(JSON.stringify(attachments));
+ });
+
+ it("skips missing R2 attachments gracefully", async () => {
+ mockGetAgentInWorkspace.mockResolvedValue({ id: "a1", emailHandle: "test-agent" });
+ mockCreateEmail.mockResolvedValue({ id: "e1" });
+ mockR2Put.mockResolvedValue(undefined);
+ mockSendEmailSend.mockResolvedValue({ messageId: "msg1" });
+ mockR2Get.mockResolvedValue(null); // R2 object not found
+
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({
+ agentId: "a1",
+ subject: "Missing attachment",
+ htmlBody: "<p>Oops</p>",
+ attachments: [
+ { key: "emails/drafts/gone/file.pdf", filename: "file.pdf", size: 100, contentType: "application/pdf" },
+ ],
+ }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(200);
+ });
+
+ it("returns 400 when agent has no emailHandle", async () => {
+ mockGetAgentInWorkspace.mockResolvedValue({ id: "a1", emailHandle: null });
+
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({
+ agentId: "a1",
+ subject: "Hello",
+ htmlBody: "<p>Hi</p>",
+ }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(400);
+ });
+
+ it("returns 404 when agent not in workspace", async () => {
+ mockGetAgentInWorkspace.mockResolvedValue(null);
+
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({
+ agentId: "a1",
+ subject: "Hello",
+ htmlBody: "<p>Hi</p>",
+ }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(404);
+ });
+
+ it("returns 400 when required fields are missing", async () => {
+ const req = new NextRequest("http://localhost/api/email/send?workspace_id=ws1", {
+ method: "POST",
+ body: JSON.stringify({ agentId: "a1" }),
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(400);
+ });
+});
diff --git a/src/web/src/app/api/email/send/route.ts b/src/web/src/app/api/email/send/route.ts
new file mode 100644
index 000000000..dce9cd869
--- /dev/null
+++ b/src/web/src/app/api/email/send/route.ts
@@ -0,0 +1,139 @@
+import { NextRequest } from "next/server";
+import { getCloudflareContext } from "@opennextjs/cloudflare";
+import { createDb, queries } from "@alook/shared";
+import type { EmailAttachment } from "@alook/shared";
+import { nanoid } from "nanoid";
+import { withAuth } from "@/lib/middleware/auth";
+import { withWorkspaceMember } from "@/lib/middleware/workspace";
+import { writeJSON, writeError } from "@/lib/middleware/helpers";
+import { emailToResponse } from "@/lib/api/responses";
+
+function arrayBufferToBase64(buffer: ArrayBuffer): string {
+ const bytes = new Uint8Array(buffer);
+ let binary = "";
+ for (let i = 0; i < bytes.byteLength; i++) {
+ binary += String.fromCharCode(bytes[i]!);
+ }
+ return btoa(binary);
+}
+
+export const POST = withAuth(async (req: NextRequest, ctx) => {
+ const ws = await withWorkspaceMember(req, ctx);
+ if (ws instanceof Response) return ws;
+
+ const { env } = getCloudflareContext();
+ const cfEnv = env as Env;
+ const db = createDb(cfEnv.DB);
+
+ let body: {
+ agentId: string;
+ to: string;
+ subject: string;
+ htmlBody: string;
+ attachments?: EmailAttachment[];
+ };
+ try {
+ body = await req.json();
+ } catch {
+ return writeError("invalid request body", 400);
+ }
+
+ if (!body.agentId || !body.to || !body.subject) {
+ return writeError("agentId, to, and subject are required", 400);
+ }
+
+ const agent = await queries.agent.getAgentInWorkspace(db, body.agentId, ws.workspaceId);
+ if (!agent) return writeError("agent not found in workspace", 404);
+
+ if (!agent.emailHandle) {
+ return writeError("agent has no email handle configured", 400);
+ }
+
+ const fromAddress = `${agent.emailHandle}@alook.ai`;
+ const attachments = body.attachments ?? [];
+
+ let raw: string;
+
+ if (attachments.length === 0) {
+ // Simple single-part message
+ raw = [
+ `From: ${fromAddress}`,
+ `To: ${body.to}`,
+ `Subject: ${body.subject}`,
+ `Date: ${new Date().toUTCString()}`,
+ `MIME-Version: 1.0`,
+ `Content-Type: text/html; charset=utf-8`,
+ "",
+ body.htmlBody || "",
+ ].join("\r\n");
+ } else {
+ // Multipart/mixed with attachments
+ const boundary = `----=_Part_${nanoid(16)}`;
+
+ const headers = [
+ `From: ${fromAddress}`,
+ `To: ${body.to}`,
+ `Subject: ${body.subject}`,
+ `Date: ${new Date().toUTCString()}`,
+ `MIME-Version: 1.0`,
+ `Content-Type: multipart/mixed; boundary="${boundary}"`,
+ "",
+ `--${boundary}`,
+ `Content-Type: text/html; charset=utf-8`,
+ `Content-Transfer-Encoding: 7bit`,
+ "",
+ body.htmlBody || "",
+ ];
+
+ const parts: string[] = [];
+ for (const att of attachments) {
+ const obj = await cfEnv.EMAIL_BUCKET.get(att.key);
+ if (!obj) continue;
+ const buf = await obj.arrayBuffer();
+ const b64 = arrayBufferToBase64(buf);
+
+ parts.push(
+ [
+ `--${boundary}`,
+ `Content-Type: ${att.contentType}; name="${att.filename}"`,
+ `Content-Disposition: attachment; filename="${att.filename}"`,
+ `Content-Transfer-Encoding: base64`,
+ "",
+ b64.match(/.{1,76}/g)?.join("\r\n") ?? b64,
+ ].join("\r\n")
+ );
+ }
+
+ raw = [...headers, ...parts, `--${boundary}--`].join("\r\n");
+ }
+
+ // Store raw email in R2
+ const r2Id = nanoid();
+ const r2Key = `emails/${r2Id}/raw`;
+ await cfEnv.EMAIL_BUCKET.put(r2Key, raw, {
+ httpMetadata: { contentType: "message/rfc822" },
+ });
+
+ // Send via Cloudflare SendEmail binding
+ await cfEnv.SEND_EMAIL.send({
+ from: fromAddress,
+ to: body.to,
+ subject: body.subject,
+ html: body.htmlBody || "",
+ });
+
+ // Create DB record
+ const email = await queries.email.createEmail(db, {
+ agentId: body.agentId,
+ fromEmail: fromAddress,
+ toEmail: body.to,
+ subject: body.subject,
+ r2Key,
+ isWhitelisted: false,
+ forwarded: false,
+ htmlBody: body.htmlBody || "",
+ attachments: JSON.stringify(attachments),
+ });
+
+ return writeJSON(emailToResponse(email));
+});
diff --git a/src/web/src/app/api/email/upload/route.test.ts b/src/web/src/app/api/email/upload/route.test.ts
new file mode 100644
index 000000000..06d90f567
--- /dev/null
+++ b/src/web/src/app/api/email/upload/route.test.ts
@@ -0,0 +1,90 @@
+import { describe, it, expect, vi, beforeEach } from "vitest";
+import { NextRequest } from "next/server";
+
+const mockR2Put = vi.fn();
+
+vi.mock("@opennextjs/cloudflare", () => ({
+ getCloudflareContext: vi.fn(() => ({
+ env: {
+ DB: {},
+ EMAIL_BUCKET: { put: (...args: unknown[]) => mockR2Put(...args) },
+ },
+ })),
+}));
+
+vi.mock("@/lib/middleware/auth", () => ({
+ withAuth: vi.fn((handler: any) => async (req: any, ctx?: any) => {
+ const params = ctx?.params instanceof Promise ? await ctx.params : ctx?.params;
+ return handler(req, { userId: "u1", email: "[email protected]", params });
+ }),
+}));
+
+vi.mock("@/lib/middleware/workspace", () => ({
+ withWorkspaceMember: vi.fn(async () => ({ workspaceId: "ws1" })),
+}));
+
+vi.mock("@/lib/middleware/helpers", () => {
+ const { NextResponse } = require("next/server");
+ return {
+ writeJSON: (data: unknown, status = 200) => NextResponse.json(data, { status }),
+ writeError: (message: string, status: number) => NextResponse.json({ error: message }, { status }),
+ };
+});
+
+import { POST } from "./route";
+
+describe("POST /api/email/upload", () => {
+ beforeEach(() => vi.clearAllMocks());
+
+ it("uploads a file and returns metadata", async () => {
+ mockR2Put.mockResolvedValue(undefined);
+
+ const formData = new FormData();
+ formData.append("file", new File(["hello world"], "test.txt", { type: "text/plain" }));
+
+ const req = new NextRequest("http://localhost/api/email/upload?workspace_id=ws1", {
+ method: "POST",
+ body: formData,
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(200);
+
+ const body = await res.json();
+ expect(body.filename).toBe("test.txt");
+ expect(body.size).toBe(11);
+ expect(body.contentType).toBe("text/plain");
+ expect(body.key).toContain("emails/drafts/");
+ expect(body.key).toContain("/test.txt");
+
+ expect(mockR2Put).toHaveBeenCalledTimes(1);
+ });
+
+ it("returns 400 when no file is provided", async () => {
+ const formData = new FormData();
+
+ const req = new NextRequest("http://localhost/api/email/upload?workspace_id=ws1", {
+ method: "POST",
+ body: formData,
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(400);
+ });
+
+ it("returns 413 when file exceeds 10 MB", async () => {
+ // Create a file over 10MB
+ const bigContent = new Uint8Array(10 * 1024 * 1024 + 1);
+ const formData = new FormData();
+ formData.append("file", new File([bigContent], "huge.bin", { type: "application/octet-stream" }));
+
+ const req = new NextRequest("http://localhost/api/email/upload?workspace_id=ws1", {
+ method: "POST",
+ body: formData,
+ });
+
+ const res = await POST(req, {} as any);
+ expect(res.status).toBe(413);
+ expect(mockR2Put).not.toHaveBeenCalled();
+ });
+});
diff --git a/src/web/src/app/api/email/upload/route.ts b/src/web/src/app/api/email/upload/route.ts
new file mode 100644
index 000000000..95dd7caae
--- /dev/null
+++ b/src/web/src/app/api/email/upload/route.ts
@@ -0,0 +1,46 @@
+import { NextRequest } from "next/server";
+import { getCloudflareContext } from "@opennextjs/cloudflare";
+import { nanoid } from "nanoid";
+import { withAuth } from "@/lib/middleware/auth";
+import { withWorkspaceMember } from "@/lib/middleware/workspace";
+import { writeJSON, writeError } from "@/lib/middleware/helpers";
+
+const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
+
+export const POST = withAuth(async (req: NextRequest, ctx) => {
+ const ws = await withWorkspaceMember(req, ctx);
+ if (ws instanceof Response) return ws;
+
+ const { env } = getCloudflareContext();
+ const bucket = (env as Env).EMAIL_BUCKET;
+
+ let formData: FormData;
+ try {
+ formData = await req.formData();
+ } catch {
+ return writeError("invalid form data", 400);
+ }
+
+ const file = formData.get("file");
+ if (!file || !(file instanceof File)) {
+ return writeError("file is required", 400);
+ }
+
+ if (file.size > MAX_FILE_SIZE) {
+ return writeError("file exceeds 10 MB limit", 413);
+ }
+
+ const draftId = nanoid();
+ const key = `emails/drafts/${draftId}/${file.name}`;
+
+ await bucket.put(key, await file.arrayBuffer(), {
+ httpMetadata: { contentType: file.type || "application/octet-stream" },
+ });
+
+ return writeJSON({
+ key,
+ filename: file.name,
+ size: file.size,
+ contentType: file.type || "application/octet-stream",
+ });
+});
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index d0f901113..ff359e62e 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -426,6 +426,28 @@
.markdown strong { font-weight: 600; }
.markdown em { font-style: italic; }
+/* ── TipTap editor styles ── */
+.tiptap p.is-editor-empty:first-child::before {
+ color: var(--muted-foreground);
+ content: attr(data-placeholder);
+ float: left;
+ height: 0;
+ pointer-events: none;
+}
+.tiptap h1 { font-size: 1.5em; font-weight: 700; margin: 0.5em 0 0.25em; line-height: 1.3; }
+.tiptap h2 { font-size: 1.25em; font-weight: 600; margin: 0.5em 0 0.25em; line-height: 1.35; }
+.tiptap h3 { font-size: 1.1em; font-weight: 600; margin: 0.4em 0 0.2em; line-height: 1.4; }
+.tiptap ul { list-style-type: disc; padding-left: 1.5em; margin: 0.4em 0; }
+.tiptap ol { list-style-type: decimal; padding-left: 1.5em; margin: 0.4em 0; }
+.tiptap li { margin: 0.15em 0; }
+.tiptap li p { margin: 0; }
+.tiptap blockquote { border-left: 2px solid var(--border); padding-left: 0.75em; margin: 0.5em 0; color: var(--muted-foreground); }
+.tiptap a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
+.tiptap hr { border: none; border-top: 1px solid var(--border); margin: 0.75em 0; }
+.tiptap img { max-width: 100%; border-radius: 0.375rem; }
+.tiptap u { text-decoration: underline; }
+.tiptap s { text-decoration: line-through; }
+
/* ── Thin scrollbar (code blocks, tool panels, chat scroll) ── */
.markdown pre,
[data-streamdown] pre,
diff --git a/src/web/src/components/agent-detail-sidebar.tsx b/src/web/src/components/agent-detail-sidebar.tsx
deleted file mode 100644
index f45e21d44..000000000
--- a/src/web/src/components/agent-detail-sidebar.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-"use client";
-
-import Link from "next/link";
-import { usePathname } from "next/navigation";
-import { useWorkspace } from "@/contexts/workspace-context";
-import { cn } from "@/lib/utils";
-import { MessageSquare, Mail } from "lucide-react";
-
-interface AgentDetailSidebarProps {
- agentId: string;
-}
-
-const items = [
- { key: "chat", label: "Chat", icon: MessageSquare },
- { key: "email", label: "Email", icon: Mail },
-] as const;
-
-export function AgentDetailSidebar({ agentId }: AgentDetailSidebarProps) {
- const pathname = usePathname();
- const { slug } = useWorkspace();
- const base = `/w/${slug}/agents/${agentId}`;
-
- return (
- <nav className="flex w-40 shrink-0 flex-col gap-0.5 border-r border-border/40 p-2">
- {items.map(({ key, label, icon: Icon }) => {
- const href = `${base}/${key}`;
- const isActive = pathname.startsWith(href);
- return (
- <Link
- key={key}
- href={href}
- className={cn(
- "flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm transition-colors duration-150",
- isActive
- ? "bg-accent text-accent-foreground font-medium"
- : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
- )}
- >
- <Icon className="size-4" />
- {label}
- </Link>
- );
- })}
- </nav>
- );
-}
diff --git a/src/web/src/components/app-sidebar.tsx b/src/web/src/components/app-sidebar.tsx
index 5bb9f001f..769d9fb82 100644
--- a/src/web/src/components/app-sidebar.tsx
+++ b/src/web/src/components/app-sidebar.tsx
@@ -30,7 +30,7 @@ export function AppSidebar() {
const activeAgentId = urlAgentId ?? pathnameAgentMatch?.[1] ?? null;
const handleAgentClick = (agentId: string) => {
- router.push(`${prefix}/agents/${agentId}/chat`);
+ router.push(`${prefix}/agents/${agentId}`);
};
return (
diff --git a/src/web/src/components/email-compose.tsx b/src/web/src/components/email-compose.tsx
new file mode 100644
index 000000000..15e64dd49
--- /dev/null
+++ b/src/web/src/components/email-compose.tsx
@@ -0,0 +1,242 @@
+"use client";
+
+import { useState, useRef } from "react";
+import { useEditor, EditorContent } from "@tiptap/react";
+import StarterKit from "@tiptap/starter-kit";
+import Placeholder from "@tiptap/extension-placeholder";
+import Underline from "@tiptap/extension-underline";
+import Link from "@tiptap/extension-link";
+import TextAlign from "@tiptap/extension-text-align";
+import { TextStyle } from "@tiptap/extension-text-style";
+import { Color } from "@tiptap/extension-color";
+import Image from "@tiptap/extension-image";
+import { EmailToolbar } from "@/components/email-toolbar";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import type { EmailAttachment } from "@alook/shared";
+import { toast } from "sonner";
+import { Send, X, Loader2, Paperclip, File as FileIcon } from "lucide-react";
+
+interface EmailComposeProps {
+ fromAddress: string;
+ onSend: (to: string, subject: string, htmlBody: string, attachments: EmailAttachment[]) => Promise<boolean>;
+ onDiscard: () => void;
+ initialTo?: string;
+ initialSubject?: string;
+ initialBody?: string;
+ initialAttachments?: EmailAttachment[];
+}
+
+function formatFileSize(bytes: number): string {
+ if (bytes < 1024) return `${bytes} B`;
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+}
+
+export function EmailCompose({
+ fromAddress,
+ onSend,
+ onDiscard,
+ initialTo = "",
+ initialSubject = "",
+ initialBody = "",
+ initialAttachments = [],
+}: EmailComposeProps) {
+ const [to, setTo] = useState(initialTo);
+ const [subject, setSubject] = useState(initialSubject);
+ const [sending, setSending] = useState(false);
+ const [attachments, setAttachments] = useState<EmailAttachment[]>(initialAttachments);
+ const [uploading, setUploading] = useState(false);
+ const fileInputRef = useRef<HTMLInputElement>(null);
+
+ const editor = useEditor({
+ immediatelyRender: false,
+ content: initialBody || undefined,
+ extensions: [
+ StarterKit.configure({
+ link: false,
+ underline: false,
+ }),
+ Placeholder.configure({ placeholder: "Write your email..." }),
+ Underline,
+ Link.configure({
+ autolink: true,
+ openOnClick: false,
+ linkOnPaste: true,
+ }),
+ TextAlign.configure({
+ types: ["heading", "paragraph"],
+ }),
+ TextStyle,
+ Color,
+ Image.configure({
+ inline: true,
+ allowBase64: true,
+ }),
+ ],
+ editorProps: {
+ attributes: {
+ class: "text-sm max-w-none focus:outline-none min-h-[200px] px-4 py-3",
+ },
+ },
+ });
+
+ const handleSend = async () => {
+ if (!to.trim() || !subject.trim() || !editor) return;
+ setSending(true);
+ try {
+ const html = editor.getHTML();
+ const ok = await onSend(to.trim(), subject.trim(), html, attachments);
+ if (ok) {
+ setTo("");
+ setSubject("");
+ setAttachments([]);
+ editor.commands.clearContent();
+ }
+ } finally {
+ setSending(false);
+ }
+ };
+
+ const handleFileSelect = async (e: React.ChangeEvent<HTMLInputElement>) => {
+ const files = e.target.files;
+ if (!files || files.length === 0) return;
+
+ setUploading(true);
+ try {
+ const { uploadEmailAttachment } = await import("@/lib/api");
+ for (const file of Array.from(files)) {
+ if (file.size > 10 * 1024 * 1024) {
+ toast.error(`${file.name} exceeds 10 MB limit`);
+ continue;
+ }
+ const workspaceId = new URLSearchParams(window.location.search).get("workspace_id") ?? "";
+ const meta = await uploadEmailAttachment(file, workspaceId);
+ setAttachments((prev) => [...prev, meta]);
+ }
+ } catch {
+ toast.error("Failed to upload attachment");
+ } finally {
+ setUploading(false);
+ if (fileInputRef.current) fileInputRef.current.value = "";
+ }
+ };
+
+ const removeAttachment = (key: string) => {
+ setAttachments((prev) => prev.filter((a) => a.key !== key));
+ };
+
+ return (
+ <div className="flex flex-col h-full">
+ <div className="flex items-center justify-between border-b border-border/40 px-4 py-2">
+ <h3 className="text-sm font-medium">New Email</h3>
+ <div className="flex items-center gap-1">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-xs text-muted-foreground h-7 px-2"
+ onClick={onDiscard}
+ disabled={sending}
+ >
+ <X className="size-3 mr-1" />
+ Discard
+ </Button>
+ <Button
+ size="sm"
+ className="text-xs h-7 px-3"
+ onClick={handleSend}
+ disabled={sending || !to.trim() || !subject.trim()}
+ >
+ {sending ? (
+ <Loader2 className="size-3 mr-1 animate-spin" />
+ ) : (
+ <Send className="size-3 mr-1" />
+ )}
+ Send
+ </Button>
+ </div>
+ </div>
+
+ <div className="border-b border-border/30 px-4 py-2 space-y-2">
+ <div className="flex items-center gap-2 text-sm">
+ <span className="text-muted-foreground w-14 shrink-0">From:</span>
+ <span className="text-foreground/70">{fromAddress}</span>
+ </div>
+ <div className="flex items-center gap-2 text-sm">
+ <span className="text-muted-foreground w-14 shrink-0">To:</span>
+ <Input
+ type="email"
+ value={to}
+ onChange={(e) => setTo(e.target.value)}
+ placeholder="[email protected]"
+ className="h-7 text-sm border-0 bg-transparent px-0 shadow-none focus-visible:ring-0"
+ disabled={sending}
+ />
+ </div>
+ <div className="flex items-center gap-2 text-sm">
+ <span className="text-muted-foreground w-14 shrink-0">Subject:</span>
+ <Input
+ value={subject}
+ onChange={(e) => setSubject(e.target.value)}
+ placeholder="Email subject"
+ className="h-7 text-sm border-0 bg-transparent px-0 shadow-none focus-visible:ring-0"
+ disabled={sending}
+ />
+ </div>
+ </div>
+
+ <div className="flex items-center border-b border-border/30">
+ <EmailToolbar editor={editor} />
+ <div className="flex items-center gap-1 px-2 border-l border-border/30">
+ <input
+ ref={fileInputRef}
+ type="file"
+ multiple
+ className="hidden"
+ onChange={handleFileSelect}
+ />
+ <button
+ type="button"
+ title="Attach file"
+ disabled={uploading}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={() => fileInputRef.current?.click()}
+ className="flex items-center justify-center size-7 rounded-md transition-colors cursor-pointer text-muted-foreground/70 hover:text-foreground hover:bg-accent disabled:opacity-40"
+ >
+ {uploading ? (
+ <Loader2 className="size-3.5 animate-spin" />
+ ) : (
+ <Paperclip className="size-3.5" />
+ )}
+ </button>
+ </div>
+ </div>
+
+ {attachments.length > 0 && (
+ <div className="flex flex-wrap gap-1.5 px-4 py-2 border-b border-border/30">
+ {attachments.map((att) => (
+ <div
+ key={att.key}
+ className="flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs"
+ >
+ <FileIcon className="size-3 text-muted-foreground shrink-0" />
+ <span className="truncate max-w-[150px]">{att.filename}</span>
+ <span className="text-muted-foreground shrink-0">{formatFileSize(att.size)}</span>
+ <button
+ type="button"
+ onClick={() => removeAttachment(att.key)}
+ className="text-muted-foreground hover:text-foreground ml-0.5 cursor-pointer"
+ >
+ <X className="size-3" />
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+
+ <div className="flex-1 overflow-y-auto">
+ <EditorContent editor={editor} />
+ </div>
+ </div>
+ );
+}
diff --git a/src/web/src/components/email-toolbar.tsx b/src/web/src/components/email-toolbar.tsx
new file mode 100644
index 000000000..45d2b5ad1
--- /dev/null
+++ b/src/web/src/components/email-toolbar.tsx
@@ -0,0 +1,208 @@
+"use client";
+
+import type { Editor } from "@tiptap/react";
+import { cn } from "@/lib/utils";
+import {
+ Bold,
+ Italic,
+ Underline,
+ Strikethrough,
+ List,
+ ListOrdered,
+ AlignLeft,
+ AlignCenter,
+ AlignRight,
+ Link,
+ Unlink,
+ Image,
+ Heading1,
+ Heading2,
+ Minus,
+} from "lucide-react";
+
+interface EmailToolbarProps {
+ editor: Editor | null;
+}
+
+function ToolbarButton({
+ active,
+ disabled,
+ onClick,
+ title,
+ children,
+}: {
+ active?: boolean;
+ disabled?: boolean;
+ onClick: () => void;
+ title: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <button
+ type="button"
+ title={title}
+ disabled={disabled}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={onClick}
+ className={cn(
+ "flex items-center justify-center size-7 rounded-md transition-colors cursor-pointer",
+ "text-muted-foreground/70 hover:text-foreground hover:bg-accent",
+ active && "bg-accent text-foreground",
+ disabled && "opacity-40 pointer-events-none"
+ )}
+ >
+ {children}
+ </button>
+ );
+}
+
+function ToolbarDivider() {
+ return <div className="w-px h-4 bg-border/60 mx-0.5 shrink-0" />;
+}
+
+export function EmailToolbar({ editor }: EmailToolbarProps) {
+ if (!editor) return null;
+
+ const iconSize = "size-3.5";
+
+ const handleLink = () => {
+ if (editor.isActive("link")) {
+ editor.chain().focus().unsetLink().run();
+ return;
+ }
+ const url = window.prompt("URL");
+ if (url) {
+ editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
+ }
+ };
+
+ const handleImage = () => {
+ const url = window.prompt("Image URL");
+ if (url) {
+ editor.chain().focus().setImage({ src: url }).run();
+ }
+ };
+
+ return (
+ <div className="flex items-center gap-0.5 border-b border-border/30 px-3 py-1">
+ {/* Inline formatting */}
+ <ToolbarButton
+ title="Bold"
+ active={editor.isActive("bold")}
+ onClick={() => editor.chain().focus().toggleBold().run()}
+ >
+ <Bold className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Italic"
+ active={editor.isActive("italic")}
+ onClick={() => editor.chain().focus().toggleItalic().run()}
+ >
+ <Italic className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Underline"
+ active={editor.isActive("underline")}
+ onClick={() => editor.chain().focus().toggleUnderline().run()}
+ >
+ <Underline className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Strikethrough"
+ active={editor.isActive("strike")}
+ onClick={() => editor.chain().focus().toggleStrike().run()}
+ >
+ <Strikethrough className={iconSize} />
+ </ToolbarButton>
+
+ <ToolbarDivider />
+
+ {/* Headings */}
+ <ToolbarButton
+ title="Heading 1"
+ active={editor.isActive("heading", { level: 1 })}
+ onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}
+ >
+ <Heading1 className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Heading 2"
+ active={editor.isActive("heading", { level: 2 })}
+ onClick={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
+ >
+ <Heading2 className={iconSize} />
+ </ToolbarButton>
+
+ <ToolbarDivider />
+
+ {/* Lists */}
+ <ToolbarButton
+ title="Bullet List"
+ active={editor.isActive("bulletList")}
+ onClick={() => editor.chain().focus().toggleBulletList().run()}
+ >
+ <List className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Ordered List"
+ active={editor.isActive("orderedList")}
+ onClick={() => editor.chain().focus().toggleOrderedList().run()}
+ >
+ <ListOrdered className={iconSize} />
+ </ToolbarButton>
+
+ <ToolbarDivider />
+
+ {/* Alignment */}
+ <ToolbarButton
+ title="Align Left"
+ active={editor.isActive({ textAlign: "left" })}
+ onClick={() => editor.chain().focus().setTextAlign("left").run()}
+ >
+ <AlignLeft className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Align Center"
+ active={editor.isActive({ textAlign: "center" })}
+ onClick={() => editor.chain().focus().setTextAlign("center").run()}
+ >
+ <AlignCenter className={iconSize} />
+ </ToolbarButton>
+ <ToolbarButton
+ title="Align Right"
+ active={editor.isActive({ textAlign: "right" })}
+ onClick={() => editor.chain().focus().setTextAlign("right").run()}
+ >
+ <AlignRight className={iconSize} />
+ </ToolbarButton>
+
+ <ToolbarDivider />
+
+ {/* Link & Image */}
+ <ToolbarButton
+ title={editor.isActive("link") ? "Remove Link" : "Insert Link"}
+ active={editor.isActive("link")}
+ onClick={handleLink}
+ >
+ {editor.isActive("link") ? (
+ <Unlink className={iconSize} />
+ ) : (
+ <Link className={iconSize} />
+ )}
+ </ToolbarButton>
+ <ToolbarButton title="Insert Image" onClick={handleImage}>
+ <Image className={iconSize} />
+ </ToolbarButton>
+
+ <ToolbarDivider />
+
+ {/* Horizontal Rule */}
+ <ToolbarButton
+ title="Horizontal Rule"
+ onClick={() => editor.chain().focus().setHorizontalRule().run()}
+ >
+ <Minus className={iconSize} />
+ </ToolbarButton>
+ </div>
+ );
+}
diff --git a/src/web/src/env.d.ts b/src/web/src/env.d.ts
index 94bbaeef4..155e1d348 100644
--- a/src/web/src/env.d.ts
+++ b/src/web/src/env.d.ts
@@ -3,6 +3,7 @@ declare namespace Cloudflare {
DB: D1Database
EMAIL_BUCKET: R2Bucket
WS_DO_WORKER: Fetcher
+ SEND_EMAIL: SendEmail
NEXT_INC_CACHE_R2_BUCKET: R2Bucket
NEXT_TAG_CACHE_D1: D1Database
NEXT_CACHE_DO_QUEUE: DurableObjectNamespace
diff --git a/src/web/src/lib/api.ts b/src/web/src/lib/api.ts
index f799e6e5d..ea6690fa2 100644
--- a/src/web/src/lib/api.ts
+++ b/src/web/src/lib/api.ts
@@ -177,8 +177,8 @@ export const getTaskMessages = (id: string, workspaceId: string, since?: number)
);
// Emails
-export const listEmails = (agentId: string, workspaceId: string) =>
- apiFetch<Email[]>(`/api/email${wsQuery(workspaceId, { agentId })}`);
+export const listEmails = (agentId: string, workspaceId: string, folder?: string) =>
+ apiFetch<Email[]>(`/api/email${wsQuery(workspaceId, { agentId, ...(folder ? { folder } : {}) })}`);
export const getEmail = (id: string, workspaceId: string) =>
apiFetch<Email>(`/api/email/${id}${wsQuery(workspaceId)}`);
@@ -190,6 +190,40 @@ export const getEmailBody = async (id: string, workspaceId: string): Promise<str
return res.text();
};
+export const deleteEmail = (id: string, workspaceId: string) =>
+ apiFetch<void>(`/api/email/${id}${wsQuery(workspaceId)}`, { method: "DELETE" });
+
+export const uploadEmailAttachment = async (
+ file: File,
+ workspaceId: string,
+): Promise<{ key: string; filename: string; size: number; contentType: string }> => {
+ const fd = new FormData();
+ fd.append("file", file);
+ const res = await fetch(`/api/email/upload${wsQuery(workspaceId)}`, {
+ method: "POST",
+ credentials: "include",
+ body: fd,
+ });
+ if (!res.ok) {
+ const msg = await res.text().catch(() => "Upload failed");
+ throw new ApiError(msg, res.status);
+ }
+ return res.json();
+};
+
+export const sendEmail = (
+ agentId: string,
+ to: string,
+ subject: string,
+ htmlBody: string,
+ workspaceId: string,
+ attachments?: { key: string; filename: string; size: number; contentType: string }[],
+) =>
+ apiFetch<Email>(`/api/email/send${wsQuery(workspaceId)}`, {
+ method: "POST",
+ body: JSON.stringify({ agentId, to, subject, htmlBody, attachments }),
+ });
+
// Auth (Better Auth — redirect helpers only, actual auth via Better Auth client)
export const signOut = async () => {
if (typeof window !== "undefined") {
diff --git a/src/web/src/lib/api/responses.test.ts b/src/web/src/lib/api/responses.test.ts
index 1685d363d..986231a43 100644
--- a/src/web/src/lib/api/responses.test.ts
+++ b/src/web/src/lib/api/responses.test.ts
@@ -8,6 +8,7 @@ import {
messageToResponse,
runtimeToResponse,
machineTokenToResponse,
+ emailToResponse,
} from "./responses";
const ts = new Date("2024-06-01T12:00:00.456Z");
@@ -372,3 +373,60 @@ describe("all response mappers strip milliseconds from timestamps", () => {
expect(res.last_used_at).toBe(tsFormatted);
});
});
+
+describe("emailToResponse", () => {
+ it("maps DB fields to API response format", () => {
+ const res = emailToResponse({
+ id: "e1",
+ agentId: "a1",
+ fromEmail: "[email protected]",
+ toEmail: "[email protected]",
+ subject: "Hello",
+ r2Key: "emails/abc/raw",
+ isWhitelisted: 1,
+ forwarded: 0,
+
+ htmlBody: "<p>Hi</p>",
+ attachments: "[]",
+ createdAt: ts,
+ });
+ expect(res.id).toBe("e1");
+ expect(res.agent_id).toBe("a1");
+ expect(res.from_email).toBe("[email protected]");
+ expect(res.is_whitelisted).toBe(true);
+ expect(res.forwarded).toBe(false);
+
+ expect(res.attachments).toEqual([]);
+ expect(res.created_at).toBe(tsFormatted);
+ });
+
+ it("parses attachments JSON string", () => {
+ const attachments = [{ key: "k1", filename: "f.pdf", size: 100, contentType: "application/pdf" }];
+ const res = emailToResponse({
+ id: "e2",
+ agentId: "a1",
+ fromEmail: "[email protected]",
+ toEmail: "[email protected]",
+ subject: "S",
+ r2Key: "r",
+ isWhitelisted: 0,
+ forwarded: 0,
+
+ htmlBody: "",
+ attachments: JSON.stringify(attachments),
+ createdAt: ts,
+ });
+ expect(res.attachments).toEqual(attachments);
+ expect(res.attachments[0].filename).toBe("f.pdf");
+ });
+
+ it("defaults to empty array when attachments is null/empty", () => {
+ const res = emailToResponse({
+ id: "e3", agentId: "a1", fromEmail: "[email protected]", toEmail: "[email protected]",
+ subject: "S", r2Key: "r", isWhitelisted: 0, forwarded: 0,
+ htmlBody: "", attachments: "",
+ createdAt: ts,
+ });
+ expect(res.attachments).toEqual([]);
+ });
+});
diff --git a/src/web/src/lib/api/responses.ts b/src/web/src/lib/api/responses.ts
index 40012da3b..f6a6342e5 100644
--- a/src/web/src/lib/api/responses.ts
+++ b/src/web/src/lib/api/responses.ts
@@ -57,6 +57,8 @@ export function emailToResponse(e: any) {
r2_key: e.r2Key,
is_whitelisted: !!e.isWhitelisted,
forwarded: !!e.forwarded,
+ html_body: e.htmlBody ?? "",
+ attachments: JSON.parse(e.attachments || "[]"),
created_at: formatTimestamp(e.createdAt),
};
}
diff --git a/src/web/wrangler.toml b/src/web/wrangler.toml
index 89a4bfbf1..731a1d70b 100644
--- a/src/web/wrangler.toml
+++ b/src/web/wrangler.toml
@@ -44,3 +44,7 @@ bucket_name = "alook-emails"
[[services]]
binding = "WS_DO_WORKER"
service = "alook-ws-do"
+
+# Outbound email sending via Cloudflare Email Routing
+[[send_email]]
+name = "SEND_EMAIL"