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