agent-window 1.1.2 → 1.1.3
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/api/routes/instances.js +109 -0
- package/src/core/instance/config-reader.js +72 -0
- package/web/dist/assets/{Dashboard-C-Q5-Mn4.js → Dashboard-CK9p-dpz.js} +1 -1
- package/web/dist/assets/{InstanceDetail-DxooHoGi.css → InstanceDetail-E-9-YoyH.css} +1 -1
- package/web/dist/assets/InstanceDetail-txSTEfck.js +3 -0
- package/web/dist/assets/{Instances-DpVL5y7K.js → Instances-DFQOoLYE.js} +1 -1
- package/web/dist/assets/{Settings-B1H4osZM.js → Settings-DUvrHXXe.js} +1 -1
- package/web/dist/assets/{main-Ce4eRTG3.js → main-CICHNbG_.js} +5 -5
- package/web/dist/index.html +1 -1
- package/web/dist/assets/InstanceDetail-DKi-bm1V.js +0 -3
package/package.json
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
getStatus,
|
|
23
23
|
getLogs
|
|
24
24
|
} from '../../core/instance/pm2-bridge.js';
|
|
25
|
+
import { readConfig, writeConfig } from '../../core/instance/config-reader.js';
|
|
25
26
|
import { existsSync } from 'fs';
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -329,5 +330,113 @@ export async function registerInstanceRoutes(fastify) {
|
|
|
329
330
|
}
|
|
330
331
|
});
|
|
331
332
|
|
|
333
|
+
/**
|
|
334
|
+
* GET /api/instances/:name/config
|
|
335
|
+
* Get instance configuration
|
|
336
|
+
*/
|
|
337
|
+
fastify.get('/api/instances/:name/config', {
|
|
338
|
+
schema: {
|
|
339
|
+
description: 'Get instance configuration',
|
|
340
|
+
params: {
|
|
341
|
+
name: { type: 'string' }
|
|
342
|
+
},
|
|
343
|
+
tags: ['instances']
|
|
344
|
+
}
|
|
345
|
+
}, async (request, reply) => {
|
|
346
|
+
try {
|
|
347
|
+
const { name } = request.params;
|
|
348
|
+
const instance = await getInstance(name);
|
|
349
|
+
|
|
350
|
+
if (!instance) {
|
|
351
|
+
return reply.code(404).send({
|
|
352
|
+
error: 'Instance not found',
|
|
353
|
+
name
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!instance.configPath) {
|
|
358
|
+
return reply.code(400).send({
|
|
359
|
+
error: 'Instance does not have a config file'
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const result = readConfig(instance.configPath);
|
|
364
|
+
|
|
365
|
+
if (!result.success) {
|
|
366
|
+
return reply.code(400).send({
|
|
367
|
+
error: result.error
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return {
|
|
372
|
+
config: result.config,
|
|
373
|
+
path: result.path
|
|
374
|
+
};
|
|
375
|
+
} catch (error) {
|
|
376
|
+
reply.code(500).send({
|
|
377
|
+
error: 'Failed to read config',
|
|
378
|
+
message: error.message
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* PUT /api/instances/:name/config
|
|
385
|
+
* Update instance configuration
|
|
386
|
+
*/
|
|
387
|
+
fastify.put('/api/instances/:name/config', {
|
|
388
|
+
schema: {
|
|
389
|
+
description: 'Update instance configuration',
|
|
390
|
+
params: {
|
|
391
|
+
name: { type: 'string' }
|
|
392
|
+
},
|
|
393
|
+
body: {
|
|
394
|
+
type: 'object',
|
|
395
|
+
required: ['config'],
|
|
396
|
+
properties: {
|
|
397
|
+
config: { type: 'string' }
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
tags: ['instances']
|
|
401
|
+
}
|
|
402
|
+
}, async (request, reply) => {
|
|
403
|
+
try {
|
|
404
|
+
const { name } = request.params;
|
|
405
|
+
const { config } = request.body;
|
|
406
|
+
const instance = await getInstance(name);
|
|
407
|
+
|
|
408
|
+
if (!instance) {
|
|
409
|
+
return reply.code(404).send({
|
|
410
|
+
error: 'Instance not found',
|
|
411
|
+
name
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (!instance.configPath) {
|
|
416
|
+
return reply.code(400).send({
|
|
417
|
+
error: 'Instance does not have a config file'
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const result = writeConfig(instance.configPath, config);
|
|
422
|
+
|
|
423
|
+
if (!result.success) {
|
|
424
|
+
return reply.code(400).send({
|
|
425
|
+
error: result.error
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return {
|
|
430
|
+
success: true,
|
|
431
|
+
message: 'Configuration updated'
|
|
432
|
+
};
|
|
433
|
+
} catch (error) {
|
|
434
|
+
reply.code(500).send({
|
|
435
|
+
error: 'Failed to save config',
|
|
436
|
+
message: error.message
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
|
|
332
441
|
fastify.log.info('Instance routes registered');
|
|
333
442
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Reader
|
|
3
|
+
*
|
|
4
|
+
* Read and write instance configuration files.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
8
|
+
import { existsSync } from 'fs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Read config file content
|
|
12
|
+
* @param {string} configPath - Path to config file
|
|
13
|
+
* @returns {Object} Result with config content
|
|
14
|
+
*/
|
|
15
|
+
export function readConfig(configPath) {
|
|
16
|
+
if (!configPath || !existsSync(configPath)) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
error: 'Config file not found',
|
|
20
|
+
config: null
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
26
|
+
const config = JSON.parse(content);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
config: JSON.stringify(config, null, 2),
|
|
31
|
+
path: configPath
|
|
32
|
+
};
|
|
33
|
+
} catch (error) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
error: error.message,
|
|
37
|
+
config: null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Write config file content
|
|
44
|
+
* @param {string} configPath - Path to config file
|
|
45
|
+
* @param {string} content - JSON content
|
|
46
|
+
* @returns {Object} Result
|
|
47
|
+
*/
|
|
48
|
+
export function writeConfig(configPath, content) {
|
|
49
|
+
if (!configPath) {
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
error: 'Config path is required'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
// Validate JSON
|
|
58
|
+
const config = JSON.parse(content);
|
|
59
|
+
|
|
60
|
+
// Write with pretty formatting
|
|
61
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
success: true
|
|
65
|
+
};
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: error.message
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aA as dt,j as st,ab as v,y as u,z as I,D as n,E as t,R as p,G as tt,B as g,P as E,J as at,a5 as nt,c as _,r as h,Q as w,u as q,C as a,aw as ut,am as ct}from"./vue-vendor-CGSlMM3Y.js";import{d as pt,p as et,r as vt}from"./element-plus-CSm40ime.js";import{a as x,u as ot}from"./main-Ce4eRTG3.js";import{_ as lt}from"./_plugin-vue_export-helper-DlAUqK2U.js";const mt={class:"card-header"},ft={class:"header-left"},ht={class:"instance-info"},gt={class:"instance-name"},yt={class:"instance-alias"},wt={class:"status-label"},_t={class:"card-body"},bt={class:"info-row"},kt={class:"info-row"},xt={class:"value"},Ct={key:0,class:"stats-row"},$t={class:"stat"},It={class:"stat-value"},Nt={class:"stat"},Mt={class:"stat-value"},Vt={key:0,class:"stat"},jt={class:"stat-value"},Pt={key:1,class:"tags-row"},Bt={class:"card-actions"},Dt={class:"action-buttons"},Rt=["disabled"],St=["disabled"],At=["disabled"],Tt={__name:"InstanceCard",props:{instance:{type:Object,required:!0}},setup(C,{expose:R}){const c=C,k=dt(),{success:$,error:y}=ot(),d=h({status:"unknown",exists:!1,memory:0,cpu:0,uptime:0}),M=_(()=>{const o=d.value.status;return o==="online"?"online":o==="stopped"?"stopped":o==="errored"?"error":o==="restarting"?"restarting":"stopped"}),V=_(()=>{const o=d.value.status;return{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting",unknown:"Unknown"}[o]||"Unknown"}),b=_(()=>{const o=c.instance.projectPath;return o.length>35?"..."+o.slice(-32):o}),j=_(()=>({"bmad-plugin":"BMAD 插件","simple-config":"基础版",standalone:"独立实例",unknown:"未知"})[c.instance.instanceType]||"未知"),P=_(()=>`type-${c.instance.instanceType}`);async function m(){try{const o=await x.getInstanceStatus(c.instance.name);d.value=o}catch{d.value={status:"unknown",exists:!1,memory:0,cpu:0,uptime:0}}}async function r(){try{await x.startInstance(c.instance.name),$("Started",`${c.instance.name} has been started`),await m()}catch(o){y("Failed to start",o.message)}}async function L(){try{await x.stopInstance(c.instance.name),$("Stopped",`${c.instance.name} has been stopped`),await m()}catch(o){y("Failed to stop",o.message)}}async function S(){try{await x.restartInstance(c.instance.name),$("Restarted",`${c.instance.name} has been restarted`),await m()}catch(o){y("Failed to restart",o.message)}}function G(){k.push(`/instances/${c.instance.name}`)}function H(o){const s=o/1024/1024;return s>=1024?(s/1024).toFixed(1)+" GB":Math.round(s)+" MB"}function K(o){if(!o)return"-";const s=Math.floor((Date.now()-o)/1e3);return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}return st(()=>{m();const o=setInterval(m,1e4);return()=>clearInterval(o)}),R({fetchStatus:m}),(o,s)=>{const A=v("el-card");return u(),I(A,{class:"instance-card"},{default:n(()=>{var T;return[t("div",mt,[t("div",ft,[s[0]||(s[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",ht,[t("h3",gt,p(C.instance.displayName||C.instance.name),1),t("span",yt,p(C.instance.name),1)])]),t("div",{class:tt(["status-indicator",M.value])},[s[1]||(s[1]=t("span",{class:"status-dot"},null,-1)),t("span",wt,p(V.value),1)],2)]),t("div",_t,[t("div",bt,[s[2]||(s[2]=t("span",{class:"label"},"Type",-1)),t("span",{class:tt(["value instance-type",P.value])},p(j.value),3)]),t("div",kt,[s[3]||(s[3]=t("span",{class:"label"},"Path",-1)),t("span",xt,p(b.value),1)]),d.value.exists?(u(),g("div",Ct,[t("div",$t,[s[4]||(s[4]=t("span",{class:"stat-label"},"Memory",-1)),t("span",It,p(H(d.value.memory)),1)]),t("div",Nt,[s[5]||(s[5]=t("span",{class:"stat-label"},"CPU",-1)),t("span",Mt,p(d.value.cpu)+"%",1)]),d.value.status==="online"?(u(),g("div",Vt,[s[6]||(s[6]=t("span",{class:"stat-label"},"Uptime",-1)),t("span",jt,p(K(d.value.uptime)),1)])):E("",!0)])):E("",!0),(T=C.instance.tags)!=null&&T.length?(u(),g("div",Pt,[(u(!0),g(at,null,nt(C.instance.tags,U=>(u(),g("span",{key:U,class:"tag"},p(U),1))),128))])):E("",!0)]),t("div",Bt,[t("div",Dt,[t("button",{class:"action-btn",disabled:d.value.status==="online",title:"Start",onClick:r},[...s[7]||(s[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,Rt),t("button",{class:"action-btn",disabled:d.value.status!=="online",title:"Stop",onClick:L},[...s[8]||(s[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,St),t("button",{class:"action-btn",disabled:d.value.status==="unknown",title:"Restart",onClick:S},[...s[9]||(s[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,At)]),t("button",{class:"details-btn",onClick:G}," Details ")])]}),_:1})}}},Ut=lt(Tt,[["__scopeId","data-v-948fce60"]]),Ft={class:"dashboard-view"},zt={class:"dashboard-header"},qt={class:"header-actions"},Et={class:"stat-content"},Lt={class:"stat-info"},Gt={class:"stat-value"},Ht={class:"stat-content"},Kt={class:"stat-info"},Ot={class:"stat-value"},Wt={class:"stat-content"},Jt={class:"stat-info"},Qt={class:"stat-value"},Xt={class:"stat-content"},Yt={class:"stat-info"},Zt={class:"stat-value"},te={key:0,class:"loading-state"},ee={key:1,class:"empty-state"},se={key:0,class:"loading-state"},ae={key:1,class:"empty-discovered"},ne={__name:"Dashboard",setup(C){const{success:R,error:c}=ot(),k=h([]),$=h(!0),y=h(!1),d=h(!1),M=h(!1),V=h(null),b=h([]),j=h(!1),P=h(null),m=h([]),r=h({name:"",displayName:"",projectPath:"",tagsInput:""}),L={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"}]},S=_(()=>k.value.filter(i=>i.enabled).length),G=_(()=>k.value.length-S.value),H=_(()=>0),K=_(()=>b.value.length>0),o=_(()=>b.value.length);async function s(){$.value=!0;try{k.value=await x.getInstances(),await A()}catch(i){c("Failed to load",i.message)}finally{$.value=!1}}async function A(){try{const i=await x.discoverInstances();b.value=i.discovered||[]}catch{b.value=[]}}async function T(){j.value=!0;try{await A()}catch(i){c("Discovery failed",i.message)}finally{j.value=!1}}async function U(i){P.value=i.name;try{await x.importInstance({name:i.name,botName:i.botName,displayName:i.displayName,projectPath:i.projectPath}),m.value.push(i.name),R("Imported",`Instance "${i.displayName}" has been imported`),await s(),m.value.length>=b.value.length&&(d.value=!1,m.value=[])}catch(e){c("Import failed",e.message)}finally{P.value=null}}async function O(){var e;if(await((e=V.value)==null?void 0:e.validate().catch(()=>!1))){M.value=!0;try{const f=r.value.tagsInput?r.value.tagsInput.split(",").map(N=>N.trim()).filter(Boolean):[];await x.addInstance({name:r.value.name,displayName:r.value.displayName||r.value.name,projectPath:r.value.projectPath,tags:f}),R("Added",`Instance "${r.value.name}" has been added`),y.value=!1,J(),await s()}catch(f){c("Failed to add",f.message)}finally{M.value=!1}}}function W(){y.value=!1,J()}function J(){var i;r.value={name:"",displayName:"",projectPath:"",tagsInput:""},(i=V.value)==null||i.clearValidation()}return st(()=>{s();const i=setInterval(s,3e4);return()=>clearInterval(i)}),(i,e)=>{const f=v("el-button"),N=v("el-card"),B=v("el-col"),Q=v("el-row"),X=v("el-skeleton"),D=v("el-table-column"),Y=v("el-tag"),it=v("el-table"),Z=v("el-dialog"),F=v("el-input"),z=v("el-form-item"),rt=v("el-form");return u(),g("div",Ft,[t("div",zt,[e[11]||(e[11]=t("div",null,[t("h1",null,"Dashboard"),t("p",{class:"subtitle"},"Manage your AgentWindow bot instances")],-1)),t("div",qt,[K.value?(u(),I(f,{key:0,type:"info",icon:q(pt),onClick:e[0]||(e[0]=l=>d.value=!0)},{default:n(()=>[w(" Import "+p(o.value)+" Running ",1)]),_:1},8,["icon"])):E("",!0),a(f,{type:"primary",icon:q(et),onClick:e[1]||(e[1]=l=>y.value=!0)},{default:n(()=>[...e[10]||(e[10]=[w(" Add Instance ",-1)])]),_:1},8,["icon"])])]),a(Q,{gutter:16,class:"stats-row"},{default:n(()=>[a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card"},{default:n(()=>[t("div",Et,[e[13]||(e[13]=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",Gt,p(k.value.length),1),e[12]||(e[12]=t("span",{class:"stat-label"},"Total",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card success"},{default:n(()=>[t("div",Ht,[e[15]||(e[15]=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",Kt,[t("span",Ot,p(S.value),1),e[14]||(e[14]=t("span",{class:"stat-label"},"Running",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card warning"},{default:n(()=>[t("div",Wt,[e[17]||(e[17]=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",Jt,[t("span",Qt,p(G.value),1),e[16]||(e[16]=t("span",{class:"stat-label"},"Stopped",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card danger"},{default:n(()=>[t("div",Xt,[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("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",Yt,[t("span",Zt,p(H.value),1),e[18]||(e[18]=t("span",{class:"stat-label"},"Errors",-1))])])]),_:1})]),_:1})]),_:1}),$.value?(u(),g("div",te,[a(X,{rows:3,animated:""})])):k.value.length===0?(u(),g("div",ee,[e[21]||(e[21]=ut('<div class="empty-icon" data-v-b35a8700><svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-b35a8700><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-b35a8700></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-b35a8700></rect><path d="M32 32L48 48" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-b35a8700></path><circle cx="48" cy="16" r="3" fill="currentColor" fill-opacity="0.2" data-v-b35a8700></circle></svg></div><h3 data-v-b35a8700>No instances yet</h3><p data-v-b35a8700>Add your first AgentWindow bot instance to get started</p>',3)),a(f,{type:"primary",icon:q(et),onClick:e[2]||(e[2]=l=>y.value=!0)},{default:n(()=>[...e[20]||(e[20]=[w(" Add Instance ",-1)])]),_:1},8,["icon"])])):(u(),I(Q,{key:2,gutter:16,class:"instances-grid"},{default:n(()=>[(u(!0),g(at,null,nt(k.value,l=>(u(),I(B,{key:l.name,xs:24,sm:12,lg:8},{default:n(()=>[a(Ut,{instance:l},null,8,["instance"])]),_:2},1024))),128))]),_:1})),a(Z,{modelValue:d.value,"onUpdate:modelValue":e[4]||(e[4]=l=>d.value=l),title:"Import Running Instances",width:"600px"},{footer:n(()=>[a(f,{onClick:e[3]||(e[3]=l=>d.value=!1)},{default:n(()=>[...e[24]||(e[24]=[w("Close",-1)])]),_:1}),a(f,{type:"primary",icon:q(vt),onClick:T},{default:n(()=>[...e[25]||(e[25]=[w("Refresh",-1)])]),_:1},8,["icon"])]),default:n(()=>[e[26]||(e[26]=t("div",{class:"discover-info"},[t("p",null,"The following bot instances are running in PM2 but not yet registered:")],-1)),j.value?(u(),g("div",se,[a(X,{rows:2,animated:""})])):b.value.length===0?(u(),g("div",ae,[...e[22]||(e[22]=[t("p",null,"No unregistered instances found.",-1)])])):(u(),I(it,{key:2,data:b.value,stripe:"",style:{width:"100%"}},{default:n(()=>[a(D,{prop:"displayName",label:"Name",width:"140"}),a(D,{prop:"botName",label:"PM2 Name",width:"130"}),a(D,{label:"Status",width:"90"},{default:n(({row:l})=>[l.isRunning?(u(),I(Y,{key:0,type:"success",size:"small"},{default:n(()=>[...e[23]||(e[23]=[w("Running",-1)])]),_:1})):(u(),I(Y,{key:1,type:"info",size:"small"},{default:n(()=>[w(p(l.status),1)]),_:2},1024))]),_:1}),a(D,{prop:"projectPath",label:"Path","show-overflow-tooltip":""}),a(D,{label:"Action",width:"80",align:"center"},{default:n(({row:l})=>[a(f,{type:"primary",size:"small",loading:P.value===l.name,disabled:m.value.includes(l.name),onClick:oe=>U(l)},{default:n(()=>[w(p(m.value.includes(l.name)?"Done":"Import"),1)]),_:2},1032,["loading","disabled","onClick"])]),_:1})]),_:1},8,["data"]))]),_:1},8,["modelValue"]),a(Z,{modelValue:y.value,"onUpdate:modelValue":e[9]||(e[9]=l=>y.value=l),title:"Add Instance",width:"500px","before-close":W},{footer:n(()=>[a(f,{onClick:W},{default:n(()=>[...e[28]||(e[28]=[w("Cancel",-1)])]),_:1}),a(f,{type:"primary",loading:M.value,onClick:O},{default:n(()=>[...e[29]||(e[29]=[w(" Add Instance ",-1)])]),_:1},8,["loading"])]),default:n(()=>[a(rt,{ref_key:"formRef",ref:V,model:r.value,rules:L,"label-width":"100px"},{default:n(()=>[a(z,{label:"Name",prop:"name"},{default:n(()=>[a(F,{modelValue:r.value.name,"onUpdate:modelValue":e[5]||(e[5]=l=>r.value.name=l),placeholder:"my-bot",onKeyup:ct(O,["enter"])},null,8,["modelValue"])]),_:1}),a(z,{label:"Display Name",prop:"displayName"},{default:n(()=>[a(F,{modelValue:r.value.displayName,"onUpdate:modelValue":e[6]||(e[6]=l=>r.value.displayName=l),placeholder:"My Bot"},null,8,["modelValue"])]),_:1}),a(z,{label:"Project Path",prop:"projectPath"},{default:n(()=>[a(F,{modelValue:r.value.projectPath,"onUpdate:modelValue":e[7]||(e[7]=l=>r.value.projectPath=l),placeholder:"/path/to/project"},null,8,["modelValue"]),e[27]||(e[27]=t("div",{class:"form-hint"},"Path to the bot project directory",-1))]),_:1}),a(z,{label:"Tags",prop:"tags"},{default:n(()=>[a(F,{modelValue:r.value.tagsInput,"onUpdate:modelValue":e[8]||(e[8]=l=>r.value.tagsInput=l),placeholder:"prod, staging (comma separated)"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])])}}},ue=lt(ne,[["__scopeId","data-v-b35a8700"]]);export{ue as default};
|
|
1
|
+
import{aA as dt,j as st,ab as v,y as u,z as I,D as n,E as t,R as p,G as tt,B as g,P as E,J as at,a5 as nt,c as _,r as h,Q as w,u as q,C as a,aw as ut,am as ct}from"./vue-vendor-CGSlMM3Y.js";import{d as pt,p as et,r as vt}from"./element-plus-CSm40ime.js";import{a as x,u as ot}from"./main-CICHNbG_.js";import{_ as lt}from"./_plugin-vue_export-helper-DlAUqK2U.js";const mt={class:"card-header"},ft={class:"header-left"},ht={class:"instance-info"},gt={class:"instance-name"},yt={class:"instance-alias"},wt={class:"status-label"},_t={class:"card-body"},bt={class:"info-row"},kt={class:"info-row"},xt={class:"value"},Ct={key:0,class:"stats-row"},$t={class:"stat"},It={class:"stat-value"},Nt={class:"stat"},Mt={class:"stat-value"},Vt={key:0,class:"stat"},jt={class:"stat-value"},Pt={key:1,class:"tags-row"},Bt={class:"card-actions"},Dt={class:"action-buttons"},Rt=["disabled"],St=["disabled"],At=["disabled"],Tt={__name:"InstanceCard",props:{instance:{type:Object,required:!0}},setup(C,{expose:R}){const c=C,k=dt(),{success:$,error:y}=ot(),d=h({status:"unknown",exists:!1,memory:0,cpu:0,uptime:0}),M=_(()=>{const o=d.value.status;return o==="online"?"online":o==="stopped"?"stopped":o==="errored"?"error":o==="restarting"?"restarting":"stopped"}),V=_(()=>{const o=d.value.status;return{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting",unknown:"Unknown"}[o]||"Unknown"}),b=_(()=>{const o=c.instance.projectPath;return o.length>35?"..."+o.slice(-32):o}),j=_(()=>({"bmad-plugin":"BMAD 插件","simple-config":"基础版",standalone:"独立实例",unknown:"未知"})[c.instance.instanceType]||"未知"),P=_(()=>`type-${c.instance.instanceType}`);async function m(){try{const o=await x.getInstanceStatus(c.instance.name);d.value=o}catch{d.value={status:"unknown",exists:!1,memory:0,cpu:0,uptime:0}}}async function r(){try{await x.startInstance(c.instance.name),$("Started",`${c.instance.name} has been started`),await m()}catch(o){y("Failed to start",o.message)}}async function L(){try{await x.stopInstance(c.instance.name),$("Stopped",`${c.instance.name} has been stopped`),await m()}catch(o){y("Failed to stop",o.message)}}async function S(){try{await x.restartInstance(c.instance.name),$("Restarted",`${c.instance.name} has been restarted`),await m()}catch(o){y("Failed to restart",o.message)}}function G(){k.push(`/instances/${c.instance.name}`)}function H(o){const s=o/1024/1024;return s>=1024?(s/1024).toFixed(1)+" GB":Math.round(s)+" MB"}function K(o){if(!o)return"-";const s=Math.floor((Date.now()-o)/1e3);return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}return st(()=>{m();const o=setInterval(m,1e4);return()=>clearInterval(o)}),R({fetchStatus:m}),(o,s)=>{const A=v("el-card");return u(),I(A,{class:"instance-card"},{default:n(()=>{var T;return[t("div",mt,[t("div",ft,[s[0]||(s[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",ht,[t("h3",gt,p(C.instance.displayName||C.instance.name),1),t("span",yt,p(C.instance.name),1)])]),t("div",{class:tt(["status-indicator",M.value])},[s[1]||(s[1]=t("span",{class:"status-dot"},null,-1)),t("span",wt,p(V.value),1)],2)]),t("div",_t,[t("div",bt,[s[2]||(s[2]=t("span",{class:"label"},"Type",-1)),t("span",{class:tt(["value instance-type",P.value])},p(j.value),3)]),t("div",kt,[s[3]||(s[3]=t("span",{class:"label"},"Path",-1)),t("span",xt,p(b.value),1)]),d.value.exists?(u(),g("div",Ct,[t("div",$t,[s[4]||(s[4]=t("span",{class:"stat-label"},"Memory",-1)),t("span",It,p(H(d.value.memory)),1)]),t("div",Nt,[s[5]||(s[5]=t("span",{class:"stat-label"},"CPU",-1)),t("span",Mt,p(d.value.cpu)+"%",1)]),d.value.status==="online"?(u(),g("div",Vt,[s[6]||(s[6]=t("span",{class:"stat-label"},"Uptime",-1)),t("span",jt,p(K(d.value.uptime)),1)])):E("",!0)])):E("",!0),(T=C.instance.tags)!=null&&T.length?(u(),g("div",Pt,[(u(!0),g(at,null,nt(C.instance.tags,U=>(u(),g("span",{key:U,class:"tag"},p(U),1))),128))])):E("",!0)]),t("div",Bt,[t("div",Dt,[t("button",{class:"action-btn",disabled:d.value.status==="online",title:"Start",onClick:r},[...s[7]||(s[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,Rt),t("button",{class:"action-btn",disabled:d.value.status!=="online",title:"Stop",onClick:L},[...s[8]||(s[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,St),t("button",{class:"action-btn",disabled:d.value.status==="unknown",title:"Restart",onClick:S},[...s[9]||(s[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,At)]),t("button",{class:"details-btn",onClick:G}," Details ")])]}),_:1})}}},Ut=lt(Tt,[["__scopeId","data-v-948fce60"]]),Ft={class:"dashboard-view"},zt={class:"dashboard-header"},qt={class:"header-actions"},Et={class:"stat-content"},Lt={class:"stat-info"},Gt={class:"stat-value"},Ht={class:"stat-content"},Kt={class:"stat-info"},Ot={class:"stat-value"},Wt={class:"stat-content"},Jt={class:"stat-info"},Qt={class:"stat-value"},Xt={class:"stat-content"},Yt={class:"stat-info"},Zt={class:"stat-value"},te={key:0,class:"loading-state"},ee={key:1,class:"empty-state"},se={key:0,class:"loading-state"},ae={key:1,class:"empty-discovered"},ne={__name:"Dashboard",setup(C){const{success:R,error:c}=ot(),k=h([]),$=h(!0),y=h(!1),d=h(!1),M=h(!1),V=h(null),b=h([]),j=h(!1),P=h(null),m=h([]),r=h({name:"",displayName:"",projectPath:"",tagsInput:""}),L={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"}]},S=_(()=>k.value.filter(i=>i.enabled).length),G=_(()=>k.value.length-S.value),H=_(()=>0),K=_(()=>b.value.length>0),o=_(()=>b.value.length);async function s(){$.value=!0;try{k.value=await x.getInstances(),await A()}catch(i){c("Failed to load",i.message)}finally{$.value=!1}}async function A(){try{const i=await x.discoverInstances();b.value=i.discovered||[]}catch{b.value=[]}}async function T(){j.value=!0;try{await A()}catch(i){c("Discovery failed",i.message)}finally{j.value=!1}}async function U(i){P.value=i.name;try{await x.importInstance({name:i.name,botName:i.botName,displayName:i.displayName,projectPath:i.projectPath}),m.value.push(i.name),R("Imported",`Instance "${i.displayName}" has been imported`),await s(),m.value.length>=b.value.length&&(d.value=!1,m.value=[])}catch(e){c("Import failed",e.message)}finally{P.value=null}}async function O(){var e;if(await((e=V.value)==null?void 0:e.validate().catch(()=>!1))){M.value=!0;try{const f=r.value.tagsInput?r.value.tagsInput.split(",").map(N=>N.trim()).filter(Boolean):[];await x.addInstance({name:r.value.name,displayName:r.value.displayName||r.value.name,projectPath:r.value.projectPath,tags:f}),R("Added",`Instance "${r.value.name}" has been added`),y.value=!1,J(),await s()}catch(f){c("Failed to add",f.message)}finally{M.value=!1}}}function W(){y.value=!1,J()}function J(){var i;r.value={name:"",displayName:"",projectPath:"",tagsInput:""},(i=V.value)==null||i.clearValidation()}return st(()=>{s();const i=setInterval(s,3e4);return()=>clearInterval(i)}),(i,e)=>{const f=v("el-button"),N=v("el-card"),B=v("el-col"),Q=v("el-row"),X=v("el-skeleton"),D=v("el-table-column"),Y=v("el-tag"),it=v("el-table"),Z=v("el-dialog"),F=v("el-input"),z=v("el-form-item"),rt=v("el-form");return u(),g("div",Ft,[t("div",zt,[e[11]||(e[11]=t("div",null,[t("h1",null,"Dashboard"),t("p",{class:"subtitle"},"Manage your AgentWindow bot instances")],-1)),t("div",qt,[K.value?(u(),I(f,{key:0,type:"info",icon:q(pt),onClick:e[0]||(e[0]=l=>d.value=!0)},{default:n(()=>[w(" Import "+p(o.value)+" Running ",1)]),_:1},8,["icon"])):E("",!0),a(f,{type:"primary",icon:q(et),onClick:e[1]||(e[1]=l=>y.value=!0)},{default:n(()=>[...e[10]||(e[10]=[w(" Add Instance ",-1)])]),_:1},8,["icon"])])]),a(Q,{gutter:16,class:"stats-row"},{default:n(()=>[a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card"},{default:n(()=>[t("div",Et,[e[13]||(e[13]=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",Gt,p(k.value.length),1),e[12]||(e[12]=t("span",{class:"stat-label"},"Total",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card success"},{default:n(()=>[t("div",Ht,[e[15]||(e[15]=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",Kt,[t("span",Ot,p(S.value),1),e[14]||(e[14]=t("span",{class:"stat-label"},"Running",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card warning"},{default:n(()=>[t("div",Wt,[e[17]||(e[17]=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",Jt,[t("span",Qt,p(G.value),1),e[16]||(e[16]=t("span",{class:"stat-label"},"Stopped",-1))])])]),_:1})]),_:1}),a(B,{xs:12,sm:6},{default:n(()=>[a(N,{class:"stat-card danger"},{default:n(()=>[t("div",Xt,[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("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",Yt,[t("span",Zt,p(H.value),1),e[18]||(e[18]=t("span",{class:"stat-label"},"Errors",-1))])])]),_:1})]),_:1})]),_:1}),$.value?(u(),g("div",te,[a(X,{rows:3,animated:""})])):k.value.length===0?(u(),g("div",ee,[e[21]||(e[21]=ut('<div class="empty-icon" data-v-b35a8700><svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-b35a8700><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-b35a8700></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-b35a8700></rect><path d="M32 32L48 48" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke-opacity="0.2" data-v-b35a8700></path><circle cx="48" cy="16" r="3" fill="currentColor" fill-opacity="0.2" data-v-b35a8700></circle></svg></div><h3 data-v-b35a8700>No instances yet</h3><p data-v-b35a8700>Add your first AgentWindow bot instance to get started</p>',3)),a(f,{type:"primary",icon:q(et),onClick:e[2]||(e[2]=l=>y.value=!0)},{default:n(()=>[...e[20]||(e[20]=[w(" Add Instance ",-1)])]),_:1},8,["icon"])])):(u(),I(Q,{key:2,gutter:16,class:"instances-grid"},{default:n(()=>[(u(!0),g(at,null,nt(k.value,l=>(u(),I(B,{key:l.name,xs:24,sm:12,lg:8},{default:n(()=>[a(Ut,{instance:l},null,8,["instance"])]),_:2},1024))),128))]),_:1})),a(Z,{modelValue:d.value,"onUpdate:modelValue":e[4]||(e[4]=l=>d.value=l),title:"Import Running Instances",width:"600px"},{footer:n(()=>[a(f,{onClick:e[3]||(e[3]=l=>d.value=!1)},{default:n(()=>[...e[24]||(e[24]=[w("Close",-1)])]),_:1}),a(f,{type:"primary",icon:q(vt),onClick:T},{default:n(()=>[...e[25]||(e[25]=[w("Refresh",-1)])]),_:1},8,["icon"])]),default:n(()=>[e[26]||(e[26]=t("div",{class:"discover-info"},[t("p",null,"The following bot instances are running in PM2 but not yet registered:")],-1)),j.value?(u(),g("div",se,[a(X,{rows:2,animated:""})])):b.value.length===0?(u(),g("div",ae,[...e[22]||(e[22]=[t("p",null,"No unregistered instances found.",-1)])])):(u(),I(it,{key:2,data:b.value,stripe:"",style:{width:"100%"}},{default:n(()=>[a(D,{prop:"displayName",label:"Name",width:"140"}),a(D,{prop:"botName",label:"PM2 Name",width:"130"}),a(D,{label:"Status",width:"90"},{default:n(({row:l})=>[l.isRunning?(u(),I(Y,{key:0,type:"success",size:"small"},{default:n(()=>[...e[23]||(e[23]=[w("Running",-1)])]),_:1})):(u(),I(Y,{key:1,type:"info",size:"small"},{default:n(()=>[w(p(l.status),1)]),_:2},1024))]),_:1}),a(D,{prop:"projectPath",label:"Path","show-overflow-tooltip":""}),a(D,{label:"Action",width:"80",align:"center"},{default:n(({row:l})=>[a(f,{type:"primary",size:"small",loading:P.value===l.name,disabled:m.value.includes(l.name),onClick:oe=>U(l)},{default:n(()=>[w(p(m.value.includes(l.name)?"Done":"Import"),1)]),_:2},1032,["loading","disabled","onClick"])]),_:1})]),_:1},8,["data"]))]),_:1},8,["modelValue"]),a(Z,{modelValue:y.value,"onUpdate:modelValue":e[9]||(e[9]=l=>y.value=l),title:"Add Instance",width:"500px","before-close":W},{footer:n(()=>[a(f,{onClick:W},{default:n(()=>[...e[28]||(e[28]=[w("Cancel",-1)])]),_:1}),a(f,{type:"primary",loading:M.value,onClick:O},{default:n(()=>[...e[29]||(e[29]=[w(" Add Instance ",-1)])]),_:1},8,["loading"])]),default:n(()=>[a(rt,{ref_key:"formRef",ref:V,model:r.value,rules:L,"label-width":"100px"},{default:n(()=>[a(z,{label:"Name",prop:"name"},{default:n(()=>[a(F,{modelValue:r.value.name,"onUpdate:modelValue":e[5]||(e[5]=l=>r.value.name=l),placeholder:"my-bot",onKeyup:ct(O,["enter"])},null,8,["modelValue"])]),_:1}),a(z,{label:"Display Name",prop:"displayName"},{default:n(()=>[a(F,{modelValue:r.value.displayName,"onUpdate:modelValue":e[6]||(e[6]=l=>r.value.displayName=l),placeholder:"My Bot"},null,8,["modelValue"])]),_:1}),a(z,{label:"Project Path",prop:"projectPath"},{default:n(()=>[a(F,{modelValue:r.value.projectPath,"onUpdate:modelValue":e[7]||(e[7]=l=>r.value.projectPath=l),placeholder:"/path/to/project"},null,8,["modelValue"]),e[27]||(e[27]=t("div",{class:"form-hint"},"Path to the bot project directory",-1))]),_:1}),a(z,{label:"Tags",prop:"tags"},{default:n(()=>[a(F,{modelValue:r.value.tagsInput,"onUpdate:modelValue":e[8]||(e[8]=l=>r.value.tagsInput=l),placeholder:"prod, staging (comma separated)"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])])}}},ue=lt(ne,[["__scopeId","data-v-b35a8700"]]);export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.log-viewer[data-v-d564c329]{display:flex;flex-direction:column;height:400px;border:1px solid var(--el-border-color);border-radius:4px;background:var(--el-bg-color)}.log-viewer.expanded[data-v-d564c329]{position:fixed;top:0;left:0;right:0;bottom:0;height:100vh;z-index:9999;border-radius:0}.log-toolbar[data-v-d564c329]{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-bottom:1px solid var(--el-border-color);background:var(--el-bg-color-page)}.log-toolbar .toolbar-left[data-v-d564c329],.log-toolbar .toolbar-right[data-v-d564c329]{display:flex;align-items:center;gap:8px}.log-content[data-v-d564c329]{flex:1;overflow-y:auto;padding:12px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;background:#1a1a1a;color:#e0e0e0}.empty-logs[data-v-d564c329]{display:flex;align-items:center;justify-content:center;height:100%;color:var(--el-text-color-secondary)}.log-line[data-v-d564c329]{display:flex;gap:8px;padding:2px 0}.log-line[data-v-d564c329]:hover{background:#ffffff0d}.log-line .log-timestamp[data-v-d564c329]{color:#888;flex-shrink:0}.log-line .log-type[data-v-d564c329]{color:var(--el-color-warning);flex-shrink:0;font-weight:600}.log-line .log-message[data-v-d564c329]{flex:1;word-break:break-all}.log-line.log-error[data-v-d564c329]{color:#f56c6c}.log-line.log-warn[data-v-d564c329]{color:#e6a23c}.log-line.log-info[data-v-d564c329]{color:#409eff}.loading-logs[data-v-d564c329]{display:flex;justify-content:center;padding:20px}.instance-detail-view[data-v-
|
|
1
|
+
.log-viewer[data-v-d564c329]{display:flex;flex-direction:column;height:400px;border:1px solid var(--el-border-color);border-radius:4px;background:var(--el-bg-color)}.log-viewer.expanded[data-v-d564c329]{position:fixed;top:0;left:0;right:0;bottom:0;height:100vh;z-index:9999;border-radius:0}.log-toolbar[data-v-d564c329]{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-bottom:1px solid var(--el-border-color);background:var(--el-bg-color-page)}.log-toolbar .toolbar-left[data-v-d564c329],.log-toolbar .toolbar-right[data-v-d564c329]{display:flex;align-items:center;gap:8px}.log-content[data-v-d564c329]{flex:1;overflow-y:auto;padding:12px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;background:#1a1a1a;color:#e0e0e0}.empty-logs[data-v-d564c329]{display:flex;align-items:center;justify-content:center;height:100%;color:var(--el-text-color-secondary)}.log-line[data-v-d564c329]{display:flex;gap:8px;padding:2px 0}.log-line[data-v-d564c329]:hover{background:#ffffff0d}.log-line .log-timestamp[data-v-d564c329]{color:#888;flex-shrink:0}.log-line .log-type[data-v-d564c329]{color:var(--el-color-warning);flex-shrink:0;font-weight:600}.log-line .log-message[data-v-d564c329]{flex:1;word-break:break-all}.log-line.log-error[data-v-d564c329]{color:#f56c6c}.log-line.log-warn[data-v-d564c329]{color:#e6a23c}.log-line.log-info[data-v-d564c329]{color:#409eff}.loading-logs[data-v-d564c329]{display:flex;justify-content:center;padding:20px}.instance-detail-view[data-v-711715eb]{display:flex;flex-direction:column;gap:20px}.detail-header[data-v-711715eb]{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px}.detail-header .header-content[data-v-711715eb]{display:flex;align-items:center;gap:12px}.detail-header .header-content .instance-icon[data-v-711715eb]{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;color:var(--el-text-color-regular)}.detail-header .header-content .instance-icon svg[data-v-711715eb]{width:24px;height:24px}.detail-header .header-content h2[data-v-711715eb]{margin:0;font-size:20px}.detail-header .header-content .instance-name[data-v-711715eb]{font-size:12px;color:var(--el-text-color-secondary)}.detail-header .header-actions[data-v-711715eb]{display:flex;gap:8px}.detail-content .status-panel .status-indicator[data-v-711715eb]{display:flex;align-items:center;gap:8px}.detail-content .status-panel .status-indicator .status-dot[data-v-711715eb]{width:12px;height:12px;border-radius:50%}.detail-content .status-panel .status-indicator .status-dot.online[data-v-711715eb]{background:var(--aw-status-online)}.detail-content .status-panel .status-indicator .status-dot.stopped[data-v-711715eb]{background:var(--aw-status-stopped)}.detail-content .status-panel .status-indicator .status-dot.error[data-v-711715eb]{background:var(--aw-status-error)}.detail-content .status-panel .status-indicator .status-text[data-v-711715eb]{font-size:16px;font-weight:500}.detail-content .status-panel .status-stats[data-v-711715eb]{display:grid;grid-template-columns:1fr 1fr;gap:16px}.detail-content .status-panel .status-stats .stat-item[data-v-711715eb]{display:flex;flex-direction:column;gap:4px}.detail-content .status-panel .status-stats .stat-item .stat-label[data-v-711715eb]{font-size:11px;color:var(--el-text-color-secondary);text-transform:uppercase}.detail-content .status-panel .status-stats .stat-item .stat-value[data-v-711715eb]{font-size:14px;font-weight:600}.logs-card[data-v-711715eb] .el-card__body{padding:0}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as g,j as se,W as we,f as ye,ab as u,y as d,B as v,E as o,C as t,D as a,Q as f,u as S,z as E,P as U,J as j,a5 as ie,G as Y,R as c,c as B,n as he,aB as ke,aA as be}from"./vue-vendor-CGSlMM3Y.js";import{d as Ce,b as xe,f as Se,c as $e,l as Le,v as Ve,e as De,g as Ie,m as Ne,a as Te}from"./element-plus-CSm40ime.js";import{a as D,u as Me}from"./main-CICHNbG_.js";import{_ as ue}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Be={class:"log-toolbar"},Re={class:"toolbar-left"},Pe={class:"toolbar-right"},Ue={key:0,class:"empty-logs"},je={class:"log-timestamp"},Ee={key:0,class:"log-type"},ze={class:"log-message"},Fe={key:1,class:"loading-logs"},Ae={__name:"LogViewer",props:{instanceName:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:["expand","collapse"],setup(z,{emit:F}){const I=z,$=F,p=g([]),n=g(!1),_=g(!1),L=g(I.expanded),w=g("all"),b=g(""),C=g(null);let y=null;const T=B(()=>{let i=p.value;if(w.value!=="all"&&(i=i.filter(s=>String(s.data||s).toLowerCase().includes(w.value==="out"?"stdout":"stderr"))),b.value){const s=b.value.toLowerCase();i=i.filter(m=>String(m.data||m).toLowerCase().includes(s))}return i});function A(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 O(i){return i?new Date(i).toLocaleTimeString("en-US",{hour12:!1}):""}function J(i){i?R():P()}function R(){if(y)return;const i=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,m=`${i}//${s}/ws/logs/${I.instanceName}`;y=new WebSocket(m),y.onopen=()=>{n.value=!1},y.onmessage=h=>{try{const x=JSON.parse(h.data);x.type==="log"&&(p.value.push(x),p.value.length>1e3&&(p.value=p.value.slice(-1e3)),he(()=>{C.value&&(C.value.scrollTop=C.value.scrollHeight)}))}catch{p.value.push({data:h.data,timestamp:Date.now()})}},y.onerror=()=>{n.value=!1},y.onclose=()=>{y=null,_.value&&setTimeout(R,3e3)}}function P(){y&&(y.close(),y=null)}async function q(){n.value=!0;try{const s=await(await fetch(`/api/instances/${I.instanceName}/logs?lines=100`)).json();s.logs&&(p.value=s.logs.split(`
|
|
2
|
+
`).filter(m=>m.trim()).map(m=>({data:m,timestamp:Date.now()})))}catch{}finally{n.value=!1}}function M(){p.value=[]}function H(){const i=p.value.map(x=>x.data||x).join(`
|
|
3
|
+
`),s=new Blob([i],{type:"text/plain"}),m=URL.createObjectURL(s),h=document.createElement("a");h.href=m,h.download=`${I.instanceName}-logs-${Date.now()}.txt`,h.click(),URL.revokeObjectURL(m)}function W(){L.value=!0,$("expand")}function G(){L.value=!1,$("collapse")}return se(()=>{q()}),we(()=>{P()}),ye(()=>I.expanded,i=>{L.value=i}),(i,s)=>{const m=u("el-checkbox"),h=u("el-option"),x=u("el-select"),l=u("el-input"),e=u("el-button"),N=u("el-icon");return d(),v("div",{class:Y(["log-viewer",{expanded:L.value}])},[o("div",Be,[o("div",Re,[t(m,{modelValue:_.value,"onUpdate:modelValue":s[0]||(s[0]=r=>_.value=r),onChange:J},{default:a(()=>[...s[3]||(s[3]=[o("span",null,"Live",-1)])]),_:1},8,["modelValue"]),t(x,{modelValue:w.value,"onUpdate:modelValue":s[1]||(s[1]=r=>w.value=r),size:"small",style:{width:"100px"}},{default:a(()=>[t(h,{label:"All",value:"all"}),t(h,{label:"Stdout",value:"out"}),t(h,{label:"Stderr",value:"err"})]),_:1},8,["modelValue"]),t(l,{modelValue:b.value,"onUpdate:modelValue":s[2]||(s[2]=r=>b.value=r),size:"small",placeholder:"Search logs...","prefix-icon":"Search",style:{width:"200px"},clearable:""},null,8,["modelValue"])]),o("div",Pe,[t(e,{size:"small",icon:S(Ce),onClick:H},{default:a(()=>[...s[4]||(s[4]=[f(" Export ",-1)])]),_:1},8,["icon"]),t(e,{size:"small",icon:S(xe),onClick:M},{default:a(()=>[...s[5]||(s[5]=[f(" Clear ",-1)])]),_:1},8,["icon"]),z.expanded?(d(),E(e,{key:1,size:"small",icon:S($e),onClick:G},null,8,["icon"])):(d(),E(e,{key:0,size:"small",icon:S(Se),onClick:W},null,8,["icon"]))])]),o("div",{class:"log-content",ref_key:"logContentRef",ref:C},[T.value.length===0?(d(),v("div",Ue,[...s[6]||(s[6]=[o("span",null,"No logs to display",-1)])])):U("",!0),(d(!0),v(j,null,ie(T.value,(r,Q)=>(d(),v("div",{key:Q,class:Y(["log-line",A(r)])},[o("span",je,c(O(r.timestamp)),1),r.type!=="log"?(d(),v("span",Ee,c(r.type),1)):U("",!0),o("span",ze,c(r.data||r),1)],2))),128)),n.value?(d(),v("div",Fe,[t(N,{class:"is-loading"},{default:a(()=>[t(S(Le))]),_:1})])):U("",!0)],512)],2)}}},Oe=ue(Ae,[["__scopeId","data-v-d564c329"]]),Je={class:"instance-detail-view"},qe={key:0,class:"loading-state"},He={key:1,class:"error-state"},We={class:"detail-header"},Ge={class:"header-content"},Qe={class:"instance-icon"},Ke={key:0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Xe={key:1,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ye={class:"instance-name"},Ze={class:"header-actions"},et={class:"status-panel"},tt={class:"status-indicator"},at={class:"status-text"},nt={class:"status-stats"},ot={class:"stat-item"},lt={class:"stat-value"},st={class:"stat-item"},it={class:"stat-value"},ut={class:"stat-item"},rt={class:"stat-value"},dt={class:"stat-item"},ct={class:"stat-value"},pt={key:1},ft={key:0,class:"loading-state"},mt={__name:"InstanceDetail",setup(z){const F=ke(),I=be(),{success:$,error:p}=Me(),n=g(null),_=g({status:"unknown",exists:!1}),L=g(!0),w=g(null),b=g(!1),C=g(""),y=g(!1),T=g(!1),A=B(()=>{var l,e;return(e=(l=n.value)==null?void 0:l.tags)!=null&&e.includes("prod")?"prod":"dev"}),O=B(()=>{var e;return{"bmad-plugin":"BMAD 插件","simple-config":"基础版",standalone:"独立实例",unknown:"未知"}[(e=n.value)==null?void 0:e.instanceType]||"未知"}),J=B(()=>{var e;return{"bmad-plugin":"success","simple-config":"info",standalone:"warning",unknown:""}[(e=n.value)==null?void 0:e.instanceType]||""}),R=B(()=>{const l=_.value.status;return l==="online"?"online":l==="stopped"?"stopped":l==="errored"?"error":""}),P=B(()=>{const l=_.value.status;return{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting"}[l]||"Unknown"});async function q(){L.value=!0;try{const l=F.params.name;n.value=await D.getInstance(l),await M()}catch{n.value=null}finally{L.value=!1}}async function M(){try{_.value=await D.getInstanceStatus(n.value.name)}catch{_.value={status:"unknown",exists:!1}}}async function H(){w.value="start";try{await D.startInstance(n.value.name),$("Started",`${n.value.name} has been started`),await M()}catch(l){p("Failed to start",l.message)}finally{w.value=null}}async function W(){w.value="stop";try{await D.stopInstance(n.value.name),$("Stopped",`${n.value.name} has been stopped`),await M()}catch(l){p("Failed to stop",l.message)}finally{w.value=null}}async function G(){w.value="restart";try{await D.restartInstance(n.value.name),$("Restarted",`${n.value.name} has been restarted`),await M()}catch(l){p("Failed to restart",l.message)}finally{w.value=null}}async function i(l){switch(l){case"logs":const e=document.querySelector(".logs-card");e&&e.scrollIntoView({behavior:"smooth"});break;case"config":await s();break;case"delete":try{await Te.confirm(`Are you sure you want to delete "${n.value.name}"?`,"Confirm Delete",{type:"warning"}),await D.removeInstance(n.value.name),$("Deleted","Instance has been removed"),I.push("/")}catch(N){N!=="cancel"&&p("Failed",N.message)}break}}async function s(){var l;if(!((l=n.value)!=null&&l.configPath)){p("No Config","This instance does not have a config file");return}b.value=!0,y.value=!0;try{const e=await D.getInstanceConfig(n.value.name);C.value=e.config||""}catch(e){p("Failed to load",e.message),b.value=!1}finally{y.value=!1}}async function m(){T.value=!0;try{try{JSON.parse(C.value)}catch(l){throw new Error("Invalid JSON: "+l.message)}await D.updateInstanceConfig(n.value.name,{config:C.value}),$("Saved","Configuration has been updated"),b.value=!1}catch(l){p("Failed to save",l.message)}finally{T.value=!1}}function h(l){if(!l)return"-";const e=l/1024/1024;return e>=1024?(e/1024).toFixed(1)+" GB":Math.round(e)+" MB"}function x(l){return l?new Date(l).toLocaleString():"-"}return se(q),(l,e)=>{var ne,oe;const N=u("el-skeleton"),r=u("el-button"),Q=u("el-result"),re=u("el-page-header"),de=u("el-button-group"),K=u("el-dropdown-item"),ce=u("el-dropdown-menu"),pe=u("el-dropdown"),fe=u("el-divider"),X=u("el-card"),Z=u("el-col"),V=u("el-descriptions-item"),ee=u("el-tag"),me=u("el-descriptions"),ve=u("el-row"),te=u("el-input"),ae=u("el-form-item"),_e=u("el-form"),ge=u("el-dialog");return d(),v("div",Je,[L.value?(d(),v("div",qe,[t(N,{rows:5,animated:""})])):n.value?(d(),v(j,{key:2},[o("div",We,[t(re,{onBack:e[1]||(e[1]=k=>l.$router.push("/"))},{content:a(()=>[o("div",Ge,[o("span",Qe,[A.value==="prod"?(d(),v("svg",Ke,[...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)])])):(d(),v("svg",Xe,[...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,c(n.value.displayName||n.value.name),1),o("span",Ye,c(n.value.name),1)])])]),_:1}),o("div",Ze,[t(de,null,{default:a(()=>[t(r,{icon:S(Ve),disabled:_.value.status==="online",loading:w.value==="start",onClick:H},{default:a(()=>[...e[8]||(e[8]=[f(" Start ",-1)])]),_:1},8,["icon","disabled","loading"]),t(r,{icon:S(De),disabled:_.value.status!=="online",loading:w.value==="stop",onClick:W},{default:a(()=>[...e[9]||(e[9]=[f(" Stop ",-1)])]),_:1},8,["icon","disabled","loading"]),t(r,{icon:S(Ie),loading:w.value==="restart",onClick:G},{default:a(()=>[...e[10]||(e[10]=[f(" Restart ",-1)])]),_:1},8,["icon","loading"])]),_:1}),t(pe,{onCommand:i},{dropdown:a(()=>[t(ce,null,{default:a(()=>[t(K,{command:"logs"},{default:a(()=>[...e[12]||(e[12]=[f("View Logs",-1)])]),_:1}),t(K,{command:"config"},{default:a(()=>[...e[13]||(e[13]=[f("Edit Config",-1)])]),_:1}),t(K,{command:"delete",divided:""},{default:a(()=>[...e[14]||(e[14]=[f("Delete Instance",-1)])]),_:1})]),_:1})]),default:a(()=>[t(r,{icon:S(Ne)},{default:a(()=>[...e[11]||(e[11]=[f(" More ",-1)])]),_:1},8,["icon"])]),_:1})])]),t(ve,{gutter:20,class:"detail-content"},{default:a(()=>[t(Z,{xs:24,lg:8},{default:a(()=>[t(X,{header:"Status"},{default:a(()=>[o("div",et,[o("div",tt,[o("span",{class:Y(["status-dot",R.value])},null,2),o("span",at,c(P.value),1)]),_.value.exists?(d(),v(j,{key:0},[t(fe),o("div",nt,[o("div",ot,[e[15]||(e[15]=o("span",{class:"stat-label"},"PID",-1)),o("span",lt,c(_.value.pid||"-"),1)]),o("div",st,[e[16]||(e[16]=o("span",{class:"stat-label"},"Memory",-1)),o("span",it,c(h(_.value.memory)),1)]),o("div",ut,[e[17]||(e[17]=o("span",{class:"stat-label"},"CPU",-1)),o("span",rt,c(_.value.cpu)+"%",1)]),o("div",dt,[e[18]||(e[18]=o("span",{class:"stat-label"},"Restarts",-1)),o("span",ct,c(_.value.restarts),1)])])],64)):U("",!0)])]),_:1})]),_:1}),t(Z,{xs:24,lg:16},{default:a(()=>[t(X,{header:"Information"},{default:a(()=>[t(me,{column:1,border:""},{default:a(()=>[t(V,{label:"Name"},{default:a(()=>[f(c(n.value.name),1)]),_:1}),t(V,{label:"Display Name"},{default:a(()=>[f(c(n.value.displayName||"-"),1)]),_:1}),t(V,{label:"Type"},{default:a(()=>[t(ee,{type:J.value},{default:a(()=>[f(c(O.value),1)]),_:1},8,["type"])]),_:1}),t(V,{label:"Project Path"},{default:a(()=>[o("code",null,c(n.value.projectPath),1)]),_:1}),t(V,{label:"Plugin Path"},{default:a(()=>[o("code",null,c(n.value.pluginPath||"-"),1)]),_:1}),t(V,{label:"Config Path"},{default:a(()=>[o("code",null,c(n.value.configPath||"Default"),1)]),_:1}),t(V,{label:"Added"},{default:a(()=>[f(c(x(n.value.addedAt)),1)]),_:1}),t(V,{label:"Tags"},{default:a(()=>{var k;return[(k=n.value.tags)!=null&&k.length?(d(!0),v(j,{key:0},ie(n.value.tags,le=>(d(),E(ee,{key:le,size:"small",style:{"margin-right":"4px"}},{default:a(()=>[f(c(le),1)]),_:2},1024))),128)):(d(),v("span",pt,"-"))]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(X,{header:"Recent Logs",class:"logs-card"},{default:a(()=>[t(Oe,{"instance-name":n.value.name,expanded:!1},null,8,["instance-name"])]),_:1})],64)):(d(),v("div",He,[t(Q,{icon:"error",title:"Instance not found","sub-title":"The requested instance does not exist"},{extra:a(()=>[t(r,{type:"primary",onClick:e[0]||(e[0]=k=>l.$router.push("/"))},{default:a(()=>[...e[5]||(e[5]=[f("Back to Dashboard",-1)])]),_:1})]),_:1})])),t(ge,{modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=k=>b.value=k),title:`Edit Config - ${((ne=n.value)==null?void 0:ne.displayName)||((oe=n.value)==null?void 0:oe.name)}`,width:"70%",top:"5vh"},{footer:a(()=>[t(r,{onClick:e[3]||(e[3]=k=>b.value=!1)},{default:a(()=>[...e[19]||(e[19]=[f("Cancel",-1)])]),_:1}),t(r,{type:"primary",loading:T.value,onClick:m},{default:a(()=>[...e[20]||(e[20]=[f("Save",-1)])]),_:1},8,["loading"])]),default:a(()=>[y.value?(d(),v("div",ft,[t(N,{rows:5,animated:""})])):(d(),E(_e,{key:1,"label-width":"120px"},{default:a(()=>[t(ae,{label:"Config Path"},{default:a(()=>{var k;return[t(te,{value:(k=n.value)==null?void 0:k.configPath,disabled:""},null,8,["value"])]}),_:1}),t(ae,{label:"Config Content"},{default:a(()=>[t(te,{modelValue:C.value,"onUpdate:modelValue":e[2]||(e[2]=k=>C.value=k),type:"textarea",rows:20,placeholder:"Configuration JSON content"},null,8,["modelValue"])]),_:1})]),_:1}))]),_:1},8,["modelValue","title"])])}}},yt=ue(mt,[["__scopeId","data-v-711715eb"]]);export{yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,u as B}from"./main-
|
|
1
|
+
import{a as p,u as B}from"./main-CICHNbG_.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-CICHNbG_.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-
|
|
2
|
-
import{l as Pt,r as ae,j as Nt,B as L,E as g,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 Ht,az as $t}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 H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,lt=e=>!V(e)&&e!==H;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},wn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_e(Uint8Array)),gn=(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}),He=(({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)=>(H.addEventListener("message",({source:s,data:i})=>{s===H&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),H.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A(H.postMessage)),Nn=typeof queueMicrotask<"u"?queueMicrotask.bind(H):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:wn,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:gn,matchAll:bn,isHTMLForm:En,hasOwnProperty:He,hasOwnProp:He,reduceDescriptors:ut,freezeMethods:On,toObjectSet:xn,toCamelCase:Sn,noop:Tn,toFiniteNumber:An,findKey:ct,global:H,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 $e(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 S=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,"[]"))&&(S=a.toArray(d)))return m=ht(m),S.forEach(function(R,T){!(a.isUndefined(R)||R===null)&&t.append(o===!0?$e([m],T,i):o===null?m:m+"[]",l(R))}),!1}return Te(d)?!0:(t.append($e(h,m,i),l(d)),!1)}const p=[],w=Object.assign(Bn,{defaultVisitor:u,convertValue:l,isVisitable:Te});function E(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(S,_){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(_)?_.trim():_,m,w))===!0&&E(S,m?m.concat(_):[_])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(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 wt={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,Hn=Pe&&(!Ae||["ReactNative","NativeScript","NS"].indexOf(Ae.product)<0),$n=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:Hn,hasStandardBrowserWebWorkerEnv:$n,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 gt(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:wt,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(gt(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(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CK9p-dpz.js","assets/vue-vendor-CGSlMM3Y.js","assets/element-plus-CSm40ime.js","assets/_plugin-vue_export-helper-DlAUqK2U.js","assets/Dashboard-CJDMEpOk.css","assets/Instances-DFQOoLYE.js","assets/Instances-CvnH8iDv.css","assets/InstanceDetail-txSTEfck.js","assets/InstanceDetail-E-9-YoyH.css","assets/Settings-DUvrHXXe.js","assets/Settings-CAu3R9RW.css"])))=>i.map(i=>d[i]);
|
|
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 S=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,"[]"))&&(S=a.toArray(d)))return m=ht(m),S.forEach(function(R,T){!(a.isUndefined(R)||R===null)&&t.append(o===!0?He([m],T,i):o===null?m:m+"[]",l(R))}),!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 E(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(S,_){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(_)?_.trim():_,m,g))===!0&&E(S,m?m.concat(_):[_])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return E(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
|
-
`)}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,w=0;for(;p!==s;)w+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),l-o<t)return;const E=u&&l-u;return E?Math.round(w*1e3/E):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,w){return a.isPlainObject(l)&&a.isPlainObject(u)?a.merge.call({caseless:w},l,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(l,u,p,w){if(a.isUndefined(u)){if(!a.isUndefined(l))return r(void 0,l,p,w)}else return r(l,u,p,w)}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,w=p(e[u],t[u],u);a.isUndefined(w)&&p!==c||(n[u]=w)}),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,w,E,d;function m(){E&&E(),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 S(){if(!h)return;const R=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:R,config:e,request:h};Et(function(k){n(k),m()},function(k){r(k),m()},N),h=null}"onloadend"in h?h.onloadend=S:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(S)},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||wt;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&&([w,d]=fe(l,!0),h.addEventListener("progress",w)),f&&h.upload&&([p,E]=fe(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=R=>{h&&(r(!R||R.type?new W(null,e,h):R),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 w=i+=p;n(w)}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 S=m&&m[d];if(S)return S.call(m);throw new y(`Response type '${d}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const w=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},E=async(d,m)=>{const h=a.toFiniteNumber(d.getContentLength());return h??w(m)};return async d=>{let{url:m,method:h,data:S,signal:_,cancelToken:R,timeout:T,onDownloadProgress:N,onUploadProgress:j,responseType:k,headers:we,withCredentials:te="same-origin",fetchOptions:Le}=Rt(d),Fe=t||fetch;k=k?(k+"").toLowerCase():"text";let ne=ur([_,R&&R.toAbortSignal()],T),K=null;const q=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let Ue;try{if(j&&l&&h!=="get"&&h!=="head"&&(Ue=await E(we,S))!==0){let I=new n(m,{method:"POST",body:S,duplex:"half"}),z;if(a.isFormData(S)&&(z=I.headers.get("content-type"))&&we.setContentType(z),I.body){const[ge,re]=Je(Ue,fe(We(j)));S=Xe(I.body,Ge,ge,re)}}a.isString(te)||(te=te?"include":"omit");const U=i&&"credentials"in n.prototype,Be={...Le,signal:ne,method:h.toUpperCase(),headers:we.normalize().toJSON(),body:S,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")),[ge,re]=N&&Je(z,fe(We(N),!0))||[];v=new r(Xe(v.body,Ge,ge,()=>{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}`,wr=e=>a.isFunction(e)||e===null||e===!1;function gr(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,!wr(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 :
|
|
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 E=u&&l-u;return E?Math.round(g*1e3/E):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,E,d;function m(){E&&E(),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 S(){if(!h)return;const R=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:R,config:e,request:h};Et(function(k){n(k),m()},function(k){r(k),m()},N),h=null}"onloadend"in h?h.onloadend=S:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(S)},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,E]=fe(f),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",E)),(s.cancelToken||s.signal)&&(u=R=>{h&&(r(!R||R.type?new W(null,e,h):R),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 S=m&&m[d];if(S)return S.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},E=async(d,m)=>{const h=a.toFiniteNumber(d.getContentLength());return h??g(m)};return async d=>{let{url:m,method:h,data:S,signal:_,cancelToken:R,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([_,R&&R.toAbortSignal()],T),K=null;const q=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let Ue;try{if(j&&l&&h!=="get"&&h!=="head"&&(Ue=await E(ge,S))!==0){let I=new n(m,{method:"POST",body:S,duplex:"half"}),z;if(a.isFormData(S)&&(z=I.headers.get("content-type"))&&ge.setContentType(z),I.body){const[we,re]=Je(Ue,fe(We(j)));S=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:S,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
|
-
`):" "+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:
|
|
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,w;if(!f){const d=[tt.bind(this),void 0];for(d.unshift(...c),d.push(...l),w=d.length,u=Promise.resolve(n);p<w;)u=u.then(d[p++],d[p++]);return u}w=c.length;let E=n;for(;p<w;){const d=c[p++],m=c[p++];try{E=d(E)}catch(h){m.call(this,h);break}}try{u=tt.call(this,E)}catch(d){return Promise.reject(d)}for(p=0,w=l.length;p<w;)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){$.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}))}}$.prototype[t]=n(),$.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 $(e),n=st($.prototype.request,t);return a.extend(n,$.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=$;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=>gt(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",O=b.create({baseURL:Or,timeout:3e4,headers:{"Content-Type":"application/json"}});O.interceptors.request.use(e=>e,e=>Promise.reject(e));O.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:()=>O.get("/health"),getSystemInfo:()=>O.get("/system/info"),getSystemStats:()=>O.get("/system/stats"),getInstances:()=>O.get("/instances"),getInstance:e=>O.get(`/instances/${e}`),addInstance:e=>O.post("/instances",e),removeInstance:e=>O.delete(`/instances/${e}`),getInstanceStatus:e=>O.get(`/instances/${e}/status`),getInstanceLogs:(e,t={})=>O.get(`/instances/${e}/logs`,{params:t}),discoverInstances:()=>O.get("/instances/discover"),importInstance:e=>O.post("/instances/import",e),startInstance:e=>O.post(`/instances/${e}/start`),stopInstance:e=>O.post(`/instances/${e}/stop`),restartInstance:e=>O.post(`/instances/${e}/restart`)};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"},Hr={key:1,class:"toast-message"},$r=["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)})},[g("header",Ar,[g("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)]),g("div",kr,[g("button",{class:"icon-button",onClick:l[0]||(l[0]=(...w)=>D(n)&&D(n)(...w)),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]=[g("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"},null,-1)])]))],8,Pr),g("button",{class:"icon-button",onClick:l[1]||(l[1]=w=>f.$router.push("/settings")),title:"Settings"},[...l[5]||(l[5]=[g("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[g("circle",{cx:"12",cy:"12",r:"3"}),g("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)])])])]),g("main",Fr,[je(u)]),(P(),Lt(Bt,{to:"body"},[g("div",Ur,[je(Ut,{name:"toast"},{default:Ft(()=>[(P(!0),L(vt,null,It(D(r),w=>(P(),L("div",{key:w.id,class:qe(["toast",w.type])},[g("div",Br,[w.type==="success"?(P(),L("svg",Dr,[...l[6]||(l[6]=[g("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):w.type==="error"?(P(),L("svg",vr,[...l[7]||(l[7]=[g("circle",{cx:"12",cy:"12",r:"10"},null,-1),g("line",{x1:"15",y1:"9",x2:"9",y2:"15"},null,-1),g("line",{x1:"9",y1:"9",x2:"15",y2:"15"},null,-1)])])):(P(),L("svg",Ir,[...l[8]||(l[8]=[g("circle",{cx:"12",cy:"12",r:"10"},null,-1),g("line",{x1:"12",y1:"16",x2:"12",y2:"12"},null,-1),g("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"},null,-1)])]))]),g("div",jr,[w.title?(P(),L("div",qr,be(w.title),1)):Ee("",!0),w.message?(P(),L("div",Hr,be(w.message),1)):Ee("",!0)]),g("button",{class:"toast-close",onClick:E=>D(s)(w.id)},[...l[9]||(l[9]=[g("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[g("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,$r)],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((w,E)=>{p.addEventListener("load",w),p.addEventListener("error",()=>E(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-C-Q5-Mn4.js"),__vite__mapDeps([0,1,2,3,4])),meta:{title:"Dashboard"}},{path:"/instances",name:"instances",component:()=>ie(()=>import("./Instances-DpVL5y7K.js"),__vite__mapDeps([5,3,2,1,6])),meta:{title:"Instances"}},{path:"/instances/:name",name:"instance-detail",component:()=>ie(()=>import("./InstanceDetail-DKi-bm1V.js"),__vite__mapDeps([7,1,2,3,8])),meta:{title:"Instance Detail"}},{path:"/settings",name:"settings",component:()=>ie(()=>import("./Settings-B1H4osZM.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=Ht(Mr),Wr=$t();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};
|
|
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 E=n;for(;p<g;){const d=c[p++],m=c[p++];try{E=d(E)}catch(h){m.call(this,h);break}}try{u=tt.call(this,E)}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",O=b.create({baseURL:Or,timeout:3e4,headers:{"Content-Type":"application/json"}});O.interceptors.request.use(e=>e,e=>Promise.reject(e));O.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:()=>O.get("/health"),getSystemInfo:()=>O.get("/system/info"),getSystemStats:()=>O.get("/system/stats"),getInstances:()=>O.get("/instances"),getInstance:e=>O.get(`/instances/${e}`),addInstance:e=>O.post("/instances",e),removeInstance:e=>O.delete(`/instances/${e}`),getInstanceStatus:e=>O.get(`/instances/${e}/status`),getInstanceLogs:(e,t={})=>O.get(`/instances/${e}/logs`,{params:t}),discoverInstances:()=>O.get("/instances/discover"),importInstance:e=>O.post("/instances/import",e),startInstance:e=>O.post(`/instances/${e}/start`),stopInstance:e=>O.post(`/instances/${e}/stop`),restartInstance:e=>O.post(`/instances/${e}/restart`),getInstanceConfig:e=>O.get(`/instances/${e}/config`),updateInstanceConfig:(e,t)=>O.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:E=>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,E)=>{p.addEventListener("load",g),p.addEventListener("error",()=>E(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-CK9p-dpz.js"),__vite__mapDeps([0,1,2,3,4])),meta:{title:"Dashboard"}},{path:"/instances",name:"instances",component:()=>ie(()=>import("./Instances-DFQOoLYE.js"),__vite__mapDeps([5,3,2,1,6])),meta:{title:"Instances"}},{path:"/instances/:name",name:"instance-detail",component:()=>ie(()=>import("./InstanceDetail-txSTEfck.js"),__vite__mapDeps([7,1,2,3,8])),meta:{title:"Instance Detail"}},{path:"/settings",name:"settings",component:()=>ie(()=>import("./Settings-DUvrHXXe.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-CICHNbG_.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,3 +0,0 @@
|
|
|
1
|
-
import{r as y,j as te,W as le,f as ie,ab as i,y as d,B as m,E as a,C as t,D as n,Q as p,u as k,z as K,P as U,J as j,a5 as ae,G as X,R as u,c as B,n as re,aB as ue,aA as de}from"./vue-vendor-CGSlMM3Y.js";import{d as ce,b as pe,f as me,c as _e,l as fe,v as ve,e as ge,g as we,m as ye,a as he}from"./element-plus-CSm40ime.js";import{a as T,u as ke}from"./main-Ce4eRTG3.js";import{_ as ne}from"./_plugin-vue_export-helper-DlAUqK2U.js";const be={class:"log-toolbar"},xe={class:"toolbar-left"},Ce={class:"toolbar-right"},Se={key:0,class:"empty-logs"},Le={class:"log-timestamp"},$e={key:0,class:"log-type"},De={class:"log-message"},Me={key:1,class:"loading-logs"},Te={__name:"LogViewer",props:{instanceName:{type:String,required:!0},expanded:{type:Boolean,default:!1}},emits:["expand","collapse"],setup(P,{emit:z}){const S=P,L=z,_=y([]),o=y(!1),c=y(!1),b=y(S.expanded),f=y("all"),$=y(""),D=y(null);let w=null;const I=B(()=>{let e=_.value;if(f.value!=="all"&&(e=e.filter(s=>String(s.data||s).toLowerCase().includes(f.value==="out"?"stdout":"stderr"))),$.value){const s=$.value.toLowerCase();e=e.filter(r=>String(r.data||r).toLowerCase().includes(s))}return e});function E(e){const s=String(e.data||e).toLowerCase();return s.includes("error")||s.includes("err")||e.type==="error"?"log-error":s.includes("warn")||e.type==="warning"?"log-warn":s.includes("info")?"log-info":""}function A(e){return e?new Date(e).toLocaleTimeString("en-US",{hour12:!1}):""}function M(e){e?R():V()}function R(){if(w)return;const e=window.location.protocol==="https:"?"wss:":"ws:",s=window.location.host,r=`${e}//${s}/ws/logs/${S.instanceName}`;w=new WebSocket(r),w.onopen=()=>{o.value=!1},w.onmessage=g=>{try{const h=JSON.parse(g.data);h.type==="log"&&(_.value.push(h),_.value.length>1e3&&(_.value=_.value.slice(-1e3)),re(()=>{D.value&&(D.value.scrollTop=D.value.scrollHeight)}))}catch{_.value.push({data:g.data,timestamp:Date.now()})}},w.onerror=()=>{o.value=!1},w.onclose=()=>{w=null,c.value&&setTimeout(R,3e3)}}function V(){w&&(w.close(),w=null)}async function F(){o.value=!0;try{const s=await(await fetch(`/api/instances/${S.instanceName}/logs?lines=100`)).json();s.logs&&(_.value=s.logs.split(`
|
|
2
|
-
`).filter(r=>r.trim()).map(r=>({data:r,timestamp:Date.now()})))}catch{}finally{o.value=!1}}function H(){_.value=[]}function W(){const e=_.value.map(h=>h.data||h).join(`
|
|
3
|
-
`),s=new Blob([e],{type:"text/plain"}),r=URL.createObjectURL(s),g=document.createElement("a");g.href=r,g.download=`${S.instanceName}-logs-${Date.now()}.txt`,g.click(),URL.revokeObjectURL(r)}function q(){b.value=!0,L("expand")}function l(){b.value=!1,L("collapse")}return te(()=>{F()}),le(()=>{V()}),ie(()=>S.expanded,e=>{b.value=e}),(e,s)=>{const r=i("el-checkbox"),g=i("el-option"),h=i("el-select"),O=i("el-input"),x=i("el-button"),G=i("el-icon");return d(),m("div",{class:X(["log-viewer",{expanded:b.value}])},[a("div",be,[a("div",xe,[t(r,{modelValue:c.value,"onUpdate:modelValue":s[0]||(s[0]=v=>c.value=v),onChange:M},{default:n(()=>[...s[3]||(s[3]=[a("span",null,"Live",-1)])]),_:1},8,["modelValue"]),t(h,{modelValue:f.value,"onUpdate:modelValue":s[1]||(s[1]=v=>f.value=v),size:"small",style:{width:"100px"}},{default:n(()=>[t(g,{label:"All",value:"all"}),t(g,{label:"Stdout",value:"out"}),t(g,{label:"Stderr",value:"err"})]),_:1},8,["modelValue"]),t(O,{modelValue:$.value,"onUpdate:modelValue":s[2]||(s[2]=v=>$.value=v),size:"small",placeholder:"Search logs...","prefix-icon":"Search",style:{width:"200px"},clearable:""},null,8,["modelValue"])]),a("div",Ce,[t(x,{size:"small",icon:k(ce),onClick:W},{default:n(()=>[...s[4]||(s[4]=[p(" Export ",-1)])]),_:1},8,["icon"]),t(x,{size:"small",icon:k(pe),onClick:H},{default:n(()=>[...s[5]||(s[5]=[p(" Clear ",-1)])]),_:1},8,["icon"]),P.expanded?(d(),K(x,{key:1,size:"small",icon:k(_e),onClick:l},null,8,["icon"])):(d(),K(x,{key:0,size:"small",icon:k(me),onClick:q},null,8,["icon"]))])]),a("div",{class:"log-content",ref_key:"logContentRef",ref:D},[I.value.length===0?(d(),m("div",Se,[...s[6]||(s[6]=[a("span",null,"No logs to display",-1)])])):U("",!0),(d(!0),m(j,null,ae(I.value,(v,J)=>(d(),m("div",{key:J,class:X(["log-line",E(v)])},[a("span",Le,u(A(v.timestamp)),1),v.type!=="log"?(d(),m("span",$e,u(v.type),1)):U("",!0),a("span",De,u(v.data||v),1)],2))),128)),o.value?(d(),m("div",Me,[t(G,{class:"is-loading"},{default:n(()=>[t(k(fe))]),_:1})])):U("",!0)],512)],2)}}},Be=ne(Te,[["__scopeId","data-v-d564c329"]]),Ie={class:"instance-detail-view"},Re={key:0,class:"loading-state"},Ve={key:1,class:"error-state"},Ne={class:"detail-header"},Ue={class:"header-content"},je={class:"instance-icon"},Pe={key:0,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze={key:1,width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ee={class:"instance-name"},Ae={class:"header-actions"},Fe={class:"status-panel"},He={class:"status-indicator"},We={class:"status-text"},qe={class:"status-stats"},Oe={class:"stat-item"},Ge={class:"stat-value"},Je={class:"stat-item"},Qe={class:"stat-value"},Ke={class:"stat-item"},Xe={class:"stat-value"},Ye={class:"stat-item"},Ze={class:"stat-value"},et={key:1},tt={__name:"InstanceDetail",setup(P){const z=ue(),S=de(),{success:L,error:_}=ke(),o=y(null),c=y({status:"unknown",exists:!1}),b=y(!0),f=y(null),$=B(()=>{var l,e;return(e=(l=o.value)==null?void 0:l.tags)!=null&&e.includes("prod")?"prod":"dev"}),D=B(()=>{var e;return{"bmad-plugin":"BMAD 插件","simple-config":"基础版",standalone:"独立实例",unknown:"未知"}[(e=o.value)==null?void 0:e.instanceType]||"未知"}),w=B(()=>{var e;return{"bmad-plugin":"success","simple-config":"info",standalone:"warning",unknown:""}[(e=o.value)==null?void 0:e.instanceType]||""}),I=B(()=>{const l=c.value.status;return l==="online"?"online":l==="stopped"?"stopped":l==="errored"?"error":""}),E=B(()=>{const l=c.value.status;return{online:"Running",stopped:"Stopped",errored:"Error",restarting:"Restarting"}[l]||"Unknown"});async function A(){b.value=!0;try{const l=z.params.name;o.value=await T.getInstance(l),await M()}catch{o.value=null}finally{b.value=!1}}async function M(){try{c.value=await T.getInstanceStatus(o.value.name)}catch{c.value={status:"unknown",exists:!1}}}async function R(){f.value="start";try{await T.startInstance(o.value.name),L("Started",`${o.value.name} has been started`),await M()}catch(l){_("Failed to start",l.message)}finally{f.value=null}}async function V(){f.value="stop";try{await T.stopInstance(o.value.name),L("Stopped",`${o.value.name} has been stopped`),await M()}catch(l){_("Failed to stop",l.message)}finally{f.value=null}}async function F(){f.value="restart";try{await T.restartInstance(o.value.name),L("Restarted",`${o.value.name} has been restarted`),await M()}catch(l){_("Failed to restart",l.message)}finally{f.value=null}}async function H(l){switch(l){case"delete":try{await he.confirm(`Are you sure you want to delete "${o.value.name}"?`,"Confirm Delete",{type:"warning"}),await T.removeInstance(o.value.name),L("Deleted","Instance has been removed"),S.push("/")}catch(e){err!=="cancel"&&_("Failed",e.message)}break}}function W(l){if(!l)return"-";const e=l/1024/1024;return e>=1024?(e/1024).toFixed(1)+" GB":Math.round(e)+" MB"}function q(l){return l?new Date(l).toLocaleString():"-"}return te(A),(l,e)=>{const s=i("el-skeleton"),r=i("el-button"),g=i("el-result"),h=i("el-page-header"),O=i("el-button-group"),x=i("el-dropdown-item"),G=i("el-dropdown-menu"),v=i("el-dropdown"),J=i("el-divider"),Q=i("el-card"),Y=i("el-col"),C=i("el-descriptions-item"),Z=i("el-tag"),se=i("el-descriptions"),oe=i("el-row");return d(),m("div",Ie,[b.value?(d(),m("div",Re,[t(s,{rows:5,animated:""})])):o.value?(d(),m(j,{key:2},[a("div",Ne,[t(h,{onBack:e[1]||(e[1]=N=>l.$router.push("/"))},{content:n(()=>[a("div",Ue,[a("span",je,[$.value==="prod"?(d(),m("svg",Pe,[...e[3]||(e[3]=[a("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),a("path",{d:"M8 12H16M8 8H16M8 16H12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(d(),m("svg",ze,[...e[4]||(e[4]=[a("circle",{cx:"12",cy:"8",r:"4",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),a("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)])]))]),a("div",null,[a("h2",null,u(o.value.displayName||o.value.name),1),a("span",Ee,u(o.value.name),1)])])]),_:1}),a("div",Ae,[t(O,null,{default:n(()=>[t(r,{icon:k(ve),disabled:c.value.status==="online",loading:f.value==="start",onClick:R},{default:n(()=>[...e[5]||(e[5]=[p(" Start ",-1)])]),_:1},8,["icon","disabled","loading"]),t(r,{icon:k(ge),disabled:c.value.status!=="online",loading:f.value==="stop",onClick:V},{default:n(()=>[...e[6]||(e[6]=[p(" Stop ",-1)])]),_:1},8,["icon","disabled","loading"]),t(r,{icon:k(we),loading:f.value==="restart",onClick:F},{default:n(()=>[...e[7]||(e[7]=[p(" Restart ",-1)])]),_:1},8,["icon","loading"])]),_:1}),t(v,{onCommand:H},{dropdown:n(()=>[t(G,null,{default:n(()=>[t(x,{command:"logs"},{default:n(()=>[...e[9]||(e[9]=[p("View Logs",-1)])]),_:1}),t(x,{command:"config"},{default:n(()=>[...e[10]||(e[10]=[p("Edit Config",-1)])]),_:1}),t(x,{command:"delete",divided:""},{default:n(()=>[...e[11]||(e[11]=[p("Delete Instance",-1)])]),_:1})]),_:1})]),default:n(()=>[t(r,{icon:k(ye)},{default:n(()=>[...e[8]||(e[8]=[p(" More ",-1)])]),_:1},8,["icon"])]),_:1})])]),t(oe,{gutter:20,class:"detail-content"},{default:n(()=>[t(Y,{xs:24,lg:8},{default:n(()=>[t(Q,{header:"Status"},{default:n(()=>[a("div",Fe,[a("div",He,[a("span",{class:X(["status-dot",I.value])},null,2),a("span",We,u(E.value),1)]),c.value.exists?(d(),m(j,{key:0},[t(J),a("div",qe,[a("div",Oe,[e[12]||(e[12]=a("span",{class:"stat-label"},"PID",-1)),a("span",Ge,u(c.value.pid||"-"),1)]),a("div",Je,[e[13]||(e[13]=a("span",{class:"stat-label"},"Memory",-1)),a("span",Qe,u(W(c.value.memory)),1)]),a("div",Ke,[e[14]||(e[14]=a("span",{class:"stat-label"},"CPU",-1)),a("span",Xe,u(c.value.cpu)+"%",1)]),a("div",Ye,[e[15]||(e[15]=a("span",{class:"stat-label"},"Restarts",-1)),a("span",Ze,u(c.value.restarts),1)])])],64)):U("",!0)])]),_:1})]),_:1}),t(Y,{xs:24,lg:16},{default:n(()=>[t(Q,{header:"Information"},{default:n(()=>[t(se,{column:1,border:""},{default:n(()=>[t(C,{label:"Name"},{default:n(()=>[p(u(o.value.name),1)]),_:1}),t(C,{label:"Display Name"},{default:n(()=>[p(u(o.value.displayName||"-"),1)]),_:1}),t(C,{label:"Type"},{default:n(()=>[t(Z,{type:w.value},{default:n(()=>[p(u(D.value),1)]),_:1},8,["type"])]),_:1}),t(C,{label:"Project Path"},{default:n(()=>[a("code",null,u(o.value.projectPath),1)]),_:1}),t(C,{label:"Plugin Path"},{default:n(()=>[a("code",null,u(o.value.pluginPath||"-"),1)]),_:1}),t(C,{label:"Config Path"},{default:n(()=>[a("code",null,u(o.value.configPath||"Default"),1)]),_:1}),t(C,{label:"Added"},{default:n(()=>[p(u(q(o.value.addedAt)),1)]),_:1}),t(C,{label:"Tags"},{default:n(()=>{var N;return[(N=o.value.tags)!=null&&N.length?(d(!0),m(j,{key:0},ae(o.value.tags,ee=>(d(),K(Z,{key:ee,size:"small",style:{"margin-right":"4px"}},{default:n(()=>[p(u(ee),1)]),_:2},1024))),128)):(d(),m("span",et,"-"))]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(Q,{header:"Recent Logs",class:"logs-card"},{default:n(()=>[t(Be,{"instance-name":o.value.name,expanded:!1},null,8,["instance-name"])]),_:1})],64)):(d(),m("div",Ve,[t(g,{icon:"error",title:"Instance not found","sub-title":"The requested instance does not exist"},{extra:n(()=>[t(r,{type:"primary",onClick:e[0]||(e[0]=N=>l.$router.push("/"))},{default:n(()=>[...e[2]||(e[2]=[p("Back to Dashboard",-1)])]),_:1})]),_:1})]))])}}},lt=ne(tt,[["__scopeId","data-v-e445ae67"]]);export{lt as default};
|