hackagent-webui 0.6.3.dev70__py3-none-any.whl → 0.6.5.dev72__py3-none-any.whl
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.
- hackagent_webui/__init__.py +1 -1
- hackagent_webui/static/404.html +2 -2
- hackagent_webui/static/VERSION +1 -1
- hackagent_webui/static/_next/static/chunks/21-9b527eba32db4357.js +1 -0
- hackagent_webui/static/_next/static/chunks/323-48aec32488b6e5bf.js +1 -0
- hackagent_webui/static/_next/static/chunks/328-d42d52b81db94a35.js +1 -0
- hackagent_webui/static/_next/static/chunks/{921-92a9ab4120f81d51.js → 356-90f2ee305a89f642.js} +1 -1
- hackagent_webui/static/_next/static/chunks/381-b738bb0d835db190.js +1 -0
- hackagent_webui/static/_next/static/chunks/495-ac70d412256bbfe9.js +1 -0
- hackagent_webui/static/_next/static/chunks/546-64c7e818ab4dd2e7.js +1 -0
- hackagent_webui/static/_next/static/chunks/583-f38a7bb278cdb7b1.js +1 -0
- hackagent_webui/static/_next/static/chunks/683-ab457b94ca148f0e.js +1 -0
- hackagent_webui/static/_next/static/chunks/874-f9e3658d3feed699.js +25 -0
- hackagent_webui/static/_next/static/chunks/924-c5a440689b66a79a.js +1 -0
- hackagent_webui/static/_next/static/chunks/97-393ae9eee3ee20ab.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/agents/page-ea6fa46f56918ab5.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/attacks/page-9d0f6a4e82057892.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/credentials/page-170ae86afa1516f9.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/{layout-2df42f6bc0bb81ea.js → layout-bb2a869293131472.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/page-e1303435339f9e4f.js +1 -0
- hackagent_webui/static/_next/static/chunks/app/profile/{page-2e2b66f15f0b6b94.js → page-4ddc195a9862fb6f.js} +1 -1
- hackagent_webui/static/_next/static/chunks/app/stats/page-9b75118409cfc976.js +1 -0
- hackagent_webui/static/_next/static/css/cf5d013e1e316b2f.css +1 -0
- hackagent_webui/static/agents.html +2 -2
- hackagent_webui/static/agents.txt +6 -6
- hackagent_webui/static/api-keys.html +2 -2
- hackagent_webui/static/api-keys.txt +5 -5
- hackagent_webui/static/attacks.html +2 -2
- hackagent_webui/static/attacks.txt +6 -6
- hackagent_webui/static/campaign-export/styles.css +1 -1
- hackagent_webui/static/credentials.html +2 -2
- hackagent_webui/static/credentials.txt +6 -6
- hackagent_webui/static/index.html +2 -2
- hackagent_webui/static/index.txt +6 -6
- hackagent_webui/static/profile.html +2 -2
- hackagent_webui/static/profile.txt +6 -6
- hackagent_webui/static/secrets.html +2 -2
- hackagent_webui/static/secrets.txt +5 -5
- hackagent_webui/static/stats.html +2 -2
- hackagent_webui/static/stats.txt +6 -6
- hackagent_webui/static/usage.html +2 -2
- hackagent_webui/static/usage.txt +6 -6
- {hackagent_webui-0.6.3.dev70.dist-info → hackagent_webui-0.6.5.dev72.dist-info}/METADATA +1 -1
- hackagent_webui-0.6.5.dev72.dist-info/RECORD +81 -0
- hackagent_webui/static/_next/static/chunks/160-21f7abf9e76923d9.js +0 -1
- hackagent_webui/static/_next/static/chunks/452-19c4d89f17c2b51f.js +0 -1
- hackagent_webui/static/_next/static/chunks/583-78ba13009c3dc8f0.js +0 -1
- hackagent_webui/static/_next/static/chunks/592-cb13179874c3bab1.js +0 -1
- hackagent_webui/static/_next/static/chunks/634-36db0f32d413e3f4.js +0 -1
- hackagent_webui/static/_next/static/chunks/658-451b7f3b5c5a1599.js +0 -25
- hackagent_webui/static/_next/static/chunks/688-74942a135eec7c34.js +0 -1
- hackagent_webui/static/_next/static/chunks/747-aa8aa91116de6e71.js +0 -1
- hackagent_webui/static/_next/static/chunks/764-b642e364454b2ac4.js +0 -1
- hackagent_webui/static/_next/static/chunks/870-fd9b5a5e5bb99ffa.js +0 -1
- hackagent_webui/static/_next/static/chunks/888-2e968371d359a872.js +0 -1
- hackagent_webui/static/_next/static/chunks/924-5936172175b16f71.js +0 -1
- hackagent_webui/static/_next/static/chunks/970-bc5945a148c7d8b8.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/agents/page-3c5aa0f73ce025a1.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/attacks/page-03e86fdf23ae8012.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/credentials/page-e8ee2f975dfadf78.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/page-40fdbb3c458241bf.js +0 -1
- hackagent_webui/static/_next/static/chunks/app/stats/page-43b13b5c908c1b1b.js +0 -1
- hackagent_webui/static/_next/static/css/d4ba75bde43fd1c8.css +0 -1
- hackagent_webui-0.6.3.dev70.dist-info/RECORD +0 -83
- /hackagent_webui/static/_next/static/{P47g0-U6UYrSvP3KRUxo_ → jaJDfi8Dn3oTclRwdpEnk}/_buildManifest.js +0 -0
- /hackagent_webui/static/_next/static/{P47g0-U6UYrSvP3KRUxo_ → jaJDfi8Dn3oTclRwdpEnk}/_ssgManifest.js +0 -0
- {hackagent_webui-0.6.3.dev70.dist-info → hackagent_webui-0.6.5.dev72.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[924],{3998:(e,t,a)=>{a.d(t,{$:()=>c,r:()=>s});var n=a(95155);a(12115);var i=a(32467),o=a(83101),r=a(64269);let s=(0,o.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:t,variant:a,size:o,asChild:c=!1,...u}=e,l=c?i.DX:"button";return(0,n.jsx)(l,{"data-slot":"button",className:(0,r.cn)(s({variant:a,size:o,className:t})),...u})}},4882:(e,t,a)=>{a.d(t,{cwn:()=>M,OgW:()=>F,Lev:()=>H,jhh:()=>V,Vk6:()=>i,XoK:()=>$,At2:()=>X,UYx:()=>Y,o3e:()=>s,cdi:()=>Z,v3H:()=>Q,uzR:()=>ee,qjb:()=>q,ZLz:()=>et,S5d:()=>v,ipj:()=>ea});let n="http://localhost".replace(/\/+$/,"");class i{set config(e){this.configuration=e}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:n}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||function e(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Object.keys(t).map(n=>(function t(a,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=i+(i.length?"[".concat(a,"]"):a);if(n instanceof Array){let e=n.map(e=>encodeURIComponent(String(e))).join("&".concat(encodeURIComponent(o),"="));return"".concat(encodeURIComponent(o),"=").concat(e)}return n instanceof Set?t(a,Array.from(n),i):n instanceof Date?"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(n.toISOString())):n instanceof Object?e(n,o):"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(String(n)))})(n,t[n],a)).filter(e=>e.length>0).join("&")}}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let e=this.configuration.apiKey;if(e)return"function"==typeof e?e:()=>e}get accessToken(){let e=this.configuration.accessToken;if(e)return"function"==typeof e?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}constructor(e={}){this.configuration=e}}let o=new i;class r{withMiddleware(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];let n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];let n=t.map(e=>({pre:e}));return this.withMiddleware(...n)}withPostMiddleware(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];let n=t.map(e=>({post:e}));return this.withMiddleware(...n)}isJsonMime(e){return!!e&&r.jsonRegex.test(e)}async request(e,t){let{url:a,init:n}=await this.createFetchParams(e,t),i=await this.fetchApi(a,n);if(i&&i.status>=200&&i.status<300)return i;throw new s(i,"Response returned an error code")}async createFetchParams(e,t){var a,n;let i,o=this.configuration.basePath+e.path;void 0!==e.query&&0!==Object.keys(e.query).length&&(o+="?"+this.configuration.queryParamsStringify(e.query));let r=Object.assign({},this.configuration.headers,e.headers);Object.keys(r).forEach(e=>void 0===r[e]?delete r[e]:{});let s={method:e.method,headers:r,body:e.body,credentials:this.configuration.credentials},c={...s,...await ("function"==typeof t?t:async()=>t)({init:s,context:e})};return a=c.body,i="undefined"!=typeof FormData&&a instanceof FormData||c.body instanceof URLSearchParams||(n=c.body,"undefined"!=typeof Blob&&n instanceof Blob)?c.body:this.isJsonMime(r["Content-Type"])?JSON.stringify(c.body):c.body,{url:o,init:{...c,body:i}}}clone(){let e=new this.constructor(this.configuration);return e.middleware=this.middleware.slice(),e}constructor(e=o){this.configuration=e,this.fetchApi=async(e,t)=>{let a,n={url:e,init:t};for(let e of this.middleware)e.pre&&(n=await e.pre({fetch:this.fetchApi,...n})||n);try{a=await (this.configuration.fetchApi||fetch)(n.url,n.init)}catch(e){for(let t of this.middleware)t.onError&&(a=await t.onError({fetch:this.fetchApi,url:n.url,init:n.init,error:e,response:a?a.clone():void 0})||a);if(void 0===a)if(e instanceof Error)throw new c(e,"The request failed and the interceptors did not return an alternative response");else throw e}for(let e of this.middleware)e.post&&(a=await e.post({fetch:this.fetchApi,url:n.url,init:n.init,response:a.clone()})||a);return a},this.middleware=e.middleware}}r.jsonRegex=RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");class s extends Error{constructor(e,t){super(t),this.response=e,this.name="ResponseError"}}class c extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}class u extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}class l{async value(){return this.transformer(await this.raw.json())}constructor(e,t=e=>e){this.raw=e,this.transformer=t}}class h{async value(){}constructor(e){this.raw=e}}function d(e){var t;return null==(t=e)?t:{id:t.id,timestamp:new Date(t.timestamp),apiKeyPrefix:t.api_key_prefix,userUsername:t.user_username,organizationName:t.organization_name,modelIdUsed:t.model_id_used,apiEndpoint:t.api_endpoint,inputTokens:t.input_tokens,outputTokens:t.output_tokens,creditsDeducted:t.credits_deducted,requestPayloadPreview:t.request_payload_preview,responsePayloadPreview:t.response_payload_preview}}function g(e,t){return null==e?e:{id:e.id,name:e.name}}function f(e,t){return null==e?e:{user:e.user,username:e.username,organization:e.organization}}function w(e){var t;return null==(t=e)?t:{id:t.id,name:t.name,endpoint:t.endpoint,agentType:t.agent_type,description:null==t.description?void 0:t.description,config:t.config,organization:t.organization,organizationDetail:g(t.organization_detail,!1),owner:t.owner,ownerDetail:f(t.owner_detail,!1),createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at)}}function p(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,description:e.description,config:e.config}}function k(e){var t;return null==(t=e)?t:{id:t.id,type:t.type,agent:t.agent,agentName:t.agent_name,owner:t.owner,ownerUsername:t.owner_username,organization:t.organization,organizationName:t.organization_name,_configuration:t.configuration,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at)}}function T(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{type:e.type,agent:e.agent,configuration:e._configuration}}function y(e){var t;return null==(t=e)?t:{id:t.id,name:t.name,description:null==t.description?void 0:t.description,agent:t.agent,spec:t.spec,organization:t.organization,owner:t.owner,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at)}}function m(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,description:e.description,agent:e.agent,spec:e.spec}}function A(e){var t;return null==(t=e)?t:{name:t.name,description:t.description}}function R(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{claimed_by:e.claimedBy}}let v={Pending:"PENDING",Running:"RUNNING",Completed:"COMPLETED",Failed:"FAILED",Cancelled:"CANCELLED"},q={Cloud:"cloud",Local:"local",Cli:"cli"};function z(e){var t,a=e;if(null==a)return a;return{id:a.id,result:a.result,sequence:a.sequence,stepType:null==a.step_type?void 0:(t=a.step_type,t),timestamp:new Date(a.timestamp),content:null==a.content?void 0:a.content}}function _(e){var t,a=e;if(null==a)return a;return{id:a.id,run:a.run,runId:a.run_id,requestPayload:null==a.request_payload?void 0:a.request_payload,responseStatusCode:null==a.response_status_code?void 0:a.response_status_code,responseHeaders:null==a.response_headers?void 0:a.response_headers,responseBody:null==a.response_body?void 0:a.response_body,latencyMs:null==a.latency_ms?void 0:a.latency_ms,detectedToolCalls:null==a.detected_tool_calls?void 0:a.detected_tool_calls,evaluationStatus:null==a.evaluation_status?void 0:(t=a.evaluation_status,t),evaluationNotes:null==a.evaluation_notes?void 0:a.evaluation_notes,evaluationMetrics:null==a.evaluation_metrics?void 0:a.evaluation_metrics,agentSpecificData:null==a.agent_specific_data?void 0:a.agent_specific_data,goal:null==a.goal?void 0:a.goal,goalIndex:null==a.goal_index?void 0:a.goal_index,timestamp:new Date(a.timestamp),traces:null==a.traces?void 0:a.traces.map(z)}}function C(e,t){var a,n;if(null==e)return e;return{id:e.id,agent:e.agent,agentName:e.agent_name,attack:e.attack,owner:e.owner,ownerUsername:e.owner_username,organization:e.organization,organizationName:e.organization_name,runConfig:e.run_config,timestamp:new Date(e.timestamp),status:(a=e.status,a),runNotes:e.run_notes,executor:(n=e.executor,n),campaign:e.campaign,parent:e.parent,claimedAt:null==e.claimed_at?null:new Date(e.claimed_at),claimedBy:e.claimed_by,heartbeatAt:null==e.heartbeat_at?null:new Date(e.heartbeat_at),cancelRequestedAt:null==e.cancel_requested_at?null:new Date(e.cancel_requested_at),finishedAt:null==e.finished_at?null:new Date(e.finished_at),results:e.results.map(_),runToken:null==e.run_token?void 0:e.run_token,env:null==e.env?void 0:e.env}}function B(e,t){var a,n;if(null==e)return e;return{id:e.id,agent:e.agent,agentName:e.agent_name,attack:e.attack,owner:e.owner,ownerUsername:e.owner_username,organization:e.organization,organizationName:e.organization_name,runConfig:e.run_config,timestamp:new Date(e.timestamp),status:(a=e.status,a),runNotes:e.run_notes,executor:(n=e.executor,n),campaign:e.campaign,parent:e.parent,claimedAt:null==e.claimed_at?null:new Date(e.claimed_at),claimedBy:e.claimed_by,heartbeatAt:null==e.heartbeat_at?null:new Date(e.heartbeat_at),cancelRequestedAt:null==e.cancel_requested_at?null:new Date(e.cancel_requested_at),finishedAt:null==e.finished_at?null:new Date(e.finished_at),results:e.results.map(_),command:null==e.command?void 0:e.command}}function P(e){var t;return null==(t=e)?t:{id:t.id,name:t.name,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at),credits:t.credits,creditsLastUpdated:new Date(t.credits_last_updated)}}function I(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name}}function K(e){var t,a=e;if(null==a)return a;return{goalIndex:a.goal_index,goal:a.goal,category:a.category,attempts:a.attempts,successfulJailbreaks:a.successful_jailbreaks,failedJailbreaks:a.failed_jailbreaks,errors:a.errors,notEvaluated:a.not_evaluated,verdict:(t=a.verdict,t),bestScore:a.best_score,decidingResult:a.deciding_result,firstTimestamp:new Date(a.first_timestamp),lastTimestamp:new Date(a.last_timestamp)}}function b(e){var t,a,n=e;if(null==n)return n;return{id:n.id,agent:n.agent,agentName:n.agent_name,attack:n.attack,attackType:n.attack_type,owner:n.owner,ownerUsername:n.owner_username,organization:n.organization,organizationName:n.organization_name,runConfig:n.run_config,timestamp:new Date(n.timestamp),status:(t=n.status,t),runNotes:n.run_notes,executor:(a=n.executor,a),campaign:n.campaign,parent:n.parent,claimedAt:null==n.claimed_at?null:new Date(n.claimed_at),claimedBy:n.claimed_by,heartbeatAt:null==n.heartbeat_at?null:new Date(n.heartbeat_at),cancelRequestedAt:null==n.cancel_requested_at?null:new Date(n.cancel_requested_at),finishedAt:null==n.finished_at?null:new Date(n.finished_at),totalResults:n.total_results,successfulJailbreaks:n.successful_jailbreaks,failedJailbreaks:n.failed_jailbreaks,errors:n.errors,notEvaluated:n.not_evaluated,totalGoals:n.total_goals,jailbrokenGoals:n.jailbroken_goals}}function U(e){var t;return null==(t=e)?t:{name:t.name,createdByUsername:t.created_by_username,createdAt:new Date(t.created_at),updatedAt:new Date(t.updated_at)}}function x(e){var t;return null==(t=e)?t:{id:t.id,name:t.name,prefix:t.prefix,created:new Date(t.created),revoked:t.revoked,expiryDate:null==t.expiry_date?null:new Date(t.expiry_date),user:t.user,userDetail:f(t.user_detail,!1),organization:t.organization,organizationDetail:g(t.organization_detail,!1)}}function S(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1],e}function D(e){var t,a=e;if(null==a)return a;return{id:a.id,user:a.user,username:a.username,email:null==a.email?void 0:a.email,firstName:null==a.first_name?void 0:a.first_name,lastName:null==a.last_name?void 0:a.last_name,organization:a.organization,organizationName:a.organization_name,auth0UserId:a.auth0_user_id,keycloakUserId:a.keycloak_user_id,analyticsConsent:null==a.analytics_consent?void 0:(t=a.analytics_consent,t)}}function E(e){var t;return null==(t=e)?t:{code:t.code,message:t.message,details:t.details}}function J(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{run:e.run,request_payload:e.requestPayload,response_status_code:e.responseStatusCode,response_headers:e.responseHeaders,response_body:e.responseBody,latency_ms:e.latencyMs,detected_tool_calls:e.detectedToolCalls,evaluation_status:e.evaluationStatus,evaluation_notes:e.evaluationNotes,evaluation_metrics:e.evaluationMetrics,agent_specific_data:e.agentSpecificData,goal:e.goal,goal_index:e.goalIndex}}function W(e){var t,a,n=e;if(null==n)return n;return{id:n.id,agent:n.agent,agentName:n.agent_name,attack:n.attack,owner:n.owner,ownerUsername:n.owner_username,organization:n.organization,organizationName:n.organization_name,runConfig:n.run_config,timestamp:new Date(n.timestamp),status:(t=n.status,t),runNotes:n.run_notes,executor:(a=n.executor,a),campaign:n.campaign,parent:n.parent,claimedAt:null==n.claimed_at?null:new Date(n.claimed_at),claimedBy:n.claimed_by,heartbeatAt:null==n.heartbeat_at?null:new Date(n.heartbeat_at),cancelRequestedAt:null==n.cancel_requested_at?null:new Date(n.cancel_requested_at),finishedAt:null==n.finished_at?null:new Date(n.finished_at),results:null==n.results?void 0:n.results.map(_)}}function L(e){var t,a=e;if(null==a)return a;return{seq:a.seq,time:new Date(a.time),level:(t=a.level,t),kind:a.kind,attack:a.attack,attackRun:a.attack_run,goalIndex:a.goal_index,message:a.message,data:a.data}}function j(e){return function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{seq:e.seq,time:e.time.toISOString(),level:e.level,kind:e.kind,attack:e.attack,attack_run:e.attackRun,goal_index:e.goalIndex,message:e.message,data:e.data}}(e,!1)}function N(e){var t;return null==(t=e)?t:{key:t.key,label:t.label,type:t.type,_default:t.default,description:t.description,required:t.required,choices:null==t.choices?null:t.choices,min:t.min,max:t.max,section:t.section,advanced:t.advanced}}function O(e){var t;return null==(t=e)?t:{attackType:t.attack_type,label:t.label,description:t.description,category:t.category,categoryLabel:t.category_label,categoryDescription:t.category_description,tags:t.tags,tagLabels:t.tag_labels,primaryOrder:t.primary_order,fields:t.fields.map(N),paramsSchema:t.params_schema,requiredRoles:t.required_roles,optionalRoles:t.optional_roles}}function G(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{email:e.email,first_name:e.firstName,last_name:e.lastName,analytics_consent:S(e.analyticsConsent,!1)}}class M extends r{async agentCreateRaw(e,t){if(null==e.agentRequest)throw new u("agentRequest",'Required parameter "agentRequest" was null or undefined when calling agentCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/agent",method:"POST",headers:a,query:{},body:p(e.agentRequest,!1)},t),e=>w(e))}async agentCreate(e,t){let a=await this.agentCreateRaw(e,t);return await a.value()}async agentDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling agentDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/agent/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async agentDestroy(e,t){await this.agentDestroyRaw(e,t)}async agentListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/agent",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(w)}})}async agentList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.agentListRaw(e,t);return await a.value()}async agentPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling agentPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/agent/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,description:e.description,config:e.config}}(e.patchedAgentRequest,!1)},t),e=>w(e))}async agentPartialUpdate(e,t){let a=await this.agentPartialUpdateRaw(e,t);return await a.value()}async agentRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling agentRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/agent/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>w(e))}async agentRetrieve(e,t){let a=await this.agentRetrieveRaw(e,t);return await a.value()}async agentUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling agentUpdate().');if(null==e.agentRequest)throw new u("agentRequest",'Required parameter "agentRequest" was null or undefined when calling agentUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/agent/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:p(e.agentRequest,!1)},t),e=>w(e))}async agentUpdate(e,t){let a=await this.agentUpdateRaw(e,t);return await a.value()}}class F extends r{async apilogsListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/apilogs",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(d)}})}async apilogsList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.apilogsListRaw(e,t);return await a.value()}async apilogsRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling apilogsRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/apilogs/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>d(e))}async apilogsRetrieve(e,t){let a=await this.apilogsRetrieveRaw(e,t);return await a.value()}async apilogsSummaryRetrieveRaw(e,t){if(null==e.endDate)throw new u("endDate",'Required parameter "endDate" was null or undefined when calling apilogsSummaryRetrieve().');if(null==e.startDate)throw new u("startDate",'Required parameter "startDate" was null or undefined when calling apilogsSummaryRetrieve().');let a={};null!=e.byKey&&(a.by_key=e.byKey),null!=e.endDate&&(a.end_date=e.endDate.toISOString().substring(0,10)),null!=e.startDate&&(a.start_date=e.startDate.toISOString().substring(0,10)),null!=e.tz&&(a.tz=e.tz);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/apilogs/summary",method:"GET",headers:n,query:a},t),e=>d(e))}async apilogsSummaryRetrieve(e,t){let a=await this.apilogsSummaryRetrieveRaw(e,t);return await a.value()}}class H extends r{async attackCreateRaw(e,t){if(null==e.attackRequest)throw new u("attackRequest",'Required parameter "attackRequest" was null or undefined when calling attackCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/attack",method:"POST",headers:a,query:{},body:T(e.attackRequest,!1)},t),e=>k(e))}async attackCreate(e,t){let a=await this.attackCreateRaw(e,t);return await a.value()}async attackDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling attackDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/attack/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async attackDestroy(e,t){await this.attackDestroyRaw(e,t)}async attackListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/attack",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(k)}})}async attackList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.attackListRaw(e,t);return await a.value()}async attackPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling attackPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/attack/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{type:e.type,agent:e.agent,configuration:e._configuration}}(e.patchedAttackRequest,!1)},t),e=>k(e))}async attackPartialUpdate(e,t){let a=await this.attackPartialUpdateRaw(e,t);return await a.value()}async attackRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling attackRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/attack/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>k(e))}async attackRetrieve(e,t){let a=await this.attackRetrieveRaw(e,t);return await a.value()}async attackUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling attackUpdate().');if(null==e.attackRequest)throw new u("attackRequest",'Required parameter "attackRequest" was null or undefined when calling attackUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/attack/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:T(e.attackRequest,!1)},t),e=>k(e))}async attackUpdate(e,t){let a=await this.attackUpdateRaw(e,t);return await a.value()}}class V extends r{async campaignCreateRaw(e,t){if(null==e.campaignRequest)throw new u("campaignRequest",'Required parameter "campaignRequest" was null or undefined when calling campaignCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign",method:"POST",headers:a,query:{},body:m(e.campaignRequest,!1)},t),e=>y(e))}async campaignCreate(e,t){let a=await this.campaignCreateRaw(e,t);return await a.value()}async campaignDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/campaign/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async campaignDestroy(e,t){await this.campaignDestroyRaw(e,t)}async campaignLaunchAdhocRaw(e,t){if(null==e.adhocLaunchRequest)throw new u("adhocLaunchRequest",'Required parameter "adhocLaunchRequest" was null or undefined when calling campaignLaunchAdhoc().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/launch",method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,description:e.description,agent:e.agent,spec:e.spec,executor:e.executor}}(e.adhocLaunchRequest,!1)},t),e=>B(e,!1))}async campaignLaunchAdhoc(e,t){let a=await this.campaignLaunchAdhocRaw(e,t);return await a.value()}async campaignLaunchCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignLaunchCreate().');if(null==e.launchRequest)throw new u("launchRequest",'Required parameter "launchRequest" was null or undefined when calling campaignLaunchCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/{id}/launch".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{executor:e.executor}}(e.launchRequest,!1)},t),e=>B(e,!1))}async campaignLaunchCreate(e,t){let a=await this.campaignLaunchCreateRaw(e,t);return await a.value()}async campaignListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(y)}})}async campaignList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.campaignListRaw(e,t);return await a.value()}async campaignPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,description:e.description,agent:e.agent,spec:e.spec}}(e.patchedCampaignRequest,!1)},t),e=>y(e))}async campaignPartialUpdate(e,t){let a=await this.campaignPartialUpdateRaw(e,t);return await a.value()}async campaignPreflightRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignPreflightRetrieve().');let a={};null!=e.executor&&(a.executor=e.executor);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/{id}/preflight".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:a},t),e=>(function(e,t){var a;if(null==e)return e;return{executor:(a=e.executor,a),ok:e.ok,problems:e.problems.map(E)}})(e,0))}async campaignPreflightRetrieve(e,t){let a=await this.campaignPreflightRetrieveRaw(e,t);return await a.value()}async campaignRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>y(e))}async campaignRetrieve(e,t){let a=await this.campaignRetrieveRaw(e,t);return await a.value()}async campaignSchemaRetrieveRaw(e){let t={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("KeycloakJWTAccessToken",[]);a&&(t.Authorization="Bearer ".concat(a))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("APIKeyAuth",[]);a&&(t.Authorization="Bearer ".concat(a))}return new l(await this.request({path:"/campaign/schema",method:"GET",headers:t,query:{}},e),e=>{var t;return null==(t=e)?t:{schema:t.schema,datasetPresets:t.dataset_presets.map(A)}})}async campaignSchemaRetrieve(e){let t=await this.campaignSchemaRetrieveRaw(e);return await t.value()}async campaignStartCreateRaw(e,t){if(null==e.campaignStartRequest)throw new u("campaignStartRequest",'Required parameter "campaignStartRequest" was null or undefined when calling campaignStartCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/start",method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{agent:e.agent,spec:e.spec,claimed_by:e.claimedBy}}(e.campaignStartRequest,!1)},t),e=>W(e))}async campaignStartCreate(e,t){let a=await this.campaignStartCreateRaw(e,t);return await a.value()}async campaignTechniquesListRaw(e){let t={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("KeycloakJWTAccessToken",[]);a&&(t.Authorization="Bearer ".concat(a))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("APIKeyAuth",[]);a&&(t.Authorization="Bearer ".concat(a))}return new l(await this.request({path:"/campaign/techniques",method:"GET",headers:t,query:{}},e),e=>e.map(O))}async campaignTechniquesList(e){let t=await this.campaignTechniquesListRaw(e);return await t.value()}async campaignUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling campaignUpdate().');if(null==e.campaignRequest)throw new u("campaignRequest",'Required parameter "campaignRequest" was null or undefined when calling campaignUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/campaign/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:m(e.campaignRequest,!1)},t),e=>y(e))}async campaignUpdate(e,t){let a=await this.campaignUpdateRaw(e,t);return await a.value()}}class $ extends r{async creditsRequestCreateRaw(e,t){let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/credits/request",method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{amount:e.amount,reason:e.reason}}(e.creditRequestRequest,!1)},t),e=>{var t;return null==(t=e)?t:{status:t.status}})}async creditsRequestCreate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.creditsRequestCreateRaw(e,t);return await a.value()}}class X extends r{async keyContextRetrieveRaw(e){let t={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("KeycloakJWTAccessToken",[]);a&&(t.Authorization="Bearer ".concat(a))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("APIKeyAuth",[]);a&&(t.Authorization="Bearer ".concat(a))}return new l(await this.request({path:"/key/context",method:"GET",headers:t,query:{}},e),e=>{var t;return null==(t=e)?t:{userId:null==t.user_id?void 0:t.user_id,username:null==t.username?void 0:t.username,organizationId:null==t.organization_id?void 0:t.organization_id,organizationName:null==t.organization_name?void 0:t.organization_name}})}async keyContextRetrieve(e){let t=await this.keyContextRetrieveRaw(e);return await t.value()}async keyCreateRaw(e,t){if(null==e.userAPIKeyRequest)throw new u("userAPIKeyRequest",'Required parameter "userAPIKeyRequest" was null or undefined when calling keyCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/key",method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,key:e.key}}(e.userAPIKeyRequest,!1)},t),e=>x(e))}async keyCreate(e,t){let a=await this.keyCreateRaw(e,t);return await a.value()}async keyDestroyRaw(e,t){if(null==e.prefix)throw new u("prefix",'Required parameter "prefix" was null or undefined when calling keyDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/key/{prefix}".replace("{prefix}",encodeURIComponent(String(e.prefix))),method:"DELETE",headers:a,query:{}},t))}async keyDestroy(e,t){await this.keyDestroyRaw(e,t)}async keyListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/key",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(x)}})}async keyList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.keyListRaw(e,t);return await a.value()}async keyRetrieveRaw(e,t){if(null==e.prefix)throw new u("prefix",'Required parameter "prefix" was null or undefined when calling keyRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/key/{prefix}".replace("{prefix}",encodeURIComponent(String(e.prefix))),method:"GET",headers:a,query:{}},t),e=>x(e))}async keyRetrieve(e,t){let a=await this.keyRetrieveRaw(e,t);return await a.value()}}class Y extends r{async organizationCreateRaw(e,t){if(null==e.organizationRequest)throw new u("organizationRequest",'Required parameter "organizationRequest" was null or undefined when calling organizationCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/organization",method:"POST",headers:a,query:{},body:I(e.organizationRequest,!1)},t),e=>P(e))}async organizationCreate(e,t){let a=await this.organizationCreateRaw(e,t);return await a.value()}async organizationDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling organizationDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/organization/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async organizationDestroy(e,t){await this.organizationDestroyRaw(e,t)}async organizationListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/organization",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(P)}})}async organizationList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.organizationListRaw(e,t);return await a.value()}async organizationMeRetrieveRaw(e){let t={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("KeycloakJWTAccessToken",[]);a&&(t.Authorization="Bearer ".concat(a))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("APIKeyAuth",[]);a&&(t.Authorization="Bearer ".concat(a))}return new l(await this.request({path:"/organization/me",method:"GET",headers:t,query:{}},e),e=>P(e))}async organizationMeRetrieve(e){let t=await this.organizationMeRetrieveRaw(e);return await t.value()}async organizationPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling organizationPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/organization/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name}}(e.patchedOrganizationRequest,!1)},t),e=>P(e))}async organizationPartialUpdate(e,t){let a=await this.organizationPartialUpdateRaw(e,t);return await a.value()}async organizationRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling organizationRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/organization/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>P(e))}async organizationRetrieve(e,t){let a=await this.organizationRetrieveRaw(e,t);return await a.value()}async organizationUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling organizationUpdate().');if(null==e.organizationRequest)throw new u("organizationRequest",'Required parameter "organizationRequest" was null or undefined when calling organizationUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/organization/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:I(e.organizationRequest,!1)},t),e=>P(e))}async organizationUpdate(e,t){let a=await this.organizationUpdateRaw(e,t);return await a.value()}}class Z extends r{async resultCreateRaw(e,t){if(null==e.resultRequest)throw new u("resultRequest",'Required parameter "resultRequest" was null or undefined when calling resultCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result",method:"POST",headers:a,query:{},body:J(e.resultRequest,!1)},t),e=>_(e))}async resultCreate(e,t){let a=await this.resultCreateRaw(e,t);return await a.value()}async resultDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling resultDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/result/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async resultDestroy(e,t){await this.resultDestroyRaw(e,t)}async resultListRaw(e,t){let a={};null!=e.evaluationStatus&&(a.evaluation_status=e.evaluationStatus),null!=e.goalIndex&&(a.goal_index=e.goalIndex),null!=e.includeTraces&&(a.include_traces=e.includeTraces),null!=e.ordering&&(a.ordering=e.ordering),null!=e.page&&(a.page=e.page),null!=e.pageSize&&(a.page_size=e.pageSize),null!=e.run&&(a.run=e.run),null!=e.runOrganization&&(a.run__organization=e.runOrganization);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(_)}})}async resultList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.resultListRaw(e,t);return await a.value()}async resultPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling resultPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{run:e.run,request_payload:e.requestPayload,response_status_code:e.responseStatusCode,response_headers:e.responseHeaders,response_body:e.responseBody,latency_ms:e.latencyMs,detected_tool_calls:e.detectedToolCalls,evaluation_status:e.evaluationStatus,evaluation_notes:e.evaluationNotes,evaluation_metrics:e.evaluationMetrics,agent_specific_data:e.agentSpecificData,goal:e.goal,goal_index:e.goalIndex}}(e.patchedResultRequest,!1)},t),e=>_(e))}async resultPartialUpdate(e,t){let a=await this.resultPartialUpdateRaw(e,t);return await a.value()}async resultRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling resultRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>_(e))}async resultRetrieve(e,t){let a=await this.resultRetrieveRaw(e,t);return await a.value()}async resultTraceCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling resultTraceCreate().');if(null==e.traceRequest)throw new u("traceRequest",'Required parameter "traceRequest" was null or undefined when calling resultTraceCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result/{id}/trace".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{sequence:e.sequence,step_type:e.stepType,content:e.content}}(e.traceRequest,!1)},t),e=>z(e))}async resultTraceCreate(e,t){let a=await this.resultTraceCreateRaw(e,t);return await a.value()}async resultUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling resultUpdate().');if(null==e.resultRequest)throw new u("resultRequest",'Required parameter "resultRequest" was null or undefined when calling resultUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/result/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:J(e.resultRequest,!1)},t),e=>_(e))}async resultUpdate(e,t){let a=await this.resultUpdateRaw(e,t);return await a.value()}}let Q={ErrorAgentResponse:"ERROR_AGENT_RESPONSE",ErrorTestFramework:"ERROR_TEST_FRAMEWORK",FailedCriteria:"FAILED_CRITERIA",FailedJailbreak:"FAILED_JAILBREAK",NotEvaluated:"NOT_EVALUATED",PassedCriteria:"PASSED_CRITERIA",SuccessfulJailbreak:"SUCCESSFUL_JAILBREAK"};class ee extends r{async runCancelCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runCancelCreate().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/cancel".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{}},t),e=>W(e))}async runCancelCreate(e,t){let a=await this.runCancelCreateRaw(e,t);return await a.value()}async runChildrenCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runChildrenCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/children".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{attack:e.attack,agent:e.agent,run_config:e.runConfig}}(e.childRunRequest,!1)},t),e=>W(e))}async runChildrenCreate(e,t){let a=await this.runChildrenCreateRaw(e,t);return await a.value()}async runClaimCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runClaimCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("WorkerTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/claim".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:R(e.claimRequest,!1)},t),e=>C(e,!1))}async runClaimCreate(e,t){let a=await this.runClaimCreateRaw(e,t);return await a.value()}async runClaimNextCreateRaw(e,t){let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("WorkerTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/claim-next",method:"POST",headers:a,query:{},body:R(e.claimRequest,!1)},t),e=>C(e,!1))}async runClaimNextCreate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.runClaimNextCreateRaw(e,t);switch(a.raw.status){case 200:default:return await a.value();case 204:return null}}async runDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/run/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async runDestroy(e,t){await this.runDestroyRaw(e,t)}async runEventsCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runEventsCreate().');if(null==e.runEventBatchRequest)throw new u("runEventBatchRequest",'Required parameter "runEventBatchRequest" was null or undefined when calling runEventsCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/events".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{events:e.events.map(j)}}(e.runEventBatchRequest,!1)},t),e=>{var t;return null==(t=e)?t:{accepted:t.accepted,duplicates:t.duplicates,dropped:t.dropped,lastSeq:t.last_seq}})}async runEventsCreate(e,t){let a=await this.runEventsCreateRaw(e,t);return await a.value()}async runEventsRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runEventsRetrieve().');let a={};null!=e.after&&(a.after=e.after),null!=e.level&&(a.level=e.level),null!=e.limit&&(a.limit=e.limit);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/events".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{results:t.results.map(L),lastSeq:t.last_seq,hasMore:t.has_more}})}async runEventsRetrieve(e,t){let a=await this.runEventsRetrieveRaw(e,t);return await a.value()}async runFinishCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runFinishCreate().');if(null==e.finishRequest)throw new u("finishRequest",'Required parameter "finishRequest" was null or undefined when calling runFinishCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/finish".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{status:e.status,note:e.note}}(e.finishRequest,!1)},t),e=>W(e))}async runFinishCreate(e,t){let a=await this.runFinishCreateRaw(e,t);return await a.value()}async runGoalsListRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runGoalsList().');let a={};null!=e.page&&(a.page=e.page),null!=e.pageSize&&(a.page_size=e.pageSize);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/goals".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(K)}})}async runGoalsList(e,t){let a=await this.runGoalsListRaw(e,t);return await a.value()}async runHeartbeatCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runHeartbeatCreate().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/heartbeat".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{}},t),e=>{var t;return null==(t=e)?t:{cancelRequested:t.cancel_requested}})}async runHeartbeatCreate(e,t){let a=await this.runHeartbeatCreateRaw(e,t);return await a.value()}async runListRaw(e,t){let a={};null!=e.agent&&(a.agent=e.agent),null!=e.attack&&(a.attack=e.attack),null!=e.campaign&&(a.campaign=e.campaign),null!=e.executor&&(a.executor=e.executor),null!=e.organization&&(a.organization=e.organization),null!=e.page&&(a.page=e.page),null!=e.pageSize&&(a.page_size=e.pageSize),null!=e.parent&&(a.parent=e.parent),null!=e.parentIsnull&&(a.parent__isnull=e.parentIsnull),null!=e.status&&(a.status=e.status);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(b)}})}async runList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.runListRaw(e,t);return await a.value()}async runPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{run_notes:e.runNotes,run_config:e.runConfig}}(e.patchedRunUpdateRequest,!1)},t),e=>W(e))}async runPartialUpdate(e,t){let a=await this.runPartialUpdateRaw(e,t);return await a.value()}async runResultCreateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runResultCreate().');if(null==e.resultRequest)throw new u("resultRequest",'Required parameter "resultRequest" was null or undefined when calling runResultCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}/result".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:a,query:{},body:J(e.resultRequest,!1)},t),e=>_(e))}async runResultCreate(e,t){let a=await this.runResultCreateRaw(e,t);return await a.value()}async runRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling runRetrieve().');let a={};null!=e.includeResults&&(a.include_results=e.includeResults);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("RunTokenAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/run/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:a},t),e=>W(e))}async runRetrieve(e,t){let a=await this.runRetrieveRaw(e,t);return await a.value()}}class et extends r{async secretCreateRaw(e,t){if(null==e.secretWriteRequest)throw new u("secretWriteRequest",'Required parameter "secretWriteRequest" was null or undefined when calling secretCreate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/secret",method:"POST",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{name:e.name,value:e.value}}(e.secretWriteRequest,!1)},t),e=>U(e))}async secretCreate(e,t){let a=await this.secretCreateRaw(e,t);return await a.value()}async secretDestroyRaw(e,t){if(null==e.name)throw new u("name",'Required parameter "name" was null or undefined when calling secretDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/secret/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"DELETE",headers:a,query:{}},t),e=>(function(e,t){var a;if(null==e)return e;return{referencedBy:(a=e.referenced_by,null==a?a:{agents:a.agents,campaigns:a.campaigns})}})(e,0))}async secretDestroy(e,t){let a=await this.secretDestroyRaw(e,t);return await a.value()}async secretListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/secret",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(U)}})}async secretList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.secretListRaw(e,t);return await a.value()}async secretUpdateRaw(e,t){if(null==e.name)throw new u("name",'Required parameter "name" was null or undefined when calling secretUpdate().');if(null==e.secretValueRequest)throw new u("secretValueRequest",'Required parameter "secretValueRequest" was null or undefined when calling secretUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/secret/{name}".replace("{name}",encodeURIComponent(String(e.name))),method:"PUT",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{value:e.value}}(e.secretValueRequest,!1)},t),e=>U(e))}async secretUpdate(e,t){let a=await this.secretUpdateRaw(e,t);return await a.value()}}class ea extends r{async userCreateRaw(e,t){let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user",method:"POST",headers:a,query:{},body:G(e.userProfileRequest,!1)},t),e=>D(e))}async userCreate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.userCreateRaw(e,t);return await a.value()}async userDestroyRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling userDestroy().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new h(await this.request({path:"/user/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:a,query:{}},t))}async userDestroy(e,t){await this.userDestroyRaw(e,t)}async userListRaw(e,t){let a={};null!=e.page&&(a.page=e.page);let n={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(n.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(n.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user",method:"GET",headers:n,query:a},t),e=>{var t;return null==(t=e)?t:{count:t.count,next:null==t.next?void 0:t.next,previous:null==t.previous?void 0:t.previous,results:t.results.map(D)}})}async userList(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.userListRaw(e,t);return await a.value()}async userMeRetrieveRaw(e){let t={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("KeycloakJWTAccessToken",[]);a&&(t.Authorization="Bearer ".concat(a))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,a=await e("APIKeyAuth",[]);a&&(t.Authorization="Bearer ".concat(a))}return new l(await this.request({path:"/user/me",method:"GET",headers:t,query:{}},e),e=>D(e))}async userMeRetrieve(e){let t=await this.userMeRetrieveRaw(e);return await t.value()}async userMeUpdateRaw(e,t){let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user/me",method:"PUT",headers:a,query:{},body:G(e.userProfileRequest,!1)},t),e=>D(e))}async userMeUpdate(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,a=await this.userMeUpdateRaw(e,t);return await a.value()}async userPartialUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling userPartialUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:a,query:{},body:function(e){return(arguments.length>1&&void 0!==arguments[1]&&arguments[1],null==e)?e:{email:e.email,first_name:e.firstName,last_name:e.lastName,analytics_consent:S(e.analyticsConsent,!1)}}(e.patchedUserProfileRequest,!1)},t),e=>D(e))}async userPartialUpdate(e,t){let a=await this.userPartialUpdateRaw(e,t);return await a.value()}async userRetrieveRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling userRetrieve().');let a={};if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:a,query:{}},t),e=>D(e))}async userRetrieve(e,t){let a=await this.userRetrieveRaw(e,t);return await a.value()}async userUpdateRaw(e,t){if(null==e.id)throw new u("id",'Required parameter "id" was null or undefined when calling userUpdate().');let a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("KeycloakJWTAccessToken",[]);t&&(a.Authorization="Bearer ".concat(t))}if(this.configuration&&this.configuration.accessToken){let e=this.configuration.accessToken,t=await e("APIKeyAuth",[]);t&&(a.Authorization="Bearer ".concat(t))}return new l(await this.request({path:"/user/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:a,query:{},body:G(e.userProfileRequest,!1)},t),e=>D(e))}async userUpdate(e,t){let a=await this.userUpdateRaw(e,t);return await a.value()}}},7831:(e,t,a)=>{a.d(t,{Bm:()=>f,DR:()=>r,Ft:()=>w,Iu:()=>h,KC:()=>d,ME:()=>c,gb:()=>u,in:()=>s,ki:()=>i.k,nu:()=>g,userApi:()=>l});var n=a(4882),i=a(72903);let o=(0,a(41444).h)("apiClient"),r=new n.Vk6({basePath:"/api/proxy",middleware:[{pre:async e=>{o.debug("Running pre-request middleware...");let t=(0,i.b)();t.Authorization?(o.debug("Token found, adding Authorization header."),e.init.headers={...e.init.headers,...t}):o.warn("No token found, Authorization header not added.")},post:async e=>{let t=e.response.headers.get("content-type");if(!e.response.ok&&t&&!t.includes("application/json")){let a=await e.response.text();throw o.error({status:e.response.status,contentType:t,preview:a.substring(0,200)},"API returned non-JSON response"),Error("API error ".concat(e.response.status,": Server returned ").concat(t," instead of JSON. Check API endpoint and CORS configuration."))}}}]}),s=new n.cwn(r),c=new n.uzR(r);new n.cdi(r),new n.Lev(r);let u=new n.At2(r),l=new n.ipj(r),h=new n.UYx(r),d=new n.OgW(r),g=new n.XoK(r),f=new n.jhh(r),w=new n.ZLz(r)},41444:(e,t,a)=>{a.d(t,{h:()=>o});var n=a(65727);let i=a.n(n)()({level:"info",browser:{asObject:!1,write:{debug:e=>!1,info:e=>console.info(e),warn:e=>console.warn(e),error:e=>console.error(e)}},redact:{paths:["token","password","authorization","apiKey","api_key","wallet.address","user.wallet.address","privateKey","private_key"],censor:"[REDACTED]"}}),o=e=>i.child({module:e})},64269:(e,t,a)=>{a.d(t,{cn:()=>o});var n=a(2821),i=a(75889);function o(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,i.QP)((0,n.$)(t))}},72903:(e,t,a)=>{a.d(t,{b:()=>r,k:()=>o});let n=(0,a(41444).h)("apiClient"),i=null;function o(e){i=e,n.debug(e?"Access token set":"Access token cleared")}function r(){return i?{Authorization:"Bearer ".concat(i)}:{}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[97],{1088:(e,t,n)=>{n.d(t,{DV:()=>$,Fj:()=>E,HF:()=>m,Iu:()=>Z,K$:()=>D,Lt:()=>h,MM:()=>S,MR:()=>x,QO:()=>o,Sq:()=>b,Wk:()=>k,Xx:()=>v,ZR:()=>f,ZW:()=>R,aV:()=>g,bD:()=>w,gK:()=>p,ky:()=>L,nK:()=>y,qn:()=>q,r6:()=>d,rR:()=>i,rV:()=>r,s6:()=>M,uZ:()=>u,z1:()=>s});var a=n(43226);let r={name:"hackagent/attacker-v1",connection:{provider:"hackagent",type:"OPENAI"}},s={name:"hackagent/judge-v1",connection:{provider:"hackagent",type:"OPENAI"}},l=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function o(e){return"${"+e+"}"}function i(e){var t,n;return"string"!=typeof e?null:null!=(n=null==(t=l.exec(e))?void 0:t[1])?n:null}function c(e){return{name:e.name,connection:{...e.connection}}}let u=["majority","any","mean","max"],d="majority",g=7,f=0,m=10,p=3;function x(e){return"mean"===e||"max"===e}let h=["attack","target","judge"],y=1,v=32;function b(e){return Number.isInteger(e)&&e>=y&&e<=v}let j=()=>({attack:8,target:8,judge:8}),k={name:"",description:"",agentId:"",goals:{kind:"inline",goals:[]},attacks:[],judges:{count:1},concurrency:j(),passthrough:{}},N=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function w(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>w(e,t[n]));if(N(e)&&N(t)){let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>n in t&&w(e[n],t[n]))}return!1}function A(e,t){let n=e;for(let e of t.split(".")){if(!N(n))return;n=n[e]}return n}function O(e,t){return Object.fromEntries(Object.entries(e).filter(e=>{let[n]=e;return!t.includes(n)}))}function _(e,t){return e.find(e=>e.attackType===t)}let C=(e,t)=>w(e,t);function S(e){return Object.fromEntries(e.fields.map(e=>[e.key,e.default]))}function E(e,t){var n;let a=e.description.trim(),{count:l,aggregation:o,threshold:i,custom:u=[]}=e.judges;return function e(t,n){let a={...t};for(let[t,r]of Object.entries(n))a[t]=N(a[t])&&N(r)?e(a[t],r):r;return a}({version:1,campaign:{name:e.name.trim(),...a?{description:a}:{}},dataset:{source:function(e){switch(e.kind){case"intents":return{type:"intents",selections:e.selections};case"preset":return{type:"preset",name:e.name};case"inline":return{type:"inline",goals:e.goals};case"custom":return e.source}}(e.goals),...e.goals.selection?{selection:e.goals.selection}:{}},attacks:e.attacks.map(e=>(function(e,t){var n;let a=_(t,e.attackType),s=new Map(null==a?void 0:a.fields.map(e=>[e.key,e.default])),l={};for(let[t,n]of Object.entries(e.parameters))void 0!==n&&(s.has(t)&&w(n,s.get(t))||function(e,t,n){let a=t.split("."),r=e;for(let e of a.slice(0,-1))N(r[e])||(r[e]={}),r=r[e];r[a[a.length-1]]=n}(l,t,n));let o={...Object.fromEntries((null!=(n=null==a?void 0:a.requiredRoles)?n:[]).map(e=>[e,c(r)])),...e.roles};return{name:e.attackType,...Object.keys(l).length?{parameters:l}:{},...Object.keys(o).length?{roles:o}:{}}})(e,t)),evaluation:{judges:null!=(n=e.judges.models)?n:[...Array.from({length:l},()=>c(s)),...u],...o?{aggregation:o}:{},...void 0!==i?{threshold:i}:{}},execution:{concurrency:{...e.concurrency}}},e.passthrough)}let z=["version","campaign","dataset","attacks","evaluation"],I=["target","execution"];function Z(e,t){var n;if(!N(e))return{...k,goals:{kind:"inline",goals:[]},judges:{count:1},concurrency:j(),passthrough:{}};let a=N(e.campaign)?e.campaign:{},l=N(e.dataset)?e.dataset:{},o=N(e.evaluation)?e.evaluation:{},i=Array.isArray(o.judges)?o.judges:[],c=i.filter(e=>!C(e,s)),d=i.length-c.length,g={count:0===i.length?1:d};u.includes(o.aggregation)&&(g.aggregation=o.aggregation),"number"==typeof o.threshold&&(g.threshold=o.threshold),c.length&&(g.custom=c);let f=[...Array.from({length:d},()=>s),...c];i.length&&!w(i,f)&&(g.models=i);let m=O(e,[...z,...I]),p=O(a,["name","description"]);Object.keys(p).length&&(m.campaign=p);let x=O(l,["source","selection"]);Object.keys(x).length&&(m.dataset=x);let y=O(o,["judges","aggregation","threshold"]);return Object.keys(y).length&&(m.evaluation=y),{name:"string"==typeof a.name?a.name:"",description:"string"==typeof a.description?a.description:"",agentId:"",goals:{..."intents"===(n=N(l.source)?l.source:{}).type&&Array.isArray(n.selections)&&2===Object.keys(n).length&&n.selections.every(e=>N(e)&&/^[A-Z]$/.test(String(e.category))&&Object.keys(e).every(e=>["category","subcategories","samples_per_subcategory"].includes(e)))?{kind:"intents",selections:n.selections}:"preset"===n.type&&"string"==typeof n.name&&2===Object.keys(n).length?{kind:"preset",name:n.name}:"inline"===n.type&&Array.isArray(n.goals)&&2===Object.keys(n).length?{kind:"inline",goals:n.goals.map(String)}:Object.keys(n).length?{kind:"custom",source:n}:{kind:"inline",goals:[]},...N(l.selection)?{selection:l.selection}:{}},attacks:Array.isArray(e.attacks)?e.attacks.map(e=>(function(e,t){var n;let a=N(e)?e:{},s="string"==typeof a.name?a.name:"",l=_(t,s),o=null!=(n=null==l?void 0:l.requiredRoles)?n:[],i=Object.fromEntries(Object.entries(N(a.roles)?a.roles:{}).filter(e=>{let[t,n]=e;return!(o.includes(t)&&C(n,r))}));return{attackType:s,parameters:function(e,t){var n;let a=null!=(n=null==t?void 0:t.fields)?n:[],r=new Set(a.map(e=>e.key)),s={};for(let t of a){let n=A(e,t.key);s[t.key]=void 0===n?t.default:n}let l=(e,t)=>{for(let[n,o]of Object.entries(e)){let e=t?"".concat(t,".").concat(n):n;r.has(e)||(a.some(t=>t.key.startsWith("".concat(e,".")))&&N(o)?l(o,e):s[e]=o)}};return l(e,""),s}(N(a.parameters)?a.parameters:{},l),...Object.keys(i).length?{roles:i}:{}}})(e,t)):[],judges:g,concurrency:function(e){let t=A(e,"execution.concurrency"),n=j();if(!N(t))return n;for(let e of h)"number"==typeof t[e]&&(n[e]=t[e]);return n}(e),passthrough:m}}function L(e){return Object.keys(e.passthrough).length>0}function $(e){return"intents"===e.kind?e.selections.length>0:"inline"===e.kind?e.goals.length>0:"preset"!==e.kind||""!==e.name}function M(e){let t={campaign:{},dataset:{},attacks:{},attackCards:{},evaluation:{},execution:{},other:{}};for(let[r,s]of Object.entries(e)){let[e,...l]=r.split("."),o=l.join(".");if("attacks"===e){let e=Number(l[0]);if(l.length&&Number.isInteger(e)){var n,a;(null!=(a=(n=t.attackCards)[e])?a:n[e]={})[l.slice(1).join(".")]=s}else t.attacks[o]=s}else"campaign"===e||"dataset"===e||"evaluation"===e||"execution"===e?t[e][o]=s:t.other[r]=s}return t}let T=e=>Array.isArray(e)?e.map(String).join(" "):String(e);function R(e){let t={spec:{},fields:{}};if(!N(e))return t;for(let[n,a]of Object.entries(e))if("spec"===n)if(N(a))for(let[e,n]of Object.entries(a))t.spec[e]=T(n);else t.spec.spec=T(a);else t.fields[n]=T(a);return t}let F=/(?:^|[^a-z])(?:[a-z]*key|token|secret|password|passwd|auth|authorization|cookie|credentials?|signature|session)(?:$|[^a-z])/;function q(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[],a=e=>t?"".concat(t,".").concat(e):String(e);if(Array.isArray(e))e.forEach((e,t)=>n.push(...q(e,a(t))));else if(N(e))for(let[t,r]of Object.entries(e))(function(e){let t=e.trim().toLowerCase();return!t.endsWith("_env")&&F.test(t)})(t)&&("api_key"===t?null!=r&&null===i(r):"string"==typeof r?""!==r&&"[REDACTED]"!==r:"number"==typeof r)?n.push(a(t)):n.push(...q(r,a(t)));return n}function D(e){var t,n,r,s,l,o,i,c;let u=[];if("intents"===e.goals.kind&&u.push(...(0,a.sx)(e.goals.selections)),"custom"===e.goals.kind){let t=e.goals.source;["preset","inline","provider","intents"].includes(String(t.type))||u.push("Choose a valid dataset source type."),"intents"===t.type&&u.push(...(0,a.sx)(t.selections)),"provider"!==t.type||"string"==typeof t.provider&&t.provider.trim()||u.push("Specify the dataset provider."),"preset"!==t.type||"string"==typeof t.name&&t.name.trim()||u.push("Specify the dataset preset."),"inline"===t.type&&(!Array.isArray(t.goals)||!t.goals.length||t.goals.some(e=>"string"!=typeof e||!e.trim()))&&u.push("Add at least one non-empty goal.")}let d=null!=(r=e.goals.selection)?r:{};for(let e of["start","end","limit","seed"]){let t=d[e];null!=t&&(!Number.isSafeInteger(t)||"seed"!==e&&Number(t)<+("start"!==e))&&u.push("Dataset ".concat(e," must be a valid integer."))}"number"==typeof d.end&&d.end<=Number(null!=(s=d.start)?s:0)&&u.push("Dataset end must be greater than start.");let g=[...null!=(o=null!=(l=e.judges.models)?l:e.judges.custom)?o:[],...e.attacks.flatMap(e=>{var t;return Object.values(null!=(t=e.roles)?t:{})})];for(let a of((null!=(c=null==(t=e.judges.models)?void 0:t.length)?c:e.judges.count+(null!=(i=null==(n=e.judges.custom)?void 0:n.length)?i:0))<1&&u.push("Add at least one judge."),g)){if(!N(a)||"string"!=typeof a.name||!a.name.trim()||!N(a.connection)||!a.connection.type||!a.connection.provider){u.push("Each model needs a name, provider and connection type.");continue}let e=a.connection;void 0!==e.timeout&&("number"!=typeof e.timeout||e.timeout<=0)&&u.push("Model timeout must be greater than zero.");let t=N(a.generation)?a.generation:{};for(let e of["temperature","max_tokens","top_p"]){let n=t[e];void 0!==n&&("number"!=typeof n||!Number.isFinite(n)||n<+("max_tokens"===e)||"max_tokens"===e&&!Number.isInteger(n)||"top_p"===e&&n>1)&&u.push("Invalid model ".concat(e,"."))}}return h.some(t=>!b(e.concurrency[t]))&&u.push("Concurrency must be a whole number from ".concat(y," to ").concat(v,".")),q({models:g,goals:e.goals}).length&&u.push("Use named secret references for model credentials."),Array.from(new Set(u))}},18332:(e,t,n)=>{n.d(t,{Fc:()=>o,TN:()=>c,XL:()=>i});var a=n(95155);n(12115);var r=n(83101),s=n(64269);let l=(0,r.F)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:n,...r}=e;return(0,a.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,s.cn)(l({variant:n}),t),...r})}function i(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"alert-title",className:(0,s.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...n})}function c(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"alert-description",className:(0,s.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...n})}},20243:(e,t,n)=>{n.d(t,{E:()=>s});var a=n(95155),r=n(64269);function s(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"skeleton",className:(0,r.cn)("bg-accent animate-pulse rounded-md",t),...n})}},22470:(e,t,n)=>{n.d(t,{M:()=>r});var a=n(95155);n(12115);let r=e=>{let{title:t,description:n,action:r,children:s,maxWidth:l="full",compact:o=!1}=e;return(0,a.jsxs)("div",{className:"w-full ".concat({full:"max-w-full","8xl":"max-w-[90rem]","7xl":"max-w-7xl","6xl":"max-w-6xl","5xl":"max-w-5xl","4xl":"max-w-4xl","3xl":"max-w-3xl","2xl":"max-w-2xl"}[l]||"max-w-full"," mx-auto ").concat(o?"py-3 space-y-3":"py-6 space-y-6"),children:[t&&(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 border-b ".concat(o?"px-4 pb-3":"px-6 pb-5"),children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:t}),n&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:n})]}),r&&(0,a.jsx)("div",{className:"flex-shrink-0 pt-0.5",children:r})]}),s]})}},25733:(e,t,n)=>{n.d(t,{i:()=>a});async function a(e){let t=[];for(let a=1;;a++){var n;let r=await e(a);if(t.push(...null!=(n=r.results)?n:[]),!r.next)return t}}},35835:(e,t,n)=>{n.d(t,{T:()=>s});var a=n(95155);n(12115);var r=n(98053);let s=e=>{let{open:t,onOpenChange:n,title:s,description:l,onConfirm:o,confirmText:i="Confirm",cancelText:c="Cancel",variant:u="default"}=e;return(0,a.jsx)(r.Lt,{open:t,onOpenChange:n,children:(0,a.jsxs)(r.EO,{children:[(0,a.jsxs)(r.wd,{children:[(0,a.jsx)(r.r7,{children:s}),(0,a.jsx)(r.$v,{children:l})]}),(0,a.jsxs)(r.ck,{children:[(0,a.jsx)(r.Zr,{children:c}),(0,a.jsx)(r.Rx,{onClick:()=>{o(),n(!1)},className:"destructive"===u?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"",children:i})]})]})})}},43226:(e,t,n)=>{function a(e){let t=e["x-hackagent-intent-categories"];return Array.isArray(t)?t.filter(e=>e&&"string"==typeof e.code&&"string"==typeof e.label&&Array.isArray(e.subcategories)&&e.subcategories.every(e=>e&&"string"==typeof e.code&&"string"==typeof e.label&&Number.isSafeInteger(e.count)&&e.count>0)):[]}function r(e){if(!Array.isArray(e)||!e.length)return["Choose at least one category."];let t=new Set;for(let n of e){if(!n||"string"!=typeof n.category||!n.category.trim())return["Each category selection needs a category."];if(t.has(n.category))return["Select each category only once."];if(t.add(n.category),null!=n.subcategories&&(!Array.isArray(n.subcategories)||!n.subcategories.length||n.subcategories.some(e=>"string"!=typeof e||!e.trim())||new Set(n.subcategories).size!==n.subcategories.length))return["Choose at least one unique subcategory per category."];if(void 0!==n.samples_per_subcategory&&(!Number.isSafeInteger(n.samples_per_subcategory)||n.samples_per_subcategory<1))return["Goals per subcategory must be a positive integer."]}return[]}function s(e,t){return e.reduce((e,n)=>{var a,r;return e+(null!=(r=null==(a=t.find(e=>e.code===n.category))?void 0:a.subcategories)?r:[]).filter(e=>!n.subcategories||n.subcategories.includes(e.code)).reduce((e,t)=>{var a;return e+Math.min(t.count,null!=(a=n.samples_per_subcategory)?a:1)},0)},0)}function l(e,t){var n,a;return Math.max(0,...(null!=(a=null==(n=t.find(t=>t.code===e.category))?void 0:n.subcategories)?a:[]).filter(t=>!e.subcategories||e.subcategories.includes(t.code)).map(e=>e.count))}n.d(t,{Kn:()=>s,ix:()=>a,sT:()=>l,sx:()=>r})},51834:(e,t,n)=>{n.d(t,{Cf:()=>d,Es:()=>f,HM:()=>c,L3:()=>m,c7:()=>g,lG:()=>o,rr:()=>p});var a=n(95155);n(12115);var r=n(88292),s=n(65229),l=n(64269);function o(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"dialog",...t})}function i(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"dialog-portal",...t})}function c(e){let{...t}=e;return(0,a.jsx)(r.bm,{"data-slot":"dialog-close",...t})}function u(e){let{className:t,...n}=e;return(0,a.jsx)(r.hJ,{"data-slot":"dialog-overlay",className:(0,l.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...n})}function d(e){let{className:t,children:n,...o}=e;return(0,a.jsxs)(i,{"data-slot":"dialog-portal",children:[(0,a.jsx)(u,{}),(0,a.jsxs)(r.UC,{"data-slot":"dialog-content",className:(0,l.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...o,children:[n,(0,a.jsxs)(r.bm,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,a.jsx)(s.A,{}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function g(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"dialog-header",className:(0,l.cn)("flex flex-col gap-2 text-center sm:text-left",t),...n})}function f(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"dialog-footer",className:(0,l.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...n})}function m(e){let{className:t,...n}=e;return(0,a.jsx)(r.hE,{"data-slot":"dialog-title",className:(0,l.cn)("text-lg leading-none font-semibold",t),...n})}function p(e){let{className:t,...n}=e;return(0,a.jsx)(r.VY,{"data-slot":"dialog-description",className:(0,l.cn)("text-muted-foreground text-sm",t),...n})}},56419:(e,t,n)=>{n.d(t,{p:()=>r});var a=n(95155);n(12115);let r=e=>{let{icon:t,title:n,description:r,action:s}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center text-center py-12 px-4",children:[(0,a.jsx)("div",{className:"rounded-full bg-muted p-3 mb-4",children:(0,a.jsx)(t,{className:"h-10 w-10 text-muted-foreground"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold mb-2",children:n}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground max-w-sm mb-6",children:r}),s&&(0,a.jsx)("div",{children:s})]})}},65142:(e,t,n)=>{n.d(t,{p:()=>s});var a=n(95155);n(12115);var r=n(64269);function s(e){let{className:t,type:n,...s}=e;return(0,a.jsx)("input",{type:n,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...s})}},74672:(e,t,n)=>{n.d(t,{q:()=>f});var a=n(95155),r=n(12115),s=n(4882),l=n(3998),o=n(51834),i=n(65142),c=n(76444),u=n(7831);let d=/^[A-Z][A-Z0-9_]{1,63}$/;async function g(e){if(e instanceof s.o3e){let t=null;try{t=await e.response.json()}catch(e){}if(t&&"object"==typeof t){let e=t;if("string"==typeof e.error)return e.error;if("string"==typeof e.detail)return e.detail;let n=Object.entries(e).map(e=>{let[t,n]=e;return"".concat(t,": ").concat(Array.isArray(n)?n.join(" "):String(n))});if(n.length)return n.join("; ")}return"Could not save the secret (HTTP ".concat(e.response.status,").")}return"Could not save the secret."}function f(e){let{open:t,onOpenChange:n,presetName:s,onSaved:f}=e,[m,p]=(0,r.useState)(null!=s?s:""),[x,h]=(0,r.useState)(""),[y,v]=(0,r.useState)(!1),[b,j]=(0,r.useState)(null);(0,r.useEffect)(()=>{h(""),j(null),t&&p(null!=s?s:"")},[t,s]);let k=d.test(m),N=k&&x.length>0&&!y,w=async()=>{if(N){v(!0),j(null);try{await u.Ft.secretCreate({secretWriteRequest:{name:m,value:x}}),h(""),f(m)}catch(e){j(await g(e))}finally{v(!1)}}};return(0,a.jsx)(o.lG,{open:t,onOpenChange:n,children:(0,a.jsxs)(o.Cf,{children:[(0,a.jsxs)(o.c7,{children:[(0,a.jsx)(o.L3,{children:"Add secret"}),(0,a.jsx)(o.rr,{children:"Stored encrypted for your organization. The value cannot be read back after saving."})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(c.J,{htmlFor:"secret-name",children:"Name"}),(0,a.jsx)(i.p,{id:"secret-name",value:m,readOnly:!!s,onChange:e=>p(e.target.value),placeholder:"OPENAI_API_KEY",autoComplete:"off"}),m&&!k&&(0,a.jsx)("p",{className:"text-xs text-destructive",children:"Use capital letters, digits and underscores, starting with a letter (2 to 64 characters)."})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(c.J,{htmlFor:"secret-value",children:"Value"}),(0,a.jsx)(i.p,{id:"secret-value",type:"password",value:x,onChange:e=>h(e.target.value),autoComplete:"off"})]}),b&&(0,a.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:b})]}),(0,a.jsxs)(o.Es,{children:[(0,a.jsx)(l.$,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),(0,a.jsx)(l.$,{onClick:w,disabled:!N,children:y?"Saving…":"Save secret"})]})]})})}},76444:(e,t,n)=>{n.d(t,{J:()=>l});var a=n(95155);n(12115);var r=n(85408),s=n(64269);function l(e){let{className:t,...n}=e;return(0,a.jsx)(r.b,{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...n})}},98053:(e,t,n)=>{n.d(t,{$v:()=>p,EO:()=>d,Lt:()=>o,Rx:()=>x,Zr:()=>h,ck:()=>f,r7:()=>m,tv:()=>i,wd:()=>g});var a=n(95155);n(12115);var r=n(35646),s=n(64269),l=n(3998);function o(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"alert-dialog",...t})}function i(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"alert-dialog-trigger",...t})}function c(e){let{...t}=e;return(0,a.jsx)(r.ZL,{"data-slot":"alert-dialog-portal",...t})}function u(e){let{className:t,...n}=e;return(0,a.jsx)(r.hJ,{"data-slot":"alert-dialog-overlay",className:(0,s.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...n})}function d(e){let{className:t,...n}=e;return(0,a.jsxs)(c,{children:[(0,a.jsx)(u,{}),(0,a.jsx)(r.UC,{"data-slot":"alert-dialog-content",className:(0,s.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n})]})}function g(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,s.cn)("flex flex-col gap-2 text-center sm:text-left",t),...n})}function f(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,s.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...n})}function m(e){let{className:t,...n}=e;return(0,a.jsx)(r.hE,{"data-slot":"alert-dialog-title",className:(0,s.cn)("text-lg font-semibold",t),...n})}function p(e){let{className:t,...n}=e;return(0,a.jsx)(r.VY,{"data-slot":"alert-dialog-description",className:(0,s.cn)("text-muted-foreground text-sm",t),...n})}function x(e){let{className:t,...n}=e;return(0,a.jsx)(r.rc,{className:(0,s.cn)((0,l.r)(),t),...n})}function h(e){let{className:t,...n}=e;return(0,a.jsx)(r.ZD,{className:(0,s.cn)((0,l.r)({variant:"outline"}),t),...n})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[165],{3730:(e,t,n)=>{"use strict";n.d(t,{Ke:()=>l,Nt:()=>s,R6:()=>r});var a=n(49578);let s=a.bL,r=a.R6,l=a.Ke},34105:(e,t,n)=>{"use strict";n.d(t,{c:()=>a});let a=(0,n(12115).createContext)(void 0)},39166:(e,t,n)=>{"use strict";n.d(t,{j:()=>l,w:()=>a});let a=["OPENAI","LITELLM","OLLAMA"],s={kind:"anywhere",label:"Launchable"},r="Endpoint is a local address";function l(e){var t;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=function(e){let t=e.config;if("object"!=typeof t||null===t)return null;let n=t.connection;return"object"==typeof n&&null!==n?n:null}(e);if(!l)return{kind:"unsupported",label:"Not launchable from the dashboard yet",reason:"This agent has no model configuration yet. Edit and save it on the Targets page."};let i=String(null!=(t=l.type)?t:"");if(!a.includes(i))return{kind:"unsupported",label:"Not launchable from the dashboard yet",reason:"Only OpenAI, LiteLLM and Ollama agents can be launched from the dashboard."};let o="string"==typeof l.endpoint?l.endpoint.trim():"";if(!o)return"OLLAMA"!==i||n?s:{kind:"local",label:"Local network",reason:"".concat(r," (defaults to localhost)")};let d=function(e){try{return new URL(e.includes("://")?e:"http://".concat(e)).hostname.toLowerCase().replace(/\.$/,"").replace(/^\[(.*)\]$/,"$1")}catch(e){return null}}(o);if(!d)return{kind:"local",label:"Local network",reason:"Endpoint is not a valid URL"};let c=n?null:function(e){if("localhost"===e||e.endsWith(".localhost")||e.endsWith(".local")||"::1"===e)return r;let t=function(e){let t=e.split(".");if(4!==t.length||!t.every(e=>/^\d{1,3}$/.test(e)))return null;let n=t.map(Number);return n.every(e=>e<=255)?n:null}(e);if(!t)return null;let[n,a]=t;return 127===n?r:10===n||172===n&&a>=16&&a<=31||192===n&&168===a?"Endpoint is a private network address":null}(d);return c?{kind:"local",label:"Local network",reason:c}:s}},46056:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>X});var a=n(95155),s=n(12115),r=n(80230),l=n(7831),i=n(41444),o=n(22470),d=n(56419),c=n(35835),u=n(24033),m=n(71360),h=n(6191),x=n(35299),p=n(4882),g=n(74672),f=n(3998),j=n(3730),v=n(51834),b=n(65142),y=n(76444),N=n(39166),A=n(1088),k=n(25733);let w={OPENAI:"OpenAI",LITELLM:"LiteLLM",OLLAMA:"Ollama",GOOGLE_ADK:"Google ADK",CLAUDE_CODE:"Claude Code",CODEX:"Codex",HERMES:"Hermes",WEB:"Web",LANGCHAIN:"LangChain",MCP:"MCP",A2A:"A2A",UNKNOWN:"Unknown"},C=[...N.w.map(e=>({value:e,label:w[e],launchable:!0})),...["GOOGLE_ADK","CLAUDE_CODE","CODEX","HERMES","WEB","LANGCHAIN","MCP","A2A","UNKNOWN"].map(e=>({value:e,label:"".concat(w[e]," ").concat("(dashboard launch not available yet)"),launchable:!1}))],E="__add_secret__",L="flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";function O(e){return"object"!=typeof e||null===e||Array.isArray(e)?{}:e}function T(e){return"string"==typeof e?e:""}function S(e){return Array.isArray(e)?e.join(" "):String(e)}let _=/(?:^|[^a-z])(?:[a-z]*key|token|secret|password|passwd|auth|authorization|cookie|credentials?|signature|session)(?:$|[^a-z])/;function I(e){var t,n,a,s;let r=O(null==e?void 0:e.config),l=O(r.connection),i=O(r.generation),o=Object.entries(O(l.headers)).filter(e=>{let[,t]=e;return"string"==typeof t}).map(e=>{let[t,n]=e;return{key:t,value:n}});return{name:null!=(t=null==e?void 0:e.name)?t:"",description:null!=(n=null==e?void 0:e.description)?n:"",type:"OPENAI_SDK"===(s=T(l.type)||(null==e?void 0:e.agentType)||"OPENAI")?"OPENAI":s,model:T(r.name),endpoint:T(l.endpoint)||((null==e?void 0:e.config)?"":null!=(a=null==e?void 0:e.endpoint)?a:""),secret:(0,A.rR)(l.api_key),timeout:null==l.timeout?"":String(l.timeout),maxTokens:null==i.max_tokens?"":String(i.max_tokens),headers:o}}async function D(e){if(!(e instanceof p.o3e))return{status:null,body:null};let t=null;try{t=await e.response.json()}catch(e){}return{status:e.response.status,body:t}}function P(e){let{message:t}=e;return t?(0,a.jsx)("p",{className:"text-xs text-destructive",children:t}):null}function z(e){var t;let{open:n,onOpenChange:r,agent:i,onSaved:o}=e,[d,c]=(0,s.useState)(()=>I(i)),[p,N]=(0,s.useState)(!1),[w,T]=(0,s.useState)({}),[z,M]=(0,s.useState)(null),[F,$]=(0,s.useState)(!1),[U,H]=(0,s.useState)([]),[K,R]=(0,s.useState)(null),[W,G]=(0,s.useState)(!1),[J,q]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(!n)return;let e=I(i);c(e),N(!!e.secret),T({}),M(null),R(null),q(!1)},[n,i]),(0,s.useEffect)(()=>{if(!n)return;let e=!0;return(0,k.i)(e=>l.Ft.secretList({page:e})).then(t=>e&&H(t.map(e=>e.name))).catch(()=>e&&R("Could not load secrets.")),()=>{e=!1}},[n]);let X=(e,t)=>c(n=>({...n,[e]:t})),B="OLLAMA"===d.type,Z=d.secret&&!U.includes(d.secret)?[...U,d.secret]:U,Q=e=>{T(e),(e.timeout||e.maxTokens||e.headers)&&q(!0)},V=async()=>{let e=(()=>{let e={};d.name.trim()||(e.name="Name is required."),d.model.trim()||(e.model="Model is required."),B&&!d.endpoint.trim()&&(e.endpoint="Endpoint is required for Ollama."),p&&!d.secret&&(e.auth="Select a secret or choose None."),d.timeout.trim()&&!(Number(d.timeout)>0)&&(e.timeout="Timeout must be a positive number."),d.maxTokens.trim()&&!(Number.isInteger(Number(d.maxTokens))&&Number(d.maxTokens)>0)&&(e.maxTokens="Max tokens must be a positive whole number.");let t=d.headers.find(e=>e.key.trim()&&function(e){let t=e.trim().toLowerCase();return!t.endsWith("_env")&&_.test(t)}(e.key));return t&&(e.headers="Header ".concat(t.key.trim()," looks like a credential. Store it as a secret and use Authentication → Secret instead.")),e})();if(Q(e),M(null),Object.keys(e).length)return;$(!0);let t={name:d.name.trim(),description:d.description,config:function(e,t){let n={...O(t)},a={...O(n.connection)},s=a.type===e.type;n.name=e.model.trim(),a.type=e.type,s&&a.provider||(a.provider=e.type.toLowerCase());let r=e.endpoint.trim();r?a.endpoint=r:delete a.endpoint,e.secret?a.api_key=(0,A.QO)(e.secret):delete a.api_key;let l=e.headers.filter(e=>e.key.trim()),i={...Object.fromEntries(Object.entries(O(O(n.connection).headers)).filter(e=>{let[,t]=e;return"string"!=typeof t})),...Object.fromEntries(l.map(e=>[e.key.trim(),e.value]))};Object.keys(i).length?a.headers=i:delete a.headers,e.timeout.trim()?a.timeout=Number(e.timeout):delete a.timeout,n.connection=a;let o={...O(n.generation)};return e.maxTokens.trim()?o.max_tokens=Number(e.maxTokens):delete o.max_tokens,Object.keys(o).length?n.generation=o:delete n.generation,n}({...d,secret:p?d.secret:null},null==i?void 0:i.config)};try{(null==i?void 0:i.id)?await l.in.agentUpdate({id:i.id,agentRequest:t}):await l.in.agentCreate({agentRequest:t}),o()}catch(a){let{status:e,body:t}=await D(a);if(400===e&&t){var n;let e=function(e){let t={},n=[];for(let[a,s]of Object.entries(O(e)))if("name"===a||"description"===a)t[a]=S(s);else if("config"!==a||"object"!=typeof s||null===s||Array.isArray(s))n.push("".concat(a,": ").concat(S(s)));else for(let[e,a]of Object.entries(s)){let s="name"===e?"model":"connection.endpoint"===e?"endpoint":"connection.api_key"===e?"auth":"connection.timeout"===e?"timeout":"generation.max_tokens"===e?"maxTokens":e.startsWith("connection.headers")?"headers":null;s?t[s]=S(a):n.push("".concat(e,": ").concat(S(a)))}return{fields:t,general:n.length?n.join("; "):null}}(t);Q(e.fields);let a=Object.keys(e.fields).length>0;M(null!=(n=e.general)?n:a?null:"Could not save the agent (HTTP 400).")}else M(e?"Could not save the agent (HTTP ".concat(e,")."):"Could not save the agent.")}finally{$(!1)}},Y=(e,t)=>X("headers",d.headers.map((n,a)=>a===e?{...n,...t}:n));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.lG,{open:n,onOpenChange:r,children:(0,a.jsxs)(v.Cf,{className:"sm:max-w-[520px] max-h-[90vh] overflow-y-auto",children:[(0,a.jsxs)(v.c7,{children:[(0,a.jsx)(v.L3,{children:i?"Edit target":"Add target"}),(0,a.jsx)(v.rr,{children:i?(0,a.jsxs)(a.Fragment,{children:["Update the details for ",(0,a.jsx)("strong",{children:i.name}),"."]}):"Connect a model or agent for security evaluation."})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-2",children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(y.J,{htmlFor:"agent-name",children:["Name ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(b.p,{id:"agent-name",value:d.name,onChange:e=>X("name",e.target.value)}),(0,a.jsx)(P,{message:w.name})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{htmlFor:"agent-description",children:"Description"}),(0,a.jsx)("textarea",{id:"agent-description",value:d.description,onChange:e=>X("description",e.target.value),rows:2,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring resize-none"}),(0,a.jsx)(P,{message:w.description})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{htmlFor:"agent-type",children:"Type"}),(0,a.jsx)("select",{id:"agent-type",className:L,value:d.type,onChange:e=>X("type",e.target.value),children:C.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(y.J,{htmlFor:"agent-model",children:["Model ",(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(b.p,{id:"agent-model",value:d.model,onChange:e=>X("model",e.target.value),placeholder:"gpt-4o-mini",className:"font-mono text-sm"}),(0,a.jsx)(P,{message:w.model})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsxs)(y.J,{htmlFor:"agent-endpoint",children:["Endpoint ",B&&(0,a.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,a.jsx)(b.p,{id:"agent-endpoint",value:d.endpoint,onChange:e=>X("endpoint",e.target.value),placeholder:"OLLAMA"===d.type?"http://localhost:11434":"https://api.example.com/v1",className:"font-mono text-sm"}),"OPENAI"===d.type&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Leave empty to use the OpenAI API"}),(0,a.jsx)(P,{message:w.endpoint})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{htmlFor:"agent-auth",children:"Authentication"}),(0,a.jsxs)("select",{id:"agent-auth",className:L,value:p?"secret":"none",onChange:e=>{N("secret"===e.target.value),"secret"!==e.target.value&&X("secret",null)},children:[(0,a.jsx)("option",{value:"none",children:"None"}),(0,a.jsx)("option",{value:"secret",children:"Secret"})]}),p&&(0,a.jsxs)("select",{"aria-label":"Secret",className:L,value:null!=(t=d.secret)?t:"",onChange:e=>e.target.value===E?G(!0):X("secret",e.target.value),children:[(0,a.jsx)("option",{value:"",disabled:!0,children:"Select a secret"}),Z.map(e=>(0,a.jsx)("option",{value:e,children:e},e)),(0,a.jsx)("option",{value:E,children:"Add secret…"})]}),K&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:K}),(0,a.jsx)(P,{message:w.auth})]}),(0,a.jsxs)(j.Nt,{open:J,onOpenChange:q,children:[(0,a.jsxs)(j.R6,{className:"flex items-center gap-1 text-sm font-medium",children:[(0,a.jsx)(u.A,{className:"h-4 w-4"})," Advanced"]}),(0,a.jsxs)(j.Ke,{className:"grid gap-4 pt-3",children:[(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{htmlFor:"agent-timeout",children:"Timeout (seconds)"}),(0,a.jsx)(b.p,{id:"agent-timeout",type:"number",min:1,value:d.timeout,onChange:e=>X("timeout",e.target.value)}),(0,a.jsx)(P,{message:w.timeout})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{htmlFor:"agent-max-tokens",children:"Max tokens"}),(0,a.jsx)(b.p,{id:"agent-max-tokens",type:"number",inputMode:"numeric",min:1,step:1,placeholder:"Model maximum","aria-describedby":"agent-max-tokens-help",value:d.maxTokens,onChange:e=>X("maxTokens",e.target.value)}),(0,a.jsx)("p",{id:"agent-max-tokens-help",className:"text-xs text-muted-foreground",children:"Longest reply the target may write. Leave empty to use the model's maximum."}),(0,a.jsx)(P,{message:w.maxTokens})]}),(0,a.jsxs)("div",{className:"grid gap-1.5",children:[(0,a.jsx)(y.J,{children:"Headers"}),d.headers.map((e,t)=>(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(b.p,{"aria-label":"Header name ".concat(t+1),value:e.key,onChange:e=>Y(t,{key:e.target.value}),placeholder:"Name"}),(0,a.jsx)(b.p,{"aria-label":"Header value ".concat(t+1),value:e.value,onChange:e=>Y(t,{value:e.target.value}),placeholder:"Value"}),(0,a.jsx)(f.$,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove header ".concat(t+1),onClick:()=>X("headers",d.headers.filter((e,n)=>n!==t)),children:(0,a.jsx)(m.A,{className:"h-4 w-4"})})]},t)),(0,a.jsxs)(f.$,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>X("headers",[...d.headers,{key:"",value:""}]),children:[(0,a.jsx)(h.A,{className:"mr-1 h-4 w-4"})," Add header"]}),(0,a.jsx)(P,{message:w.headers})]})]})]}),z&&(0,a.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:z})]}),(0,a.jsxs)(v.Es,{children:[(0,a.jsx)(f.$,{variant:"outline",disabled:F,onClick:()=>r(!1),children:"Cancel"}),(0,a.jsxs)(f.$,{onClick:V,disabled:F,children:[F&&(0,a.jsx)(x.A,{className:"mr-2 h-4 w-4 animate-spin"}),i?"Save changes":"Add target"]})]})]})}),(0,a.jsx)(g.q,{open:W,onOpenChange:G,onSaved:e=>{H(t=>t.includes(e)?t:[...t,e]),X("secret",e),G(!1)}})]})}var M=n(87270),F=n(20243),$=n(18332),U=n(98053),H=n(50803),K=n(78192),R=n(46826),W=n(18514),G=n(46767);let J={LITELLM:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",OPENAI:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",OLLAMA:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",GOOGLE_ADK:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",UNKNOWN:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"},q=(0,i.h)("AgentsPage");function X(){var e;let{isAuthenticated:t,isLoading:n}=(0,r.h)(),[i,u]=(0,s.useState)([]),[h,p]=(0,s.useState)(!0),[g,j]=(0,s.useState)(null),[v,b]=(0,s.useState)(null),[y,N]=(0,s.useState)({open:!1,title:"",description:""}),[A,k]=(0,s.useState)({open:!1,agent:null}),[C,E]=(0,s.useState)(null),[L,O]=(0,s.useState)(!0),[T,S]=(0,s.useState)(null),[_,I]=(0,s.useState)(!1),[D,P]=(0,s.useState)(null),X=(0,s.useCallback)(async()=>{p(!0),j(null),q.debug("Fetching agents...");try{var e;let t=await l.in.agentList();q.info({count:null==(e=t.results)?void 0:e.length},"Agents fetched successfully"),u(t.results||[])}catch(t){q.error({err:t},"Error fetching agents");let e=t.message||"Failed to load agents. Please try again later.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}q.error({status:n,responseBody:a},"API Error"),e=403===n?"Forbidden: Check your permissions.":401===n?"Unauthorized: Please log in again.":"API Error (".concat(n,"): ").concat(a||e)}j(e),u([])}finally{p(!1)}},[]);(0,s.useEffect)(()=>{(async()=>{if(!n&&t){O(!0),S(null);try{q.debug("Fetching user profile via /user/me...");let e=await l.userApi.userMeRetrieve();E(e),q.debug({org:e.organization},"User profile fetched")}catch(t){q.error({err:t},"Error fetching user profile");let e=t.message||"Failed to load user profile.";if(t.response){let n=t.response.status,a="Could not read error body";try{a=await t.response.text()}catch(e){}e="Profile API Error (".concat(n,"): ").concat(a||e)}S(e)}finally{O(!1)}}})()},[n,t]);let B=()=>L?void N({open:!0,title:"Please Wait",description:"User profile is still loading. Please wait a moment."}):!T&&(null==C?void 0:C.organization)?void(P(null),I(!0)):void N({open:!0,title:"Organization Error",description:"Cannot create agent: Organization ID not found. ".concat(T||"Organization ID missing from profile.")}),Z=e=>{if(!e.id)return void N({open:!0,title:"Invalid Agent",description:"Cannot edit agent: ID is missing."});P(e),I(!0)},Q=async()=>{let e=A.agent;if(!(null==e?void 0:e.id))return;let t=e.id;k({open:!1,agent:null}),b(t);try{await l.in.agentDestroy({id:t}),q.info({agentId:t},"Agent deleted successfully"),u(e=>e.filter(e=>e.id!==t))}catch(n){q.error({err:n},"Error deleting agent");let t=n.message||'Failed to delete agent "'.concat(e.name,'". Please try again.');if(n.response){let e=n.response.status,a="Could not read error body";try{a=await n.response.text()}catch(e){}q.error({status:e,responseBody:a},"Delete API Error"),t="Delete API Error (".concat(e,"): ").concat(a||t)}N({open:!0,title:"Error Deleting Agent",description:t})}finally{b(null)}};return((0,s.useEffect)(()=>{!n&&t?X():n||t||(p(!1),u([]),j(null),b(null))},[n,t,X]),n||h&&0===i.length&&!g||L)?(0,a.jsx)(o.M,{title:"Targets",description:"Connect models and AI agents to evaluate their security.",children:(0,a.jsx)("div",{className:"px-6 space-y-3",children:[void 0,void 0,void 0].map((e,t)=>(0,a.jsxs)("div",{className:"border rounded-lg p-4 flex items-start gap-4",children:[(0,a.jsx)(F.E,{className:"h-10 w-10 rounded-md flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)(F.E,{className:"h-4 w-1/4"}),(0,a.jsx)(F.E,{className:"h-3 w-1/2"})]}),(0,a.jsx)(F.E,{className:"h-6 w-20 rounded-full"}),(0,a.jsx)(F.E,{className:"h-8 w-8 rounded"}),(0,a.jsx)(F.E,{className:"h-8 w-8 rounded"})]},"skeleton-".concat(t)))})}):(0,a.jsxs)(o.M,{title:"Targets",description:"Connect models and AI agents to evaluate their security.",action:t&&(0,a.jsxs)(f.$,{onClick:B,children:[(0,a.jsx)(R.A,{className:"mr-2 h-4 w-4"})," Add target"]}),children:[(0,a.jsxs)("div",{className:"px-6 space-y-4",children:[!t&&!n&&(0,a.jsxs)($.Fc,{children:[(0,a.jsx)(H.A,{className:"h-4 w-4"}),(0,a.jsx)($.XL,{children:"Authentication Required"}),(0,a.jsx)($.TN,{children:"Please log in to manage targets."})]}),t&&g&&(0,a.jsxs)($.Fc,{variant:"destructive",children:[(0,a.jsx)(H.A,{className:"h-4 w-4"}),(0,a.jsx)($.XL,{children:"Error loading targets"}),(0,a.jsx)($.TN,{children:g})]}),t&&T&&(0,a.jsxs)($.Fc,{variant:"destructive",children:[(0,a.jsx)(H.A,{className:"h-4 w-4"}),(0,a.jsx)($.XL,{children:"Profile Error"}),(0,a.jsxs)($.TN,{children:[T," — Agent creation may not be available."]})]}),t&&!h&&0===i.length&&!g&&(0,a.jsx)(d.p,{icon:K.A,title:"No targets configured",description:"Connect your first model or AI agent to use it in a campaign.",action:(0,a.jsxs)(f.$,{onClick:B,children:[(0,a.jsx)(R.A,{className:"mr-2 h-4 w-4"})," Add target"]})}),t&&i.length>0&&(0,a.jsx)(G.Bc,{children:(0,a.jsx)("div",{className:"rounded-lg border overflow-hidden",children:(0,a.jsxs)(M.XI,{children:[(0,a.jsx)(M.A0,{children:(0,a.jsxs)(M.Hj,{className:"bg-muted/50 hover:bg-muted/50",children:[(0,a.jsx)(M.nd,{className:"w-[25%] pl-4",children:"Target"}),(0,a.jsx)(M.nd,{className:"w-[15%]",children:"Model"}),(0,a.jsx)(M.nd,{className:"w-[20%]",children:"Endpoint"}),(0,a.jsx)(M.nd,{className:"w-[15%]",children:"Type"}),(0,a.jsx)(M.nd,{className:"w-[12%]",children:"Created"}),(0,a.jsx)(M.nd,{className:"w-[13%] text-right pr-4",children:"Actions"})]})}),(0,a.jsx)(M.BF,{children:i.map(e=>{var t,n,s,r;return(0,a.jsxs)(M.Hj,{className:"group",children:[(0,a.jsx)(M.nA,{className:"pl-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"mt-0.5 h-8 w-8 rounded-md bg-muted flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(K.A,{className:"h-4 w-4 text-muted-foreground"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"font-medium text-sm leading-tight",children:e.name}),e.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:e.description}),(null==(t=e.organizationDetail)?void 0:t.name)&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground/70 mt-0.5",children:e.organizationDetail.name})]})]})}),(0,a.jsx)(M.nA,{children:e.config?(0,a.jsx)("span",{className:"text-sm font-mono",children:function(e){let t=null==e?void 0:e.name;return"string"==typeof t&&t?t:"—"}(e.config)}):(0,a.jsx)("button",{type:"button",onClick:()=>Z(e),className:"text-xs font-medium text-amber-700 dark:text-amber-400 underline-offset-2 hover:underline",children:"Needs configuration"})}),(0,a.jsx)(M.nA,{children:(0,a.jsxs)(G.m_,{children:[(0,a.jsx)(G.k$,{asChild:!0,children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate block max-w-[200px] cursor-default",children:e.endpoint||"—"})}),(0,a.jsx)(G.ZI,{side:"bottom",className:"max-w-sm break-all",children:e.endpoint||"No endpoint"})]})}),(0,a.jsx)(M.nA,{children:e.agentType?(0,a.jsx)("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ".concat(null!=(n=J[e.agentType])?n:J.UNKNOWN),children:null!=(r=w[s=e.agentType])?r:s}):(0,a.jsx)("span",{className:"text-xs text-muted-foreground/50",children:"—"})}),(0,a.jsx)(M.nA,{children:(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:e.createdAt?new Date(e.createdAt).toLocaleDateString():"—"})}),(0,a.jsx)(M.nA,{className:"text-right pr-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,a.jsxs)(G.m_,{children:[(0,a.jsx)(G.k$,{asChild:!0,children:(0,a.jsx)(f.$,{variant:"ghost",size:"icon",onClick:()=>Z(e),disabled:!!v,className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,a.jsx)(W.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(G.ZI,{children:"Edit target"})]}),(0,a.jsxs)(G.m_,{children:[(0,a.jsx)(G.k$,{asChild:!0,children:(0,a.jsx)(f.$,{variant:"ghost",size:"icon",onClick:()=>(e=>{if(!e.id)return void N({open:!0,title:"Invalid Agent",description:"Cannot delete agent: ID missing or invalid."});k({open:!0,agent:e})})(e),disabled:!!v,className:"h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity ".concat(v===e.id?"text-destructive opacity-100":"hover:text-destructive"),children:v===e.id?(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(G.ZI,{children:"Delete target"})]})]})})]},e.id)})})]})})})]}),(0,a.jsx)(z,{open:_,onOpenChange:I,agent:D,onSaved:()=>{I(!1),P(null),X()}}),(0,a.jsx)(U.Lt,{open:y.open,onOpenChange:e=>N(t=>({...t,open:e})),children:(0,a.jsxs)(U.EO,{children:[(0,a.jsxs)(U.wd,{children:[(0,a.jsx)(U.r7,{children:y.title}),(0,a.jsx)(U.$v,{children:y.description})]}),(0,a.jsx)(U.ck,{children:(0,a.jsx)(U.Rx,{onClick:()=>N(e=>({...e,open:!1})),children:"OK"})})]})}),(0,a.jsx)(c.T,{open:A.open,onOpenChange:e=>k(t=>({...t,open:e})),title:"Delete target",description:'Are you sure you want to delete "'.concat(null==(e=A.agent)?void 0:e.name,'"? This action cannot be undone.'),onConfirm:Q,confirmText:"Delete",variant:"destructive"})]})}},46767:(e,t,n)=>{"use strict";n.d(t,{Bc:()=>l,ZI:()=>d,k$:()=>o,m_:()=>i});var a=n(95155);n(12115);var s=n(53583),r=n(64269);function l(e){let{delayDuration:t=0,...n}=e;return(0,a.jsx)(s.Kq,{"data-slot":"tooltip-provider",delayDuration:t,...n})}function i(e){let{...t}=e;return(0,a.jsx)(l,{children:(0,a.jsx)(s.bL,{"data-slot":"tooltip",...t})})}function o(e){let{...t}=e;return(0,a.jsx)(s.l9,{"data-slot":"tooltip-trigger",...t})}function d(e){let{className:t,sideOffset:n=0,children:l,...i}=e;return(0,a.jsx)(s.ZL,{children:(0,a.jsxs)(s.UC,{"data-slot":"tooltip-content",sideOffset:n,className:(0,r.cn)("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[l,(0,a.jsx)(s.i3,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}},50952:(e,t,n)=>{Promise.resolve().then(n.bind(n,46056))},80230:(e,t,n)=>{"use strict";n.d(t,{h:()=>l});var a=n(12115),s=n(34105);let r=async()=>"";function l(){let e=(0,a.useContext)(s.c);return e||{provider:"disabled",user:void 0,isAuthenticated:!1,isLoading:!0,login:void 0,logout:void 0,getAccessTokenSilently:r}}},87270:(e,t,n)=>{"use strict";n.d(t,{A0:()=>l,BF:()=>i,Hj:()=>o,XI:()=>r,nA:()=>c,nd:()=>d});var a=n(95155);n(12115);var s=n(64269);function r(e){let{className:t,...n}=e;return(0,a.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,a.jsx)("table",{"data-slot":"table",className:(0,s.cn)("w-full caption-bottom text-sm",t),...n})})}function l(e){let{className:t,...n}=e;return(0,a.jsx)("thead",{"data-slot":"table-header",className:(0,s.cn)("[&_tr]:border-b",t),...n})}function i(e){let{className:t,...n}=e;return(0,a.jsx)("tbody",{"data-slot":"table-body",className:(0,s.cn)("[&_tr:last-child]:border-0",t),...n})}function o(e){let{className:t,...n}=e;return(0,a.jsx)("tr",{"data-slot":"table-row",className:(0,s.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...n})}function d(e){let{className:t,...n}=e;return(0,a.jsx)("th",{"data-slot":"table-head",className:(0,s.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...n})}function c(e){let{className:t,...n}=e;return(0,a.jsx)("td",{"data-slot":"table-cell",className:(0,s.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...n})}}},e=>{e.O(0,[187,272,583,8,924,97,441,493,358],()=>e(e.s=50952)),_N_E=e.O()}]);
|