@shawnstack/quickforge 1.6.9 → 1.6.10
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/README.md +452 -452
- package/dist/assets/AgentProfilesPage-BtZpDV-3.js +1 -0
- package/dist/assets/{ChatPanelHost-BNFeNRy-.js → ChatPanelHost-BF1V-xOV.js} +49 -49
- package/dist/assets/{PluginsPage-C5OClNdT.js → PluginsPage-CCIj8-Mn.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-yT10oaaM.js → ScheduledTasksPage-DIMewQ3i.js} +2 -2
- package/dist/assets/{SettingsWorkspacePage-DuXwIeLd.js → SettingsWorkspacePage-BPD495WT.js} +348 -353
- package/dist/assets/{SharedConversationPage-ClpUSa0F.js → SharedConversationPage-B_oMTp7B.js} +1 -1
- package/dist/assets/TerminalDock-wgW7kSC4.js +2 -0
- package/dist/assets/WorkspaceInspector-CdX45r3u.js +13 -0
- package/dist/assets/index-Bxg5fT2p.css +3 -0
- package/dist/assets/index-DKmdePUP.js +63 -0
- package/dist/assets/{mcp-servers-dialog-DC2Zfojn.js → mcp-servers-dialog-jHlDR9jP.js} +2 -2
- package/dist/assets/{skills-dialog-Mnj8fZwq.js → skills-dialog-DvSnPPzu.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/server/routes/backup.mjs +135 -48
- package/server/routes/workspace.mjs +56 -0
- package/server/utils/platform.mjs +4 -4
- package/dist/assets/AgentProfilesPage-5eqU0Cjk.js +0 -1
- package/dist/assets/TerminalDock-BmL-FeKv.js +0 -2
- package/dist/assets/WorkspaceInspector-yH23pXpj.js +0 -13
- package/dist/assets/index-Qof73j0o.css +0 -3
- package/dist/assets/index-_ut7awrd.js +0 -63
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentProfilesPage-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r,Nt as i,Rt as a,S as o,Vt as s,_ as c,c as l,g as u,j as d,mt as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentProfilesPage-BtZpDV-3.js","assets/rolldown-runtime-DWdDZTNf.js","assets/index-DKmdePUP.js","assets/pi-ai-Cr3rpCXT.js","assets/pi-web-ui-DoRGtREc.js","assets/lit-vendor-Dr3cpBGF.js","assets/css-utils-rkE68RDy.js","assets/icons-C7j5jdKo.js","assets/react-vendor-VqdnQHHS.js","assets/skills-dialog-DvSnPPzu.js","assets/logger-B65Akg8A.js","assets/index-Bxg5fT2p.css","assets/mcp-servers-dialog-jHlDR9jP.js","assets/PluginsPage-CCIj8-Mn.js","assets/plugin-api-BbUkYm3Y.js","assets/ScheduledTasksPage-DIMewQ3i.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r,Nt as i,Rt as a,S as o,Vt as s,_ as c,c as l,g as u,j as d,mt as f,p,pt as m,u as h,yt as g,zt as ee}from"./icons-C7j5jdKo.js";import{n as te,r as ne}from"./react-vendor-VqdnQHHS.js";import{p as _}from"./lit-vendor-Dr3cpBGF.js";import{m as v,x as y}from"./pi-web-ui-DoRGtREc.js";import{J as b}from"./pi-ai-Cr3rpCXT.js";import{t as x}from"./logger-B65Akg8A.js";import{$ as re,A as S,B as ie,C as ae,D as oe,E as se,F as ce,H as C,I as le,L as ue,M as de,O as fe,Q as pe,T as me,V as w,Z as T,at as E,ct as he,dt as ge,ft as _e,ht as D,it as ve,k as O,mt as ye,ot as be,pt as xe,rt as Se,tt as Ce,ut as we,w as Te,z as Ee}from"./index-DKmdePUP.js";var k=e(s(),1),De={openai:{name:`OpenAI`,baseUrl:`https://api.openai.com/v1`,protocol:`openai-completions`,modelId:`gpt-4o`,supportsImages:!0},deepseek:{name:`DeepSeek`,baseUrl:`https://api.deepseek.com/v1`,protocol:`openai-completions`,modelId:`deepseek-chat`},glm:{name:`Zhipu GLM`,baseUrl:`https://open.bigmodel.cn/api/paas/v4`,protocol:`openai-completions`,modelId:`glm-4-plus`},ollama:{name:`Ollama`,baseUrl:`http://localhost:11434/v1`,protocol:`openai-completions`,modelId:`llama3.1`},litellm:{name:T.name,baseUrl:T.baseUrl,protocol:`openai-completions`,modelId:T.modelId,supportsImages:T.supportsImages}},Oe=[{key:`openai`,label:D(`presetOpenai`)},{key:`deepseek`,label:D(`presetDeepseek`)},{key:`glm`,label:D(`presetGlm`)},{key:`ollama`,label:D(`presetOllama`)},{key:`litellm`,label:D(`presetLitellm`)},{key:`custom`,label:D(`presetCustom`)}],A=()=>({modelId:``,contextWindow:T.contextWindow,maxTokens:T.maxTokens,reasoning:!0,supportsImages:!1,open:!1}),j=()=>({name:T.name,baseUrl:T.baseUrl,apiKey:``,headerRows:[],protocol:`openai-completions`,models:[A()]}),ke=class extends v{providers=[];form=j();editingProviderId;formOpen=!1;loading=!0;apiKeyVisible=!1;advancedOpen=!1;activePreset=``;testing=!1;testResult=`idle`;testError=``;autoEditProviderName=null;async connectedCallback(){if(super.connectedCallback(),await this.loadProviders(),this.autoEditProviderName){let e=this.providers.find(e=>e.name===this.autoEditProviderName);e&&await this.openEditForm(e),this.autoEditProviderName=null}}getTabName(){return D(`customModels`)}async loadProviders(){this.loading=!0,this.requestUpdate();try{this.providers=await y().customProviders.getAll()}catch(e){x.error(`Failed to load custom providers:`,e),this.providers=[]}finally{this.loading=!1,this.requestUpdate()}}resetTestState(){this.testing=!1,this.testResult=`idle`,this.testError=``}openAddForm(){this.editingProviderId=void 0,this.form=j(),this.apiKeyVisible=!1,this.advancedOpen=!1,this.activePreset=``,this.resetTestState(),this.formOpen=!0,this.requestUpdate()}async openEditForm(e){let t=await y().providerKeys.get(e.name)??e.apiKey??``,n=e.models??[],r=n.length>0?n.map(e=>({modelId:e.id,contextWindow:e.contextWindow??T.contextWindow,maxTokens:e.maxTokens??T.maxTokens,reasoning:e.reasoning===!0,supportsImages:e.input?.includes(`image`)===!0,open:!1})):[A()],i=n[0]?.headers??{},a=Object.entries(i).map(([e,t])=>({key:e,value:String(t)}));this.editingProviderId=e.id,this.form={providerId:e.id,id:e.id,name:e.name,baseUrl:e.baseUrl,apiKey:t,headerRows:a,protocol:e.type===`anthropic-messages`?`anthropic-messages`:`openai-completions`,models:r},this.apiKeyVisible=!1,this.advancedOpen=a.length>0||e.type===`anthropic-messages`,this.activePreset=``,this.resetTestState(),this.formOpen=!0,this.requestUpdate()}closeForm(){this.formOpen=!1,this.editingProviderId=void 0,this.form=j(),this.apiKeyVisible=!1,this.advancedOpen=!1,this.activePreset=``,this.resetTestState(),this.requestUpdate()}toggleApiKeyVisibility(){this.apiKeyVisible=!this.apiKeyVisible,this.requestUpdate()}updateForm(e,t){this.form={...this.form,[e]:t},(e===`name`||e===`baseUrl`)&&(this.activePreset=``),this.resetTestState(),this.requestUpdate()}updateModelField(e,t,n){let r=this.form.models.map((r,i)=>i===e?{...r,[t]:n}:r);this.form={...this.form,models:r},t===`modelId`&&(this.activePreset=``,this.resetTestState()),this.requestUpdate()}addModelRow(){this.form={...this.form,models:[...this.form.models,A()]},this.requestUpdate()}removeModelRow(e){let t=this.form.models.filter((t,n)=>n!==e);this.form={...this.form,models:t},this.requestUpdate()}toggleModelExpanded(e){let t=this.form.models.map((t,n)=>n===e?{...t,open:!t.open}:t);this.form={...this.form,models:t},this.requestUpdate()}addHeaderRow(){this.form={...this.form,headerRows:[...this.form.headerRows,{key:``,value:``}]},this.requestUpdate()}updateHeaderRow(e,t,n){let r=this.form.headerRows.map((r,i)=>i===e?{...r,[t]:n}:r);this.form={...this.form,headerRows:r},this.requestUpdate()}removeHeaderRow(e){let t=this.form.headerRows.filter((t,n)=>n!==e);this.form={...this.form,headerRows:t},this.requestUpdate()}applyPreset(e){if(this.activePreset=e,e===`custom`)this.form={...this.form,name:``,baseUrl:``,protocol:`openai-completions`,models:[A()]};else{let t=De[e];this.form={...this.form,name:t.name,baseUrl:t.baseUrl,protocol:t.protocol,models:[{...A(),modelId:t.modelId,supportsImages:t.supportsImages===!0,open:!1}]}}this.resetTestState(),this.requestUpdate()}buildHeadersFromRows(){let e={};for(let t of this.form.headerRows){let n=t.key.trim(),r=t.value.trim();n&&r&&(e[n]=r)}return e}buildModel(e,t){let n=this.form.name.trim(),r=this.form.baseUrl.trim(),i=e.reasoning===!0,a=e.supportsImages===!0?[`text`,`image`]:[`text`],o=r.includes(`api.deepseek.com`);return Se({id:e.modelId,name:`${e.modelId} (${n})`,api:this.form.protocol,provider:n,baseUrl:r.replace(/\/$/,``),reasoning:i,input:a,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:Number(e.contextWindow)||T.contextWindow,maxTokens:Number(e.maxTokens)||T.maxTokens,headers:Object.keys(t).length>0?t:void 0,thinkingLevelMap:o&&i?{low:`high`,medium:`high`,high:`high`,xhigh:`max`}:void 0,compat:this.form.protocol===`openai-completions`?{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:i,supportsUsageInStreaming:!1,supportsStrictMode:!1,maxTokensField:`max_tokens`,...o&&i?{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:`deepseek`}:{}}:void 0})}async testConnection(){let e=this.form.baseUrl.trim(),t=this.form.models.find(e=>e.modelId.trim());if(!e||!t){this.testing=!1,this.testResult=`fail`,this.testError=D(`testRequiresFields`),this.requestUpdate();return}let n=this.buildHeadersFromRows(),r=this.buildModel(t,n);this.testing=!0,this.testResult=`idle`,this.testError=``,this.requestUpdate();try{let e=await(await fetch(`/api/models/test-connection`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({model:r,apiKey:this.form.apiKey.trim()})})).json().catch(()=>({}));e?.ok?(this.testResult=`ok`,this.testError=``):(this.testResult=`fail`,this.testError=e?.error||D(`connectionFailed`))}catch(e){this.testResult=`fail`,this.testError=e?.message||D(`connectionFailed`)}finally{this.testing=!1,this.requestUpdate()}}async saveModel(){let e=this.form.name.trim(),t=this.form.baseUrl.trim();if(!e||!t){w(D(`fillProviderBaseUrlModel`));return}let n=this.form.models.filter(e=>e.modelId.trim());if(n.length===0){w(D(`atLeastOneModel`));return}let r=n.map(e=>e.modelId.trim());if(new Set(r).size!==r.length){w(D(`duplicateModelId`));return}let i=this.buildHeadersFromRows(),a=n.map(e=>this.buildModel(e,i)),o=this.form.apiKey.trim(),s=this.editingProviderId?this.providers.find(e=>e.id===this.editingProviderId):void 0,c={id:this.editingProviderId??be(),name:e,type:this.form.protocol,baseUrl:a[0].baseUrl,apiKey:o||void 0,models:a};try{let e=y();await e.customProviders.set(c),s&&s.name!==c.name&&await e.providerKeys.delete(s.name),o?await e.providerKeys.set(c.name,o):await e.providerKeys.delete(c.name),this.closeForm(),await this.loadProviders()}catch(e){x.error(`Failed to save custom model:`,e),w(D(`saveCustomModelFailed`))}}async deleteProvider(e){if(await C({description:D(`confirmDeleteProvider`,{name:e.name}),confirmLabel:D(`confirmDelete`),cancelLabel:D(`cancel`),variant:`destructive`}))try{let t=y();await t.customProviders.delete(e.id),await t.providerKeys.delete(e.name),await this.loadProviders()}catch(e){x.error(`Failed to delete custom provider:`,e),w(D(`deleteFailed`))}}renderProvider(e){let t=e.models??[],n=t.length,r=e.type===`anthropic-messages`?`Anthropic Messages`:`OpenAI Compatible`;return _`
|
|
3
3
|
<div class="quickforge-settings-list-item">
|
|
4
4
|
<div class="quickforge-settings-list-item-main">
|
|
5
5
|
<div class="flex min-w-0 items-start gap-3">
|
|
@@ -8,16 +8,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
8
8
|
<div class="quickforge-settings-row-title">${e.name}</div>
|
|
9
9
|
<div class="quickforge-settings-row-description break-all">${e.baseUrl}</div>
|
|
10
10
|
<div class="quickforge-settings-meta">
|
|
11
|
-
<span class="quickforge-settings-badge quickforge-settings-badge-muted">${
|
|
12
|
-
<span class="quickforge-settings-badge quickforge-settings-badge-info">${
|
|
13
|
-
${n===0?
|
|
11
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-muted">${D(`providerProtocol`)}: ${r}</span>
|
|
12
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-info">${D(`modelsCount`,{count:n})}</span>
|
|
13
|
+
${n===0?_`<span class="quickforge-settings-badge quickforge-settings-badge-warning">${D(`noModelAdded`)}</span>`:null}
|
|
14
14
|
</div>
|
|
15
|
-
${n>0?
|
|
15
|
+
${n>0?_`
|
|
16
16
|
<div class="quickforge-settings-meta">
|
|
17
|
-
${t.slice(0,6).map(e=>
|
|
17
|
+
${t.slice(0,6).map(e=>_`
|
|
18
18
|
<code class="quickforge-settings-command-name">${e.id}</code>
|
|
19
19
|
`)}
|
|
20
|
-
${t.length>6?
|
|
20
|
+
${t.length>6?_`<span class="quickforge-settings-badge quickforge-settings-badge-muted">+${t.length-6}</span>`:null}
|
|
21
21
|
</div>
|
|
22
22
|
`:null}
|
|
23
23
|
</div>
|
|
@@ -29,22 +29,22 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
29
29
|
type="button"
|
|
30
30
|
@click=${()=>this.openEditForm(e)}
|
|
31
31
|
>
|
|
32
|
-
${
|
|
32
|
+
${D(`editModel`)}
|
|
33
33
|
</button>
|
|
34
34
|
<button
|
|
35
35
|
class="quickforge-settings-button quickforge-settings-button-danger quickforge-settings-button-compact"
|
|
36
36
|
type="button"
|
|
37
37
|
@click=${()=>this.deleteProvider(e)}
|
|
38
38
|
>
|
|
39
|
-
${
|
|
39
|
+
${D(`delete`)}
|
|
40
40
|
</button>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
|
-
`}renderPresetChips(){return
|
|
43
|
+
`}renderPresetChips(){return _`
|
|
44
44
|
<div class="quickforge-settings-form-row">
|
|
45
|
-
<span class="quickforge-settings-form-label">${
|
|
45
|
+
<span class="quickforge-settings-form-label">${D(`presets`)}</span>
|
|
46
46
|
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap">
|
|
47
|
-
${Oe.map(e=>
|
|
47
|
+
${Oe.map(e=>_`
|
|
48
48
|
<button
|
|
49
49
|
class="quickforge-settings-segmented-option ${this.activePreset===e.key?`quickforge-settings-segmented-option-active`:``}"
|
|
50
50
|
type="button"
|
|
@@ -55,12 +55,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
55
55
|
`)}
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
|
-
`}renderModelRow(e,t){let n=e.open===!0;return
|
|
58
|
+
`}renderModelRow(e,t){let n=e.open===!0;return _`
|
|
59
59
|
<div class="quickforge-settings-subrow quickforge-settings-row-align-start">
|
|
60
60
|
<button
|
|
61
61
|
class="quickforge-settings-icon-action"
|
|
62
62
|
type="button"
|
|
63
|
-
title=${
|
|
63
|
+
title=${D(`expandModel`)}
|
|
64
64
|
aria-expanded=${n?`true`:`false`}
|
|
65
65
|
@click=${()=>this.toggleModelExpanded(t)}
|
|
66
66
|
>
|
|
@@ -71,12 +71,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
71
71
|
class="quickforge-settings-input quickforge-settings-mono"
|
|
72
72
|
.value=${e.modelId}
|
|
73
73
|
@input=${e=>this.updateModelField(t,`modelId`,e.target.value)}
|
|
74
|
-
placeholder=${
|
|
74
|
+
placeholder=${D(`modelIdPlaceholder`)}
|
|
75
75
|
/>
|
|
76
|
-
${n?
|
|
76
|
+
${n?_`
|
|
77
77
|
<div class="quickforge-settings-model-grid mt-3">
|
|
78
78
|
<label class="quickforge-settings-form-row">
|
|
79
|
-
<span class="quickforge-settings-form-label">${
|
|
79
|
+
<span class="quickforge-settings-form-label">${D(`contextWindow`)}</span>
|
|
80
80
|
<input
|
|
81
81
|
class="quickforge-settings-input"
|
|
82
82
|
.value=${String(e.contextWindow)}
|
|
@@ -85,7 +85,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
85
85
|
/>
|
|
86
86
|
</label>
|
|
87
87
|
<label class="quickforge-settings-form-row">
|
|
88
|
-
<span class="quickforge-settings-form-label">${
|
|
88
|
+
<span class="quickforge-settings-form-label">${D(`maxTokens`)}</span>
|
|
89
89
|
<input
|
|
90
90
|
class="quickforge-settings-input"
|
|
91
91
|
.value=${String(e.maxTokens)}
|
|
@@ -100,7 +100,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
100
100
|
.checked=${e.reasoning}
|
|
101
101
|
@change=${e=>this.updateModelField(t,`reasoning`,e.target.checked)}
|
|
102
102
|
/>
|
|
103
|
-
<span>${
|
|
103
|
+
<span>${D(`reasoningModel`)}</span>
|
|
104
104
|
</label>
|
|
105
105
|
<label class="mt-2 flex items-center gap-2 text-sm text-muted-foreground">
|
|
106
106
|
<input
|
|
@@ -109,49 +109,49 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
109
109
|
@change=${e=>this.updateModelField(t,`supportsImages`,e.target.checked)}
|
|
110
110
|
/>
|
|
111
111
|
<span>
|
|
112
|
-
${
|
|
113
|
-
<quickforge-info-tip .label=${
|
|
112
|
+
${D(`imageInputModel`)}
|
|
113
|
+
<quickforge-info-tip .label=${D(`imageInputModelHelp`)}></quickforge-info-tip>
|
|
114
114
|
</span>
|
|
115
115
|
</label>
|
|
116
116
|
`:null}
|
|
117
117
|
</div>
|
|
118
|
-
${this.form.models.length>1?
|
|
118
|
+
${this.form.models.length>1?_`
|
|
119
119
|
<button
|
|
120
120
|
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
121
121
|
type="button"
|
|
122
|
-
title=${
|
|
122
|
+
title=${D(`delete`)}
|
|
123
123
|
@click=${()=>this.removeModelRow(t)}
|
|
124
124
|
>
|
|
125
125
|
✕
|
|
126
126
|
</button>
|
|
127
127
|
`:null}
|
|
128
128
|
</div>
|
|
129
|
-
`}renderHeadersEditor(){return
|
|
129
|
+
`}renderHeadersEditor(){return _`
|
|
130
130
|
<div class="quickforge-settings-form-row">
|
|
131
131
|
<span class="quickforge-settings-form-label">
|
|
132
|
-
${
|
|
133
|
-
<quickforge-info-tip .label=${
|
|
132
|
+
${D(`customHeaders`)}
|
|
133
|
+
<quickforge-info-tip .label=${D(`customHeadersHelp`)}></quickforge-info-tip>
|
|
134
134
|
</span>
|
|
135
|
-
${this.form.headerRows.length===0?
|
|
135
|
+
${this.form.headerRows.length===0?_``:_`
|
|
136
136
|
<div class="quickforge-settings-nested-list">
|
|
137
|
-
${this.form.headerRows.map((e,t)=>
|
|
137
|
+
${this.form.headerRows.map((e,t)=>_`
|
|
138
138
|
<div class="quickforge-settings-subrow">
|
|
139
139
|
<input
|
|
140
140
|
class="quickforge-settings-input"
|
|
141
141
|
.value=${e.key}
|
|
142
142
|
@input=${e=>this.updateHeaderRow(t,`key`,e.target.value)}
|
|
143
|
-
placeholder=${
|
|
143
|
+
placeholder=${D(`headerName`)}
|
|
144
144
|
/>
|
|
145
145
|
<input
|
|
146
146
|
class="quickforge-settings-input"
|
|
147
147
|
.value=${e.value}
|
|
148
148
|
@input=${e=>this.updateHeaderRow(t,`value`,e.target.value)}
|
|
149
|
-
placeholder=${
|
|
149
|
+
placeholder=${D(`headerValue`)}
|
|
150
150
|
/>
|
|
151
151
|
<button
|
|
152
152
|
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
153
153
|
type="button"
|
|
154
|
-
title=${
|
|
154
|
+
title=${D(`removeHeader`)}
|
|
155
155
|
@click=${()=>this.removeHeaderRow(t)}
|
|
156
156
|
>
|
|
157
157
|
✕
|
|
@@ -165,11 +165,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
165
165
|
type="button"
|
|
166
166
|
@click=${()=>this.addHeaderRow()}
|
|
167
167
|
>
|
|
168
|
-
+ ${
|
|
168
|
+
+ ${D(`addHeader`)}
|
|
169
169
|
</button>
|
|
170
170
|
</div>
|
|
171
|
-
`}renderTestStatus(){return this.testResult===`idle`&&!this.testing?
|
|
172
|
-
<section class="quickforge-settings-section" aria-label=${this.editingProviderId?
|
|
171
|
+
`}renderTestStatus(){return this.testResult===`idle`&&!this.testing?_``:this.testing?_`<span class="quickforge-settings-status">${D(`testingConnection`)}</span>`:this.testResult===`ok`?_`<span class="quickforge-settings-badge quickforge-settings-badge-success">✓ ${D(`connectionOk`)}</span>`:_`<span class="quickforge-settings-alert">✗ ${this.testError||D(`connectionFailed`)}</span>`}renderForm(){return _`
|
|
172
|
+
<section class="quickforge-settings-section" aria-label=${this.editingProviderId?D(`editCustomModel`):D(`addCustomModel`)}>
|
|
173
173
|
<div class="quickforge-settings-toolbar">
|
|
174
174
|
<button
|
|
175
175
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
@@ -177,11 +177,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
177
177
|
@click=${()=>this.closeForm()}
|
|
178
178
|
>
|
|
179
179
|
<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg>
|
|
180
|
-
${
|
|
180
|
+
${D(`back`)}
|
|
181
181
|
</button>
|
|
182
182
|
<div class="quickforge-settings-row-main">
|
|
183
|
-
<div class="quickforge-settings-row-title">${this.editingProviderId?
|
|
184
|
-
<div class="quickforge-settings-row-description">${
|
|
183
|
+
<div class="quickforge-settings-row-title">${this.editingProviderId?D(`editCustomModel`):D(`addCustomModel`)}</div>
|
|
184
|
+
<div class="quickforge-settings-row-description">${D(`customModelsDescription`)}</div>
|
|
185
185
|
</div>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
@@ -189,12 +189,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
189
189
|
${this.renderPresetChips()}
|
|
190
190
|
|
|
191
191
|
<label class="quickforge-settings-form-row">
|
|
192
|
-
<span class="quickforge-settings-form-label">${
|
|
192
|
+
<span class="quickforge-settings-form-label">${D(`providerName`)}</span>
|
|
193
193
|
<input
|
|
194
194
|
class="quickforge-settings-input"
|
|
195
195
|
.value=${this.form.name}
|
|
196
196
|
@input=${e=>this.updateForm(`name`,e.target.value)}
|
|
197
|
-
placeholder=${
|
|
197
|
+
placeholder=${D(`providerNamePlaceholder`)}
|
|
198
198
|
/>
|
|
199
199
|
</label>
|
|
200
200
|
|
|
@@ -209,37 +209,37 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
209
209
|
</label>
|
|
210
210
|
|
|
211
211
|
<label class="quickforge-settings-form-row">
|
|
212
|
-
<span class="quickforge-settings-form-label">${
|
|
212
|
+
<span class="quickforge-settings-form-label">${D(`apiKey`)}</span>
|
|
213
213
|
<div class="quickforge-settings-inline-field">
|
|
214
214
|
<input
|
|
215
215
|
class="quickforge-settings-input pr-10"
|
|
216
216
|
.value=${this.form.apiKey}
|
|
217
217
|
type=${this.apiKeyVisible?`text`:`password`}
|
|
218
218
|
@input=${e=>this.updateForm(`apiKey`,e.target.value)}
|
|
219
|
-
placeholder=${
|
|
219
|
+
placeholder=${D(`apiKeyPlaceholder`)}
|
|
220
220
|
/>
|
|
221
221
|
<button
|
|
222
222
|
class="quickforge-settings-inline-field-button"
|
|
223
223
|
type="button"
|
|
224
|
-
title=${this.apiKeyVisible?
|
|
225
|
-
aria-label=${this.apiKeyVisible?
|
|
224
|
+
title=${this.apiKeyVisible?D(`hideApiKey`):D(`showApiKey`)}
|
|
225
|
+
aria-label=${this.apiKeyVisible?D(`hideApiKey`):D(`showApiKey`)}
|
|
226
226
|
aria-pressed=${this.apiKeyVisible?`true`:`false`}
|
|
227
227
|
@click=${()=>this.toggleApiKeyVisibility()}
|
|
228
228
|
>
|
|
229
|
-
${this.apiKeyVisible?
|
|
229
|
+
${this.apiKeyVisible?_`<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" y1="2" x2="22" y2="22"/><path d="M8.53 8.53A5 5 0 0 0 12 17a5 5 0 0 0 3.47-8.53"/></svg>`:_`<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`}
|
|
230
230
|
</button>
|
|
231
231
|
</div>
|
|
232
232
|
</label>
|
|
233
233
|
|
|
234
234
|
<div class="quickforge-settings-form-row">
|
|
235
235
|
<div class="flex items-center justify-between gap-3">
|
|
236
|
-
<span class="quickforge-settings-form-label">${
|
|
236
|
+
<span class="quickforge-settings-form-label">${D(`modelsList`)}</span>
|
|
237
237
|
<button
|
|
238
238
|
class="quickforge-settings-button quickforge-settings-button-secondary quickforge-settings-button-compact"
|
|
239
239
|
type="button"
|
|
240
240
|
@click=${()=>this.addModelRow()}
|
|
241
241
|
>
|
|
242
|
-
+ ${
|
|
242
|
+
+ ${D(`addModel`)}
|
|
243
243
|
</button>
|
|
244
244
|
</div>
|
|
245
245
|
<div class="quickforge-settings-nested-list">
|
|
@@ -254,15 +254,15 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
254
254
|
@click=${()=>{this.advancedOpen=!this.advancedOpen,this.requestUpdate()}}
|
|
255
255
|
>
|
|
256
256
|
<span>${this.advancedOpen?`▾`:`▸`}</span>
|
|
257
|
-
${
|
|
257
|
+
${D(`providerAdvanced`)}
|
|
258
258
|
</button>
|
|
259
259
|
|
|
260
|
-
${this.advancedOpen?
|
|
260
|
+
${this.advancedOpen?_`
|
|
261
261
|
<div class="quickforge-settings-form-grid rounded-lg border border-border p-3">
|
|
262
262
|
<label class="quickforge-settings-form-row">
|
|
263
263
|
<span class="quickforge-settings-form-label">
|
|
264
|
-
${
|
|
265
|
-
<quickforge-info-tip .label=${
|
|
264
|
+
${D(`protocolType`)}
|
|
265
|
+
<quickforge-info-tip .label=${D(`protocolHelp`)}></quickforge-info-tip>
|
|
266
266
|
</span>
|
|
267
267
|
<select
|
|
268
268
|
class="quickforge-settings-select"
|
|
@@ -288,7 +288,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
288
288
|
type="button"
|
|
289
289
|
@click=${()=>this.closeForm()}
|
|
290
290
|
>
|
|
291
|
-
${
|
|
291
|
+
${D(`cancel`)}
|
|
292
292
|
</button>
|
|
293
293
|
<button
|
|
294
294
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
@@ -296,49 +296,49 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
296
296
|
?disabled=${this.testing}
|
|
297
297
|
@click=${()=>this.testConnection()}
|
|
298
298
|
>
|
|
299
|
-
${this.testing?
|
|
299
|
+
${this.testing?D(`testingConnection`):D(`testConnection`)}
|
|
300
300
|
</button>
|
|
301
301
|
<button
|
|
302
302
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
303
303
|
type="button"
|
|
304
304
|
@click=${()=>this.saveModel()}
|
|
305
305
|
>
|
|
306
|
-
${
|
|
306
|
+
${D(`save`)}
|
|
307
307
|
</button>
|
|
308
308
|
</div>
|
|
309
309
|
</div>
|
|
310
310
|
</section>
|
|
311
|
-
`}render(){return this.formOpen?
|
|
311
|
+
`}render(){return this.formOpen?_`
|
|
312
312
|
<div class="quickforge-settings-stack">
|
|
313
313
|
<div class="quickforge-settings-heading">
|
|
314
314
|
<h3 class="quickforge-settings-title">
|
|
315
|
-
${this.editingProviderId?
|
|
316
|
-
<quickforge-info-tip .label=${
|
|
315
|
+
${this.editingProviderId?D(`editCustomModel`):D(`addCustomModel`)}
|
|
316
|
+
<quickforge-info-tip .label=${D(`customModelsDescription`)}></quickforge-info-tip>
|
|
317
317
|
</h3>
|
|
318
318
|
</div>
|
|
319
319
|
${this.renderForm()}
|
|
320
320
|
</div>
|
|
321
|
-
`:
|
|
321
|
+
`:_`
|
|
322
322
|
<div class="quickforge-settings-stack">
|
|
323
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
323
|
+
<section class="quickforge-settings-section" aria-label=${D(`customModelsTitle`)}>
|
|
324
324
|
<div class="quickforge-settings-toolbar">
|
|
325
325
|
<div>
|
|
326
|
-
<div class="quickforge-settings-row-title">${
|
|
327
|
-
<div class="quickforge-settings-row-description">${
|
|
326
|
+
<div class="quickforge-settings-row-title">${D(`customModelsTitle`)}</div>
|
|
327
|
+
<div class="quickforge-settings-row-description">${D(`customModelsDescription`)}</div>
|
|
328
328
|
</div>
|
|
329
329
|
<button
|
|
330
330
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
331
331
|
type="button"
|
|
332
332
|
@click=${()=>this.openAddForm()}
|
|
333
333
|
>
|
|
334
|
-
${
|
|
334
|
+
${D(`addModel`)}
|
|
335
335
|
</button>
|
|
336
336
|
</div>
|
|
337
337
|
|
|
338
|
-
${this.loading?
|
|
338
|
+
${this.loading?_`<div class="quickforge-settings-empty-row">${D(`loading`)}</div>`:this.providers.length===0?_`<div class="quickforge-settings-empty-row">${D(`noCustomModels`)}</div>`:this.providers.map(e=>this.renderProvider(e))}
|
|
339
339
|
</section>
|
|
340
340
|
</div>
|
|
341
|
-
`}},M=`quickforge-custom-providers-only-tab`;customElements.get(M)||customElements.define(M,ke);function Ae(e){let t=document.createElement(M);return e&&(t.autoEditProviderName=e),t}var je=[{value:`light`,label:()=>
|
|
341
|
+
`}},M=`quickforge-custom-providers-only-tab`;customElements.get(M)||customElements.define(M,ke);function Ae(e){let t=document.createElement(M);return e&&(t.autoEditProviderName=e),t}var je=[{value:`light`,label:()=>D(`lightTheme`)},{value:`dark`,label:()=>D(`darkTheme`)}],Me=class extends v{theme=se();interfaceFontSizePx=O.interfaceFontSizePx;messageFontSizePx=O.messageFontSizePx;loading=!0;error=``;getTabName(){return D(`appearance`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=y(),[t,n]=await Promise.all([oe(e),ce(e)]);this.theme=t.theme,this.interfaceFontSizePx=n.interfaceFontSizePx,this.messageFontSizePx=n.messageFontSizePx}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async selectTheme(e){if(this.theme!==e){this.theme=e,this.requestUpdate();try{await fe(y(),{theme:e}),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}}currentFontSizeSettings(){return le({interfaceFontSizePx:this.interfaceFontSizePx,messageFontSizePx:this.messageFontSizePx})}previewFontSize(e){let t=le(e);this.interfaceFontSizePx=t.interfaceFontSizePx,this.messageFontSizePx=t.messageFontSizePx,de(t),this.requestUpdate()}updateInterfaceFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),interfaceFontSizePx:Number(e)||O.interfaceFontSizePx})}updateMessageFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),messageFontSizePx:Number(e)||O.messageFontSizePx})}async saveFontSize(){try{await ue(y(),this.currentFontSizeSettings()),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}renderThemeOption(e){let t=this.theme===e.value;return _`
|
|
342
342
|
<button
|
|
343
343
|
type="button"
|
|
344
344
|
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
@@ -347,14 +347,14 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
347
347
|
>
|
|
348
348
|
${e.label()}
|
|
349
349
|
</button>
|
|
350
|
-
`}getFontSizeRangeProgress(e){return(e-
|
|
350
|
+
`}getFontSizeRangeProgress(e){return(e-S.min)/(S.max-S.min)*100}renderFontSizeSlider(e,t,n,r){return _`
|
|
351
351
|
<div class="quickforge-settings-row">
|
|
352
352
|
<div class="quickforge-settings-row-main">
|
|
353
353
|
<div class="quickforge-settings-row-title">
|
|
354
354
|
${e}
|
|
355
|
-
${t?
|
|
355
|
+
${t?_`<quickforge-info-tip .label=${t}></quickforge-info-tip>`:null}
|
|
356
356
|
</div>
|
|
357
|
-
<div class="quickforge-settings-row-description">${
|
|
357
|
+
<div class="quickforge-settings-row-description">${D(`fontSizeRangeDescription`)}</div>
|
|
358
358
|
</div>
|
|
359
359
|
<div class="quickforge-settings-row-control quickforge-settings-slider-control">
|
|
360
360
|
<span class="quickforge-settings-value-badge">${n}px</span>
|
|
@@ -362,8 +362,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
362
362
|
class="quickforge-font-size-slider"
|
|
363
363
|
style=${`--quickforge-font-size-slider-progress: ${this.getFontSizeRangeProgress(n)}%`}
|
|
364
364
|
type="range"
|
|
365
|
-
min=${String(
|
|
366
|
-
max=${String(
|
|
365
|
+
min=${String(S.min)}
|
|
366
|
+
max=${String(S.max)}
|
|
367
367
|
step="1"
|
|
368
368
|
.value=${String(n)}
|
|
369
369
|
@input=${e=>r(e.target.value)}
|
|
@@ -371,71 +371,71 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
371
371
|
/>
|
|
372
372
|
</div>
|
|
373
373
|
</div>
|
|
374
|
-
`}render(){return this.loading?
|
|
374
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${D(`loading`)}</div>`:_`
|
|
375
375
|
<div class="quickforge-settings-stack">
|
|
376
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
376
|
+
<section class="quickforge-settings-section" aria-label=${D(`appearance`)}>
|
|
377
377
|
<div class="quickforge-settings-row">
|
|
378
378
|
<div class="quickforge-settings-row-main">
|
|
379
379
|
<div class="quickforge-settings-row-title">
|
|
380
|
-
${
|
|
381
|
-
<quickforge-info-tip .label=${
|
|
380
|
+
${D(`theme`)}
|
|
381
|
+
<quickforge-info-tip .label=${D(`themeDescription`)}></quickforge-info-tip>
|
|
382
382
|
</div>
|
|
383
|
-
<div class="quickforge-settings-row-description">${
|
|
383
|
+
<div class="quickforge-settings-row-description">${D(`themeDescription`)}</div>
|
|
384
384
|
</div>
|
|
385
385
|
<div class="quickforge-settings-row-control">
|
|
386
|
-
<div class="quickforge-settings-segmented" role="group" aria-label=${
|
|
386
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${D(`theme`)}>
|
|
387
387
|
${je.map(e=>this.renderThemeOption(e))}
|
|
388
388
|
</div>
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
391
391
|
|
|
392
|
-
${this.renderFontSizeSlider(
|
|
392
|
+
${this.renderFontSizeSlider(D(`interfaceFontSize`),null,this.interfaceFontSizePx,e=>this.updateInterfaceFontSize(e))}
|
|
393
393
|
|
|
394
|
-
${this.renderFontSizeSlider(
|
|
394
|
+
${this.renderFontSizeSlider(D(`messageFontSize`),D(`messageFontSizeNote`),this.messageFontSizePx,e=>this.updateMessageFontSize(e))}
|
|
395
395
|
</section>
|
|
396
396
|
|
|
397
|
-
${this.error?
|
|
397
|
+
${this.error?_`<span class="quickforge-settings-error">${this.error}</span>`:null}
|
|
398
398
|
</div>
|
|
399
|
-
`}},N=`quickforge-appearance-settings-tab`;customElements.get(N)||customElements.define(N,Me);function Ne(){return document.createElement(N)}var Pe=`auto-compact-settings`,P={enabled:!0,thresholdPercent:80,keepRecentTurns:3,minSourceChars:1600,requireConfirmation:!0};function F(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Fe(e){if(!e||typeof e!=`object`)return{...P};let t=e;return{enabled:t.enabled!==!1,thresholdPercent:F(t.thresholdPercent,P.thresholdPercent,50,95),keepRecentTurns:F(t.keepRecentTurns,P.keepRecentTurns,1,20),minSourceChars:F(t.minSourceChars,P.minSourceChars,0,2e5),requireConfirmation:t.requireConfirmation!==!1}}async function Ie(e){return Fe(await e.settings.get(Pe))}async function Le(e,t){await e.settings.set(Pe,Fe(t))}var Re=[{value:`off`,label:()=>
|
|
399
|
+
`}},N=`quickforge-appearance-settings-tab`;customElements.get(N)||customElements.define(N,Me);function Ne(){return document.createElement(N)}var Pe=`auto-compact-settings`,P={enabled:!0,thresholdPercent:80,keepRecentTurns:3,minSourceChars:1600,requireConfirmation:!0};function F(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Fe(e){if(!e||typeof e!=`object`)return{...P};let t=e;return{enabled:t.enabled!==!1,thresholdPercent:F(t.thresholdPercent,P.thresholdPercent,50,95),keepRecentTurns:F(t.keepRecentTurns,P.keepRecentTurns,1,20),minSourceChars:F(t.minSourceChars,P.minSourceChars,0,2e5),requireConfirmation:t.requireConfirmation!==!1}}async function Ie(e){return Fe(await e.settings.get(Pe))}async function Le(e,t){await e.settings.set(Pe,Fe(t))}var Re=[{value:`off`,label:()=>D(`thinkingOff`)},{value:`low`,label:()=>D(`thinkingLow`)},{value:`medium`,label:()=>D(`thinkingMedium`)},{value:`high`,label:()=>D(`thinkingHigh`)},{value:`xhigh`,label:()=>D(`thinkingXHigh`)}];function ze(e){return(e??``).trim().replace(/\/$/,``)}function I(e){return JSON.stringify([e.provider,e.id,e.api,ze(e.baseUrl)])}function Be(e){return`${e.provider} / ${e.id}`}function Ve(){return`custom_${globalThis.crypto?.randomUUID?.().slice(0,8)||Date.now().toString(36)}`}function He(e){let t=e.trim(),n=t.split(/[\\/]/).pop()?.replace(/^"|"$/g,``)||t;return/^bash(\.exe)?$/i.test(n)?`Bash`:/^zsh$/i.test(n)?`Zsh`:/^fish$/i.test(n)?`Fish`:/^cmd(\.exe)?$/i.test(n)?`Command Prompt`:/^powershell(\.exe)?$/i.test(n)?`Windows PowerShell`:/^pwsh(\.exe)?$/i.test(n)?`PowerShell 7+`:n||`Custom Shell`}var Ue=_`
|
|
400
400
|
<svg class="size-3.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
401
401
|
<path d="M3.5 8.2 6.6 11.3 12.7 4.7" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" />
|
|
402
402
|
</svg>
|
|
403
|
-
`,We=
|
|
403
|
+
`,We=_`
|
|
404
404
|
<svg class="size-3.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
405
405
|
<circle cx="8" cy="8" r="4.8" stroke="currentColor" stroke-width="1.5" />
|
|
406
406
|
</svg>
|
|
407
|
-
`,Ge=
|
|
407
|
+
`,Ge=_`
|
|
408
408
|
<svg class="size-3.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
409
409
|
<path d="M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" />
|
|
410
410
|
</svg>
|
|
411
|
-
`,Ke=class extends
|
|
411
|
+
`,Ke=class extends v{models=[];selectedModel;thinkingLevel=`off`;showToolDetails=!1;expandToolsByDefault=!1;autoCompactEnabled=!0;autoCompactRequireConfirmation=!0;autoCompactThresholdPercent=80;autoCompactThresholdPercentInput=`80`;autoCompactKeepRecentTurns=3;selectedLanguage=xe();loading=!0;saved=!1;savedMessage=``;error=``;terminalShellConfig={terminalShell:`auto`,defaultProfileId:`auto`,profiles:[]};customShellCommand=``;getTabName(){return D(`defaultOptions`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}updated(){this.syncSelectValues()}syncSelectValues(){let e=this.querySelector(`[data-default-model-select]`);e&&this.selectedModel&&(e.value=I(this.selectedModel));let t=this.querySelector(`[data-default-thinking-select]`);t&&(t.value=this.thinkingLevel);let n=this.querySelector(`[data-language-select]`);n&&(n.value=this.selectedLanguage)}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=y(),[t,n,r,i]=await Promise.all([re(e),Ce(e),Ee(e),Ie(e)]);this.models=t,this.selectedModel=n.model?t.find(e=>I(e)===I(n.model))??n.model:t[0],this.thinkingLevel=n.thinkingLevel??pe(this.selectedModel),this.showToolDetails=r.showToolDetails,this.expandToolsByDefault=r.expandToolsByDefault,this.autoCompactEnabled=i.enabled,this.autoCompactRequireConfirmation=i.requireConfirmation,this.autoCompactThresholdPercent=i.thresholdPercent,this.autoCompactThresholdPercentInput=String(i.thresholdPercent),this.autoCompactKeepRecentTurns=i.keepRecentTurns,await this.loadTerminalShell()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}updateModel(e){let t=this.models.find(t=>I(t)===e);this.selectedModel=t,this.thinkingLevel=pe(t),this.saved=!1,this.requestUpdate(),this.saveDefaultModelOptions()}updateThinkingLevel(e){this.thinkingLevel=Re.some(t=>t.value===e)?e:`off`,this.saved=!1,this.requestUpdate(),this.saveDefaultModelOptions()}updateLanguage(e){this.selectedLanguage=e===`zh`?`zh`:`en`,this.requestUpdate(),this.applyLanguage()}async applyLanguage(){await _e(y(),this.selectedLanguage)}updateShowToolDetails(e){this.showToolDetails=e,this.saved=!1,this.requestUpdate(),this.saveToolDisplayOptions()}updateExpandToolsByDefault(e){this.expandToolsByDefault=e,this.saved=!1,this.requestUpdate(),this.saveToolDisplayOptions()}updateAutoCompactEnabled(e){this.autoCompactEnabled=e,this.saved=!1,this.requestUpdate(),this.saveAutoCompactOptions()}updateAutoCompactRequireConfirmation(e){this.autoCompactRequireConfirmation=e,this.saved=!1,this.requestUpdate(),this.saveAutoCompactOptions()}updateAutoCompactThresholdPercent(e){this.autoCompactThresholdPercentInput=e;let t=Number(e);e!==``&&Number.isFinite(t)&&(this.autoCompactThresholdPercent=t),this.saved=!1,this.requestUpdate()}updateAutoCompactKeepRecentTurns(e){this.autoCompactKeepRecentTurns=Number(e)||3,this.saved=!1,this.requestUpdate()}commitAutoCompactThresholdPercent(){let e=Number(this.autoCompactThresholdPercentInput);if(!Number.isFinite(e)){this.autoCompactThresholdPercentInput=String(this.autoCompactThresholdPercent),this.requestUpdate();return}let t=Math.max(50,Math.min(95,Math.round(e)));this.autoCompactThresholdPercent=t,this.autoCompactThresholdPercentInput=String(t),this.requestUpdate(),this.saveAutoCompactOptions()}commitAutoCompactKeepRecentTurns(){let e=Math.max(1,Math.min(20,Math.round(this.autoCompactKeepRecentTurns||3)));this.autoCompactKeepRecentTurns=e,this.requestUpdate(),this.saveAutoCompactOptions()}markSaved(e=D(`defaultOptionsSaved`)){this.saved=!0,this.savedMessage=e,this.error=``,this.requestUpdate()}customShellProfiles(){return this.terminalShellConfig.profiles.filter(e=>!e.builtin)}async loadTerminalShell(){try{let e=await fetch(`/api/system/terminal-shell`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||D(`requestFailed`));this.terminalShellConfig={terminalShell:t?.terminalShell||`auto`,defaultProfileId:t?.defaultProfileId||`auto`,profiles:Array.isArray(t?.profiles)?t.profiles:[]}}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}}async saveTerminalShellConfig(e,t=this.customShellProfiles(),n=D(`terminalShellSaved`)){try{let r=await fetch(`/api/system/terminal-shell`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaultProfileId:e,profiles:t})}),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.error||D(`requestFailed`));this.terminalShellConfig=i,this.markSaved(n)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}async addCustomTerminalShell(){let e=this.customShellCommand.trim();if(!e){this.error=D(`terminalShellProfileRequired`),this.requestUpdate();return}let t=[...this.customShellProfiles(),{id:Ve(),name:He(e),command:e,builtin:!1}];this.customShellCommand=``,await this.saveTerminalShellConfig(this.terminalShellConfig.defaultProfileId,t,D(`terminalShellProfilesSaved`))}async deleteCustomTerminalShell(e){let t=this.terminalShellConfig.profiles.find(t=>t.id===e);if(!t||t.builtin||!await C({description:D(`terminalShellDeleteConfirm`,{name:t.name}),confirmLabel:D(`confirmDelete`),cancelLabel:D(`cancel`),variant:`destructive`}))return;let n=this.customShellProfiles().filter(t=>t.id!==e),r=this.terminalShellConfig.defaultProfileId===e?`auto`:this.terminalShellConfig.defaultProfileId;await this.saveTerminalShellConfig(r,n,D(`terminalShellProfilesSaved`))}async saveDefaultModelOptions(){try{let e=this.selectedModel?.reasoning?this.thinkingLevel:`off`;await ve(y(),{model:this.selectedModel,thinkingLevel:e}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}async saveToolDisplayOptions(){try{await ie(y(),{showToolDetails:this.showToolDetails,expandToolsByDefault:this.expandToolsByDefault}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}async saveAutoCompactOptions(){try{await Le(y(),{enabled:this.autoCompactEnabled,thresholdPercent:this.autoCompactThresholdPercent,keepRecentTurns:this.autoCompactKeepRecentTurns,minSourceChars:1600,requireConfirmation:this.autoCompactRequireConfirmation}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}modelOptions(){if(!this.selectedModel)return this.models;let e=I(this.selectedModel);return this.models.some(t=>I(t)===e)?this.models:[this.selectedModel,...this.models]}shellProfileRow(e,t=!1){let n=e.id===this.terminalShellConfig.defaultProfileId||this.terminalShellConfig.defaultProfileId===`auto`&&t;return _`
|
|
412
412
|
<div class="quickforge-settings-subrow">
|
|
413
413
|
<div class="quickforge-settings-row-main">
|
|
414
414
|
<div class="quickforge-settings-row-title">${e.name}</div>
|
|
415
415
|
<div class="quickforge-settings-row-description quickforge-settings-mono" title=${e.command}>${e.command}</div>
|
|
416
416
|
</div>
|
|
417
417
|
<div class="quickforge-settings-row-control quickforge-settings-icon-actions">
|
|
418
|
-
${n?
|
|
419
|
-
<span class="quickforge-settings-icon-action quickforge-settings-icon-action-success" title=${
|
|
418
|
+
${n?_`
|
|
419
|
+
<span class="quickforge-settings-icon-action quickforge-settings-icon-action-success" title=${D(`terminalShellDefaultBadge`)} aria-label=${D(`terminalShellDefaultBadge`)}>
|
|
420
420
|
${Ue}
|
|
421
421
|
</span>
|
|
422
|
-
`:
|
|
422
|
+
`:_`
|
|
423
423
|
<button
|
|
424
424
|
class="quickforge-settings-icon-action"
|
|
425
425
|
type="button"
|
|
426
|
-
title=${
|
|
427
|
-
aria-label=${
|
|
426
|
+
title=${D(`terminalShellSetDefault`)}
|
|
427
|
+
aria-label=${D(`terminalShellSetDefault`)}
|
|
428
428
|
@click=${()=>this.saveTerminalShellConfig(e.id)}
|
|
429
429
|
>
|
|
430
430
|
${We}
|
|
431
431
|
</button>
|
|
432
432
|
`}
|
|
433
|
-
${e.builtin?null:
|
|
433
|
+
${e.builtin?null:_`
|
|
434
434
|
<button
|
|
435
435
|
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
436
436
|
type="button"
|
|
437
|
-
title=${
|
|
438
|
-
aria-label=${
|
|
437
|
+
title=${D(`delete`)}
|
|
438
|
+
aria-label=${D(`delete`)}
|
|
439
439
|
@click=${()=>this.deleteCustomTerminalShell(e.id)}
|
|
440
440
|
>
|
|
441
441
|
${Ge}
|
|
@@ -443,48 +443,48 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
443
443
|
`}
|
|
444
444
|
</div>
|
|
445
445
|
</div>
|
|
446
|
-
`}terminalShellSettings(){let e=this.terminalShellConfig.profiles;return
|
|
447
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
446
|
+
`}terminalShellSettings(){let e=this.terminalShellConfig.profiles;return _`
|
|
447
|
+
<section class="quickforge-settings-section" aria-label=${D(`terminalShell`)}>
|
|
448
448
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
449
449
|
<div class="quickforge-settings-row-main">
|
|
450
450
|
<div class="quickforge-settings-row-title">
|
|
451
|
-
${
|
|
452
|
-
<quickforge-info-tip .label=${
|
|
451
|
+
${D(`terminalShell`)}
|
|
452
|
+
<quickforge-info-tip .label=${D(`terminalShellDescription`)}></quickforge-info-tip>
|
|
453
453
|
</div>
|
|
454
|
-
<div class="quickforge-settings-row-description">${
|
|
454
|
+
<div class="quickforge-settings-row-description">${D(`terminalShellAutoDetectedHint`)}</div>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
457
457
|
|
|
458
458
|
<div class="quickforge-settings-nested-list">
|
|
459
|
-
${e.length>0?e.map((e,t)=>this.shellProfileRow(e,t===0)):
|
|
459
|
+
${e.length>0?e.map((e,t)=>this.shellProfileRow(e,t===0)):_`<div class="quickforge-settings-empty-row">${D(`terminalShellNoDetected`)}</div>`}
|
|
460
460
|
</div>
|
|
461
461
|
|
|
462
462
|
<div class="quickforge-settings-row">
|
|
463
463
|
<div class="quickforge-settings-row-main">
|
|
464
|
-
<div class="quickforge-settings-row-title">${
|
|
465
|
-
<div class="quickforge-settings-row-description">${
|
|
464
|
+
<div class="quickforge-settings-row-title">${D(`terminalShellCommand`)}</div>
|
|
465
|
+
<div class="quickforge-settings-row-description">${D(`terminalShellCustomDescription`)}</div>
|
|
466
466
|
</div>
|
|
467
467
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-terminal-shell-command-control">
|
|
468
468
|
<input
|
|
469
469
|
class="quickforge-settings-input quickforge-settings-mono"
|
|
470
470
|
type="text"
|
|
471
471
|
.value=${this.customShellCommand}
|
|
472
|
-
placeholder=${
|
|
472
|
+
placeholder=${D(`terminalShellCommandPlaceholder`)}
|
|
473
473
|
@input=${e=>{this.customShellCommand=e.target.value}}
|
|
474
474
|
/>
|
|
475
475
|
<button
|
|
476
476
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
477
477
|
type="button"
|
|
478
|
-
title=${
|
|
479
|
-
aria-label=${
|
|
478
|
+
title=${D(`terminalShellAdd`)}
|
|
479
|
+
aria-label=${D(`terminalShellAdd`)}
|
|
480
480
|
@click=${()=>this.addCustomTerminalShell()}
|
|
481
481
|
>
|
|
482
|
-
${
|
|
482
|
+
${D(`terminalShellAdd`)}
|
|
483
483
|
</button>
|
|
484
484
|
</div>
|
|
485
485
|
</div>
|
|
486
486
|
</section>
|
|
487
|
-
`}renderSwitch(e,t,n=!1){return
|
|
487
|
+
`}renderSwitch(e,t,n=!1){return _`
|
|
488
488
|
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
489
489
|
<input
|
|
490
490
|
type="checkbox"
|
|
@@ -494,16 +494,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
494
494
|
/>
|
|
495
495
|
<span aria-hidden="true"></span>
|
|
496
496
|
</label>
|
|
497
|
-
`}render(){return this.loading?
|
|
497
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${D(`loading`)}</div>`:_`
|
|
498
498
|
<div class="quickforge-settings-stack">
|
|
499
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
499
|
+
<section class="quickforge-settings-section" aria-label=${D(`defaultOptions`)}>
|
|
500
500
|
<div class="quickforge-settings-row">
|
|
501
501
|
<div class="quickforge-settings-row-main">
|
|
502
502
|
<div class="quickforge-settings-row-title">
|
|
503
|
-
${
|
|
504
|
-
<quickforge-info-tip .label=${
|
|
503
|
+
${D(`language`)}
|
|
504
|
+
<quickforge-info-tip .label=${D(`languageDescription`)}></quickforge-info-tip>
|
|
505
505
|
</div>
|
|
506
|
-
<div class="quickforge-settings-row-description">${
|
|
506
|
+
<div class="quickforge-settings-row-description">${D(`displayLanguage`)}</div>
|
|
507
507
|
</div>
|
|
508
508
|
<div class="quickforge-settings-row-control">
|
|
509
509
|
<select
|
|
@@ -512,16 +512,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
512
512
|
.value=${this.selectedLanguage}
|
|
513
513
|
@change=${e=>this.updateLanguage(e.target.value)}
|
|
514
514
|
>
|
|
515
|
-
<option value="zh">${
|
|
516
|
-
<option value="en">${
|
|
515
|
+
<option value="zh">${D(`simplifiedChinese`)}</option>
|
|
516
|
+
<option value="en">${D(`english`)}</option>
|
|
517
517
|
</select>
|
|
518
518
|
</div>
|
|
519
519
|
</div>
|
|
520
520
|
|
|
521
521
|
<div class="quickforge-settings-row">
|
|
522
522
|
<div class="quickforge-settings-row-main">
|
|
523
|
-
<div class="quickforge-settings-row-title">${
|
|
524
|
-
<div class="quickforge-settings-row-description">${
|
|
523
|
+
<div class="quickforge-settings-row-title">${D(`defaultModel`)}</div>
|
|
524
|
+
<div class="quickforge-settings-row-description">${D(`defaultModelDescription`)}</div>
|
|
525
525
|
</div>
|
|
526
526
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
527
527
|
<select
|
|
@@ -530,7 +530,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
530
530
|
.value=${this.selectedModel?I(this.selectedModel):``}
|
|
531
531
|
@change=${e=>this.updateModel(e.target.value)}
|
|
532
532
|
>
|
|
533
|
-
${this.modelOptions().length===0?
|
|
533
|
+
${this.modelOptions().length===0?_`<option value="">${D(`noModelAvailable`)}</option>`:this.modelOptions().map(e=>_`
|
|
534
534
|
<option .value=${I(e)}>${Be(e)}</option>
|
|
535
535
|
`)}
|
|
536
536
|
</select>
|
|
@@ -539,9 +539,9 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
539
539
|
|
|
540
540
|
<div class="quickforge-settings-row">
|
|
541
541
|
<div class="quickforge-settings-row-main">
|
|
542
|
-
<div class="quickforge-settings-row-title">${
|
|
542
|
+
<div class="quickforge-settings-row-title">${D(`defaultThinkingLevel`)}</div>
|
|
543
543
|
<div class="quickforge-settings-row-description">
|
|
544
|
-
${this.selectedModel?.reasoning?
|
|
544
|
+
${this.selectedModel?.reasoning?D(`defaultThinkingLevelDescription`):D(`thinkingRequiresReasoningModel`)}
|
|
545
545
|
</div>
|
|
546
546
|
</div>
|
|
547
547
|
<div class="quickforge-settings-row-control">
|
|
@@ -552,7 +552,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
552
552
|
?disabled=${!this.selectedModel?.reasoning}
|
|
553
553
|
@change=${e=>this.updateThinkingLevel(e.target.value)}
|
|
554
554
|
>
|
|
555
|
-
${Re.map(e=>
|
|
555
|
+
${Re.map(e=>_`
|
|
556
556
|
<option .value=${e.value}>${e.label()}</option>
|
|
557
557
|
`)}
|
|
558
558
|
</select>
|
|
@@ -562,10 +562,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
562
562
|
<div class="quickforge-settings-row">
|
|
563
563
|
<div class="quickforge-settings-row-main">
|
|
564
564
|
<div class="quickforge-settings-row-title">
|
|
565
|
-
${
|
|
566
|
-
<quickforge-info-tip .label=${
|
|
565
|
+
${D(`showToolDetails`)}
|
|
566
|
+
<quickforge-info-tip .label=${D(`showToolDetailsDescription`)}></quickforge-info-tip>
|
|
567
567
|
</div>
|
|
568
|
-
<div class="quickforge-settings-row-description">${
|
|
568
|
+
<div class="quickforge-settings-row-description">${D(`showToolDetailsDescriptionShort`)}</div>
|
|
569
569
|
</div>
|
|
570
570
|
<div class="quickforge-settings-row-control">
|
|
571
571
|
${this.renderSwitch(this.showToolDetails,e=>this.updateShowToolDetails(e))}
|
|
@@ -574,8 +574,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
574
574
|
|
|
575
575
|
<div class="quickforge-settings-row">
|
|
576
576
|
<div class="quickforge-settings-row-main">
|
|
577
|
-
<div class="quickforge-settings-row-title">${
|
|
578
|
-
<div class="quickforge-settings-row-description">${
|
|
577
|
+
<div class="quickforge-settings-row-title">${D(`expandToolsByDefault`)}</div>
|
|
578
|
+
<div class="quickforge-settings-row-description">${D(`expandToolsByDefaultDescription`)}</div>
|
|
579
579
|
</div>
|
|
580
580
|
<div class="quickforge-settings-row-control">
|
|
581
581
|
${this.renderSwitch(this.expandToolsByDefault,e=>this.updateExpandToolsByDefault(e))}
|
|
@@ -585,10 +585,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
585
585
|
<div class="quickforge-settings-row">
|
|
586
586
|
<div class="quickforge-settings-row-main">
|
|
587
587
|
<div class="quickforge-settings-row-title">
|
|
588
|
-
${
|
|
589
|
-
<quickforge-info-tip .label=${
|
|
588
|
+
${D(`autoCompactEnabled`)}
|
|
589
|
+
<quickforge-info-tip .label=${D(`autoCompactDescription`)}></quickforge-info-tip>
|
|
590
590
|
</div>
|
|
591
|
-
<div class="quickforge-settings-row-description">${
|
|
591
|
+
<div class="quickforge-settings-row-description">${D(`autoCompactTriggerNote`)}</div>
|
|
592
592
|
</div>
|
|
593
593
|
<div class="quickforge-settings-row-control">
|
|
594
594
|
${this.renderSwitch(this.autoCompactEnabled,e=>this.updateAutoCompactEnabled(e))}
|
|
@@ -597,8 +597,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
597
597
|
|
|
598
598
|
<div class="quickforge-settings-row">
|
|
599
599
|
<div class="quickforge-settings-row-main">
|
|
600
|
-
<div class="quickforge-settings-row-title">${
|
|
601
|
-
<div class="quickforge-settings-row-description">${
|
|
600
|
+
<div class="quickforge-settings-row-title">${D(`autoCompactRequireConfirmation`)}</div>
|
|
601
|
+
<div class="quickforge-settings-row-description">${D(`autoCompactRequireConfirmationDescription`)}</div>
|
|
602
602
|
</div>
|
|
603
603
|
<div class="quickforge-settings-row-control">
|
|
604
604
|
${this.renderSwitch(this.autoCompactRequireConfirmation,e=>this.updateAutoCompactRequireConfirmation(e),!this.autoCompactEnabled)}
|
|
@@ -607,8 +607,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
607
607
|
|
|
608
608
|
<div class="quickforge-settings-row">
|
|
609
609
|
<div class="quickforge-settings-row-main">
|
|
610
|
-
<div class="quickforge-settings-row-title">${
|
|
611
|
-
<div class="quickforge-settings-row-description">${
|
|
610
|
+
<div class="quickforge-settings-row-title">${D(`autoCompactThresholdPercent`)}</div>
|
|
611
|
+
<div class="quickforge-settings-row-description">${D(`autoCompactThresholdDescription`)}</div>
|
|
612
612
|
</div>
|
|
613
613
|
<div class="quickforge-settings-row-control">
|
|
614
614
|
<input
|
|
@@ -629,10 +629,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
629
629
|
<div class="quickforge-settings-row">
|
|
630
630
|
<div class="quickforge-settings-row-main">
|
|
631
631
|
<div class="quickforge-settings-row-title">
|
|
632
|
-
${
|
|
633
|
-
<quickforge-info-tip .label=${
|
|
632
|
+
${D(`autoCompactKeepRecentTurns`)}
|
|
633
|
+
<quickforge-info-tip .label=${D(`autoCompactHistoryPreserved`)}></quickforge-info-tip>
|
|
634
634
|
</div>
|
|
635
|
-
<div class="quickforge-settings-row-description">${
|
|
635
|
+
<div class="quickforge-settings-row-description">${D(`autoCompactKeepRecentTurnsDescription`)}</div>
|
|
636
636
|
</div>
|
|
637
637
|
<div class="quickforge-settings-row-control">
|
|
638
638
|
<input
|
|
@@ -653,10 +653,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
653
653
|
|
|
654
654
|
${this.terminalShellSettings()}
|
|
655
655
|
|
|
656
|
-
${this.saved?
|
|
657
|
-
${this.error?
|
|
656
|
+
${this.saved?_`<div class="quickforge-settings-message">${this.savedMessage||D(`defaultOptionsSaved`)}</div>`:null}
|
|
657
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
658
658
|
</div>
|
|
659
|
-
`}},L=`quickforge-default-options-settings-tab`;customElements.get(L)||customElements.define(L,Ke);function qe(){return document.createElement(L)}var Je=`quickforge-backup`,
|
|
659
|
+
`}},L=`quickforge-default-options-settings-tab`;customElements.get(L)||customElements.define(L,Ke);function qe(){return document.createElement(L)}var Je=`quickforge-backup`,R=[{id:`settings`,countKey:`settings`,label:()=>D(`restoreSettings`),description:()=>D(`restoreSettingsDescription`)},{id:`mcp`,countKey:`mcp`,label:()=>D(`restoreMcp`),description:()=>D(`restoreMcpDescription`)},{id:`providerKeys`,countKey:`providerKeys`,label:()=>D(`restoreProviderKeys`),description:()=>D(`restoreProviderKeysDescription`)},{id:`customProviders`,countKey:`customProviders`,label:()=>D(`restoreCustomProviders`),description:()=>D(`restoreCustomProvidersDescription`)},{id:`projects`,countKey:`projects`,label:()=>D(`restoreProjects`),description:()=>D(`restoreProjectsDescription`)},{id:`scheduledTasks`,countKey:`scheduledTasks`,label:()=>D(`restoreScheduledTasks`),description:()=>D(`restoreScheduledTasksDescription`)}],Ye=R;function Xe(e,t){let n=new Blob([`${JSON.stringify(t,null,2)}\n`],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function Ze(){return new Date().toISOString().replace(/[:.]/g,`-`)}function Qe(e){return e?Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`, `):``}function $e(e){return Ye.filter(t=>(e.sections?.[t.countKey]??0)>0)}function et(e){return $e(e).map(e=>e.id)}function tt(e){return e instanceof RangeError||e instanceof Error&&e.message.includes(`Invalid string length`)}function z(e,t){return tt(e)?D(`backupStringTooLarge`):e instanceof Error?e.message:t}var nt=class extends v{exportSections=new Set(R.map(e=>e.id));busy=!1;message=``;error=``;safetyBackupPath=``;pendingImport=null;getTabName(){return D(`backupRestore`)}toggleExportSection(e,t){t?this.exportSections.add(e):this.exportSections.delete(e),this.clearStatus(),this.requestUpdate()}clearStatus(){this.message=``,this.error=``,this.safetyBackupPath=``}async exportBackup(){if(this.exportSections.size===0){this.error=D(`selectAtLeastOneExportSection`),this.requestUpdate();return}this.busy=!0,this.clearStatus(),this.requestUpdate();try{let e=new URLSearchParams({sections:[...this.exportSections].join(`,`)}),t=await fetch(`/api/backup/export?${e.toString()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||D(`backupExportFailed`));Xe(`${Je}-settings-${Ze()}.json`,n),this.message=D(`backupExported`)}catch(e){this.error=z(e,D(`backupExportFailed`))}finally{this.busy=!1,this.requestUpdate()}}async inspectBackupFile(e){let t=await fetch(`/api/backup/inspect-file`,{method:`POST`,headers:{"content-type":`application/json`},body:e}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||D(`backupInspectFailed`));if(!n)throw Error(D(`backupInspectFailed`));return n}async importBackupFromFile(e){this.busy=!0,this.clearStatus(),this.pendingImport=null,this.requestUpdate();try{let t=await this.inspectBackupFile(e),n=new Set(et(t));this.pendingImport={backup:null,importToken:t.importToken,inspect:t,selectedSections:n,mode:`replace`},this.message=t.ignoredConversations?D(`backupInspectedWithIgnoredConversations`):D(`backupInspected`)}catch(e){this.error=z(e,D(`backupImportFailed`))}finally{this.busy=!1,this.requestUpdate()}}togglePendingSection(e,t){this.pendingImport&&(t?this.pendingImport.selectedSections.add(e):this.pendingImport.selectedSections.delete(e),this.message=``,this.error=``,this.requestUpdate())}setRestoreMode(e){this.pendingImport&&(this.pendingImport.mode=e,this.message=``,this.error=``,this.requestUpdate())}cancelPendingImport(){this.pendingImport=null,this.message=``,this.error=``,this.requestUpdate()}async confirmPendingImport(){if(this.pendingImport){if(this.pendingImport.selectedSections.size===0){this.error=D(`selectAtLeastOneRestoreSection`),this.requestUpdate();return}if(await C({description:this.pendingImport.mode===`replace`?D(`backupImportReplaceConfirm`):D(`backupImportMergeConfirm`),confirmLabel:D(`confirmImportSelected`),cancelLabel:D(`cancel`)})){this.busy=!0,this.clearStatus(),this.requestUpdate();try{let e=this.pendingImport.importToken?{importToken:this.pendingImport.importToken,sections:[...this.pendingImport.selectedSections],mode:this.pendingImport.mode}:{backup:this.pendingImport.backup,sections:[...this.pendingImport.selectedSections],mode:this.pendingImport.mode},t=await fetch(`/api/backup/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||D(`backupImportFailed`));let r=Qe(n?.summary);this.safetyBackupPath=n?.safetyBackupPath||``,this.pendingImport=null,this.message=r?`${D(`backupImported`)} ${r}`:D(`backupImported`),window.setTimeout(()=>window.location.reload(),1500)}catch(e){this.error=z(e,D(`backupImportFailed`))}finally{this.busy=!1,this.requestUpdate()}}}}handleFileChange(e){let t=e.target,n=t.files?.[0];t.value=``,n&&this.importBackupFromFile(n)}renderSwitch(e,t,n=!1){return _`
|
|
660
660
|
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
661
661
|
<input
|
|
662
662
|
type="checkbox"
|
|
@@ -666,62 +666,69 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
666
666
|
/>
|
|
667
667
|
<span aria-hidden="true"></span>
|
|
668
668
|
</label>
|
|
669
|
-
`}renderPendingImport(){if(!this.pendingImport)return null;let{inspect:e,selectedSections:t}=this.pendingImport,n=$e(e);return
|
|
670
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
669
|
+
`}renderPendingImport(){if(!this.pendingImport)return null;let{inspect:e,selectedSections:t}=this.pendingImport,n=$e(e);return _`
|
|
670
|
+
<section class="quickforge-settings-section" aria-label=${D(`backupInspectTitle`)}>
|
|
671
671
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
672
672
|
<div class="quickforge-settings-row-main">
|
|
673
|
-
<div class="quickforge-settings-row-title">${
|
|
674
|
-
<div class="quickforge-settings-row-description">${
|
|
673
|
+
<div class="quickforge-settings-row-title">${D(`backupInspectTitle`)}</div>
|
|
674
|
+
<div class="quickforge-settings-row-description">${D(`backupInspectDescription`)}</div>
|
|
675
675
|
</div>
|
|
676
676
|
</div>
|
|
677
677
|
|
|
678
678
|
<div class="quickforge-settings-nested-list">
|
|
679
679
|
<div class="quickforge-settings-subrow">
|
|
680
680
|
<div class="quickforge-settings-row-main">
|
|
681
|
-
<div class="quickforge-settings-row-title">${
|
|
681
|
+
<div class="quickforge-settings-row-title">${D(`backupInspectExportedAt`)}</div>
|
|
682
682
|
</div>
|
|
683
683
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.exportedAt||`-`}</div>
|
|
684
684
|
</div>
|
|
685
685
|
<div class="quickforge-settings-subrow">
|
|
686
686
|
<div class="quickforge-settings-row-main">
|
|
687
|
-
<div class="quickforge-settings-row-title">${
|
|
687
|
+
<div class="quickforge-settings-row-title">${D(`backupInspectVersion`)}</div>
|
|
688
688
|
</div>
|
|
689
689
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version??`-`}</div>
|
|
690
690
|
</div>
|
|
691
691
|
<div class="quickforge-settings-subrow">
|
|
692
692
|
<div class="quickforge-settings-row-main">
|
|
693
|
-
<div class="quickforge-settings-row-title">${
|
|
693
|
+
<div class="quickforge-settings-row-title">${D(`backupInspectScope`)}</div>
|
|
694
694
|
</div>
|
|
695
695
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.scope||`-`}</div>
|
|
696
696
|
</div>
|
|
697
697
|
<div class="quickforge-settings-subrow">
|
|
698
698
|
<div class="quickforge-settings-row-main">
|
|
699
|
-
<div class="quickforge-settings-row-title">${
|
|
699
|
+
<div class="quickforge-settings-row-title">${D(`backupInspectSecrets`)}</div>
|
|
700
700
|
</div>
|
|
701
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.includeSecrets?
|
|
701
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.includeSecrets?D(`yes`):D(`no`)}</div>
|
|
702
702
|
</div>
|
|
703
703
|
</div>
|
|
704
704
|
|
|
705
|
-
${e.warnings?.length?
|
|
705
|
+
${e.warnings?.length?_`
|
|
706
706
|
<div class="quickforge-settings-warning quickforge-settings-warning-attached">
|
|
707
|
-
${e.warnings.map(e=>
|
|
707
|
+
${e.warnings.map(e=>_`<div>⚠ ${e}</div>`)}
|
|
708
|
+
</div>
|
|
709
|
+
`:null}
|
|
710
|
+
|
|
711
|
+
${e.invalidSections&&Object.keys(e.invalidSections).length?_`
|
|
712
|
+
<div class="quickforge-settings-warning quickforge-settings-warning-attached">
|
|
713
|
+
<div>${D(`backupInvalidSections`)}</div>
|
|
714
|
+
${Object.entries(e.invalidSections).map(([e,t])=>_`<div>${e}: ${t}</div>`)}
|
|
708
715
|
</div>
|
|
709
716
|
`:null}
|
|
710
717
|
|
|
711
718
|
<div class="quickforge-settings-row">
|
|
712
719
|
<div class="quickforge-settings-row-main">
|
|
713
|
-
<div class="quickforge-settings-row-title">${
|
|
714
|
-
<div class="quickforge-settings-row-description">${
|
|
720
|
+
<div class="quickforge-settings-row-title">${D(`restoreMode`)}</div>
|
|
721
|
+
<div class="quickforge-settings-row-description">${D(`restoreModeDescription`)}</div>
|
|
715
722
|
</div>
|
|
716
723
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
717
|
-
<div class="quickforge-settings-segmented" role="group" aria-label=${
|
|
724
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${D(`restoreMode`)}>
|
|
718
725
|
<button
|
|
719
726
|
type="button"
|
|
720
727
|
class="quickforge-settings-segmented-option ${this.pendingImport.mode===`replace`?`quickforge-settings-segmented-option-active`:``}"
|
|
721
728
|
?disabled=${this.busy}
|
|
722
729
|
@click=${()=>this.setRestoreMode(`replace`)}
|
|
723
730
|
>
|
|
724
|
-
${
|
|
731
|
+
${D(`restoreModeReplace`)}
|
|
725
732
|
</button>
|
|
726
733
|
<button
|
|
727
734
|
type="button"
|
|
@@ -729,7 +736,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
729
736
|
?disabled=${this.busy}
|
|
730
737
|
@click=${()=>this.setRestoreMode(`merge`)}
|
|
731
738
|
>
|
|
732
|
-
${
|
|
739
|
+
${D(`restoreModeMerge`)}
|
|
733
740
|
</button>
|
|
734
741
|
</div>
|
|
735
742
|
</div>
|
|
@@ -737,14 +744,14 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
737
744
|
|
|
738
745
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
739
746
|
<div class="quickforge-settings-row-main">
|
|
740
|
-
<div class="quickforge-settings-row-title">${
|
|
747
|
+
<div class="quickforge-settings-row-title">${D(`selectRestoreSections`)}</div>
|
|
741
748
|
<div class="quickforge-settings-row-description">
|
|
742
|
-
${this.pendingImport.mode===`replace`?
|
|
749
|
+
${this.pendingImport.mode===`replace`?D(`restoreModeReplaceDescription`):D(`restoreModeMergeDescription`)}
|
|
743
750
|
</div>
|
|
744
751
|
</div>
|
|
745
752
|
</div>
|
|
746
753
|
<div class="quickforge-settings-nested-list">
|
|
747
|
-
${n.map(n=>
|
|
754
|
+
${n.map(n=>_`
|
|
748
755
|
<div class="quickforge-settings-subrow">
|
|
749
756
|
<div class="quickforge-settings-row-main">
|
|
750
757
|
<div class="quickforge-settings-row-title">${n.label()} (${e.sections?.[n.countKey]??0})</div>
|
|
@@ -759,8 +766,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
759
766
|
|
|
760
767
|
<div class="quickforge-settings-row">
|
|
761
768
|
<div class="quickforge-settings-row-main">
|
|
762
|
-
<div class="quickforge-settings-row-title">${
|
|
763
|
-
<div class="quickforge-settings-row-description">${
|
|
769
|
+
<div class="quickforge-settings-row-title">${D(`backupImportActions`)}</div>
|
|
770
|
+
<div class="quickforge-settings-row-description">${D(`backupImportActionsDescription`)}</div>
|
|
764
771
|
</div>
|
|
765
772
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
766
773
|
<button
|
|
@@ -769,7 +776,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
769
776
|
?disabled=${this.busy||t.size===0}
|
|
770
777
|
@click=${()=>this.confirmPendingImport()}
|
|
771
778
|
>
|
|
772
|
-
${this.busy?
|
|
779
|
+
${this.busy?D(`loading`):D(`confirmImportSelected`)}
|
|
773
780
|
</button>
|
|
774
781
|
<button
|
|
775
782
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
@@ -777,78 +784,66 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
777
784
|
?disabled=${this.busy}
|
|
778
785
|
@click=${()=>this.cancelPendingImport()}
|
|
779
786
|
>
|
|
780
|
-
${
|
|
787
|
+
${D(`cancel`)}
|
|
781
788
|
</button>
|
|
782
789
|
</div>
|
|
783
790
|
</div>
|
|
784
791
|
</section>
|
|
785
|
-
`}render(){return
|
|
792
|
+
`}render(){return _`
|
|
786
793
|
<div class="quickforge-settings-stack">
|
|
787
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
788
|
-
<div class="quickforge-settings-row">
|
|
794
|
+
<section class="quickforge-settings-section" aria-label=${D(`exportData`)}>
|
|
795
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
789
796
|
<div class="quickforge-settings-row-main">
|
|
790
797
|
<div class="quickforge-settings-row-title">
|
|
791
|
-
${
|
|
792
|
-
<quickforge-info-tip .label=${
|
|
798
|
+
${D(`selectExportSections`)}
|
|
799
|
+
<quickforge-info-tip .label=${D(`exportDataDescription`)}></quickforge-info-tip>
|
|
793
800
|
</div>
|
|
794
|
-
<div class="quickforge-settings-row-description">${
|
|
795
|
-
</div>
|
|
796
|
-
<div class="quickforge-settings-row-control">
|
|
797
|
-
<select
|
|
798
|
-
class="quickforge-settings-select"
|
|
799
|
-
.value=${this.exportScope}
|
|
800
|
-
?disabled=${this.busy}
|
|
801
|
-
@change=${e=>this.setScope(e.target.value)}
|
|
802
|
-
>
|
|
803
|
-
<option value="all">${O(`exportScopeAll`)}</option>
|
|
804
|
-
<option value="config">${O(`exportScopeConfig`)}</option>
|
|
805
|
-
<option value="sessions">${O(`exportScopeSessions`)}</option>
|
|
806
|
-
</select>
|
|
801
|
+
<div class="quickforge-settings-row-description">${D(`selectExportSectionsDescription`)}</div>
|
|
807
802
|
</div>
|
|
808
803
|
</div>
|
|
809
804
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
${this.renderSwitch(this.includeSecrets,e=>this.setIncludeSecrets(e),this.busy||this.exportScope===`sessions`)}
|
|
823
|
-
</div>
|
|
805
|
+
<div class="quickforge-settings-nested-list">
|
|
806
|
+
${R.map(e=>_`
|
|
807
|
+
<div class="quickforge-settings-subrow">
|
|
808
|
+
<div class="quickforge-settings-row-main">
|
|
809
|
+
<div class="quickforge-settings-row-title">${e.label()}</div>
|
|
810
|
+
<div class="quickforge-settings-row-description">${e.description()}</div>
|
|
811
|
+
</div>
|
|
812
|
+
<div class="quickforge-settings-row-control">
|
|
813
|
+
${this.renderSwitch(this.exportSections.has(e.id),t=>this.toggleExportSection(e.id,t),this.busy)}
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
`)}
|
|
824
817
|
</div>
|
|
825
818
|
|
|
819
|
+
<div class="quickforge-settings-note">${D(`conversationBackupExcluded`)}</div>
|
|
820
|
+
|
|
826
821
|
<div class="quickforge-settings-row">
|
|
827
822
|
<div class="quickforge-settings-row-main">
|
|
828
|
-
<div class="quickforge-settings-row-title">${
|
|
829
|
-
<div class="quickforge-settings-row-description">${
|
|
823
|
+
<div class="quickforge-settings-row-title">${D(`exportBackup`)}</div>
|
|
824
|
+
<div class="quickforge-settings-row-description">${D(`exportBackupDescription`)}</div>
|
|
830
825
|
</div>
|
|
831
826
|
<div class="quickforge-settings-row-control">
|
|
832
827
|
<button
|
|
833
828
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
834
829
|
type="button"
|
|
835
|
-
?disabled=${this.busy}
|
|
830
|
+
?disabled=${this.busy||this.exportSections.size===0}
|
|
836
831
|
@click=${()=>this.exportBackup()}
|
|
837
832
|
>
|
|
838
|
-
${this.busy?
|
|
833
|
+
${this.busy?D(`loading`):D(`exportBackup`)}
|
|
839
834
|
</button>
|
|
840
835
|
</div>
|
|
841
836
|
</div>
|
|
842
837
|
</section>
|
|
843
838
|
|
|
844
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
839
|
+
<section class="quickforge-settings-section" aria-label=${D(`importData`)}>
|
|
845
840
|
<div class="quickforge-settings-row">
|
|
846
841
|
<div class="quickforge-settings-row-main">
|
|
847
842
|
<div class="quickforge-settings-row-title">
|
|
848
|
-
${
|
|
849
|
-
<quickforge-info-tip .label=${
|
|
843
|
+
${D(`importBackup`)}
|
|
844
|
+
<quickforge-info-tip .label=${D(`importDataDescription`)}></quickforge-info-tip>
|
|
850
845
|
</div>
|
|
851
|
-
<div class="quickforge-settings-row-description">${
|
|
846
|
+
<div class="quickforge-settings-row-description">${D(`importDataDescription`)}</div>
|
|
852
847
|
</div>
|
|
853
848
|
<div class="quickforge-settings-row-control">
|
|
854
849
|
<label class="quickforge-settings-button quickforge-settings-button-secondary ${this.busy?`pointer-events-none opacity-60`:``}">
|
|
@@ -859,24 +854,24 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
859
854
|
?disabled=${this.busy}
|
|
860
855
|
@change=${e=>this.handleFileChange(e)}
|
|
861
856
|
/>
|
|
862
|
-
${
|
|
857
|
+
${D(`importBackup`)}
|
|
863
858
|
</label>
|
|
864
859
|
</div>
|
|
865
860
|
</div>
|
|
866
861
|
</section>
|
|
867
862
|
|
|
868
863
|
${this.renderPendingImport()}
|
|
869
|
-
${this.message?
|
|
870
|
-
${this.safetyBackupPath?
|
|
871
|
-
${this.error?
|
|
864
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
865
|
+
${this.safetyBackupPath?_`<div class="quickforge-settings-note">${D(`backupSafetyBackupPath`)}: <code>${this.safetyBackupPath}</code></div>`:null}
|
|
866
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
872
867
|
</div>
|
|
873
|
-
`}},B=`quickforge-backup-settings-tab`;customElements.get(B)||customElements.define(B,
|
|
868
|
+
`}},B=`quickforge-backup-settings-tab`;customElements.get(B)||customElements.define(B,nt);function rt(){return document.createElement(B)}function it(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(ye())}function at(e){let t={...e};return delete t.archivedAt,t}function V(){if(!(typeof BroadcastChannel>`u`))try{let e=new BroadcastChannel(`quickforge-sync`);e.postMessage({type:`sessions-changed`,sourceTabId:`archived-conversations-settings-tab`,timestamp:Date.now()}),e.close()}catch{}}var ot=class extends v{sessions=[];projects=[];loading=!0;busySessionId=``;query=``;projectFilter=`all`;message=``;error=``;getTabName(){return D(`archivedConversations`)}async connectedCallback(){super.connectedCallback(),await this.loadData()}get projectNameById(){return new Map(this.projects.map(e=>[e.id,e.name]))}async loadData(){this.loading=!0,this.error=``,this.requestUpdate();try{let[e,t]=await Promise.all([fetch(`/api/storage/sessions-metadata/index/lastModified?direction=desc&limit=1000&offset=0&archived=only`,{cache:`no-store`}),fetch(`/api/project`,{cache:`no-store`}).catch(()=>null)]),n=await e.json().catch(()=>null);if(!e.ok)throw Error(n?.error||D(`requestFailed`));if(this.sessions=Array.isArray(n?.values)?n.values:[],t?.ok){let e=await t.json().catch(()=>null);this.projects=Array.isArray(e?.projects)?e.projects:[]}}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}filteredSessions(){let e=this.query.trim().toLowerCase();return this.sessions.filter(t=>{if(this.projectFilter!==`all`&&(this.projectFilter===`global`&&t.scope===`project`||this.projectFilter!==`global`&&t.projectId!==this.projectFilter))return!1;if(!e)return!0;let n=t.projectId&&this.projectNameById.get(t.projectId)||``;return`${E(t.title)} ${n}`.toLowerCase().includes(e)})}groupedSessions(){let e=new Map;for(let t of this.filteredSessions()){let n=t.scope===`project`&&t.projectId?t.projectId:`global`;e.set(n,[...e.get(n)??[],t])}return[...e.entries()]}projectLabel(e){return e===`global`?D(`normalChat`):this.projectNameById.get(e)||D(`unknownProject`)}async restoreSession(e){if(!this.busySessionId){this.busySessionId=e,this.message=``,this.error=``,this.requestUpdate();try{let t=y(),n=await t.sessions.get(e),r=await t.sessions.getMetadata(e);if(!n||!r)throw Error(D(`sessionNotFound`));await t.sessions.save(at(n),at(r)),this.sessions=this.sessions.filter(t=>t.id!==e),this.message=D(`sessionRestored`),V()}catch(e){this.error=e instanceof Error?e.message:D(`restoreSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteSession(e){if(!this.busySessionId&&await C({description:D(`deleteArchivedSessionConfirm`,{title:E(e.title)}),confirmLabel:D(`confirmDelete`),cancelLabel:D(`cancel`),variant:`destructive`})){this.busySessionId=e.id,this.message=``,this.error=``,this.requestUpdate();try{await y().sessions.delete(e.id),this.sessions=this.sessions.filter(t=>t.id!==e.id),this.message=D(`archivedSessionDeleted`),V()}catch(e){this.error=e instanceof Error?e.message:D(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteAllArchivedSessions(){if(!(this.busySessionId||this.sessions.length===0)&&await C({description:D(`deleteAllArchivedSessionsConfirm`),confirmLabel:D(`confirmDelete`),cancelLabel:D(`cancel`),variant:`destructive`})){this.busySessionId=`__all__`,this.message=``,this.error=``,this.requestUpdate();try{let e=y();await Promise.all(this.sessions.map(t=>e.sessions.delete(t.id))),this.sessions=[],this.message=D(`archivedSessionsDeleted`),V()}catch(e){this.error=e instanceof Error?e.message:D(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}renderSession(e){let t=this.busySessionId===e.id||this.busySessionId===`__all__`;return _`
|
|
874
869
|
<div class="border-t border-border px-4 py-3 first:border-t-0">
|
|
875
870
|
<div class="flex items-start justify-between gap-3">
|
|
876
871
|
<div class="min-w-0">
|
|
877
|
-
<div class="truncate text-sm font-medium text-foreground">${
|
|
872
|
+
<div class="truncate text-sm font-medium text-foreground">${E(e.title)}</div>
|
|
878
873
|
<div class="mt-1 text-xs text-muted-foreground">
|
|
879
|
-
${
|
|
874
|
+
${D(`lastModified`)}: ${it(e.lastModified)} · ${D(`archivedAt`)}: ${it(e.archivedAt)}
|
|
880
875
|
</div>
|
|
881
876
|
</div>
|
|
882
877
|
<div class="flex shrink-0 items-center gap-2">
|
|
@@ -886,7 +881,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
886
881
|
?disabled=${t}
|
|
887
882
|
@click=${()=>this.restoreSession(e.id)}
|
|
888
883
|
>
|
|
889
|
-
${
|
|
884
|
+
${D(`restoreSession`)}
|
|
890
885
|
</button>
|
|
891
886
|
<button
|
|
892
887
|
class="rounded-md px-2.5 py-1 text-xs text-destructive hover:bg-destructive/10 disabled:opacity-60"
|
|
@@ -894,12 +889,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
894
889
|
?disabled=${t}
|
|
895
890
|
@click=${()=>this.deleteSession(e)}
|
|
896
891
|
>
|
|
897
|
-
${
|
|
892
|
+
${D(`deletePermanently`)}
|
|
898
893
|
</button>
|
|
899
894
|
</div>
|
|
900
895
|
</div>
|
|
901
896
|
</div>
|
|
902
|
-
`}render(){let e=this.groupedSessions();return
|
|
897
|
+
`}render(){let e=this.groupedSessions();return _`
|
|
903
898
|
<div class="flex flex-col gap-4">
|
|
904
899
|
<div class="flex justify-end">
|
|
905
900
|
<button
|
|
@@ -908,7 +903,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
908
903
|
?disabled=${!!this.busySessionId||this.sessions.length===0}
|
|
909
904
|
@click=${()=>this.deleteAllArchivedSessions()}
|
|
910
905
|
>
|
|
911
|
-
${
|
|
906
|
+
${D(`deleteAll`)}
|
|
912
907
|
</button>
|
|
913
908
|
</div>
|
|
914
909
|
|
|
@@ -918,7 +913,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
918
913
|
class="rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring/30"
|
|
919
914
|
type="search"
|
|
920
915
|
.value=${this.query}
|
|
921
|
-
placeholder=${
|
|
916
|
+
placeholder=${D(`searchArchivedConversations`)}
|
|
922
917
|
@input=${e=>{this.query=e.target.value,this.requestUpdate()}}
|
|
923
918
|
/>
|
|
924
919
|
<select
|
|
@@ -926,23 +921,23 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
926
921
|
.value=${this.projectFilter}
|
|
927
922
|
@change=${e=>{this.projectFilter=e.target.value,this.requestUpdate()}}
|
|
928
923
|
>
|
|
929
|
-
<option value="all">${
|
|
930
|
-
<option value="global">${
|
|
931
|
-
${this.projects.map(e=>
|
|
924
|
+
<option value="all">${D(`allProjects`)}</option>
|
|
925
|
+
<option value="global">${D(`normalChat`)}</option>
|
|
926
|
+
${this.projects.map(e=>_`<option value=${e.id}>${e.name}</option>`)}
|
|
932
927
|
</select>
|
|
933
928
|
</div>
|
|
934
929
|
|
|
935
|
-
${this.loading?
|
|
936
|
-
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${
|
|
937
|
-
`:e.length===0?
|
|
938
|
-
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${
|
|
939
|
-
`:
|
|
930
|
+
${this.loading?_`
|
|
931
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${D(`loading`)}</div>
|
|
932
|
+
`:e.length===0?_`
|
|
933
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${D(`noArchivedConversations`)}</div>
|
|
934
|
+
`:_`
|
|
940
935
|
<div>
|
|
941
|
-
${e.map(([e,t])=>
|
|
936
|
+
${e.map(([e,t])=>_`
|
|
942
937
|
<div class="border-b border-border last:border-b-0">
|
|
943
938
|
<div class="flex items-center justify-between gap-3 bg-muted/20 px-4 py-2 text-sm text-muted-foreground">
|
|
944
939
|
<div class="truncate">${this.projectLabel(e)}</div>
|
|
945
|
-
<div class="shrink-0">${
|
|
940
|
+
<div class="shrink-0">${D(`conversationCount`,{count:t.length})}</div>
|
|
946
941
|
</div>
|
|
947
942
|
${t.map(e=>this.renderSession(e))}
|
|
948
943
|
</div>
|
|
@@ -951,10 +946,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
951
946
|
`}
|
|
952
947
|
</section>
|
|
953
948
|
|
|
954
|
-
${this.message?
|
|
955
|
-
${this.error?
|
|
949
|
+
${this.message?_`<div class="rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300">${this.message}</div>`:null}
|
|
950
|
+
${this.error?_`<div class="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">${this.error}</div>`:null}
|
|
956
951
|
</div>
|
|
957
|
-
`}},H=`quickforge-archived-conversations-settings-tab`;customElements.get(H)||customElements.define(H,
|
|
952
|
+
`}},H=`quickforge-archived-conversations-settings-tab`;customElements.get(H)||customElements.define(H,ot);function st(){return document.createElement(H)}function ct(){return Array.from({length:16},()=>`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%^&*`[Math.floor(Math.random()*65)]).join(``)}var lt=class extends v{loading=!0;saving=!1;enabled=!1;hasPassword=!1;password=``;sessionTtlHours=12;activeTokenCount=0;lanUrls=[];error=``;message=``;getTabName(){return D(`lanAccess`)}async connectedCallback(){super.connectedCallback(),await this.loadStatus()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||D(`requestFailed`));return r}applyStatus(e){this.enabled=!!e.enabled,this.hasPassword=!!e.hasPassword,this.sessionTtlHours=Number(e.sessionTtlHours||12),this.activeTokenCount=Number(e.activeTokenCount||0),this.lanUrls=Array.isArray(e.lanUrls)?e.lanUrls:[]}async loadStatus(){this.loading=!0,this.error=``,this.requestUpdate();try{this.applyStatus(await this.request(`/api/lan-access/status`))}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}updatePassword(e){this.password=e,this.requestUpdate()}updateEnabled(e){this.enabled=e,this.requestUpdate()}updateTtl(e){this.sessionTtlHours=Number(e)||12,this.requestUpdate()}async saveSettings(){if(!this.saving){if(this.enabled&&!this.hasPassword&&!this.password.trim()){this.error=D(`lanAccessPasswordRequired`),this.requestUpdate();return}if(this.password.trim()&&this.password.trim().length<8){this.error=D(`lanAccessPasswordTooShort`),this.requestUpdate();return}if(!(this.enabled&&!await C({description:D(`lanAccessEnableConfirm`),confirmLabel:D(`enabled`),cancelLabel:D(`cancel`)}))){this.saving=!0,this.error=``,this.message=``,this.requestUpdate();try{let e=await this.request(`/api/lan-access/settings`,{method:`PUT`,body:JSON.stringify({enabled:this.enabled,password:this.password.trim()||void 0,sessionTtlHours:this.sessionTtlHours})});this.applyStatus(e),this.password=``,this.message=D(`lanAccessSaved`)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}}async revokeAll(){if(await C({description:D(`lanAccessRevokeAllConfirm`),confirmLabel:D(`lanAccessRevokeAll`),cancelLabel:D(`cancel`),variant:`destructive`})){this.saving=!0,this.error=``,this.message=``,this.requestUpdate();try{let e=await this.request(`/api/lan-access/revoke-all`,{method:`POST`});this.applyStatus(e),this.message=D(`lanAccessRevoked`)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}renderSwitch(e,t,n=!1){return _`
|
|
958
953
|
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
959
954
|
<input
|
|
960
955
|
type="checkbox"
|
|
@@ -964,48 +959,48 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
964
959
|
/>
|
|
965
960
|
<span aria-hidden="true"></span>
|
|
966
961
|
</label>
|
|
967
|
-
`}render(){return this.loading?
|
|
962
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${D(`loading`)}</div>`:_`
|
|
968
963
|
<div class="quickforge-settings-stack">
|
|
969
|
-
<div class="quickforge-settings-warning">${
|
|
964
|
+
<div class="quickforge-settings-warning">${D(`lanAccessRiskWarning`)}</div>
|
|
970
965
|
|
|
971
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
966
|
+
<section class="quickforge-settings-section" aria-label=${D(`lanAccessStatus`)}>
|
|
972
967
|
<div class="quickforge-settings-row">
|
|
973
968
|
<div class="quickforge-settings-row-main">
|
|
974
|
-
<div class="quickforge-settings-row-title">${
|
|
975
|
-
<div class="quickforge-settings-row-description">${
|
|
969
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessEnabled`)}</div>
|
|
970
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessEnabledDescription`)}</div>
|
|
976
971
|
</div>
|
|
977
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.enabled?
|
|
972
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.enabled?D(`enabled`):D(`disabled`)}</div>
|
|
978
973
|
</div>
|
|
979
974
|
<div class="quickforge-settings-row">
|
|
980
975
|
<div class="quickforge-settings-row-main">
|
|
981
|
-
<div class="quickforge-settings-row-title">${
|
|
982
|
-
<div class="quickforge-settings-row-description">${
|
|
976
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessPassword`)}</div>
|
|
977
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessPasswordStatusDescription`)}</div>
|
|
983
978
|
</div>
|
|
984
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.hasPassword?
|
|
979
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.hasPassword?D(`configured`):D(`notConfigured`)}</div>
|
|
985
980
|
</div>
|
|
986
981
|
<div class="quickforge-settings-row">
|
|
987
982
|
<div class="quickforge-settings-row-main">
|
|
988
|
-
<div class="quickforge-settings-row-title">${
|
|
989
|
-
<div class="quickforge-settings-row-description">${
|
|
983
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessActiveDevices`)}</div>
|
|
984
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessActiveDevicesDescription`)}</div>
|
|
990
985
|
</div>
|
|
991
986
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.activeTokenCount}</div>
|
|
992
987
|
</div>
|
|
993
988
|
<div class="quickforge-settings-row">
|
|
994
989
|
<div class="quickforge-settings-row-main">
|
|
995
|
-
<div class="quickforge-settings-row-title">${
|
|
996
|
-
<div class="quickforge-settings-row-description">${
|
|
990
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessUrls`)}</div>
|
|
991
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessUrlsDescription`)}</div>
|
|
997
992
|
</div>
|
|
998
993
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
999
|
-
${this.lanUrls.length?this.lanUrls.map(e=>
|
|
994
|
+
${this.lanUrls.length?this.lanUrls.map(e=>_`<div>${e}</div>`):`-`}
|
|
1000
995
|
</div>
|
|
1001
996
|
</div>
|
|
1002
997
|
</section>
|
|
1003
998
|
|
|
1004
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
999
|
+
<section class="quickforge-settings-section" aria-label=${D(`lanAccess`)}>
|
|
1005
1000
|
<div class="quickforge-settings-row">
|
|
1006
1001
|
<div class="quickforge-settings-row-main">
|
|
1007
|
-
<div class="quickforge-settings-row-title">${
|
|
1008
|
-
<div class="quickforge-settings-row-description">${
|
|
1002
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessAllowFull`)}</div>
|
|
1003
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessAllowFullDescription`)}</div>
|
|
1009
1004
|
</div>
|
|
1010
1005
|
<div class="quickforge-settings-row-control">
|
|
1011
1006
|
${this.renderSwitch(this.enabled,e=>this.updateEnabled(e),this.saving)}
|
|
@@ -1014,8 +1009,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1014
1009
|
|
|
1015
1010
|
<div class="quickforge-settings-row">
|
|
1016
1011
|
<div class="quickforge-settings-row-main">
|
|
1017
|
-
<div class="quickforge-settings-row-title">${
|
|
1018
|
-
<div class="quickforge-settings-row-description">${this.hasPassword?
|
|
1012
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessPassword`)}</div>
|
|
1013
|
+
<div class="quickforge-settings-row-description">${this.hasPassword?D(`lanAccessPasswordPlaceholderConfigured`):D(`lanAccessPasswordPlaceholder`)}</div>
|
|
1019
1014
|
</div>
|
|
1020
1015
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-lan-password-control">
|
|
1021
1016
|
<input
|
|
@@ -1023,53 +1018,53 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1023
1018
|
type="password"
|
|
1024
1019
|
.value=${this.password}
|
|
1025
1020
|
@input=${e=>this.updatePassword(e.target.value)}
|
|
1026
|
-
placeholder=${this.hasPassword?
|
|
1021
|
+
placeholder=${this.hasPassword?D(`lanAccessPasswordPlaceholderConfigured`):D(`lanAccessPasswordPlaceholder`)}
|
|
1027
1022
|
/>
|
|
1028
1023
|
<button
|
|
1029
1024
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
1030
1025
|
type="button"
|
|
1031
|
-
@click=${()=>this.updatePassword(
|
|
1026
|
+
@click=${()=>this.updatePassword(ct())}
|
|
1032
1027
|
>
|
|
1033
|
-
${
|
|
1028
|
+
${D(`generatePassword`)}
|
|
1034
1029
|
</button>
|
|
1035
1030
|
</div>
|
|
1036
1031
|
</div>
|
|
1037
1032
|
|
|
1038
1033
|
<div class="quickforge-settings-row">
|
|
1039
1034
|
<div class="quickforge-settings-row-main">
|
|
1040
|
-
<div class="quickforge-settings-row-title">${
|
|
1041
|
-
<div class="quickforge-settings-row-description">${
|
|
1035
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessSessionTtl`)}</div>
|
|
1036
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessSessionTtlDescription`)}</div>
|
|
1042
1037
|
</div>
|
|
1043
1038
|
<div class="quickforge-settings-row-control">
|
|
1044
1039
|
<select class="quickforge-settings-select" .value=${String(this.sessionTtlHours)} @change=${e=>this.updateTtl(e.target.value)}>
|
|
1045
|
-
<option value="1">1 ${
|
|
1046
|
-
<option value="12">12 ${
|
|
1047
|
-
<option value="24">24 ${
|
|
1048
|
-
<option value="168">7 ${
|
|
1040
|
+
<option value="1">1 ${D(`hour`)}</option>
|
|
1041
|
+
<option value="12">12 ${D(`hours`)}</option>
|
|
1042
|
+
<option value="24">24 ${D(`hours`)}</option>
|
|
1043
|
+
<option value="168">7 ${D(`days`)}</option>
|
|
1049
1044
|
</select>
|
|
1050
1045
|
</div>
|
|
1051
1046
|
</div>
|
|
1052
1047
|
|
|
1053
1048
|
<div class="quickforge-settings-row">
|
|
1054
1049
|
<div class="quickforge-settings-row-main">
|
|
1055
|
-
<div class="quickforge-settings-row-title">${
|
|
1056
|
-
<div class="quickforge-settings-row-description">${
|
|
1050
|
+
<div class="quickforge-settings-row-title">${D(`lanAccessActions`)}</div>
|
|
1051
|
+
<div class="quickforge-settings-row-description">${D(`lanAccessActionsDescription`)}</div>
|
|
1057
1052
|
</div>
|
|
1058
1053
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1059
1054
|
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${this.saving} @click=${()=>this.saveSettings()}>
|
|
1060
|
-
${this.saving?
|
|
1055
|
+
${this.saving?D(`saving`):D(`save`)}
|
|
1061
1056
|
</button>
|
|
1062
1057
|
<button class="quickforge-settings-button quickforge-settings-button-danger" type="button" ?disabled=${this.saving} @click=${()=>this.revokeAll()}>
|
|
1063
|
-
${
|
|
1058
|
+
${D(`lanAccessRevokeAll`)}
|
|
1064
1059
|
</button>
|
|
1065
1060
|
</div>
|
|
1066
1061
|
</div>
|
|
1067
1062
|
</section>
|
|
1068
1063
|
|
|
1069
|
-
${this.message?
|
|
1070
|
-
${this.error?
|
|
1064
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1065
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1071
1066
|
</div>
|
|
1072
|
-
`}},U=`quickforge-lan-access-settings-tab`;customElements.get(U)||customElements.define(U,
|
|
1067
|
+
`}},U=`quickforge-lan-access-settings-tab`;customElements.get(U)||customElements.define(U,lt);function ut(){return document.createElement(U)}var dt=18e4,ft=3e4,pt=1e3,mt=`https://github.com/shawnstack/quickforge/releases/latest`;function W(){if(typeof document>`u`)return!1;let e=window;return document.body.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function ht(e){return new Promise(t=>window.setTimeout(t,e))}var gt=[{value:`startup`,label:()=>D(`frequencyStartup`)},{value:`daily`,label:()=>D(`frequencyDaily`)},{value:`weekly`,label:()=>D(`frequencyWeekly`)},{value:`off`,label:()=>D(`frequencyOff`)}],_t=class extends v{about;updateInfo;loading=!0;checking=!1;updating=!1;restarting=!1;message=``;error=``;frequency=ae.frequency;lastCheckAt=null;serviceStatus;getTabName(){return D(`about`)}async connectedCallback(){super.connectedCallback(),await this.loadAbout()}async loadAbout(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/about`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||D(`requestFailed`));this.about=t;try{let[e,t]=await Promise.all([Te(y()),this.loadServiceStatus()]);this.frequency=e.frequency,this.lastCheckAt=e.lastCheckAt,this.serviceStatus=t}catch{}}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadServiceStatus(){let e=await fetch(`/api/health`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||D(`requestFailed`));return t}async checkUpdate(){if(!(this.checking||this.updating)){if(W()){window.open(mt,`_blank`,`noopener,noreferrer`),this.message=D(`desktopUpdateHint`),this.error=``,this.requestUpdate();return}this.checking=!0,this.message=``,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/update/check`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||D(`updateCheckFailed`));this.updateInfo=t,this.about=t,this.updateInfo.updateAvailable?this.message=D(`updateAvailableMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.updateInfo.localVersionIsNewer?this.message=D(`localVersionNewerMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.message=D(`alreadyLatestVersion`,{version:this.updateInfo.currentVersion})}catch(e){this.error=e instanceof Error?e.message:D(`updateCheckFailed`)}finally{this.checking=!1,this.requestUpdate()}}}async pollUntilUpdated(e){let t=Date.now();for(;Date.now()-t<dt;){await ht(pt);try{let t=await fetch(`/api/health?updatePoll=${Date.now()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(t.ok&&n?.ok&&n.bootId&&n.bootId!==e){this.message=D(`updateRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(D(`updateRestartTimeout`))}async pollUntilRestarted(e){let t=Date.now();for(;Date.now()-t<ft;){await ht(pt);try{let t=await fetch(`/api/health?restartPoll=${Date.now()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(t.ok&&n?.ok&&n.bootId&&n.bootId!==e){this.message=D(`backendRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(D(`backendRestartTimeout`))}async restartService(){if(!this.serviceStatus||this.restarting||!await C({description:D(`restartBackendConfirm`),confirmLabel:D(`restartBackendService`),cancelLabel:D(`cancel`)}))return;this.restarting=!0,this.message=D(`backendRestarting`),this.error=``,this.requestUpdate();let e=this.serviceStatus.bootId;try{let t=await fetch(`/api/system/restart`,{method:`POST`,headers:{"x-quickforge-action":`restart`}}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||D(`backendRestartFailed`));await this.pollUntilRestarted(e)}catch(e){this.error=e instanceof Error?e.message:D(`backendRestartFailed`),this.message=``,this.restarting=!1,this.requestUpdate()}}async updateQuickForge(){if(W()){window.open(mt,`_blank`,`noopener,noreferrer`),this.message=D(`desktopUpdateHint`),this.error=``,this.requestUpdate();return}if(!(!this.updateInfo?.updateAvailable||this.updating)&&await C({description:D(`updateConfirm`,{command:this.updateInfo.installCommand}),confirmLabel:D(`updateRuntimeNow`),cancelLabel:D(`cancel`)})){this.updating=!0,this.message=D(`updatingQuickForge`),this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/update`,{method:`POST`,headers:{"x-quickforge-action":`update`}}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||D(`updateFailed`));if(this.updateInfo=t,t?.updateStarted){let e=t.logFile?` ${D(`updateLogFile`,{path:t.logFile})}`:``;this.message=`${D(`updateStarted`)}${e}`,this.requestUpdate(),await this.pollUntilUpdated(t.bootId)}else this.message=t?.updated?D(`updateCompleted`):D(`alreadyLatestVersion`,{version:t?.currentVersion||this.about?.version||`-`}),this.updating=!1}catch(e){this.error=e instanceof Error?e.message:D(`updateFailed`),this.message=``,this.updating=!1}finally{this.requestUpdate()}}}async selectFrequency(e){if(this.frequency!==e){this.frequency=e,this.requestUpdate();try{let t=y();await me(t,{...await Te(t),frequency:e}),this.error=``}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.requestUpdate()}}}renderFrequencyOption(e){let t=this.frequency===e.value;return _`
|
|
1073
1068
|
<button
|
|
1074
1069
|
type="button"
|
|
1075
1070
|
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
@@ -1078,25 +1073,25 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1078
1073
|
>
|
|
1079
1074
|
${e.label()}
|
|
1080
1075
|
</button>
|
|
1081
|
-
`}infoRows(){let e=this.about;return e?
|
|
1076
|
+
`}infoRows(){let e=this.about;return e?_`
|
|
1082
1077
|
<div class="quickforge-settings-row">
|
|
1083
1078
|
<div class="quickforge-settings-row-main">
|
|
1084
|
-
<div class="quickforge-settings-row-title">${
|
|
1085
|
-
<div class="quickforge-settings-row-description">${
|
|
1079
|
+
<div class="quickforge-settings-row-title">${D(`packageName`)}</div>
|
|
1080
|
+
<div class="quickforge-settings-row-description">${D(`packageNameDescription`)}</div>
|
|
1086
1081
|
</div>
|
|
1087
1082
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.name}</div>
|
|
1088
1083
|
</div>
|
|
1089
1084
|
<div class="quickforge-settings-row">
|
|
1090
1085
|
<div class="quickforge-settings-row-main">
|
|
1091
|
-
<div class="quickforge-settings-row-title">${
|
|
1092
|
-
<div class="quickforge-settings-row-description">${
|
|
1086
|
+
<div class="quickforge-settings-row-title">${D(`currentVersion`)}</div>
|
|
1087
|
+
<div class="quickforge-settings-row-description">${D(`currentVersionDescription`)}</div>
|
|
1093
1088
|
</div>
|
|
1094
1089
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version}</div>
|
|
1095
1090
|
</div>
|
|
1096
1091
|
<div class="quickforge-settings-row">
|
|
1097
1092
|
<div class="quickforge-settings-row-main">
|
|
1098
|
-
<div class="quickforge-settings-row-title">${
|
|
1099
|
-
<div class="quickforge-settings-row-description">${
|
|
1093
|
+
<div class="quickforge-settings-row-title">${D(`github`)}</div>
|
|
1094
|
+
<div class="quickforge-settings-row-description">${D(`githubDescription`)}</div>
|
|
1100
1095
|
</div>
|
|
1101
1096
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1102
1097
|
<a class="quickforge-settings-link" href=${e.repositoryUrl} target="_blank" rel="noreferrer">
|
|
@@ -1104,35 +1099,35 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1104
1099
|
</a>
|
|
1105
1100
|
</div>
|
|
1106
1101
|
</div>
|
|
1107
|
-
`:null}updateStatus(){return this.updateInfo?
|
|
1102
|
+
`:null}updateStatus(){return this.updateInfo?_`
|
|
1108
1103
|
<div class="quickforge-settings-row">
|
|
1109
1104
|
<div class="quickforge-settings-row-main">
|
|
1110
|
-
<div class="quickforge-settings-row-title">${
|
|
1111
|
-
<div class="quickforge-settings-row-description">${
|
|
1105
|
+
<div class="quickforge-settings-row-title">${D(`latestVersion`)}</div>
|
|
1106
|
+
<div class="quickforge-settings-row-description">${D(`latestVersionDescription`)}</div>
|
|
1112
1107
|
</div>
|
|
1113
1108
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.updateInfo.latestVersion}</div>
|
|
1114
1109
|
</div>
|
|
1115
|
-
${this.updateInfo.logFile?
|
|
1110
|
+
${this.updateInfo.logFile?_`
|
|
1116
1111
|
<div class="quickforge-settings-row">
|
|
1117
1112
|
<div class="quickforge-settings-row-main">
|
|
1118
|
-
<div class="quickforge-settings-row-title">${
|
|
1119
|
-
<div class="quickforge-settings-row-description">${
|
|
1113
|
+
<div class="quickforge-settings-row-title">${D(`updateLog`)}</div>
|
|
1114
|
+
<div class="quickforge-settings-row-description">${D(`updateLogDescription`)}</div>
|
|
1120
1115
|
</div>
|
|
1121
1116
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1122
1117
|
<code>${this.updateInfo.logFile}</code>
|
|
1123
1118
|
</div>
|
|
1124
1119
|
</div>
|
|
1125
1120
|
`:null}
|
|
1126
|
-
`:null}restartSection(){let e=this.serviceStatus?.restartUnsupportedReason||
|
|
1127
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1121
|
+
`:null}restartSection(){let e=this.serviceStatus?.restartUnsupportedReason||D(`backendRestartUnsupported`),t=this.restarting||!this.serviceStatus?.restartSupported;return _`
|
|
1122
|
+
<section class="quickforge-settings-section" aria-label=${D(`restartBackendService`)}>
|
|
1128
1123
|
<div class="quickforge-settings-row">
|
|
1129
1124
|
<div class="quickforge-settings-row-main">
|
|
1130
1125
|
<div class="quickforge-settings-row-title">
|
|
1131
|
-
${
|
|
1132
|
-
<quickforge-info-tip .label=${
|
|
1126
|
+
${D(`restartBackendService`)}
|
|
1127
|
+
<quickforge-info-tip .label=${D(`restartBackendServiceDescription`)}></quickforge-info-tip>
|
|
1133
1128
|
</div>
|
|
1134
1129
|
<div class="quickforge-settings-row-description">
|
|
1135
|
-
${this.serviceStatus?.restartSupported?
|
|
1130
|
+
${this.serviceStatus?.restartSupported?D(`restartBackendServiceDescription`):e}
|
|
1136
1131
|
</div>
|
|
1137
1132
|
</div>
|
|
1138
1133
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1142,32 +1137,32 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1142
1137
|
?disabled=${t}
|
|
1143
1138
|
@click=${()=>this.restartService()}
|
|
1144
1139
|
>
|
|
1145
|
-
${this.restarting?
|
|
1140
|
+
${this.restarting?D(`backendRestarting`):D(`restartBackendService`)}
|
|
1146
1141
|
</button>
|
|
1147
1142
|
</div>
|
|
1148
1143
|
</div>
|
|
1149
1144
|
</section>
|
|
1150
|
-
`}render(){if(this.loading)return
|
|
1145
|
+
`}render(){if(this.loading)return _`<div class="text-sm text-muted-foreground">${D(`loading`)}</div>`;let e=this.checking||this.updating||!this.updateInfo?.updateAvailable,t=W();return _`
|
|
1151
1146
|
<div class="quickforge-settings-stack">
|
|
1152
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1147
|
+
<section class="quickforge-settings-section" aria-label=${D(`projectInfo`)}>
|
|
1153
1148
|
${this.infoRows()}
|
|
1154
1149
|
</section>
|
|
1155
1150
|
|
|
1156
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1157
|
-
${t?null:
|
|
1151
|
+
<section class="quickforge-settings-section" aria-label=${D(t?`desktopUpdates`:`runtimeUpdates`)}>
|
|
1152
|
+
${t?null:_`
|
|
1158
1153
|
<div class="quickforge-settings-row">
|
|
1159
1154
|
<div class="quickforge-settings-row-main">
|
|
1160
1155
|
<div class="quickforge-settings-row-title">
|
|
1161
|
-
${
|
|
1162
|
-
<quickforge-info-tip .label=${
|
|
1156
|
+
${D(`updateFrequencySection`)}
|
|
1157
|
+
<quickforge-info-tip .label=${D(`updateFrequencyDescription`)}></quickforge-info-tip>
|
|
1163
1158
|
</div>
|
|
1164
1159
|
<div class="quickforge-settings-row-description">
|
|
1165
|
-
${this.lastCheckAt?
|
|
1160
|
+
${this.lastCheckAt?D(`lastCheckedAt`,{time:new Date(this.lastCheckAt).toLocaleString(ye())}):D(`lastCheckedNever`)}
|
|
1166
1161
|
</div>
|
|
1167
1162
|
</div>
|
|
1168
1163
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1169
|
-
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${
|
|
1170
|
-
${
|
|
1164
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${D(`updateFrequencySection`)}>
|
|
1165
|
+
${gt.map(e=>this.renderFrequencyOption(e))}
|
|
1171
1166
|
</div>
|
|
1172
1167
|
</div>
|
|
1173
1168
|
</div>
|
|
@@ -1178,11 +1173,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1178
1173
|
<div class="quickforge-settings-row">
|
|
1179
1174
|
<div class="quickforge-settings-row-main">
|
|
1180
1175
|
<div class="quickforge-settings-row-title">
|
|
1181
|
-
${
|
|
1182
|
-
<quickforge-info-tip .label=${
|
|
1176
|
+
${D(t?`desktopUpdates`:`runtimeUpdates`)}
|
|
1177
|
+
<quickforge-info-tip .label=${D(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}></quickforge-info-tip>
|
|
1183
1178
|
</div>
|
|
1184
1179
|
<div class="quickforge-settings-row-description">
|
|
1185
|
-
${
|
|
1180
|
+
${D(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}
|
|
1186
1181
|
</div>
|
|
1187
1182
|
</div>
|
|
1188
1183
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1192,16 +1187,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1192
1187
|
?disabled=${this.checking||this.updating}
|
|
1193
1188
|
@click=${()=>this.checkUpdate()}
|
|
1194
1189
|
>
|
|
1195
|
-
${this.checking?
|
|
1190
|
+
${this.checking?D(`checkingUpdate`):D(t?`openDesktopReleases`:`checkRuntimeUpdate`)}
|
|
1196
1191
|
</button>
|
|
1197
|
-
${t?null:
|
|
1192
|
+
${t?null:_`
|
|
1198
1193
|
<button
|
|
1199
1194
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
1200
1195
|
type="button"
|
|
1201
1196
|
?disabled=${e}
|
|
1202
1197
|
@click=${()=>this.updateQuickForge()}
|
|
1203
1198
|
>
|
|
1204
|
-
${this.updating?
|
|
1199
|
+
${this.updating?D(`updatingQuickForge`):D(`updateRuntimeNow`)}
|
|
1205
1200
|
</button>
|
|
1206
1201
|
`}
|
|
1207
1202
|
</div>
|
|
@@ -1210,22 +1205,22 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1210
1205
|
|
|
1211
1206
|
${this.restartSection()}
|
|
1212
1207
|
|
|
1213
|
-
${this.message?
|
|
1214
|
-
${this.error?
|
|
1208
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1209
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1215
1210
|
</div>
|
|
1216
|
-
`}},G=`quickforge-about-settings-tab`;customElements.get(G)||customElements.define(G,
|
|
1211
|
+
`}},G=`quickforge-about-settings-tab`;customElements.get(G)||customElements.define(G,_t);function vt(){return document.createElement(G)}var yt=class extends v{loading=!0;saving=!1;saved=!1;error=``;message=``;projects=[];project;commandDir=``;commands=[];loadingCommands=!1;saveTimer=null;lastSavedCommandDir=``;pendingSaveAfterCurrent=!1;getTabName(){return D(`projectCommands`)}async connectedCallback(){super.connectedCallback(),await this.loadProjects()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||D(`requestFailed`));return r}async loadProjects(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await this.request(`/api/project`);this.projects=e?.projects??(e?.project?[e.project]:[]),this.project=e?.project??this.projects[0],this.commandDir=typeof this.project?.commandDir==`string`?this.project.commandDir:``,this.lastSavedCommandDir=this.commandDir,await this.loadCommands()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}selectProject(e){this.clearSaveTimer();let t=e.target,n=this.projects.find(e=>e.id===t.value);n&&(this.project=n,this.commandDir=typeof n.commandDir==`string`?n.commandDir:``,this.lastSavedCommandDir=this.commandDir,this.saved=!1,this.message=``,this.error=``,this.commands=[],this.requestUpdate(),this.loadCommands())}async loadCommands(){if(this.project?.id){this.loadingCommands=!0,this.requestUpdate();try{let e=await this.request(`/api/project/commands?projectId=${encodeURIComponent(this.project.id)}`);this.commands=e?.commands??[]}catch{this.commands=[]}finally{this.loadingCommands=!1,this.requestUpdate()}}}updateCommandDir(e){this.commandDir=e,this.saved=!1,this.message=``,this.scheduleSave(),this.requestUpdate()}clearSaveTimer(){this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null)}scheduleSave(){this.clearSaveTimer(),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.save()},800)}disconnectedCallback(){this.clearSaveTimer(),super.disconnectedCallback()}async save(){if(!this.project)return;if(this.saving){this.pendingSaveAfterCurrent=!0;return}let e=this.project.id,t=this.commandDir;if(t!==this.lastSavedCommandDir){this.saving=!0,this.saved=!1,this.error=``,this.message=``,this.requestUpdate();try{let n=await this.request(`/api/project/${encodeURIComponent(e)}/command-dir`,{method:`PUT`,body:JSON.stringify({commandDir:t})});if(this.project?.id===e){if(this.project=n?.project??this.project,this.project){let e=this.projects.findIndex(e=>e.id===this.project.id);e>=0&&(this.projects[e]=this.project)}this.commandDir=typeof this.project?.commandDir==`string`?this.project.commandDir:t,this.lastSavedCommandDir=this.commandDir,this.saved=!0,await this.loadCommands()}}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.saving=!1,this.pendingSaveAfterCurrent&&(this.pendingSaveAfterCurrent=!1,this.scheduleSave()),this.requestUpdate()}}}async openCommandDir(){if(this.project){this.error=``,this.message=``,this.requestUpdate();try{await this.request(`/api/project/open-path`,{method:`POST`,body:JSON.stringify({path:`.ai/commands`,projectId:this.project.id})})}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`),this.requestUpdate()}}}async createCommand(){if(!this.project)return;let e=window.prompt(D(`newCommandPrompt`));if(e?.trim()){this.error=``,this.message=``,this.requestUpdate();try{let t=await this.request(`/api/project/command`,{method:`POST`,body:JSON.stringify({name:e.trim(),projectId:this.project.id})});t.ok?(this.message=D(`commandCreated`,{name:t.name??e.trim()}),await this.loadCommands()):t.reason===`exists`?this.error=D(`commandAlreadyExists`,{name:t.name??e.trim()}):this.error=D(`invalidCommandName`)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.requestUpdate()}}}render(){return this.loading?_`<div class="quickforge-settings-note">${D(`loading`)}</div>`:this.projects.length===0?_`
|
|
1217
1212
|
<div class="quickforge-settings-stack">
|
|
1218
|
-
<div class="quickforge-settings-note">${
|
|
1219
|
-
${this.error?
|
|
1213
|
+
<div class="quickforge-settings-note">${D(`selectProjectForCommands`)}</div>
|
|
1214
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1220
1215
|
</div>
|
|
1221
|
-
`:
|
|
1216
|
+
`:_`
|
|
1222
1217
|
<div class="quickforge-settings-stack">
|
|
1223
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1218
|
+
<section class="quickforge-settings-section" aria-label=${D(`projectCommands`)}>
|
|
1224
1219
|
<div class="quickforge-settings-row">
|
|
1225
1220
|
<div class="quickforge-settings-row-main">
|
|
1226
|
-
<div class="quickforge-settings-row-title">${
|
|
1221
|
+
<div class="quickforge-settings-row-title">${D(`project`)}</div>
|
|
1227
1222
|
<div class="quickforge-settings-row-description">
|
|
1228
|
-
${this.project?.path?this.project.path:
|
|
1223
|
+
${this.project?.path?this.project.path:D(`projectCommandsProjectDescription`)}
|
|
1229
1224
|
</div>
|
|
1230
1225
|
</div>
|
|
1231
1226
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1234,7 +1229,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1234
1229
|
.value=${this.project?.id??``}
|
|
1235
1230
|
@change=${e=>this.selectProject(e)}
|
|
1236
1231
|
>
|
|
1237
|
-
${this.projects.map(e=>
|
|
1232
|
+
${this.projects.map(e=>_`<option value=${e.id} ?selected=${e.id===this.project?.id}>${e.name}</option>`)}
|
|
1238
1233
|
</select>
|
|
1239
1234
|
</div>
|
|
1240
1235
|
</div>
|
|
@@ -1242,16 +1237,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1242
1237
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1243
1238
|
<div class="quickforge-settings-row-main">
|
|
1244
1239
|
<div class="quickforge-settings-row-title">
|
|
1245
|
-
${
|
|
1246
|
-
<quickforge-info-tip .label=${
|
|
1240
|
+
${D(`commandDirectories`)}
|
|
1241
|
+
<quickforge-info-tip .label=${D(`commandDirectoryHelp`)}></quickforge-info-tip>
|
|
1247
1242
|
</div>
|
|
1248
|
-
<div class="quickforge-settings-row-description">${
|
|
1243
|
+
<div class="quickforge-settings-row-description">${D(`commandDirectoriesDescription`)}</div>
|
|
1249
1244
|
</div>
|
|
1250
1245
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1251
1246
|
<textarea
|
|
1252
1247
|
class="quickforge-settings-textarea quickforge-settings-mono"
|
|
1253
1248
|
.value=${this.commandDir}
|
|
1254
|
-
placeholder=${
|
|
1249
|
+
placeholder=${D(`commandDirectoryPlaceholder`)}
|
|
1255
1250
|
@input=${e=>this.updateCommandDir(e.target.value)}
|
|
1256
1251
|
></textarea>
|
|
1257
1252
|
</div>
|
|
@@ -1259,8 +1254,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1259
1254
|
|
|
1260
1255
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1261
1256
|
<div class="quickforge-settings-row-main">
|
|
1262
|
-
<div class="quickforge-settings-row-title">${
|
|
1263
|
-
<div class="quickforge-settings-row-description">${
|
|
1257
|
+
<div class="quickforge-settings-row-title">${D(`commandDirectoryExamples`)}</div>
|
|
1258
|
+
<div class="quickforge-settings-row-description">${D(`commandDirectoryExamplesDescription`)}</div>
|
|
1264
1259
|
</div>
|
|
1265
1260
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-code-list">
|
|
1266
1261
|
<code>.ai/commands</code>
|
|
@@ -1271,11 +1266,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1271
1266
|
</div>
|
|
1272
1267
|
</section>
|
|
1273
1268
|
|
|
1274
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1269
|
+
<section class="quickforge-settings-section" aria-label=${D(`loadedCommands`,{count:this.commands.length})}>
|
|
1275
1270
|
<div class="quickforge-settings-row">
|
|
1276
1271
|
<div class="quickforge-settings-row-main">
|
|
1277
|
-
<div class="quickforge-settings-row-title">${
|
|
1278
|
-
<div class="quickforge-settings-row-description">${
|
|
1272
|
+
<div class="quickforge-settings-row-title">${D(`loadedCommands`,{count:this.commands.length})}</div>
|
|
1273
|
+
<div class="quickforge-settings-row-description">${D(`loadedCommandsDescription`)}</div>
|
|
1279
1274
|
</div>
|
|
1280
1275
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1281
1276
|
<button
|
|
@@ -1284,7 +1279,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1284
1279
|
?disabled=${this.loadingCommands}
|
|
1285
1280
|
@click=${()=>this.openCommandDir()}
|
|
1286
1281
|
>
|
|
1287
|
-
${
|
|
1282
|
+
${D(`openCommandDir`)}
|
|
1288
1283
|
</button>
|
|
1289
1284
|
<button
|
|
1290
1285
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
@@ -1292,41 +1287,41 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1292
1287
|
?disabled=${this.loadingCommands}
|
|
1293
1288
|
@click=${()=>this.createCommand()}
|
|
1294
1289
|
>
|
|
1295
|
-
${
|
|
1290
|
+
${D(`createCommand`)}
|
|
1296
1291
|
</button>
|
|
1297
1292
|
</div>
|
|
1298
1293
|
</div>
|
|
1299
1294
|
|
|
1300
1295
|
<div class="quickforge-settings-nested-list">
|
|
1301
|
-
${this.loadingCommands?
|
|
1296
|
+
${this.loadingCommands?_`<div class="quickforge-settings-empty-row">${D(`loading`)}</div>`:this.commands.length===0?_`<div class="quickforge-settings-empty-row">${D(`noCommandsLoaded`)}</div>`:this.commands.map(e=>{let t=e.argumentHint?` ${e.argumentHint}`:``;return _`
|
|
1302
1297
|
<div class="quickforge-settings-subrow">
|
|
1303
1298
|
<div class="quickforge-settings-row-main">
|
|
1304
1299
|
<div class="quickforge-settings-row-title">
|
|
1305
1300
|
<code class="quickforge-settings-command-name">/${e.name}${t}</code>
|
|
1306
1301
|
</div>
|
|
1307
1302
|
<div class="quickforge-settings-row-description">
|
|
1308
|
-
${e.description||
|
|
1303
|
+
${e.description||D(`noDescription`)}
|
|
1309
1304
|
</div>
|
|
1310
1305
|
</div>
|
|
1311
|
-
${e.relativePath?
|
|
1306
|
+
${e.relativePath?_`<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">${e.relativePath}</div>`:null}
|
|
1312
1307
|
</div>
|
|
1313
1308
|
`})}
|
|
1314
1309
|
</div>
|
|
1315
1310
|
</section>
|
|
1316
1311
|
|
|
1317
|
-
${this.saving?
|
|
1318
|
-
${this.saved?
|
|
1319
|
-
${this.message?
|
|
1320
|
-
${this.error?
|
|
1312
|
+
${this.saving?_`<div class="quickforge-settings-note">${D(`saving`)}</div>`:null}
|
|
1313
|
+
${this.saved?_`<div class="quickforge-settings-message">${D(`projectCommandsSaved`)}</div>`:null}
|
|
1314
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1315
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1321
1316
|
</div>
|
|
1322
|
-
`}},K=`quickforge-project-commands-settings-tab`;customElements.get(K)||customElements.define(K,
|
|
1317
|
+
`}},K=`quickforge-project-commands-settings-tab`;customElements.get(K)||customElements.define(K,yt);function bt(){return document.createElement(K)}var q={"x-quickforge-action":`channel-action`};function xt(e){switch(e){case`running`:return`quickforge-settings-badge-success`;case`waiting_scan`:case`starting`:case`stopping`:return`quickforge-settings-badge-warning`;case`error`:return`quickforge-settings-badge-danger`;default:return`quickforge-settings-badge-muted`}}function St(e){switch(e){case`starting`:return D(`channelStatusStarting`);case`waiting_scan`:return D(`channelStatusWaitingScan`);case`running`:return D(`channelStatusRunning`);case`stopping`:return D(`channelStatusStopping`);case`error`:return D(`channelStatusError`);default:return D(`channelStatusStopped`)}}function Ct(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}var wt=class extends v{loading=!0;channels=[];workspaces=[];selectedWorkspaceIdByChannel={};error=``;message=``;eventSource;busyChannelId=``;getTabName(){return D(`channels`)}async connectedCallback(){super.connectedCallback(),await Promise.all([this.loadChannels(),this.loadWorkspaces()]),this.connectEvents()}disconnectedCallback(){this.eventSource?.close(),this.eventSource=void 0,super.disconnectedCallback()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.headers||{}}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||D(`requestFailed`));return r}async loadChannels(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await this.request(`/api/channels`);this.channels=Array.isArray(e.channels)?e.channels:[],this.ensureWorkspaceSelections()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadWorkspaces(){try{let e=await this.request(`/api/project`),t=e.defaultWorkspaceRoot||``,n=t?[{id:`default`,name:D(`channelDefaultWorkspace`),path:t,kind:`default`}]:[],r=(Array.isArray(e.projects)?e.projects:[]).map(e=>({id:e.id,name:e.name,path:e.path,kind:`project`}));this.workspaces=[...n,...r],this.ensureWorkspaceSelections()}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.requestUpdate()}}ensureWorkspaceSelections(){let e=new Set(this.workspaces.map(e=>e.id)),t={...this.selectedWorkspaceIdByChannel};for(let n of this.channels){if(!n.supportsWorkspaceSelection)continue;let r=t[n.id],i=n.launchWorkspace?.id,a=n.status!==`stopped`&&n.status!==`error`;if(i&&e.has(i)&&a){t[n.id]=i;continue}r&&e.has(r)||(t[n.id]=i&&e.has(i)?i:`default`)}this.selectedWorkspaceIdByChannel=t}connectEvents(){this.eventSource?.close();let e=new EventSource(`/api/channels/events`);this.eventSource=e;let t=e=>{try{let t=JSON.parse(e.data);this.applyChannelEvent(t)}catch{}};e.addEventListener(`snapshot`,t),e.addEventListener(`status`,t),e.addEventListener(`log`,t),e.addEventListener(`qrcode`,t),e.addEventListener(`error`,()=>{})}applyChannelEvent(e){if(Array.isArray(e.channels)){this.channels=e.channels,this.ensureWorkspaceSelections(),this.requestUpdate();return}if(e.snapshot){this.upsertChannel(e.snapshot);return}if(e.channelId&&e.log){let t=this.channels.find(t=>t.id===e.channelId);t&&(t.logs=[...t.logs||[],e.log].slice(-300),this.requestUpdate())}}upsertChannel(e){let t=this.channels.findIndex(t=>t.id===e.id);t>=0?this.channels=[...this.channels.slice(0,t),e,...this.channels.slice(t+1)]:this.channels=[...this.channels,e],this.ensureWorkspaceSelections(),this.requestUpdate()}selectedWorkspaceId(e){return this.selectedWorkspaceIdByChannel[e.id]||e.launchWorkspace?.id||`default`}handleWorkspaceChange(e,t){let n=t.currentTarget;n&&(this.selectedWorkspaceIdByChannel={...this.selectedWorkspaceIdByChannel,[e.id]:n.value||`default`},this.requestUpdate())}startOptions(e){return e.supportsWorkspaceSelection?{projectId:this.selectedWorkspaceId(e)}:void 0}async invoke(e,t){if(!this.busyChannelId&&!(t===`restart`&&!await C({description:D(`channelRestartConfirm`,{name:e.name}),confirmLabel:D(`restart`),cancelLabel:D(`cancel`)}))){this.busyChannelId=e.id,this.error=``,this.message=``,this.requestUpdate();try{let n=t===`start`||t===`restart`?this.startOptions(e):void 0,r=await this.request(`/api/channels/${encodeURIComponent(e.id)}/${t}`,{method:`POST`,headers:n?{...q,"content-type":`application/json`}:q,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}async invokeAction(e,t){if(!this.busyChannelId&&!((t.destructive||t.id===`relogin`)&&!await C({description:t.id===`relogin`?D(`channelReloginConfirm`,{name:e.name}):D(`channelLogoutConfirm`,{name:e.name}),confirmLabel:t.label,cancelLabel:D(`cancel`),variant:t.destructive?`destructive`:void 0}))){this.busyChannelId=e.id,this.error=``,this.message=``,this.requestUpdate();try{let n=t.id===`relogin`?this.startOptions(e):void 0,r=await this.request(`/api/channels/${encodeURIComponent(e.id)}/actions/${encodeURIComponent(t.id)}`,{method:`POST`,headers:n?{...q,"content-type":`application/json`}:q,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:D(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}workspaceSection(e,t){if(!e.supportsWorkspaceSelection)return null;let n=this.selectedWorkspaceId(e),r=e.launchWorkspace;return _`
|
|
1323
1318
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1324
1319
|
<div class="quickforge-settings-row-main">
|
|
1325
1320
|
<div class="quickforge-settings-row-title">
|
|
1326
|
-
${
|
|
1327
|
-
<quickforge-info-tip .label=${
|
|
1321
|
+
${D(`channelWorkspace`)}
|
|
1322
|
+
<quickforge-info-tip .label=${D(`channelWorkspaceDescription`)}></quickforge-info-tip>
|
|
1328
1323
|
</div>
|
|
1329
|
-
${r?
|
|
1324
|
+
${r?_`<div class="quickforge-settings-row-description">${D(`channelCurrentWorkspace`)}: <span class="quickforge-settings-mono">${r.path}</span></div>`:_`<div class="quickforge-settings-row-description">${D(`channelWorkspaceDescription`)}</div>`}
|
|
1330
1325
|
</div>
|
|
1331
1326
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1332
1327
|
<select
|
|
@@ -1335,89 +1330,89 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Ft as t,H as n,It as r
|
|
|
1335
1330
|
.value=${n}
|
|
1336
1331
|
@change=${t=>this.handleWorkspaceChange(e,t)}
|
|
1337
1332
|
>
|
|
1338
|
-
${this.workspaces.map(e=>
|
|
1339
|
-
<option value=${e.id}>${e.kind===`default`?
|
|
1333
|
+
${this.workspaces.map(e=>_`
|
|
1334
|
+
<option value=${e.id}>${e.kind===`default`?D(`channelDefaultWorkspace`):e.name} — ${e.path}</option>
|
|
1340
1335
|
`)}
|
|
1341
1336
|
</select>
|
|
1342
1337
|
</div>
|
|
1343
1338
|
</div>
|
|
1344
|
-
`}channelMeta(e){return
|
|
1339
|
+
`}channelMeta(e){return _`
|
|
1345
1340
|
<div class="quickforge-settings-nested-list">
|
|
1346
|
-
${[[
|
|
1341
|
+
${[[D(`channelProvider`),e.provider||`-`],[D(`channelCommand`),e.commandLabel||`-`],[D(`channelPid`),e.pid?String(e.pid):`-`],[D(`channelStartedAt`),Ct(e.startedAt)]].map(([e,t])=>_`
|
|
1347
1342
|
<div class="quickforge-settings-subrow">
|
|
1348
1343
|
<div class="quickforge-settings-row-main">
|
|
1349
1344
|
<div class="quickforge-settings-row-title">${e}</div>
|
|
1350
1345
|
</div>
|
|
1351
|
-
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value ${e===
|
|
1346
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value ${e===D(`channelCommand`)?`quickforge-settings-mono`:``}">${t}</div>
|
|
1352
1347
|
</div>
|
|
1353
1348
|
`)}
|
|
1354
1349
|
</div>
|
|
1355
|
-
`}qrSection(e){return!e.qrCodeText&&!e.qrCodeUrl&&e.status!==`waiting_scan`?null:
|
|
1350
|
+
`}qrSection(e){return!e.qrCodeText&&!e.qrCodeUrl&&e.status!==`waiting_scan`?null:_`
|
|
1356
1351
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1357
1352
|
<div class="quickforge-settings-row-main">
|
|
1358
1353
|
<div class="quickforge-settings-row-title">
|
|
1359
|
-
${
|
|
1360
|
-
<quickforge-info-tip .label=${
|
|
1354
|
+
${D(`channelQrTitle`)}
|
|
1355
|
+
<quickforge-info-tip .label=${D(`channelQrDescription`)}></quickforge-info-tip>
|
|
1361
1356
|
</div>
|
|
1362
|
-
<div class="quickforge-settings-row-description">${
|
|
1363
|
-
${e.qrCodeUrl?
|
|
1357
|
+
<div class="quickforge-settings-row-description">${D(`channelQrDescription`)}</div>
|
|
1358
|
+
${e.qrCodeUrl?_`
|
|
1364
1359
|
<div class="quickforge-settings-meta">
|
|
1365
1360
|
<a class="quickforge-settings-link quickforge-settings-mono" href=${e.qrCodeUrl} target="_blank" rel="noreferrer">${e.qrCodeUrl}</a>
|
|
1366
1361
|
</div>
|
|
1367
1362
|
`:null}
|
|
1368
1363
|
</div>
|
|
1369
|
-
${e.qrCodeText?
|
|
1364
|
+
${e.qrCodeText?_`<pre class="quickforge-channel-qr-text">${e.qrCodeText}</pre>`:null}
|
|
1370
1365
|
</div>
|
|
1371
|
-
`}logsSection(e){let t=e.logs||[];return
|
|
1366
|
+
`}logsSection(e){let t=e.logs||[];return _`
|
|
1372
1367
|
<details class="quickforge-channel-logs" open>
|
|
1373
|
-
<summary class="quickforge-channel-logs-summary">${
|
|
1368
|
+
<summary class="quickforge-channel-logs-summary">${D(`channelRecentLogs`)}</summary>
|
|
1374
1369
|
<div class="quickforge-channel-logs-body">
|
|
1375
|
-
${t.length?t.slice(-80).map(e=>
|
|
1370
|
+
${t.length?t.slice(-80).map(e=>_`
|
|
1376
1371
|
<div class="quickforge-channel-log-row">
|
|
1377
1372
|
<span class="text-muted-foreground/55">${new Date(e.time).toLocaleTimeString()}</span>
|
|
1378
1373
|
<span class=${e.stream===`stderr`?`text-destructive/80`:`text-muted-foreground/70`}>${e.stream}</span>
|
|
1379
1374
|
<span class="min-w-0 whitespace-pre-wrap break-words text-foreground/85">${e.text}</span>
|
|
1380
1375
|
</div>
|
|
1381
|
-
`):
|
|
1376
|
+
`):_`<div class="quickforge-settings-empty-row">${D(`channelNoLogs`)}</div>`}
|
|
1382
1377
|
</div>
|
|
1383
1378
|
</details>
|
|
1384
|
-
`}channelCard(e){let t=this.busyChannelId===e.id||!!e.activeAction,n=e.status===`running`||e.status===`waiting_scan`||e.status===`starting`,r=e.status===`stopping`,i=!!(e.supportsWorkspaceSelection&&this.workspaces.length===0);return
|
|
1379
|
+
`}channelCard(e){let t=this.busyChannelId===e.id||!!e.activeAction,n=e.status===`running`||e.status===`waiting_scan`||e.status===`starting`,r=e.status===`stopping`,i=!!(e.supportsWorkspaceSelection&&this.workspaces.length===0);return _`
|
|
1385
1380
|
<section class="quickforge-settings-section" aria-label=${e.name}>
|
|
1386
1381
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
1387
1382
|
<div class="quickforge-settings-row-main">
|
|
1388
1383
|
<div class="quickforge-settings-row-title">
|
|
1389
1384
|
${e.name}
|
|
1390
|
-
<span class="quickforge-settings-badge ${
|
|
1385
|
+
<span class="quickforge-settings-badge ${xt(e.status)}">${St(e.status)}</span>
|
|
1391
1386
|
</div>
|
|
1392
1387
|
<div class="quickforge-settings-row-description">${e.description}</div>
|
|
1393
|
-
${e.requirements?.length?
|
|
1388
|
+
${e.requirements?.length?_`<div class="quickforge-settings-row-description">${D(`channelRequirements`)}: ${e.requirements.join(` · `)}</div>`:null}
|
|
1394
1389
|
</div>
|
|
1395
1390
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1396
|
-
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${t||n||r||i} @click=${()=>this.invoke(e,`start`)}>${
|
|
1397
|
-
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||!n||r} @click=${()=>this.invoke(e,`stop`)}>${
|
|
1398
|
-
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||r||i} @click=${()=>this.invoke(e,`restart`)}>${
|
|
1399
|
-
${e.actions?.map(n=>
|
|
1391
|
+
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${t||n||r||i} @click=${()=>this.invoke(e,`start`)}>${D(`start`)}</button>
|
|
1392
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||!n||r} @click=${()=>this.invoke(e,`stop`)}>${D(`stop`)}</button>
|
|
1393
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||r||i} @click=${()=>this.invoke(e,`restart`)}>${D(`restart`)}</button>
|
|
1394
|
+
${e.actions?.map(n=>_`
|
|
1400
1395
|
<button class="quickforge-settings-button ${n.destructive?`quickforge-settings-button-danger`:`quickforge-settings-button-secondary`}" type="button" ?disabled=${t} @click=${()=>this.invokeAction(e,n)}>${n.label}</button>
|
|
1401
1396
|
`)}
|
|
1402
1397
|
</div>
|
|
1403
1398
|
</div>
|
|
1404
1399
|
|
|
1405
1400
|
${this.workspaceSection(e,t||n||r)}
|
|
1406
|
-
${i?
|
|
1401
|
+
${i?_`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${D(`channelNoWorkspaces`)}</div>`:null}
|
|
1407
1402
|
${this.channelMeta(e)}
|
|
1408
|
-
${e.error?
|
|
1403
|
+
${e.error?_`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${e.error}</div>`:null}
|
|
1409
1404
|
${this.qrSection(e)}
|
|
1410
1405
|
${this.logsSection(e)}
|
|
1411
1406
|
</section>
|
|
1412
|
-
`}render(){return this.loading?
|
|
1407
|
+
`}render(){return this.loading?_`<div class="quickforge-settings-note">${D(`loading`)}</div>`:_`
|
|
1413
1408
|
<div class="quickforge-settings-stack">
|
|
1414
1409
|
<section class="quickforge-settings-warning">
|
|
1415
|
-
${
|
|
1410
|
+
${D(`channelsSecurityWarning`)}
|
|
1416
1411
|
</section>
|
|
1417
1412
|
|
|
1418
|
-
${this.channels.length?
|
|
1413
|
+
${this.channels.length?_`${this.channels.map(e=>this.channelCard(e))}`:_`<div class="quickforge-settings-note">${D(`channelsEmpty`)}</div>`}
|
|
1419
1414
|
|
|
1420
|
-
${this.message?
|
|
1421
|
-
${this.error?
|
|
1415
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1416
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1422
1417
|
</div>
|
|
1423
|
-
`}},J=`quickforge-channels-settings-tab`;customElements.get(J)||customElements.define(J,
|
|
1418
|
+
`}},J=`quickforge-channels-settings-tab`;customElements.get(J)||customElements.define(J,wt);function Tt(){return document.createElement(J)}var Et=ne(),Y=te(),Dt=(0,k.lazy)(()=>b(()=>import(`./AgentProfilesPage-BtZpDV-3.js`).then(e=>({default:e.AgentProfilesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Ot=(0,k.lazy)(()=>b(()=>import(`./mcp-servers-dialog-jHlDR9jP.js`).then(e=>({default:e.McpServersPanel})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),kt=(0,k.lazy)(()=>b(()=>import(`./skills-dialog-DvSnPPzu.js`).then(e=>e.n).then(e=>({default:e.SkillsManagerPanel})),__vite__mapDeps([9,1,2,3,4,5,6,7,8,10,11]))),At=(0,k.lazy)(()=>b(()=>import(`./PluginsPage-CCIj8-Mn.js`).then(e=>({default:e.PluginsPage})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,14]))),jt=(0,k.lazy)(()=>b(()=>import(`./ScheduledTasksPage-DIMewQ3i.js`).then(e=>({default:e.ScheduledTasksPage})),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11]))),Mt=class extends v{tabName=``;renderReact;root;getTabName(){return this.tabName}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.mountReact())}disconnectedCallback(){this.root?.unmount(),this.root=void 0,super.disconnectedCallback()}render(){return _`<div class="quickforge-react-settings-tab h-full min-h-0"></div>`}mountReact(){let e=this.querySelector(`.quickforge-react-settings-tab`);!e||!this.renderReact||(this.root??=(0,Et.createRoot)(e),this.root.render(this.renderReact()))}},X=`quickforge-react-settings-tab`;customElements.get(X)||customElements.define(X,Mt);function Z(e,t){let n=document.createElement(X);return n.tabName=e,n.renderReact=t,n}function Q({children:e}){return(0,Y.jsx)(`div`,{className:`quickforge-settings-stack h-full min-h-[30rem]`,children:(0,Y.jsx)(k.Suspense,{fallback:(0,Y.jsx)(`div`,{className:`quickforge-settings-note`,children:D(`loading`)}),children:e})})}function Nt(e){window.dispatchEvent(new CustomEvent(`quickforge:open-session-from-settings`,{detail:{sessionId:e}}))}function Pt(){return Z(D(`agentsTab`),()=>(0,Y.jsx)(Q,{children:(0,Y.jsx)(Dt,{})}))}function Ft(){return Z(D(`skills`),()=>(0,Y.jsx)(Q,{children:(0,Y.jsx)(kt,{active:!0,scope:`global`,embedded:!0,onSaved:()=>void 0})}))}function It(){return Z(D(`mcpServers`),()=>(0,Y.jsx)(Q,{children:(0,Y.jsx)(Ot,{active:!0})}))}function Lt(){return Z(D(`plugins`),()=>(0,Y.jsx)(Q,{children:(0,Y.jsx)(At,{})}))}function Rt(){return Z(D(`scheduledTasks`),()=>(0,Y.jsx)(Q,{children:(0,Y.jsx)(jt,{onOpenSession:Nt})}))}function zt(e){let t=[{key:`appearance`,tab:Ne(),getDescription:()=>D(`appearanceDescription`)},{key:`defaults`,tab:qe(),getDescription:()=>D(`defaultOptionsDescription`)},{key:`customModels`,tab:Ae(e),getDescription:()=>D(`customModelsDescription`)},{key:`agents`,tab:Pt(),getDescription:()=>D(`agentsDescription`)},{key:`skills`,tab:Ft(),getDescription:()=>D(`globalSkillsDescription`)},{key:`mcp`,tab:It(),getDescription:void 0},{key:`plugins`,tab:Lt(),getDescription:()=>D(`pluginsDescription`)},{key:`scheduledTasks`,tab:Rt(),getDescription:()=>D(`scheduledTasksDescription`)},{key:`projectCommands`,tab:bt(),getDescription:()=>D(`projectCommandsDescription`)},{key:`backup`,tab:rt(),getDescription:()=>D(`backupRestoreDescription`)},{key:`archivedConversations`,tab:st(),getDescription:()=>D(`archivedConversationsDescription`)},{key:`channels`,tab:Tt(),getDescription:()=>D(`channelsDescription`)},{key:`lanAccess`,tab:ut(),getDescription:()=>D(`lanAccessDescription`)},{key:`about`,tab:vt(),getDescription:()=>D(`aboutQuickForgeDescription`)}];return{items:[...t],tabs:t.map(e=>e.tab),indexOf:e=>t.findIndex(t=>t.key===e)}}var $={appearance:d,defaults:h,customModels:f,agents:t,skills:r,mcp:u,plugins:o,scheduledTasks:i,projectCommands:l,backup:g,archivedConversations:ee,channels:p,lanAccess:m,about:n};function Bt({tab:e}){let t=(0,k.useRef)(null);return(0,k.useEffect)(()=>{let n=t.current;if(n)return n.replaceChildren(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),(0,Y.jsx)(`div`,{ref:t,className:`quickforge-settings-tab-host min-h-0 flex-1`})}function Vt({initialTab:e,customProvider:t,onBack:n}){let r=(0,k.useMemo)(()=>zt(t),[t]),i=Math.max(0,r.indexOf(e)),[o,s]=(0,k.useState)(),l=o??i,u=r.items[l]??r.items[0],d=u?.getDescription?.(),f=u?$[u.key]:void 0,[p,m]=(0,k.useState)(``),h=p.trim().toLowerCase(),g=(0,k.useMemo)(()=>r.items.map((e,t)=>({item:e,index:t})).filter(({item:e})=>h?[e.key,e.tab.getTabName(),e.getDescription?.()??``].join(` `).toLowerCase().includes(h):!0),[r.items,h]);return(0,Y.jsxs)(`div`,{className:`flex h-screen min-h-0 bg-[var(--quickforge-sidebar-bg)] text-foreground`,children:[(0,Y.jsxs)(`aside`,{className:`relative z-10 hidden w-80 shrink-0 overflow-hidden bg-[var(--quickforge-sidebar-bg)] md:flex md:min-h-0 md:flex-col`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 px-3 pb-2 pt-3`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:`group relative flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-muted-foreground/72 transition-[background-color,color,box-shadow] duration-160 ease-out hover:bg-[var(--quickforge-sidebar-hover-bg)] hover:text-foreground/86 hover:shadow-[0_8px_20px_-18px_rgb(15_23_42_/_0.35)]`,onClick:n,"aria-label":`返回工作区`,children:[(0,Y.jsx)(`span`,{className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground/55 transition-colors group-hover:text-foreground/70`,children:(0,Y.jsx)(a,{className:`size-4`})}),(0,Y.jsx)(`span`,{className:`truncate text-sm leading-5`,children:`返回工作区`})]}),(0,Y.jsxs)(`div`,{className:`quickforge-settings-inline-field mt-3`,children:[(0,Y.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:D(`searchSettings`),"aria-label":D(`searchSettings`),className:`quickforge-settings-input`})]})]}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-4`,children:(0,Y.jsxs)(`nav`,{className:`space-y-1`,"aria-label":D(`settings`),children:[g.map(({item:e,index:t})=>{let n=t===l,r=$[e.key];return(0,Y.jsxs)(`button`,{type:`button`,className:ge(`group relative flex w-full items-center gap-2.5 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm leading-5 transition-[background-color,color,box-shadow] duration-160 ease-out`,n?`bg-[var(--quickforge-sidebar-active-bg)] font-medium text-foreground/92 shadow-[0_8px_22px_-20px_rgb(15_23_42_/_0.32)]`:`text-muted-foreground/76 hover:bg-[var(--quickforge-sidebar-hover-bg)] hover:text-foreground/90 hover:shadow-[0_8px_20px_-18px_rgb(15_23_42_/_0.35)]`),onClick:()=>s(t),"aria-current":n?`page`:void 0,children:[(0,Y.jsx)(`span`,{className:ge(`inline-flex size-5 shrink-0 items-center justify-center transition-colors`,n?`text-foreground/72`:`text-muted-foreground/52 group-hover:text-foreground/68`),children:(0,Y.jsx)(r,{className:`size-4`,"aria-hidden":`true`})}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.tab.getTabName()})]},e.key)}),g.length===0?(0,Y.jsx)(`div`,{className:`px-2 py-3 text-sm text-muted-foreground/70`,children:D(`noSettingsResults`)}):null]})})]}),(0,Y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col bg-[var(--quickforge-main-bg)] md:overflow-hidden md:rounded-l-2xl`,children:[(0,Y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-2 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-3 pr-4 md:px-5`,children:[(0,Y.jsx)(we,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:n,"aria-label":`返回工作区`,children:(0,Y.jsx)(a,{className:`size-4`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[f?(0,Y.jsx)(f,{className:`size-4 shrink-0 text-muted-foreground/65`,"aria-hidden":`true`}):null,(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium text-foreground/90`,children:u?.tab.getTabName()}),d?(0,Y.jsx)(he,{label:d}):null]})})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_30%,transparent)] px-3 py-2 md:hidden`,children:(0,Y.jsxs)(`div`,{className:`quickforge-settings-inline-field`,children:[(0,Y.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,Y.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:D(`searchSettings`),"aria-label":D(`searchSettings`),className:`quickforge-settings-input`})]})}),(0,Y.jsxs)(`div`,{className:`quickforge-settings-mobile-tabs flex shrink-0 gap-1 overflow-x-auto border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_30%,transparent)] px-3 py-2 md:hidden`,children:[g.map(({item:e,index:t})=>{let n=t===l,r=$[e.key];return(0,Y.jsxs)(`button`,{type:`button`,className:ge(`inline-flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-sm transition-colors`,n?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/55 hover:text-foreground`),onClick:()=>s(t),children:[(0,Y.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:e.tab.getTabName()})]},e.key)}),g.length===0?(0,Y.jsx)(`div`,{className:`shrink-0 px-1 py-1.5 text-sm text-muted-foreground/70`,children:D(`noSettingsResults`)}):null]}),(0,Y.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-5 md:px-8 md:py-7`,children:(0,Y.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col`,children:u?(0,Y.jsx)(Bt,{tab:u.tab}):null})})]})]})}export{Vt as SettingsWorkspacePage};
|