WS2: Developer Portal (portal/) - Standalone Next.js 14 + Tailwind CSS app — independent deployment - Home page: hero, feature grid, CTA to /get-started - /pricing: free tier limits table (10 agents, 1k calls/day) + paid tier CTA - /sdks: all 4 SDKs (Node.js, Python, Go, Java) with install + code examples - /api-explorer: Swagger UI from NEXT_PUBLIC_API_URL/openapi.json, persistAuthorization - /get-started: 4-step wizard (setup → register agent → credentials → SDK snippet) - Shared Nav component with active-link highlighting - Build: 8/8 static pages, zero TypeScript errors WS3: CLI Tool (cli/ — npm package: sentryagent) - configure, register-agent, list-agents, issue-token, rotate-credentials, tail-audit-log - Auto OAuth2 token fetch + 30s-buffer cache via client_credentials flow - chalk-formatted table output, confirmation prompts, bounded audit log dedup - bash + zsh shell completion scripts - README with installation, all commands, and completion setup - Build: tsc clean, node dist/index.js --help verified Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
38 lines
17 KiB
JavaScript
38 lines
17 KiB
JavaScript
(()=>{var e={};e.id=719,e.ids=[719],e.modules={7849:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external")},2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},5403:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},4749:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},178:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>l.a,__next_app__:()=>m,originalPathname:()=>x,pages:()=>c,routeModule:()=>g,tree:()=>o}),s(1665),s(7341),s(5866);var n=s(3191),r=s(8716),a=s(7922),l=s.n(a),i=s(5231),d={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>i[e]);s.d(t,d);let o=["",{children:["get-started",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,1665)),"/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/app/get-started/page.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,7341)),"/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,5866,23)),"next/dist/client/components/not-found-error"]}],c=["/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/app/get-started/page.tsx"],x="/get-started/page",m={require:s,loadChunk:()=>Promise.resolve()},g=new n.AppPageRouteModule({definition:{kind:r.x.APP_PAGE,page:"/get-started/page",pathname:"/get-started",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:o}})},5642:(e,t,s)=>{Promise.resolve().then(s.bind(s,4174))},2692:(e,t,s)=>{Promise.resolve().then(s.bind(s,6435))},6643:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,2994,23)),Promise.resolve().then(s.t.bind(s,6114,23)),Promise.resolve().then(s.t.bind(s,9727,23)),Promise.resolve().then(s.t.bind(s,9671,23)),Promise.resolve().then(s.t.bind(s,1868,23)),Promise.resolve().then(s.t.bind(s,4759,23))},6435:(e,t,s)=>{"use strict";s.d(t,{GetStartedWizard:()=>p});var n=s(326),r=s(7577),a=s.n(r);function l({current:e,total:t}){return n.jsx("div",{className:"mb-8 flex items-center gap-2",children:Array.from({length:t},(e,t)=>t+1).map(s=>(0,n.jsxs)(a().Fragment,{children:[n.jsx("div",{className:["flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold",s<e?"bg-brand-600 text-white":s===e?"border-2 border-brand-600 bg-brand-50 text-brand-700":"bg-slate-200 text-slate-500"].join(" "),children:s<e?"✓":s}),s<t&&n.jsx("div",{className:["h-0.5 flex-1",s<e?"bg-brand-600":"bg-slate-200"].join(" ")})]},s))})}function i({text:e}){let[t,s]=(0,r.useState)(!1),a=async()=>{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3)};return n.jsx("button",{onClick:()=>void a(),className:"ml-2 rounded bg-slate-100 px-2 py-1 text-xs font-medium text-slate-600 transition-colors hover:bg-slate-200",children:t?"Copied!":"Copy"})}function d({message:e}){return n.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:e})}function o({onNext:e}){return(0,n.jsxs)("div",{children:[n.jsx("h2",{className:"mb-2 text-2xl font-bold text-slate-900",children:"Step 1: Account Setup"}),n.jsx("p",{className:"mb-6 text-slate-600",children:"Before registering your first agent, make sure you have the AgentIdP server running."}),n.jsx("ol",{className:"mb-8 space-y-4",children:[{n:1,title:"Clone the repository",code:"git clone https://github.com/sentryagent/sentryagent-idp.git"},{n:2,title:"Copy environment variables",code:"cp .env.example .env"},{n:3,title:"Start the server",code:"docker compose up -d && npm run db:migrate"},{n:4,title:"Verify the server is healthy",code:"curl http://localhost:3000/health"}].map(({n:e,title:t,code:s})=>(0,n.jsxs)("li",{className:"flex gap-4",children:[n.jsx("span",{className:"mt-0.5 flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-full bg-brand-600 text-xs font-bold text-white",children:e}),(0,n.jsxs)("div",{className:"flex-1",children:[n.jsx("p",{className:"mb-1 font-medium text-slate-800",children:t}),(0,n.jsxs)("div",{className:"flex items-center rounded-lg bg-slate-900 px-3 py-2",children:[n.jsx("code",{className:"flex-1 text-sm text-slate-100",children:s}),n.jsx(i,{text:s})]})]})]},e))}),n.jsx("button",{onClick:e,className:"rounded-lg bg-brand-600 px-6 py-2.5 font-semibold text-white transition-colors hover:bg-brand-700",children:"My server is running →"})]})}function c({agentName:e,onAgentNameChange:t,agentId:s,loading:r,error:a,onRegister:l,onNext:o}){return(0,n.jsxs)("div",{children:[n.jsx("h2",{className:"mb-2 text-2xl font-bold text-slate-900",children:"Step 2: Register Your Agent"}),n.jsx("p",{className:"mb-6 text-slate-600",children:"Give your agent a name and register it with AgentIdP. You will receive a unique Agent ID."}),a&&n.jsx(d,{message:a}),s?(0,n.jsxs)("div",{className:"mb-6 rounded-xl border border-green-200 bg-green-50 p-6",children:[n.jsx("p",{className:"mb-1 text-sm font-semibold text-green-700",children:"Agent registered successfully!"}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)("p",{className:"text-sm text-slate-700",children:["Agent ID:"," ",n.jsx("code",{className:"rounded bg-slate-100 px-1.5 py-0.5 font-mono text-sm",children:s})]}),n.jsx(i,{text:s})]})]}):(0,n.jsxs)("div",{className:"mb-6",children:[n.jsx("label",{htmlFor:"agent-name",className:"mb-1.5 block text-sm font-medium text-slate-700",children:"Agent Name"}),(0,n.jsxs)("div",{className:"flex gap-3",children:[n.jsx("input",{id:"agent-name",type:"text",value:e,onChange:e=>t(e.target.value),placeholder:"e.g. my-summarisation-agent",className:"flex-1 rounded-lg border border-slate-300 px-4 py-2.5 text-sm focus:border-brand-500 focus:outline-none focus:ring-2 focus:ring-brand-200"}),n.jsx("button",{onClick:l,disabled:r||""===e.trim(),className:"rounded-lg bg-brand-600 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-50",children:r?"Registering…":"Register Agent"})]})]}),s&&n.jsx("button",{onClick:o,className:"rounded-lg bg-brand-600 px-6 py-2.5 font-semibold text-white transition-colors hover:bg-brand-700",children:"Generate Credentials →"})]})}function x({agentId:e,clientId:t,clientSecret:s,loading:r,error:a,onGenerate:l,onNext:o}){return(0,n.jsxs)("div",{children:[n.jsx("h2",{className:"mb-2 text-2xl font-bold text-slate-900",children:"Step 3: Generate Credentials"}),(0,n.jsxs)("p",{className:"mb-6 text-slate-600",children:["Generate OAuth 2.0 client credentials for agent"," ",n.jsx("code",{className:"rounded bg-slate-100 px-1.5 py-0.5 text-sm",children:e}),". Store your client secret securely — it will not be shown again."]}),a&&n.jsx(d,{message:a}),t&&s?n.jsx("div",{className:"mb-6 space-y-4",children:(0,n.jsxs)("div",{className:"rounded-xl border border-brand-200 bg-brand-50 p-5",children:[n.jsx("p",{className:"mb-3 text-sm font-semibold text-brand-700",children:"Credentials generated. Store these securely!"}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[n.jsx("p",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-slate-500",children:"Client ID"}),(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-lg bg-white px-3 py-2 shadow-sm",children:[n.jsx("code",{className:"flex-1 break-all font-mono text-sm text-slate-800",children:t}),n.jsx(i,{text:t})]})]}),(0,n.jsxs)("div",{children:[n.jsx("p",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-slate-500",children:"Client Secret"}),(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-lg bg-white px-3 py-2 shadow-sm",children:[n.jsx("code",{className:"flex-1 break-all font-mono text-sm text-slate-800",children:s}),n.jsx(i,{text:s})]})]})]})]})}):n.jsx("button",{onClick:l,disabled:r,className:"mb-6 rounded-lg bg-brand-600 px-6 py-2.5 font-semibold text-white transition-colors hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-50",children:r?"Generating…":"Generate Credentials"}),t&&s&&n.jsx("button",{onClick:o,className:"rounded-lg bg-brand-600 px-6 py-2.5 font-semibold text-white transition-colors hover:bg-brand-700",children:"Choose Your SDK →"})]})}let m=[{id:"nodejs",label:"Node.js / TypeScript",description:"npm install @sentryagent/idp-sdk"},{id:"python",label:"Python",description:"pip install sentryagent-idp"},{id:"go",label:"Go",description:"go get github.com/sentryagent/idp-sdk-go"},{id:"java",label:"Java",description:"Maven / Gradle — ai.sentryagent:idp-sdk:1.0.0"}];function g({selectedSdk:e,onSdkChange:t,clientId:s,clientSecret:r,apiUrl:a}){let l=function(e,t,s,n){switch(e){case"nodejs":return`import { AgentIdPClient } from '@sentryagent/idp-sdk';
|
|
|
|
const client = new AgentIdPClient({
|
|
apiUrl: '${t}',
|
|
clientId: '${s}',
|
|
clientSecret: '${n}',
|
|
});
|
|
|
|
const { accessToken } = await client.tokens.issue();
|
|
console.log('Access token:', accessToken);`;case"python":return`from sentryagent_idp import AgentIdPClient
|
|
|
|
client = AgentIdPClient(
|
|
api_url="${t}",
|
|
client_id="${s}",
|
|
client_secret="${n}",
|
|
)
|
|
|
|
token_response = client.tokens.issue()
|
|
print("Access token:", token_response.access_token)`;case"go":return`import idp "github.com/sentryagent/idp-sdk-go"
|
|
|
|
client := idp.NewClient(idp.Config{
|
|
APIURL: "${t}",
|
|
ClientID: "${s}",
|
|
ClientSecret: "${n}",
|
|
})
|
|
|
|
token, err := client.Tokens.Issue(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println("Access token:", token.AccessToken)`;case"java":return`AgentIdPClient client = AgentIdPClient.builder()
|
|
.apiUrl("${t}")
|
|
.clientId("${s}")
|
|
.clientSecret("${n}")
|
|
.build();
|
|
|
|
TokenResponse token = client.tokens().issue();
|
|
System.out.println("Access token: " + token.getAccessToken());`;default:return""}}(e,a,s,r);return(0,n.jsxs)("div",{children:[n.jsx("h2",{className:"mb-2 text-2xl font-bold text-slate-900",children:"Step 4: Choose Your SDK"}),n.jsx("p",{className:"mb-6 text-slate-600",children:"Select your language and copy the ready-to-run code snippet below. Your credentials are pre-filled."}),n.jsx("div",{className:"mb-6 grid grid-cols-2 gap-3 sm:grid-cols-4",children:m.map(({id:s,label:r,description:a})=>(0,n.jsxs)("button",{onClick:()=>t(s),className:["rounded-xl border p-4 text-left transition-all",e===s?"border-brand-500 bg-brand-50 shadow-md":"border-slate-200 bg-white hover:border-brand-300 hover:bg-brand-50"].join(" "),children:[n.jsx("p",{className:["mb-1 text-sm font-semibold",e===s?"text-brand-700":"text-slate-800"].join(" "),children:r}),n.jsx("p",{className:"text-xs text-slate-500",children:a})]},s))}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[n.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-slate-500",children:"Ready-to-run code"}),n.jsx(i,{text:l})]}),n.jsx("pre",{className:"overflow-x-auto rounded-xl bg-slate-900 px-5 py-5 text-sm leading-relaxed text-slate-100",children:n.jsx("code",{children:l})})]}),(0,n.jsxs)("div",{className:"mt-8 rounded-xl border border-green-200 bg-green-50 p-5 text-center",children:[n.jsx("p",{className:"text-lg font-bold text-green-800",children:"You are all set!"}),n.jsx("p",{className:"mt-1 text-sm text-green-700",children:"Your agent is registered and you have credentials. Start making authenticated API calls using the snippet above."})]})]})}function p({apiUrl:e}){let[t,s]=(0,r.useState)({step:1,agentName:"",agentId:null,clientId:null,clientSecret:null,selectedSdk:"nodejs",loading:!1,error:null}),a=e=>{s(t=>({...t,step:e,error:null}))},i=async()=>{s(e=>({...e,loading:!0,error:null}));try{let n=await fetch(`${e}/agents`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.agentName.trim()})});if(!n.ok){let e=await n.json();throw Error(e.message??`HTTP ${n.status}`)}let r=await n.json();s(e=>({...e,agentId:r.agentId,loading:!1,error:null}))}catch(e){s(t=>({...t,loading:!1,error:e instanceof Error?e.message:"Failed to register agent"}))}},d=async()=>{if(t.agentId){s(e=>({...e,loading:!0,error:null}));try{let n=await fetch(`${e}/agents/${t.agentId}/credentials`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!n.ok){let e=await n.json();throw Error(e.message??`HTTP ${n.status}`)}let r=await n.json();s(e=>({...e,clientId:r.clientId,clientSecret:r.clientSecret,loading:!1,error:null}))}catch(e){s(t=>({...t,loading:!1,error:e instanceof Error?e.message:"Failed to generate credentials"}))}}};return(0,n.jsxs)("div",{className:"mx-auto max-w-3xl",children:[n.jsx("div",{className:"mb-2 flex gap-2 text-xs font-medium text-slate-500",children:["Account Setup","Register Agent","Generate Credentials","Choose SDK"].map((e,s)=>n.jsx("span",{className:["flex-1 text-center",s+1===t.step?"font-bold text-brand-700":""].join(" "),children:e},e))}),n.jsx(l,{current:t.step,total:4}),(0,n.jsxs)("div",{className:"rounded-2xl border border-slate-200 bg-white p-8 shadow-sm",children:[1===t.step&&n.jsx(o,{onNext:()=>a(2)}),2===t.step&&n.jsx(c,{agentName:t.agentName,onAgentNameChange:e=>{s(t=>({...t,agentName:e}))},agentId:t.agentId,loading:t.loading,error:t.error,onRegister:()=>void i(),onNext:()=>a(3)}),3===t.step&&t.agentId&&n.jsx(x,{agentId:t.agentId,clientId:t.clientId,clientSecret:t.clientSecret,loading:t.loading,error:t.error,onGenerate:()=>void d(),onNext:()=>a(4)}),4===t.step&&t.clientId&&t.clientSecret&&n.jsx(g,{selectedSdk:t.selectedSdk,onSdkChange:e=>{s(t=>({...t,selectedSdk:e}))},clientId:t.clientId,clientSecret:t.clientSecret,apiUrl:e})]})]})}},4174:(e,t,s)=>{"use strict";s.d(t,{Nav:()=>i});var n=s(326);s(7577);var r=s(434),a=s(5047);let l=[{href:"/",label:"Home"},{href:"/api-explorer",label:"API Explorer"},{href:"/get-started",label:"Get Started"},{href:"/sdks",label:"SDKs"},{href:"/pricing",label:"Pricing"}];function i(){let e=(0,a.usePathname)();return n.jsx("header",{className:"sticky top-0 z-50 border-b border-slate-200 bg-white/90 backdrop-blur",children:(0,n.jsxs)("nav",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-4",children:[(0,n.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xl font-bold text-brand-600",children:"SentryAgent"}),n.jsx("span",{className:"rounded bg-brand-100 px-1.5 py-0.5 text-xs font-semibold text-brand-700",children:"AgentIdP"})]}),n.jsx("ul",{className:"flex items-center gap-1",children:l.map(({href:t,label:s})=>{let a="/"===t?"/"===e:e.startsWith(t);return n.jsx("li",{children:n.jsx(r.default,{href:t,className:["rounded-md px-3 py-2 text-sm font-medium transition-colors",a?"bg-brand-100 text-brand-700":"text-slate-600 hover:bg-slate-100 hover:text-slate-900"].join(" "),children:s})},t)})}),n.jsx(r.default,{href:"/get-started",className:"rounded-lg bg-brand-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-brand-700",children:"Get Started Free"})]})})}},1665:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c,metadata:()=>o});var n=s(9510),r=s(8570);let a=(0,r.createProxy)(String.raw`/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/components/GetStartedWizard.tsx`),{__esModule:l,$$typeof:i}=a;a.default;let d=(0,r.createProxy)(String.raw`/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/components/GetStartedWizard.tsx#GetStartedWizard`),o={title:"Get Started — SentryAgent AgentIdP",description:"Set up your first AI agent with SentryAgent AgentIdP in four steps."};function c(){let e=process.env.NEXT_PUBLIC_API_URL??"http://localhost:3000";return(0,n.jsxs)("div",{className:"px-6 py-16",children:[(0,n.jsxs)("div",{className:"mb-12 text-center",children:[n.jsx("h1",{className:"mb-4 text-4xl font-extrabold text-slate-900",children:"Get Started"}),n.jsx("p",{className:"text-xl text-slate-600",children:"Register your first agent and get production-ready credentials in minutes."})]}),n.jsx(d,{apiUrl:e})]})}},7341:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>c,metadata:()=>o});var n=s(9510);s(7272);var r=s(8570);let a=(0,r.createProxy)(String.raw`/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/components/Nav.tsx`),{__esModule:l,$$typeof:i}=a;a.default;let d=(0,r.createProxy)(String.raw`/home/ubuntu/vj_ai_agents_dev/sentryagent-idp/portal/components/Nav.tsx#Nav`),o={title:"SentryAgent.ai Developer Portal",description:"Identity and access management for AI agents. Register, authenticate, and secure your agents with SentryAgent AgentIdP."};function c({children:e}){return n.jsx("html",{lang:"en",children:(0,n.jsxs)("body",{className:"min-h-screen bg-slate-50 text-slate-900 antialiased",children:[n.jsx(d,{}),n.jsx("main",{children:e}),n.jsx("footer",{className:"border-t border-slate-200 py-8 text-center text-sm text-slate-500",children:(0,n.jsxs)("p",{children:["\xa9 ",new Date().getFullYear()," SentryAgent.ai — All rights reserved."]})})]})})}},7272:()=>{}};var t=require("../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),n=t.X(0,[24],()=>s(178));module.exports=n})(); |