agent-window 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/instance/pm2-bridge.js +62 -30
- package/src/core/platform/pm2-bridge.js +4 -14
- package/web/dist/assets/Dashboard-BYj0Pp4o.js +1 -0
- package/web/dist/assets/{Dashboard-DRg2tFpk.css → Dashboard-CEY00ieb.css} +1 -1
- package/web/dist/assets/{InstanceDetail-BWV1wz24.js → InstanceDetail-BmSQ90cB.js} +1 -1
- package/web/dist/assets/{Instances-D4SbRoep.js → Instances-C9LSVRYH.js} +1 -1
- package/web/dist/assets/{Settings-CdoSWOhM.js → Settings-CSFUWlVq.js} +1 -1
- package/web/dist/assets/{main-BKf0mqau.js → main-DueA0WJ5.js} +2 -2
- package/web/dist/index.html +1 -1
- package/web/dist/assets/Dashboard-1TTWybTq.js +0 -1
package/package.json
CHANGED
|
@@ -174,52 +174,84 @@ export async function getStatus(name) {
|
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
//
|
|
178
|
-
|
|
177
|
+
// Initialize health status
|
|
178
|
+
const healthStatus = {
|
|
179
179
|
pm2: proc.status === 'online',
|
|
180
180
|
discord: false,
|
|
181
181
|
docker: false,
|
|
182
182
|
overall: 'stopped'
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
+
let containerName = null;
|
|
186
|
+
const procStatus = proc.status || 'stopped';
|
|
187
|
+
|
|
188
|
+
// Get container name from config for Docker check
|
|
185
189
|
try {
|
|
186
190
|
const { readFileSync } = await import('fs');
|
|
187
|
-
const
|
|
188
|
-
const configPath = proc.configPath; // Use configPath from platform abstraction layer
|
|
191
|
+
const configPath = proc.configPath;
|
|
189
192
|
|
|
190
193
|
if (configPath) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const configContent = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
194
|
-
const projectDir = configContent.PROJECT_DIR;
|
|
195
|
-
|
|
196
|
-
if (projectDir) {
|
|
197
|
-
// Health file is in the project directory
|
|
198
|
-
const healthFile = join(projectDir, '.health-status.json');
|
|
199
|
-
|
|
200
|
-
if (existsSync(healthFile)) {
|
|
201
|
-
const healthData = JSON.parse(readFileSync(healthFile, 'utf-8'));
|
|
202
|
-
healthStatus = {
|
|
203
|
-
pm2: proc.status === 'online',
|
|
204
|
-
discord: healthData.discord || false,
|
|
205
|
-
docker: healthData.docker || false,
|
|
206
|
-
overall: healthData.docker ? 'healthy' : 'degraded'
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
} catch (e) {
|
|
211
|
-
console.debug('[Health] Could not read project from config:', e.message);
|
|
212
|
-
}
|
|
194
|
+
const configContent = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
195
|
+
containerName = configContent.workspace?.containerName || null;
|
|
213
196
|
}
|
|
214
197
|
} catch (e) {
|
|
215
|
-
|
|
216
|
-
|
|
198
|
+
console.debug('[Status] Could not read config for container name:', e.message);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Check Docker container status (always check, don't rely on stale health file)
|
|
202
|
+
let dockerRunning = false;
|
|
203
|
+
if (containerName && procStatus === 'online') {
|
|
204
|
+
try {
|
|
205
|
+
const { execSync } = await import('child_process');
|
|
206
|
+
const result = execSync(
|
|
207
|
+
`docker inspect -f '{{.State.Running}}' ${containerName} 2>/dev/null`,
|
|
208
|
+
{ encoding: 'utf-8', timeout: 5000 }
|
|
209
|
+
).trim();
|
|
210
|
+
dockerRunning = result === 'true';
|
|
211
|
+
} catch (e) {
|
|
212
|
+
// Docker container not running or doesn't exist
|
|
213
|
+
dockerRunning = false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
healthStatus.docker = dockerRunning;
|
|
218
|
+
healthStatus.pm2 = procStatus === 'online';
|
|
219
|
+
|
|
220
|
+
// Determine overall status based on PM2 + Docker combination
|
|
221
|
+
if (procStatus === 'stopped') {
|
|
222
|
+
healthStatus.overall = 'stopped';
|
|
223
|
+
} else if (procStatus === 'errored' || procStatus === 'stopped') {
|
|
224
|
+
healthStatus.overall = 'error';
|
|
225
|
+
} else if (procStatus === 'online') {
|
|
226
|
+
if (dockerRunning) {
|
|
227
|
+
healthStatus.overall = 'healthy';
|
|
228
|
+
} else if (containerName) {
|
|
229
|
+
// Has container name but container not running = degraded
|
|
230
|
+
healthStatus.overall = 'degraded';
|
|
231
|
+
} else {
|
|
232
|
+
// No container configured (simple instance without Docker)
|
|
233
|
+
healthStatus.overall = 'healthy';
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
healthStatus.overall = 'unknown';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Determine display status (what frontend shows)
|
|
240
|
+
let displayStatus = procStatus;
|
|
241
|
+
if (procStatus === 'online') {
|
|
242
|
+
if (dockerRunning) {
|
|
243
|
+
displayStatus = 'running';
|
|
244
|
+
} else if (containerName) {
|
|
245
|
+
displayStatus = 'degraded'; // PM2 running but Docker down
|
|
246
|
+
} else {
|
|
247
|
+
displayStatus = 'running'; // No Docker, just PM2
|
|
248
|
+
}
|
|
217
249
|
}
|
|
218
250
|
|
|
219
|
-
// platformPM2 returns simplified format with direct properties
|
|
220
251
|
return {
|
|
221
252
|
name: proc.name,
|
|
222
|
-
status:
|
|
253
|
+
status: displayStatus,
|
|
254
|
+
pm2Status: procStatus, // Expose raw PM2 status separately
|
|
223
255
|
exists: true,
|
|
224
256
|
pid: proc.pid,
|
|
225
257
|
uptime: proc.uptime || 0,
|
|
@@ -129,20 +129,10 @@ async function start(scriptPath, options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// Default: max 10 restarts, then stop
|
|
137
|
-
args.push('--max-restarts', '10');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (options.minUptime !== undefined) {
|
|
141
|
-
args.push('--min-uptime', String(options.minUptime));
|
|
142
|
-
} else {
|
|
143
|
-
// Default: must run at least 10 seconds to be considered stable
|
|
144
|
-
args.push('--min-uptime', '10s');
|
|
145
|
-
}
|
|
132
|
+
// Note: PM2 CLI doesn't support --max-restarts or --min-uptime as direct options
|
|
133
|
+
// These must be set via ecosystem config file or app configuration
|
|
134
|
+
// For now, we skip these to avoid errors
|
|
135
|
+
// Users can configure restart behavior in ecosystem.config.js
|
|
146
136
|
|
|
147
137
|
if (options.instances) {
|
|
148
138
|
args.push('-i', String(options.instances));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{aA as Ne,j as re,ab as p,y as d,z as C,D as a,E as t,R as u,G as oe,B as y,P as R,J,a5 as G,c as w,r as f,Q as g,u as W,C as s,aw as Ve,am as Te}from"./vue-vendor-CGSlMM3Y.js";import{d as $e,p as ie,r as Ie}from"./element-plus-CSm40ime.js";import{a as x,u as de}from"./main-DueA0WJ5.js";import{_ as ue}from"./_plugin-vue_export-helper-DlAUqK2U.js";const De={class:"card-header"},Pe={class:"header-left"},je={class:"instance-info"},Ae={class:"instance-name"},Me={class:"instance-alias"},Re={class:"status-label"},Be={class:"card-body"},Ee={class:"info-row"},Se={class:"info-row"},Ue={class:"value"},Oe={key:0,class:"stats-row"},Fe={class:"stat"},Le={class:"stat-value"},qe={class:"stat"},ze={class:"stat-value"},He={key:0,class:"stat"},Ke={class:"stat-value"},We={key:1,class:"tags-row"},Je={class:"card-actions"},Ge={class:"action-buttons"},Qe=["disabled"],Ye=["disabled"],Xe=["disabled"],Ze={__name:"InstanceCard",props:{instance:{type:Object,required:!0}},setup(D,{expose:O}){const v=D,V=Ne(),{success:P,error:_}=de(),c=f({status:"loading",exists:!1,memory:0,cpu:0,uptime:0}),B=f(null),j=f(!1),E=w(()=>{const o=c.value.status,i=c.value.health;return o==="loading"?"loading":o==="error"||o==="errored"?"error":o==="degraded"||(i==null?void 0:i.overall)==="degraded"?"degraded":o==="running"||o==="online"?"online":o==="stopped"?"stopped":o==="restarting"?"restarting":"stopped"}),S=w(()=>{const o=c.value.status;return c.value.health,o==="loading"?"Loading...":{running:"Running",online:"Running",degraded:"Degraded (Docker Down)",stopped:"Stopped",error:"Error",errored:"Error",restarting:"Restarting"}[o]||o||"Unknown"}),h=w(()=>{const o=v.instance.projectPath;return o.length>35?"..."+o.slice(-32):o}),U=w(()=>({"bmad-plugin":"BMAD 插件","simple-config":"基础版"})[v.instance.instanceType]||"基础版"),N=w(()=>`type-${v.instance.instanceType}`);async function k(){if(!j.value){j.value=!0;try{const o=await x.getInstanceStatus(v.instance.name);o&&o.status&&(c.value=o,B.value=o)}catch(o){B.value?console.debug("[InstanceCard] API error, using cached status:",o.message):console.debug("[InstanceCard] Failed to load initial status:",o.message)}finally{j.value=!1}}}async function F(){try{await x.startInstance(v.instance.name),P("Started",`${v.instance.name} has been started`),await k()}catch(o){_("Failed to start",o.message)}}async function A(){try{await x.stopInstance(v.instance.name),P("Stopped",`${v.instance.name} has been stopped`),await k()}catch(o){_("Failed to stop",o.message)}}async function l(){try{await x.restartInstance(v.instance.name),P("Restarted",`${v.instance.name} has been restarted`),await k()}catch(o){_("Failed to restart",o.message)}}function Q(){V.push(`/instances/${v.instance.name}`)}function q(o){const i=o/1024/1024;return i>=1024?(i/1024).toFixed(1)+" GB":Math.round(i)+" MB"}function Y(o){if(!o)return"-";const i=Math.floor((Date.now()-o)/1e3);return i<60?`${i}s`:i<3600?`${Math.floor(i/60)}m`:i<86400?`${Math.floor(i/3600)}h`:`${Math.floor(i/86400)}d`}return re(()=>{k();const o=setInterval(k,1e4);return()=>clearInterval(o)}),O({fetchStatus:k}),(o,i)=>{const X=p("el-card");return d(),C(X,{class:"instance-card"},{default:a(()=>{var z;return[t("div",De,[t("div",Pe,[i[0]||(i[0]=t("div",{class:"instance-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),t("circle",{cx:"12",cy:"12",r:"3"})])],-1)),t("div",je,[t("h3",Ae,u(D.instance.displayName||D.instance.name),1),t("span",Me,u(D.instance.name),1)])]),t("div",{class:oe(["status-indicator",E.value])},[i[1]||(i[1]=t("span",{class:"status-dot"},null,-1)),t("span",Re,u(S.value),1)],2)]),t("div",Be,[t("div",Ee,[i[2]||(i[2]=t("span",{class:"label"},"Type",-1)),t("span",{class:oe(["value instance-type",N.value])},u(U.value),3)]),t("div",Se,[i[3]||(i[3]=t("span",{class:"label"},"Path",-1)),t("span",Ue,u(h.value),1)]),c.value.exists?(d(),y("div",Oe,[t("div",Fe,[i[4]||(i[4]=t("span",{class:"stat-label"},"Memory",-1)),t("span",Le,u(q(c.value.memory)),1)]),t("div",qe,[i[5]||(i[5]=t("span",{class:"stat-label"},"CPU",-1)),t("span",ze,u(c.value.cpu)+"%",1)]),c.value.status==="online"?(d(),y("div",He,[i[6]||(i[6]=t("span",{class:"stat-label"},"Uptime",-1)),t("span",Ke,u(Y(c.value.uptime)),1)])):R("",!0)])):R("",!0),(z=D.instance.tags)!=null&&z.length?(d(),y("div",We,[(d(!0),y(J,null,G(D.instance.tags,M=>(d(),y("span",{key:M,class:"tag"},u(M),1))),128))])):R("",!0)]),t("div",Je,[t("div",Ge,[t("button",{class:"action-btn",disabled:c.value.status==="online"||c.value.status==="loading",title:"Start",onClick:F},[...i[7]||(i[7]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("polygon",{points:"5 3 19 12 5 21 5 3"})],-1)])],8,Qe),t("button",{class:"action-btn",disabled:c.value.status!=="online"||c.value.status==="loading",title:"Stop",onClick:A},[...i[8]||(i[8]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("rect",{x:"6",y:"4",width:"4",height:"16"}),t("rect",{x:"14",y:"4",width:"4",height:"16"})],-1)])],8,Ye),t("button",{class:"action-btn",disabled:c.value.status==="loading",title:"Restart",onClick:l},[...i[9]||(i[9]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("polyline",{points:"23 4 23 10 17 10"}),t("polyline",{points:"1 20 1 14 7 14"}),t("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})],-1)])],8,Xe)]),t("button",{class:"details-btn",onClick:Q}," Details ")])]}),_:1})}}},et=ue(Ze,[["__scopeId","data-v-f29ac840"]]),tt={class:"dashboard-view"},at={class:"dashboard-header"},st={class:"header-actions"},nt={class:"stat-content"},lt={class:"stat-info"},ot={class:"stat-value"},it={class:"stat-content"},rt={class:"stat-info"},dt={class:"stat-value"},ut={class:"stat-content"},ct={class:"stat-info"},pt={class:"stat-value"},vt={class:"stat-content"},mt={class:"stat-info"},ft={class:"stat-value"},gt={key:0,class:"loading-state"},ht={key:1,class:"empty-state"},yt={key:0,class:"loading-state"},wt={key:1,class:"empty-discovered"},_t={style:{display:"flex","align-items":"center",gap:"8px"}},kt={class:"dialog-footer"},bt={class:"footer-left"},Ct={key:0,class:"validation-summary"},xt={class:"footer-right"},Nt={key:0},Vt={class:"check-item"},Tt={class:"check-name"},$t={class:"check-message"},It={__name:"Dashboard",setup(D){const{success:O,error:v}=de(),V=f([]),P=f(!0),_=f(!1),c=f(!1),B=f(!1),j=f(!1),E=f(null),S=f(!1),h=f(null),U=f([]),N=f([]),k=f(!1),F=f(null),A=f([]),l=f({name:"",displayName:"",projectPath:"",botToken:"",oauthToken:"",allowedChannels:"",containerName:"",tagsInput:""}),Q={name:[{required:!0,message:"Name is required"},{pattern:/^[a-z0-9-]+$/,message:"Only lowercase letters, numbers, and hyphens"}],projectPath:[{required:!0,message:"Project path is required"}],botToken:[{required:!0,message:"Discord Bot Token is required"}],oauthToken:[{required:!0,message:"Claude OAuth Token is required"},{pattern:/^sk-ant-/,message:"Token must start with sk-ant-"}],allowedChannels:[{required:!0,message:"Allowed Channels is required"}]},q=w(()=>V.value.filter(r=>r.enabled).length),Y=w(()=>V.value.length-q.value),o=w(()=>0),i=w(()=>N.value.length>0),X=w(()=>N.value.length),z=w(()=>h.value?h.value.checks.filter(r=>r.status==="passed"):[]);async function M(){P.value=!0;try{V.value=await x.getInstances(),await ee()}catch(r){v("Failed to load",r.message)}finally{P.value=!1}}async function ee(){try{const r=await x.discoverInstances();N.value=r.discovered||[]}catch{N.value=[]}}async function ce(){k.value=!0;try{await ee()}catch(r){v("Discovery failed",r.message)}finally{k.value=!1}}async function pe(r){F.value=r.name;try{await x.importInstance({name:r.name,botName:r.botName,displayName:r.displayName,projectPath:r.projectPath}),A.value.push(r.name),O("Imported",`Instance "${r.displayName}" has been imported`),await M(),A.value.length>=N.value.length&&(c.value=!1,A.value=[])}catch(e){v("Import failed",e.message)}finally{F.value=null}}async function te(){var e;if(await((e=E.value)==null?void 0:e.validate().catch(()=>!1))){B.value=!0;try{const m=l.value.tagsInput?l.value.tagsInput.split(",").map(H=>H.trim()).filter(Boolean):[],T=l.value.containerName||`bot-${l.value.name}`,b={BOT_TOKEN:l.value.botToken,CLAUDE_CODE_OAUTH_TOKEN:l.value.oauthToken,PROJECT_DIR:l.value.projectPath,ALLOWED_CHANNELS:l.value.allowedChannels,workspace:{containerName:T}};await x.addInstance({name:l.value.name,displayName:l.value.displayName||l.value.name,projectPath:l.value.projectPath,tags:m,config:b,createConfig:!0}),O("Added",`Instance "${l.value.name}" has been added`),_.value=!1,se(),await M()}catch(m){v("Failed to add",m.message)}finally{B.value=!1}}}function ae(){_.value=!1,se()}function se(){var r;l.value={name:"",displayName:"",projectPath:"",botToken:"",oauthToken:"",allowedChannels:"",containerName:"",tagsInput:""},(r=E.value)==null||r.clearValidate(),h.value=null}async function ve(r){if(r&&U.value.length===0)try{const e=await x.getClaudeTokens();e.success&&(U.value=e.tokens)}catch(e){console.error("Failed to load tokens:",e)}}function me(r){l.value.oauthToken=r.token,O("Token Copied",`Claude token from "${r.displayName}" has been applied`)}async function fe(){var e;if(!await((e=E.value)==null?void 0:e.validate().catch(()=>!1))){v("Validation Failed","Please fix form errors first");return}j.value=!0;try{const m=l.value.containerName||`bot-${l.value.name}`,T={BOT_TOKEN:l.value.botToken,CLAUDE_CODE_OAUTH_TOKEN:l.value.oauthToken,PROJECT_DIR:l.value.projectPath,ALLOWED_CHANNELS:l.value.allowedChannels,workspace:{containerName:m}},b=await x.validateConfig({config:T,projectPath:l.value.projectPath});h.value=b,S.value=!0,b.success||v("Validation Failed","Some checks did not pass. Please review the results.")}catch(m){v("Validation Error",m.message)}finally{j.value=!1}}return re(()=>{M();const r=setInterval(M,3e4);return()=>clearInterval(r)}),(r,e)=>{const m=p("el-button"),T=p("el-card"),b=p("el-col"),H=p("el-row"),ne=p("el-skeleton"),L=p("el-table-column"),K=p("el-tag"),ge=p("el-table"),Z=p("el-dialog"),$=p("el-input"),I=p("el-form-item"),he=p("el-divider"),le=p("el-dropdown-item"),ye=p("el-dropdown-menu"),we=p("el-dropdown"),_e=p("el-form"),ke=p("el-alert"),be=p("el-timeline-item"),Ce=p("el-timeline");return d(),y("div",tt,[t("div",at,[e[17]||(e[17]=t("div",null,[t("h1",null,"Dashboard"),t("p",{class:"subtitle"},"Manage your AgentWindow bot instances")],-1)),t("div",st,[i.value?(d(),C(m,{key:0,type:"info",icon:W($e),onClick:e[0]||(e[0]=n=>c.value=!0)},{default:a(()=>[g(" Import "+u(X.value)+" Running ",1)]),_:1},8,["icon"])):R("",!0),s(m,{type:"primary",icon:W(ie),onClick:e[1]||(e[1]=n=>_.value=!0)},{default:a(()=>[...e[16]||(e[16]=[g(" Add Instance ",-1)])]),_:1},8,["icon"])])]),s(H,{gutter:16,class:"stats-row"},{default:a(()=>[s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card"},{default:a(()=>[t("div",nt,[e[19]||(e[19]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M8 12H16M12 8V16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),t("div",lt,[t("span",ot,u(V.value.length),1),e[18]||(e[18]=t("span",{class:"stat-label"},"Total",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card success"},{default:a(()=>[t("div",it,[e[21]||(e[21]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})])],-1)),t("div",rt,[t("span",dt,u(q.value),1),e[20]||(e[20]=t("span",{class:"stat-label"},"Running",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card warning"},{default:a(()=>[t("div",ut,[e[23]||(e[23]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1",fill:"currentColor"})])],-1)),t("div",ct,[t("span",pt,u(Y.value),1),e[22]||(e[22]=t("span",{class:"stat-label"},"Stopped",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card danger"},{default:a(()=>[t("div",vt,[e[25]||(e[25]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M12 9V12M12 16H12.01M5.29289 5.29289C2.99071 7.59508 2.19023 11.0184 3.27489 14.1236C4.35955 17.2288 7.19773 19.3613 10.4872 19.8428C13.7766 20.3242 17.0854 19.0828 19.0841 16.5841C21.0828 14.0854 21.4793 10.6367 20.1277 7.74488C18.7761 4.85303 15.8963 3.01887 12.7108 3.09219C9.52524 3.16552 6.73669 5.13405 5.51838 8.08105",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),t("div",mt,[t("span",ft,u(o.value),1),e[24]||(e[24]=t("span",{class:"stat-label"},"Errors",-1))])])]),_:1})]),_:1})]),_:1}),P.value?(d(),y("div",gt,[s(ne,{rows:3,animated:""})])):V.value.length===0?(d(),y("div",ht,[e[27]||(e[27]=Ve('<div class="empty-icon" data-v-d703c50e><svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d703c50e><rect x="8" y="8" width="48" height="48" rx="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-d703c50e></rect><rect x="16" y="16" width="16" height="16" rx="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.3" data-v-d703c50e></rect><path d="M32 32L48 48" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-d703c50e></path><circle cx="48" cy="16" r="3" fill="currentColor" fill-opacity="0.2" data-v-d703c50e></circle></svg></div><h3 data-v-d703c50e>No instances yet</h3><p data-v-d703c50e>Add your first AgentWindow bot instance to get started</p>',3)),s(m,{type:"primary",icon:W(ie),onClick:e[2]||(e[2]=n=>_.value=!0)},{default:a(()=>[...e[26]||(e[26]=[g(" Add Instance ",-1)])]),_:1},8,["icon"])])):(d(),C(H,{key:2,gutter:16,class:"instances-grid"},{default:a(()=>[(d(!0),y(J,null,G(V.value,n=>(d(),C(b,{key:n.name,xs:24,sm:12,lg:8},{default:a(()=>[s(et,{instance:n},null,8,["instance"])]),_:2},1024))),128))]),_:1})),s(Z,{modelValue:c.value,"onUpdate:modelValue":e[4]||(e[4]=n=>c.value=n),title:"Import Running Instances",width:"600px"},{footer:a(()=>[s(m,{onClick:e[3]||(e[3]=n=>c.value=!1)},{default:a(()=>[...e[30]||(e[30]=[g("Close",-1)])]),_:1}),s(m,{type:"primary",icon:W(Ie),onClick:ce},{default:a(()=>[...e[31]||(e[31]=[g("Refresh",-1)])]),_:1},8,["icon"])]),default:a(()=>[e[32]||(e[32]=t("div",{class:"discover-info"},[t("p",null,"The following bot instances are running in PM2 but not yet registered:")],-1)),k.value?(d(),y("div",yt,[s(ne,{rows:2,animated:""})])):N.value.length===0?(d(),y("div",wt,[...e[28]||(e[28]=[t("p",null,"No unregistered instances found.",-1)])])):(d(),C(ge,{key:2,data:N.value,stripe:"",style:{width:"100%"}},{default:a(()=>[s(L,{prop:"displayName",label:"Name",width:"140"}),s(L,{prop:"botName",label:"PM2 Name",width:"130"}),s(L,{label:"Status",width:"90"},{default:a(({row:n})=>[n.isRunning?(d(),C(K,{key:0,type:"success",size:"small"},{default:a(()=>[...e[29]||(e[29]=[g("Running",-1)])]),_:1})):(d(),C(K,{key:1,type:"info",size:"small"},{default:a(()=>[g(u(n.status),1)]),_:2},1024))]),_:1}),s(L,{prop:"projectPath",label:"Path","show-overflow-tooltip":""}),s(L,{label:"Action",width:"80",align:"center"},{default:a(({row:n})=>[s(m,{type:"primary",size:"small",loading:F.value===n.name,disabled:A.value.includes(n.name),onClick:xe=>pe(n)},{default:a(()=>[g(u(A.value.includes(n.name)?"Done":"Import"),1)]),_:2},1032,["loading","disabled","onClick"])]),_:1})]),_:1},8,["data"]))]),_:1},8,["modelValue"]),s(Z,{modelValue:_.value,"onUpdate:modelValue":e[13]||(e[13]=n=>_.value=n),title:"Add Instance",width:"500px","before-close":ae},{footer:a(()=>[t("div",kt,[t("div",bt,[s(m,{loading:j.value,onClick:fe},{default:a(()=>[...e[39]||(e[39]=[g(" Test Config ",-1)])]),_:1},8,["loading"]),h.value?(d(),y("div",Ct,[s(K,{type:h.value.success?"success":"danger",size:"small"},{default:a(()=>[g(u(h.value.success?"Ready":"Issues Found"),1)]),_:1},8,["type"])])):R("",!0)]),t("div",xt,[s(m,{onClick:ae},{default:a(()=>[...e[40]||(e[40]=[g("Cancel",-1)])]),_:1}),s(m,{type:"primary",loading:B.value,disabled:h.value&&!h.value.success,onClick:te},{default:a(()=>[...e[41]||(e[41]=[g(" Add Instance ",-1)])]),_:1},8,["loading","disabled"])])])]),default:a(()=>[s(_e,{ref_key:"formRef",ref:E,model:l.value,rules:Q,"label-width":"100px"},{default:a(()=>[s(I,{label:"Name",prop:"name"},{default:a(()=>[s($,{modelValue:l.value.name,"onUpdate:modelValue":e[5]||(e[5]=n=>l.value.name=n),placeholder:"my-bot",onKeyup:Te(te,["enter"])},null,8,["modelValue"])]),_:1}),s(I,{label:"Display Name",prop:"displayName"},{default:a(()=>[s($,{modelValue:l.value.displayName,"onUpdate:modelValue":e[6]||(e[6]=n=>l.value.displayName=n),placeholder:"My Bot"},null,8,["modelValue"])]),_:1}),s(I,{label:"Project Path",prop:"projectPath"},{default:a(()=>[s($,{modelValue:l.value.projectPath,"onUpdate:modelValue":e[7]||(e[7]=n=>l.value.projectPath=n),placeholder:"/path/to/project"},null,8,["modelValue"]),e[33]||(e[33]=t("div",{class:"form-hint"},"Directory where bot config will be stored",-1))]),_:1}),s(he,{"content-position":"left"},{default:a(()=>[...e[34]||(e[34]=[g("Bot Configuration",-1)])]),_:1}),s(I,{label:"Discord Bot Token",prop:"botToken"},{default:a(()=>[s($,{modelValue:l.value.botToken,"onUpdate:modelValue":e[8]||(e[8]=n=>l.value.botToken=n),type:"password",placeholder:"Your Discord bot token","show-password":""},null,8,["modelValue"])]),_:1}),s(I,{label:"Claude OAuth Token",prop:"oauthToken"},{default:a(()=>[s($,{modelValue:l.value.oauthToken,"onUpdate:modelValue":e[9]||(e[9]=n=>l.value.oauthToken=n),type:"password",placeholder:"sk-ant-...","show-password":""},{append:a(()=>[s(we,{trigger:"click",onVisibleChange:ve},{dropdown:a(()=>[s(ye,null,{default:a(()=>[U.value.length===0?(d(),C(le,{key:0,disabled:""},{default:a(()=>[...e[36]||(e[36]=[g(" No tokens available ",-1)])]),_:1})):R("",!0),(d(!0),y(J,null,G(U.value,n=>(d(),C(le,{key:n.instanceName,onClick:xe=>me(n)},{default:a(()=>[t("div",_t,[t("span",null,u(n.displayName),1),s(K,{size:"small",type:"info"},{default:a(()=>[g(u(n.maskedToken),1)]),_:2},1024)])]),_:2},1032,["onClick"]))),128))]),_:1})]),default:a(()=>[s(m,null,{default:a(()=>[...e[35]||(e[35]=[g(" Copy from... ",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"]),e[37]||(e[37]=t("div",{class:"form-hint"},"Reuse token from existing instances",-1))]),_:1}),s(I,{label:"Allowed Channels",prop:"allowedChannels"},{default:a(()=>[s($,{modelValue:l.value.allowedChannels,"onUpdate:modelValue":e[10]||(e[10]=n=>l.value.allowedChannels=n),placeholder:"channel-id-1,channel-id-2"},null,8,["modelValue"]),e[38]||(e[38]=t("div",{class:"form-hint"},"Comma-separated Discord channel IDs",-1))]),_:1}),s(I,{label:"Container Name",prop:"containerName"},{default:a(()=>[s($,{modelValue:l.value.containerName,"onUpdate:modelValue":e[11]||(e[11]=n=>l.value.containerName=n),placeholder:"bot-my-bot (auto-generated if empty)"},null,8,["modelValue"])]),_:1}),s(I,{label:"Tags",prop:"tags"},{default:a(()=>[s($,{modelValue:l.value.tagsInput,"onUpdate:modelValue":e[12]||(e[12]=n=>l.value.tagsInput=n),placeholder:"prod, staging (comma separated)"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),s(Z,{modelValue:S.value,"onUpdate:modelValue":e[15]||(e[15]=n=>S.value=n),title:"Configuration Validation Results",width:"600px"},{footer:a(()=>[s(m,{onClick:e[14]||(e[14]=n=>S.value=!1)},{default:a(()=>[...e[42]||(e[42]=[g("Close",-1)])]),_:1})]),default:a(()=>[h.value?(d(),y("div",Nt,[s(ke,{type:h.value.success?"success":"warning",title:h.value.success?"All checks passed!":"Some checks failed",closable:!1,style:{"margin-bottom":"20px"}},{default:a(()=>[t("div",null," Passed: "+u(z.value.length)+" / "+u(h.value.checks.length),1)]),_:1},8,["type","title"]),s(Ce,null,{default:a(()=>[(d(!0),y(J,null,G(h.value.checks,n=>(d(),C(be,{key:n.name,type:n.status==="passed"?"success":n.status==="failed"?"danger":"warning"},{default:a(()=>[t("div",Vt,[t("div",Tt,u(n.name),1),t("div",$t,u(n.message),1)])]),_:2},1032,["type"]))),128))]),_:1})])):R("",!0)]),_:1},8,["modelValue"])])}}},Mt=ue(It,[["__scopeId","data-v-d703c50e"]]);export{Mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.instance-card[data-v-
|
|
1
|
+
.instance-card[data-v-f29ac840]{height:100%;transition:all var(--aw-transition-base)}.instance-card[data-v-f29ac840]:hover{transform:translateY(-2px)}.card-header[data-v-f29ac840]{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.header-left[data-v-f29ac840]{display:flex;align-items:center;gap:12px}.header-left .instance-icon[data-v-f29ac840]{display:flex;align-items:center;justify-content:center;width:40px;height:40px;background:var(--aw-bg-secondary);border-radius:var(--aw-radius-md);color:var(--aw-accent)}.header-left .instance-name[data-v-f29ac840]{margin:0;font-size:15px;font-weight:600;color:var(--aw-text-primary);letter-spacing:-.01em}.header-left .instance-alias[data-v-f29ac840]{font-size:12px;color:var(--aw-text-secondary)}.status-indicator[data-v-f29ac840]{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:12px;font-size:12px;font-weight:500}.status-indicator .status-dot[data-v-f29ac840]{width:6px;height:6px;border-radius:50%;background:currentColor}.status-indicator.online[data-v-f29ac840]{background:#34c7591a;color:var(--aw-status-online)}.status-indicator.stopped[data-v-f29ac840]{background:#8e8e931a;color:var(--aw-status-stopped)}.status-indicator.loading[data-v-f29ac840]{background:#5c5c611a;color:var(--aw-status-stopped);animation:pulse-f29ac840 1.5s ease-in-out infinite}.status-indicator.error[data-v-f29ac840]{background:#ff3b301a;color:var(--aw-status-error)}.status-indicator.restarting[data-v-f29ac840]{background:#ff95001a;color:var(--aw-status-restarting)}.status-indicator.degraded[data-v-f29ac840]{background:#ff95001a;color:#ff9500}.status-indicator.warning[data-v-f29ac840]{background:#ffcc001a;color:#fc0}@keyframes pulse-f29ac840{0%,to{opacity:1}50%{opacity:.5}}.card-body[data-v-f29ac840]{display:flex;flex-direction:column;gap:12px;margin-bottom:16px}.info-row[data-v-f29ac840]{display:flex;justify-content:space-between;align-items:center}.info-row .label[data-v-f29ac840]{font-size:12px;color:var(--aw-text-secondary)}.info-row .value[data-v-f29ac840]{font-size:12px;font-family:SF Mono,Monaco,Cascadia Code,monospace;color:var(--aw-text-primary)}.info-row .value.instance-type[data-v-f29ac840]{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-weight:500;padding:2px 8px;border-radius:4px;font-size:11px}.info-row .value.instance-type.type-bmad-plugin[data-v-f29ac840]{background:#34c75926;color:#34c759}.info-row .value.instance-type.type-simple-config[data-v-f29ac840]{background:#5e5ce626;color:#5e5ce6}.info-row .value.instance-type.type-standalone[data-v-f29ac840]{background:#ff9f0a26;color:#ff9f0a}.stats-row[data-v-f29ac840]{display:flex;justify-content:space-around;padding:12px 0;border-top:1px solid var(--aw-bg-tertiary);border-bottom:1px solid var(--aw-bg-tertiary)}.stat[data-v-f29ac840]{display:flex;flex-direction:column;align-items:center;gap:4px}.stat .stat-label[data-v-f29ac840]{font-size:10px;color:var(--aw-text-secondary);text-transform:uppercase;letter-spacing:.05em}.stat .stat-value[data-v-f29ac840]{font-size:14px;font-weight:600;color:var(--aw-text-primary)}.tags-row[data-v-f29ac840]{display:flex;gap:6px;flex-wrap:wrap}.tags-row .tag[data-v-f29ac840]{padding:3px 8px;font-size:11px;font-weight:500;background:var(--aw-bg-secondary);color:var(--aw-text-secondary);border-radius:6px}.card-actions[data-v-f29ac840]{display:flex;justify-content:space-between;align-items:center;padding-top:12px;border-top:1px solid var(--aw-bg-tertiary)}.action-buttons[data-v-f29ac840]{display:flex;gap:4px}.action-btn[data-v-f29ac840]{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;background:transparent;border-radius:var(--aw-radius-sm);color:var(--aw-text-secondary);cursor:pointer;transition:all var(--aw-transition-fast)}.action-btn[data-v-f29ac840]:hover:not(:disabled){background:var(--aw-bg-secondary);color:var(--aw-text-primary)}.action-btn[data-v-f29ac840]:disabled{opacity:.4;cursor:not-allowed}.action-btn[data-v-f29ac840]:active:not(:disabled){transform:scale(.95)}.details-btn[data-v-f29ac840]{padding:8px 14px;font-size:13px;font-weight:500;color:var(--aw-accent);background:transparent;border:none;border-radius:var(--aw-radius-sm);cursor:pointer;transition:background var(--aw-transition-fast)}.details-btn[data-v-f29ac840]:hover{background:#0071e31a}.dashboard-view[data-v-d703c50e]{display:flex;flex-direction:column;gap:24px}.dashboard-header[data-v-d703c50e]{display:flex;justify-content:space-between;align-items:flex-start}.dashboard-header .header-actions[data-v-d703c50e]{display:flex;gap:12px}.dashboard-header h1[data-v-d703c50e]{margin:0;font-size:28px;font-weight:600}.dashboard-header .subtitle[data-v-d703c50e]{margin:4px 0 0;color:var(--el-text-color-secondary)}.discover-info[data-v-d703c50e]{padding:0 0 16px;color:var(--el-text-color-secondary);font-size:14px}.empty-discovered[data-v-d703c50e]{padding:40px 0;text-align:center;color:var(--el-text-color-secondary)}.stats-row .stat-card[data-v-d703c50e]{background:linear-gradient(135deg,var(--el-bg-color) 0%,var(--el-bg-color-page) 100%)}.stats-row .stat-card.success[data-v-d703c50e]{border-left:3px solid var(--aw-success)}.stats-row .stat-card.warning[data-v-d703c50e]{border-left:3px solid var(--aw-warning)}.stats-row .stat-card.danger[data-v-d703c50e]{border-left:3px solid var(--aw-danger)}.stats-row .stat-content[data-v-d703c50e]{display:flex;align-items:center;gap:16px}.stats-row .stat-content .stat-icon[data-v-d703c50e]{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;color:var(--el-text-color-regular)}.stats-row .stat-content .stat-icon svg[data-v-d703c50e]{width:24px;height:24px}.stats-row .stat-content .stat-info[data-v-d703c50e]{display:flex;flex-direction:column}.stats-row .stat-content .stat-info .stat-value[data-v-d703c50e]{font-size:24px;font-weight:600;line-height:1}.stats-row .stat-content .stat-info .stat-label[data-v-d703c50e]{font-size:12px;color:var(--el-text-color-secondary)}.loading-state[data-v-d703c50e]{padding:40px 0}.empty-state[data-v-d703c50e]{display:flex;flex-direction:column;align-items:center;gap:16px;padding:80px 0}.empty-state .empty-icon[data-v-d703c50e]{display:inline-flex;align-items:center;justify-content:center;width:64px;height:64px;opacity:.5}.empty-state .empty-icon svg[data-v-d703c50e]{width:64px;height:64px}.empty-state h3[data-v-d703c50e]{margin:0;font-size:20px}.empty-state p[data-v-d703c50e]{margin:0;color:var(--el-text-color-secondary)}.instances-grid [class*=el-col][data-v-d703c50e]{margin-bottom:16px}.form-hint[data-v-d703c50e]{font-size:12px;color:var(--el-text-color-secondary);margin-top:4px}.dialog-footer[data-v-d703c50e]{display:flex;justify-content:space-between;align-items:center;width:100%}.dialog-footer .footer-left[data-v-d703c50e]{display:flex;align-items:center;gap:12px}.dialog-footer .footer-right[data-v-d703c50e]{display:flex;gap:8px}.validation-summary[data-v-d703c50e]{display:flex;align-items:center}.check-item .check-name[data-v-d703c50e]{font-weight:600;margin-bottom:4px}.check-item .check-message[data-v-d703c50e]{font-size:13px;color:var(--el-text-color-secondary)}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as g,j as re,W as be,f as ke,ab as r,y as u,B as m,E as o,C as t,D as n,Q as p,u as $,z as U,P,J as F,a5 as ue,G as ee,R as d,c as N,n as Ce,aB as xe,aA as Se}from"./vue-vendor-CGSlMM3Y.js";import{d as De,b as $e,f as Le,c as Ve,l as Ie,v as Te,e as Me,g as Ne,m as Be,a as Re}from"./element-plus-CSm40ime.js";import{a as T,u as Pe}from"./main-
|
|
1
|
+
import{r as g,j as re,W as be,f as ke,ab as r,y as u,B as m,E as o,C as t,D as n,Q as p,u as $,z as U,P,J as F,a5 as ue,G as ee,R as d,c as N,n as Ce,aB as xe,aA as Se}from"./vue-vendor-CGSlMM3Y.js";import{d as De,b as $e,f as Le,c as Ve,l as Ie,v as Te,e as Me,g as Ne,m as Be,a as Re}from"./element-plus-CSm40ime.js";import{a as T,u as Pe}from"./main-DueA0WJ5.js";import{_ as de}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Ue={class:"log-toolbar"},je={class:"toolbar-left"},ze={class:"toolbar-right"},Ee={key:0,class:"empty-logs"},Fe={class:"log-timestamp"},Ae={key:0,class:"log-type"},Oe={class:"log-message"},Je={key:1,class:"loading-logs"},qe={__name:"LogViewer",props:{instanceName:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:["expand","collapse"],setup(A,{emit:O}){const M=A,L=O,f=g([]),l=g(!1),v=g(!1),V=g(M.expanded),y=g("all"),k=g(""),C=g(null);let w=null;const B=N(()=>{let i=f.value;if(y.value!=="all"&&(i=i.filter(s=>String(s.data||s).toLowerCase().includes(y.value==="out"?"stdout":"stderr"))),k.value){const s=k.value.toLowerCase();i=i.filter(_=>String(_.data||_).toLowerCase().includes(s))}return i});function J(i){const s=String(i.data||i).toLowerCase();return s.includes("error")||s.includes("err")||i.type==="error"?"log-error":s.includes("warn")||i.type==="warning"?"log-warn":s.includes("info")?"log-info":""}function j(i){return i?new Date(i).toLocaleTimeString("en-US",{hour12:!1}):""}function z(i){i?x():E()}function x(){if(w)return;const i=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,_=`${i}//${s}/ws/logs/${M.instanceName}`;w=new WebSocket(_),w.onopen=()=>{l.value=!1},w.onmessage=h=>{try{const S=JSON.parse(h.data);S.type==="log"&&(f.value.push(S),f.value.length>1e3&&(f.value=f.value.slice(-1e3)),Ce(()=>{C.value&&(C.value.scrollTop=C.value.scrollHeight)}))}catch{f.value.push({data:h.data,timestamp:Date.now()})}},w.onerror=()=>{l.value=!1},w.onclose=()=>{w=null,v.value&&setTimeout(x,3e3)}}function E(){w&&(w.close(),w=null)}async function q(){l.value=!0;try{const s=await(await fetch(`/api/instances/${M.instanceName}/logs?lines=100`)).json();s.logs&&(f.value=s.logs.split(`
|
|
2
2
|
`).filter(_=>_.trim()).map(_=>({data:_,timestamp:Date.now()})))}catch{}finally{l.value=!1}}function H(){f.value=[]}function R(){const i=f.value.map(S=>S.data||S).join(`
|
|
3
3
|
`),s=new Blob([i],{type:"text/plain"}),_=URL.createObjectURL(s),h=document.createElement("a");h.href=_,h.download=`${M.instanceName}-logs-${Date.now()}.txt`,h.click(),URL.revokeObjectURL(_)}function W(){V.value=!0,L("expand")}function G(){V.value=!1,L("collapse")}return re(()=>{q()}),be(()=>{E()}),ke(()=>M.expanded,i=>{V.value=i}),(i,s)=>{const _=r("el-checkbox"),h=r("el-option"),S=r("el-select"),Q=r("el-input"),a=r("el-button"),e=r("el-icon");return u(),m("div",{class:ee(["log-viewer",{expanded:V.value}])},[o("div",Ue,[o("div",je,[t(_,{modelValue:v.value,"onUpdate:modelValue":s[0]||(s[0]=c=>v.value=c),onChange:z},{default:n(()=>[...s[3]||(s[3]=[o("span",null,"Live",-1)])]),_:1},8,["modelValue"]),t(S,{modelValue:y.value,"onUpdate:modelValue":s[1]||(s[1]=c=>y.value=c),size:"small",style:{width:"100px"}},{default:n(()=>[t(h,{label:"All",value:"all"}),t(h,{label:"Stdout",value:"out"}),t(h,{label:"Stderr",value:"err"})]),_:1},8,["modelValue"]),t(Q,{modelValue:k.value,"onUpdate:modelValue":s[2]||(s[2]=c=>k.value=c),size:"small",placeholder:"Search logs...","prefix-icon":"Search",style:{width:"200px"},clearable:""},null,8,["modelValue"])]),o("div",ze,[t(a,{size:"small",icon:$(De),onClick:R},{default:n(()=>[...s[4]||(s[4]=[p(" Export ",-1)])]),_:1},8,["icon"]),t(a,{size:"small",icon:$($e),onClick:H},{default:n(()=>[...s[5]||(s[5]=[p(" Clear ",-1)])]),_:1},8,["icon"]),A.expanded?(u(),U(a,{key:1,size:"small",icon:$(Ve),onClick:G},null,8,["icon"])):(u(),U(a,{key:0,size:"small",icon:$(Le),onClick:W},null,8,["icon"]))])]),o("div",{class:"log-content",ref_key:"logContentRef",ref:C},[B.value.length===0?(u(),m("div",Ee,[...s[6]||(s[6]=[o("span",null,"No logs to display",-1)])])):P("",!0),(u(!0),m(F,null,ue(B.value,(c,D)=>(u(),m("div",{key:D,class:ee(["log-line",J(c)])},[o("span",Fe,d(j(c.timestamp)),1),c.type!=="log"?(u(),m("span",Ae,d(c.type),1)):P("",!0),o("span",Oe,d(c.data||c),1)],2))),128)),l.value?(u(),m("div",Je,[t(e,{class:"is-loading"},{default:n(()=>[t($(Ie))]),_:1})])):P("",!0)],512)],2)}}},He=de(qe,[["__scopeId","data-v-d564c329"]]),We={class:"instance-detail-view"},Ge={key:0,class:"loading-state"},Qe={key:1,class:"error-state"},Ke={class:"detail-header"},Xe={class:"header-content"},Ye={class:"instance-icon"},Ze={key:0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},et={key:1,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},tt={class:"instance-name"},at={class:"header-actions"},nt={class:"status-panel"},lt={class:"status-indicator"},ot={class:"status-text"},st={class:"status-stats"},it={class:"stat-item"},rt={class:"stat-value"},ut={class:"stat-item"},dt={class:"stat-value"},ct={class:"stat-item"},pt={class:"stat-value"},ft={class:"stat-item"},mt={class:"stat-value"},vt={key:1},_t={key:0,class:"loading-state"},gt={key:0,style:{"margin-left":"12px",color:"var(--el-text-color-secondary)","font-size":"13px"}},yt={__name:"InstanceDetail",setup(A){const O=xe(),M=Se(),{success:L,error:f}=Pe(),l=g(null),v=g({status:"loading",exists:!1}),V=g(!0),y=g(null),k=g(!1),C=g(""),w=g(!1),B=g(!1),J=N(()=>{var a,e;return(e=(a=l.value)==null?void 0:a.tags)!=null&&e.includes("prod")?"prod":"dev"}),j=N(()=>{var e;return{"bmad-plugin":"BMAD 插件","simple-config":"基础版"}[(e=l.value)==null?void 0:e.instanceType]||"基础版"}),z=N(()=>{var e;return{"bmad-plugin":"success","simple-config":"info"}[(e=l.value)==null?void 0:e.instanceType]||"info"}),x=N(()=>{var a;return((a=l.value)==null?void 0:a.instanceType)==="bmad-plugin"}),E=N(()=>{const a=v.value.status,e=v.value.health;return a==="loading"?"loading":a==="online"?(e==null?void 0:e.overall)==="degraded"?"warning":"online":a==="stopped"?"stopped":a==="errored"?"error":""}),q=N(()=>{const a=v.value.status,e=v.value.health;return a==="loading"?"Loading...":a==="online"&&(e==null?void 0:e.overall)==="degraded"?"Degraded (Docker Down)":{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting"}[a]||"Loading..."});async function H(){V.value=!0;try{const a=O.params.name;l.value=await T.getInstance(a),await R()}catch{l.value=null}finally{V.value=!1}}async function R(){try{v.value=await T.getInstanceStatus(l.value.name)}catch(a){console.debug("[InstanceDetail] Failed to fetch status:",a.message)}}async function W(){y.value="start";try{await T.startInstance(l.value.name),L("Started",`${l.value.name} has been started`),await R()}catch(a){f("Failed to start",a.message)}finally{y.value=null}}async function G(){y.value="stop";try{await T.stopInstance(l.value.name),L("Stopped",`${l.value.name} has been stopped`),await R()}catch(a){f("Failed to stop",a.message)}finally{y.value=null}}async function i(){y.value="restart";try{await T.restartInstance(l.value.name),L("Restarted",`${l.value.name} has been restarted`),await R()}catch(a){f("Failed to restart",a.message)}finally{y.value=null}}async function s(a){switch(a){case"logs":const e=document.querySelector(".logs-card");e&&e.scrollIntoView({behavior:"smooth"});break;case"config":await _();break;case"delete":try{await Re.confirm(`Are you sure you want to delete "${l.value.name}"?`,"Confirm Delete",{type:"warning"}),await T.removeInstance(l.value.name),L("Deleted","Instance has been removed"),M.push("/")}catch(c){c!=="cancel"&&f("Failed",c.message)}break}}async function _(){var a;if(!((a=l.value)!=null&&a.configPath)){f("No Config","This instance does not have a config file");return}k.value=!0,w.value=!0;try{const e=await T.getInstanceConfig(l.value.name);C.value=e.config||""}catch(e){f("Failed to load",e.message),k.value=!1}finally{w.value=!1}}async function h(){B.value=!0;try{try{JSON.parse(C.value)}catch(a){throw new Error("Invalid JSON: "+a.message)}await T.updateInstanceConfig(l.value.name,{config:C.value}),L("Saved","Configuration has been updated"),k.value=!1}catch(a){f("Failed to save",a.message)}finally{B.value=!1}}function S(a){if(!a)return"-";const e=a/1024/1024;return e>=1024?(e/1024).toFixed(1)+" GB":Math.round(e)+" MB"}function Q(a){return a?new Date(a).toLocaleString():"-"}return re(H),(a,e)=>{var ne,le,oe,se;const c=r("el-skeleton"),D=r("el-button"),ce=r("el-result"),pe=r("el-page-header"),fe=r("el-button-group"),K=r("el-dropdown-item"),me=r("el-dropdown-menu"),ve=r("el-dropdown"),_e=r("el-divider"),X=r("el-card"),te=r("el-col"),I=r("el-descriptions-item"),Y=r("el-tag"),ge=r("el-descriptions"),ye=r("el-row"),Z=r("el-form-item"),ae=r("el-input"),we=r("el-form"),he=r("el-dialog");return u(),m("div",We,[V.value?(u(),m("div",Ge,[t(c,{rows:5,animated:""})])):l.value?(u(),m(F,{key:2},[o("div",Ke,[t(pe,{onBack:e[1]||(e[1]=b=>a.$router.push("/"))},{content:n(()=>[o("div",Xe,[o("span",Ye,[J.value==="prod"?(u(),m("svg",Ze,[...e[6]||(e[6]=[o("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M8 12H16M8 8H16M8 16H12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(u(),m("svg",et,[...e[7]||(e[7]=[o("circle",{cx:"12",cy:"8",r:"4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M6 21C6 17.5 8.5 15 12 15C15.5 15 18 17.5 18 21",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))]),o("div",null,[o("h2",null,d(l.value.displayName||l.value.name),1),o("span",tt,d(l.value.name),1)])])]),_:1}),o("div",at,[t(fe,null,{default:n(()=>[t(D,{icon:$(Te),disabled:v.value.status==="online",loading:y.value==="start",onClick:W},{default:n(()=>[...e[8]||(e[8]=[p(" Start ",-1)])]),_:1},8,["icon","disabled","loading"]),t(D,{icon:$(Me),disabled:v.value.status!=="online",loading:y.value==="stop",onClick:G},{default:n(()=>[...e[9]||(e[9]=[p(" Stop ",-1)])]),_:1},8,["icon","disabled","loading"]),t(D,{icon:$(Ne),loading:y.value==="restart",onClick:i},{default:n(()=>[...e[10]||(e[10]=[p(" Restart ",-1)])]),_:1},8,["icon","loading"])]),_:1}),t(ve,{onCommand:s},{dropdown:n(()=>[t(me,null,{default:n(()=>[t(K,{command:"logs"},{default:n(()=>[...e[12]||(e[12]=[p("View Logs",-1)])]),_:1}),t(K,{command:"config"},{default:n(()=>[...e[13]||(e[13]=[p("Edit Config",-1)])]),_:1}),t(K,{command:"delete",divided:""},{default:n(()=>[...e[14]||(e[14]=[p("Delete Instance",-1)])]),_:1})]),_:1})]),default:n(()=>[t(D,{icon:$(Be)},{default:n(()=>[...e[11]||(e[11]=[p(" More ",-1)])]),_:1},8,["icon"])]),_:1})])]),t(ye,{gutter:20,class:"detail-content"},{default:n(()=>[t(te,{xs:24,lg:8},{default:n(()=>[t(X,{header:"Status"},{default:n(()=>[o("div",nt,[o("div",lt,[o("span",{class:ee(["status-dot",E.value])},null,2),o("span",ot,d(q.value),1)]),v.value.exists?(u(),m(F,{key:0},[t(_e),o("div",st,[o("div",it,[e[15]||(e[15]=o("span",{class:"stat-label"},"PID",-1)),o("span",rt,d(v.value.pid||"-"),1)]),o("div",ut,[e[16]||(e[16]=o("span",{class:"stat-label"},"Memory",-1)),o("span",dt,d(S(v.value.memory)),1)]),o("div",ct,[e[17]||(e[17]=o("span",{class:"stat-label"},"CPU",-1)),o("span",pt,d(v.value.cpu)+"%",1)]),o("div",ft,[e[18]||(e[18]=o("span",{class:"stat-label"},"Restarts",-1)),o("span",mt,d(v.value.restarts),1)])])],64)):P("",!0)])]),_:1})]),_:1}),t(te,{xs:24,lg:16},{default:n(()=>[t(X,{header:"Information"},{default:n(()=>[t(ge,{column:1,border:""},{default:n(()=>[t(I,{label:"Name"},{default:n(()=>[p(d(l.value.name),1)]),_:1}),t(I,{label:"Display Name"},{default:n(()=>[p(d(l.value.displayName||"-"),1)]),_:1}),t(I,{label:"Type"},{default:n(()=>[t(Y,{type:z.value},{default:n(()=>[p(d(j.value),1)]),_:1},8,["type"])]),_:1}),t(I,{label:"Project Path"},{default:n(()=>[o("code",null,d(l.value.projectPath),1)]),_:1}),t(I,{label:"Plugin Path"},{default:n(()=>[o("code",null,d(l.value.pluginPath||"-"),1)]),_:1}),t(I,{label:"Config Path"},{default:n(()=>[o("code",null,d(l.value.configPath||"Default"),1)]),_:1}),t(I,{label:"Added"},{default:n(()=>[p(d(Q(l.value.addedAt)),1)]),_:1}),t(I,{label:"Tags"},{default:n(()=>{var b;return[(b=l.value.tags)!=null&&b.length?(u(!0),m(F,{key:0},ue(l.value.tags,ie=>(u(),U(Y,{key:ie,size:"small",style:{"margin-right":"4px"}},{default:n(()=>[p(d(ie),1)]),_:2},1024))),128)):(u(),m("span",vt,"-"))]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(X,{header:"Recent Logs",class:"logs-card"},{default:n(()=>[t(He,{"instance-name":l.value.name,expanded:!1},null,8,["instance-name"])]),_:1})],64)):(u(),m("div",Qe,[t(ce,{icon:"error",title:"Instance not found","sub-title":"The requested instance does not exist"},{extra:n(()=>[t(D,{type:"primary",onClick:e[0]||(e[0]=b=>a.$router.push("/"))},{default:n(()=>[...e[5]||(e[5]=[p("Back to Dashboard",-1)])]),_:1})]),_:1})])),t(he,{modelValue:k.value,"onUpdate:modelValue":e[4]||(e[4]=b=>k.value=b),title:x.value?`View Config - ${((ne=l.value)==null?void 0:ne.displayName)||((le=l.value)==null?void 0:le.name)} (Read Only)`:`Edit Config - ${((oe=l.value)==null?void 0:oe.displayName)||((se=l.value)==null?void 0:se.name)}`,width:"70%",top:"5vh"},{footer:n(()=>[t(D,{onClick:e[3]||(e[3]=b=>k.value=!1)},{default:n(()=>[p(d(x.value?"Close":"Cancel"),1)]),_:1}),x.value?P("",!0):(u(),U(D,{key:0,type:"primary",loading:B.value,onClick:h},{default:n(()=>[...e[19]||(e[19]=[p(" Save ",-1)])]),_:1},8,["loading"]))]),default:n(()=>[w.value?(u(),m("div",_t,[t(c,{rows:5,animated:""})])):(u(),U(we,{key:1,"label-width":"120px"},{default:n(()=>[t(Z,{label:"Instance Type"},{default:n(()=>[t(Y,{type:z.value},{default:n(()=>[p(d(j.value),1)]),_:1},8,["type"]),x.value?(u(),m("span",gt," BMAD plugin instances are read-only. Please edit config files directly in the project directory. ")):P("",!0)]),_:1}),t(Z,{label:"Config Path"},{default:n(()=>{var b;return[t(ae,{value:(b=l.value)==null?void 0:b.configPath,disabled:""},null,8,["value"])]}),_:1}),t(Z,{label:"Config Content"},{default:n(()=>[t(ae,{modelValue:C.value,"onUpdate:modelValue":e[2]||(e[2]=b=>C.value=b),type:"textarea",rows:20,disabled:x.value,placeholder:x.value?"BMAD instance config is read-only":"Configuration JSON content"},null,8,["modelValue","disabled","placeholder"])]),_:1})]),_:1}))]),_:1},8,["modelValue","title"])])}}},Ct=de(yt,[["__scopeId","data-v-d6d6cdf5"]]);export{Ct as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,u as B}from"./main-
|
|
1
|
+
import{a as p,u as B}from"./main-DueA0WJ5.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{a as k}from"./element-plus-CSm40ime.js";import{j as x,y as _,B as N,E as f,C as a,D as n,M as $,z,Q as i,R as E,ac as T,r as b,ab as o}from"./vue-vendor-CGSlMM3Y.js";const V={class:"instances-view"},j={__name:"Instances",setup(M){const{success:v,error:r}=B(),d=b([]),c=b(!0);async function u(){c.value=!0;try{d.value=await p.getInstances()}catch(t){r("Failed to load",t.message)}finally{c.value=!1}}async function y(t){try{await k.confirm(`Are you sure you want to delete instance "${t.name}"?`,"Confirm Delete",{type:"warning",confirmButtonText:"Delete",cancelButtonText:"Cancel"}),await p.removeInstance(t.name),v("Deleted",`Instance "${t.name}" has been removed`),await u()}catch(e){e!=="cancel"&&r("Failed to delete",e.message)}}return x(u),(t,e)=>{const s=o("el-table-column"),g=o("el-tag"),m=o("el-button"),h=o("el-table"),w=o("el-card"),D=T("loading");return _(),N("div",V,[e[2]||(e[2]=f("div",{class:"view-header"},[f("h1",null,"Instances")],-1)),a(w,null,{default:n(()=>[$((_(),z(h,{data:d.value,stripe:""},{default:n(()=>[a(s,{prop:"name",label:"Name",width:"180"}),a(s,{prop:"displayName",label:"Display Name"}),a(s,{prop:"projectPath",label:"Project Path"}),a(s,{prop:"enabled",label:"Status",width:"100"},{default:n(({row:l})=>[a(g,{type:l.enabled?"success":"info",size:"small"},{default:n(()=>[i(E(l.enabled?"Enabled":"Disabled"),1)]),_:2},1032,["type"])]),_:1}),a(s,{label:"Actions",width:"200",align:"right"},{default:n(({row:l})=>[a(m,{size:"small",onClick:C=>t.$router.push(`/instances/${l.name}`)},{default:n(()=>[...e[0]||(e[0]=[i(" View ",-1)])]),_:1},8,["onClick"]),a(m,{size:"small",type:"danger",plain:"",onClick:C=>y(l)},{default:n(()=>[...e[1]||(e[1]=[i(" Delete ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[D,c.value]])]),_:1})])}}},Q=I(j,[["__scopeId","data-v-b1513f53"]]);export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as M}from"./main-
|
|
1
|
+
import{b as M}from"./main-DueA0WJ5.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{r as B,j as W,y as g,B as $,E as r,C as t,D as o,u,z as v,Q as i,R as c,ab as s,c as D}from"./vue-vendor-CGSlMM3Y.js";import"./element-plus-CSm40ime.js";const N={class:"settings-view"},A={class:"setting-item"},C={__name:"Settings",setup(E){const{systemInfo:d,fetchSystemInfo:w}=M(),_=B(localStorage.getItem("darkMode")==="true"),b=D(()=>{var n;const a=(n=d.value)==null?void 0:n.platform;return{darwin:"macOS",linux:"Linux",win32:"Windows"}[a]||a});function k(){localStorage.setItem("darkMode",_.value),document.documentElement.classList.toggle("dark",_.value)}function h(a){if(!a)return"-";const e=Math.floor(a/86400),n=Math.floor(a%86400/3600),m=Math.floor(a%3600/60);return e>0?`${e}d ${n}h ${m}m`:n>0?`${n}h ${m}m`:`${m}m`}return W(()=>{w()}),(a,e)=>{const n=s("el-descriptions-item"),m=s("el-descriptions"),y=s("el-skeleton"),p=s("el-card"),f=s("el-col"),V=s("el-switch"),x=s("el-divider"),S=s("el-row");return g(),$("div",N,[e[4]||(e[4]=r("div",{class:"view-header"},[r("h1",null,"Settings")],-1)),t(S,{gutter:20},{default:o(()=>[t(f,{span:24},{default:o(()=>[t(p,{header:"System Information"},{default:o(()=>[u(d)?(g(),v(m,{key:0,column:2,border:""},{default:o(()=>[t(n,{label:"Platform"},{default:o(()=>[i(c(b.value),1)]),_:1}),t(n,{label:"Node Version"},{default:o(()=>[i(c(u(d).nodeVersion),1)]),_:1}),t(n,{label:"AgentWindow Version"},{default:o(()=>{var l;return[i(c((l=u(d).agentWindow)==null?void 0:l.version),1)]}),_:1}),t(n,{label:"Home Directory"},{default:o(()=>{var l;return[i(c((l=u(d).agentWindow)==null?void 0:l.home),1)]}),_:1}),t(n,{label:"Uptime",span:2},{default:o(()=>[i(c(h(u(d).uptime)),1)]),_:1})]),_:1})):(g(),v(y,{key:1,rows:4,animated:""}))]),_:1})]),_:1}),t(f,{xs:24,md:12},{default:o(()=>[t(p,{header:"Appearance"},{default:o(()=>[r("div",A,[e[1]||(e[1]=r("span",null,"Dark Mode",-1)),t(V,{modelValue:_.value,"onUpdate:modelValue":e[0]||(e[0]=l=>_.value=l),onChange:k},null,8,["modelValue"])])]),_:1})]),_:1}),t(f,{xs:24,md:12},{default:o(()=>[t(p,{header:"About"},{default:o(()=>[e[2]||(e[2]=r("p",null,"AgentWindow Web UI provides a browser-based interface for managing your bot instances.",-1)),t(x),e[3]||(e[3]=r("p",{class:"about-text"},[i(" Version 1.0.0"),r("br"),i(" Built with Vue 3 + Element Plus ")],-1))]),_:1})]),_:1})]),_:1})])}}},z=I(C,[["__scopeId","data-v-a16409cb"]]);export{z as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-BYj0Pp4o.js","assets/vue-vendor-CGSlMM3Y.js","assets/element-plus-CSm40ime.js","assets/_plugin-vue_export-helper-DlAUqK2U.js","assets/Dashboard-CEY00ieb.css","assets/Instances-C9LSVRYH.js","assets/Instances-CvnH8iDv.css","assets/InstanceDetail-BmSQ90cB.js","assets/InstanceDetail-BRMjUfAV.css","assets/Settings-CSFUWlVq.js","assets/Settings-CAu3R9RW.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{l as Pt,r as ae,j as Nt,B as L,E as w,aw as Ie,u as D,R as be,P as Ee,C as je,z as Lt,D as Ft,ap as Ut,T as Bt,G as qe,ab as Dt,y as P,J as vt,a5 as It,ax as jt,ay as qt,at as $t,az as Ht}from"./vue-vendor-CGSlMM3Y.js";import{i as Mt,E as zt}from"./element-plus-CSm40ime.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const se=Pt([]);let Vt=0;function Jt(){function e(o){const c=++Vt;return se.push({id:c,type:"info",title:"",message:"",duration:3e3,...o}),o.duration!==0&&setTimeout(()=>{t(c)},o.duration||3e3),c}function t(o){const c=se.findIndex(f=>f.id===o);c>-1&&se.splice(c,1)}function n(o,c){return e({type:"success",title:o,message:c})}function r(o,c){return e({type:"error",title:o,message:c,duration:5e3})}function s(o,c){return e({type:"warning",title:o,message:c})}function i(o,c){return e({type:"info",title:o,message:c})}return{toasts:se,addToast:e,removeToast:t,success:n,error:r,warning:s,info:i}}function st(e,t){return function(){return e.apply(t,arguments)}}const{toString:Wt}=Object.prototype,{getPrototypeOf:_e}=Object,{iterator:de,toStringTag:ot}=Symbol,pe=(e=>t=>{const n=Wt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),F=e=>(e=e.toLowerCase(),t=>pe(t)===e),he=e=>t=>typeof t===e,{isArray:J}=Array,V=he("undefined");function G(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const it=F("ArrayBuffer");function Kt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&it(e.buffer),t}const Xt=he("string"),A=he("function"),at=he("number"),Q=e=>e!==null&&typeof e=="object",Gt=e=>e===!0||e===!1,ce=e=>{if(pe(e)!=="object")return!1;const t=_e(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ot in e)&&!(de in e)},Qt=e=>{if(!Q(e)||G(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Zt=F("Date"),Yt=F("File"),en=F("Blob"),tn=F("FileList"),nn=e=>Q(e)&&A(e.pipe),rn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=pe(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},sn=F("URLSearchParams"),[on,an,cn,ln]=["ReadableStream","Request","Response","Headers"].map(F),un=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Z(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),J(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(G(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function ct(e,t){if(G(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const $=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lt=e=>!V(e)&&e!==$;function xe(){const{caseless:e,skipUndefined:t}=lt(this)&&this||{},n={},r=(s,i)=>{const o=e&&ct(n,i)||i;ce(n[o])&&ce(s)?n[o]=xe(n[o],s):ce(s)?n[o]=xe({},s):J(s)?n[o]=s.slice():(!t||!V(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Z(arguments[s],r);return n}const fn=(e,t,n,{allOwnKeys:r}={})=>(Z(t,(s,i)=>{n&&A(s)?e[i]=st(s,n):e[i]=s},{allOwnKeys:r}),e),dn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pn=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},hn=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&_e(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},mn=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},yn=e=>{if(!e)return null;if(J(e))return e;let t=e.length;if(!at(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},gn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_e(Uint8Array)),wn=(e,t)=>{const r=(e&&e[de]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},bn=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},En=F("HTMLFormElement"),Sn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),$e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Rn=F("RegExp"),ut=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Z(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},On=e=>{ut(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(A(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},xn=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return J(e)?r(e):r(String(e).split(t)),n},Tn=()=>{},An=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Cn(e){return!!(e&&A(e.append)&&e[ot]==="FormData"&&e[de])}const _n=e=>{const t=new Array(10),n=(r,s)=>{if(Q(r)){if(t.indexOf(r)>=0)return;if(G(r))return r;if(!("toJSON"in r)){t[s]=r;const i=J(r)?[]:{};return Z(r,(o,c)=>{const f=n(o,s+1);!V(f)&&(i[c]=f)}),t[s]=void 0,i}}return r};return n(e,0)},kn=F("AsyncFunction"),Pn=e=>e&&(Q(e)||A(e))&&A(e.then)&&A(e.catch),ft=((e,t)=>e?setImmediate:t?((n,r)=>($.addEventListener("message",({source:s,data:i})=>{s===$&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A($.postMessage)),Nn=typeof queueMicrotask<"u"?queueMicrotask.bind($):typeof process<"u"&&process.nextTick||ft,Ln=e=>e!=null&&A(e[de]),a={isArray:J,isArrayBuffer:it,isBuffer:G,isFormData:rn,isArrayBufferView:Kt,isString:Xt,isNumber:at,isBoolean:Gt,isObject:Q,isPlainObject:ce,isEmptyObject:Qt,isReadableStream:on,isRequest:an,isResponse:cn,isHeaders:ln,isUndefined:V,isDate:Zt,isFile:Yt,isBlob:en,isRegExp:Rn,isFunction:A,isStream:nn,isURLSearchParams:sn,isTypedArray:gn,isFileList:tn,forEach:Z,merge:xe,extend:fn,trim:un,stripBOM:dn,inherits:pn,toFlatObject:hn,kindOf:pe,kindOfTest:F,endsWith:mn,toArray:yn,forEachEntry:wn,matchAll:bn,isHTMLForm:En,hasOwnProperty:$e,hasOwnProp:$e,reduceDescriptors:ut,freezeMethods:On,toObjectSet:xn,toCamelCase:Sn,noop:Tn,toFiniteNumber:An,findKey:ct,global:$,isContextDefined:lt,isSpecCompliantForm:Cn,toJSONObject:_n,isAsyncFn:kn,isThenable:Pn,setImmediate:ft,asap:Nn,isIterable:Ln};function y(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(y,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const dt=y.prototype,pt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{pt[e]={value:e}});Object.defineProperties(y,pt);Object.defineProperty(dt,"isAxiosError",{value:!0});y.from=(e,t,n,r,s,i)=>{const o=Object.create(dt);a.toFlatObject(e,o,function(u){return u!==Error.prototype},l=>l!=="isAxiosError");const c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return y.call(o,c,f,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const Fn=null;function Te(e){return a.isPlainObject(e)||a.isArray(e)}function ht(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function He(e,t,n){return e?e.concat(t).map(function(s,i){return s=ht(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Un(e){return a.isArray(e)&&!e.some(Te)}const Bn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function me(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!a.isUndefined(h[m])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,f=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function l(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!f&&a.isBlob(d))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?f&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,m,h){let R=d;if(d&&!h&&typeof d=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&Un(d)||(a.isFileList(d)||a.endsWith(m,"[]"))&&(R=a.toArray(d)))return m=ht(m),R.forEach(function(O,T){!(a.isUndefined(O)||O===null)&&t.append(o===!0?He([m],T,i):o===null?m:m+"[]",l(O))}),!1}return Te(d)?!0:(t.append(He(h,m,i),l(d)),!1)}const p=[],g=Object.assign(Bn,{defaultVisitor:u,convertValue:l,isVisitable:Te});function S(d,m){if(!a.isUndefined(d)){if(p.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(d),a.forEach(d,function(R,_){(!(a.isUndefined(R)||R===null)&&s.call(t,R,a.isString(_)?_.trim():_,m,g))===!0&&S(R,m?m.concat(_):[_])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return S(e),t}function Me(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function ke(e,t){this._pairs=[],e&&me(e,this,t)}const mt=ke.prototype;mt.append=function(t,n){this._pairs.push([t,n])};mt.toString=function(t){const n=t?function(r){return t.call(this,r,Me)}:Me;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yt(e,t,n){if(!t)return e;const r=n&&n.encode||Dn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new ke(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class ze{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const gt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vn=typeof URLSearchParams<"u"?URLSearchParams:ke,In=typeof FormData<"u"?FormData:null,jn=typeof Blob<"u"?Blob:null,qn={isBrowser:!0,classes:{URLSearchParams:vn,FormData:In,Blob:jn},protocols:["http","https","file","blob","url","data"]},Pe=typeof window<"u"&&typeof document<"u",Ae=typeof navigator=="object"&&navigator||void 0,$n=Pe&&(!Ae||["ReactNative","NativeScript","NS"].indexOf(Ae.product)<0),Hn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Mn=Pe&&window.location.href||"http://localhost",zn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Pe,hasStandardBrowserEnv:$n,hasStandardBrowserWebWorkerEnv:Hn,navigator:Ae,origin:Mn},Symbol.toStringTag,{value:"Module"})),x={...zn,...qn};function Vn(e,t){return me(e,new x.classes.URLSearchParams,{visitor:function(n,r,s,i){return x.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Jn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wn(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function wt(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),f=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,f?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Wn(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Jn(r),s,n,0)}),n}return null}function Kn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Y={transitional:gt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(wt(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Vn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return me(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Kn(t)):t}],transformResponse:[function(t){const n=this.transitional||Y.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:x.classes.FormData,Blob:x.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{Y.headers[e]={}});const Xn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Gn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
3
3
|
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Xn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ve=Symbol("internals");function X(e){return e&&String(e).trim().toLowerCase()}function le(e){return e===!1||e==null?e:a.isArray(e)?e.map(le):String(e)}function Qn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Zn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Se(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Yn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function er(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let C=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(c,f,l){const u=X(f);if(!u)throw new Error("header name must be a non-empty string");const p=a.findKey(s,u);(!p||s[p]===void 0||l===!0||l===void 0&&s[p]!==!1)&&(s[p||f]=le(c))}const o=(c,f)=>a.forEach(c,(l,u)=>i(l,u,f));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!Zn(t))o(Gn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},f,l;for(const u of t){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[l=u[0]]=(f=c[l])?a.isArray(f)?[...f,u[1]]:[f,u[1]]:u[1]}o(c,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=X(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Qn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=X(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Se(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=X(o),o){const c=a.findKey(r,o);c&&(!n||Se(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||Se(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=le(s),delete n[i];return}const c=t?Yn(i):String(i).trim();c!==i&&delete n[i],n[c]=le(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
4
4
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ve]=this[Ve]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=X(o);r[c]||(er(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(C);function Re(e,t){const n=this||Y,r=t||n,s=C.from(r.headers);let i=r.data;return a.forEach(e,function(c){i=c.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function bt(e){return!!(e&&e.__CANCEL__)}function W(e,t,n){y.call(this,e??"canceled",y.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(W,y,{__CANCEL__:!0});function Et(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function tr(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function nr(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(f){const l=Date.now(),u=r[i];o||(o=l),n[s]=f,r[s]=l;let p=i,g=0;for(;p!==s;)g+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const S=u&&l-u;return S?Math.round(g*1e3/S):void 0}}function rr(e,t){let n=0,r=1e3/t,s,i;const o=(l,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...l)};return[(...l)=>{const u=Date.now(),p=u-n;p>=r?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-p)))},()=>s&&o(s)]}const fe=(e,t,n=3)=>{let r=0;const s=nr(50,250);return rr(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,f=o-r,l=s(f),u=o<=c;r=o;const p={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:l||void 0,estimated:l&&c&&u?(c-o)/l:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},Je=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},We=e=>(...t)=>a.asap(()=>e(...t)),sr=x.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,x.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(x.origin),x.navigator&&/(msie|trident)/i.test(x.navigator.userAgent)):()=>!0,or=x.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function ir(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ar(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function St(e,t,n){let r=!ir(t);return e&&(r||n==!1)?ar(e,t):t}const Ke=e=>e instanceof C?{...e}:e;function M(e,t){t=t||{};const n={};function r(l,u,p,g){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:g},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,p,g){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l,p,g)}else return r(l,u,p,g)}function i(l,u){if(!a.isUndefined(u))return r(void 0,u)}function o(l,u){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function c(l,u,p){if(p in t)return r(l,u);if(p in e)return r(void 0,l)}const f={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(l,u,p)=>s(Ke(l),Ke(u),p,!0)};return a.forEach(Object.keys({...e,...t}),function(u){const p=f[u]||s,g=p(e[u],t[u],u);a.isUndefined(g)&&p!==c||(n[u]=g)}),n}const Rt=e=>{const t=M({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;if(t.headers=o=C.from(o),t.url=yt(St(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(x.hasStandardBrowserEnv||x.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const f=n.getHeaders(),l=["content-type","content-length"];Object.entries(f).forEach(([u,p])=>{l.includes(u.toLowerCase())&&o.set(u,p)})}}if(x.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&sr(t.url))){const f=s&&i&&or.read(i);f&&o.set(s,f)}return t},cr=typeof XMLHttpRequest<"u",lr=cr&&function(e){return new Promise(function(n,r){const s=Rt(e);let i=s.data;const o=C.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:l}=s,u,p,g,S,d;function m(){S&&S(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function R(){if(!h)return;const O=C.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),N={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:O,config:e,request:h};Et(function(k){n(k),m()},function(k){r(k),m()},N),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(T){const N=T&&T.message?T.message:"Network Error",j=new y(N,y.ERR_NETWORK,e,h);j.event=T||null,r(j),h=null},h.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const N=s.transitional||gt;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new y(T,N.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(T,N){h.setRequestHeader(N,T)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),l&&([g,d]=fe(l,!0),h.addEventListener("progress",g)),f&&h.upload&&([p,S]=fe(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(u=O=>{h&&(r(!O||O.type?new W(null,e,h):O),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const _=tr(s.url);if(_&&x.protocols.indexOf(_)===-1){r(new y("Unsupported protocol "+_+":",y.ERR_BAD_REQUEST,e));return}h.send(i||null)})},ur=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(l){if(!s){s=!0,c();const u=l instanceof Error?l:this.reason;r.abort(u instanceof y?u:new W(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,i(new y(`timeout ${t} of ms exceeded`,y.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),e=null)};e.forEach(l=>l.addEventListener("abort",i));const{signal:f}=r;return f.unsubscribe=()=>a.asap(c),f}},fr=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},dr=async function*(e,t){for await(const n of pr(e))yield*fr(n,t)},pr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Xe=(e,t,n,r)=>{const s=dr(e,t);let i=0,o,c=f=>{o||(o=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:l,value:u}=await s.next();if(l){c(),f.close();return}let p=u.byteLength;if(n){let g=i+=p;n(g)}f.enqueue(new Uint8Array(u))}catch(l){throw c(l),l}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Ge=64*1024,{isFunction:oe}=a,hr=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Qe,TextEncoder:Ze}=a.global,Ye=(e,...t)=>{try{return!!e(...t)}catch{return!1}},mr=e=>{e=a.merge.call({skipUndefined:!0},hr,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const c=s&&oe(Qe),f=s&&(typeof Ze=="function"?(d=>m=>d.encode(m))(new Ze):async d=>new Uint8Array(await new n(d).arrayBuffer())),l=i&&c&&Ye(()=>{let d=!1;const m=new n(x.origin,{body:new Qe,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!m}),u=o&&c&&Ye(()=>a.isReadableStream(new r("").body)),p={stream:u&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!p[d]&&(p[d]=(m,h)=>{let R=m&&m[d];if(R)return R.call(m);throw new y(`Response type '${d}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const g=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(x.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await f(d)).byteLength},S=async(d,m)=>{const h=a.toFiniteNumber(d.getContentLength());return h??g(m)};return async d=>{let{url:m,method:h,data:R,signal:_,cancelToken:O,timeout:T,onDownloadProgress:N,onUploadProgress:j,responseType:k,headers:ge,withCredentials:te="same-origin",fetchOptions:Le}=Rt(d),Fe=t||fetch;k=k?(k+"").toLowerCase():"text";let ne=ur([_,O&&O.toAbortSignal()],T),K=null;const q=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let Ue;try{if(j&&l&&h!=="get"&&h!=="head"&&(Ue=await S(ge,R))!==0){let I=new n(m,{method:"POST",body:R,duplex:"half"}),z;if(a.isFormData(R)&&(z=I.headers.get("content-type"))&&ge.setContentType(z),I.body){const[we,re]=Je(Ue,fe(We(j)));R=Xe(I.body,Ge,we,re)}}a.isString(te)||(te=te?"include":"omit");const U=i&&"credentials"in n.prototype,Be={...Le,signal:ne,method:h.toUpperCase(),headers:ge.normalize().toJSON(),body:R,duplex:"half",credentials:U?te:void 0};K=i&&new n(m,Be);let v=await(i?Fe(K,Le):Fe(m,Be));const De=u&&(k==="stream"||k==="response");if(u&&(N||De&&q)){const I={};["status","statusText","headers"].forEach(ve=>{I[ve]=v[ve]});const z=a.toFiniteNumber(v.headers.get("content-length")),[we,re]=N&&Je(z,fe(We(N),!0))||[];v=new r(Xe(v.body,Ge,we,()=>{re&&re(),q&&q()}),I)}k=k||"text";let kt=await p[a.findKey(p,k)||"text"](v,d);return!De&&q&&q(),await new Promise((I,z)=>{Et(I,z,{data:kt,headers:C.from(v.headers),status:v.status,statusText:v.statusText,config:d,request:K})})}catch(U){throw q&&q(),U&&U.name==="TypeError"&&/Load failed|fetch/i.test(U.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,d,K),{cause:U.cause||U}):y.from(U,U&&U.code,d,K)}}},yr=new Map,Ot=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,c=o,f,l,u=yr;for(;c--;)f=i[c],l=u.get(f),l===void 0&&u.set(f,l=c?new Map:mr(t)),u=l;return l};Ot();const Ne={http:Fn,xhr:lr,fetch:{get:Ot}};a.forEach(Ne,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const et=e=>`- ${e}`,gr=e=>a.isFunction(e)||e===null||e===!1;function wr(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let c;if(s=r,!gr(r)&&(s=Ne[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([f,l])=>`adapter ${f} `+(l===!1?"is not supported by the environment":"is not available in the build"));let c=n?o.length>1?`since :
|
|
5
5
|
`+o.map(et).join(`
|
|
6
6
|
`):" "+et(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const xt={getAdapter:wr,adapters:Ne};function Oe(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new W(null,e)}function tt(e){return Oe(e),e.headers=C.from(e.headers),e.data=Re.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(e.adapter||Y.adapter,e)(e).then(function(r){return Oe(e),r.data=Re.call(e,e.transformResponse,r),r.headers=C.from(r.headers),r},function(r){return bt(r)||(Oe(e),r&&r.response&&(r.response.data=Re.call(e,e.transformResponse,r.response),r.response.headers=C.from(r.response.headers))),Promise.reject(r)})}const Tt="1.13.2",ye={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ye[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const nt={};ye.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Tt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new y(s(o," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!nt[o]&&(nt[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}};ye.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function br(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],f=c===void 0||o(c,i,e);if(f!==!0)throw new y("option "+i+" must be "+f,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}const ue={assertOptions:br,validators:ye},B=ue.validators;let H=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ze,response:new ze}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
7
|
-
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=M(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ue.assertOptions(r,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ue.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ue.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=C.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,p=0,g;if(!f){const d=[tt.bind(this),void 0];for(d.unshift(...c),d.push(...l),g=d.length,u=Promise.resolve(n);p<g;)u=u.then(d[p++],d[p++]);return u}g=c.length;let S=n;for(;p<g;){const d=c[p++],m=c[p++];try{S=d(S)}catch(h){m.call(this,h);break}}try{u=tt.call(this,S)}catch(d){return Promise.reject(d)}for(p=0,g=l.length;p<g;)u=u.then(l[p++],l[p++]);return u}getUri(t){t=M(this.defaults,t);const n=St(t.baseURL,t.url,t.allowAbsoluteUrls);return yt(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request(M(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(M(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Er=class At{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new W(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new At(function(s){t=s}),cancel:t}}};function Sr(e){return function(n){return e.apply(null,n)}}function Rr(e){return a.isObject(e)&&e.isAxiosError===!0}const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ce).forEach(([e,t])=>{Ce[t]=e});function Ct(e){const t=new H(e),n=st(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ct(M(e,s))},n}const b=Ct(Y);b.Axios=H;b.CanceledError=W;b.CancelToken=Er;b.isCancel=bt;b.VERSION=Tt;b.toFormData=me;b.AxiosError=y;b.Cancel=b.CanceledError;b.all=function(t){return Promise.all(t)};b.spread=Sr;b.isAxiosError=Rr;b.mergeConfig=M;b.AxiosHeaders=C;b.formToJSON=e=>wt(a.isHTMLForm(e)?new FormData(e):e);b.getAdapter=xt.getAdapter;b.HttpStatusCode=Ce;b.default=b;const{Axios:Zr,AxiosError:Yr,CanceledError:es,isCancel:ts,CancelToken:ns,VERSION:rs,all:ss,Cancel:os,isAxiosError:is,spread:as,toFormData:cs,AxiosHeaders:ls,HttpStatusCode:us,formToJSON:fs,getAdapter:ds,mergeConfig:ps}=b,Or="/api",E=b.create({baseURL:Or,timeout:3e4,headers:{"Content-Type":"application/json"}});E.interceptors.request.use(e=>e,e=>Promise.reject(e));E.interceptors.response.use(e=>e.data,e=>{var n,r;const t=((r=(n=e.response)==null?void 0:n.data)==null?void 0:r.error)||e.message||"Request failed";return Promise.reject(new Error(t))});const xr={getHealth:()=>E.get("/health"),getSystemInfo:()=>E.get("/system/info"),getSystemStats:()=>E.get("/system/stats"),getInstances:()=>E.get("/instances"),getInstance:e=>E.get(`/instances/${e}`),addInstance:e=>E.post("/instances",e),removeInstance:e=>E.delete(`/instances/${e}`),getInstanceStatus:e=>E.get(`/instances/${e}/status`),getInstanceLogs:(e,t={})=>E.get(`/instances/${e}/logs`,{params:t}),discoverInstances:()=>E.get("/instances/discover"),importInstance:e=>E.post("/instances/import",e),getClaudeTokens:()=>E.get("/instances/tokens/claude"),startInstance:e=>E.post(`/instances/${e}/start`),stopInstance:e=>E.post(`/instances/${e}/stop`),restartInstance:e=>E.post(`/instances/${e}/restart`),validateConfig:e=>E.post("/validate-config",e),getInstanceConfig:e=>E.get(`/instances/${e}/config`),updateInstanceConfig:(e,t)=>E.put(`/instances/${e}/config`,t)};function Tr(){const e=ae(null),t=ae(!1),n=ae(null);async function r(){t.value=!0,n.value=null;try{const s=await xr.get("/system/info");e.value=s}catch(s){n.value=s.message}finally{t.value=!1}}return{systemInfo:e,loading:t,error:n,fetchSystemInfo:r}}const Ar={class:"app-header"},Cr={class:"header-left"},_r={key:0,class:"version"},kr={class:"header-right"},Pr=["title"],Nr={key:0,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Lr={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Fr={class:"app-main"},Ur={class:"toast-container"},Br={class:"toast-icon"},Dr={key:0,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},vr={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ir={key:2,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},jr={class:"toast-content"},qr={key:0,class:"toast-title"},$r={key:1,class:"toast-message"},Hr=["onClick"],Mr={__name:"App",setup(e){const{darkMode:t,toggleDarkMode:n}=c(),{toasts:r,removeToast:s}=Jt(),{systemInfo:i,fetchSystemInfo:o}=Tr();Nt(()=>{o()});function c(){const f=ae(localStorage.getItem("darkMode")==="true");function l(){f.value=!f.value,localStorage.setItem("darkMode",f.value),document.documentElement.classList.toggle("dark",f.value)}return f.value&&document.documentElement.classList.add("dark"),{darkMode:f,toggleDarkMode:l}}return(f,l)=>{var p;const u=Dt("router-view");return P(),L("div",{id:"app",class:qe({"dark-mode":D(t)})},[w("header",Ar,[w("div",Cr,[l[2]||(l[2]=Ie('<svg class="logo" width="28" height="28" viewBox="0 0 28 28" fill="none"><rect width="28" height="28" rx="6" fill="var(--aw-accent)"></rect><rect x="4" y="4" width="20" height="20" rx="4" stroke="white" stroke-width="1.5" fill="none"></rect><circle cx="14" cy="14" r="3" fill="white" opacity="0.9"></circle></svg><span class="brand">AgentWindow</span>',2)),D(i)?(P(),L("span",_r,"v"+be(((p=D(i).agentWindow)==null?void 0:p.version)||"1.0.0"),1)):Ee("",!0)]),w("div",kr,[w("button",{class:"icon-button",onClick:l[0]||(l[0]=(...g)=>D(n)&&D(n)(...g)),title:D(t)?"Light Mode":"Dark Mode"},[D(t)?(P(),L("svg",Nr,[...l[3]||(l[3]=[Ie('<circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>',9)])])):(P(),L("svg",Lr,[...l[4]||(l[4]=[w("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},null,-1)])]))],8,Pr),w("button",{class:"icon-button",onClick:l[1]||(l[1]=g=>f.$router.push("/settings")),title:"Settings"},[...l[5]||(l[5]=[w("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[w("circle",{cx:"12",cy:"12",r:"3"}),w("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})],-1)])])])]),w("main",Fr,[je(u)]),(P(),Lt(Bt,{to:"body"},[w("div",Ur,[je(Ut,{name:"toast"},{default:Ft(()=>[(P(!0),L(vt,null,It(D(r),g=>(P(),L("div",{key:g.id,class:qe(["toast",g.type])},[w("div",Br,[g.type==="success"?(P(),L("svg",Dr,[...l[6]||(l[6]=[w("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):g.type==="error"?(P(),L("svg",vr,[...l[7]||(l[7]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("line",{x1:"15",y1:"9",x2:"9",y2:"15"},null,-1),w("line",{x1:"9",y1:"9",x2:"15",y2:"15"},null,-1)])])):(P(),L("svg",Ir,[...l[8]||(l[8]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("line",{x1:"12",y1:"16",x2:"12",y2:"12"},null,-1),w("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"},null,-1)])]))]),w("div",jr,[g.title?(P(),L("div",qr,be(g.title),1)):Ee("",!0),g.message?(P(),L("div",$r,be(g.message),1)):Ee("",!0)]),w("button",{class:"toast-close",onClick:S=>D(s)(g.id)},[...l[9]||(l[9]=[w("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[w("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Hr)],2))),128))]),_:1})])]))],2)}}},zr="modulepreload",Vr=function(e){return"/"+e},rt={},ie=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(f=>{if(f=Vr(f),f in rt)return;rt[f]=!0;const l=f.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${u}`))return;const p=document.createElement("link");if(p.rel=l?"stylesheet":zr,l||(p.as="script"),p.crossOrigin="",p.href=f,c&&p.setAttribute("nonce",c),document.head.appendChild(p),l)return new Promise((g,S)=>{p.addEventListener("load",g),p.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return s.then(o=>{for(const c of o||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})},Jr=[{path:"/",name:"dashboard",component:()=>ie(()=>import("./Dashboard-1TTWybTq.js"),__vite__mapDeps([0,1,2,3,4])),meta:{title:"Dashboard"}},{path:"/instances",name:"instances",component:()=>ie(()=>import("./Instances-D4SbRoep.js"),__vite__mapDeps([5,3,2,1,6])),meta:{title:"Instances"}},{path:"/instances/:name",name:"instance-detail",component:()=>ie(()=>import("./InstanceDetail-BWV1wz24.js"),__vite__mapDeps([7,1,2,3,8])),meta:{title:"Instance Detail"}},{path:"/settings",name:"settings",component:()=>ie(()=>import("./Settings-CdoSWOhM.js"),__vite__mapDeps([9,3,1,2,10])),meta:{title:"Settings"}},{path:"/:pathMatch(.*)*",redirect:"/"}],_t=jt({history:qt(),routes:Jr});_t.afterEach(e=>{const t=e.meta.title||"AgentWindow";document.title=`${t} - AgentWindow`});const ee=$t(Mr),Wr=Ht();ee.use(Wr);ee.use(_t);ee.use(Mt);for(const[e,t]of Object.entries(zt))ee.component(e,t);ee.mount("#app");export{xr as a,Tr as b,Jt as u};
|
|
7
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=M(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ue.assertOptions(r,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ue.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ue.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=C.concat(o,i);const c=[];let f=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(f=f&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const l=[];this.interceptors.response.forEach(function(m){l.push(m.fulfilled,m.rejected)});let u,p=0,g;if(!f){const d=[tt.bind(this),void 0];for(d.unshift(...c),d.push(...l),g=d.length,u=Promise.resolve(n);p<g;)u=u.then(d[p++],d[p++]);return u}g=c.length;let S=n;for(;p<g;){const d=c[p++],m=c[p++];try{S=d(S)}catch(h){m.call(this,h);break}}try{u=tt.call(this,S)}catch(d){return Promise.reject(d)}for(p=0,g=l.length;p<g;)u=u.then(l[p++],l[p++]);return u}getUri(t){t=M(this.defaults,t);const n=St(t.baseURL,t.url,t.allowAbsoluteUrls);return yt(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request(M(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(M(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Er=class At{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new W(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new At(function(s){t=s}),cancel:t}}};function Sr(e){return function(n){return e.apply(null,n)}}function Rr(e){return a.isObject(e)&&e.isAxiosError===!0}const Ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ce).forEach(([e,t])=>{Ce[t]=e});function Ct(e){const t=new H(e),n=st(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ct(M(e,s))},n}const b=Ct(Y);b.Axios=H;b.CanceledError=W;b.CancelToken=Er;b.isCancel=bt;b.VERSION=Tt;b.toFormData=me;b.AxiosError=y;b.Cancel=b.CanceledError;b.all=function(t){return Promise.all(t)};b.spread=Sr;b.isAxiosError=Rr;b.mergeConfig=M;b.AxiosHeaders=C;b.formToJSON=e=>wt(a.isHTMLForm(e)?new FormData(e):e);b.getAdapter=xt.getAdapter;b.HttpStatusCode=Ce;b.default=b;const{Axios:Zr,AxiosError:Yr,CanceledError:es,isCancel:ts,CancelToken:ns,VERSION:rs,all:ss,Cancel:os,isAxiosError:is,spread:as,toFormData:cs,AxiosHeaders:ls,HttpStatusCode:us,formToJSON:fs,getAdapter:ds,mergeConfig:ps}=b,Or="/api",E=b.create({baseURL:Or,timeout:3e4,headers:{"Content-Type":"application/json"}});E.interceptors.request.use(e=>e,e=>Promise.reject(e));E.interceptors.response.use(e=>e.data,e=>{var n,r;const t=((r=(n=e.response)==null?void 0:n.data)==null?void 0:r.error)||e.message||"Request failed";return Promise.reject(new Error(t))});const xr={getHealth:()=>E.get("/health"),getSystemInfo:()=>E.get("/system/info"),getSystemStats:()=>E.get("/system/stats"),getInstances:()=>E.get("/instances"),getInstance:e=>E.get(`/instances/${e}`),addInstance:e=>E.post("/instances",e),removeInstance:e=>E.delete(`/instances/${e}`),getInstanceStatus:e=>E.get(`/instances/${e}/status`),getInstanceLogs:(e,t={})=>E.get(`/instances/${e}/logs`,{params:t}),discoverInstances:()=>E.get("/instances/discover"),importInstance:e=>E.post("/instances/import",e),getClaudeTokens:()=>E.get("/instances/tokens/claude"),startInstance:e=>E.post(`/instances/${e}/start`),stopInstance:e=>E.post(`/instances/${e}/stop`),restartInstance:e=>E.post(`/instances/${e}/restart`),validateConfig:e=>E.post("/validate-config",e),getInstanceConfig:e=>E.get(`/instances/${e}/config`),updateInstanceConfig:(e,t)=>E.put(`/instances/${e}/config`,t)};function Tr(){const e=ae(null),t=ae(!1),n=ae(null);async function r(){t.value=!0,n.value=null;try{const s=await xr.get("/system/info");e.value=s}catch(s){n.value=s.message}finally{t.value=!1}}return{systemInfo:e,loading:t,error:n,fetchSystemInfo:r}}const Ar={class:"app-header"},Cr={class:"header-left"},_r={key:0,class:"version"},kr={class:"header-right"},Pr=["title"],Nr={key:0,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Lr={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Fr={class:"app-main"},Ur={class:"toast-container"},Br={class:"toast-icon"},Dr={key:0,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},vr={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Ir={key:2,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},jr={class:"toast-content"},qr={key:0,class:"toast-title"},$r={key:1,class:"toast-message"},Hr=["onClick"],Mr={__name:"App",setup(e){const{darkMode:t,toggleDarkMode:n}=c(),{toasts:r,removeToast:s}=Jt(),{systemInfo:i,fetchSystemInfo:o}=Tr();Nt(()=>{o()});function c(){const f=ae(localStorage.getItem("darkMode")==="true");function l(){f.value=!f.value,localStorage.setItem("darkMode",f.value),document.documentElement.classList.toggle("dark",f.value)}return f.value&&document.documentElement.classList.add("dark"),{darkMode:f,toggleDarkMode:l}}return(f,l)=>{var p;const u=Dt("router-view");return P(),L("div",{id:"app",class:qe({"dark-mode":D(t)})},[w("header",Ar,[w("div",Cr,[l[2]||(l[2]=Ie('<svg class="logo" width="28" height="28" viewBox="0 0 28 28" fill="none"><rect width="28" height="28" rx="6" fill="var(--aw-accent)"></rect><rect x="4" y="4" width="20" height="20" rx="4" stroke="white" stroke-width="1.5" fill="none"></rect><circle cx="14" cy="14" r="3" fill="white" opacity="0.9"></circle></svg><span class="brand">AgentWindow</span>',2)),D(i)?(P(),L("span",_r,"v"+be(((p=D(i).agentWindow)==null?void 0:p.version)||"1.0.0"),1)):Ee("",!0)]),w("div",kr,[w("button",{class:"icon-button",onClick:l[0]||(l[0]=(...g)=>D(n)&&D(n)(...g)),title:D(t)?"Light Mode":"Dark Mode"},[D(t)?(P(),L("svg",Nr,[...l[3]||(l[3]=[Ie('<circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>',9)])])):(P(),L("svg",Lr,[...l[4]||(l[4]=[w("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},null,-1)])]))],8,Pr),w("button",{class:"icon-button",onClick:l[1]||(l[1]=g=>f.$router.push("/settings")),title:"Settings"},[...l[5]||(l[5]=[w("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[w("circle",{cx:"12",cy:"12",r:"3"}),w("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})],-1)])])])]),w("main",Fr,[je(u)]),(P(),Lt(Bt,{to:"body"},[w("div",Ur,[je(Ut,{name:"toast"},{default:Ft(()=>[(P(!0),L(vt,null,It(D(r),g=>(P(),L("div",{key:g.id,class:qe(["toast",g.type])},[w("div",Br,[g.type==="success"?(P(),L("svg",Dr,[...l[6]||(l[6]=[w("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):g.type==="error"?(P(),L("svg",vr,[...l[7]||(l[7]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("line",{x1:"15",y1:"9",x2:"9",y2:"15"},null,-1),w("line",{x1:"9",y1:"9",x2:"15",y2:"15"},null,-1)])])):(P(),L("svg",Ir,[...l[8]||(l[8]=[w("circle",{cx:"12",cy:"12",r:"10"},null,-1),w("line",{x1:"12",y1:"16",x2:"12",y2:"12"},null,-1),w("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"},null,-1)])]))]),w("div",jr,[g.title?(P(),L("div",qr,be(g.title),1)):Ee("",!0),g.message?(P(),L("div",$r,be(g.message),1)):Ee("",!0)]),w("button",{class:"toast-close",onClick:S=>D(s)(g.id)},[...l[9]||(l[9]=[w("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[w("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),w("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,Hr)],2))),128))]),_:1})])]))],2)}}},zr="modulepreload",Vr=function(e){return"/"+e},rt={},ie=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),c=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(f=>{if(f=Vr(f),f in rt)return;rt[f]=!0;const l=f.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${u}`))return;const p=document.createElement("link");if(p.rel=l?"stylesheet":zr,l||(p.as="script"),p.crossOrigin="",p.href=f,c&&p.setAttribute("nonce",c),document.head.appendChild(p),l)return new Promise((g,S)=>{p.addEventListener("load",g),p.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return s.then(o=>{for(const c of o||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})},Jr=[{path:"/",name:"dashboard",component:()=>ie(()=>import("./Dashboard-BYj0Pp4o.js"),__vite__mapDeps([0,1,2,3,4])),meta:{title:"Dashboard"}},{path:"/instances",name:"instances",component:()=>ie(()=>import("./Instances-C9LSVRYH.js"),__vite__mapDeps([5,3,2,1,6])),meta:{title:"Instances"}},{path:"/instances/:name",name:"instance-detail",component:()=>ie(()=>import("./InstanceDetail-BmSQ90cB.js"),__vite__mapDeps([7,1,2,3,8])),meta:{title:"Instance Detail"}},{path:"/settings",name:"settings",component:()=>ie(()=>import("./Settings-CSFUWlVq.js"),__vite__mapDeps([9,3,1,2,10])),meta:{title:"Settings"}},{path:"/:pathMatch(.*)*",redirect:"/"}],_t=jt({history:qt(),routes:Jr});_t.afterEach(e=>{const t=e.meta.title||"AgentWindow";document.title=`${t} - AgentWindow`});const ee=$t(Mr),Wr=Ht();ee.use(Wr);ee.use(_t);ee.use(Mt);for(const[e,t]of Object.entries(zt))ee.component(e,t);ee.mount("#app");export{xr as a,Tr as b,Jt as u};
|
package/web/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>AgentWindow - Bot Management UI</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🪟</text></svg>">
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-DueA0WJ5.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/vue-vendor-CGSlMM3Y.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/element-plus-CSm40ime.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="/assets/main-CalRvcyG.css">
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aA as Ne,j as re,ab as p,y as d,z as C,D as a,E as t,R as u,G as oe,B as y,P as B,J as G,a5 as Q,c as w,r as f,Q as g,u as J,C as s,aw as Ve,am as Te}from"./vue-vendor-CGSlMM3Y.js";import{d as $e,p as ie,r as Ie}from"./element-plus-CSm40ime.js";import{a as x,u as de}from"./main-BKf0mqau.js";import{_ as ue}from"./_plugin-vue_export-helper-DlAUqK2U.js";const De={class:"card-header"},Pe={class:"header-left"},je={class:"instance-info"},Ae={class:"instance-name"},Me={class:"instance-alias"},Be={class:"status-label"},Re={class:"card-body"},Ee={class:"info-row"},Se={class:"info-row"},Oe={class:"value"},Ue={key:0,class:"stats-row"},Fe={class:"stat"},Le={class:"stat-value"},qe={class:"stat"},ze={class:"stat-value"},He={key:0,class:"stat"},Ke={class:"stat-value"},We={key:1,class:"tags-row"},Je={class:"card-actions"},Ge={class:"action-buttons"},Qe=["disabled"],Ye=["disabled"],Xe=["disabled"],Ze={__name:"InstanceCard",props:{instance:{type:Object,required:!0}},setup(D,{expose:U}){const v=D,V=Ne(),{success:P,error:_}=de(),c=f({status:"loading",exists:!1,memory:0,cpu:0,uptime:0}),R=f(null),j=f(!1),E=w(()=>{const i=c.value.status,l=c.value.health;return i==="loading"?"loading":i==="errored"?"error":(l==null?void 0:l.overall)==="degraded"?"degraded":(l==null?void 0:l.overall)==="unhealthy"?"warning":i==="online"?"online":i==="stopped"?"stopped":i==="restarting"?"restarting":"stopped"}),S=w(()=>{const i=c.value.status,l=c.value.health;return i==="loading"?"Loading...":i==="online"&&(l==null?void 0:l.overall)==="degraded"?"Degraded (Docker Down)":{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting"}[i]||"Loading..."}),h=w(()=>{const i=v.instance.projectPath;return i.length>35?"..."+i.slice(-32):i}),O=w(()=>({"bmad-plugin":"BMAD 插件","simple-config":"基础版"})[v.instance.instanceType]||"基础版"),N=w(()=>`type-${v.instance.instanceType}`);async function k(){if(!j.value){j.value=!0;try{const i=await x.getInstanceStatus(v.instance.name);i&&i.status&&(c.value=i,R.value=i)}catch(i){R.value?console.debug("[InstanceCard] API error, using cached status:",i.message):console.debug("[InstanceCard] Failed to load initial status:",i.message)}finally{j.value=!1}}}async function F(){try{await x.startInstance(v.instance.name),P("Started",`${v.instance.name} has been started`),await k()}catch(i){_("Failed to start",i.message)}}async function A(){try{await x.stopInstance(v.instance.name),P("Stopped",`${v.instance.name} has been stopped`),await k()}catch(i){_("Failed to stop",i.message)}}async function o(){try{await x.restartInstance(v.instance.name),P("Restarted",`${v.instance.name} has been restarted`),await k()}catch(i){_("Failed to restart",i.message)}}function Y(){V.push(`/instances/${v.instance.name}`)}function q(i){const l=i/1024/1024;return l>=1024?(l/1024).toFixed(1)+" GB":Math.round(l)+" MB"}function X(i){if(!i)return"-";const l=Math.floor((Date.now()-i)/1e3);return l<60?`${l}s`:l<3600?`${Math.floor(l/60)}m`:l<86400?`${Math.floor(l/3600)}h`:`${Math.floor(l/86400)}d`}return re(()=>{k();const i=setInterval(k,1e4);return()=>clearInterval(i)}),U({fetchStatus:k}),(i,l)=>{const z=p("el-card");return d(),C(z,{class:"instance-card"},{default:a(()=>{var H;return[t("div",De,[t("div",Pe,[l[0]||(l[0]=t("div",{class:"instance-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),t("circle",{cx:"12",cy:"12",r:"3"})])],-1)),t("div",je,[t("h3",Ae,u(D.instance.displayName||D.instance.name),1),t("span",Me,u(D.instance.name),1)])]),t("div",{class:oe(["status-indicator",E.value])},[l[1]||(l[1]=t("span",{class:"status-dot"},null,-1)),t("span",Be,u(S.value),1)],2)]),t("div",Re,[t("div",Ee,[l[2]||(l[2]=t("span",{class:"label"},"Type",-1)),t("span",{class:oe(["value instance-type",N.value])},u(O.value),3)]),t("div",Se,[l[3]||(l[3]=t("span",{class:"label"},"Path",-1)),t("span",Oe,u(h.value),1)]),c.value.exists?(d(),y("div",Ue,[t("div",Fe,[l[4]||(l[4]=t("span",{class:"stat-label"},"Memory",-1)),t("span",Le,u(q(c.value.memory)),1)]),t("div",qe,[l[5]||(l[5]=t("span",{class:"stat-label"},"CPU",-1)),t("span",ze,u(c.value.cpu)+"%",1)]),c.value.status==="online"?(d(),y("div",He,[l[6]||(l[6]=t("span",{class:"stat-label"},"Uptime",-1)),t("span",Ke,u(X(c.value.uptime)),1)])):B("",!0)])):B("",!0),(H=D.instance.tags)!=null&&H.length?(d(),y("div",We,[(d(!0),y(G,null,Q(D.instance.tags,M=>(d(),y("span",{key:M,class:"tag"},u(M),1))),128))])):B("",!0)]),t("div",Je,[t("div",Ge,[t("button",{class:"action-btn",disabled:c.value.status==="online"||c.value.status==="loading",title:"Start",onClick:F},[...l[7]||(l[7]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("polygon",{points:"5 3 19 12 5 21 5 3"})],-1)])],8,Qe),t("button",{class:"action-btn",disabled:c.value.status!=="online"||c.value.status==="loading",title:"Stop",onClick:A},[...l[8]||(l[8]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("rect",{x:"6",y:"4",width:"4",height:"16"}),t("rect",{x:"14",y:"4",width:"4",height:"16"})],-1)])],8,Ye),t("button",{class:"action-btn",disabled:c.value.status==="loading",title:"Restart",onClick:o},[...l[9]||(l[9]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t("polyline",{points:"23 4 23 10 17 10"}),t("polyline",{points:"1 20 1 14 7 14"}),t("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})],-1)])],8,Xe)]),t("button",{class:"details-btn",onClick:Y}," Details ")])]}),_:1})}}},et=ue(Ze,[["__scopeId","data-v-9192a287"]]),tt={class:"dashboard-view"},at={class:"dashboard-header"},st={class:"header-actions"},nt={class:"stat-content"},lt={class:"stat-info"},ot={class:"stat-value"},it={class:"stat-content"},rt={class:"stat-info"},dt={class:"stat-value"},ut={class:"stat-content"},ct={class:"stat-info"},pt={class:"stat-value"},vt={class:"stat-content"},mt={class:"stat-info"},ft={class:"stat-value"},gt={key:0,class:"loading-state"},ht={key:1,class:"empty-state"},yt={key:0,class:"loading-state"},wt={key:1,class:"empty-discovered"},_t={style:{display:"flex","align-items":"center",gap:"8px"}},kt={class:"dialog-footer"},bt={class:"footer-left"},Ct={key:0,class:"validation-summary"},xt={class:"footer-right"},Nt={key:0},Vt={class:"check-item"},Tt={class:"check-name"},$t={class:"check-message"},It={__name:"Dashboard",setup(D){const{success:U,error:v}=de(),V=f([]),P=f(!0),_=f(!1),c=f(!1),R=f(!1),j=f(!1),E=f(null),S=f(!1),h=f(null),O=f([]),N=f([]),k=f(!1),F=f(null),A=f([]),o=f({name:"",displayName:"",projectPath:"",botToken:"",oauthToken:"",allowedChannels:"",containerName:"",tagsInput:""}),Y={name:[{required:!0,message:"Name is required"},{pattern:/^[a-z0-9-]+$/,message:"Only lowercase letters, numbers, and hyphens"}],projectPath:[{required:!0,message:"Project path is required"}],botToken:[{required:!0,message:"Discord Bot Token is required"}],oauthToken:[{required:!0,message:"Claude OAuth Token is required"},{pattern:/^sk-ant-/,message:"Token must start with sk-ant-"}],allowedChannels:[{required:!0,message:"Allowed Channels is required"}]},q=w(()=>V.value.filter(r=>r.enabled).length),X=w(()=>V.value.length-q.value),i=w(()=>0),l=w(()=>N.value.length>0),z=w(()=>N.value.length),H=w(()=>h.value?h.value.checks.filter(r=>r.status==="passed"):[]);async function M(){P.value=!0;try{V.value=await x.getInstances(),await ee()}catch(r){v("Failed to load",r.message)}finally{P.value=!1}}async function ee(){try{const r=await x.discoverInstances();N.value=r.discovered||[]}catch{N.value=[]}}async function ce(){k.value=!0;try{await ee()}catch(r){v("Discovery failed",r.message)}finally{k.value=!1}}async function pe(r){F.value=r.name;try{await x.importInstance({name:r.name,botName:r.botName,displayName:r.displayName,projectPath:r.projectPath}),A.value.push(r.name),U("Imported",`Instance "${r.displayName}" has been imported`),await M(),A.value.length>=N.value.length&&(c.value=!1,A.value=[])}catch(e){v("Import failed",e.message)}finally{F.value=null}}async function te(){var e;if(await((e=E.value)==null?void 0:e.validate().catch(()=>!1))){R.value=!0;try{const m=o.value.tagsInput?o.value.tagsInput.split(",").map(K=>K.trim()).filter(Boolean):[],T=o.value.containerName||`bot-${o.value.name}`,b={BOT_TOKEN:o.value.botToken,CLAUDE_CODE_OAUTH_TOKEN:o.value.oauthToken,PROJECT_DIR:o.value.projectPath,ALLOWED_CHANNELS:o.value.allowedChannels,workspace:{containerName:T}};await x.addInstance({name:o.value.name,displayName:o.value.displayName||o.value.name,projectPath:o.value.projectPath,tags:m,config:b,createConfig:!0}),U("Added",`Instance "${o.value.name}" has been added`),_.value=!1,se(),await M()}catch(m){v("Failed to add",m.message)}finally{R.value=!1}}}function ae(){_.value=!1,se()}function se(){var r;o.value={name:"",displayName:"",projectPath:"",botToken:"",oauthToken:"",allowedChannels:"",containerName:"",tagsInput:""},(r=E.value)==null||r.clearValidate(),h.value=null}async function ve(r){if(r&&O.value.length===0)try{const e=await x.getClaudeTokens();e.success&&(O.value=e.tokens)}catch(e){console.error("Failed to load tokens:",e)}}function me(r){o.value.oauthToken=r.token,U("Token Copied",`Claude token from "${r.displayName}" has been applied`)}async function fe(){var e;if(!await((e=E.value)==null?void 0:e.validate().catch(()=>!1))){v("Validation Failed","Please fix form errors first");return}j.value=!0;try{const m=o.value.containerName||`bot-${o.value.name}`,T={BOT_TOKEN:o.value.botToken,CLAUDE_CODE_OAUTH_TOKEN:o.value.oauthToken,PROJECT_DIR:o.value.projectPath,ALLOWED_CHANNELS:o.value.allowedChannels,workspace:{containerName:m}},b=await x.validateConfig({config:T,projectPath:o.value.projectPath});h.value=b,S.value=!0,b.success||v("Validation Failed","Some checks did not pass. Please review the results.")}catch(m){v("Validation Error",m.message)}finally{j.value=!1}}return re(()=>{M();const r=setInterval(M,3e4);return()=>clearInterval(r)}),(r,e)=>{const m=p("el-button"),T=p("el-card"),b=p("el-col"),K=p("el-row"),ne=p("el-skeleton"),L=p("el-table-column"),W=p("el-tag"),ge=p("el-table"),Z=p("el-dialog"),$=p("el-input"),I=p("el-form-item"),he=p("el-divider"),le=p("el-dropdown-item"),ye=p("el-dropdown-menu"),we=p("el-dropdown"),_e=p("el-form"),ke=p("el-alert"),be=p("el-timeline-item"),Ce=p("el-timeline");return d(),y("div",tt,[t("div",at,[e[17]||(e[17]=t("div",null,[t("h1",null,"Dashboard"),t("p",{class:"subtitle"},"Manage your AgentWindow bot instances")],-1)),t("div",st,[l.value?(d(),C(m,{key:0,type:"info",icon:J($e),onClick:e[0]||(e[0]=n=>c.value=!0)},{default:a(()=>[g(" Import "+u(z.value)+" Running ",1)]),_:1},8,["icon"])):B("",!0),s(m,{type:"primary",icon:J(ie),onClick:e[1]||(e[1]=n=>_.value=!0)},{default:a(()=>[...e[16]||(e[16]=[g(" Add Instance ",-1)])]),_:1},8,["icon"])])]),s(K,{gutter:16,class:"stats-row"},{default:a(()=>[s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card"},{default:a(()=>[t("div",nt,[e[19]||(e[19]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("path",{d:"M8 12H16M12 8V16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),t("div",lt,[t("span",ot,u(V.value.length),1),e[18]||(e[18]=t("span",{class:"stat-label"},"Total",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card success"},{default:a(()=>[t("div",it,[e[21]||(e[21]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),t("circle",{cx:"12",cy:"12",r:"3",fill:"currentColor"})])],-1)),t("div",rt,[t("span",dt,u(q.value),1),e[20]||(e[20]=t("span",{class:"stat-label"},"Running",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card warning"},{default:a(()=>[t("div",ut,[e[23]||(e[23]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1",fill:"currentColor"})])],-1)),t("div",ct,[t("span",pt,u(X.value),1),e[22]||(e[22]=t("span",{class:"stat-label"},"Stopped",-1))])])]),_:1})]),_:1}),s(b,{xs:12,sm:6},{default:a(()=>[s(T,{class:"stat-card danger"},{default:a(()=>[t("div",vt,[e[25]||(e[25]=t("span",{class:"stat-icon"},[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[t("path",{d:"M12 9V12M12 16H12.01M5.29289 5.29289C2.99071 7.59508 2.19023 11.0184 3.27489 14.1236C4.35955 17.2288 7.19773 19.3613 10.4872 19.8428C13.7766 20.3242 17.0854 19.0828 19.0841 16.5841C21.0828 14.0854 21.4793 10.6367 20.1277 7.74488C18.7761 4.85303 15.8963 3.01887 12.7108 3.09219C9.52524 3.16552 6.73669 5.13405 5.51838 8.08105",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)),t("div",mt,[t("span",ft,u(i.value),1),e[24]||(e[24]=t("span",{class:"stat-label"},"Errors",-1))])])]),_:1})]),_:1})]),_:1}),P.value?(d(),y("div",gt,[s(ne,{rows:3,animated:""})])):V.value.length===0?(d(),y("div",ht,[e[27]||(e[27]=Ve('<div class="empty-icon" data-v-d703c50e><svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-d703c50e><rect x="8" y="8" width="48" height="48" rx="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-d703c50e></rect><rect x="16" y="16" width="16" height="16" rx="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.3" data-v-d703c50e></rect><path d="M32 32L48 48" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-d703c50e></path><circle cx="48" cy="16" r="3" fill="currentColor" fill-opacity="0.2" data-v-d703c50e></circle></svg></div><h3 data-v-d703c50e>No instances yet</h3><p data-v-d703c50e>Add your first AgentWindow bot instance to get started</p>',3)),s(m,{type:"primary",icon:J(ie),onClick:e[2]||(e[2]=n=>_.value=!0)},{default:a(()=>[...e[26]||(e[26]=[g(" Add Instance ",-1)])]),_:1},8,["icon"])])):(d(),C(K,{key:2,gutter:16,class:"instances-grid"},{default:a(()=>[(d(!0),y(G,null,Q(V.value,n=>(d(),C(b,{key:n.name,xs:24,sm:12,lg:8},{default:a(()=>[s(et,{instance:n},null,8,["instance"])]),_:2},1024))),128))]),_:1})),s(Z,{modelValue:c.value,"onUpdate:modelValue":e[4]||(e[4]=n=>c.value=n),title:"Import Running Instances",width:"600px"},{footer:a(()=>[s(m,{onClick:e[3]||(e[3]=n=>c.value=!1)},{default:a(()=>[...e[30]||(e[30]=[g("Close",-1)])]),_:1}),s(m,{type:"primary",icon:J(Ie),onClick:ce},{default:a(()=>[...e[31]||(e[31]=[g("Refresh",-1)])]),_:1},8,["icon"])]),default:a(()=>[e[32]||(e[32]=t("div",{class:"discover-info"},[t("p",null,"The following bot instances are running in PM2 but not yet registered:")],-1)),k.value?(d(),y("div",yt,[s(ne,{rows:2,animated:""})])):N.value.length===0?(d(),y("div",wt,[...e[28]||(e[28]=[t("p",null,"No unregistered instances found.",-1)])])):(d(),C(ge,{key:2,data:N.value,stripe:"",style:{width:"100%"}},{default:a(()=>[s(L,{prop:"displayName",label:"Name",width:"140"}),s(L,{prop:"botName",label:"PM2 Name",width:"130"}),s(L,{label:"Status",width:"90"},{default:a(({row:n})=>[n.isRunning?(d(),C(W,{key:0,type:"success",size:"small"},{default:a(()=>[...e[29]||(e[29]=[g("Running",-1)])]),_:1})):(d(),C(W,{key:1,type:"info",size:"small"},{default:a(()=>[g(u(n.status),1)]),_:2},1024))]),_:1}),s(L,{prop:"projectPath",label:"Path","show-overflow-tooltip":""}),s(L,{label:"Action",width:"80",align:"center"},{default:a(({row:n})=>[s(m,{type:"primary",size:"small",loading:F.value===n.name,disabled:A.value.includes(n.name),onClick:xe=>pe(n)},{default:a(()=>[g(u(A.value.includes(n.name)?"Done":"Import"),1)]),_:2},1032,["loading","disabled","onClick"])]),_:1})]),_:1},8,["data"]))]),_:1},8,["modelValue"]),s(Z,{modelValue:_.value,"onUpdate:modelValue":e[13]||(e[13]=n=>_.value=n),title:"Add Instance",width:"500px","before-close":ae},{footer:a(()=>[t("div",kt,[t("div",bt,[s(m,{loading:j.value,onClick:fe},{default:a(()=>[...e[39]||(e[39]=[g(" Test Config ",-1)])]),_:1},8,["loading"]),h.value?(d(),y("div",Ct,[s(W,{type:h.value.success?"success":"danger",size:"small"},{default:a(()=>[g(u(h.value.success?"Ready":"Issues Found"),1)]),_:1},8,["type"])])):B("",!0)]),t("div",xt,[s(m,{onClick:ae},{default:a(()=>[...e[40]||(e[40]=[g("Cancel",-1)])]),_:1}),s(m,{type:"primary",loading:R.value,disabled:h.value&&!h.value.success,onClick:te},{default:a(()=>[...e[41]||(e[41]=[g(" Add Instance ",-1)])]),_:1},8,["loading","disabled"])])])]),default:a(()=>[s(_e,{ref_key:"formRef",ref:E,model:o.value,rules:Y,"label-width":"100px"},{default:a(()=>[s(I,{label:"Name",prop:"name"},{default:a(()=>[s($,{modelValue:o.value.name,"onUpdate:modelValue":e[5]||(e[5]=n=>o.value.name=n),placeholder:"my-bot",onKeyup:Te(te,["enter"])},null,8,["modelValue"])]),_:1}),s(I,{label:"Display Name",prop:"displayName"},{default:a(()=>[s($,{modelValue:o.value.displayName,"onUpdate:modelValue":e[6]||(e[6]=n=>o.value.displayName=n),placeholder:"My Bot"},null,8,["modelValue"])]),_:1}),s(I,{label:"Project Path",prop:"projectPath"},{default:a(()=>[s($,{modelValue:o.value.projectPath,"onUpdate:modelValue":e[7]||(e[7]=n=>o.value.projectPath=n),placeholder:"/path/to/project"},null,8,["modelValue"]),e[33]||(e[33]=t("div",{class:"form-hint"},"Directory where bot config will be stored",-1))]),_:1}),s(he,{"content-position":"left"},{default:a(()=>[...e[34]||(e[34]=[g("Bot Configuration",-1)])]),_:1}),s(I,{label:"Discord Bot Token",prop:"botToken"},{default:a(()=>[s($,{modelValue:o.value.botToken,"onUpdate:modelValue":e[8]||(e[8]=n=>o.value.botToken=n),type:"password",placeholder:"Your Discord bot token","show-password":""},null,8,["modelValue"])]),_:1}),s(I,{label:"Claude OAuth Token",prop:"oauthToken"},{default:a(()=>[s($,{modelValue:o.value.oauthToken,"onUpdate:modelValue":e[9]||(e[9]=n=>o.value.oauthToken=n),type:"password",placeholder:"sk-ant-...","show-password":""},{append:a(()=>[s(we,{trigger:"click",onVisibleChange:ve},{dropdown:a(()=>[s(ye,null,{default:a(()=>[O.value.length===0?(d(),C(le,{key:0,disabled:""},{default:a(()=>[...e[36]||(e[36]=[g(" No tokens available ",-1)])]),_:1})):B("",!0),(d(!0),y(G,null,Q(O.value,n=>(d(),C(le,{key:n.instanceName,onClick:xe=>me(n)},{default:a(()=>[t("div",_t,[t("span",null,u(n.displayName),1),s(W,{size:"small",type:"info"},{default:a(()=>[g(u(n.maskedToken),1)]),_:2},1024)])]),_:2},1032,["onClick"]))),128))]),_:1})]),default:a(()=>[s(m,null,{default:a(()=>[...e[35]||(e[35]=[g(" Copy from... ",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"]),e[37]||(e[37]=t("div",{class:"form-hint"},"Reuse token from existing instances",-1))]),_:1}),s(I,{label:"Allowed Channels",prop:"allowedChannels"},{default:a(()=>[s($,{modelValue:o.value.allowedChannels,"onUpdate:modelValue":e[10]||(e[10]=n=>o.value.allowedChannels=n),placeholder:"channel-id-1,channel-id-2"},null,8,["modelValue"]),e[38]||(e[38]=t("div",{class:"form-hint"},"Comma-separated Discord channel IDs",-1))]),_:1}),s(I,{label:"Container Name",prop:"containerName"},{default:a(()=>[s($,{modelValue:o.value.containerName,"onUpdate:modelValue":e[11]||(e[11]=n=>o.value.containerName=n),placeholder:"bot-my-bot (auto-generated if empty)"},null,8,["modelValue"])]),_:1}),s(I,{label:"Tags",prop:"tags"},{default:a(()=>[s($,{modelValue:o.value.tagsInput,"onUpdate:modelValue":e[12]||(e[12]=n=>o.value.tagsInput=n),placeholder:"prod, staging (comma separated)"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),s(Z,{modelValue:S.value,"onUpdate:modelValue":e[15]||(e[15]=n=>S.value=n),title:"Configuration Validation Results",width:"600px"},{footer:a(()=>[s(m,{onClick:e[14]||(e[14]=n=>S.value=!1)},{default:a(()=>[...e[42]||(e[42]=[g("Close",-1)])]),_:1})]),default:a(()=>[h.value?(d(),y("div",Nt,[s(ke,{type:h.value.success?"success":"warning",title:h.value.success?"All checks passed!":"Some checks failed",closable:!1,style:{"margin-bottom":"20px"}},{default:a(()=>[t("div",null," Passed: "+u(H.value.length)+" / "+u(h.value.checks.length),1)]),_:1},8,["type","title"]),s(Ce,null,{default:a(()=>[(d(!0),y(G,null,Q(h.value.checks,n=>(d(),C(be,{key:n.name,type:n.status==="passed"?"success":n.status==="failed"?"danger":"warning"},{default:a(()=>[t("div",Vt,[t("div",Tt,u(n.name),1),t("div",$t,u(n.message),1)])]),_:2},1032,["type"]))),128))]),_:1})])):B("",!0)]),_:1},8,["modelValue"])])}}},Mt=ue(It,[["__scopeId","data-v-d703c50e"]]);export{Mt as default};
|