agentinbox-cli 0.0.0 → 0.1.0-nightly.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +312 -0
- package/dist/audit-CQe-_dPQ.js +2 -0
- package/dist/audit-DETqygzG.js +65 -0
- package/dist/audit-DETqygzG.js.map +1 -0
- package/dist/auth-BniddcRD.js +447 -0
- package/dist/auth-BniddcRD.js.map +1 -0
- package/dist/auth-C2v7bEmQ.js +2 -0
- package/dist/bus-Cz0flS37.js +12 -0
- package/dist/bus-Cz0flS37.js.map +1 -0
- package/dist/bus-OKIGut72.js +2 -0
- package/dist/cli.js +141 -0
- package/dist/cli.js.map +1 -0
- package/dist/config-CIvgMqLx.js +2 -0
- package/dist/config-v975gxv4.js +44 -0
- package/dist/config-v975gxv4.js.map +1 -0
- package/dist/crypto-DYZ4R7c2.js +74 -0
- package/dist/crypto-DYZ4R7c2.js.map +1 -0
- package/dist/db-CfoMO5zW.js +2 -0
- package/dist/db-DdagFmUY.js +247 -0
- package/dist/db-DdagFmUY.js.map +1 -0
- package/dist/errors-CJLUPllS.js +38 -0
- package/dist/errors-CJLUPllS.js.map +1 -0
- package/dist/instance-DZMV78rI.js +2 -0
- package/dist/instance-Dy2jeyZc.js +174 -0
- package/dist/instance-Dy2jeyZc.js.map +1 -0
- package/dist/server-CWqKeCGn.js +981 -0
- package/dist/server-CWqKeCGn.js.map +1 -0
- package/dist/service-63pdSmhO.js +332 -0
- package/dist/service-63pdSmhO.js.map +1 -0
- package/dist/settings-Dq2ETFsd.js +98 -0
- package/dist/settings-Dq2ETFsd.js.map +1 -0
- package/dist/settings-qtn5WTBM.js +2 -0
- package/dist/setup-token-Bkwk84l7.js +47 -0
- package/dist/setup-token-Bkwk84l7.js.map +1 -0
- package/dist/skill/SKILL.md +226 -0
- package/dist/skill-BWWtinsE.js +2 -0
- package/dist/skill-WKbeyNct.js +43 -0
- package/dist/skill-WKbeyNct.js.map +1 -0
- package/dist/urls-CNYhbeUQ.js +2 -0
- package/dist/urls-DmnonkJo.js +22 -0
- package/dist/urls-DmnonkJo.js.map +1 -0
- package/dist/web/assets/_agentId-il4y7OCG.js +1 -0
- package/dist/web/assets/_app-BIO8WIYB.js +1 -0
- package/dist/web/assets/_app-wlLL4MrD.js +63 -0
- package/dist/web/assets/_webhookId-CiwDrkY4.js +1 -0
- package/dist/web/assets/account-status-at9Bv3_T.js +1 -0
- package/dist/web/assets/accounts-B4rfPwCV.js +1 -0
- package/dist/web/assets/accounts-list-e--JWxHH.js +1 -0
- package/dist/web/assets/activity-zrckFhPk.js +1 -0
- package/dist/web/assets/agent-create-form-DaWPR6kx.js +1 -0
- package/dist/web/assets/agents-D4gPq4dt.js +1 -0
- package/dist/web/assets/approvals-DaoZ6wuf.js +2 -0
- package/dist/web/assets/arrow-left-DVJV4Zx7.js +1 -0
- package/dist/web/assets/arrow-right-4PFX6MSS.js +1 -0
- package/dist/web/assets/audit-bAdLe-px.js +1 -0
- package/dist/web/assets/audit-bits-DQHo74i6.js +1 -0
- package/dist/web/assets/bot-DVw15lBn.js +1 -0
- package/dist/web/assets/card-EQTpqntn.js +1 -0
- package/dist/web/assets/checkbox-DDZZurgK.js +1 -0
- package/dist/web/assets/chevron-down-892ylB4R.js +1 -0
- package/dist/web/assets/chevron-right-CbBKS6-T.js +1 -0
- package/dist/web/assets/chips-input-Btdc_f7b.js +1 -0
- package/dist/web/assets/circle-x-Bi4IGwky.js +1 -0
- package/dist/web/assets/common-h6596gEC.js +1 -0
- package/dist/web/assets/connect-host-Co31qIYr.js +1 -0
- package/dist/web/assets/data-table-DsKrM62X.js +1 -0
- package/dist/web/assets/dialog-CgZr27yw.js +1 -0
- package/dist/web/assets/dist-B0e3Ju3r.js +1 -0
- package/dist/web/assets/empty-CE_WZGEC.js +1 -0
- package/dist/web/assets/es2015-DPaldoxG.js +41 -0
- package/dist/web/assets/event-row-C0qRfWuV.js +1 -0
- package/dist/web/assets/events-Svyij7mp.js +1 -0
- package/dist/web/assets/eye-off-DjpaihHf.js +1 -0
- package/dist/web/assets/field-CcyMn3ey.js +1 -0
- package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/web/assets/get-started-Cxfw97sJ.js +1 -0
- package/dist/web/assets/grants-BilXCDps.js +1 -0
- package/dist/web/assets/index-DgIgw66p.css +2 -0
- package/dist/web/assets/index-TbxC5ZgP.js +10 -0
- package/dist/web/assets/input-CMhmmHiH.js +1 -0
- package/dist/web/assets/input-group-DRs3TNaT.js +1 -0
- package/dist/web/assets/key-round-CVIZRCLM.js +1 -0
- package/dist/web/assets/labels-C_Pwium9.js +1 -0
- package/dist/web/assets/login-DUJia7lg.js +1 -0
- package/dist/web/assets/mail-CAVmuESo.js +1 -0
- package/dist/web/assets/mutations-D_GluJ0j.js +1 -0
- package/dist/web/assets/paperclip-QFjM4y6n.js +1 -0
- package/dist/web/assets/password-input-_m9Ycphv.js +1 -0
- package/dist/web/assets/pencil-Bf1JhsG0.js +1 -0
- package/dist/web/assets/play-DiPk49JH.js +1 -0
- package/dist/web/assets/plus-CETmK0SB.js +1 -0
- package/dist/web/assets/preload-helper-BFuRUfdt.js +1 -0
- package/dist/web/assets/progress-3ZOsbLSK.js +6 -0
- package/dist/web/assets/queries-a3M5_loa.js +2 -0
- package/dist/web/assets/refresh-cw-DOn9kD7g.js +1 -0
- package/dist/web/assets/search-gcYjitzV.js +1 -0
- package/dist/web/assets/select-_tULk-vs.js +1 -0
- package/dist/web/assets/send-BhQwhuJo.js +1 -0
- package/dist/web/assets/settings-Dl4wb4f0.js +1 -0
- package/dist/web/assets/settings-form-D21eKBh-.js +1 -0
- package/dist/web/assets/setup-DYnNhnfH.js +1 -0
- package/dist/web/assets/sheet--2lKU0jN.js +1 -0
- package/dist/web/assets/shield-alert-CbFgd06X.js +1 -0
- package/dist/web/assets/stamp-CH2OvjH2.js +1 -0
- package/dist/web/assets/stream-6OwrgVZw.js +1 -0
- package/dist/web/assets/tabs-CiAUEj_y.js +1 -0
- package/dist/web/assets/tag-CP72Kk6Y.js +1 -0
- package/dist/web/assets/test-connection-F2tMowbv.js +1 -0
- package/dist/web/assets/textarea-CCokBZIw.js +1 -0
- package/dist/web/assets/toggle-group-D1pC7sJr.js +1 -0
- package/dist/web/assets/trash-DxdMNg8B.js +1 -0
- package/dist/web/assets/use-sign-out-BuzlTb0Q.js +1 -0
- package/dist/web/assets/useInfiniteQuery-DE6WChlb.js +1 -0
- package/dist/web/assets/useMatch-BKUnm54_.js +1 -0
- package/dist/web/assets/useMutation-DGl4PaZ1.js +1 -0
- package/dist/web/assets/useQuery-DAhf1YDH.js +1 -0
- package/dist/web/assets/useSelector-D70eKNYs.js +1 -0
- package/dist/web/assets/webhook-BWT75M78.js +1 -0
- package/dist/web/assets/webhook-sheet-4U_6Rw8I.js +34 -0
- package/dist/web/assets/webhooks-C1JvTI88.js +1 -0
- package/dist/web/assets/with-selector-CkNyXYMW.js +1 -0
- package/dist/web/assets/x-BHjDLXNO.js +1 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +31 -0
- package/package.json +94 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{G as e,f as t,ht as n,mt as r,n as i,o as a,q as o,r as ee,t as te,vt as s}from"./queries-a3M5_loa.js";import{t as c}from"./useQuery-DAhf1YDH.js";import{a as ne,i as re,n as ie,r as ae,t as oe}from"./select-_tULk-vs.js";import{c as l,n as u,r as d,t as f}from"./toggle-group-D1pC7sJr.js";import{c as p,l as m,u as h}from"./card-EQTpqntn.js";import{n as g,r as se,s as _,t as v}from"./common-h6596gEC.js";import{t as y}from"./shield-alert-CbFgd06X.js";import{t as b}from"./checkbox-DDZZurgK.js";import{a as x,c as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./field-CcyMn3ey.js";import{i as k,n as A,r as ce,t as le}from"./tabs-CiAUEj_y.js";import{G as ue,f as j}from"./index-TbxC5ZgP.js";import{a as de,i as M,n as N,o as P,r as F,t as I}from"./dialog-CgZr27yw.js";import{t as L}from"./input-CMhmmHiH.js";import{a as R,i as z,n as B,o as V,r as H,t as fe}from"./sheet--2lKU0jN.js";import{s as U}from"./labels-C_Pwium9.js";import{t as pe}from"./mutations-D_GluJ0j.js";import{t as W}from"./chips-input-Btdc_f7b.js";var G={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};G.node;var me=e(G),K=r(),he=`// npm install standardwebhooks
|
|
2
|
+
import { Webhook } from "standardwebhooks";
|
|
3
|
+
|
|
4
|
+
const wh = new Webhook(process.env.AGENTINBOX_WEBHOOK_SECRET); // "whsec_…"
|
|
5
|
+
|
|
6
|
+
// Verify the raw request body (before JSON parsing). Throws if invalid.
|
|
7
|
+
const event = wh.verify(rawBody, {
|
|
8
|
+
"webhook-id": req.headers["webhook-id"],
|
|
9
|
+
"webhook-timestamp": req.headers["webhook-timestamp"],
|
|
10
|
+
"webhook-signature": req.headers["webhook-signature"],
|
|
11
|
+
});`,ge=`# pip install standardwebhooks
|
|
12
|
+
import os
|
|
13
|
+
from standardwebhooks.webhooks import Webhook
|
|
14
|
+
|
|
15
|
+
wh = Webhook(os.environ["AGENTINBOX_WEBHOOK_SECRET"]) # "whsec_…"
|
|
16
|
+
|
|
17
|
+
# Verify the raw request body. Raises if invalid.
|
|
18
|
+
event = wh.verify(raw_body, dict(request.headers))`,_e=`import crypto from "node:crypto";
|
|
19
|
+
|
|
20
|
+
// Signed content: "<webhook-id>.<webhook-timestamp>.<raw body>"
|
|
21
|
+
// Key: base64-decoded secret after the "whsec_" prefix. Signature: HMAC-SHA256, base64.
|
|
22
|
+
function verify(secret, headers, rawBody) {
|
|
23
|
+
const id = headers["webhook-id"];
|
|
24
|
+
const ts = headers["webhook-timestamp"];
|
|
25
|
+
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; // reject replays
|
|
26
|
+
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
|
|
27
|
+
const expected = crypto.createHmac("sha256", key).update(\`\${id}.\${ts}.\${rawBody}\`).digest("base64");
|
|
28
|
+
// The header may hold several space-separated "v1,<signature>" entries.
|
|
29
|
+
return headers["webhook-signature"].split(" ").some((entry) => {
|
|
30
|
+
const sig = Buffer.from(entry.split(",")[1] ?? "");
|
|
31
|
+
const want = Buffer.from(expected);
|
|
32
|
+
return sig.length === want.length && crypto.timingSafeEqual(sig, want);
|
|
33
|
+
});
|
|
34
|
+
}`;function q(){return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Requests are signed per `,(0,K.jsx)(`a`,{className:`underline underline-offset-4`,href:`https://www.standardwebhooks.com`,target:`_blank`,rel:`noopener noreferrer`,children:`Standard Webhooks`}),` with the headers `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:`webhook-id`}),`, `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:`webhook-timestamp`}),` and`,` `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:`webhook-signature`}),`. Reply with any 2xx quickly; anything else is retried with backoff.`]}),(0,K.jsxs)(le,{defaultValue:`node`,children:[(0,K.jsxs)(ce,{children:[(0,K.jsx)(k,{value:`node`,children:`Node.js`}),(0,K.jsx)(k,{value:`python`,children:`Python`}),(0,K.jsx)(k,{value:`manual`,children:`No library`})]}),(0,K.jsx)(A,{value:`node`,children:(0,K.jsx)(v,{code:he})}),(0,K.jsx)(A,{value:`python`,children:(0,K.jsx)(v,{code:ge})}),(0,K.jsx)(A,{value:`manual`,children:(0,K.jsx)(v,{code:_e})})]})]})}function ve({secret:e}){return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(_,{children:`Signing secret`}),(0,K.jsx)(g,{value:e,size:`lg`}),(0,K.jsxs)(p,{variant:`warning`,children:[(0,K.jsx)(y,{}),(0,K.jsx)(h,{children:`Copy the secret now. It won't be shown again.`}),(0,K.jsx)(m,{children:`Store it with your receiver (e.g. as AGENTINBOX_WEBHOOK_SECRET). If it's lost, rotate it from the webhook's page.`})]})]}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(_,{children:`Verify requests`}),(0,K.jsx)(q,{})]})]})}function ye({secret:e,title:n,description:r,onClose:i}){return(0,K.jsx)(I,{open:!!e,onOpenChange:e=>!e&&i(),children:(0,K.jsxs)(N,{className:`max-h-[calc(100svh-2rem)] overflow-y-auto sm:max-w-2xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,K.jsxs)(de,{children:[(0,K.jsx)(P,{children:n}),(0,K.jsx)(F,{children:r})]}),e&&(0,K.jsx)(ve,{secret:e}),(0,K.jsx)(M,{children:(0,K.jsx)(t,{onClick:i,children:`I've saved the secret`})})]})})}var J=s(n(),1);function Y(e){if(!e)return null;try{return new RegExp(e,`i`),null}catch(e){return e.message.replace(/^Invalid regular expression: /,``)}}function be(e){let t={};return e.accountIds?.length&&(t.accountIds=e.accountIds),e.labelIds?.length&&(t.labelIds=e.labelIds),e.from?.length&&(t.from=e.from),e.to?.length&&(t.to=e.to),e.subject?.trim()&&(t.subject=e.subject.trim()),e.hasAttachments!==void 0&&(t.hasAttachments=e.hasAttachments),t}var X=(e,t=3)=>e.length<=t?e.join(`, `):`${e.slice(0,t).join(`, `)} and ${e.length-t} more`;function Z(e,t){let n=e.filter,r=e.eventTypes.map(e=>U[e]?.label.toLowerCase()??e),i=[r.length?`Sends ${X(r)} events`:`Sends nothing yet: pick at least one event type`];return i.push(n.accountIds?.length?`from ${X(n.accountIds.map(e=>t.find(t=>t.id===e)?.email??e))}`:`from every account the agent can read`),n.labelIds?.length&&i.push(`only for messages labeled ${X(n.labelIds)}`),n.from?.length&&i.push(`where the sender matches ${X(n.from)}`),n.to?.length&&i.push(`where a recipient matches ${X(n.to)}`),n.subject&&i.push(`where the subject matches /${n.subject}/i`),n.hasAttachments===!0&&i.push(`with attachments only`),n.hasAttachments===!1&&i.push(`without attachments only`),i.push(e.includeBody?`including the cleaned message body`:`with metadata only (no body)`),i}function xe({value:e,onChange:t,invalid:n}){let r=(n,r)=>t(j.filter(t=>t===n?r:e.includes(t)));return(0,K.jsxs)(D,{"data-invalid":n,children:[(0,K.jsx)(T,{variant:`label`,children:`Events`}),(0,K.jsx)(`div`,{className:`grid gap-1.5`,children:j.map(t=>(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2.5 rounded-lg border px-3 py-2 has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50 has-[[data-state=checked]]:bg-muted/40`,children:[(0,K.jsx)(b,{className:`mt-0.5`,checked:e.includes(t),onCheckedChange:e=>r(t,e===!0)}),(0,K.jsxs)(`span`,{className:`min-w-0 space-y-0.5`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2 text-sm font-medium`,children:[U[t].label,(0,K.jsx)(`code`,{className:`font-mono text-xs font-normal text-muted-foreground`,children:t})]}),(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:U[t].description})]})]},t))}),n&&(0,K.jsx)(E,{children:`Pick at least one event type.`})]})}var Q=e=>/\s/.test(e)?`no spaces allowed`:e.length>254?`too long`:null;function Se({value:e,onChange:t,accounts:n}){let r=n=>t({...e,...n}),i=e.accountIds??[],a=Y(e.subject),o=(e,t)=>r({accountIds:t?[...new Set([...i,e])]:i.filter(t=>t!==e)});return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsxs)(D,{children:[(0,K.jsx)(T,{variant:`label`,children:`Accounts`}),(0,K.jsx)(w,{children:`Leave all unchecked for every account the agent can read. Accounts it has no read grant for are never sent.`}),(0,K.jsx)(`div`,{className:`grid gap-1.5 sm:grid-cols-2`,children:n.map(e=>(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-lg border px-3 py-2 text-sm has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/50`,children:[(0,K.jsx)(b,{checked:i.includes(e.id),onCheckedChange:t=>o(e.id,t===!0)}),(0,K.jsx)(`span`,{className:`truncate`,children:e.email})]},e.id))})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(x,{htmlFor:`wf-labels`,children:`Labels`}),(0,K.jsx)(d,{id:`wf-labels`,accountIds:i.length?i:n.map(e=>e.id),value:e.labelIds??[],onChange:e=>r({labelIds:e}),placeholder:`Any label`}),(0,K.jsx)(w,{children:`Fire only for messages carrying any of these labels.`})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,K.jsxs)(O,{children:[(0,K.jsx)(x,{htmlFor:`wf-from`,children:`From`}),(0,K.jsx)(W,{id:`wf-from`,value:e.from??[],onChange:e=>r({from:e}),placeholder:`Any sender`,validate:Q}),(0,K.jsxs)(w,{children:[`Globs like `,(0,K.jsx)(`code`,{className:`font-mono`,children:`*@stripe.com`})]})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(x,{htmlFor:`wf-to`,children:`To or Cc`}),(0,K.jsx)(W,{id:`wf-to`,value:e.to??[],onChange:e=>r({to:e}),placeholder:`Any recipient`,validate:Q}),(0,K.jsxs)(w,{children:[`e.g. `,(0,K.jsx)(`code`,{className:`font-mono`,children:`support@yourco.com`})]})]})]}),(0,K.jsxs)(O,{"data-invalid":!!a,children:[(0,K.jsx)(x,{htmlFor:`wf-subject`,children:`Subject matches`}),(0,K.jsx)(L,{id:`wf-subject`,className:`font-mono`,placeholder:`e.g. invoice|receipt`,spellCheck:!1,value:e.subject??``,onChange:e=>r({subject:e.target.value}),"aria-invalid":!!a}),a?(0,K.jsxs)(E,{children:[`Not a valid regular expression: `,a]}):(0,K.jsx)(w,{children:`A regular expression, case-insensitive. Leave empty for any subject.`})]}),(0,K.jsxs)(O,{children:[(0,K.jsx)(x,{children:`Attachments`}),(0,K.jsxs)(f,{type:`single`,variant:`outline`,size:`sm`,value:e.hasAttachments===void 0?`any`:e.hasAttachments?`with`:`without`,onValueChange:e=>e&&r({hasAttachments:e===`any`?void 0:e===`with`}),"aria-label":`Attachments`,children:[(0,K.jsx)(u,{value:`any`,children:`Any`}),(0,K.jsx)(u,{value:`with`,children:`With attachments`}),(0,K.jsx)(u,{value:`without`,children:`Without`})]})]})]})}function Ce({value:e,onChange:t}){return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsxs)(O,{orientation:`horizontal`,children:[(0,K.jsx)(l,{id:`wf-body`,checked:e,onCheckedChange:t}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(x,{htmlFor:`wf-body`,children:`Include message body`}),(0,K.jsx)(w,{children:`Adds the message as clean Markdown, plus attachment info and safety signals, so the agent can act without a fetch.`})]})]}),e&&(0,K.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-warning/40 bg-warning/10 px-3 py-2 text-xs`,children:[(0,K.jsx)(y,{className:`mt-px size-3.5 shrink-0 text-warning`}),(0,K.jsxs)(`span`,{children:[`Bodies are cleaned (hidden text and invisible characters removed) but are still `,(0,K.jsx)(`strong`,{children:`untrusted input`}),`: anyone can email you. Your receiver should treat the content as data, never as instructions.`]})]})]})}var $=/^(localhost|127\.|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.|\[?::1\]?$|.*\.(local|internal|lan|home)$)/i;function we(e){if(!e.trim())return{error:`Enter the URL agentinbox should POST events to.`};let t;try{t=new URL(e.trim())}catch{return{error:`Enter a full URL, including https://`}}return t.protocol!==`https:`&&t.protocol!==`http:`?{error:`Only http and https URLs are supported.`}:$.test(t.hostname)?{note:`private`}:t.protocol===`http:`?{note:`http`}:{}}function Te({open:e,onOpenChange:t,webhook:n,defaultAgentId:r,onCreated:i}){return(0,K.jsx)(fe,{open:e,onOpenChange:t,children:(0,K.jsx)(B,{className:`w-full gap-0 sm:max-w-xl`,children:e&&(0,K.jsx)(Ee,{webhook:n,defaultAgentId:r,onDone:()=>t(!1),onCreated:i})})})}function Ee({webhook:e,defaultAgentId:n,onDone:r,onCreated:s}){let l=c(i.agents()),u=c(i.accounts()),[d,f]=(0,J.useState)(()=>e?{agentId:e.agentId,name:e.name,url:e.url,eventTypes:e.eventTypes,filter:e.filter,includeBody:e.includeBody,enabled:e.enabled}:{agentId:n??``,name:``,url:``,eventTypes:[`message.received`],filter:{},includeBody:!1,enabled:!0}),[p,m]=(0,J.useState)(!1),h=e=>f(t=>({...t,...e})),g=d.agentId||(l.data?.length===1?l.data[0].id:``),v=pe({mutationFn:t=>e?a(`/api/webhooks/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:t}):a(`/api/webhooks`,{body:t}),invalidate:[te.webhooks],success:e?`Webhook saved`:void 0,errorTitle:!1,onSuccess:e=>{r(),`secret`in e&&s?.(e)}}),y=we(d.url),b={agent:g?null:`Choose the agent this webhook delivers to.`,name:d.name.trim()?null:`Give it a name, e.g. “Support inbox → n8n”.`,url:y.error??null,events:d.eventTypes.length===0,subject:Y(d.filter.subject)},T=!b.agent&&!b.name&&!b.url&&!b.events&&!b.subject;return(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m(!0),T&&v.mutate({...d,agentId:g,name:d.name.trim(),url:d.url.trim(),filter:be(d.filter)})},noValidate:!0,className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(R,{className:`border-b`,children:[(0,K.jsx)(V,{children:e?`Edit ${e.name}`:`New webhook`}),(0,K.jsx)(H,{children:`agentinbox POSTs a signed JSON payload to your URL for each matching event, retrying failures.`})]}),(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:(0,K.jsxs)(C,{children:[(0,K.jsxs)(O,{"data-invalid":p&&!!b.agent,children:[(0,K.jsx)(x,{htmlFor:`wh-agent`,children:`Agent`}),(0,K.jsxs)(oe,{value:g,onValueChange:e=>h({agentId:e}),children:[(0,K.jsx)(re,{id:`wh-agent`,className:`w-full`,"aria-invalid":p&&!!b.agent,children:(0,K.jsx)(ne,{placeholder:l.data?.length===0?`Create an agent first`:`Choose an agent`})}),(0,K.jsx)(ie,{children:l.data?.map(e=>(0,K.jsx)(ae,{value:e.id,children:e.name},e.id))})]}),p&&b.agent?(0,K.jsx)(E,{children:b.agent}):(0,K.jsx)(w,{children:`Events are limited to what this agent's grants let it read.`})]}),(0,K.jsxs)(O,{"data-invalid":p&&!!b.name,children:[(0,K.jsx)(x,{htmlFor:`wh-name`,children:`Name`}),(0,K.jsx)(L,{id:`wh-name`,value:d.name,onChange:e=>h({name:e.target.value}),placeholder:`Support inbox → n8n`,"aria-invalid":p&&!!b.name}),p&&b.name&&(0,K.jsx)(E,{children:b.name})]}),(0,K.jsxs)(O,{"data-invalid":p&&!!b.url,children:[(0,K.jsx)(x,{htmlFor:`wh-url`,children:`Endpoint URL`}),(0,K.jsx)(L,{id:`wh-url`,type:`url`,inputMode:`url`,spellCheck:!1,className:`font-mono`,placeholder:`https://example.com/hooks/agentinbox`,value:d.url,onChange:e=>h({url:e.target.value}),"aria-invalid":p&&!!b.url}),p&&b.url?(0,K.jsx)(E,{children:b.url}):y.note===`private`?(0,K.jsxs)(w,{className:`flex items-start gap-1.5`,children:[(0,K.jsx)(ue,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsxs)(`span`,{children:[`Private and loopback addresses are blocked unless they're on the`,` `,(0,K.jsx)(o,{to:`/settings`,hash:`webhook-allowlist`,className:`underline underline-offset-4`,children:`webhook allowlist`}),` `,`(protects your network from forged targets).`]})]}):y.note===`http`?(0,K.jsx)(w,{children:`Plain http sends mail metadata unencrypted. Prefer https for anything off this machine.`}):null]}),(0,K.jsx)(S,{}),(0,K.jsx)(xe,{value:d.eventTypes,onChange:e=>h({eventTypes:e}),invalid:p&&b.events}),(0,K.jsx)(S,{}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(_,{children:`Only when the message matches`}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All conditions you set must match. Leave everything empty to get every event.`})]}),(0,K.jsx)(Se,{value:d.filter,onChange:e=>h({filter:e}),accounts:u.data??[]}),(0,K.jsx)(S,{}),(0,K.jsx)(Ce,{value:d.includeBody,onChange:e=>h({includeBody:e})}),(0,K.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,K.jsx)(me,{className:`size-3.5`}),` In plain words`]}),(0,K.jsxs)(`p`,{children:[Z(d,u.data??[]).join(`, `),`.`]})]}),v.isError&&(0,K.jsx)(se,{error:v.error,title:`Couldn't save the webhook`})]})}),(0,K.jsxs)(z,{className:`flex-row justify-end border-t`,children:[(0,K.jsx)(t,{type:`button`,variant:`ghost`,onClick:r,children:`Cancel`}),(0,K.jsxs)(t,{type:`submit`,disabled:v.isPending||p&&!T,children:[v.isPending&&(0,K.jsx)(ee,{}),e?`Save changes`:`Create webhook`]})]})]})}export{q as i,Z as n,ye as r,Te as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,ht as t,mt as n,n as r,q as i,vt as a}from"./queries-a3M5_loa.js";import{t as o}from"./useQuery-DAhf1YDH.js";import{r as s}from"./dist-B0e3Ju3r.js";import{t as c}from"./bot-DVw15lBn.js";import{t as l}from"./chevron-right-CbBKS6-T.js";import{a as u,o as d}from"./toggle-group-D1pC7sJr.js";import{t as f}from"./card-EQTpqntn.js";import{A as p,a as m,k as h,o as g}from"./common-h6596gEC.js";import{t as _}from"./plus-CETmK0SB.js";import{r as v,t as y}from"./webhook-sheet-4U_6Rw8I.js";import{t as b}from"./webhook-BWT75M78.js";import{n as x}from"./index-TbxC5ZgP.js";import{a as S,i as C,n as w,o as T,r as E,t as D}from"./empty-CE_WZGEC.js";import{s as O}from"./labels-C_Pwium9.js";var k=a(t()),A=n();function j({webhook:e,agentName:t}){return(0,A.jsxs)(i,{to:`/webhooks/$webhookId`,params:{webhookId:e.id},className:`flex items-center gap-3 p-4 outline-none hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,A.jsx)(u,{enabled:e.enabled}),t&&(0,A.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,A.jsx)(c,{className:`size-3.5`}),` `,t]})]}),(0,A.jsx)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.url}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.eventTypes.map(e=>(0,A.jsx)(p,{variant:`outline`,className:`font-normal`,children:O[e]?.label??e},e))}),(0,A.jsx)(d,{webhook:e})]}),(0,A.jsx)(l,{className:`size-4 shrink-0 text-muted-foreground`})]})}function M(){let{new:t}=x.useSearch(),n=s({from:x.fullPath}),i=o(r.webhooks()),a=o(r.agents()),[c,l]=(0,k.useState)(),u=e=>void n({search:{new:e},replace:!0}),d=a.data?.length===0;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(m,{title:`Webhooks`,description:`Push mail events to your agents the moment they happen. Payloads are signed, retried on failure and logged for replay.`,actions:(0,A.jsxs)(e,{onClick:()=>u(`1`),disabled:d,children:[(0,A.jsx)(_,{}),` New webhook`]})}),i.isPending?(0,A.jsx)(h,{className:`h-40 rounded-xl`}):i.isError?(0,A.jsx)(g,{error:i.error,onRetry:()=>void i.refetch()}):i.data.length===0?(0,A.jsx)(f,{children:(0,A.jsxs)(D,{children:[(0,A.jsxs)(C,{children:[(0,A.jsx)(S,{variant:`icon`,children:(0,A.jsx)(b,{})}),(0,A.jsx)(T,{children:`No webhooks yet`}),(0,A.jsx)(E,{children:d?`Webhooks deliver events to an agent. Create an agent first.`:`Add one to have agentinbox call your agent (n8n, a serverless function, your own service) when matching mail arrives.`})]}),(0,A.jsx)(w,{children:d?(0,A.jsx)(e,{onClick:()=>void n({to:`/agents`}),children:`Go to agents`}):(0,A.jsxs)(e,{onClick:()=>u(`1`),children:[(0,A.jsx)(_,{}),` Create a webhook`]})})]})}):(0,A.jsx)(f,{className:`gap-0 divide-y py-0`,children:i.data.map(e=>(0,A.jsx)(j,{webhook:e,agentName:a.data?.find(t=>t.id===e.agentId)?.name},e.id))}),(0,A.jsx)(y,{open:!!t,onOpenChange:e=>!e&&u(void 0),defaultAgentId:t&&t!==`1`?t:void 0,onCreated:l}),(0,A.jsx)(v,{secret:c?.secret,title:`${c?.webhook.name??`Webhook`} created`,description:`Use this secret to verify that requests really come from agentinbox.`,onClose:()=>{let e=c?.webhook.id;l(void 0),e&&n({to:`/webhooks/$webhookId`,params:{webhookId:e}})}})]})}export{M as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{gt as e,ht as t}from"./queries-a3M5_loa.js";var n=e((e=>{var n=t();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t(),i=r();function a(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var o=typeof Object.is==`function`?Object.is:a,s=i.useSyncExternalStore,c=n.useRef,l=n.useEffect,u=n.useMemo,d=n.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=c(null);if(a.current===null){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=u(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,o(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=s(e,a[0],a[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),d(p),p}})),a=e(((e,t)=>{t.exports=i()}));export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e}from"./queries-a3M5_loa.js";var t={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><rect width="32" height="32" rx="8" fill="#171717"/><rect x="7.5" y="10" width="17" height="12.5" rx="2" stroke="#fafafa" stroke-width="2"/><path d="M8.5 11.5 16 17l7.5-5.5" stroke="#fafafa" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="24.5" cy="9" r="3.5" fill="#3987e5" stroke="#171717" stroke-width="1.5"/></svg>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<meta name="color-scheme" content="light dark" />
|
|
8
|
+
<title>agentinbox</title>
|
|
9
|
+
<script>
|
|
10
|
+
// Apply the saved theme before first paint to avoid a light flash in dark mode.
|
|
11
|
+
try {
|
|
12
|
+
var t = localStorage.getItem("agentinbox.theme") || "system";
|
|
13
|
+
if (t === "dark" || (t === "system" && matchMedia("(prefers-color-scheme: dark)").matches))
|
|
14
|
+
document.documentElement.classList.add("dark");
|
|
15
|
+
} catch (e) {}
|
|
16
|
+
</script>
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-TbxC5ZgP.js"></script>
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-a3M5_loa.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/useQuery-DAhf1YDH.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/with-selector-CkNyXYMW.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/useSelector-D70eKNYs.js">
|
|
22
|
+
<link rel="modulepreload" crossorigin href="/assets/useMatch-BKUnm54_.js">
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-B0e3Ju3r.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/assets/preload-helper-BFuRUfdt.js">
|
|
25
|
+
<link rel="modulepreload" crossorigin href="/assets/es2015-DPaldoxG.js">
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DgIgw66p.css">
|
|
27
|
+
</head>
|
|
28
|
+
<body>
|
|
29
|
+
<div id="root"></div>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1 +1,94 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "agentinbox-cli",
|
|
3
|
+
"version": "0.1.0-nightly.1",
|
|
4
|
+
"description": "Self-hosted Gmail broker for AI agents: one place for credentials, MCP tools, real-time webhooks, guardrails, and a web console.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/unlaboredlabs/agentinbox.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/unlaboredlabs/agentinbox#readme",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"gmail",
|
|
15
|
+
"agents",
|
|
16
|
+
"webhooks",
|
|
17
|
+
"email",
|
|
18
|
+
"self-hosted",
|
|
19
|
+
"ai"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"agentinbox": "dist/cli.js"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.13"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "concurrently -k -n server,web -c blue,magenta \"pnpm dev:server\" \"pnpm dev:web\"",
|
|
34
|
+
"dev:server": "tsx watch server/cli.ts start --dev",
|
|
35
|
+
"dev:web": "vite",
|
|
36
|
+
"build": "vite build && tsdown --config-loader native",
|
|
37
|
+
"start": "node dist/cli.js",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p tsconfig.app.json --noEmit",
|
|
39
|
+
"lint": "oxlint",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"prepublishOnly": "node -e \"const m=['dist/cli.js','dist/web/index.html'].filter(f=>!require('fs').existsSync(f));if(m.length){console.error('Missing '+m.join(', ')+': run pnpm build before publishing.');process.exit(1)}\""
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@hono/node-server": "^2.1.5",
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
47
|
+
"commander": "^15.0.0",
|
|
48
|
+
"hono": "^4.13.13",
|
|
49
|
+
"linkedom": "^0.18.13",
|
|
50
|
+
"nodemailer": "^10.1.1",
|
|
51
|
+
"open": "^11.0.4",
|
|
52
|
+
"picocolors": "^1.1.1",
|
|
53
|
+
"turndown": "^7.2.4",
|
|
54
|
+
"turndown-plugin-gfm": "^1.0.2",
|
|
55
|
+
"zod": "^4.6.7"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
59
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
60
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
61
|
+
"@tanstack/react-form": "^1.33.5",
|
|
62
|
+
"@tanstack/react-query": "^5.104.2",
|
|
63
|
+
"@tanstack/react-router": "^1.170.44",
|
|
64
|
+
"@tanstack/react-table": "^9.3.1",
|
|
65
|
+
"@tanstack/router-plugin": "^1.168.45",
|
|
66
|
+
"@types/node": "^26.6.5",
|
|
67
|
+
"@types/nodemailer": "^8.0.2",
|
|
68
|
+
"@types/react": "^19.3.0",
|
|
69
|
+
"@types/react-dom": "^19.3.0",
|
|
70
|
+
"@types/turndown": "^5.0.6",
|
|
71
|
+
"@vitejs/plugin-react": "^6.1.2",
|
|
72
|
+
"class-variance-authority": "^0.7.1",
|
|
73
|
+
"clsx": "^2.1.1",
|
|
74
|
+
"cmdk": "^1.1.1",
|
|
75
|
+
"concurrently": "^10.0.6",
|
|
76
|
+
"date-fns": "^4.4.0",
|
|
77
|
+
"lucide-react": "^1.57.0",
|
|
78
|
+
"oxlint": "^1.88.0",
|
|
79
|
+
"radix-ui": "^1.8.1",
|
|
80
|
+
"react": "^19.3.0",
|
|
81
|
+
"react-dom": "^19.3.0",
|
|
82
|
+
"recharts": "^3.10.1",
|
|
83
|
+
"sonner": "^2.0.8",
|
|
84
|
+
"tailwind-merge": "^3.7.0",
|
|
85
|
+
"tailwindcss": "^4.3.3",
|
|
86
|
+
"tsdown": "^0.23.1",
|
|
87
|
+
"tsx": "^4.23.15",
|
|
88
|
+
"tw-animate-css": "^1.4.0",
|
|
89
|
+
"typescript": "^7.0.2",
|
|
90
|
+
"vite": "^8.3.4",
|
|
91
|
+
"vitest": "^5.0.4"
|
|
92
|
+
},
|
|
93
|
+
"packageManager": "pnpm@12.11.2"
|
|
94
|
+
}
|