@shawnstack/quickforge 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/bin/quickforge.mjs +2 -0
- package/dist/assets/{AgentProfilesPage-BFgyFa5e.js → AgentProfilesPage-D7pbg8nm.js} +1 -1
- package/dist/assets/{ChatPanelHost-Cld9HcVz.js → ChatPanelHost-wfGCaCzD.js} +62 -62
- package/dist/assets/{PluginsPage-DEMqwhOA.js → PluginsPage-NAGroBm3.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-DTP_gedp.js → ScheduledTasksPage-Bp0MNfQD.js} +2 -2
- package/dist/assets/{SettingsWorkspacePage-Dr9zT5Bs.js → SettingsWorkspacePage-BtJZMIsZ.js} +350 -269
- package/dist/assets/{SharedConversationPage-op3DRwcw.js → SharedConversationPage-Ce3KoVZt.js} +1 -1
- package/dist/assets/{TerminalDock-BL_UovwU.js → TerminalDock-4eUuXP7X.js} +2 -2
- package/dist/assets/WorkspaceInspector-kM3BRPjY.js +13 -0
- package/dist/assets/{index-yV1wtqTr.js → index-C6k5taeb.js} +8 -8
- package/dist/assets/index-CzN8NSKC.css +3 -0
- package/dist/assets/{mcp-servers-dialog-Bp6kbIup.js → mcp-servers-dialog-BQbFywVL.js} +2 -2
- package/dist/assets/{skills-dialog-DiJAUfvW.js → skills-dialog-REBeTFSH.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +4 -1
- package/server/ai-http-logger.mjs +6 -6
- package/server/ai-provider-options.mjs +8 -0
- package/server/index.mjs +7 -2
- package/server/network-proxy.mjs +384 -0
- package/server/public-api.mjs +4 -0
- package/server/routes/agent-profiles.mjs +2 -0
- package/server/routes/models.mjs +1 -0
- package/server/routes/scheduled-tasks.mjs +2 -0
- package/server/routes/system.mjs +26 -0
- package/server/routes/workspace.mjs +2 -0
- package/server/session-utils.mjs +2 -0
- package/dist/assets/WorkspaceInspector-73dhAime.js +0 -13
- package/dist/assets/index-Cu2bBHLv.css +0 -3
|
@@ -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{A as t,Dt as n,Et as r,H as i,Mt as a,Ot as o,Pt as s,Tt as c,_ as ee,f as l,ft as u,h as d,jt as te,l as f,ot as p,s as m,st as ne,x as re}from"./icons-BP8YOS-Z.js";import{n as ie,r as ae}from"./react-vendor-Dr5xvL-e.js";import{p as h}from"./lit-vendor-Dr3cpBGF.js";import{m as g,x as _}from"./pi-web-ui-DoRGtREc.js";import{J as v}from"./pi-ai-Cr3rpCXT.js";import{t as y}from"./logger-B65Akg8A.js";import{B as b,C as oe,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentProfilesPage-D7pbg8nm.js","assets/rolldown-runtime-DWdDZTNf.js","assets/index-C6k5taeb.js","assets/pi-ai-Cr3rpCXT.js","assets/pi-web-ui-DoRGtREc.js","assets/lit-vendor-Dr3cpBGF.js","assets/css-utils-rkE68RDy.js","assets/icons-BP8YOS-Z.js","assets/react-vendor-Dr5xvL-e.js","assets/skills-dialog-REBeTFSH.js","assets/logger-B65Akg8A.js","assets/index-CzN8NSKC.css","assets/mcp-servers-dialog-BQbFywVL.js","assets/PluginsPage-NAGroBm3.js","assets/plugin-api-BbUkYm3Y.js","assets/ScheduledTasksPage-Bp0MNfQD.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r,H as i,Mt as a,Ot as o,Pt as s,Tt as c,_ as ee,f as l,ft as u,h as d,jt as te,l as f,ot as p,s as m,st as ne,x as re}from"./icons-BP8YOS-Z.js";import{n as ie,r as ae}from"./react-vendor-Dr5xvL-e.js";import{p as h}from"./lit-vendor-Dr3cpBGF.js";import{m as g,x as _}from"./pi-web-ui-DoRGtREc.js";import{J as v}from"./pi-ai-Cr3rpCXT.js";import{t as y}from"./logger-B65Akg8A.js";import{B as b,C as oe,Ct as se,D as ce,Dt as le,E as ue,Et as de,F as fe,I as pe,O as x,Ot as S,P as me,R as he,S as ge,T as _e,Tt as ve,V as C,_t as ye,dt as be,ft as xe,gt as Se,j as Ce,k as w,mt as we,ut as T,vt as E,w as Te,wt as D,xt as Ee,yt as De,z as Oe}from"./index-C6k5taeb.js";var O=e(s(),1),ke={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}},Ae=[{key:`openai`,label:S(`presetOpenai`)},{key:`deepseek`,label:S(`presetDeepseek`)},{key:`glm`,label:S(`presetGlm`)},{key:`ollama`,label:S(`presetOllama`)},{key:`litellm`,label:S(`presetLitellm`)},{key:`custom`,label:S(`presetCustom`)}],k=()=>({modelId:``,contextWindow:T.contextWindow,maxTokens:T.maxTokens,reasoning:!0,supportsImages:!1,open:!1}),A=()=>({name:T.name,baseUrl:T.baseUrl,apiKey:``,headerRows:[],protocol:`openai-completions`,models:[k()]}),je=class extends g{providers=[];form=A();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 S(`customModels`)}async loadProviders(){this.loading=!0,this.requestUpdate();try{this.providers=await _().customProviders.getAll()}catch(e){y.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=A(),this.apiKeyVisible=!1,this.advancedOpen=!1,this.activePreset=``,this.resetTestState(),this.formOpen=!0,this.requestUpdate()}async openEditForm(e){let t=await _().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})):[k()],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=A(),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,k()]},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:[k()]};else{let t=ke[e];this.form={...this.form,name:t.name,baseUrl:t.baseUrl,protocol:t.protocol,models:[{...k(),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=S(`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||S(`connectionFailed`))}catch(e){this.testResult=`fail`,this.testError=e?.message||S(`connectionFailed`)}finally{this.testing=!1,this.requestUpdate()}}async saveModel(){let e=this.form.name.trim(),t=this.form.baseUrl.trim();if(!e||!t){b(S(`fillProviderBaseUrlModel`));return}let n=this.form.models.filter(e=>e.modelId.trim());if(n.length===0){b(S(`atLeastOneModel`));return}let r=n.map(e=>e.modelId.trim());if(new Set(r).size!==r.length){b(S(`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??De(),name:e,type:this.form.protocol,baseUrl:a[0].baseUrl,apiKey:o||void 0,models:a};try{let e=_();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){y.error(`Failed to save custom model:`,e),b(S(`saveCustomModelFailed`))}}async deleteProvider(e){if(await C({description:S(`confirmDeleteProvider`,{name:e.name}),confirmLabel:S(`confirmDelete`),cancelLabel:S(`cancel`),variant:`destructive`}))try{let t=_();await t.customProviders.delete(e.id),await t.providerKeys.delete(e.name),await this.loadProviders()}catch(e){y.error(`Failed to delete custom provider:`,e),b(S(`deleteFailed`))}}renderProvider(e){let t=e.models??[],n=t.length,r=e.type===`anthropic-messages`?`Anthropic Messages`:`OpenAI Compatible`;return h`
|
|
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,9 +8,9 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et 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?h`<span class="quickforge-settings-badge quickforge-settings-badge-warning">${
|
|
11
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-muted">${S(`providerProtocol`)}: ${r}</span>
|
|
12
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-info">${S(`modelsCount`,{count:n})}</span>
|
|
13
|
+
${n===0?h`<span class="quickforge-settings-badge quickforge-settings-badge-warning">${S(`noModelAdded`)}</span>`:null}
|
|
14
14
|
</div>
|
|
15
15
|
${n>0?h`
|
|
16
16
|
<div class="quickforge-settings-meta">
|
|
@@ -29,20 +29,20 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
29
29
|
type="button"
|
|
30
30
|
@click=${()=>this.openEditForm(e)}
|
|
31
31
|
>
|
|
32
|
-
${
|
|
32
|
+
${S(`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
|
+
${S(`delete`)}
|
|
40
40
|
</button>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
`}renderPresetChips(){return h`
|
|
44
44
|
<div class="quickforge-settings-form-row">
|
|
45
|
-
<span class="quickforge-settings-form-label">${
|
|
45
|
+
<span class="quickforge-settings-form-label">${S(`presets`)}</span>
|
|
46
46
|
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap">
|
|
47
47
|
${Ae.map(e=>h`
|
|
48
48
|
<button
|
|
@@ -60,7 +60,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
60
60
|
<button
|
|
61
61
|
class="quickforge-settings-icon-action"
|
|
62
62
|
type="button"
|
|
63
|
-
title=${
|
|
63
|
+
title=${S(`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{A as t,Dt as n,Et 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=${S(`modelIdPlaceholder`)}
|
|
75
75
|
/>
|
|
76
76
|
${n?h`
|
|
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">${S(`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{A as t,Dt as n,Et 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">${S(`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{A as t,Dt as n,Et as r
|
|
|
100
100
|
.checked=${e.reasoning}
|
|
101
101
|
@change=${e=>this.updateModelField(t,`reasoning`,e.target.checked)}
|
|
102
102
|
/>
|
|
103
|
-
<span>${
|
|
103
|
+
<span>${S(`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,8 +109,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et 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
|
+
${S(`imageInputModel`)}
|
|
113
|
+
<quickforge-info-tip .label=${S(`imageInputModelHelp`)}></quickforge-info-tip>
|
|
114
114
|
</span>
|
|
115
115
|
</label>
|
|
116
116
|
`:null}
|
|
@@ -119,7 +119,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
119
119
|
<button
|
|
120
120
|
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
121
121
|
type="button"
|
|
122
|
-
title=${
|
|
122
|
+
title=${S(`delete`)}
|
|
123
123
|
@click=${()=>this.removeModelRow(t)}
|
|
124
124
|
>
|
|
125
125
|
✕
|
|
@@ -129,8 +129,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
129
129
|
`}renderHeadersEditor(){return h`
|
|
130
130
|
<div class="quickforge-settings-form-row">
|
|
131
131
|
<span class="quickforge-settings-form-label">
|
|
132
|
-
${
|
|
133
|
-
<quickforge-info-tip .label=${
|
|
132
|
+
${S(`customHeaders`)}
|
|
133
|
+
<quickforge-info-tip .label=${S(`customHeadersHelp`)}></quickforge-info-tip>
|
|
134
134
|
</span>
|
|
135
135
|
${this.form.headerRows.length===0?h``:h`
|
|
136
136
|
<div class="quickforge-settings-nested-list">
|
|
@@ -140,18 +140,18 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
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=${S(`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=${S(`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=${S(`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{A as t,Dt as n,Et as r
|
|
|
165
165
|
type="button"
|
|
166
166
|
@click=${()=>this.addHeaderRow()}
|
|
167
167
|
>
|
|
168
|
-
+ ${
|
|
168
|
+
+ ${S(`addHeader`)}
|
|
169
169
|
</button>
|
|
170
170
|
</div>
|
|
171
|
-
`}renderTestStatus(){return this.testResult===`idle`&&!this.testing?h``:this.testing?h`<span class="quickforge-settings-status">${
|
|
172
|
-
<section class="quickforge-settings-section" aria-label=${this.editingProviderId?
|
|
171
|
+
`}renderTestStatus(){return this.testResult===`idle`&&!this.testing?h``:this.testing?h`<span class="quickforge-settings-status">${S(`testingConnection`)}</span>`:this.testResult===`ok`?h`<span class="quickforge-settings-badge quickforge-settings-badge-success">✓ ${S(`connectionOk`)}</span>`:h`<span class="quickforge-settings-alert">✗ ${this.testError||S(`connectionFailed`)}</span>`}renderForm(){return h`
|
|
172
|
+
<section class="quickforge-settings-section" aria-label=${this.editingProviderId?S(`editCustomModel`):S(`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{A as t,Dt as n,Et 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
|
+
${S(`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?S(`editCustomModel`):S(`addCustomModel`)}</div>
|
|
184
|
+
<div class="quickforge-settings-row-description">${S(`customModelsDescription`)}</div>
|
|
185
185
|
</div>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
@@ -189,12 +189,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et 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">${S(`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=${S(`providerNamePlaceholder`)}
|
|
198
198
|
/>
|
|
199
199
|
</label>
|
|
200
200
|
|
|
@@ -209,20 +209,20 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et 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">${S(`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=${S(`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?S(`hideApiKey`):S(`showApiKey`)}
|
|
225
|
+
aria-label=${this.apiKeyVisible?S(`hideApiKey`):S(`showApiKey`)}
|
|
226
226
|
aria-pressed=${this.apiKeyVisible?`true`:`false`}
|
|
227
227
|
@click=${()=>this.toggleApiKeyVisibility()}
|
|
228
228
|
>
|
|
@@ -233,13 +233,13 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
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">${S(`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
|
+
+ ${S(`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{A as t,Dt as n,Et as r
|
|
|
254
254
|
@click=${()=>{this.advancedOpen=!this.advancedOpen,this.requestUpdate()}}
|
|
255
255
|
>
|
|
256
256
|
<span>${this.advancedOpen?`▾`:`▸`}</span>
|
|
257
|
-
${
|
|
257
|
+
${S(`providerAdvanced`)}
|
|
258
258
|
</button>
|
|
259
259
|
|
|
260
260
|
${this.advancedOpen?h`
|
|
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
|
+
${S(`protocolType`)}
|
|
265
|
+
<quickforge-info-tip .label=${S(`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{A as t,Dt as n,Et as r
|
|
|
288
288
|
type="button"
|
|
289
289
|
@click=${()=>this.closeForm()}
|
|
290
290
|
>
|
|
291
|
-
${
|
|
291
|
+
${S(`cancel`)}
|
|
292
292
|
</button>
|
|
293
293
|
<button
|
|
294
294
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
@@ -296,14 +296,14 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
296
296
|
?disabled=${this.testing}
|
|
297
297
|
@click=${()=>this.testConnection()}
|
|
298
298
|
>
|
|
299
|
-
${this.testing?
|
|
299
|
+
${this.testing?S(`testingConnection`):S(`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
|
+
${S(`save`)}
|
|
307
307
|
</button>
|
|
308
308
|
</div>
|
|
309
309
|
</div>
|
|
@@ -312,33 +312,33 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
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?S(`editCustomModel`):S(`addCustomModel`)}
|
|
316
|
+
<quickforge-info-tip .label=${S(`customModelsDescription`)}></quickforge-info-tip>
|
|
317
317
|
</h3>
|
|
318
318
|
</div>
|
|
319
319
|
${this.renderForm()}
|
|
320
320
|
</div>
|
|
321
321
|
`:h`
|
|
322
322
|
<div class="quickforge-settings-stack">
|
|
323
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
323
|
+
<section class="quickforge-settings-section" aria-label=${S(`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">${S(`customModelsTitle`)}</div>
|
|
327
|
+
<div class="quickforge-settings-row-description">${S(`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
|
+
${S(`addModel`)}
|
|
335
335
|
</button>
|
|
336
336
|
</div>
|
|
337
337
|
|
|
338
|
-
${this.loading?h`<div class="quickforge-settings-empty-row">${
|
|
338
|
+
${this.loading?h`<div class="quickforge-settings-empty-row">${S(`loading`)}</div>`:this.providers.length===0?h`<div class="quickforge-settings-empty-row">${S(`noCustomModels`)}</div>`:this.providers.map(e=>this.renderProvider(e))}
|
|
339
339
|
</section>
|
|
340
340
|
</div>
|
|
341
|
-
`}},j=`quickforge-custom-providers-only-tab`;customElements.get(j)||customElements.define(j,je);function Me(e){let t=document.createElement(j);return e&&(t.autoEditProviderName=e),t}var Ne=[{value:`light`,label:()=>
|
|
341
|
+
`}},j=`quickforge-custom-providers-only-tab`;customElements.get(j)||customElements.define(j,je);function Me(e){let t=document.createElement(j);return e&&(t.autoEditProviderName=e),t}var Ne=[{value:`light`,label:()=>S(`lightTheme`)},{value:`dark`,label:()=>S(`darkTheme`)}],Pe=class extends g{theme=_e();interfaceFontSizePx=x.interfaceFontSizePx;messageFontSizePx=x.messageFontSizePx;loading=!0;error=``;getTabName(){return S(`appearance`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=_(),[t,n]=await Promise.all([ue(e),me(e)]);this.theme=t.theme,this.interfaceFontSizePx=n.interfaceFontSizePx,this.messageFontSizePx=n.messageFontSizePx}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async selectTheme(e){if(this.theme!==e){this.theme=e,this.requestUpdate();try{await ce(_(),{theme:e}),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}}currentFontSizeSettings(){return fe({interfaceFontSizePx:this.interfaceFontSizePx,messageFontSizePx:this.messageFontSizePx})}previewFontSize(e){let t=fe(e);this.interfaceFontSizePx=t.interfaceFontSizePx,this.messageFontSizePx=t.messageFontSizePx,Ce(t),this.requestUpdate()}updateInterfaceFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),interfaceFontSizePx:Number(e)||x.interfaceFontSizePx})}updateMessageFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),messageFontSizePx:Number(e)||x.messageFontSizePx})}async saveFontSize(){try{await pe(_(),this.currentFontSizeSettings()),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}renderThemeOption(e){let t=this.theme===e.value;return h`
|
|
342
342
|
<button
|
|
343
343
|
type="button"
|
|
344
344
|
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
@@ -354,7 +354,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
354
354
|
${e}
|
|
355
355
|
${t?h`<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">${S(`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>
|
|
@@ -371,45 +371,124 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
371
371
|
/>
|
|
372
372
|
</div>
|
|
373
373
|
</div>
|
|
374
|
-
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${
|
|
374
|
+
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${S(`loading`)}</div>`:h`
|
|
375
375
|
<div class="quickforge-settings-stack">
|
|
376
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
376
|
+
<section class="quickforge-settings-section" aria-label=${S(`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
|
+
${S(`theme`)}
|
|
381
|
+
<quickforge-info-tip .label=${S(`themeDescription`)}></quickforge-info-tip>
|
|
382
382
|
</div>
|
|
383
|
-
<div class="quickforge-settings-row-description">${
|
|
383
|
+
<div class="quickforge-settings-row-description">${S(`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=${S(`theme`)}>
|
|
387
387
|
${Ne.map(e=>this.renderThemeOption(e))}
|
|
388
388
|
</div>
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
391
391
|
|
|
392
|
-
${this.renderFontSizeSlider(
|
|
392
|
+
${this.renderFontSizeSlider(S(`interfaceFontSize`),null,this.interfaceFontSizePx,e=>this.updateInterfaceFontSize(e))}
|
|
393
393
|
|
|
394
|
-
${this.renderFontSizeSlider(
|
|
394
|
+
${this.renderFontSizeSlider(S(`messageFontSize`),S(`messageFontSizeNote`),this.messageFontSizePx,e=>this.updateMessageFontSize(e))}
|
|
395
395
|
</section>
|
|
396
396
|
|
|
397
397
|
${this.error?h`<span class="quickforge-settings-error">${this.error}</span>`:null}
|
|
398
398
|
</div>
|
|
399
|
-
`}},M=`quickforge-appearance-settings-tab`;customElements.get(M)||customElements.define(M,Pe);function Fe(){return document.createElement(M)}var Ie=`auto-compact-settings`,N={enabled:!0,thresholdPercent:80,keepRecentTurns:3,minSourceChars:1600,requireConfirmation:!0};function P(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Le(e){if(!e||typeof e!=`object`)return{...N};let t=e;return{enabled:t.enabled!==!1,thresholdPercent:P(t.thresholdPercent,N.thresholdPercent,50,95),keepRecentTurns:P(t.keepRecentTurns,N.keepRecentTurns,1,20),minSourceChars:P(t.minSourceChars,N.minSourceChars,0,2e5),requireConfirmation:t.requireConfirmation!==!1}}async function Re(e){return Le(await e.settings.get(Ie))}async function ze(e,t){await e.settings.set(Ie,Le(t))}var Be=`auto-archive-settings`,Ve={enabled:!1};function He(e){return!e||typeof e!=`object`?{...Ve}:{enabled:e.enabled===!0}}async function Ue(e){return He(await e.settings.get(Be))}async function We(e,t){await e.settings.set(Be,He(t))}var Ge=[{value:`off`,label:()=>
|
|
399
|
+
`}},M=`quickforge-appearance-settings-tab`;customElements.get(M)||customElements.define(M,Pe);function Fe(){return document.createElement(M)}var Ie=`auto-compact-settings`,N={enabled:!0,thresholdPercent:80,keepRecentTurns:3,minSourceChars:1600,requireConfirmation:!0};function P(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Le(e){if(!e||typeof e!=`object`)return{...N};let t=e;return{enabled:t.enabled!==!1,thresholdPercent:P(t.thresholdPercent,N.thresholdPercent,50,95),keepRecentTurns:P(t.keepRecentTurns,N.keepRecentTurns,1,20),minSourceChars:P(t.minSourceChars,N.minSourceChars,0,2e5),requireConfirmation:t.requireConfirmation!==!1}}async function Re(e){return Le(await e.settings.get(Ie))}async function ze(e,t){await e.settings.set(Ie,Le(t))}var Be=`auto-archive-settings`,Ve={enabled:!1};function He(e){return!e||typeof e!=`object`?{...Ve}:{enabled:e.enabled===!0}}async function Ue(e){return He(await e.settings.get(Be))}async function We(e,t){await e.settings.set(Be,He(t))}var Ge=[{value:`off`,label:()=>S(`thinkingOff`)},{value:`low`,label:()=>S(`thinkingLow`)},{value:`medium`,label:()=>S(`thinkingMedium`)},{value:`high`,label:()=>S(`thinkingHigh`)},{value:`xhigh`,label:()=>S(`thinkingXHigh`)}],Ke=[{value:`compact`,label:()=>S(`toolDisplayCompact`)},{value:`detailed`,label:()=>S(`toolDisplayDetailed`)}],F=`__custom__`;function qe(e){return(e??``).trim().replace(/\/$/,``)}function I(e){return JSON.stringify([e.provider,e.id,e.api,qe(e.baseUrl)])}function Je(e){return`${e.provider} / ${e.id}`}function Ye(){return`custom_${globalThis.crypto?.randomUUID?.().slice(0,8)||Date.now().toString(36)}`}function Xe(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 Ze=h`
|
|
400
400
|
<svg class="size-3.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
401
401
|
<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" />
|
|
402
402
|
</svg>
|
|
403
|
-
`,Qe=class extends g{models=[];selectedModel;thinkingLevel=`off`;toolDisplayMode=`compact`;showContextUsage=!1;autoCompactEnabled=!0;autoCompactRequireConfirmation=!0;autoCompactThresholdPercent=80;autoCompactThresholdPercentInput=`80`;autoCompactKeepRecentTurns=3;autoArchiveEnabled=!1;selectedLanguage=
|
|
404
|
-
<
|
|
403
|
+
`,Qe=class extends g{models=[];selectedModel;thinkingLevel=`off`;toolDisplayMode=`compact`;showContextUsage=!1;autoCompactEnabled=!0;autoCompactRequireConfirmation=!0;autoCompactThresholdPercent=80;autoCompactThresholdPercentInput=`80`;autoCompactKeepRecentTurns=3;autoArchiveEnabled=!1;selectedLanguage=de();loading=!0;saved=!1;savedMessage=``;error=``;terminalShellConfig={terminalShell:`auto`,defaultProfileId:`auto`,profiles:[]};customShellCommand=``;customShellEditorOpen=!1;networkProxyMode=`direct`;networkProxyUrl=``;savedNetworkProxyConfig={mode:`direct`,proxyUrl:``};networkProxyStatus=null;networkProxySaving=!1;networkProxyLoaded=!1;getTabName(){return S(`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);let r=this.querySelector(`[data-terminal-shell-select]`);r&&(r.value=this.customShellEditorOpen?F:this.selectedTerminalShellProfileId())}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=_(),[t,n,r,i,a]=await Promise.all([xe(e),we(e),he(e),Re(e),Ue(e)]);this.models=t,this.selectedModel=n.model?t.find(e=>I(e)===I(n.model))??n.model:t[0],this.thinkingLevel=n.thinkingLevel??be(this.selectedModel),this.toolDisplayMode=r.toolDisplayMode,this.showContextUsage=r.showContextUsage,this.autoCompactEnabled=i.enabled,this.autoCompactRequireConfirmation=i.requireConfirmation,this.autoCompactThresholdPercent=i.thresholdPercent,this.autoCompactThresholdPercentInput=String(i.thresholdPercent),this.autoCompactKeepRecentTurns=i.keepRecentTurns,this.autoArchiveEnabled=a.enabled,await Promise.all([this.loadTerminalShell(),this.loadNetworkProxy()])}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}updateModel(e){let t=this.models.find(t=>I(t)===e);this.selectedModel=t,this.thinkingLevel=be(t),this.saved=!1,this.requestUpdate(),this.saveDefaultModelOptions()}updateThinkingLevel(e){this.thinkingLevel=Ge.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 ve(_(),this.selectedLanguage)}updateToolDisplayMode(e){this.toolDisplayMode!==e&&(this.toolDisplayMode=e,this.saved=!1,this.requestUpdate(),this.saveToolDisplayOptions())}updateShowContextUsage(e){this.showContextUsage=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()}updateAutoArchiveEnabled(e){this.autoArchiveEnabled=e,this.saved=!1,this.requestUpdate(),this.saveAutoArchiveOptions()}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=S(`defaultOptionsSaved`)){this.saved=!0,this.savedMessage=e,this.error=``,this.requestUpdate()}customShellProfiles(){return this.terminalShellConfig.profiles.filter(e=>!e.builtin)}selectedTerminalShellProfileId(){let e=this.terminalShellConfig.profiles;return e.some(e=>e.id===this.terminalShellConfig.defaultProfileId)?this.terminalShellConfig.defaultProfileId:e[0]?.id||F}updateTerminalShellSelection(e){if(e===F){this.customShellEditorOpen=!0,this.requestUpdate();return}this.customShellEditorOpen=!1,this.requestUpdate(),this.saveTerminalShellConfig(e)}async loadNetworkProxy(){try{let e=await fetch(`/api/system/network-proxy`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||S(`requestFailed`));this.networkProxyMode=t?.config?.mode||`direct`,this.networkProxyUrl=t?.config?.proxyUrl||``,this.savedNetworkProxyConfig={mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl},this.networkProxyStatus=t?.status||null,this.networkProxyLoaded=!0}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}}updateNetworkProxyMode(e){this.networkProxyMode===e||this.networkProxySaving||!this.networkProxyLoaded||(this.networkProxyMode=e,this.saved=!1,this.error=``,this.requestUpdate(),!(e===`manual`&&!this.networkProxyUrl.trim())&&this.saveNetworkProxy())}updateNetworkProxyUrl(e){this.networkProxyUrl=e,this.saved=!1,this.requestUpdate()}networkProxyValidationError(){let e=this.networkProxyUrl.trim();if(!e)return S(`networkProxyAddressRequired`);try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?!t.hostname||!t.port?S(`networkProxyAddressPortError`):t.username||t.password?S(`networkProxyAddressCredentialsError`):t.pathname&&t.pathname!==`/`||t.search||t.hash?S(`networkProxyAddressPathError`):``:S(`networkProxyAddressProtocolError`)}catch{return S(`networkProxyAddressInvalid`)}}async saveNetworkProxy(){if(!(this.networkProxySaving||!this.networkProxyLoaded)){if(this.networkProxyMode===`manual`){let e=this.networkProxyValidationError();if(e){this.saved=!1,this.error=e,this.requestUpdate();return}}this.networkProxySaving=!0,this.saved=!1,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/network-proxy`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||S(`requestFailed`));this.networkProxyMode=t?.config?.mode||this.networkProxyMode,this.networkProxyUrl=t?.config?.proxyUrl||``,this.savedNetworkProxyConfig={mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl},this.networkProxyStatus=t?.status||null,this.markSaved(S(`networkProxySaved`))}catch(e){this.networkProxyMode=this.savedNetworkProxyConfig.mode,this.networkProxyUrl=this.savedNetworkProxyConfig.proxyUrl,this.saved=!1,this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.networkProxySaving=!1,this.requestUpdate()}}}async refreshNetworkProxy(){if(!(this.networkProxySaving||!this.networkProxyLoaded)){this.networkProxySaving=!0,this.saved=!1,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/network-proxy/refresh`,{method:`POST`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||S(`requestFailed`));this.networkProxyStatus=t?.status||null,this.markSaved(S(`networkProxyRefreshed`))}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.networkProxySaving=!1,this.requestUpdate()}}}renderNetworkProxyModeOption(e,t){let n=this.networkProxyMode===e;return h`
|
|
404
|
+
<button
|
|
405
|
+
type="button"
|
|
406
|
+
class="quickforge-settings-segmented-option ${n?`quickforge-settings-segmented-option-active`:``}"
|
|
407
|
+
aria-pressed=${n?`true`:`false`}
|
|
408
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded}
|
|
409
|
+
@click=${()=>this.updateNetworkProxyMode(e)}
|
|
410
|
+
>
|
|
411
|
+
${t}
|
|
412
|
+
</button>
|
|
413
|
+
`}networkProxySettings(){let e=this.networkProxyMode===`manual`?this.networkProxyValidationError():``,t=this.networkProxyMode===`manual`&&(this.networkProxyUrl!==this.savedNetworkProxyConfig.proxyUrl||this.savedNetworkProxyConfig.mode!==`manual`),n=this.networkProxyLoaded?this.networkProxyStatus?.supported===!1?this.networkProxyStatus.error||S(`networkProxyUnsupported`):S(`networkProxyStatus`,{source:this.networkProxyStatus?.source||S(`unknown`),runtime:this.networkProxyStatus?.runtimeKind||S(`unknown`)}):S(`networkProxyLoadFailed`);return h`
|
|
414
|
+
<section class="quickforge-settings-section" aria-label=${S(`networkConnection`)}>
|
|
405
415
|
<div class="quickforge-settings-row">
|
|
406
416
|
<div class="quickforge-settings-row-main">
|
|
407
417
|
<div class="quickforge-settings-row-title">
|
|
408
|
-
${
|
|
409
|
-
<quickforge-info-tip .label=${
|
|
418
|
+
${S(`networkProxyMode`)}
|
|
419
|
+
<quickforge-info-tip .label=${S(`networkProxyDescription`)}></quickforge-info-tip>
|
|
420
|
+
</div>
|
|
421
|
+
<div class="quickforge-settings-row-description">${n}</div>
|
|
422
|
+
</div>
|
|
423
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
424
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${S(`networkProxyMode`)}>
|
|
425
|
+
${this.renderNetworkProxyModeOption(`direct`,S(`networkProxyDirect`))}
|
|
426
|
+
${this.renderNetworkProxyModeOption(`system`,S(`networkProxySystem`))}
|
|
427
|
+
${this.renderNetworkProxyModeOption(`manual`,S(`networkProxyManual`))}
|
|
428
|
+
</div>
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
${this.networkProxyMode===`manual`?h`
|
|
433
|
+
<div class="quickforge-settings-row">
|
|
434
|
+
<div class="quickforge-settings-row-main">
|
|
435
|
+
<div class="quickforge-settings-row-title">${S(`networkProxyAddress`)}</div>
|
|
436
|
+
<div class="quickforge-settings-row-description">${S(`networkProxyAddressDescription`)}</div>
|
|
437
|
+
</div>
|
|
438
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-network-proxy-control">
|
|
439
|
+
<input
|
|
440
|
+
id="quickforge-network-proxy-url"
|
|
441
|
+
class="quickforge-settings-input quickforge-settings-mono"
|
|
442
|
+
type="url"
|
|
443
|
+
aria-label=${S(`networkProxyAddress`)}
|
|
444
|
+
aria-invalid=${t&&e?`true`:`false`}
|
|
445
|
+
.value=${this.networkProxyUrl}
|
|
446
|
+
placeholder="http://127.0.0.1:7890"
|
|
447
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded}
|
|
448
|
+
@input=${e=>this.updateNetworkProxyUrl(e.target.value)}
|
|
449
|
+
@keydown=${e=>{e.key===`Enter`&&this.networkProxyUrl.trim()&&(e.preventDefault(),this.saveNetworkProxy())}}
|
|
450
|
+
/>
|
|
451
|
+
<button
|
|
452
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
453
|
+
type="button"
|
|
454
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded||!!e||!t}
|
|
455
|
+
@click=${()=>this.saveNetworkProxy()}
|
|
456
|
+
>
|
|
457
|
+
${this.networkProxySaving?S(`saving`):S(`networkProxySave`)}
|
|
458
|
+
</button>
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
`:null}
|
|
462
|
+
|
|
463
|
+
${this.networkProxyMode===`system`?h`
|
|
464
|
+
<div class="quickforge-settings-row">
|
|
465
|
+
<div class="quickforge-settings-row-main">
|
|
466
|
+
<div class="quickforge-settings-row-title">${S(`networkProxyRefresh`)}</div>
|
|
467
|
+
<div class="quickforge-settings-row-description">${S(`networkProxyRefreshDescription`)}</div>
|
|
468
|
+
</div>
|
|
469
|
+
<div class="quickforge-settings-row-control">
|
|
470
|
+
<button
|
|
471
|
+
class="quickforge-settings-button"
|
|
472
|
+
type="button"
|
|
473
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded}
|
|
474
|
+
@click=${()=>this.refreshNetworkProxy()}
|
|
475
|
+
>
|
|
476
|
+
${this.networkProxySaving?S(`saving`):S(`networkProxyRefresh`)}
|
|
477
|
+
</button>
|
|
478
|
+
</div>
|
|
479
|
+
</div>
|
|
480
|
+
`:null}
|
|
481
|
+
</section>
|
|
482
|
+
`}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||S(`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:S(`requestFailed`)}}async saveTerminalShellConfig(e,t=this.customShellProfiles(),n=S(`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||S(`requestFailed`));this.terminalShellConfig=i,this.markSaved(n)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}async addCustomTerminalShell(){let e=this.customShellCommand.trim();if(!e){this.error=S(`terminalShellProfileRequired`),this.requestUpdate();return}let t={id:Ye(),name:Xe(e),command:e,builtin:!1},n=[...this.customShellProfiles(),t];this.customShellCommand=``,this.customShellEditorOpen=!1,await this.saveTerminalShellConfig(t.id,n,S(`terminalShellProfilesSaved`))}async deleteCustomTerminalShell(e){let t=this.terminalShellConfig.profiles.find(t=>t.id===e);if(!t||t.builtin||!await C({description:S(`terminalShellDeleteConfirm`,{name:t.name}),confirmLabel:S(`confirmDelete`),cancelLabel:S(`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,S(`terminalShellProfilesSaved`))}async saveDefaultModelOptions(){try{let e=this.selectedModel?.reasoning?this.thinkingLevel:`off`;await ye(_(),{model:this.selectedModel,thinkingLevel:e}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}async saveToolDisplayOptions(){try{await Oe(_(),{toolDisplayMode:this.toolDisplayMode,showContextUsage:this.showContextUsage}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}async saveAutoCompactOptions(){try{await ze(_(),{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:S(`requestFailed`),this.requestUpdate()}}async saveAutoArchiveOptions(){try{if(await We(_(),{enabled:this.autoArchiveEnabled}),this.markSaved(S(`autoArchiveSaved`)),typeof BroadcastChannel<`u`)try{let e=new BroadcastChannel(`quickforge-sync`);e.postMessage({type:`settings-changed`,sourceTabId:`default-options-settings-tab`,timestamp:Date.now()}),e.close()}catch{}}catch(e){this.error=e instanceof Error?e.message:S(`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]}terminalShellSettings(){let e=this.terminalShellConfig.profiles,t=this.selectedTerminalShellProfileId(),n=e.find(e=>e.id===t),r=this.customShellEditorOpen||e.length===0;return h`
|
|
483
|
+
<section class="quickforge-settings-section" aria-label=${S(`terminalShell`)}>
|
|
484
|
+
<div class="quickforge-settings-row">
|
|
485
|
+
<div class="quickforge-settings-row-main">
|
|
486
|
+
<div class="quickforge-settings-row-title">
|
|
487
|
+
${S(`terminalShellDefault`)}
|
|
488
|
+
<quickforge-info-tip .label=${S(`terminalShellDescription`)}></quickforge-info-tip>
|
|
410
489
|
</div>
|
|
411
490
|
<div class="quickforge-settings-row-description quickforge-settings-mono">
|
|
412
|
-
${n?.command||
|
|
491
|
+
${n?.command||S(`terminalShellNoDetected`)}
|
|
413
492
|
</div>
|
|
414
493
|
</div>
|
|
415
494
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -417,18 +496,18 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
417
496
|
data-terminal-shell-select
|
|
418
497
|
class="quickforge-settings-select"
|
|
419
498
|
.value=${r?F:t}
|
|
420
|
-
aria-label=${
|
|
499
|
+
aria-label=${S(`terminalShellDefault`)}
|
|
421
500
|
@change=${e=>this.updateTerminalShellSelection(e.target.value)}
|
|
422
501
|
>
|
|
423
502
|
${e.map(e=>h`<option value=${e.id}>${e.name}</option>`)}
|
|
424
|
-
<option value=${F}>${
|
|
503
|
+
<option value=${F}>${S(`terminalShellCustomOption`)}</option>
|
|
425
504
|
</select>
|
|
426
505
|
${n&&!n.builtin&&!r?h`
|
|
427
506
|
<button
|
|
428
507
|
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
429
508
|
type="button"
|
|
430
|
-
title=${
|
|
431
|
-
aria-label=${
|
|
509
|
+
title=${S(`delete`)}
|
|
510
|
+
aria-label=${S(`delete`)}
|
|
432
511
|
@click=${()=>this.deleteCustomTerminalShell(n.id)}
|
|
433
512
|
>
|
|
434
513
|
${Ze}
|
|
@@ -440,25 +519,25 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
440
519
|
${r?h`
|
|
441
520
|
<div class="quickforge-settings-row">
|
|
442
521
|
<div class="quickforge-settings-row-main">
|
|
443
|
-
<div class="quickforge-settings-row-title">${
|
|
444
|
-
<div class="quickforge-settings-row-description">${
|
|
522
|
+
<div class="quickforge-settings-row-title">${S(`terminalShellCommand`)}</div>
|
|
523
|
+
<div class="quickforge-settings-row-description">${S(`terminalShellCustomDescription`)}</div>
|
|
445
524
|
</div>
|
|
446
525
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-terminal-shell-command-control">
|
|
447
526
|
<input
|
|
448
527
|
class="quickforge-settings-input quickforge-settings-mono"
|
|
449
528
|
type="text"
|
|
450
529
|
.value=${this.customShellCommand}
|
|
451
|
-
placeholder=${
|
|
530
|
+
placeholder=${S(`terminalShellCommandPlaceholder`)}
|
|
452
531
|
@input=${e=>{this.customShellCommand=e.target.value}}
|
|
453
532
|
/>
|
|
454
533
|
<button
|
|
455
534
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
456
535
|
type="button"
|
|
457
|
-
title=${
|
|
458
|
-
aria-label=${
|
|
536
|
+
title=${S(`terminalShellAdd`)}
|
|
537
|
+
aria-label=${S(`terminalShellAdd`)}
|
|
459
538
|
@click=${()=>this.addCustomTerminalShell()}
|
|
460
539
|
>
|
|
461
|
-
${
|
|
540
|
+
${S(`terminalShellAdd`)}
|
|
462
541
|
</button>
|
|
463
542
|
</div>
|
|
464
543
|
</div>
|
|
@@ -483,16 +562,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
483
562
|
/>
|
|
484
563
|
<span aria-hidden="true"></span>
|
|
485
564
|
</label>
|
|
486
|
-
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${
|
|
565
|
+
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${S(`loading`)}</div>`:h`
|
|
487
566
|
<div class="quickforge-settings-stack">
|
|
488
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
567
|
+
<section class="quickforge-settings-section" aria-label=${S(`defaultOptions`)}>
|
|
489
568
|
<div class="quickforge-settings-row">
|
|
490
569
|
<div class="quickforge-settings-row-main">
|
|
491
570
|
<div class="quickforge-settings-row-title">
|
|
492
|
-
${
|
|
493
|
-
<quickforge-info-tip .label=${
|
|
571
|
+
${S(`language`)}
|
|
572
|
+
<quickforge-info-tip .label=${S(`languageDescription`)}></quickforge-info-tip>
|
|
494
573
|
</div>
|
|
495
|
-
<div class="quickforge-settings-row-description">${
|
|
574
|
+
<div class="quickforge-settings-row-description">${S(`displayLanguage`)}</div>
|
|
496
575
|
</div>
|
|
497
576
|
<div class="quickforge-settings-row-control">
|
|
498
577
|
<select
|
|
@@ -501,16 +580,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
501
580
|
.value=${this.selectedLanguage}
|
|
502
581
|
@change=${e=>this.updateLanguage(e.target.value)}
|
|
503
582
|
>
|
|
504
|
-
<option value="zh">${
|
|
505
|
-
<option value="en">${
|
|
583
|
+
<option value="zh">${S(`simplifiedChinese`)}</option>
|
|
584
|
+
<option value="en">${S(`english`)}</option>
|
|
506
585
|
</select>
|
|
507
586
|
</div>
|
|
508
587
|
</div>
|
|
509
588
|
|
|
510
589
|
<div class="quickforge-settings-row">
|
|
511
590
|
<div class="quickforge-settings-row-main">
|
|
512
|
-
<div class="quickforge-settings-row-title">${
|
|
513
|
-
<div class="quickforge-settings-row-description">${
|
|
591
|
+
<div class="quickforge-settings-row-title">${S(`defaultModel`)}</div>
|
|
592
|
+
<div class="quickforge-settings-row-description">${S(`defaultModelDescription`)}</div>
|
|
514
593
|
</div>
|
|
515
594
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
516
595
|
<select
|
|
@@ -519,7 +598,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
519
598
|
.value=${this.selectedModel?I(this.selectedModel):``}
|
|
520
599
|
@change=${e=>this.updateModel(e.target.value)}
|
|
521
600
|
>
|
|
522
|
-
${this.modelOptions().length===0?h`<option value="">${
|
|
601
|
+
${this.modelOptions().length===0?h`<option value="">${S(`noModelAvailable`)}</option>`:this.modelOptions().map(e=>h`
|
|
523
602
|
<option .value=${I(e)}>${Je(e)}</option>
|
|
524
603
|
`)}
|
|
525
604
|
</select>
|
|
@@ -528,9 +607,9 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
528
607
|
|
|
529
608
|
<div class="quickforge-settings-row">
|
|
530
609
|
<div class="quickforge-settings-row-main">
|
|
531
|
-
<div class="quickforge-settings-row-title">${
|
|
610
|
+
<div class="quickforge-settings-row-title">${S(`defaultThinkingLevel`)}</div>
|
|
532
611
|
<div class="quickforge-settings-row-description">
|
|
533
|
-
${this.selectedModel?.reasoning?
|
|
612
|
+
${this.selectedModel?.reasoning?S(`defaultThinkingLevelDescription`):S(`thinkingRequiresReasoningModel`)}
|
|
534
613
|
</div>
|
|
535
614
|
</div>
|
|
536
615
|
<div class="quickforge-settings-row-control">
|
|
@@ -551,13 +630,13 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
551
630
|
<div class="quickforge-settings-row">
|
|
552
631
|
<div class="quickforge-settings-row-main">
|
|
553
632
|
<div class="quickforge-settings-row-title">
|
|
554
|
-
${
|
|
555
|
-
<quickforge-info-tip .label=${
|
|
633
|
+
${S(`toolDisplay`)}
|
|
634
|
+
<quickforge-info-tip .label=${S(`toolDisplayModeDescription`)}></quickforge-info-tip>
|
|
556
635
|
</div>
|
|
557
|
-
<div class="quickforge-settings-row-description">${
|
|
636
|
+
<div class="quickforge-settings-row-description">${S(`toolDisplayModeDescription`)}</div>
|
|
558
637
|
</div>
|
|
559
638
|
<div class="quickforge-settings-row-control">
|
|
560
|
-
<div class="quickforge-settings-segmented" role="group" aria-label=${
|
|
639
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${S(`toolDisplay`)}>
|
|
561
640
|
${Ke.map(e=>this.renderToolDisplayModeOption(e))}
|
|
562
641
|
</div>
|
|
563
642
|
</div>
|
|
@@ -566,10 +645,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
566
645
|
<div class="quickforge-settings-row">
|
|
567
646
|
<div class="quickforge-settings-row-main">
|
|
568
647
|
<div class="quickforge-settings-row-title">
|
|
569
|
-
${
|
|
570
|
-
<quickforge-info-tip .label=${
|
|
648
|
+
${S(`showContextUsage`)}
|
|
649
|
+
<quickforge-info-tip .label=${S(`showContextUsageDescription`)}></quickforge-info-tip>
|
|
571
650
|
</div>
|
|
572
|
-
<div class="quickforge-settings-row-description">${
|
|
651
|
+
<div class="quickforge-settings-row-description">${S(`showContextUsageDescription`)}</div>
|
|
573
652
|
</div>
|
|
574
653
|
<div class="quickforge-settings-row-control">
|
|
575
654
|
${this.renderSwitch(this.showContextUsage,e=>this.updateShowContextUsage(e))}
|
|
@@ -579,10 +658,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
579
658
|
<div class="quickforge-settings-row">
|
|
580
659
|
<div class="quickforge-settings-row-main">
|
|
581
660
|
<div class="quickforge-settings-row-title">
|
|
582
|
-
${
|
|
583
|
-
<quickforge-info-tip .label=${
|
|
661
|
+
${S(`autoArchiveEnabled`)}
|
|
662
|
+
<quickforge-info-tip .label=${S(`autoArchiveDescription`)}></quickforge-info-tip>
|
|
584
663
|
</div>
|
|
585
|
-
<div class="quickforge-settings-row-description">${
|
|
664
|
+
<div class="quickforge-settings-row-description">${S(`autoArchiveTriggerNote`)}</div>
|
|
586
665
|
</div>
|
|
587
666
|
<div class="quickforge-settings-row-control">
|
|
588
667
|
${this.renderSwitch(this.autoArchiveEnabled,e=>this.updateAutoArchiveEnabled(e))}
|
|
@@ -592,10 +671,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
592
671
|
<div class="quickforge-settings-row">
|
|
593
672
|
<div class="quickforge-settings-row-main">
|
|
594
673
|
<div class="quickforge-settings-row-title">
|
|
595
|
-
${
|
|
596
|
-
<quickforge-info-tip .label=${
|
|
674
|
+
${S(`autoCompactEnabled`)}
|
|
675
|
+
<quickforge-info-tip .label=${S(`autoCompactDescription`)}></quickforge-info-tip>
|
|
597
676
|
</div>
|
|
598
|
-
<div class="quickforge-settings-row-description">${
|
|
677
|
+
<div class="quickforge-settings-row-description">${S(`autoCompactTriggerNote`)}</div>
|
|
599
678
|
</div>
|
|
600
679
|
<div class="quickforge-settings-row-control">
|
|
601
680
|
${this.renderSwitch(this.autoCompactEnabled,e=>this.updateAutoCompactEnabled(e))}
|
|
@@ -604,8 +683,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
604
683
|
|
|
605
684
|
<div class="quickforge-settings-row">
|
|
606
685
|
<div class="quickforge-settings-row-main">
|
|
607
|
-
<div class="quickforge-settings-row-title">${
|
|
608
|
-
<div class="quickforge-settings-row-description">${
|
|
686
|
+
<div class="quickforge-settings-row-title">${S(`autoCompactRequireConfirmation`)}</div>
|
|
687
|
+
<div class="quickforge-settings-row-description">${S(`autoCompactRequireConfirmationDescription`)}</div>
|
|
609
688
|
</div>
|
|
610
689
|
<div class="quickforge-settings-row-control">
|
|
611
690
|
${this.renderSwitch(this.autoCompactRequireConfirmation,e=>this.updateAutoCompactRequireConfirmation(e),!this.autoCompactEnabled)}
|
|
@@ -614,8 +693,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
614
693
|
|
|
615
694
|
<div class="quickforge-settings-row">
|
|
616
695
|
<div class="quickforge-settings-row-main">
|
|
617
|
-
<div class="quickforge-settings-row-title">${
|
|
618
|
-
<div class="quickforge-settings-row-description">${
|
|
696
|
+
<div class="quickforge-settings-row-title">${S(`autoCompactThresholdPercent`)}</div>
|
|
697
|
+
<div class="quickforge-settings-row-description">${S(`autoCompactThresholdDescription`)}</div>
|
|
619
698
|
</div>
|
|
620
699
|
<div class="quickforge-settings-row-control">
|
|
621
700
|
<input
|
|
@@ -636,10 +715,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
636
715
|
<div class="quickforge-settings-row">
|
|
637
716
|
<div class="quickforge-settings-row-main">
|
|
638
717
|
<div class="quickforge-settings-row-title">
|
|
639
|
-
${
|
|
640
|
-
<quickforge-info-tip .label=${
|
|
718
|
+
${S(`autoCompactKeepRecentTurns`)}
|
|
719
|
+
<quickforge-info-tip .label=${S(`autoCompactHistoryPreserved`)}></quickforge-info-tip>
|
|
641
720
|
</div>
|
|
642
|
-
<div class="quickforge-settings-row-description">${
|
|
721
|
+
<div class="quickforge-settings-row-description">${S(`autoCompactKeepRecentTurnsDescription`)}</div>
|
|
643
722
|
</div>
|
|
644
723
|
<div class="quickforge-settings-row-control">
|
|
645
724
|
<input
|
|
@@ -658,12 +737,14 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
658
737
|
</div>
|
|
659
738
|
</section>
|
|
660
739
|
|
|
740
|
+
${this.networkProxySettings()}
|
|
741
|
+
|
|
661
742
|
${this.terminalShellSettings()}
|
|
662
743
|
|
|
663
|
-
${this.saved?h`<div class="quickforge-settings-message">${this.savedMessage||
|
|
664
|
-
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
744
|
+
${this.saved?h`<div class="quickforge-settings-message" role="status">${this.savedMessage||S(`defaultOptionsSaved`)}</div>`:null}
|
|
745
|
+
${this.error?h`<div class="quickforge-settings-alert" role="alert">${this.error}</div>`:null}
|
|
665
746
|
</div>
|
|
666
|
-
`}},L=`quickforge-default-options-settings-tab`;customElements.get(L)||customElements.define(L,Qe);function $e(){return document.createElement(L)}var et=`memory-settings`,tt={enabled:!0};function nt(e){return!e||typeof e!=`object`?{...tt}:{enabled:e.enabled!==!1}}async function rt(e){return nt(await e.settings.get(et))}async function it(e,t){await e.settings.set(et,nt(t))}var at=class extends g{enabled=!0;loading=!0;saving=!1;loadingDocument=!1;markdown=``;savedMarkdown=``;memoryPath=`~/.quickforge/MEMORY.md`;message=``;error=``;getTabName(){return
|
|
747
|
+
`}},L=`quickforge-default-options-settings-tab`;customElements.get(L)||customElements.define(L,Qe);function $e(){return document.createElement(L)}var et=`memory-settings`,tt={enabled:!0};function nt(e){return!e||typeof e!=`object`?{...tt}:{enabled:e.enabled!==!1}}async function rt(e){return nt(await e.settings.get(et))}async function it(e,t){await e.settings.set(et,nt(t))}var at=class extends g{enabled=!0;loading=!0;saving=!1;loadingDocument=!1;markdown=``;savedMarkdown=``;memoryPath=`~/.quickforge/MEMORY.md`;message=``;error=``;getTabName(){return S(`memory`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let[e]=await Promise.all([rt(_()),this.loadDocument()]);this.enabled=e.enabled}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadDocument(e=!1){this.loadingDocument=!0,this.error=``,e&&(this.message=``),this.requestUpdate();try{let t=await fetch(`/api/memory`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(!t.ok||!n)throw Error(n?.error||S(`requestFailed`));this.markdown=n.markdown,this.savedMarkdown=n.markdown,this.memoryPath=n.path||this.memoryPath,e&&(this.message=S(`memoryReloaded`))}finally{this.loadingDocument=!1,this.requestUpdate()}}async updateEnabled(e){let t=this.enabled;this.enabled=e,this.saving=!0,this.message=``,this.error=``,this.requestUpdate();try{await it(_(),{enabled:e}),this.message=S(e?`memoryEnabledSaved`:`memoryDisabledSaved`)}catch(e){this.enabled=t,this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}async reloadDocument(){try{await this.loadDocument(!0)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`),this.requestUpdate()}}async saveDocument(){if(!(!this.enabled||this.saving)){this.saving=!0,this.message=``,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/memory`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({markdown:this.markdown})}),t=await e.json().catch(()=>null);if(!e.ok||!t)throw Error(t?.error||S(`requestFailed`));this.markdown=t.markdown,this.savedMarkdown=t.markdown,this.memoryPath=t.path||this.memoryPath,this.message=S(`memoryContentSaved`)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}renderSwitch(){return h`
|
|
667
748
|
<label class="quickforge-settings-switch" aria-disabled=${this.saving?`true`:`false`}>
|
|
668
749
|
<input
|
|
669
750
|
type="checkbox"
|
|
@@ -673,24 +754,24 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
673
754
|
/>
|
|
674
755
|
<span aria-hidden="true"></span>
|
|
675
756
|
</label>
|
|
676
|
-
`}render(){if(this.loading)return h`<div class="text-sm text-muted-foreground">${
|
|
757
|
+
`}render(){if(this.loading)return h`<div class="text-sm text-muted-foreground">${S(`loading`)}</div>`;let e=this.markdown!==this.savedMarkdown,t=this.saving||this.loadingDocument;return h`
|
|
677
758
|
<div class="quickforge-settings-stack">
|
|
678
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
759
|
+
<section class="quickforge-settings-section" aria-label=${S(`memory`)}>
|
|
679
760
|
<div class="quickforge-settings-row">
|
|
680
761
|
<div class="quickforge-settings-row-main">
|
|
681
762
|
<div class="quickforge-settings-row-title">
|
|
682
|
-
${
|
|
683
|
-
<quickforge-info-tip .label=${
|
|
763
|
+
${S(`globalMemory`)}
|
|
764
|
+
<quickforge-info-tip .label=${S(`globalMemoryInfo`)}></quickforge-info-tip>
|
|
684
765
|
</div>
|
|
685
|
-
<div class="quickforge-settings-row-description">${
|
|
766
|
+
<div class="quickforge-settings-row-description">${S(`globalMemoryDescription`)}</div>
|
|
686
767
|
</div>
|
|
687
768
|
<div class="quickforge-settings-row-control">${this.renderSwitch()}</div>
|
|
688
769
|
</div>
|
|
689
770
|
|
|
690
771
|
<div class="quickforge-settings-row">
|
|
691
772
|
<div class="quickforge-settings-row-main">
|
|
692
|
-
<div class="quickforge-settings-row-title">${
|
|
693
|
-
<div class="quickforge-settings-row-description">${
|
|
773
|
+
<div class="quickforge-settings-row-title">${S(`memoryFile`)}</div>
|
|
774
|
+
<div class="quickforge-settings-row-description">${S(`memoryFileDescription`)}</div>
|
|
694
775
|
</div>
|
|
695
776
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
696
777
|
<code class="text-xs text-muted-foreground">${this.memoryPath}</code>
|
|
@@ -699,8 +780,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
699
780
|
|
|
700
781
|
<div class="quickforge-settings-row quickforge-settings-row-align-start quickforge-memory-content-row">
|
|
701
782
|
<div class="quickforge-settings-row-main">
|
|
702
|
-
<div class="quickforge-settings-row-title">${
|
|
703
|
-
<div class="quickforge-settings-row-description">${this.enabled?
|
|
783
|
+
<div class="quickforge-settings-row-title">${S(`memoryContent`)}</div>
|
|
784
|
+
<div class="quickforge-settings-row-description">${this.enabled?S(`memoryContentDescription`):S(`memoryContentDisabledDescription`)}</div>
|
|
704
785
|
</div>
|
|
705
786
|
<div class="quickforge-memory-editor-control">
|
|
706
787
|
<textarea
|
|
@@ -716,24 +797,24 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
716
797
|
type="button"
|
|
717
798
|
?disabled=${t}
|
|
718
799
|
@click=${()=>void this.reloadDocument()}
|
|
719
|
-
>${this.loadingDocument?
|
|
800
|
+
>${this.loadingDocument?S(`loading`):S(`memoryReload`)}</button>
|
|
720
801
|
<button
|
|
721
802
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
722
803
|
type="button"
|
|
723
804
|
?disabled=${!this.enabled||t||!e}
|
|
724
805
|
@click=${()=>void this.saveDocument()}
|
|
725
|
-
>${this.saving?
|
|
806
|
+
>${this.saving?S(`saving`):S(`memorySave`)}</button>
|
|
726
807
|
</div>
|
|
727
808
|
</div>
|
|
728
809
|
</div>
|
|
729
810
|
|
|
730
|
-
<div class="quickforge-settings-note">${
|
|
811
|
+
<div class="quickforge-settings-note">${S(`memoryCurrentSessionNote`)}</div>
|
|
731
812
|
</section>
|
|
732
813
|
|
|
733
814
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
734
815
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
735
816
|
</div>
|
|
736
|
-
`}},R=`quickforge-memory-settings-tab`;customElements.get(R)||customElements.define(R,at);function ot(){return document.createElement(R)}var st=`quickforge-backup`,z=[{id:`settings`,countKey:`settings`,label:()=>
|
|
817
|
+
`}},R=`quickforge-memory-settings-tab`;customElements.get(R)||customElements.define(R,at);function ot(){return document.createElement(R)}var st=`quickforge-backup`,z=[{id:`settings`,countKey:`settings`,label:()=>S(`restoreSettings`),description:()=>S(`restoreSettingsDescription`)},{id:`mcp`,countKey:`mcp`,label:()=>S(`restoreMcp`),description:()=>S(`restoreMcpDescription`)},{id:`providerKeys`,countKey:`providerKeys`,label:()=>S(`restoreProviderKeys`),description:()=>S(`restoreProviderKeysDescription`)},{id:`customProviders`,countKey:`customProviders`,label:()=>S(`restoreCustomProviders`),description:()=>S(`restoreCustomProvidersDescription`)},{id:`scheduledTasks`,countKey:`scheduledTasks`,label:()=>S(`restoreScheduledTasks`),description:()=>S(`restoreScheduledTasksDescription`)}],ct=z;function lt(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 ut(){return new Date().toISOString().replace(/[:.]/g,`-`)}function dt(e){return e?Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`, `):``}function ft(e){return ct.filter(t=>(e.sections?.[t.countKey]??0)>0)}function pt(e){return ft(e).map(e=>e.id)}function mt(e){return e instanceof RangeError||e instanceof Error&&e.message.includes(`Invalid string length`)}function B(e,t){return mt(e)?S(`backupStringTooLarge`):e instanceof Error?e.message:t}var ht=class extends g{exportSections=new Set(z.map(e=>e.id));busy=!1;message=``;error=``;safetyBackupPath=``;pendingImport=null;getTabName(){return S(`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=S(`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||S(`backupExportFailed`));lt(`${st}-settings-${ut()}.json`,n),this.message=S(`backupExported`)}catch(e){this.error=B(e,S(`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||S(`backupInspectFailed`));if(!n)throw Error(S(`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(pt(t));this.pendingImport={backup:null,importToken:t.importToken,inspect:t,selectedSections:n,mode:`replace`},this.message=t.ignoredConversations?S(`backupInspectedWithIgnoredConversations`):S(`backupInspected`)}catch(e){this.error=B(e,S(`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=S(`selectAtLeastOneRestoreSection`),this.requestUpdate();return}if(await C({description:this.pendingImport.mode===`replace`?S(`backupImportReplaceConfirm`):S(`backupImportMergeConfirm`),confirmLabel:S(`confirmImportSelected`),cancelLabel:S(`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||S(`backupImportFailed`));let r=dt(n?.summary);this.safetyBackupPath=n?.safetyBackupPath||``,this.pendingImport=null,this.message=r?`${S(`backupImported`)} ${r}`:S(`backupImported`),window.setTimeout(()=>window.location.reload(),1500)}catch(e){this.error=B(e,S(`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 h`
|
|
737
818
|
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
738
819
|
<input
|
|
739
820
|
type="checkbox"
|
|
@@ -744,38 +825,38 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
744
825
|
<span aria-hidden="true"></span>
|
|
745
826
|
</label>
|
|
746
827
|
`}renderPendingImport(){if(!this.pendingImport)return null;let{inspect:e,selectedSections:t}=this.pendingImport,n=ft(e);return h`
|
|
747
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
828
|
+
<section class="quickforge-settings-section" aria-label=${S(`backupInspectTitle`)}>
|
|
748
829
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
749
830
|
<div class="quickforge-settings-row-main">
|
|
750
|
-
<div class="quickforge-settings-row-title">${
|
|
751
|
-
<div class="quickforge-settings-row-description">${
|
|
831
|
+
<div class="quickforge-settings-row-title">${S(`backupInspectTitle`)}</div>
|
|
832
|
+
<div class="quickforge-settings-row-description">${S(`backupInspectDescription`)}</div>
|
|
752
833
|
</div>
|
|
753
834
|
</div>
|
|
754
835
|
|
|
755
836
|
<div class="quickforge-settings-nested-list">
|
|
756
837
|
<div class="quickforge-settings-subrow">
|
|
757
838
|
<div class="quickforge-settings-row-main">
|
|
758
|
-
<div class="quickforge-settings-row-title">${
|
|
839
|
+
<div class="quickforge-settings-row-title">${S(`backupInspectExportedAt`)}</div>
|
|
759
840
|
</div>
|
|
760
841
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.exportedAt||`-`}</div>
|
|
761
842
|
</div>
|
|
762
843
|
<div class="quickforge-settings-subrow">
|
|
763
844
|
<div class="quickforge-settings-row-main">
|
|
764
|
-
<div class="quickforge-settings-row-title">${
|
|
845
|
+
<div class="quickforge-settings-row-title">${S(`backupInspectVersion`)}</div>
|
|
765
846
|
</div>
|
|
766
847
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version??`-`}</div>
|
|
767
848
|
</div>
|
|
768
849
|
<div class="quickforge-settings-subrow">
|
|
769
850
|
<div class="quickforge-settings-row-main">
|
|
770
|
-
<div class="quickforge-settings-row-title">${
|
|
851
|
+
<div class="quickforge-settings-row-title">${S(`backupInspectScope`)}</div>
|
|
771
852
|
</div>
|
|
772
853
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.scope||`-`}</div>
|
|
773
854
|
</div>
|
|
774
855
|
<div class="quickforge-settings-subrow">
|
|
775
856
|
<div class="quickforge-settings-row-main">
|
|
776
|
-
<div class="quickforge-settings-row-title">${
|
|
857
|
+
<div class="quickforge-settings-row-title">${S(`backupInspectSecrets`)}</div>
|
|
777
858
|
</div>
|
|
778
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.includeSecrets?
|
|
859
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.includeSecrets?S(`yes`):S(`no`)}</div>
|
|
779
860
|
</div>
|
|
780
861
|
</div>
|
|
781
862
|
|
|
@@ -787,25 +868,25 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
787
868
|
|
|
788
869
|
${e.invalidSections&&Object.keys(e.invalidSections).length?h`
|
|
789
870
|
<div class="quickforge-settings-warning quickforge-settings-warning-attached">
|
|
790
|
-
<div>${
|
|
871
|
+
<div>${S(`backupInvalidSections`)}</div>
|
|
791
872
|
${Object.entries(e.invalidSections).map(([e,t])=>h`<div>${e}: ${t}</div>`)}
|
|
792
873
|
</div>
|
|
793
874
|
`:null}
|
|
794
875
|
|
|
795
876
|
<div class="quickforge-settings-row">
|
|
796
877
|
<div class="quickforge-settings-row-main">
|
|
797
|
-
<div class="quickforge-settings-row-title">${
|
|
798
|
-
<div class="quickforge-settings-row-description">${
|
|
878
|
+
<div class="quickforge-settings-row-title">${S(`restoreMode`)}</div>
|
|
879
|
+
<div class="quickforge-settings-row-description">${S(`restoreModeDescription`)}</div>
|
|
799
880
|
</div>
|
|
800
881
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
801
|
-
<div class="quickforge-settings-segmented" role="group" aria-label=${
|
|
882
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${S(`restoreMode`)}>
|
|
802
883
|
<button
|
|
803
884
|
type="button"
|
|
804
885
|
class="quickforge-settings-segmented-option ${this.pendingImport.mode===`replace`?`quickforge-settings-segmented-option-active`:``}"
|
|
805
886
|
?disabled=${this.busy}
|
|
806
887
|
@click=${()=>this.setRestoreMode(`replace`)}
|
|
807
888
|
>
|
|
808
|
-
${
|
|
889
|
+
${S(`restoreModeReplace`)}
|
|
809
890
|
</button>
|
|
810
891
|
<button
|
|
811
892
|
type="button"
|
|
@@ -813,7 +894,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
813
894
|
?disabled=${this.busy}
|
|
814
895
|
@click=${()=>this.setRestoreMode(`merge`)}
|
|
815
896
|
>
|
|
816
|
-
${
|
|
897
|
+
${S(`restoreModeMerge`)}
|
|
817
898
|
</button>
|
|
818
899
|
</div>
|
|
819
900
|
</div>
|
|
@@ -821,9 +902,9 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
821
902
|
|
|
822
903
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
823
904
|
<div class="quickforge-settings-row-main">
|
|
824
|
-
<div class="quickforge-settings-row-title">${
|
|
905
|
+
<div class="quickforge-settings-row-title">${S(`selectRestoreSections`)}</div>
|
|
825
906
|
<div class="quickforge-settings-row-description">
|
|
826
|
-
${this.pendingImport.mode===`replace`?
|
|
907
|
+
${this.pendingImport.mode===`replace`?S(`restoreModeReplaceDescription`):S(`restoreModeMergeDescription`)}
|
|
827
908
|
</div>
|
|
828
909
|
</div>
|
|
829
910
|
</div>
|
|
@@ -843,8 +924,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
843
924
|
|
|
844
925
|
<div class="quickforge-settings-row">
|
|
845
926
|
<div class="quickforge-settings-row-main">
|
|
846
|
-
<div class="quickforge-settings-row-title">${
|
|
847
|
-
<div class="quickforge-settings-row-description">${
|
|
927
|
+
<div class="quickforge-settings-row-title">${S(`backupImportActions`)}</div>
|
|
928
|
+
<div class="quickforge-settings-row-description">${S(`backupImportActionsDescription`)}</div>
|
|
848
929
|
</div>
|
|
849
930
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
850
931
|
<button
|
|
@@ -853,7 +934,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
853
934
|
?disabled=${this.busy||t.size===0}
|
|
854
935
|
@click=${()=>this.confirmPendingImport()}
|
|
855
936
|
>
|
|
856
|
-
${this.busy?
|
|
937
|
+
${this.busy?S(`loading`):S(`confirmImportSelected`)}
|
|
857
938
|
</button>
|
|
858
939
|
<button
|
|
859
940
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
@@ -861,21 +942,21 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
861
942
|
?disabled=${this.busy}
|
|
862
943
|
@click=${()=>this.cancelPendingImport()}
|
|
863
944
|
>
|
|
864
|
-
${
|
|
945
|
+
${S(`cancel`)}
|
|
865
946
|
</button>
|
|
866
947
|
</div>
|
|
867
948
|
</div>
|
|
868
949
|
</section>
|
|
869
950
|
`}render(){return h`
|
|
870
951
|
<div class="quickforge-settings-stack">
|
|
871
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
952
|
+
<section class="quickforge-settings-section" aria-label=${S(`exportData`)}>
|
|
872
953
|
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
873
954
|
<div class="quickforge-settings-row-main">
|
|
874
955
|
<div class="quickforge-settings-row-title">
|
|
875
|
-
${
|
|
876
|
-
<quickforge-info-tip .label=${
|
|
956
|
+
${S(`selectExportSections`)}
|
|
957
|
+
<quickforge-info-tip .label=${S(`exportDataDescription`)}></quickforge-info-tip>
|
|
877
958
|
</div>
|
|
878
|
-
<div class="quickforge-settings-row-description">${
|
|
959
|
+
<div class="quickforge-settings-row-description">${S(`selectExportSectionsDescription`)}</div>
|
|
879
960
|
</div>
|
|
880
961
|
</div>
|
|
881
962
|
|
|
@@ -893,12 +974,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
893
974
|
`)}
|
|
894
975
|
</div>
|
|
895
976
|
|
|
896
|
-
<div class="quickforge-settings-note">${
|
|
977
|
+
<div class="quickforge-settings-note">${S(`conversationBackupExcluded`)}</div>
|
|
897
978
|
|
|
898
979
|
<div class="quickforge-settings-row">
|
|
899
980
|
<div class="quickforge-settings-row-main">
|
|
900
|
-
<div class="quickforge-settings-row-title">${
|
|
901
|
-
<div class="quickforge-settings-row-description">${
|
|
981
|
+
<div class="quickforge-settings-row-title">${S(`exportBackup`)}</div>
|
|
982
|
+
<div class="quickforge-settings-row-description">${S(`exportBackupDescription`)}</div>
|
|
902
983
|
</div>
|
|
903
984
|
<div class="quickforge-settings-row-control">
|
|
904
985
|
<button
|
|
@@ -907,20 +988,20 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
907
988
|
?disabled=${this.busy||this.exportSections.size===0}
|
|
908
989
|
@click=${()=>this.exportBackup()}
|
|
909
990
|
>
|
|
910
|
-
${this.busy?
|
|
991
|
+
${this.busy?S(`loading`):S(`exportBackup`)}
|
|
911
992
|
</button>
|
|
912
993
|
</div>
|
|
913
994
|
</div>
|
|
914
995
|
</section>
|
|
915
996
|
|
|
916
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
997
|
+
<section class="quickforge-settings-section" aria-label=${S(`importData`)}>
|
|
917
998
|
<div class="quickforge-settings-row">
|
|
918
999
|
<div class="quickforge-settings-row-main">
|
|
919
1000
|
<div class="quickforge-settings-row-title">
|
|
920
|
-
${
|
|
921
|
-
<quickforge-info-tip .label=${
|
|
1001
|
+
${S(`importBackup`)}
|
|
1002
|
+
<quickforge-info-tip .label=${S(`importDataDescription`)}></quickforge-info-tip>
|
|
922
1003
|
</div>
|
|
923
|
-
<div class="quickforge-settings-row-description">${
|
|
1004
|
+
<div class="quickforge-settings-row-description">${S(`importDataDescription`)}</div>
|
|
924
1005
|
</div>
|
|
925
1006
|
<div class="quickforge-settings-row-control">
|
|
926
1007
|
<label class="quickforge-settings-button quickforge-settings-button-secondary ${this.busy?`pointer-events-none opacity-60`:``}">
|
|
@@ -931,7 +1012,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
931
1012
|
?disabled=${this.busy}
|
|
932
1013
|
@change=${e=>this.handleFileChange(e)}
|
|
933
1014
|
/>
|
|
934
|
-
${
|
|
1015
|
+
${S(`importBackup`)}
|
|
935
1016
|
</label>
|
|
936
1017
|
</div>
|
|
937
1018
|
</div>
|
|
@@ -939,16 +1020,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
939
1020
|
|
|
940
1021
|
${this.renderPendingImport()}
|
|
941
1022
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
942
|
-
${this.safetyBackupPath?h`<div class="quickforge-settings-note">${
|
|
1023
|
+
${this.safetyBackupPath?h`<div class="quickforge-settings-note">${S(`backupSafetyBackupPath`)}: <code>${this.safetyBackupPath}</code></div>`:null}
|
|
943
1024
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
944
1025
|
</div>
|
|
945
|
-
`}},V=`quickforge-backup-settings-tab`;customElements.get(V)||customElements.define(V,ht);function gt(){return document.createElement(V)}function _t(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(
|
|
1026
|
+
`}},V=`quickforge-backup-settings-tab`;customElements.get(V)||customElements.define(V,ht);function gt(){return document.createElement(V)}function _t(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(le())}function vt(e){let t={...e};return delete t.archivedAt,t}function H(){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 yt=class extends g{sessions=[];projects=[];loading=!0;busySessionId=``;query=``;projectFilter=`all`;message=``;error=``;getTabName(){return S(`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||S(`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:S(`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`?S(`normalChat`):this.projectNameById.get(e)||S(`unknownProject`)}async restoreSession(e){if(!this.busySessionId){this.busySessionId=e,this.message=``,this.error=``,this.requestUpdate();try{let t=_(),n=await t.sessions.get(e),r=await t.sessions.getMetadata(e);if(!n||!r)throw Error(S(`sessionNotFound`));await t.sessions.save(vt(n),vt(r)),this.sessions=this.sessions.filter(t=>t.id!==e),this.message=S(`sessionRestored`),H()}catch(e){this.error=e instanceof Error?e.message:S(`restoreSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteSession(e){if(!this.busySessionId&&await C({description:S(`deleteArchivedSessionConfirm`,{title:E(e.title)}),confirmLabel:S(`confirmDelete`),cancelLabel:S(`cancel`),variant:`destructive`})){this.busySessionId=e.id,this.message=``,this.error=``,this.requestUpdate();try{await _().sessions.delete(e.id),this.sessions=this.sessions.filter(t=>t.id!==e.id),this.message=S(`archivedSessionDeleted`),H()}catch(e){this.error=e instanceof Error?e.message:S(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteAllArchivedSessions(){if(!(this.busySessionId||this.sessions.length===0)&&await C({description:S(`deleteAllArchivedSessionsConfirm`),confirmLabel:S(`confirmDelete`),cancelLabel:S(`cancel`),variant:`destructive`})){this.busySessionId=`__all__`,this.message=``,this.error=``,this.requestUpdate();try{let e=_();await Promise.all(this.sessions.map(t=>e.sessions.delete(t.id))),this.sessions=[],this.message=S(`archivedSessionsDeleted`),H()}catch(e){this.error=e instanceof Error?e.message:S(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}renderSession(e){let t=this.busySessionId===e.id||this.busySessionId===`__all__`;return h`
|
|
946
1027
|
<div class="border-t border-border px-4 py-3 first:border-t-0">
|
|
947
1028
|
<div class="flex items-start justify-between gap-3">
|
|
948
1029
|
<div class="min-w-0">
|
|
949
|
-
<div class="truncate text-sm font-medium text-foreground">${
|
|
1030
|
+
<div class="truncate text-sm font-medium text-foreground">${E(e.title)}</div>
|
|
950
1031
|
<div class="mt-1 text-xs text-muted-foreground">
|
|
951
|
-
${
|
|
1032
|
+
${S(`lastModified`)}: ${_t(e.lastModified)} · ${S(`archivedAt`)}: ${_t(e.archivedAt)}
|
|
952
1033
|
</div>
|
|
953
1034
|
</div>
|
|
954
1035
|
<div class="flex shrink-0 items-center gap-2">
|
|
@@ -958,7 +1039,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
958
1039
|
?disabled=${t}
|
|
959
1040
|
@click=${()=>this.restoreSession(e.id)}
|
|
960
1041
|
>
|
|
961
|
-
${
|
|
1042
|
+
${S(`restoreSession`)}
|
|
962
1043
|
</button>
|
|
963
1044
|
<button
|
|
964
1045
|
class="rounded-md px-2.5 py-1 text-xs text-destructive hover:bg-destructive/10 disabled:opacity-60"
|
|
@@ -966,7 +1047,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
966
1047
|
?disabled=${t}
|
|
967
1048
|
@click=${()=>this.deleteSession(e)}
|
|
968
1049
|
>
|
|
969
|
-
${
|
|
1050
|
+
${S(`deletePermanently`)}
|
|
970
1051
|
</button>
|
|
971
1052
|
</div>
|
|
972
1053
|
</div>
|
|
@@ -980,7 +1061,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
980
1061
|
?disabled=${!!this.busySessionId||this.sessions.length===0}
|
|
981
1062
|
@click=${()=>this.deleteAllArchivedSessions()}
|
|
982
1063
|
>
|
|
983
|
-
${
|
|
1064
|
+
${S(`deleteAll`)}
|
|
984
1065
|
</button>
|
|
985
1066
|
</div>
|
|
986
1067
|
|
|
@@ -990,7 +1071,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
990
1071
|
class="rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring/30"
|
|
991
1072
|
type="search"
|
|
992
1073
|
.value=${this.query}
|
|
993
|
-
placeholder=${
|
|
1074
|
+
placeholder=${S(`searchArchivedConversations`)}
|
|
994
1075
|
@input=${e=>{this.query=e.target.value,this.requestUpdate()}}
|
|
995
1076
|
/>
|
|
996
1077
|
<select
|
|
@@ -998,23 +1079,23 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
998
1079
|
.value=${this.projectFilter}
|
|
999
1080
|
@change=${e=>{this.projectFilter=e.target.value,this.requestUpdate()}}
|
|
1000
1081
|
>
|
|
1001
|
-
<option value="all">${
|
|
1002
|
-
<option value="global">${
|
|
1082
|
+
<option value="all">${S(`allProjects`)}</option>
|
|
1083
|
+
<option value="global">${S(`normalChat`)}</option>
|
|
1003
1084
|
${this.projects.map(e=>h`<option value=${e.id}>${e.name}</option>`)}
|
|
1004
1085
|
</select>
|
|
1005
1086
|
</div>
|
|
1006
1087
|
|
|
1007
1088
|
${this.loading?h`
|
|
1008
|
-
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${
|
|
1089
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${S(`loading`)}</div>
|
|
1009
1090
|
`:e.length===0?h`
|
|
1010
|
-
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${
|
|
1091
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${S(`noArchivedConversations`)}</div>
|
|
1011
1092
|
`:h`
|
|
1012
1093
|
<div>
|
|
1013
1094
|
${e.map(([e,t])=>h`
|
|
1014
1095
|
<div class="border-b border-border last:border-b-0">
|
|
1015
1096
|
<div class="flex items-center justify-between gap-3 bg-muted/20 px-4 py-2 text-sm text-muted-foreground">
|
|
1016
1097
|
<div class="truncate">${this.projectLabel(e)}</div>
|
|
1017
|
-
<div class="shrink-0">${
|
|
1098
|
+
<div class="shrink-0">${S(`conversationCount`,{count:t.length})}</div>
|
|
1018
1099
|
</div>
|
|
1019
1100
|
${t.map(e=>this.renderSession(e))}
|
|
1020
1101
|
</div>
|
|
@@ -1026,7 +1107,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1026
1107
|
${this.message?h`<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}
|
|
1027
1108
|
${this.error?h`<div class="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">${this.error}</div>`:null}
|
|
1028
1109
|
</div>
|
|
1029
|
-
`}},U=`quickforge-archived-conversations-settings-tab`;customElements.get(U)||customElements.define(U,yt);function bt(){return document.createElement(U)}function xt(){return Array.from({length:16},()=>`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%^&*`[Math.floor(Math.random()*65)]).join(``)}var St=class extends g{loading=!0;saving=!1;enabled=!1;hasPassword=!1;password=``;sessionTtlHours=12;activeTokenCount=0;lanUrls=[];error=``;message=``;getTabName(){return
|
|
1110
|
+
`}},U=`quickforge-archived-conversations-settings-tab`;customElements.get(U)||customElements.define(U,yt);function bt(){return document.createElement(U)}function xt(){return Array.from({length:16},()=>`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%^&*`[Math.floor(Math.random()*65)]).join(``)}var St=class extends g{loading=!0;saving=!1;enabled=!1;hasPassword=!1;password=``;sessionTtlHours=12;activeTokenCount=0;lanUrls=[];error=``;message=``;getTabName(){return S(`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||S(`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:S(`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=S(`lanAccessPasswordRequired`),this.requestUpdate();return}if(this.password.trim()&&this.password.trim().length<8){this.error=S(`lanAccessPasswordTooShort`),this.requestUpdate();return}if(!(this.enabled&&!await C({description:S(`lanAccessEnableConfirm`),confirmLabel:S(`enabled`),cancelLabel:S(`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=S(`lanAccessSaved`)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}}async revokeAll(){if(await C({description:S(`lanAccessRevokeAllConfirm`),confirmLabel:S(`lanAccessRevokeAll`),cancelLabel:S(`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=S(`lanAccessRevoked`)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}renderSwitch(e,t,n=!1){return h`
|
|
1030
1111
|
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
1031
1112
|
<input
|
|
1032
1113
|
type="checkbox"
|
|
@@ -1036,36 +1117,36 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1036
1117
|
/>
|
|
1037
1118
|
<span aria-hidden="true"></span>
|
|
1038
1119
|
</label>
|
|
1039
|
-
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${
|
|
1120
|
+
`}render(){return this.loading?h`<div class="text-sm text-muted-foreground">${S(`loading`)}</div>`:h`
|
|
1040
1121
|
<div class="quickforge-settings-stack">
|
|
1041
|
-
<div class="quickforge-settings-warning">${
|
|
1122
|
+
<div class="quickforge-settings-warning">${S(`lanAccessRiskWarning`)}</div>
|
|
1042
1123
|
|
|
1043
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1124
|
+
<section class="quickforge-settings-section" aria-label=${S(`lanAccessStatus`)}>
|
|
1044
1125
|
<div class="quickforge-settings-row">
|
|
1045
1126
|
<div class="quickforge-settings-row-main">
|
|
1046
|
-
<div class="quickforge-settings-row-title">${
|
|
1047
|
-
<div class="quickforge-settings-row-description">${
|
|
1127
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessEnabled`)}</div>
|
|
1128
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessEnabledDescription`)}</div>
|
|
1048
1129
|
</div>
|
|
1049
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.enabled?
|
|
1130
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.enabled?S(`enabled`):S(`disabled`)}</div>
|
|
1050
1131
|
</div>
|
|
1051
1132
|
<div class="quickforge-settings-row">
|
|
1052
1133
|
<div class="quickforge-settings-row-main">
|
|
1053
|
-
<div class="quickforge-settings-row-title">${
|
|
1054
|
-
<div class="quickforge-settings-row-description">${
|
|
1134
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessPassword`)}</div>
|
|
1135
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessPasswordStatusDescription`)}</div>
|
|
1055
1136
|
</div>
|
|
1056
|
-
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.hasPassword?
|
|
1137
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.hasPassword?S(`configured`):S(`notConfigured`)}</div>
|
|
1057
1138
|
</div>
|
|
1058
1139
|
<div class="quickforge-settings-row">
|
|
1059
1140
|
<div class="quickforge-settings-row-main">
|
|
1060
|
-
<div class="quickforge-settings-row-title">${
|
|
1061
|
-
<div class="quickforge-settings-row-description">${
|
|
1141
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessActiveDevices`)}</div>
|
|
1142
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessActiveDevicesDescription`)}</div>
|
|
1062
1143
|
</div>
|
|
1063
1144
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.activeTokenCount}</div>
|
|
1064
1145
|
</div>
|
|
1065
1146
|
<div class="quickforge-settings-row">
|
|
1066
1147
|
<div class="quickforge-settings-row-main">
|
|
1067
|
-
<div class="quickforge-settings-row-title">${
|
|
1068
|
-
<div class="quickforge-settings-row-description">${
|
|
1148
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessUrls`)}</div>
|
|
1149
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessUrlsDescription`)}</div>
|
|
1069
1150
|
</div>
|
|
1070
1151
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1071
1152
|
${this.lanUrls.length?this.lanUrls.map(e=>h`<div>${e}</div>`):`-`}
|
|
@@ -1073,11 +1154,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1073
1154
|
</div>
|
|
1074
1155
|
</section>
|
|
1075
1156
|
|
|
1076
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1157
|
+
<section class="quickforge-settings-section" aria-label=${S(`lanAccess`)}>
|
|
1077
1158
|
<div class="quickforge-settings-row">
|
|
1078
1159
|
<div class="quickforge-settings-row-main">
|
|
1079
|
-
<div class="quickforge-settings-row-title">${
|
|
1080
|
-
<div class="quickforge-settings-row-description">${
|
|
1160
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessAllowFull`)}</div>
|
|
1161
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessAllowFullDescription`)}</div>
|
|
1081
1162
|
</div>
|
|
1082
1163
|
<div class="quickforge-settings-row-control">
|
|
1083
1164
|
${this.renderSwitch(this.enabled,e=>this.updateEnabled(e),this.saving)}
|
|
@@ -1086,8 +1167,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1086
1167
|
|
|
1087
1168
|
<div class="quickforge-settings-row">
|
|
1088
1169
|
<div class="quickforge-settings-row-main">
|
|
1089
|
-
<div class="quickforge-settings-row-title">${
|
|
1090
|
-
<div class="quickforge-settings-row-description">${this.hasPassword?
|
|
1170
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessPassword`)}</div>
|
|
1171
|
+
<div class="quickforge-settings-row-description">${this.hasPassword?S(`lanAccessPasswordPlaceholderConfigured`):S(`lanAccessPasswordPlaceholder`)}</div>
|
|
1091
1172
|
</div>
|
|
1092
1173
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-lan-password-control">
|
|
1093
1174
|
<input
|
|
@@ -1095,44 +1176,44 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1095
1176
|
type="password"
|
|
1096
1177
|
.value=${this.password}
|
|
1097
1178
|
@input=${e=>this.updatePassword(e.target.value)}
|
|
1098
|
-
placeholder=${this.hasPassword?
|
|
1179
|
+
placeholder=${this.hasPassword?S(`lanAccessPasswordPlaceholderConfigured`):S(`lanAccessPasswordPlaceholder`)}
|
|
1099
1180
|
/>
|
|
1100
1181
|
<button
|
|
1101
1182
|
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
1102
1183
|
type="button"
|
|
1103
1184
|
@click=${()=>this.updatePassword(xt())}
|
|
1104
1185
|
>
|
|
1105
|
-
${
|
|
1186
|
+
${S(`generatePassword`)}
|
|
1106
1187
|
</button>
|
|
1107
1188
|
</div>
|
|
1108
1189
|
</div>
|
|
1109
1190
|
|
|
1110
1191
|
<div class="quickforge-settings-row">
|
|
1111
1192
|
<div class="quickforge-settings-row-main">
|
|
1112
|
-
<div class="quickforge-settings-row-title">${
|
|
1113
|
-
<div class="quickforge-settings-row-description">${
|
|
1193
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessSessionTtl`)}</div>
|
|
1194
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessSessionTtlDescription`)}</div>
|
|
1114
1195
|
</div>
|
|
1115
1196
|
<div class="quickforge-settings-row-control">
|
|
1116
1197
|
<select class="quickforge-settings-select" .value=${String(this.sessionTtlHours)} @change=${e=>this.updateTtl(e.target.value)}>
|
|
1117
|
-
<option value="1">1 ${
|
|
1118
|
-
<option value="12">12 ${
|
|
1119
|
-
<option value="24">24 ${
|
|
1120
|
-
<option value="168">7 ${
|
|
1198
|
+
<option value="1">1 ${S(`hour`)}</option>
|
|
1199
|
+
<option value="12">12 ${S(`hours`)}</option>
|
|
1200
|
+
<option value="24">24 ${S(`hours`)}</option>
|
|
1201
|
+
<option value="168">7 ${S(`days`)}</option>
|
|
1121
1202
|
</select>
|
|
1122
1203
|
</div>
|
|
1123
1204
|
</div>
|
|
1124
1205
|
|
|
1125
1206
|
<div class="quickforge-settings-row">
|
|
1126
1207
|
<div class="quickforge-settings-row-main">
|
|
1127
|
-
<div class="quickforge-settings-row-title">${
|
|
1128
|
-
<div class="quickforge-settings-row-description">${
|
|
1208
|
+
<div class="quickforge-settings-row-title">${S(`lanAccessActions`)}</div>
|
|
1209
|
+
<div class="quickforge-settings-row-description">${S(`lanAccessActionsDescription`)}</div>
|
|
1129
1210
|
</div>
|
|
1130
1211
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1131
1212
|
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${this.saving} @click=${()=>this.saveSettings()}>
|
|
1132
|
-
${this.saving?
|
|
1213
|
+
${this.saving?S(`saving`):S(`save`)}
|
|
1133
1214
|
</button>
|
|
1134
1215
|
<button class="quickforge-settings-button quickforge-settings-button-danger" type="button" ?disabled=${this.saving} @click=${()=>this.revokeAll()}>
|
|
1135
|
-
${
|
|
1216
|
+
${S(`lanAccessRevokeAll`)}
|
|
1136
1217
|
</button>
|
|
1137
1218
|
</div>
|
|
1138
1219
|
</div>
|
|
@@ -1141,7 +1222,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1141
1222
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1142
1223
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1143
1224
|
</div>
|
|
1144
|
-
`}},W=`quickforge-lan-access-settings-tab`;customElements.get(W)||customElements.define(W,St);function Ct(){return document.createElement(W)}var wt=18e4,Tt=3e4,Et=1e3,Dt=`https://github.com/shawnstack/quickforge/releases/latest`;function G(){if(typeof document>`u`)return!1;let e=window;return document.body.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function Ot(e){return new Promise(t=>window.setTimeout(t,e))}var kt=[{value:`startup`,label:()=>
|
|
1225
|
+
`}},W=`quickforge-lan-access-settings-tab`;customElements.get(W)||customElements.define(W,St);function Ct(){return document.createElement(W)}var wt=18e4,Tt=3e4,Et=1e3,Dt=`https://github.com/shawnstack/quickforge/releases/latest`;function G(){if(typeof document>`u`)return!1;let e=window;return document.body.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function Ot(e){return new Promise(t=>window.setTimeout(t,e))}var kt=[{value:`startup`,label:()=>S(`frequencyStartup`)},{value:`daily`,label:()=>S(`frequencyDaily`)},{value:`weekly`,label:()=>S(`frequencyWeekly`)},{value:`off`,label:()=>S(`frequencyOff`)}],At=class extends g{about;updateInfo;loading=!0;checking=!1;updating=!1;restarting=!1;message=``;error=``;frequency=ge.frequency;lastCheckAt=null;serviceStatus;getTabName(){return S(`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||S(`requestFailed`));this.about=t;try{let[e,t]=await Promise.all([oe(_()),this.loadServiceStatus()]);this.frequency=e.frequency,this.lastCheckAt=e.lastCheckAt,this.serviceStatus=t}catch{}}catch(e){this.error=e instanceof Error?e.message:S(`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||S(`requestFailed`));return t}async checkUpdate(){if(!(this.checking||this.updating)){if(G()){window.open(Dt,`_blank`,`noopener,noreferrer`),this.message=S(`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||S(`updateCheckFailed`));this.updateInfo=t,this.about=t,this.updateInfo.updateAvailable?this.message=S(`updateAvailableMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.updateInfo.localVersionIsNewer?this.message=S(`localVersionNewerMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.message=S(`alreadyLatestVersion`,{version:this.updateInfo.currentVersion})}catch(e){this.error=e instanceof Error?e.message:S(`updateCheckFailed`)}finally{this.checking=!1,this.requestUpdate()}}}async pollUntilUpdated(e){let t=Date.now();for(;Date.now()-t<wt;){await Ot(Et);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=S(`updateRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(S(`updateRestartTimeout`))}async pollUntilRestarted(e){let t=Date.now();for(;Date.now()-t<Tt;){await Ot(Et);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=S(`backendRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(S(`backendRestartTimeout`))}async restartService(){if(!this.serviceStatus||this.restarting||!await C({description:S(`restartBackendConfirm`),confirmLabel:S(`restartBackendService`),cancelLabel:S(`cancel`)}))return;this.restarting=!0,this.message=S(`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||S(`backendRestartFailed`));await this.pollUntilRestarted(e)}catch(e){this.error=e instanceof Error?e.message:S(`backendRestartFailed`),this.message=``,this.restarting=!1,this.requestUpdate()}}async updateQuickForge(){if(G()){window.open(Dt,`_blank`,`noopener,noreferrer`),this.message=S(`desktopUpdateHint`),this.error=``,this.requestUpdate();return}if(!(!this.updateInfo?.updateAvailable||this.updating)&&await C({description:S(`updateConfirm`,{command:this.updateInfo.installCommand}),confirmLabel:S(`updateRuntimeNow`),cancelLabel:S(`cancel`)})){this.updating=!0,this.message=S(`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||S(`updateFailed`));if(this.updateInfo=t,t?.updateStarted){let e=t.logFile?` ${S(`updateLogFile`,{path:t.logFile})}`:``;this.message=`${S(`updateStarted`)}${e}`,this.requestUpdate(),await this.pollUntilUpdated(t.bootId)}else this.message=t?.updated?S(`updateCompleted`):S(`alreadyLatestVersion`,{version:t?.currentVersion||this.about?.version||`-`}),this.updating=!1}catch(e){this.error=e instanceof Error?e.message:S(`updateFailed`),this.message=``,this.updating=!1}finally{this.requestUpdate()}}}async selectFrequency(e){if(this.frequency!==e){this.frequency=e,this.requestUpdate();try{let t=_();await Te(t,{...await oe(t),frequency:e}),this.error=``}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.requestUpdate()}}}renderFrequencyOption(e){let t=this.frequency===e.value;return h`
|
|
1145
1226
|
<button
|
|
1146
1227
|
type="button"
|
|
1147
1228
|
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
@@ -1153,22 +1234,22 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1153
1234
|
`}infoRows(){let e=this.about;return e?h`
|
|
1154
1235
|
<div class="quickforge-settings-row">
|
|
1155
1236
|
<div class="quickforge-settings-row-main">
|
|
1156
|
-
<div class="quickforge-settings-row-title">${
|
|
1157
|
-
<div class="quickforge-settings-row-description">${
|
|
1237
|
+
<div class="quickforge-settings-row-title">${S(`packageName`)}</div>
|
|
1238
|
+
<div class="quickforge-settings-row-description">${S(`packageNameDescription`)}</div>
|
|
1158
1239
|
</div>
|
|
1159
1240
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.name}</div>
|
|
1160
1241
|
</div>
|
|
1161
1242
|
<div class="quickforge-settings-row">
|
|
1162
1243
|
<div class="quickforge-settings-row-main">
|
|
1163
|
-
<div class="quickforge-settings-row-title">${
|
|
1164
|
-
<div class="quickforge-settings-row-description">${
|
|
1244
|
+
<div class="quickforge-settings-row-title">${S(`currentVersion`)}</div>
|
|
1245
|
+
<div class="quickforge-settings-row-description">${S(`currentVersionDescription`)}</div>
|
|
1165
1246
|
</div>
|
|
1166
1247
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version}</div>
|
|
1167
1248
|
</div>
|
|
1168
1249
|
<div class="quickforge-settings-row">
|
|
1169
1250
|
<div class="quickforge-settings-row-main">
|
|
1170
|
-
<div class="quickforge-settings-row-title">${
|
|
1171
|
-
<div class="quickforge-settings-row-description">${
|
|
1251
|
+
<div class="quickforge-settings-row-title">${S(`github`)}</div>
|
|
1252
|
+
<div class="quickforge-settings-row-description">${S(`githubDescription`)}</div>
|
|
1172
1253
|
</div>
|
|
1173
1254
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1174
1255
|
<a class="quickforge-settings-link" href=${e.repositoryUrl} target="_blank" rel="noreferrer">
|
|
@@ -1179,32 +1260,32 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1179
1260
|
`:null}updateStatus(){return this.updateInfo?h`
|
|
1180
1261
|
<div class="quickforge-settings-row">
|
|
1181
1262
|
<div class="quickforge-settings-row-main">
|
|
1182
|
-
<div class="quickforge-settings-row-title">${
|
|
1183
|
-
<div class="quickforge-settings-row-description">${
|
|
1263
|
+
<div class="quickforge-settings-row-title">${S(`latestVersion`)}</div>
|
|
1264
|
+
<div class="quickforge-settings-row-description">${S(`latestVersionDescription`)}</div>
|
|
1184
1265
|
</div>
|
|
1185
1266
|
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.updateInfo.latestVersion}</div>
|
|
1186
1267
|
</div>
|
|
1187
1268
|
${this.updateInfo.logFile?h`
|
|
1188
1269
|
<div class="quickforge-settings-row">
|
|
1189
1270
|
<div class="quickforge-settings-row-main">
|
|
1190
|
-
<div class="quickforge-settings-row-title">${
|
|
1191
|
-
<div class="quickforge-settings-row-description">${
|
|
1271
|
+
<div class="quickforge-settings-row-title">${S(`updateLog`)}</div>
|
|
1272
|
+
<div class="quickforge-settings-row-description">${S(`updateLogDescription`)}</div>
|
|
1192
1273
|
</div>
|
|
1193
1274
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1194
1275
|
<code>${this.updateInfo.logFile}</code>
|
|
1195
1276
|
</div>
|
|
1196
1277
|
</div>
|
|
1197
1278
|
`:null}
|
|
1198
|
-
`:null}restartSection(){let e=this.serviceStatus?.restartUnsupportedReason||
|
|
1199
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1279
|
+
`:null}restartSection(){let e=this.serviceStatus?.restartUnsupportedReason||S(`backendRestartUnsupported`),t=this.restarting||!this.serviceStatus?.restartSupported;return h`
|
|
1280
|
+
<section class="quickforge-settings-section" aria-label=${S(`restartBackendService`)}>
|
|
1200
1281
|
<div class="quickforge-settings-row">
|
|
1201
1282
|
<div class="quickforge-settings-row-main">
|
|
1202
1283
|
<div class="quickforge-settings-row-title">
|
|
1203
|
-
${
|
|
1204
|
-
<quickforge-info-tip .label=${
|
|
1284
|
+
${S(`restartBackendService`)}
|
|
1285
|
+
<quickforge-info-tip .label=${S(`restartBackendServiceDescription`)}></quickforge-info-tip>
|
|
1205
1286
|
</div>
|
|
1206
1287
|
<div class="quickforge-settings-row-description">
|
|
1207
|
-
${this.serviceStatus?.restartSupported?
|
|
1288
|
+
${this.serviceStatus?.restartSupported?S(`restartBackendServiceDescription`):e}
|
|
1208
1289
|
</div>
|
|
1209
1290
|
</div>
|
|
1210
1291
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1214,31 +1295,31 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1214
1295
|
?disabled=${t}
|
|
1215
1296
|
@click=${()=>this.restartService()}
|
|
1216
1297
|
>
|
|
1217
|
-
${this.restarting?
|
|
1298
|
+
${this.restarting?S(`backendRestarting`):S(`restartBackendService`)}
|
|
1218
1299
|
</button>
|
|
1219
1300
|
</div>
|
|
1220
1301
|
</div>
|
|
1221
1302
|
</section>
|
|
1222
|
-
`}render(){if(this.loading)return h`<div class="text-sm text-muted-foreground">${
|
|
1303
|
+
`}render(){if(this.loading)return h`<div class="text-sm text-muted-foreground">${S(`loading`)}</div>`;let e=this.checking||this.updating||!this.updateInfo?.updateAvailable,t=G();return h`
|
|
1223
1304
|
<div class="quickforge-settings-stack">
|
|
1224
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1305
|
+
<section class="quickforge-settings-section" aria-label=${S(`projectInfo`)}>
|
|
1225
1306
|
${this.infoRows()}
|
|
1226
1307
|
</section>
|
|
1227
1308
|
|
|
1228
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1309
|
+
<section class="quickforge-settings-section" aria-label=${S(t?`desktopUpdates`:`runtimeUpdates`)}>
|
|
1229
1310
|
${t?null:h`
|
|
1230
1311
|
<div class="quickforge-settings-row">
|
|
1231
1312
|
<div class="quickforge-settings-row-main">
|
|
1232
1313
|
<div class="quickforge-settings-row-title">
|
|
1233
|
-
${
|
|
1234
|
-
<quickforge-info-tip .label=${
|
|
1314
|
+
${S(`updateFrequencySection`)}
|
|
1315
|
+
<quickforge-info-tip .label=${S(`updateFrequencyDescription`)}></quickforge-info-tip>
|
|
1235
1316
|
</div>
|
|
1236
1317
|
<div class="quickforge-settings-row-description">
|
|
1237
|
-
${this.lastCheckAt?
|
|
1318
|
+
${this.lastCheckAt?S(`lastCheckedAt`,{time:new Date(this.lastCheckAt).toLocaleString(le())}):S(`lastCheckedNever`)}
|
|
1238
1319
|
</div>
|
|
1239
1320
|
</div>
|
|
1240
1321
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1241
|
-
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${
|
|
1322
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${S(`updateFrequencySection`)}>
|
|
1242
1323
|
${kt.map(e=>this.renderFrequencyOption(e))}
|
|
1243
1324
|
</div>
|
|
1244
1325
|
</div>
|
|
@@ -1250,11 +1331,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1250
1331
|
<div class="quickforge-settings-row">
|
|
1251
1332
|
<div class="quickforge-settings-row-main">
|
|
1252
1333
|
<div class="quickforge-settings-row-title">
|
|
1253
|
-
${
|
|
1254
|
-
<quickforge-info-tip .label=${
|
|
1334
|
+
${S(t?`desktopUpdates`:`runtimeUpdates`)}
|
|
1335
|
+
<quickforge-info-tip .label=${S(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}></quickforge-info-tip>
|
|
1255
1336
|
</div>
|
|
1256
1337
|
<div class="quickforge-settings-row-description">
|
|
1257
|
-
${
|
|
1338
|
+
${S(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}
|
|
1258
1339
|
</div>
|
|
1259
1340
|
</div>
|
|
1260
1341
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1264,7 +1345,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1264
1345
|
?disabled=${this.checking||this.updating}
|
|
1265
1346
|
@click=${()=>this.checkUpdate()}
|
|
1266
1347
|
>
|
|
1267
|
-
${this.checking?
|
|
1348
|
+
${this.checking?S(`checkingUpdate`):S(t?`openDesktopReleases`:`checkRuntimeUpdate`)}
|
|
1268
1349
|
</button>
|
|
1269
1350
|
${t?null:h`
|
|
1270
1351
|
<button
|
|
@@ -1273,7 +1354,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1273
1354
|
?disabled=${e}
|
|
1274
1355
|
@click=${()=>this.updateQuickForge()}
|
|
1275
1356
|
>
|
|
1276
|
-
${this.updating?
|
|
1357
|
+
${this.updating?S(`updatingQuickForge`):S(`updateRuntimeNow`)}
|
|
1277
1358
|
</button>
|
|
1278
1359
|
`}
|
|
1279
1360
|
</div>
|
|
@@ -1285,19 +1366,19 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1285
1366
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1286
1367
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1287
1368
|
</div>
|
|
1288
|
-
`}},K=`quickforge-about-settings-tab`;customElements.get(K)||customElements.define(K,At);function jt(){return document.createElement(K)}var Mt=class extends g{loading=!0;saving=!1;saved=!1;error=``;message=``;projects=[];project;commandDir=``;commands=[];loadingCommands=!1;saveTimer=null;lastSavedCommandDir=``;pendingSaveAfterCurrent=!1;getTabName(){return
|
|
1369
|
+
`}},K=`quickforge-about-settings-tab`;customElements.get(K)||customElements.define(K,At);function jt(){return document.createElement(K)}var Mt=class extends g{loading=!0;saving=!1;saved=!1;error=``;message=``;projects=[];project;commandDir=``;commands=[];loadingCommands=!1;saveTimer=null;lastSavedCommandDir=``;pendingSaveAfterCurrent=!1;getTabName(){return S(`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||S(`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:S(`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:S(`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:S(`requestFailed`),this.requestUpdate()}}}async createCommand(){if(!this.project)return;let e=window.prompt(S(`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=S(`commandCreated`,{name:t.name??e.trim()}),await this.loadCommands()):t.reason===`exists`?this.error=S(`commandAlreadyExists`,{name:t.name??e.trim()}):this.error=S(`invalidCommandName`)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.requestUpdate()}}}render(){return this.loading?h`<div class="quickforge-settings-note">${S(`loading`)}</div>`:this.projects.length===0?h`
|
|
1289
1370
|
<div class="quickforge-settings-stack">
|
|
1290
|
-
<div class="quickforge-settings-note">${
|
|
1371
|
+
<div class="quickforge-settings-note">${S(`selectProjectForCommands`)}</div>
|
|
1291
1372
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1292
1373
|
</div>
|
|
1293
1374
|
`:h`
|
|
1294
1375
|
<div class="quickforge-settings-stack">
|
|
1295
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1376
|
+
<section class="quickforge-settings-section" aria-label=${S(`projectCommands`)}>
|
|
1296
1377
|
<div class="quickforge-settings-row">
|
|
1297
1378
|
<div class="quickforge-settings-row-main">
|
|
1298
|
-
<div class="quickforge-settings-row-title">${
|
|
1379
|
+
<div class="quickforge-settings-row-title">${S(`project`)}</div>
|
|
1299
1380
|
<div class="quickforge-settings-row-description">
|
|
1300
|
-
${this.project?.path?this.project.path:
|
|
1381
|
+
${this.project?.path?this.project.path:S(`projectCommandsProjectDescription`)}
|
|
1301
1382
|
</div>
|
|
1302
1383
|
</div>
|
|
1303
1384
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
@@ -1314,16 +1395,16 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1314
1395
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1315
1396
|
<div class="quickforge-settings-row-main">
|
|
1316
1397
|
<div class="quickforge-settings-row-title">
|
|
1317
|
-
${
|
|
1318
|
-
<quickforge-info-tip .label=${
|
|
1398
|
+
${S(`commandDirectories`)}
|
|
1399
|
+
<quickforge-info-tip .label=${S(`commandDirectoryHelp`)}></quickforge-info-tip>
|
|
1319
1400
|
</div>
|
|
1320
|
-
<div class="quickforge-settings-row-description">${
|
|
1401
|
+
<div class="quickforge-settings-row-description">${S(`commandDirectoriesDescription`)}</div>
|
|
1321
1402
|
</div>
|
|
1322
1403
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1323
1404
|
<textarea
|
|
1324
1405
|
class="quickforge-settings-textarea quickforge-settings-mono"
|
|
1325
1406
|
.value=${this.commandDir}
|
|
1326
|
-
placeholder=${
|
|
1407
|
+
placeholder=${S(`commandDirectoryPlaceholder`)}
|
|
1327
1408
|
@input=${e=>this.updateCommandDir(e.target.value)}
|
|
1328
1409
|
></textarea>
|
|
1329
1410
|
</div>
|
|
@@ -1331,8 +1412,8 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1331
1412
|
|
|
1332
1413
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1333
1414
|
<div class="quickforge-settings-row-main">
|
|
1334
|
-
<div class="quickforge-settings-row-title">${
|
|
1335
|
-
<div class="quickforge-settings-row-description">${
|
|
1415
|
+
<div class="quickforge-settings-row-title">${S(`commandDirectoryExamples`)}</div>
|
|
1416
|
+
<div class="quickforge-settings-row-description">${S(`commandDirectoryExamplesDescription`)}</div>
|
|
1336
1417
|
</div>
|
|
1337
1418
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-code-list">
|
|
1338
1419
|
<code>.ai/commands</code>
|
|
@@ -1343,11 +1424,11 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1343
1424
|
</div>
|
|
1344
1425
|
</section>
|
|
1345
1426
|
|
|
1346
|
-
<section class="quickforge-settings-section" aria-label=${
|
|
1427
|
+
<section class="quickforge-settings-section" aria-label=${S(`loadedCommands`,{count:this.commands.length})}>
|
|
1347
1428
|
<div class="quickforge-settings-row">
|
|
1348
1429
|
<div class="quickforge-settings-row-main">
|
|
1349
|
-
<div class="quickforge-settings-row-title">${
|
|
1350
|
-
<div class="quickforge-settings-row-description">${
|
|
1430
|
+
<div class="quickforge-settings-row-title">${S(`loadedCommands`,{count:this.commands.length})}</div>
|
|
1431
|
+
<div class="quickforge-settings-row-description">${S(`loadedCommandsDescription`)}</div>
|
|
1351
1432
|
</div>
|
|
1352
1433
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1353
1434
|
<button
|
|
@@ -1356,7 +1437,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1356
1437
|
?disabled=${this.loadingCommands}
|
|
1357
1438
|
@click=${()=>this.openCommandDir()}
|
|
1358
1439
|
>
|
|
1359
|
-
${
|
|
1440
|
+
${S(`openCommandDir`)}
|
|
1360
1441
|
</button>
|
|
1361
1442
|
<button
|
|
1362
1443
|
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
@@ -1364,20 +1445,20 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1364
1445
|
?disabled=${this.loadingCommands}
|
|
1365
1446
|
@click=${()=>this.createCommand()}
|
|
1366
1447
|
>
|
|
1367
|
-
${
|
|
1448
|
+
${S(`createCommand`)}
|
|
1368
1449
|
</button>
|
|
1369
1450
|
</div>
|
|
1370
1451
|
</div>
|
|
1371
1452
|
|
|
1372
1453
|
<div class="quickforge-settings-nested-list">
|
|
1373
|
-
${this.loadingCommands?h`<div class="quickforge-settings-empty-row">${
|
|
1454
|
+
${this.loadingCommands?h`<div class="quickforge-settings-empty-row">${S(`loading`)}</div>`:this.commands.length===0?h`<div class="quickforge-settings-empty-row">${S(`noCommandsLoaded`)}</div>`:this.commands.map(e=>{let t=e.argumentHint?` ${e.argumentHint}`:``;return h`
|
|
1374
1455
|
<div class="quickforge-settings-subrow">
|
|
1375
1456
|
<div class="quickforge-settings-row-main">
|
|
1376
1457
|
<div class="quickforge-settings-row-title">
|
|
1377
1458
|
<code class="quickforge-settings-command-name">/${e.name}${t}</code>
|
|
1378
1459
|
</div>
|
|
1379
1460
|
<div class="quickforge-settings-row-description">
|
|
1380
|
-
${e.description||
|
|
1461
|
+
${e.description||S(`noDescription`)}
|
|
1381
1462
|
</div>
|
|
1382
1463
|
</div>
|
|
1383
1464
|
${e.relativePath?h`<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">${e.relativePath}</div>`:null}
|
|
@@ -1386,19 +1467,19 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1386
1467
|
</div>
|
|
1387
1468
|
</section>
|
|
1388
1469
|
|
|
1389
|
-
${this.saving?h`<div class="quickforge-settings-note">${
|
|
1390
|
-
${this.saved?h`<div class="quickforge-settings-message">${
|
|
1470
|
+
${this.saving?h`<div class="quickforge-settings-note">${S(`saving`)}</div>`:null}
|
|
1471
|
+
${this.saved?h`<div class="quickforge-settings-message">${S(`projectCommandsSaved`)}</div>`:null}
|
|
1391
1472
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1392
1473
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1393
1474
|
</div>
|
|
1394
|
-
`}},q=`quickforge-project-commands-settings-tab`;customElements.get(q)||customElements.define(q,Mt);function Nt(){return document.createElement(q)}var J={"x-quickforge-action":`channel-action`};function Pt(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 Ft(e){switch(e){case`starting`:return
|
|
1475
|
+
`}},q=`quickforge-project-commands-settings-tab`;customElements.get(q)||customElements.define(q,Mt);function Nt(){return document.createElement(q)}var J={"x-quickforge-action":`channel-action`};function Pt(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 Ft(e){switch(e){case`starting`:return S(`channelStatusStarting`);case`waiting_scan`:return S(`channelStatusWaitingScan`);case`running`:return S(`channelStatusRunning`);case`stopping`:return S(`channelStatusStopping`);case`error`:return S(`channelStatusError`);default:return S(`channelStatusStopped`)}}function It(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}var Lt=class extends g{loading=!0;channels=[];workspaces=[];selectedWorkspaceIdByChannel={};error=``;message=``;eventSource;busyChannelId=``;getTabName(){return S(`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||S(`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:S(`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:S(`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:S(`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:S(`channelRestartConfirm`,{name:e.name}),confirmLabel:S(`restart`),cancelLabel:S(`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?{...J,"content-type":`application/json`}:J,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}async invokeAction(e,t){if(!this.busyChannelId&&!((t.destructive||t.id===`relogin`)&&!await C({description:t.id===`relogin`?S(`channelReloginConfirm`,{name:e.name}):S(`channelLogoutConfirm`,{name:e.name}),confirmLabel:t.label,cancelLabel:S(`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?{...J,"content-type":`application/json`}:J,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:S(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}workspaceSection(e,t){if(!e.supportsWorkspaceSelection)return null;let n=this.selectedWorkspaceId(e),r=e.launchWorkspace;return h`
|
|
1395
1476
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1396
1477
|
<div class="quickforge-settings-row-main">
|
|
1397
1478
|
<div class="quickforge-settings-row-title">
|
|
1398
|
-
${
|
|
1399
|
-
<quickforge-info-tip .label=${
|
|
1479
|
+
${S(`channelWorkspace`)}
|
|
1480
|
+
<quickforge-info-tip .label=${S(`channelWorkspaceDescription`)}></quickforge-info-tip>
|
|
1400
1481
|
</div>
|
|
1401
|
-
${r?h`<div class="quickforge-settings-row-description">${
|
|
1482
|
+
${r?h`<div class="quickforge-settings-row-description">${S(`channelCurrentWorkspace`)}: <span class="quickforge-settings-mono">${r.path}</span></div>`:h`<div class="quickforge-settings-row-description">${S(`channelWorkspaceDescription`)}</div>`}
|
|
1402
1483
|
</div>
|
|
1403
1484
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1404
1485
|
<select
|
|
@@ -1408,19 +1489,19 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1408
1489
|
@change=${t=>this.handleWorkspaceChange(e,t)}
|
|
1409
1490
|
>
|
|
1410
1491
|
${this.workspaces.map(e=>h`
|
|
1411
|
-
<option value=${e.id}>${e.kind===`default`?
|
|
1492
|
+
<option value=${e.id}>${e.kind===`default`?S(`channelDefaultWorkspace`):e.name} — ${e.path}</option>
|
|
1412
1493
|
`)}
|
|
1413
1494
|
</select>
|
|
1414
1495
|
</div>
|
|
1415
1496
|
</div>
|
|
1416
1497
|
`}channelMeta(e){return h`
|
|
1417
1498
|
<div class="quickforge-settings-nested-list">
|
|
1418
|
-
${[[
|
|
1499
|
+
${[[S(`channelProvider`),e.provider||`-`],[S(`channelCommand`),e.commandLabel||`-`],[S(`channelPid`),e.pid?String(e.pid):`-`],[S(`channelStartedAt`),It(e.startedAt)]].map(([e,t])=>h`
|
|
1419
1500
|
<div class="quickforge-settings-subrow">
|
|
1420
1501
|
<div class="quickforge-settings-row-main">
|
|
1421
1502
|
<div class="quickforge-settings-row-title">${e}</div>
|
|
1422
1503
|
</div>
|
|
1423
|
-
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value ${e===
|
|
1504
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value ${e===S(`channelCommand`)?`quickforge-settings-mono`:``}">${t}</div>
|
|
1424
1505
|
</div>
|
|
1425
1506
|
`)}
|
|
1426
1507
|
</div>
|
|
@@ -1428,10 +1509,10 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1428
1509
|
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1429
1510
|
<div class="quickforge-settings-row-main">
|
|
1430
1511
|
<div class="quickforge-settings-row-title">
|
|
1431
|
-
${
|
|
1432
|
-
<quickforge-info-tip .label=${
|
|
1512
|
+
${S(`channelQrTitle`)}
|
|
1513
|
+
<quickforge-info-tip .label=${S(`channelQrDescription`)}></quickforge-info-tip>
|
|
1433
1514
|
</div>
|
|
1434
|
-
<div class="quickforge-settings-row-description">${
|
|
1515
|
+
<div class="quickforge-settings-row-description">${S(`channelQrDescription`)}</div>
|
|
1435
1516
|
${e.qrCodeUrl?h`
|
|
1436
1517
|
<div class="quickforge-settings-meta">
|
|
1437
1518
|
<a class="quickforge-settings-link quickforge-settings-mono" href=${e.qrCodeUrl} target="_blank" rel="noreferrer">${e.qrCodeUrl}</a>
|
|
@@ -1442,7 +1523,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1442
1523
|
</div>
|
|
1443
1524
|
`}logsSection(e){let t=e.logs||[];return h`
|
|
1444
1525
|
<details class="quickforge-channel-logs" open>
|
|
1445
|
-
<summary class="quickforge-channel-logs-summary">${
|
|
1526
|
+
<summary class="quickforge-channel-logs-summary">${S(`channelRecentLogs`)}</summary>
|
|
1446
1527
|
<div class="quickforge-channel-logs-body">
|
|
1447
1528
|
${t.length?t.slice(-80).map(e=>h`
|
|
1448
1529
|
<div class="quickforge-channel-log-row">
|
|
@@ -1450,7 +1531,7 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1450
1531
|
<span class=${e.stream===`stderr`?`text-destructive/80`:`text-muted-foreground/70`}>${e.stream}</span>
|
|
1451
1532
|
<span class="min-w-0 whitespace-pre-wrap break-words text-foreground/85">${e.text}</span>
|
|
1452
1533
|
</div>
|
|
1453
|
-
`):h`<div class="quickforge-settings-empty-row">${
|
|
1534
|
+
`):h`<div class="quickforge-settings-empty-row">${S(`channelNoLogs`)}</div>`}
|
|
1454
1535
|
</div>
|
|
1455
1536
|
</details>
|
|
1456
1537
|
`}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 h`
|
|
@@ -1462,12 +1543,12 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1462
1543
|
<span class="quickforge-settings-badge ${Pt(e.status)}">${Ft(e.status)}</span>
|
|
1463
1544
|
</div>
|
|
1464
1545
|
<div class="quickforge-settings-row-description">${e.description}</div>
|
|
1465
|
-
${e.requirements?.length?h`<div class="quickforge-settings-row-description">${
|
|
1546
|
+
${e.requirements?.length?h`<div class="quickforge-settings-row-description">${S(`channelRequirements`)}: ${e.requirements.join(` · `)}</div>`:null}
|
|
1466
1547
|
</div>
|
|
1467
1548
|
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1468
|
-
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${t||n||r||i} @click=${()=>this.invoke(e,`start`)}>${
|
|
1469
|
-
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||!n||r} @click=${()=>this.invoke(e,`stop`)}>${
|
|
1470
|
-
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||r||i} @click=${()=>this.invoke(e,`restart`)}>${
|
|
1549
|
+
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${t||n||r||i} @click=${()=>this.invoke(e,`start`)}>${S(`start`)}</button>
|
|
1550
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||!n||r} @click=${()=>this.invoke(e,`stop`)}>${S(`stop`)}</button>
|
|
1551
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||r||i} @click=${()=>this.invoke(e,`restart`)}>${S(`restart`)}</button>
|
|
1471
1552
|
${e.actions?.map(n=>h`
|
|
1472
1553
|
<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>
|
|
1473
1554
|
`)}
|
|
@@ -1475,21 +1556,21 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Dt as n,Et as r
|
|
|
1475
1556
|
</div>
|
|
1476
1557
|
|
|
1477
1558
|
${this.workspaceSection(e,t||n||r)}
|
|
1478
|
-
${i?h`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${
|
|
1559
|
+
${i?h`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${S(`channelNoWorkspaces`)}</div>`:null}
|
|
1479
1560
|
${this.channelMeta(e)}
|
|
1480
1561
|
${e.error?h`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${e.error}</div>`:null}
|
|
1481
1562
|
${this.qrSection(e)}
|
|
1482
1563
|
${this.logsSection(e)}
|
|
1483
1564
|
</section>
|
|
1484
|
-
`}render(){return this.loading?h`<div class="quickforge-settings-note">${
|
|
1565
|
+
`}render(){return this.loading?h`<div class="quickforge-settings-note">${S(`loading`)}</div>`:h`
|
|
1485
1566
|
<div class="quickforge-settings-stack">
|
|
1486
1567
|
<section class="quickforge-settings-warning">
|
|
1487
|
-
${
|
|
1568
|
+
${S(`channelsSecurityWarning`)}
|
|
1488
1569
|
</section>
|
|
1489
1570
|
|
|
1490
|
-
${this.channels.length?h`${this.channels.map(e=>this.channelCard(e))}`:h`<div class="quickforge-settings-note">${
|
|
1571
|
+
${this.channels.length?h`${this.channels.map(e=>this.channelCard(e))}`:h`<div class="quickforge-settings-note">${S(`channelsEmpty`)}</div>`}
|
|
1491
1572
|
|
|
1492
1573
|
${this.message?h`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1493
1574
|
${this.error?h`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1494
1575
|
</div>
|
|
1495
|
-
`}},Y=`quickforge-channels-settings-tab`;customElements.get(Y)||customElements.define(Y,Lt);function Rt(){return document.createElement(Y)}var zt=ae(),X=ie(),Bt=(0,O.lazy)(()=>v(()=>import(`./AgentProfilesPage-
|
|
1576
|
+
`}},Y=`quickforge-channels-settings-tab`;customElements.get(Y)||customElements.define(Y,Lt);function Rt(){return document.createElement(Y)}var zt=ae(),X=ie(),Bt=(0,O.lazy)(()=>v(()=>import(`./AgentProfilesPage-D7pbg8nm.js`).then(e=>({default:e.AgentProfilesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),Vt=(0,O.lazy)(()=>v(()=>import(`./mcp-servers-dialog-BQbFywVL.js`).then(e=>({default:e.McpServersPanel})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ht=(0,O.lazy)(()=>v(()=>import(`./skills-dialog-REBeTFSH.js`).then(e=>e.n).then(e=>({default:e.SkillsManagerPanel})),__vite__mapDeps([9,1,2,3,4,5,6,7,8,10,11]))),Ut=(0,O.lazy)(()=>v(()=>import(`./PluginsPage-NAGroBm3.js`).then(e=>({default:e.PluginsPage})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,14]))),Wt=(0,O.lazy)(()=>v(()=>import(`./ScheduledTasksPage-Bp0MNfQD.js`).then(e=>({default:e.ScheduledTasksPage})),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11]))),Gt=class extends g{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 h`<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,zt.createRoot)(e),this.root.render(this.renderReact()))}},Z=`quickforge-react-settings-tab`;customElements.get(Z)||customElements.define(Z,Gt);function Q(e,t){let n=document.createElement(Z);return n.tabName=e,n.renderReact=t,n}function $({children:e}){return(0,X.jsx)(`div`,{className:`quickforge-settings-stack h-full min-h-[30rem]`,children:(0,X.jsx)(O.Suspense,{fallback:(0,X.jsx)(`div`,{className:`quickforge-settings-note`,children:S(`loading`)}),children:e})})}function Kt(e){window.dispatchEvent(new CustomEvent(`quickforge:open-session-from-settings`,{detail:{sessionId:e}}))}function qt(){return Q(S(`agentsTab`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Bt,{})}))}function Jt(){return Q(S(`skills`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Ht,{active:!0,scope:`global`,embedded:!0,onSaved:()=>void 0})}))}function Yt(){return Q(S(`mcpServers`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Vt,{active:!0})}))}function Xt(){return Q(S(`plugins`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Ut,{})}))}function Zt(){return Q(S(`scheduledTasks`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Wt,{onOpenSession:Kt})}))}function Qt(e){let t=[{key:`appearance`,tab:Fe(),getDescription:()=>S(`appearanceDescription`)},{key:`defaults`,tab:$e(),getDescription:()=>S(`defaultOptionsDescription`)},{key:`memory`,tab:ot(),getDescription:()=>S(`memoryDescription`)},{key:`customModels`,tab:Me(e),getDescription:()=>S(`customModelsDescription`)},{key:`agents`,tab:qt(),getDescription:()=>S(`agentsDescription`)},{key:`skills`,tab:Jt(),getDescription:()=>S(`globalSkillsDescription`)},{key:`mcp`,tab:Yt(),getDescription:void 0},{key:`plugins`,tab:Xt(),getDescription:()=>S(`pluginsDescription`)},{key:`scheduledTasks`,tab:Zt(),getDescription:()=>S(`scheduledTasksDescription`)},{key:`projectCommands`,tab:Nt(),getDescription:()=>S(`projectCommandsDescription`)},{key:`backup`,tab:gt(),getDescription:()=>S(`backupRestoreDescription`)},{key:`archivedConversations`,tab:bt(),getDescription:()=>S(`archivedConversationsDescription`)},{key:`channels`,tab:Rt(),getDescription:()=>S(`channelsDescription`)},{key:`lanAccess`,tab:Ct(),getDescription:()=>S(`lanAccessDescription`)},{key:`about`,tab:jt(),getDescription:()=>S(`aboutQuickForgeDescription`)}];return{items:[...t],tabs:t.map(e=>e.tab),indexOf:e=>t.findIndex(t=>t.key===e)}}var $t={appearance:t,defaults:f,memory:r,customModels:ne,agents:n,skills:o,mcp:d,plugins:re,scheduledTasks:c,projectCommands:m,backup:u,archivedConversations:a,channels:l,lanAccess:p,about:i};function en({tab:e}){let t=(0,O.useRef)(null);return(0,O.useEffect)(()=>{let n=t.current;if(n)return n.replaceChildren(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),(0,X.jsx)(`div`,{ref:t,className:`quickforge-settings-tab-host min-h-0 flex-1`})}function tn({initialTab:e,customProvider:t,onBack:n}){let r=(0,O.useMemo)(()=>Qt(t),[t]),i=Math.max(0,r.indexOf(e)),[a,o]=(0,O.useState)(),s=a??i,c=r.items[s]??r.items[0],l=c?.getDescription?.(),u=c?$t[c.key]:void 0,[d,f]=(0,O.useState)(``),p=d.trim().toLowerCase(),m=(0,O.useMemo)(()=>r.items.map((e,t)=>({item:e,index:t})).filter(({item:e})=>p?[e.key,e.tab.getTabName(),e.getDescription?.()??``].join(` `).toLowerCase().includes(p):!0),[r.items,p]);return(0,X.jsxs)(`div`,{className:`flex h-screen min-h-0 bg-[var(--quickforge-sidebar-bg)] text-foreground`,children:[(0,X.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,X.jsxs)(`div`,{className:`shrink-0 px-3 pb-2 pt-3`,children:[(0,X.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,X.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,X.jsx)(te,{className:`size-4`})}),(0,X.jsx)(`span`,{className:`truncate text-sm leading-5`,children:`返回工作区`})]}),(0,X.jsxs)(`div`,{className:`quickforge-settings-inline-field mt-3`,children:[(0,X.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:S(`searchSettings`),"aria-label":S(`searchSettings`),className:`quickforge-settings-input`})]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-4`,children:(0,X.jsxs)(`nav`,{className:`space-y-1`,"aria-label":S(`settings`),children:[m.map(({item:e,index:t})=>{let n=t===s,r=$t[e.key];return(0,X.jsxs)(`button`,{type:`button`,className:D(`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:()=>o(t),"aria-current":n?`page`:void 0,children:[(0,X.jsx)(`span`,{className:D(`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,X.jsx)(r,{className:`size-4`,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{className:`truncate`,children:e.tab.getTabName()})]},e.key)}),m.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-sm text-muted-foreground/70`,children:S(`noSettingsResults`)}):null]})})]}),(0,X.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col bg-[var(--quickforge-main-bg)] md:overflow-hidden md:rounded-tl-2xl`,children:[(0,X.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,X.jsx)(se,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:n,"aria-label":`返回工作区`,children:(0,X.jsx)(te,{className:`size-4`})}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[u?(0,X.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground/65`,"aria-hidden":`true`}):null,(0,X.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium text-foreground/90`,children:c?.tab.getTabName()}),l?(0,X.jsx)(Ee,{label:l}):null]})})]}),(0,X.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,X.jsxs)(`div`,{className:`quickforge-settings-inline-field`,children:[(0,X.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:S(`searchSettings`),"aria-label":S(`searchSettings`),className:`quickforge-settings-input`})]})}),(0,X.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:[m.map(({item:e,index:t})=>{let n=t===s,r=$t[e.key];return(0,X.jsxs)(`button`,{type:`button`,className:D(`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:()=>o(t),children:[(0,X.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:e.tab.getTabName()})]},e.key)}),m.length===0?(0,X.jsx)(`div`,{className:`shrink-0 px-1 py-1.5 text-sm text-muted-foreground/70`,children:S(`noSettingsResults`)}):null]}),(0,X.jsx)(`section`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-5 md:px-8 md:py-7`,children:(0,X.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col`,children:c?(0,X.jsx)(en,{tab:c.tab}):null})})]})]})}export{tn as SettingsWorkspacePage};
|