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