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