@applica-software-guru/persona-sdk 0.1.115 → 0.1.116

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.
@@ -1,2 +1,2 @@
1
- "use strict";var N=Object.defineProperty;var M=(o,t,e)=>t in o?N(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var h=(o,t,e)=>M(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class l extends Error{constructor(e,s){super(`API Error: ${e} - ${s}`);h(this,"statusCode");h(this,"body");this.statusCode=e,this.body=s}}class y{constructor(t){this.apiKey=t}applyHeaders(t){t.set("x-persona-apikey",this.apiKey)}getCredentials(){return this.apiKey}}class c{constructor(t,e){h(this,"baseUrl");h(this,"authProvider");this.baseUrl=t,this.authProvider=typeof e=="string"?new y(e):e}getBaseUrl(){return this.baseUrl}getAuthProvider(){return this.authProvider}normalizePageParams(t,e){return{page:t===void 0||t<1?1:t,size:e===void 0||e<1?20:e}}buildHeaders(){const t=new Headers;return t.set("Content-Type","application/json"),this.authProvider.applyHeaders(t),t}buildUrl(t,e){const s=new URL(this.baseUrl+t);return e&&Object.entries(e).forEach(([r,n])=>{n!=null&&s.searchParams.set(r,String(n))}),s.toString()}async handleResponse(t){if(!t.ok){const s=await t.text();throw new l(t.status,s)}const e=await t.text();return e?JSON.parse(e):void 0}async httpGet(t,e){const s=await fetch(this.buildUrl(t,e),{method:"GET",headers:this.buildHeaders()});return this.handleResponse(s)}async httpPost(t,e,s){const r=await fetch(this.buildUrl(t,s),{method:"POST",headers:this.buildHeaders(),body:e?JSON.stringify(e):void 0});return this.handleResponse(r)}async httpPut(t,e){const s=await fetch(this.baseUrl+t,{method:"PUT",headers:this.buildHeaders(),body:JSON.stringify(e)});return this.handleResponse(s)}async httpPatch(t,e){const s=await fetch(this.baseUrl+t,{method:"PATCH",headers:this.buildHeaders(),body:JSON.stringify(e)});return this.handleResponse(s)}async httpDelete(t){const e=await fetch(this.baseUrl+t,{method:"DELETE",headers:this.buildHeaders()});if(!e.ok){const s=await e.text();throw new l(e.status,s)}}}class m extends c{constructor(e,s,r){super(e,s);h(this,"billingBaseUrl");this.billingBaseUrl=(r||e).replace(/\/$/,"")}async list(e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return e&&(i.keyword=e),this.httpGet("/projects",i)}async get(e){return this.httpGet("/projects/"+e)}async getMine(){return this.httpGet("/projects/mine")}async create(e){return this.httpPost("/projects",e)}async update(e){return this.httpPut("/projects/"+e.projectId,e)}async remove(e){await this.httpDelete("/projects/"+e)}async duplicate(e,s){return this.httpPost("/projects/"+e+"/actions/duplicate",s)}async getSubscription(e){return this.billingRequest("/projects/"+e+"/subscription","GET")}async changeSubscriptionPlan(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/change-plan","POST",s)}async addSubscriptionCredits(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/add-credits","POST",s)}async setInfiniteCredits(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/set-infinite-credits","POST",s)}async billingRequest(e,s,r){const n=new Headers;n.set("Content-Type","application/json"),this.getAuthProvider().applyHeaders(n);const a=await fetch(this.billingBaseUrl+e,{method:s,headers:n,body:r?JSON.stringify(r):void 0});if(!a.ok){const p=await a.text();throw new l(a.status,p)}const i=await a.text();return i?JSON.parse(i):void 0}}class P extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/agents",i)}async get(t){return this.httpGet("/agents/"+t)}async create(t){return this.httpPost("/agents",t)}async update(t){return this.httpPut("/agents/"+t.id,t)}async remove(t){await this.httpDelete("/agents/"+t)}async getSynthesizerSupportedVoices(t){return this.httpGet("/values/synthesizers/"+t+"/voices")}async listRevisions(t){return this.httpGet("/agents/"+t+"/revisions")}async getRevision(t,e){return this.httpGet("/agents/"+t+"/revisions/"+e)}async rollback(t,e){return this.httpPost("/agents/"+t+"/revisions/"+e+"/rollback",{})}async generateSystemInstructions(t,e){const s={prompt:t};return e&&(s.sessionId=e),(await this.httpPost("/agents/system-instructions",s)).instructions}async getArchitect(){return this.httpGet("/agents/architect")}}class w extends c{constructor(e,s,r){super(e,s);h(this,"knowledgeBaseId");this.knowledgeBaseId=r}async list(e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return e&&(i.keyword=e),this.httpGet("/knowledge-bases/"+this.knowledgeBaseId+"/documents",i)}async upload(e){return this.httpPost("/knowledge-bases/"+this.knowledgeBaseId+"/documents",e)}async get(e){return this.httpGet("/knowledge-bases/"+this.knowledgeBaseId+"/documents/"+e)}async reprocess(e){return this.httpPost("/knowledge-bases/"+this.knowledgeBaseId+"/documents",{document_id:e})}async remove(e){await this.httpDelete("/knowledge-bases/"+this.knowledgeBaseId+"/documents/"+e)}}class f extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/knowledge-bases",i)}async get(t){return this.httpGet("/knowledge-bases/"+t)}async create(t){return this.httpPost("/knowledge-bases",t)}async update(t){return this.httpPut("/knowledge-bases/"+t.id,t)}async remove(t){await this.httpDelete("/knowledge-bases/"+t)}documents(t){return new w(this.getBaseUrl(),this.getAuthProvider(),t)}async searchChunks(t,e){return this.httpPost("/knowledge-bases/"+t+"/search",e)}}class v extends c{constructor(t,e){super(t,e)}async list(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/workflows/"+t+"/executions",a)}async get(t,e){return this.httpGet("/workflows/"+t+"/executions/"+e)}async run(t,e){return this.httpPost("/workflows/"+t+"/executions",e)}async queue(t,e){return this.httpPost("/workflows/"+t+"/executions/queue",e)}async listRuns(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size),r={page:e,size:s};return t.status&&(r.status=t.status),t.workflowId&&(r.workflowId=t.workflowId),t.dateFrom&&(r.dateFrom=t.dateFrom),t.dateTo&&(r.dateTo=t.dateTo),this.httpGet("/executions",r)}async cancel(t,e){return this.httpPost("/workflows/"+t+"/executions/"+e+"/cancel",{})}async rerun(t,e,s,r="reuse_outputs"){return this.httpPost("/workflows/"+t+"/executions/"+e+"/rerun",{fromNodeId:s,mode:r})}async dryRunNode(t,e,s={}){return this.httpPost("/workflows/"+t+"/nodes/"+e+"/dry-run",{inputs:s})}async stepTrace(t,e,s,r,n){const{page:a,size:i}=this.normalizePageParams(r,n??200);return this.httpGet("/workflows/"+t+"/executions/"+e+"/steps/"+s+"/trace",{page:a,size:i})}}class b extends c{constructor(t,e){super(t,e)}async list(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size??50),r={page:e,size:s};return(t.status??"pending")&&(r.status=t.status??"pending"),t.assignee&&(r.assignee=t.assignee),t.workflowId&&(r.workflowId=t.workflowId),t.executionId&&(r.executionId=t.executionId),this.httpGet("/human-tasks",r)}async respond(t,e,s){return this.httpPost("/human-tasks/"+t+"/respond",{response:e,respondedBy:s})}}class k extends c{constructor(t,e){super(t,e)}async providers(){return this.httpGet("/channels/providers")}async list(){return this.httpGet("/channels")}async createLink(t="telegram"){return this.httpPost("/channels/"+t+"/link-token")}async update(t,e){return this.httpPatch("/channels/"+t,e)}async verify(t){return this.httpPost("/channels/"+t+"/verify")}async unlink(t){await this.httpDelete("/channels/"+t)}async myIdentities(){return this.httpGet("/channels/identities/me")}async createIdentityLink(t="telegram"){return this.httpPost("/channels/identities/"+t+"/link-token")}async unlinkIdentity(t="telegram"){await this.httpDelete("/channels/identities/me/"+t)}}class G extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/workflows",i)}async create(t){return this.httpPost("/workflows",t)}async update(t,e){return e.id=t,this.httpPut("/workflows/"+t,e)}async remove(t){await this.httpDelete("/workflows/"+t)}async get(t){return this.httpGet("/workflows/"+t)}executions(){return new v(this.getBaseUrl(),this.getAuthProvider())}humanTasks(){return new b(this.getBaseUrl(),this.getAuthProvider())}channels(){return new k(this.getBaseUrl(),this.getAuthProvider())}async listRevisions(t){return this.httpGet("/workflows/"+t+"/revisions")}async getRevision(t,e){return this.httpGet("/workflows/"+t+"/revisions/"+e)}async rollback(t,e){return this.httpPost("/workflows/"+t+"/revisions/"+e+"/rollback",{})}}class A extends c{constructor(t,e){super(t,e)}async authorize(t,e){return this.httpPost("/credentials/"+t+"/authorize",e)}async handleOAuth2Callback(t,e,s,r){const n={code:e,state:s};return r&&(n.scope=r),this.httpGet("/credentials/"+t+"/oauth2/callback",n)}async list(){return this.httpGet("/credentials")}async getByProvider(t){return this.httpGet("/credentials/"+t)}async getById(t){return this.httpGet("/credentials/all/"+t)}async remove(t){await this.httpDelete("/credentials/all/"+t)}}class z extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/features/templates",i)}async get(t){return this.httpGet("/features/templates/"+t)}async create(t){return this.httpPost("/features/templates",t)}async update(t,e){return this.httpPut("/features/templates/"+t,e)}async patch(t,e){return this.httpPatch("/features/templates/"+t,e)}async remove(t){await this.httpDelete("/features/templates/"+t)}async getMcpAvailableTools(t,e){const s=e?{credentialsId:e}:void 0;return this.httpPost("/features/templates/mcp/available-tools",t,s)}}class U{constructor(t,e){h(this,"baseUrl");h(this,"auth");this.baseUrl=t,this.auth=e}templates(){return new z(this.baseUrl,this.auth)}}class x extends c{constructor(t,e){super(t,e)}async list(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/triggers/"+t+"/executions",a)}async execute(t,e){return this.httpPost("/triggers/"+t+"/executions",e)}async get(t){return this.httpGet("/triggers/executions/"+t)}async remove(t){await this.httpDelete("/triggers/executions/"+t)}}class S extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/triggers",i)}async create(t){return this.httpPost("/triggers",t)}async update(t,e){return this.httpPut("/triggers/"+t,e)}async remove(t){await this.httpDelete("/triggers/"+t)}async get(t){return this.httpGet("/triggers/"+t)}executions(){return new x(this.getBaseUrl(),this.getAuthProvider())}}class T extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/service-prices",i)}async getStats(t={}){return this.httpGet("/service-prices/stats",{...t})}async get(t){return this.httpGet("/service-prices/"+t)}async create(t){return this.httpPost("/service-prices",t)}async update(t,e){return this.httpPut("/service-prices/"+t,e)}async remove(t){await this.httpDelete("/service-prices/"+t)}}class R extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/markup-rules",i)}async get(t){return this.httpGet("/markup-rules/"+t)}async create(t){return this.httpPost("/markup-rules",t)}async update(t,e){return this.httpPut("/markup-rules/"+t,e)}async remove(t){await this.httpDelete("/markup-rules/"+t)}}class C extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/providers",i)}async get(t){return this.httpGet("/providers/"+t)}async create(t){return this.httpPost("/providers",t)}async update(t,e){return this.httpPut("/providers/"+t,e)}async remove(t){await this.httpDelete("/providers/"+t)}async available(){return this.httpGet("/providers/available")}async names(){return this.httpGet("/provider-names")}async models(t){return this.httpGet("/provider-models",{provider:t})}}class I extends c{constructor(t,e){super(t,e)}async list(t,e,s,r,n,a){const{page:i,size:p}=this.normalizePageParams(n,a),u={page:i,size:p};return t&&(u.keyword=t),e&&(u.status=e),s&&(u.agentId=s),r&&(u.userId=r),this.httpGet("/sessions",u)}async get(t){return this.httpGet("/sessions/"+t)}async getUsage(t){return this.httpGet("/sessions/"+t+"/usage")}async generateMessage(t,e){return this.httpPost("/sessions/"+t+"/messages",e)}async findMessages(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/sessions/"+t+"/messages",a)}async remove(t){await this.httpDelete("/sessions/"+t)}async rename(t,e){return this.httpPut("/sessions/"+t+"/name",{name:e})}async getAgentState(t){return this.httpGet("/sessions/"+encodeURIComponent(t)+"/agent-state")}async cancelExecution(t){return this.httpPost("/sessions/"+encodeURIComponent(t)+"/cancel",{})}async steerExecution(t,e){return this.httpPost("/sessions/"+encodeURIComponent(t)+"/steer",{text:e})}}class E extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a};return t&&(i.keyword=t),r&&(i.status=r),this.httpGet("/missions",i)}async get(t){return this.httpGet("/missions/"+t)}async create(t){return this.httpPost("/missions",t)}async update(t,e){return this.httpPut("/missions/"+t,e)}async remove(t){await this.httpDelete("/missions/"+t)}async generate(t){return this.httpPost("/missions/"+t+"/generate")}async execute(t){return this.httpPost("/missions/"+t+"/execute")}async retry(t){return this.httpPost("/missions/"+t+"/retry")}async replan(t){return this.httpPost("/missions/"+t+"/replan")}async sendInstruction(t,e){return this.httpPost("/missions/"+t+"/instructions",{instruction:e})}async stop(t){return this.httpPost("/missions/"+t+"/stop")}async resume(t){return this.httpPost("/missions/"+t+"/continue")}}class B{constructor(t,e){h(this,"baseUrl");h(this,"authProvider");this.baseUrl=(t||"https://persona.applica.guru/billing").replace(/\/$/,""),this.authProvider=e??null}buildHeaders(){const t=new Headers;return t.set("Content-Type","application/json"),this.authProvider&&(typeof this.authProvider=="string"?t.set("x-persona-apikey",this.authProvider):this.authProvider.applyHeaders(t)),t}async request(t,e,s){const r=await fetch(this.baseUrl+t,{method:e,headers:this.buildHeaders(),body:s?JSON.stringify(s):void 0});if(!r.ok){const a=await r.text();throw new l(r.status,a)}const n=await r.text();return n?JSON.parse(n):void 0}async createCustomer(t){return this.request("/customers","POST",t)}async updateCustomer(t,e){return this.request("/customers/"+t,"PUT",e)}async getCustomer(t){return this.request("/customers/"+t,"GET")}async saveCustomer(t){return this.request("/customers","POST",t)}async deleteCustomer(t){await this.request("/customers/"+t,"DELETE")}async createSubscription(t){return this.request("/customers/"+t.owner+"/subscription","POST",t)}async getSubscription(t){return this.request("/customers/"+t+"/subscription","GET")}async getProjectSubscription(t){return this.request("/projects/"+t+"/subscription","GET")}async changeProjectSubscriptionPlan(t,e){return this.request("/projects/"+t+"/subscription/actions/change-plan","POST",e)}async addProjectSubscriptionCredits(t,e){return this.request("/projects/"+t+"/subscription/actions/add-credits","POST",e)}async beginUpgrade(t,e){return this.request("/customers/"+t+"/subscription/actions/upgrade","POST",e)}async downgrade(t,e){return this.request("/customers/"+t+"/subscription/actions/downgrade","POST",e)}async mentorize(t,e){return this.request("/customers/"+t+"/subscription/actions/mentorize","POST",e)}async addCredits(t,e){return this.request("/customers/"+t+"/subscription/credits","POST",{credits:e})}async useCredits(t,e,s,r,n,a){const i={credits:e,services:s};return r&&(i.referenceId=r),n!==void 0&&(i.totalCost=n),a!==void 0&&(i.totalPrice=a),this.request("/customers/"+t+"/subscription/credits","DELETE",i)}async getCredits(t){try{return(await this.request("/customers/"+t+"/subscription/credits","GET")).credits??0}catch{return 0}}async isValid(t){try{return(await this.request("/customers/"+t+"/subscription/valid","GET")).valid??!1}catch{return!1}}async listInvoices(t,e,s){const r=[];e&&r.push("date_from="+e),s&&r.push("date_to="+s);const n=r.length>0?"?"+r.join("&"):"";return this.request("/customers/"+t+"/invoices"+n,"GET")}async cancelSubscription(t){return this.request("/customers/"+t+"/subscription/actions/cancel","POST",{})}async getUsageStats(t,e,s,r){const n=[];e&&n.push("date_from="+encodeURIComponent(e)),s&&n.push("date_to="+encodeURIComponent(s)),r!=null&&r.length&&r.forEach(i=>n.push("model="+encodeURIComponent(i)));const a=n.length>0?"?"+n.join("&"):"";return this.request("/projects/"+t+"/subscription/usage-stats"+a,"GET")}async listUsages(t,e,s,r,n,a,i,p){const u=[];e&&u.push("date_from="+encodeURIComponent(e)),s&&u.push("date_to="+encodeURIComponent(s)),r!=null&&r.length&&r.forEach(g=>u.push("model="+encodeURIComponent(g))),n&&u.push("session_id="+encodeURIComponent(n)),a!==void 0&&u.push("page="+encodeURIComponent(String(a))),i!==void 0&&u.push("size="+encodeURIComponent(String(i))),p!=null&&p.length&&p.forEach(g=>u.push("alias="+encodeURIComponent(g)));const H=u.length>0?"?"+u.join("&"):"";return this.request("/projects/"+t+"/subscription/usages"+H,"GET")}}class j extends c{constructor(t,e){super(t,e)}async get(t){return this.httpGet("/values/"+t)}async getLanguageCodes(){return this.httpGet("/values/language-codes")}async getModelNames(){return this.httpGet("/values/model-names")}async getModelProviders(){return this.httpGet("/values/model-providers")}async getKnowledgeTypes(){return this.httpGet("/values/knowledge-types")}async getCollaborationModes(){return this.httpGet("/values/collaboration-modes")}async getTranscriberNames(){return this.httpGet("/values/transcriber-names")}async getSynthesizerNames(){return this.httpGet("/values/synthesizer-names")}async getSynthesizerVoices(t){return this.httpGet("/values/synthesizers/"+t+"/voices")}async getDocumentExtractors(){return this.httpGet("/values/document-extractors")}async getEmbeddingModels(){return this.httpGet("/values/embedding-models")}async getQualityOptions(){return this.httpGet("/values/quality")}async getChunkSizeOptions(){return this.httpGet("/values/chunk-size")}async getFeatureTypes(){return this.httpGet("/values/feature-types")}async getRoles(){return this.httpGet("/values/roles")}async getServiceUnits(){return this.httpGet("/values/service-units")}async getTriggerSourceTypes(){return this.httpGet("/values/trigger-source-types")}async getTriggerDestinationTypes(){return this.httpGet("/values/trigger-destination-types")}}class O extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/model-aliases",i)}async get(t){return this.httpGet("/model-aliases/"+t)}async create(t){return this.httpPost("/model-aliases",t)}async update(t,e){return this.httpPut("/model-aliases/"+t,e)}async remove(t){await this.httpDelete("/model-aliases/"+t)}async impact(t){return this.httpGet("/model-aliases/"+t+"/impact")}async check(t){return this.httpPost("/model-aliases/"+t+"/check")}async suggestions(t,e,s){const r={};return e&&(r.model=e),s!==void 0&&(r.limit=s),this.httpGet("/model-aliases/"+t+"/suggestions",r)}static inUse(t){var e,s;if(!(t instanceof l)||t.statusCode!==409)return null;try{const r=(s=(e=JSON.parse(t.body))==null?void 0:e.detail)==null?void 0:s.impact;return r&&typeof r.total=="number"?r:null}catch{return null}}}class q extends c{constructor(t,e){super(t,e)}async list(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size),r={page:e,size:s};return t.unreadOnly&&(r.unreadOnly=!0),t.includeResolved&&(r.includeResolved=!0),t.projectId&&(r.projectId=t.projectId),this.httpGet("/notifications",r)}async unreadCount(t){return(await this.httpGet("/notifications/unread-count",t?{projectId:t}:void 0)).count}async markRead(t){return this.httpPost("/notifications/"+t+"/read")}async markAllRead(t){await this.httpPost("/notifications/read-all",void 0,t?{projectId:t}:void 0)}}class _{constructor(t,e,s){h(this,"baseUrl");h(this,"workflowsBaseUrl");h(this,"billingBaseUrl");this.baseUrl=t,this.workflowsBaseUrl=e,this.billingBaseUrl=s||"https://persona.applica.guru/billing"}projects(t){return new m(this.baseUrl,t,this.billingBaseUrl)}agents(t){return new P(this.baseUrl,t)}knowledgeBases(t){return new f(this.baseUrl,t)}workflows(t){return new G(this.workflowsBaseUrl,t)}credentials(t){return new A(this.baseUrl,t)}features(t){return new U(this.baseUrl,t)}triggers(t){return new S(this.baseUrl,t)}servicePrices(t){return new T(this.baseUrl,t)}markupRules(t){return new R(this.baseUrl,t)}providers(t){return new C(this.baseUrl,t)}sessions(t){return new I(this.baseUrl,t)}missions(t){return new E(this.baseUrl,t)}billing(t){return new B(this.billingBaseUrl,t)}modelAliases(t){return new O(this.baseUrl,t)}notifications(t){return new q(this.baseUrl,t)}values(t){return new j(this.baseUrl,t)}}class J{constructor(t){this.token=t}applyHeaders(t){t.set("Authorization",`Bearer ${this.token}`)}getCredentials(){return this.token}}const d="alias:";function D(o){return!!o&&o.trim().toLowerCase().startsWith(d)}function L(o){if(!D(o))throw new Error(`Not a model alias reference: ${JSON.stringify(o)}`);return o.trim().slice(d.length).trim()}function F(o){return d+o.trim()}exports.ALIAS_PREFIX=d;exports.AgentsApi=P;exports.ApiException=l;exports.ApiKeyAuthenticationProvider=y;exports.BearerTokenAuthenticationProvider=J;exports.BillingClient=B;exports.ChannelsApi=k;exports.CredentialsApi=A;exports.FeatureTemplatesApi=z;exports.FeaturesApi=U;exports.HumanTasksApi=b;exports.KnowledgeBaseDocumentsApi=w;exports.KnowledgeBasesApi=f;exports.MarkupRulesApi=R;exports.MissionsApi=E;exports.ModelAliasesApi=O;exports.NotificationsApi=q;exports.PersonaSdk=_;exports.ProjectsApi=m;exports.ProvidersApi=C;exports.ServicePricesApi=T;exports.SessionsApi=I;exports.TriggerExecutionsApi=x;exports.TriggersApi=S;exports.ValuesApi=j;exports.WorkflowExecutionsApi=v;exports.WorkflowsApi=G;exports.aliasNameFromRef=L;exports.aliasRef=F;exports.isAliasRef=D;
1
+ "use strict";var N=Object.defineProperty;var _=(o,t,e)=>t in o?N(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e;var h=(o,t,e)=>_(o,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class l extends Error{constructor(e,s){super(`API Error: ${e} - ${s}`);h(this,"statusCode");h(this,"body");this.statusCode=e,this.body=s}}class y{constructor(t){this.apiKey=t}applyHeaders(t){t.set("x-persona-apikey",this.apiKey)}getCredentials(){return this.apiKey}}class c{constructor(t,e){h(this,"baseUrl");h(this,"authProvider");this.baseUrl=t,this.authProvider=typeof e=="string"?new y(e):e}getBaseUrl(){return this.baseUrl}getAuthProvider(){return this.authProvider}normalizePageParams(t,e){return{page:t===void 0||t<1?1:t,size:e===void 0||e<1?20:e}}buildHeaders(){const t=new Headers;return t.set("Content-Type","application/json"),this.authProvider.applyHeaders(t),t}buildUrl(t,e){const s=new URL(this.baseUrl+t);return e&&Object.entries(e).forEach(([r,n])=>{n!=null&&s.searchParams.set(r,String(n))}),s.toString()}async handleResponse(t){if(!t.ok){const s=await t.text();throw new l(t.status,s)}const e=await t.text();return e?JSON.parse(e):void 0}async httpGet(t,e){const s=await fetch(this.buildUrl(t,e),{method:"GET",headers:this.buildHeaders()});return this.handleResponse(s)}async httpPost(t,e,s){const r=await fetch(this.buildUrl(t,s),{method:"POST",headers:this.buildHeaders(),body:e?JSON.stringify(e):void 0});return this.handleResponse(r)}async httpPut(t,e){const s=await fetch(this.baseUrl+t,{method:"PUT",headers:this.buildHeaders(),body:JSON.stringify(e)});return this.handleResponse(s)}async httpPatch(t,e){const s=await fetch(this.baseUrl+t,{method:"PATCH",headers:this.buildHeaders(),body:JSON.stringify(e)});return this.handleResponse(s)}async httpDelete(t){const e=await fetch(this.baseUrl+t,{method:"DELETE",headers:this.buildHeaders()});if(!e.ok){const s=await e.text();throw new l(e.status,s)}}}class m extends c{constructor(e,s,r){super(e,s);h(this,"billingBaseUrl");this.billingBaseUrl=(r||e).replace(/\/$/,"")}async list(e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return e&&(i.keyword=e),this.httpGet("/projects",i)}async get(e){return this.httpGet("/projects/"+e)}async getMine(){return this.httpGet("/projects/mine")}async create(e){return this.httpPost("/projects",e)}async update(e){return this.httpPut("/projects/"+e.projectId,e)}async remove(e){await this.httpDelete("/projects/"+e)}async duplicate(e,s){return this.httpPost("/projects/"+e+"/actions/duplicate",s)}async getSubscription(e){return this.billingRequest("/projects/"+e+"/subscription","GET")}async changeSubscriptionPlan(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/change-plan","POST",s)}async addSubscriptionCredits(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/add-credits","POST",s)}async setInfiniteCredits(e,s){return this.billingRequest("/projects/"+e+"/subscription/actions/set-infinite-credits","POST",s)}async billingRequest(e,s,r){const n=new Headers;n.set("Content-Type","application/json"),this.getAuthProvider().applyHeaders(n);const a=await fetch(this.billingBaseUrl+e,{method:s,headers:n,body:r?JSON.stringify(r):void 0});if(!a.ok){const p=await a.text();throw new l(a.status,p)}const i=await a.text();return i?JSON.parse(i):void 0}}class P extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/agents",i)}async get(t){return this.httpGet("/agents/"+t)}async create(t){return this.httpPost("/agents",t)}async update(t){return this.httpPut("/agents/"+t.id,t)}async remove(t){await this.httpDelete("/agents/"+t)}async getSynthesizerSupportedVoices(t){return this.httpGet("/values/synthesizers/"+t+"/voices")}async listRevisions(t){return this.httpGet("/agents/"+t+"/revisions")}async getRevision(t,e){return this.httpGet("/agents/"+t+"/revisions/"+e)}async rollback(t,e){return this.httpPost("/agents/"+t+"/revisions/"+e+"/rollback",{})}async generateSystemInstructions(t,e){const s={prompt:t};return e&&(s.sessionId=e),(await this.httpPost("/agents/system-instructions",s)).instructions}async getArchitect(){return this.httpGet("/agents/architect")}}class w extends c{constructor(e,s,r){super(e,s);h(this,"knowledgeBaseId");this.knowledgeBaseId=r}async list(e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return e&&(i.keyword=e),this.httpGet("/knowledge-bases/"+this.knowledgeBaseId+"/documents",i)}async upload(e){return this.httpPost("/knowledge-bases/"+this.knowledgeBaseId+"/documents",e)}async get(e){return this.httpGet("/knowledge-bases/"+this.knowledgeBaseId+"/documents/"+e)}async reprocess(e){return this.httpPost("/knowledge-bases/"+this.knowledgeBaseId+"/documents",{document_id:e})}async remove(e){await this.httpDelete("/knowledge-bases/"+this.knowledgeBaseId+"/documents/"+e)}}class f extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/knowledge-bases",i)}async get(t){return this.httpGet("/knowledge-bases/"+t)}async create(t){return this.httpPost("/knowledge-bases",t)}async update(t){return this.httpPut("/knowledge-bases/"+t.id,t)}async remove(t){await this.httpDelete("/knowledge-bases/"+t)}documents(t){return new w(this.getBaseUrl(),this.getAuthProvider(),t)}async searchChunks(t,e){return this.httpPost("/knowledge-bases/"+t+"/search",e)}}class v extends c{constructor(t,e){super(t,e)}async list(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/workflows/"+t+"/executions",a)}async get(t,e){return this.httpGet("/workflows/"+t+"/executions/"+e)}async run(t,e){return this.httpPost("/workflows/"+t+"/executions",e)}async queue(t,e){return this.httpPost("/workflows/"+t+"/executions/queue",e)}async listRuns(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size),r={page:e,size:s};return t.status&&(r.status=t.status),t.workflowId&&(r.workflowId=t.workflowId),t.dateFrom&&(r.dateFrom=t.dateFrom),t.dateTo&&(r.dateTo=t.dateTo),this.httpGet("/executions",r)}async cancel(t,e){return this.httpPost("/workflows/"+t+"/executions/"+e+"/cancel",{})}async rerun(t,e,s,r="reuse_outputs"){return this.httpPost("/workflows/"+t+"/executions/"+e+"/rerun",{fromNodeId:s,mode:r})}async dryRunNode(t,e,s={}){return this.httpPost("/workflows/"+t+"/nodes/"+e+"/dry-run",{inputs:s})}async stepTrace(t,e,s,r,n){const{page:a,size:i}=this.normalizePageParams(r,n??200);return this.httpGet("/workflows/"+t+"/executions/"+e+"/steps/"+s+"/trace",{page:a,size:i})}}class b extends c{constructor(t,e){super(t,e)}async list(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size??50),r={page:e,size:s};return(t.status??"pending")&&(r.status=t.status??"pending"),t.assignee&&(r.assignee=t.assignee),t.workflowId&&(r.workflowId=t.workflowId),t.executionId&&(r.executionId=t.executionId),this.httpGet("/human-tasks",r)}async respond(t,e,s){return this.httpPost("/human-tasks/"+t+"/respond",{response:e,respondedBy:s})}}class k extends c{constructor(t,e){super(t,e)}async providers(){return this.httpGet("/channels/providers")}async list(){return this.httpGet("/channels")}async createLink(t="telegram"){return this.httpPost("/channels/"+t+"/link-token")}async update(t,e){return this.httpPatch("/channels/"+t,e)}async verify(t){return this.httpPost("/channels/"+t+"/verify")}async unlink(t){await this.httpDelete("/channels/"+t)}async myIdentities(){return this.httpGet("/channels/identities/me")}async createIdentityLink(t="telegram"){return this.httpPost("/channels/identities/"+t+"/link-token")}async unlinkIdentity(t="telegram"){await this.httpDelete("/channels/identities/me/"+t)}}class G extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/workflows",i)}async create(t){return this.httpPost("/workflows",t)}async update(t,e){return e.id=t,this.httpPut("/workflows/"+t,e)}async remove(t){await this.httpDelete("/workflows/"+t)}async get(t){return this.httpGet("/workflows/"+t)}executions(){return new v(this.getBaseUrl(),this.getAuthProvider())}humanTasks(){return new b(this.getBaseUrl(),this.getAuthProvider())}channels(){return new k(this.getBaseUrl(),this.getAuthProvider())}async listRevisions(t){return this.httpGet("/workflows/"+t+"/revisions")}async getRevision(t,e){return this.httpGet("/workflows/"+t+"/revisions/"+e)}async rollback(t,e){return this.httpPost("/workflows/"+t+"/revisions/"+e+"/rollback",{})}}class A extends c{constructor(t,e){super(t,e)}async authorize(t,e){return this.httpPost("/credentials/"+t+"/authorize",e)}async handleOAuth2Callback(t,e,s,r){const n={code:e,state:s};return r&&(n.scope=r),this.httpGet("/credentials/"+t+"/oauth2/callback",n)}async list(){return this.httpGet("/credentials")}async getByProvider(t){return this.httpGet("/credentials/"+t)}async getById(t){return this.httpGet("/credentials/all/"+t)}async remove(t){await this.httpDelete("/credentials/all/"+t)}}class z extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/features/templates",i)}async get(t){return this.httpGet("/features/templates/"+t)}async create(t){return this.httpPost("/features/templates",t)}async update(t,e){return this.httpPut("/features/templates/"+t,e)}async patch(t,e){return this.httpPatch("/features/templates/"+t,e)}async remove(t){await this.httpDelete("/features/templates/"+t)}async getMcpAvailableTools(t,e){const s=e?{credentialsId:e}:void 0;return this.httpPost("/features/templates/mcp/available-tools",t,s)}}class U{constructor(t,e){h(this,"baseUrl");h(this,"auth");this.baseUrl=t,this.auth=e}templates(){return new z(this.baseUrl,this.auth)}}class x extends c{constructor(t,e){super(t,e)}async list(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/triggers/"+t+"/executions",a)}async execute(t,e){return this.httpPost("/triggers/"+t+"/executions",e)}async get(t){return this.httpGet("/triggers/executions/"+t)}async remove(t){await this.httpDelete("/triggers/executions/"+t)}}class S extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/triggers",i)}async create(t){return this.httpPost("/triggers",t)}async update(t,e){return this.httpPut("/triggers/"+t,e)}async remove(t){await this.httpDelete("/triggers/"+t)}async get(t){return this.httpGet("/triggers/"+t)}executions(){return new x(this.getBaseUrl(),this.getAuthProvider())}}class T extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a,...r};return t&&(i.keyword=t),this.httpGet("/service-prices",i)}async getStats(t={}){return this.httpGet("/service-prices/stats",{...t})}async get(t){return this.httpGet("/service-prices/"+t)}async create(t){return this.httpPost("/service-prices",t)}async update(t,e){return this.httpPut("/service-prices/"+t,e)}async remove(t){await this.httpDelete("/service-prices/"+t)}}class R extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/markup-rules",i)}async get(t){return this.httpGet("/markup-rules/"+t)}async create(t){return this.httpPost("/markup-rules",t)}async update(t,e){return this.httpPut("/markup-rules/"+t,e)}async remove(t){await this.httpDelete("/markup-rules/"+t)}}class C extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/providers",i)}async get(t){return this.httpGet("/providers/"+t)}async create(t){return this.httpPost("/providers",t)}async update(t,e){return this.httpPut("/providers/"+t,e)}async remove(t){await this.httpDelete("/providers/"+t)}async available(){return this.httpGet("/providers/available")}async names(){return this.httpGet("/provider-names")}async models(t){return this.httpGet("/provider-models",{provider:t})}}class I extends c{constructor(t,e){super(t,e)}async list(t,e,s,r,n,a){const{page:i,size:p}=this.normalizePageParams(n,a),u={page:i,size:p};return t&&(u.keyword=t),e&&(u.status=e),s&&(u.agentId=s),r&&(u.userId=r),this.httpGet("/sessions",u)}async get(t){return this.httpGet("/sessions/"+t)}async getUsage(t){return this.httpGet("/sessions/"+t+"/usage")}async generateMessage(t,e){return this.httpPost("/sessions/"+t+"/messages",e)}async findMessages(t,e,s){const{page:r,size:n}=this.normalizePageParams(e,s),a={page:r,size:n};return this.httpGet("/sessions/"+t+"/messages",a)}async remove(t){await this.httpDelete("/sessions/"+t)}async rename(t,e){return this.httpPut("/sessions/"+t+"/name",{name:e})}async getAgentState(t){return this.httpGet("/sessions/"+encodeURIComponent(t)+"/agent-state")}async cancelExecution(t){return this.httpPost("/sessions/"+encodeURIComponent(t)+"/cancel",{})}async steerExecution(t,e){return this.httpPost("/sessions/"+encodeURIComponent(t)+"/steer",{text:e})}}class E extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(e,s),i={page:n,size:a};return t&&(i.keyword=t),r&&(i.status=r),this.httpGet("/missions",i)}async get(t){return this.httpGet("/missions/"+t)}async create(t){return this.httpPost("/missions",t)}async update(t,e){return this.httpPut("/missions/"+t,e)}async remove(t){await this.httpDelete("/missions/"+t)}async generate(t){return this.httpPost("/missions/"+t+"/generate")}async execute(t){return this.httpPost("/missions/"+t+"/execute")}async retry(t){return this.httpPost("/missions/"+t+"/retry")}async replan(t){return this.httpPost("/missions/"+t+"/replan")}async sendInstruction(t,e){return this.httpPost("/missions/"+t+"/instructions",{instruction:e})}async stop(t){return this.httpPost("/missions/"+t+"/stop")}async resume(t){return this.httpPost("/missions/"+t+"/continue")}}class B{constructor(t,e){h(this,"baseUrl");h(this,"authProvider");this.baseUrl=(t||"https://persona.applica.guru/billing").replace(/\/$/,""),this.authProvider=e??null}buildHeaders(){const t=new Headers;return t.set("Content-Type","application/json"),this.authProvider&&(typeof this.authProvider=="string"?t.set("x-persona-apikey",this.authProvider):this.authProvider.applyHeaders(t)),t}async request(t,e,s){const r=await fetch(this.baseUrl+t,{method:e,headers:this.buildHeaders(),body:s?JSON.stringify(s):void 0});if(!r.ok){const a=await r.text();throw new l(r.status,a)}const n=await r.text();return n?JSON.parse(n):void 0}async createCustomer(t){return this.request("/customers","POST",t)}async updateCustomer(t,e){return this.request("/customers/"+t,"PUT",e)}async getCustomer(t){return this.request("/customers/"+t,"GET")}async saveCustomer(t){return this.request("/customers","POST",t)}async deleteCustomer(t){await this.request("/customers/"+t,"DELETE")}async createSubscription(t){return this.request("/customers/"+t.owner+"/subscription","POST",t)}async getSubscription(t){return this.request("/customers/"+t+"/subscription","GET")}async getProjectSubscription(t){return this.request("/projects/"+t+"/subscription","GET")}async changeProjectSubscriptionPlan(t,e){return this.request("/projects/"+t+"/subscription/actions/change-plan","POST",e)}async addProjectSubscriptionCredits(t,e){return this.request("/projects/"+t+"/subscription/actions/add-credits","POST",e)}async beginUpgrade(t,e){return this.request("/customers/"+t+"/subscription/actions/upgrade","POST",e)}async downgrade(t,e){return this.request("/customers/"+t+"/subscription/actions/downgrade","POST",e)}async mentorize(t,e){return this.request("/customers/"+t+"/subscription/actions/mentorize","POST",e)}async addCredits(t,e){return this.request("/customers/"+t+"/subscription/credits","POST",{credits:e})}async useCredits(t,e,s,r,n,a){const i={credits:e,services:s};return r&&(i.referenceId=r),n!==void 0&&(i.totalCost=n),a!==void 0&&(i.totalPrice=a),this.request("/customers/"+t+"/subscription/credits","DELETE",i)}async getCredits(t){try{return(await this.request("/customers/"+t+"/subscription/credits","GET")).credits??0}catch{return 0}}async isValid(t){try{return(await this.request("/customers/"+t+"/subscription/valid","GET")).valid??!1}catch{return!1}}async listInvoices(t,e,s){const r=[];e&&r.push("date_from="+e),s&&r.push("date_to="+s);const n=r.length>0?"?"+r.join("&"):"";return this.request("/customers/"+t+"/invoices"+n,"GET")}async cancelSubscription(t){return this.request("/customers/"+t+"/subscription/actions/cancel","POST",{})}async getUsageStats(t,e,s,r){const n=[];e&&n.push("date_from="+encodeURIComponent(e)),s&&n.push("date_to="+encodeURIComponent(s)),r!=null&&r.length&&r.forEach(i=>n.push("model="+encodeURIComponent(i)));const a=n.length>0?"?"+n.join("&"):"";return this.request("/projects/"+t+"/subscription/usage-stats"+a,"GET")}async listUsages(t,e,s,r,n,a,i,p){const u=[];e&&u.push("date_from="+encodeURIComponent(e)),s&&u.push("date_to="+encodeURIComponent(s)),r!=null&&r.length&&r.forEach(g=>u.push("model="+encodeURIComponent(g))),n&&u.push("session_id="+encodeURIComponent(n)),a!==void 0&&u.push("page="+encodeURIComponent(String(a))),i!==void 0&&u.push("size="+encodeURIComponent(String(i))),p!=null&&p.length&&p.forEach(g=>u.push("alias="+encodeURIComponent(g)));const M=u.length>0?"?"+u.join("&"):"";return this.request("/projects/"+t+"/subscription/usages"+M,"GET")}}class j extends c{constructor(t,e){super(t,e)}async get(t){return this.httpGet("/values/"+t)}async getLanguageCodes(){return this.httpGet("/values/language-codes")}async getModelNames(){return this.httpGet("/values/model-names")}async getModelProviders(){return this.httpGet("/values/model-providers")}async getKnowledgeTypes(){return this.httpGet("/values/knowledge-types")}async getCollaborationModes(){return this.httpGet("/values/collaboration-modes")}async getTranscriberNames(){return this.httpGet("/values/transcriber-names")}async getSynthesizerNames(){return this.httpGet("/values/synthesizer-names")}async getSynthesizerVoices(t){return this.httpGet("/values/synthesizers/"+t+"/voices")}async getDocumentExtractors(){return this.httpGet("/values/document-extractors")}async getEmbeddingModels(){return this.httpGet("/values/embedding-models")}async getQualityOptions(){return this.httpGet("/values/quality")}async getChunkSizeOptions(){return this.httpGet("/values/chunk-size")}async getFeatureTypes(){return this.httpGet("/values/feature-types")}async getRoles(){return this.httpGet("/values/roles")}async getServiceUnits(){return this.httpGet("/values/service-units")}async getTriggerSourceTypes(){return this.httpGet("/values/trigger-source-types")}async getTriggerDestinationTypes(){return this.httpGet("/values/trigger-destination-types")}}class O extends c{constructor(t,e){super(t,e)}async list(t,e,s,r){const{page:n,size:a}=this.normalizePageParams(s,r),i={page:n,size:a};return t&&(i.projectId=t),e&&(i.keyword=e),this.httpGet("/model-aliases",i)}async get(t){return this.httpGet("/model-aliases/"+t)}async create(t){return this.httpPost("/model-aliases",t)}async update(t,e){return this.httpPut("/model-aliases/"+t,e)}async remove(t){await this.httpDelete("/model-aliases/"+t)}async impact(t){return this.httpGet("/model-aliases/"+t+"/impact")}async check(t){return this.httpPost("/model-aliases/"+t+"/check")}async suggestions(t,e,s){const r={};return e&&(r.model=e),s!==void 0&&(r.limit=s),this.httpGet("/model-aliases/"+t+"/suggestions",r)}static inUse(t){var e,s;if(!(t instanceof l)||t.statusCode!==409)return null;try{const r=(s=(e=JSON.parse(t.body))==null?void 0:e.detail)==null?void 0:s.impact;return r&&typeof r.total=="number"?r:null}catch{return null}}}class q extends c{constructor(t,e){super(t,e)}async list(t={}){const{page:e,size:s}=this.normalizePageParams(t.page,t.size),r={page:e,size:s};return t.unreadOnly&&(r.unreadOnly=!0),t.includeResolved&&(r.includeResolved=!0),t.projectId&&(r.projectId=t.projectId),this.httpGet("/notifications",r)}async unreadCount(t){return(await this.httpGet("/notifications/unread-count",t?{projectId:t}:void 0)).count}async markRead(t){return this.httpPost("/notifications/"+t+"/read")}async markAllRead(t){await this.httpPost("/notifications/read-all",void 0,t?{projectId:t}:void 0)}}class D extends c{constructor(t,e){super(t,e)}async decide(t){return this.httpPost("/decisions",t)}async listModels(){return this.httpGet("/decision-models")}}class J{constructor(t,e,s){h(this,"baseUrl");h(this,"workflowsBaseUrl");h(this,"billingBaseUrl");this.baseUrl=t,this.workflowsBaseUrl=e,this.billingBaseUrl=s||"https://persona.applica.guru/billing"}projects(t){return new m(this.baseUrl,t,this.billingBaseUrl)}agents(t){return new P(this.baseUrl,t)}knowledgeBases(t){return new f(this.baseUrl,t)}workflows(t){return new G(this.workflowsBaseUrl,t)}credentials(t){return new A(this.baseUrl,t)}features(t){return new U(this.baseUrl,t)}triggers(t){return new S(this.baseUrl,t)}servicePrices(t){return new T(this.baseUrl,t)}markupRules(t){return new R(this.baseUrl,t)}providers(t){return new C(this.baseUrl,t)}sessions(t){return new I(this.baseUrl,t)}missions(t){return new E(this.baseUrl,t)}billing(t){return new B(this.billingBaseUrl,t)}modelAliases(t){return new O(this.baseUrl,t)}notifications(t){return new q(this.baseUrl,t)}decisions(t){return new D(this.baseUrl,t)}values(t){return new j(this.baseUrl,t)}}class L{constructor(t){this.token=t}applyHeaders(t){t.set("Authorization",`Bearer ${this.token}`)}getCredentials(){return this.token}}const d="alias:";function H(o){return!!o&&o.trim().toLowerCase().startsWith(d)}function F(o){if(!H(o))throw new Error(`Not a model alias reference: ${JSON.stringify(o)}`);return o.trim().slice(d.length).trim()}function K(o){return d+o.trim()}exports.ALIAS_PREFIX=d;exports.AgentsApi=P;exports.ApiException=l;exports.ApiKeyAuthenticationProvider=y;exports.BearerTokenAuthenticationProvider=L;exports.BillingClient=B;exports.ChannelsApi=k;exports.CredentialsApi=A;exports.DecisionsApi=D;exports.FeatureTemplatesApi=z;exports.FeaturesApi=U;exports.HumanTasksApi=b;exports.KnowledgeBaseDocumentsApi=w;exports.KnowledgeBasesApi=f;exports.MarkupRulesApi=R;exports.MissionsApi=E;exports.ModelAliasesApi=O;exports.NotificationsApi=q;exports.PersonaSdk=J;exports.ProjectsApi=m;exports.ProvidersApi=C;exports.ServicePricesApi=T;exports.SessionsApi=I;exports.TriggerExecutionsApi=x;exports.TriggersApi=S;exports.ValuesApi=j;exports.WorkflowExecutionsApi=v;exports.WorkflowsApi=G;exports.aliasNameFromRef=F;exports.aliasRef=K;exports.isAliasRef=H;
2
2
  //# sourceMappingURL=bundle.cjs.js.map