@chainingintention/pi-web-cn 2.202611.4 → 2.202611.5
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/dist/client/assets/{PiWebApp-rG0WhMEa.js → PiWebApp-NXSXyci_.js} +879 -866
- package/dist/client/assets/SettingsDialog-lAadl-rm.js +1274 -0
- package/dist/client/assets/{external-DZQ-GM9O.js → external-Bxk-hFko.js} +1 -1
- package/dist/client/assets/{index-C8SnDkf4.js → index-AJX2U-nF.js} +2 -2
- package/dist/client/assets/{main-T8PgowZ_.js → main-BrnfeRme.js} +2 -2
- package/dist/client/assets/requiredTerminalPlugin-M436A3oj.js +3 -0
- package/dist/client/index.html +1 -1
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -1
- package/dist/pi-web-plugins/zh-cn/catalogs.json +38 -0
- package/dist/pi-web-plugins/zh-cn/config-errors.json +9 -1
- package/dist/server/configRoutes.js +1 -0
- package/dist/server/configRoutes.js.map +1 -1
- package/dist/server/normalAuth.js +1 -1
- package/dist/server/normalAuth.js.map +1 -1
- package/dist/server/sessiond/sessionProxyRoutes.js +3 -0
- package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
- package/dist/server/sessiond.js +10 -1
- package/dist/server/sessiond.js.map +1 -1
- package/dist/server/speech/speechRoutes.js +25 -0
- package/dist/server/speech/speechRoutes.js.map +1 -0
- package/dist/server/speech/transcriptionService.js +198 -0
- package/dist/server/speech/transcriptionService.js.map +1 -0
- package/dist/shared/apiTypes.js +1 -0
- package/dist/shared/apiTypes.js.map +1 -1
- package/dist/shared/capabilities.js +3 -0
- package/dist/shared/capabilities.js.map +1 -1
- package/dist/shared/configResolution.js +2 -0
- package/dist/shared/configResolution.js.map +1 -1
- package/dist/shared/federatedRoutes.js +2 -0
- package/dist/shared/federatedRoutes.js.map +1 -1
- package/dist/shared/piWebConfigParsing.js +76 -0
- package/dist/shared/piWebConfigParsing.js.map +1 -1
- package/dist/shared/speechTranscription.js +81 -0
- package/dist/shared/speechTranscription.js.map +1 -0
- package/docs/config.md +30 -3
- package/docs/plugins.md +1 -1
- package/package.json +1 -1
- package/dist/client/assets/SettingsDialog-D6czghzo.js +0 -1129
- package/dist/client/assets/requiredTerminalPlugin-DrXvpLs1.js +0 -3
|
@@ -1,1129 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./styles-BwN5rgmt.js";import{t as r}from"./themePreference-BBiJxLjs.js";import{d as i,f as a,i as o,u as s}from"./themeCatalog-B3yda95n.js";import{D as c,F as ee,G as l,I as u,M as d,N as te,P as f,U as p,W as m,c as ne,d as re,f as ie,h as ae,j as oe,k as se,l as ce,m as h,n as le,o as ue,p as g,r as de,u as fe,w as pe}from"./composerShortcuts-BggqvE9J.js";import{J as me,W as he,b as ge,bt as _,et as _e,gt as ve,ht as ye,m as v,mt as y,o as be,p as xe,pt as b,t as Se,v as Ce,vt as x}from"./requiredTerminalPlugin-DrXvpLs1.js";import{d as S,n as C,o as w,t as T}from"./lit-CJ6w1GHF.js";var we={heading:_(`MCP`,`MCP authentication settings heading; protocol name`),description:_(`Manage authentication for enabled MCP servers that support OAuth in the selected session.`,`MCP settings scope guidance`),refresh:_(`Refresh servers`,`Reload MCP servers in the selected session`),thisMachine:_(`this machine`,`Fallback machine target when no display name is provided`),selectSession:_(`Select a nonarchived session on {target} to manage MCP authentication. Close settings to select a session, or use Configure machine to match the selected session’s machine.`,`No eligible session; target is the raw selected machine label; Configure machine names the settings machine selector`),context:_(`Session context`,`MCP session context section heading`),contextAria:_(`MCP session context`,`Accessible name for selected MCP machine, session and workspace`),machine:_(`Machine:`,`Selected machine value label`),session:_(`Session:`,`Selected session identifier label`),workspace:_(`Workspace:`,`Selected session working directory label`),logoutHelp:_(`Logout removes local Pi credentials. It does not disable the server or revoke permission at the provider. Other sessions using those credentials are also affected.`,`Consequences of logging out of an MCP server`),loading:_(`Loading MCP servers…`,`MCP server list loading status`),empty:_(`No enabled MCP servers with OAuth support are available in this session.`,`MCP server list empty status`),serversAria:_(`MCP servers`,`Accessible name for MCP authentication server list`),login:_(`Login`,`Open MCP server OAuth login`),logout:_(`Logout`,`Remove local MCP credentials`),loginAria:_(`Login to {name}`,`Server-specific login accessible name; raw server name`),logoutAria:_(`Logout from {name}`,`Server-specific logout accessible name; raw server name`),loadError:_(`Could not load MCP servers: {error}`,`Server list load failure; raw runtime diagnostic`),authError:_(`Could not open MCP authentication: {error}`,`Authentication flow launch failure; raw runtime diagnostic`)},E=t(`.ui-settings-section{border-bottom:1px solid var(--pi-border-muted);gap:14px;min-width:0;padding:16px;display:grid}.ui-settings-heading{gap:6px;min-width:0;display:grid}.ui-settings-heading h3{margin:0;font-size:14px;line-height:1.4}.ui-settings-heading p{color:var(--pi-muted);margin:0;line-height:1.45}.ui-settings-fields{gap:14px;min-width:0;display:grid}.ui-settings-actions{flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;min-width:0;display:flex}.ui-settings-path{background:var(--pi-bg);min-width:0;color:var(--pi-muted);overflow-wrap:anywhere;gap:5px;padding:12px;display:grid}.ui-settings-summary{background:var(--pi-bg);gap:10px;min-width:0;padding:12px;display:grid}.ui-settings-list{gap:0;min-width:0;display:grid}.ui-settings-row{border-bottom:1px solid var(--pi-border-muted);flex-wrap:wrap;align-items:center;gap:12px;min-width:0;padding:12px 16px;display:flex}@media (width<=480px){.ui-settings-actions{grid-template-columns:minmax(0,1fr);display:grid}}`),Te={heading:_(`Theme`,`Theme settings heading and selector label`),description:_(`Choose a theme for this browser, or save the gateway default.`,`Theme settings scope`),local:_(`Using a theme saved in this browser`,`Theme preference source`),default:_(`Using the default theme`,`Theme preference source`),current:_(`Current: {name}`,`Current theme; name is plugin-owned`),gateway:_(`Default: {name}{auto, select, yes { · Follows system appearance} other {}}`,`Gateway default theme and system appearance status`),catalogLoading:_(`Loading themes…`,`Theme catalog loading status`),catalogError:_(`Couldn’t load themes. {error}`,`Theme catalog load failure; error is the raw host diagnostic`),retryCatalog:_(`Retry`,`Retry loading the theme catalog`),unavailable:_(`{id} (unavailable)`,`Unavailable theme identifier; preserve id`),unavailableHelp:_(`This theme is unavailable. Choose an available theme, or enable the plugin that provides it.`,`Recovery for a missing theme plugin`),auto:_(`Follow system appearance`,`Automatic light/dark theme checkbox`),autoHelp:_(`Switch between light and dark versions when this theme supports both.`,`Automatic theme behavior`),useLocal:_(`Use in this browser`,`Apply staged theme only to this browser`),setDefault:_(`Set gateway default`,`Save staged theme as the gateway default`),useDefault:_(`Use the default`,`Remove this browser's theme override`),scope:_(`Setting a default leaves saved browser choices unchanged. Use the default to remove this browser's override.`,`Theme preference scope guidance`)},Ee={heading:_(`Keyboard shortcuts`,`Shortcut settings heading`),description:_(`Type or record a shortcut, then save each action. <code>mod</code> means ⌘ on Mac or Ctrl elsewhere. Try <code>mod+k</code> or a sequence like <code>g p</code>.`,`Shortcut editing instructions; code spans are literal key syntax`),refresh:_(`Refresh shortcuts`,`Reload shortcut settings`),loading:_(`Loading shortcuts…`,`Shortcut settings loading state`),unavailable:_(`Shortcut settings are unavailable. Refresh shortcuts to try again.`,`Shortcut settings unavailable state`),details:_(`Shortcut details`,`Disclosure of shortcut precedence and config location`),editableHelp:_(`Unmodified app shortcuts work outside editable fields. Composer send shortcuts accept one key combination and take priority inside the editor. Unassigned Enter and Shift+Enter insert newlines.`,`Shortcut behavior in editable fields`),screenHelp:_(`Touch or narrow screen applies when the primary pointer is coarse or the viewport is at most 760px wide. Desktop applies otherwise.`,`Composer shortcut breakpoint explanation`),priorityHelp:_(`Custom app shortcuts take priority over defaults. Ties use action id order. Shorter shortcuts block longer sequences with the same prefix.`,`Shortcut conflict resolution explanation`),configFile:_(`Config file`,`Shortcut config path label`),unknown:_(`Unknown`,`Config path unavailable`),configHelp:_(`Shortcut overrides are saved under <code>shortcuts</code>. A value of <code>null</code> disables the action shortcut.`,`Shortcut config storage; code spans are literal config syntax`),sendBehavior:_(`Send behavior`,`Composer shortcut send settings heading`),sendWhileRunning:_(`Send while agent is running`,`Composer streaming behavior selector label`),steer:_(`Steer (default)`,`Send message before the next model call`),followUp:_(`Follow-up`,`Send message after the current response`),sendHelp:_(`Keyboard shortcut only. Steer sends before the next model call; follow-up waits for the response to finish.`,`Scope of streaming send preference`),noActions:_(`No actions registered.`,`Empty shortcut action list`),composerGroup:_(`Chat composer`,`Built-in composer shortcut group`),otherGroup:_(`Other`,`Actions with no supplied group`),composerTitle:_(`Send message — {screen, select, mobile {touch or narrow screen} other {desktop}}`,`Composer send shortcut action title`),composerDescription:_(`One key combination, active only in the message editor. Overrides global shortcuts there.`,`Composer send shortcut action description`),defaultShortcut:_(`Default: <key>{shortcut}</key>`,`Default key binding; key callback safely marks up literal shortcut syntax`),noDefaultShortcut:_(`No default shortcut`,`Action has no default binding`),disabled:_(`Disabled`,`Disabled shortcut state`),unassigned:_(`Unassigned`,`Unassigned shortcut state`),state:_(`{state, select, default {Default} custom {Custom} disabled {Disabled} other {No default}}{unsaved, select, yes { · Unsaved} other {}}`,`Binding source and staged draft status`),shortcut:_(`Shortcut`,`Shortcut text field label`),shortcutFor:_(`Shortcut for {title}`,`Accessible shortcut field label; title belongs to action provider`),save:_(`Save`,`Save this action's shortcut`),saveFor:_(`Save shortcut for {title}`,`Accessible save shortcut action`),cancelRecording:_(`Cancel recording`,`Stop shortcut recording`),record:_(`Record`,`Start shortcut recording`),recordFor:_(`{recording, select, yes {Cancel recording for {title}} other {Record shortcut for {title}}}`,`Accessible shortcut record toggle`),disable:_(`Disable shortcut`,`Disable a shortcut binding`),disableFor:_(`Disable shortcut for {title}`,`Accessible disable shortcut action`),restore:_(`Restore default`,`Remove a custom shortcut preference`),restoreFor:_(`Restore default shortcut for {title}`,`Accessible restore shortcut action`),recording:_(`Recording shortcut: press a key combination or sequence. Press Esc to stop.`,`Recording before the first key`),recordingSequence:_(`Recording shortcut: {shortcut}. Press another key to add a sequence, or wait to finish.`,`Recording with a captured literal key sequence`),invalidKey:_(`Press a letter, number, punctuation, function, or navigation key. Press Esc to cancel recording.`,`Unsupported key while recording`),saveFailure:_(`Could not save shortcut. {diagnostic}`,`Shortcut save failure; diagnostic is unmodified runtime detail`),singleChord:_(`Composer send shortcuts must be a single key combination, not a sequence.`,`Composer shortcut validation`),empty:_(`Enter a shortcut, choose None, or reset to the default.`,`Empty shortcut parse failure`),missingKey:_(`Shortcut chords must include a key.`,`Shortcut parse failure: modifiers without a key`),duplicateModifier:_(`Shortcut has duplicate {value} modifiers.`,`Shortcut parse failure; value is a literal modifier key name`),unsupportedKey:_(`Unsupported shortcut key: {value}`,`Shortcut parse failure; value is raw key syntax`),multipleKeys:_(`Each shortcut chord can include only one non-modifier key.`,`Shortcut parse failure: multiple keys in a chord`),inactive:_(`Conflict: inactive; used by {title}`,`Shortcut shadowed by another action`),anotherAction:_(`another action`,`Unknown owner of a conflicting shortcut`),conflict:_(`Conflict: takes priority over {count, plural, one {# action} other {# actions}}: {names}{more, plural, =0 {} other {, +# more}}`,`Winning shortcut conflict summary; names is a regional list of up to two provider-owned action titles`)},De={panel:_(`Settings panel`,`Accessible fallback name when a settings panel has no heading`),notices:_(`Settings notices`,`Accessible name for a settings panel's notice stack`)},Oe=x.registerMessages(`core.settingsFrame`,De),D=x.registerMessages(`core.settingsTheme`,Te),O=x.registerMessages(`core.settingsShortcuts`,Ee),ke={availability:`error`,error:`error`,success:`success`,security:`warning`,warning:`warning`,info:`info`};function Ae(e){return e.tone??ke[e.type]}var k=class extends T{constructor(){super(),this.heading=``,this.description=``,this.actionLabel=``,this.actionTitle=``,this.actionDisabled=!1,this.notices=[],new y(this),n.createController(this)}render(){return w`
|
|
2
|
-
<section class="panel" aria-label=${this.heading||Oe.t(`panel`)}>
|
|
3
|
-
<header class="section-heading">
|
|
4
|
-
<div class="heading-copy">
|
|
5
|
-
${this.heading===``?C:w`<h2>${this.heading}</h2>`}
|
|
6
|
-
<div class="description"><slot name="description">${this.description}</slot></div>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="heading-actions"><slot name="actions">${this.renderDefaultAction()}</slot></div>
|
|
9
|
-
</header>
|
|
10
|
-
${this.renderNoticeStack()}
|
|
11
|
-
<div class="content"><slot></slot></div>
|
|
12
|
-
</section>
|
|
13
|
-
`}renderDefaultAction(){return this.actionLabel===``?C:w`
|
|
14
|
-
<button
|
|
15
|
-
class="secondary ui-button ui-button--action"
|
|
16
|
-
title=${this.actionTitle||this.actionLabel}
|
|
17
|
-
?disabled=${this.actionDisabled}
|
|
18
|
-
@click=${()=>{this.onAction?.()}}
|
|
19
|
-
>${this.actionLabel}</button>
|
|
20
|
-
`}renderNoticeStack(){return this.notices.length===0?C:w`
|
|
21
|
-
<div class="notice-stack" aria-label=${Oe.t(`notices`)}>
|
|
22
|
-
${this.notices.map(e=>this.renderNotice(e))}
|
|
23
|
-
</div>
|
|
24
|
-
`}renderNotice(e){let t=Ae(e),n=e.role??je(t),r=e.title;return w`
|
|
25
|
-
<article class=${`notice ui-notice ${t}`} role=${n}>
|
|
26
|
-
${r===void 0||r===``?C:w`<strong class="notice-title">${r}</strong>`}
|
|
27
|
-
<div class="notice-content">${e.content}</div>
|
|
28
|
-
</article>
|
|
29
|
-
`}static{this.styles=[e,fe,S`
|
|
30
|
-
@layer pi-web-base {
|
|
31
|
-
:host { display: block; }
|
|
32
|
-
.panel { display: block; }
|
|
33
|
-
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--pi-border-muted); background: var(--pi-surface); }
|
|
34
|
-
.heading-copy { display: grid; gap: 6px; min-width: 0; }
|
|
35
|
-
.heading-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
|
|
36
|
-
h2 { margin: 0; font-size: 17px; line-height: 1.25; }
|
|
37
|
-
.description { color: var(--pi-muted); line-height: 1.45; }
|
|
38
|
-
.description ::slotted(*) { margin: 0; }
|
|
39
|
-
.secondary { flex: 0 0 auto; }
|
|
40
|
-
.notice-stack { display: grid; gap: 1px; }
|
|
41
|
-
.notice-title { display: block; margin-bottom: 4px; color: inherit; }
|
|
42
|
-
.notice-content { min-width: 0; }
|
|
43
|
-
code { border: 1px solid var(--pi-border-muted); border-radius: 5px; background: var(--pi-bg); padding: 1px 4px; color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
44
|
-
.content { display: grid; gap: 0; min-width: 0; }
|
|
45
|
-
.content ::slotted(*) { min-width: 0; }
|
|
46
|
-
|
|
47
|
-
@media (max-width: 760px) {
|
|
48
|
-
.section-heading { display: grid; gap: 12px; }
|
|
49
|
-
.heading-actions { justify-self: start; }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
`]}};c([m()],k.prototype,`heading`,void 0),c([m({attribute:!1})],k.prototype,`description`,void 0),c([m()],k.prototype,`actionLabel`,void 0),c([m()],k.prototype,`actionTitle`,void 0),c([m({type:Boolean})],k.prototype,`actionDisabled`,void 0),c([m({attribute:!1})],k.prototype,`notices`,void 0),c([m({attribute:!1})],k.prototype,`onAction`,void 0),k=c([l(`settings-panel-frame`)],k);function je(e){switch(e){case`error`:return`alert`;case`success`:return`status`;case`warning`:case`info`:return`note`}}var A=x.registerMessages(`core.settingsMcp`,we),j=class extends T{constructor(){super(),this.targetLabel=``,this.servers=[],this.loading=!1,this.generation=0,new y(this),n.createController(this)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.reload()}disconnectedCallback(){this.generation+=1,this.servers=[],this.error=void 0,this.loading=!1,super.disconnectedCallback()}willUpdate(e){e.has(`context`)&&this.reload()}isCurrent(e,t){return this.isConnected&&e===this.generation&&t.machineId===this.context?.machineId&&t.session.id===this.context.session.id&&t.session.cwd===this.context.session.cwd}async reload(){let e=++this.generation;if(this.servers=[],this.error=void 0,this.loading=!1,!this.isConnected||this.context===void 0)return;let t={machineId:this.context.machineId,session:{...this.context.session}};this.loading=!0;try{let n=await xe.mcpAuthServers(t.session,t.machineId);this.isCurrent(e,t)&&(this.servers=n.servers)}catch(n){this.isCurrent(e,t)&&(this.error={kind:`load`,diagnostic:Me(n)})}finally{this.isCurrent(e,t)&&(this.loading=!1)}}async authenticate(e,t,n){let r=this.generation;try{await this.onMcpAuth?.(e,t,n)}catch(e){this.isCurrent(r,n)&&(this.error={kind:`auth`,diagnostic:Me(e)})}}render(){let e=this.context===void 0?void 0:{machineId:this.context.machineId,session:{...this.context.session}};return w`
|
|
54
|
-
<settings-panel-frame
|
|
55
|
-
.heading=${A.t(`heading`)}
|
|
56
|
-
.description=${A.t(`description`)}
|
|
57
|
-
.actionLabel=${A.t(`refresh`)}
|
|
58
|
-
.actionDisabled=${e===void 0||this.loading}
|
|
59
|
-
.onAction=${()=>this.reload()}
|
|
60
|
-
.notices=${this.error===void 0?[]:[{type:`error`,content:A.t(this.error.kind===`load`?`loadError`:`authError`,{error:this.error.diagnostic})}]}
|
|
61
|
-
>
|
|
62
|
-
<section class="ui-settings-section">
|
|
63
|
-
${e===void 0?w`
|
|
64
|
-
<p role="status">${A.t(`selectSession`,{target:this.targetLabel||A.t(`thisMachine`)})}</p>
|
|
65
|
-
`:w`
|
|
66
|
-
<div class="ui-settings-heading"><h3>${A.t(`context`)}</h3></div>
|
|
67
|
-
<div class="ui-settings-summary session-context" aria-label=${A.t(`contextAria`)}>
|
|
68
|
-
<span><strong>${A.t(`machine`)}</strong> <bdi>${this.targetLabel||A.t(`thisMachine`)}</bdi></span>
|
|
69
|
-
<span><strong>${A.t(`session`)}</strong> <bdi>${e.session.id}</bdi></span>
|
|
70
|
-
<span><strong>${A.t(`workspace`)}</strong> <bdi dir="ltr">${e.session.cwd}</bdi></span>
|
|
71
|
-
</div>
|
|
72
|
-
<p>${A.t(`logoutHelp`)}</p>
|
|
73
|
-
${this.loading?w`<p role="status">${A.t(`loading`)}</p>`:this.error===void 0?this.servers.length===0?w`
|
|
74
|
-
<p role="status">${A.t(`empty`)}</p>
|
|
75
|
-
`:w`
|
|
76
|
-
<ul class="ui-settings-list server-list" aria-label=${A.t(`serversAria`)}>
|
|
77
|
-
${this.servers.map(t=>w`
|
|
78
|
-
<li class="ui-settings-row">
|
|
79
|
-
<div class="server-copy ui-settings-heading">
|
|
80
|
-
<h3 dir="auto">${t.name}</h3>
|
|
81
|
-
${t.description===void 0?null:w`<p class="server-description" dir="auto">${t.description}</p>`}
|
|
82
|
-
</div>
|
|
83
|
-
<div class="ui-settings-actions">
|
|
84
|
-
<button class="ui-button ui-button--action" aria-label=${A.t(`loginAria`,{name:t.name})} ?disabled=${this.onMcpAuth===void 0} @click=${()=>{this.authenticate(`login`,t.name,e)}}>${A.t(`login`)}</button>
|
|
85
|
-
<button class="ui-button ui-button--action" aria-label=${A.t(`logoutAria`,{name:t.name})} ?disabled=${this.onMcpAuth===void 0} @click=${()=>{this.authenticate(`logout`,t.name,e)}}>${A.t(`logout`)}</button>
|
|
86
|
-
</div>
|
|
87
|
-
</li>
|
|
88
|
-
`)}
|
|
89
|
-
</ul>
|
|
90
|
-
`:null}
|
|
91
|
-
`}
|
|
92
|
-
</section>
|
|
93
|
-
</settings-panel-frame>
|
|
94
|
-
`}static{this.styles=[e,E,S`
|
|
95
|
-
@layer pi-web-base {
|
|
96
|
-
:host { display: block; }
|
|
97
|
-
p { line-height: 1.45; }
|
|
98
|
-
.ui-settings-section > p { margin: 0; }
|
|
99
|
-
.session-context { overflow-wrap: anywhere; }
|
|
100
|
-
.server-list { margin: 0; padding: 0; list-style: none; }
|
|
101
|
-
.server-copy { flex: 1 1 240px; min-width: 0; }
|
|
102
|
-
.server-description { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
103
|
-
}
|
|
104
|
-
`]}};c([m({attribute:!1,hasChanged:(e,t)=>e?.machineId!==t?.machineId||e?.session.id!==t?.session.id||e?.session.cwd!==t?.session.cwd})],j.prototype,`context`,void 0),c([m()],j.prototype,`targetLabel`,void 0),c([m({attribute:!1})],j.prototype,`onMcpAuth`,void 0),c([p()],j.prototype,`servers`,void 0),c([p()],j.prototype,`loading`,void 0),c([p()],j.prototype,`error`,void 0),j=c([l(`settings-mcp-panel`)],j);function Me(e){return e instanceof Error?e.message:String(e)}var Ne={heading:_(`General configuration`,`General settings heading`),refresh:_(`Refresh settings`,`Reload gateway and selected machine settings`),description:_(`Gateway settings apply to this server. The machine name, file access, and uploads apply to {target}.`,`General configuration scope; target is a raw machine label`),selectedMachine:_(`selected machine`,`Fallback machine target when no label is supplied`),chatAria:_(`Chat display settings`,`Chat display section accessible name`),chat:_(`Chat display`,`Chat display section heading`),chatHelp:_(`Choose how much agent activity the transcript shows before you open it.`,`Chat display guidance`),loadingGateway:_(`Loading gateway configuration…`,`Gateway configuration loading status`),chatUnavailable:_(`Chat display settings are unavailable. Choose Refresh settings to try again.`,`Chat display unavailable recovery`),quiet:_(`Quiet mode`,`Transcript quiet mode checkbox`),quietHelp:_(`Collapse tool calls, thinking, and other agent activity into one “events” line you can expand. Off by default.`,`Transcript quiet mode guidance`),gatewayAria:_(`Gateway server settings`,`Gateway section accessible name`),gateway:_(`Gateway server`,`Gateway section heading`),gatewayHelp:_(`Save host, port, and allowed hosts on this gateway. Restart the web service to apply host or port changes.`,`Gateway configuration scope and restart guidance`),gatewayUnavailable:_(`Gateway settings are unavailable. Choose Refresh settings to try again.`,`Gateway settings unavailable recovery`),gatewayFile:_(`Gateway config file`,`Gateway configuration path label`),exists:_(`Existing file`,`Config file exists status`),createFile:_(`This file will be created on save`,`Config file absent status`),host:_(`Host`,`Gateway bind host field`),hostHelp:_(`Address the web server should bind to. Leave empty to use PI WEB''s default.`,`Gateway bind host guidance`),port:_(`Port`,`Gateway port field`),portHelp:_(`TCP port from {min, number} to {max, number}. Leave empty to use PI WEB''s default.`,`Gateway port guidance; numeric limits`),allowedHosts:_(`Allowed hosts`,`Gateway allowed hosts field`),hostsList:_(`Only listed hosts`,`Restrict gateway to listed hosts option`),hostsAll:_(`Allow every host`,`Disable gateway host restriction option`),hostList:_(`Host list`,`Gateway host list field`),hostsHelp:_(`Enter one host per line. “Allow every host” disables the host restriction.`,`Gateway allowed hosts guidance`),unsaved:_(`Unsaved changes`,`Settings form dirty status`),saving:_(`Saving…`,`Settings save in progress`),saveGateway:_(`Save gateway server config`,`Save gateway configuration action`),machine:_(`Selected machine settings`,`Machine section heading and accessible name`),machineHelp:_(`Save the machine name, file access, and upload defaults on {target}.`,`Machine settings scope; raw target label`),loadingMachine:_(`Loading selected-machine settings…`,`Machine settings loading status`),machineUnavailable:_(`Machine settings are unavailable. Choose Refresh settings to try again.`,`Machine settings unavailable recovery`),machineFile:_(`Selected machine config file`,`Machine config path label`),name:_(`Machine name`,`Machine installation name field`),nameHelp:_(`Shown in the machine selector and installed app. Leave blank to use PI-WEB.`,`Machine name guidance`),roots:_(`Global external path additions`,`Machine-wide additional external roots field`),rootsHelp:_(`Additional roots for absolute <code>@</code> completions and file explorer reads outside a workspace on {target}. Enter one absolute path, Windows absolute path, or <code>~</code>-prefixed path per line. Leaving this empty does not remove machine base roots or project additions.`,`External filesystem access guidance; code marks literal syntax; target is a raw label`),upload:_(`Default upload folder`,`Manual file upload default field`),uploadHelp:_(`Workspace-relative folder for manual file uploads on {target}. Leave empty to inherit the default. The built-in default is <code>{folder}</code>.`,`Upload folder guidance; raw target and folder`),attachment:_(`Default attachments folder`,`Prompt attachments folder field`),attachmentHelp:_(`Workspace-relative folder for prompt attachments saved into the workspace on {target}. Leave empty to inherit the default. The built-in default is <code>{folder}</code>.`,`Attachment folder guidance; raw target and folder`),saveMachine:_(`Save machine settings`,`Save selected machine configuration action`),configuration:_(`Configuration`,`Configuration error notice title`),override:_(`environment override`,`Environment override field badge`),effectiveGatewayAria:_(`Gateway settings after environment overrides`,`Gateway effective summary accessible name`),effectiveGateway:_(`Gateway settings after overrides`,`Gateway effective summary heading`),effectiveHelp:_(`Environment overrides take priority. Host and port apply after the web service restarts; these values do not verify the running address.`,`Effective settings priority and runtime caveat`),defaultValue:_(`{value} default`,`Default configuration value; raw value must remain unchanged`),effectiveMachineAria:_(`Effective selected machine file access and upload summary`,`Effective selected machine summary accessible name`),effectiveMachine:_(`Effective selected-machine settings`,`Effective selected machine summary heading`),baseRoots:_(`Machine base roots`,`Effective machine base paths summary label`),baseRootsHelp:_(`Edit base roots in the machine config file or through the API.`,`Machine base roots have no Settings editor`),externalRoots:_(`Global additions`,`Effective machine-wide additional external roots label`),machineSummaryHelp:_(`Machine-wide values only. Projects may add external roots; project additions are not shown here.`,`Machine summary excludes project-specific access`),noPaths:_(`None listed`,`Empty base roots or global additions list`),uploadFolder:_(`Upload folder`,`Effective upload folder label`),attachmentFolder:_(`Attachments folder`,`Effective attachments folder label`),anyHost:_(`Any host`,`All hosts allowed effective value`),noHosts:_(`None listed`,`Empty allowed hosts effective value`),unset:_(`Unset`,`Unconfigured allowed hosts effective value`),denied:_(`No machine-wide external roots. Projects may still add external roots.`,`Neither machine base roots nor global additions are configured`),invalidPort:_(`Port must be an integer from {min, number} to {max, number}.`,`Invalid gateway port validation`),externalPath:_(`Allowed external paths must be absolute paths or start with ~: {value}`,`Invalid external root; raw path`),folderRelative:_(`{field, select, upload {Upload default folder must be workspace-relative.} other {Attachment default folder must be workspace-relative.}}`,`Invalid absolute default folder`),folderTraversal:_(`{field, select, upload {Upload default folder must not contain path traversal.} other {Attachment default folder must not contain path traversal.}}`,`Invalid traversal in default folder`)},Pe=class extends Error{constructor(e,t){super(t),this.validation=e}};function Fe(){return{command:``,dir:``}}function Ie(e){return{command:e.agent?.command??``,dir:e.agent?.dir??``}}function Le(e){let t=e.command.trim(),n=e.dir.trim();return{agent:{...t===``?{}:{command:t},...n===``?{}:{dir:n}}}}function Re(e,t){let n=Le(e).agent??{},r=t.agent??{};return n.command===r.command&&n.dir===r.dir}function ze(){return{host:``,port:``,allowedHostsMode:`list`,allowedHostsText:``}}function Be(){return{installationName:``,allowedPathsText:``,uploadDefaultFolder:``,attachmentDefaultFolder:``}}function Ve(e){return{host:e.host??``,port:e.port===void 0?``:String(e.port),allowedHostsMode:e.allowedHosts===!0?`all`:`list`,allowedHostsText:Array.isArray(e.allowedHosts)?e.allowedHosts.join(`
|
|
105
|
-
`):``}}function He(e){return{installationName:e.installationName??``,allowedPathsText:e.pathAccess?.allowedPaths?.join(`
|
|
106
|
-
`)??``,uploadDefaultFolder:e.uploads?.defaultFolder??``,attachmentDefaultFolder:e.attachments?.defaultFolder??``}}function Ue(e,t,n){let r={...n};for(let n in e)e[n]!==t[n]&&(r[n]=e[n]);return r}function We(e,t={}){let n=Ke(t),r=e.host.trim(),i=e.port.trim();if(r!==``&&(n.host=r),i!==``){let e=Number(i);if(!Number.isInteger(e)||e<1||e>65535)throw new Pe({kind:`port`},`Port must be an integer from 1 to 65535.`);n.port=e}return n.allowedHosts=e.allowedHostsMode===`all`||qe(e.allowedHostsText),n}function Ge(e){let t=Je(e.allowedPathsText),n=Ye(e.uploadDefaultFolder,`upload`),r=Ye(e.attachmentDefaultFolder,`attachment`);return{installationName:e.installationName.trim(),pathAccess:{allowedPaths:t},uploads:n===``?{}:{defaultFolder:n},attachments:r===``?{}:{defaultFolder:r}}}function Ke(e){return{...e.installationName===void 0?{}:{installationName:e.installationName},...e.shortcuts===void 0?{}:{shortcuts:e.shortcuts},...e.defaultTheme===void 0?{}:{defaultTheme:e.defaultTheme},...e.defaultLocalization===void 0?{}:{defaultLocalization:e.defaultLocalization},...e.defaultStreamingBehavior===void 0?{}:{defaultStreamingBehavior:e.defaultStreamingBehavior},...e.quietMode===void 0?{}:{quietMode:e.quietMode},...e.plugins===void 0?{}:{plugins:e.plugins},...e.normalAuth===void 0?{}:{normalAuth:e.normalAuth},...e.sessionArchive===void 0?{}:{sessionArchive:e.sessionArchive},...e.pathAccess===void 0?{}:{pathAccess:e.pathAccess},...e.uploads===void 0?{}:{uploads:e.uploads},...e.attachments===void 0?{}:{attachments:e.attachments},...e.maxUploadBytes===void 0?{}:{maxUploadBytes:e.maxUploadBytes},...e.spawnSessions===void 0?{}:{spawnSessions:e.spawnSessions},...e.subsessions===void 0?{}:{subsessions:e.subsessions},...e.sessionMessages===void 0?{}:{sessionMessages:e.sessionMessages},...e.askUser===void 0?{}:{askUser:e.askUser},...e.agent===void 0?{}:{agent:e.agent}}}function qe(e){return e.split(/[\n,]/u).map(e=>e.trim()).filter(e=>e!==``)}function Je(e){let t=e.split(`
|
|
107
|
-
`).map(e=>e.trim()).filter(e=>e!==``),n=t.find(e=>!Xe(e));if(n!==void 0)throw new Pe({kind:`externalPath`,value:n},`Allowed external paths must be absolute paths or start with ~: ${n}`);return t}function Ye(e,t){let n=t===`upload`?`Upload default folder`:`Attachment default folder`,r=e.trim();if(r===``)return``;if(Ze(r))throw new Pe({kind:`folderRelative`,field:t},`${n} must be workspace-relative.`);let i=r.split(/[\\/]+/u).filter(e=>e!==``&&e!==`.`);if(i.length===0)return``;if(i.some(e=>e===`..`))throw new Pe({kind:`folderTraversal`,field:t},`${n} must not contain path traversal.`);return i.join(`/`)}function Xe(e){return e===`~`||e.startsWith(`~/`)||e.startsWith(`~\\`)||e.startsWith(`/`)||e.startsWith(`\\`)||/^[A-Za-z]:[\\/]/u.test(e)}function Ze(e){let t=e.replace(/\\/g,`/`);return t.startsWith(`/`)||/^[A-Za-z]:\//u.test(t)}var M=x.registerMessages(`core.settingsGeneral`,Ne);function Qe(e){if(!(e instanceof Pe))return e instanceof Error?e.message:String(e);let t=e.validation;switch(t.kind){case`port`:return M.t(`invalidPort`,{min:1,max:65535});case`externalPath`:return M.t(`externalPath`,{value:t.value});case`folderRelative`:return M.t(`folderRelative`,{field:t.field});case`folderTraversal`:return M.t(`folderTraversal`,{field:t.field})}}var $e={heading:_(`Language and region`,`Browser-local localization settings section heading`),description:_(`Applies to this browser, across all machines and projects. Your messages and code stay unchanged.`,`Scope of localization preferences`),language:_(`Interface language`,`UI language field label`),languageHelp:_(`English is the fallback. Install language-pack plugins for more translations.`,`Explains available language choices and partial catalogs`),languageOption:_(`{name} ({code})`,`Language choice with native Intl display name and stable locale identifier`),region:_(`Regional format`,`Regional formatting locale field label`),regionHelp:_(`Leave blank to use the default, or enter a language tag such as en-GB or de-DE for dates and numbers.`,`Help for an optional regional formatting override`),useDefault:_(`Use default`,`Placeholder for an empty field that inherits the default shown below`),gatewayDefault:_(`Gateway default: <isolate>{value}</isolate>`,`Inherited value configured by the PI WEB server; not the selected remote machine`),browserDefault:_(`Browser default: <isolate>{value}</isolate>`,`Inherited browser-provided locale or time zone`),zone:_(`Time zone`,`Time-zone override field label`),zoneHelp:_(`Leave blank to use the default, or enter a time zone such as Europe/Berlin or UTC.`,`Help for native Intl time-zone identifiers`),hours:_(`Clock format`,`Hour-cycle preference field label`),hoursDefault:_(`Regional default`,`Use the regional locale's default hour cycle`),hoursGatewayDefault:_(`Gateway default`,`Use the clock format configured by the gateway instead of a browser-local override`),h12:_(`12-hour`,`Conventional 12-hour clock, with hours 1 through 12 and a day period`),h23:_(`24-hour (0–23)`,`Conventional 24-hour clock, with midnight displayed as hour zero`),apply:_(`Apply to this browser`,`Apply localization form without changing server configuration`),applying:_(`Applying…`,`Localization catalogs are loading`),reset:_(`Use defaults`,`Remove all browser-local localization overrides and inherit server or browser defaults`),saved:_(`Language and region applied.`,`Localization preferences applied successfully`),preview:_(`Current format`,`Heading for applied regional formatting examples`),datePreview:_(`Date and time: {value}`,`Applied date/time preview; value is a native Intl-formatted date`),numberPreview:_(`Number: {value}`,`Applied number preview; value is a native Intl-formatted number`),invalidLanguage:_(`Choose a valid language tag, such as en.`,`Language validation error`),invalidRegion:_(`Enter a valid language tag, such as en-GB, or leave it blank.`,`Regional locale validation error`),invalidZone:_(`Enter a supported time-zone name, such as Europe/Berlin, or leave it blank.`,`Time-zone validation error`),invalidHours:_(`Choose a clock format from the list.`,`Hour-cycle validation error`),applyFailure:_(`Could not apply language and region: {diagnostic}`,`Unexpected preference failure; diagnostic remains verbatim`)},et={enforced:_(`Controlled by {variable}`,`Environment-enforced setting; variable is an environment variable name`),source:_(`Source: {source}`,`Effective setting source reported by the machine`),reset:_(`Reset saved override`,`Remove a writable config setting to inherit defaults`),resetSetting:_(`Reset saved override for {setting}`,`Accessible reset action; setting is a JSON pointer`)},tt={defaultLocalization:[`language`,`formatLocale`,`timeZone`,`hourCycle`],uploads:[`defaultFolder`],attachments:[`defaultFolder`],sessionArchive:[`directory`],pathAccess:[`allowedPaths`]};function nt(e){return Object.entries(tt).find(([t])=>t===e)?.[1]}function rt(e){let[t]=e;return t===void 0?!1:e.length===1?t===`plugins`||nt(t)!==void 0:t===`plugins`&&(e.length===2||e.length===3&&e[2]===`settings`)}function it(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function at(e,t){let n={...e,...it(t)};for(let r of Object.keys(tt)){let i=Object.getOwnPropertyDescriptor(t,r)?.value;if(!ct(i))continue;let a=Object.getOwnPropertyDescriptor(e,r)?.value;Object.defineProperty(n,r,{value:{...ct(a)?a:{},...it(i)},enumerable:!0,configurable:!0,writable:!0})}if(t.plugins!==void 0){n.plugins={...e.plugins};for(let[r,i]of Object.entries(t.plugins)){let t=e.plugins?.[r];n.plugins[r]={...t,...it(i),...i.settings===void 0?{}:{settings:{...t?.settings,...it(i.settings)}}}}}return n}function ot(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function st(e){let t=[];for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let i=nt(n);if(i!==void 0&&ct(r))for(let e of i)Object.getOwnPropertyDescriptor(r,e)?.value!==void 0&&t.push(`/${n}/${ot(e)}`);else if(n===`plugins`)for(let[n,r]of Object.entries(e.plugins??{})){let e=`/plugins/${ot(n)}`;r.enabled!==void 0&&t.push(`${e}/enabled`);for(let n of Object.keys(it(r.settings??{})))t.push(`${e}/settings/${ot(n)}`)}else t.push(`/${n}`)}return t}function ct(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var lt=x.registerMessages(`core.settingsConfigUpdate`,et);function ut(...e){return`/${e.map(e=>e.replace(/~/gu,`~0`).replace(/\//gu,`~1`)).join(`/`)}`}function dt(e,t){let n=e;for(let e of t.slice(1).split(`/`)){if(typeof n!=`object`||!n)return;n=Object.getOwnPropertyDescriptor(n,e.replace(/~1/gu,`/`).replace(/~0/gu,`~`))?.value}return n}function N(e,t){for(let n=t;n!==``;n=n.slice(0,n.lastIndexOf(`/`))){let t=e?.enforcedSettings?.[n];if(t!==void 0)return t}let n=t.slice(1).split(`/`)[0]??``;if(e&&Object.getOwnPropertyDescriptor(e.envOverrides,n)?.value===!0)return`PI_WEB_${n.replace(/[A-Z]/gu,e=>`_${e}`).toUpperCase()}`}function ft(e,t,n=e?.config??{}){let r={},i=(t,n,r,a)=>{let o=r[r.length-1];if(o!==void 0&&N(e,ut(...r))===void 0){if(rt(r)&&typeof t==`object`&&t&&!Array.isArray(t)){let e={};for(let[a,o]of Object.entries(t))i(o,typeof n==`object`&&n?Object.getOwnPropertyDescriptor(n,a)?.value:void 0,[...r,a],e);Object.keys(e).length&&Object.defineProperty(a,o,{value:e,enumerable:!0})}else t!==void 0&&JSON.stringify(t)!==JSON.stringify(n)&&Object.defineProperty(a,o,{value:t,enumerable:!0})}};for(let[e,a]of Object.entries(t))i(a,Object.getOwnPropertyDescriptor(n,e)?.value,[e],r);return Object.keys(r).length?{set:r}:{}}function pt(e,t){let n=st(e?.config??{});return{unset:[...new Set(t.flatMap(e=>n.filter(t=>t===e||t.startsWith(`${e}/`))))].filter(t=>N(e,t)===void 0)}}function mt(e,t,n){let r=(e,t)=>{let r={...e};for(let e of n)Reflect.deleteProperty(r,e);return{...r,...Object.fromEntries(Object.entries(t).filter(([e])=>n.some(t=>t===e)))}},i=(e={},t={})=>({...Object.fromEntries(Object.entries(e).filter(([e])=>!n.some(t=>e===`/${t}`||e.startsWith(`/${t}/`)))),...Object.fromEntries(Object.entries(t).filter(([e])=>n.some(t=>e===`/${t}`||e.startsWith(`/${t}/`))))});return{...e,config:r(e.config,t.config),effectiveConfig:r(e.effectiveConfig,t.effectiveConfig),...e.defaultsConfig===void 0&&t.defaultsConfig===void 0?{}:{defaultsConfig:r(e.defaultsConfig??{},t.defaultsConfig??{})},...e.enforcedSettings===void 0&&t.enforcedSettings===void 0?{}:{enforcedSettings:i(e.enforcedSettings,t.enforcedSettings)},...e.configSources===void 0&&t.configSources===void 0?{}:{configSources:i(e.configSources,t.configSources)},envOverrides:{...e.envOverrides,...t.envOverrides}}}function ht(e,t){return e===void 0?t===void 0?C:w`<small>${lt.t(`source`,{source:t})}</small>`:w`<small>${lt.t(`enforced`,{variable:e})}</small>`}function P(e,t,n,r){let i=N(e,t),a;for(let n=t;n!==``&&a===void 0;n=n.slice(0,n.lastIndexOf(`/`)))a=e?.configSources?.[n];let o=pt(e,[t]).unset??[];return i===void 0&&a===void 0&&(!r||dt(e?.config,t)===void 0)?C:w`<span class="setting-controls">
|
|
108
|
-
${ht(i,a)}
|
|
109
|
-
${r&&dt(e?.config,t)!==void 0?w`<button type="button" class="ui-button ui-button--action ui-button--compact" aria-label=${lt.t(`resetSetting`,{setting:t})} ?disabled=${n||o.length===0} @click=${()=>{r(o)}}>${lt.t(`reset`)}</button>`:C}
|
|
110
|
-
</span>`}var F=x.registerMessages(`core.settingsLocalization`,$e);function gt(e){return{language:e.language??x.preferences.language,formatLocale:e.formatLocale??``,timeZone:e.timeZone??``,hourCycle:e.hourCycle??``}}function _t(e){let t=x.availableLanguages;return t.includes(e)?e:t.includes(x.language)?x.language:`en`}function vt(e){return e.hourCycle?e.hourCycle===`h11`||e.hourCycle===`h12`?`h12`:`h23`:``}function yt(e,t){return e.language===t.language&&e.formatLocale===t.formatLocale&&e.timeZone===t.timeZone&&e.hourCycle===t.hourCycle}function bt(e){for(let[t,n]of[[`language`,`invalidLanguage`],[`formatLocale`,`invalidRegion`]])if(t!==`formatLocale`||e[t].trim())try{if(Intl.getCanonicalLocales(e[t].trim())[0]===void 0)return{field:t,key:n}}catch{return{field:t,key:n}}try{new Intl.DateTimeFormat(`en`,e.timeZone.trim()?{timeZone:e.timeZone.trim()}:{})}catch{return{field:`timeZone`,key:`invalidZone`}}if(![``,`h11`,`h12`,`h23`,`h24`].includes(e.hourCycle))return{field:`hourCycle`,key:`invalidHours`}}var I=class extends T{locked(e){return N(this.configResponse,`/defaultLocalization/${e}`)!==void 0||x.preferenceSettingPolicy(e).locked}fieldSource(e){let t=x.preferenceSettingPolicy(e);return ht(N(this.configResponse,`/defaultLocalization/${e}`)??t.enforcedBy,this.configResponse?.configSources?.[`/defaultLocalization/${e}`]??t.source)}displayedPreferences(){let e={...x.preferenceOverrides};for(let t of[`language`,`formatLocale`,`timeZone`,`hourCycle`])this.locked(t)&&Object.assign(e,{[t]:this.configResponse?.effectiveConfig.defaultLocalization?.[t]??x.preferences[t]});return e}constructor(){super(),this.baseline=gt(x.preferenceOverrides),this.draft={...this.baseline},this.applying=!1,this.saved=!1,this.previewDate=new Date,new y(this),n.createController(this)}willUpdate(){let e=gt(this.displayedPreferences());yt(e,this.baseline)||(yt(this.draft,this.baseline)&&(this.draft=e),this.baseline=e);for(let t of[`language`,`formatLocale`,`timeZone`,`hourCycle`])this.locked(t)&&(this.draft[t]=e[t])}updated(){let e=this.renderRoot.querySelector(`#language`),t=this.renderRoot.querySelector(`#hourCycle`);e&&(e.value=_t(this.draft.language)),t&&(t.value=vt(this.draft))}render(){let e=x.availableLanguages,t=_t(this.draft.language),n=vt(this.draft),r=ve(`formatLocale`),i=ve(`timeZone`),a=new Intl.DisplayNames([x.language],{type:`language`});return w`
|
|
111
|
-
<section class="ui-settings-section" aria-labelledby="localization-heading">
|
|
112
|
-
<header class="ui-settings-heading">
|
|
113
|
-
<h3 id="localization-heading">${F.t(`heading`)}</h3>
|
|
114
|
-
<p>${F.t(`description`)}</p>
|
|
115
|
-
</header>
|
|
116
|
-
<form class="ui-settings-fields" novalidate @submit=${e=>{e.preventDefault(),this.apply(this.draft)}}>
|
|
117
|
-
<label class="ui-form-field" for="language">
|
|
118
|
-
<span>${F.t(`language`)}</span>
|
|
119
|
-
<select id="language" class="ui-input" aria-describedby=${this.helpIds(`language`,`language-help`)} aria-invalid=${this.validation?.field===`language`?`true`:C} ?disabled=${this.applying||this.locked(`language`)}
|
|
120
|
-
@change=${e=>{this.edit(`language`,e)}}>
|
|
121
|
-
${e.map(e=>w`<option value=${e} ?selected=${e===t}>${F.t(`languageOption`,{name:a.of(e)??e,code:e})}</option>`)}
|
|
122
|
-
</select>
|
|
123
|
-
${this.fieldSource(`language`)}
|
|
124
|
-
<small id="language-help">${F.t(`languageHelp`)}</small>
|
|
125
|
-
</label>
|
|
126
|
-
<div class="ui-form-field">
|
|
127
|
-
<label for="formatLocale">${F.t(`region`)}</label>
|
|
128
|
-
<input id="formatLocale" class="ui-input" dir="ltr" spellcheck="false" autocapitalize="off" .value=${h(this.draft.formatLocale)}
|
|
129
|
-
placeholder=${F.t(`useDefault`)} aria-describedby=${this.helpIds(`formatLocale`,`region-help region-default`)} aria-invalid=${this.validation?.field===`formatLocale`?`true`:C}
|
|
130
|
-
?disabled=${this.applying||this.locked(`formatLocale`)} @input=${e=>{this.edit(`formatLocale`,e)}}>
|
|
131
|
-
${this.fieldSource(`formatLocale`)}
|
|
132
|
-
<small id="region-help">${F.t(`regionHelp`)}</small>
|
|
133
|
-
<small id="region-default">${F.rich(r.source===`server`?`gatewayDefault`:`browserDefault`,{value:r.value,isolate:e=>w`<bdi dir="ltr">${e}</bdi>`})}</small>
|
|
134
|
-
</div>
|
|
135
|
-
<label class="ui-form-field" for="timeZone">
|
|
136
|
-
<span>${F.t(`zone`)}</span>
|
|
137
|
-
<input id="timeZone" class="ui-input" dir="ltr" spellcheck="false" autocapitalize="off" .value=${h(this.draft.timeZone)}
|
|
138
|
-
placeholder=${F.t(`useDefault`)} aria-describedby=${this.helpIds(`timeZone`,`zone-help zone-default`)} aria-invalid=${this.validation?.field===`timeZone`?`true`:C}
|
|
139
|
-
?disabled=${this.applying||this.locked(`timeZone`)} @input=${e=>{this.edit(`timeZone`,e)}}>
|
|
140
|
-
${this.fieldSource(`timeZone`)}
|
|
141
|
-
<small id="zone-help">${F.t(`zoneHelp`)}</small>
|
|
142
|
-
<small id="zone-default">${F.rich(i.source===`server`?`gatewayDefault`:`browserDefault`,{value:i.value,isolate:e=>w`<bdi dir="ltr">${e}</bdi>`})}</small>
|
|
143
|
-
</label>
|
|
144
|
-
<label class="ui-form-field" for="hourCycle">
|
|
145
|
-
<span>${F.t(`hours`)}</span>
|
|
146
|
-
<select id="hourCycle" class="ui-input" aria-describedby=${this.validation?.field===`hourCycle`?`localization-validation`:C} aria-invalid=${this.validation?.field===`hourCycle`?`true`:C} ?disabled=${this.applying||this.locked(`hourCycle`)} @change=${e=>{this.edit(`hourCycle`,e)}}>
|
|
147
|
-
<option value="" ?selected=${n===``}>${F.t(x.preferenceDefaults.hourCycle===void 0?`hoursDefault`:`hoursGatewayDefault`)}</option>
|
|
148
|
-
${[`h12`,`h23`].map(e=>w`<option value=${e} ?selected=${e===n}>${F.t(e)}</option>`)}
|
|
149
|
-
</select>
|
|
150
|
-
</label>
|
|
151
|
-
${this.fieldSource(`hourCycle`)}
|
|
152
|
-
${this.validation?w`<p class="ui-form-error" id="localization-validation" role="alert">${F.t(this.validation.key)}</p>`:C}
|
|
153
|
-
${this.failure===void 0?C:w`<p class="ui-form-error" role="alert">${F.t(`applyFailure`,{diagnostic:this.failure})}</p>`}
|
|
154
|
-
<div class="ui-settings-summary" aria-label=${F.t(`preview`)}>
|
|
155
|
-
<strong>${F.t(`preview`)}</strong>
|
|
156
|
-
<span>${F.t(`datePreview`,{value:x.date(this.previewDate,{dateStyle:`medium`,timeStyle:`short`})})}</span>
|
|
157
|
-
<span>${F.t(`numberPreview`,{value:x.number(12345.67)})}</span>
|
|
158
|
-
</div>
|
|
159
|
-
<footer class="ui-settings-actions">
|
|
160
|
-
<button type="submit" class="ui-button ui-button--action ui-button--primary" ?disabled=${this.applying}>${F.t(this.applying?`applying`:`apply`)}</button>
|
|
161
|
-
<button type="button" class="ui-button ui-button--action" ?disabled=${this.applying}
|
|
162
|
-
@click=${()=>{this.save({})}}>${F.t(`reset`)}</button>
|
|
163
|
-
</footer>
|
|
164
|
-
<p role="status">${this.saved?F.t(`saved`):C}</p>
|
|
165
|
-
</form>
|
|
166
|
-
</section>
|
|
167
|
-
`}helpIds(e,t){return this.validation?.field===e?`${t} localization-validation`:t}edit(e,t){(t.target instanceof HTMLInputElement||t.target instanceof HTMLSelectElement)&&this.setField(e,t.target.value)}setField(e,t){this.draft={...this.draft,[e]:t},this.validation?.field===e&&(this.validation=void 0),this.saved=!1,this.failure=void 0}async apply(e){if(this.applying)return;if(this.validation=bt(e),this.failure=void 0,this.saved=!1,this.validation){await this.updateComplete,this.renderRoot.querySelector(`#${this.validation.field}`)?.focus();return}let t={...x.preferenceOverrides};for(let n of[`language`,`formatLocale`,`timeZone`,`hourCycle`]){if(this.locked(n)||e[n]===this.baseline[n]&&x.preferenceOverrides[n]===void 0)continue;let r=n===`language`?_t(e.language.trim()):n===`hourCycle`?vt(e):e[n].trim();Reflect.deleteProperty(t,n),r&&Object.assign(t,{[n]:r})}this.save(t)}save(e){if(!this.applying){this.applying=!0,this.validation=void 0,this.failure=void 0,this.saved=!1;try{let t={...e};for(let e of[`language`,`formatLocale`,`timeZone`,`hourCycle`]){if(!this.locked(e))continue;Reflect.deleteProperty(t,e);let n=x.preferenceOverrides[e];n!==void 0&&Object.assign(t,{[e]:n})}x.setPreferenceOverrides(t),this.baseline=gt(this.displayedPreferences()),this.draft={...this.baseline},this.saved=!0}catch(e){this.failure=e instanceof Error?e.message:String(e)}finally{this.applying=!1}}}static{this.styles=[e,g,E,S`
|
|
168
|
-
:host { display: block; min-width: 0; }
|
|
169
|
-
p { margin: 0; }
|
|
170
|
-
p, small { color: var(--pi-muted); line-height: 1.45; }
|
|
171
|
-
.ui-settings-summary span { overflow-wrap: anywhere; }
|
|
172
|
-
.ui-form-error { color: var(--pi-error); }
|
|
173
|
-
`]}};c([m({attribute:!1})],I.prototype,`configResponse`,void 0),c([p()],I.prototype,`draft`,void 0),c([p()],I.prototype,`validation`,void 0),c([p()],I.prototype,`failure`,void 0),c([p()],I.prototype,`applying`,void 0),c([p()],I.prototype,`saved`,void 0),I=c([l(`settings-localization-panel`)],I);function xt(e){return w`${M.t(`description`,{target:e})}`}var L=class extends T{constructor(){super(),this.loading=!1,this.machineLoading=!1,this.saving=!1,this.error=``,this.machineError=``,this.savedMessage=``,this.targetLabel=``,this.targetId=`local`,this.gatewayDraft=ze(),this.machineDraft=Be(),this.gatewayLocalError=``,this.machineLocalError=``,this.gatewayBaseline=ze(),this.machineBaseline=Be(),n.createController(this),new y(this)}get displayTarget(){return this.targetLabel||M.t(`selectedMachine`)}get hasUnsavedMachineChanges(){return!Dt(this.machineDraft,this.machineBaseline)}discardMachineChanges(){this.machineDraft={...this.machineBaseline},this.machineLocalError=``}willUpdate(e){if(e.has(`configResponse`)&&this.configResponse!==void 0){let e=Ve(this.configResponse.effectiveConfig),t=this.gatewaySubmission,n=t!==void 0&&Dt(e,t.expected);this.gatewayDraft=Ue(this.gatewayDraft,n?t.draft:this.gatewayBaseline,e);for(let[t,n]of[[`host`,`host`],[`port`,`port`],[`allowedHostsMode`,`allowedHosts`],[`allowedHostsText`,`allowedHosts`]])N(this.configResponse,`/${n}`)!==void 0&&Object.assign(this.gatewayDraft,{[t]:e[t]});this.gatewayBaseline=e,n&&(this.gatewaySubmission=void 0)}if((e.has(`targetId`)||e.has(`machineConfigResponse`)&&this.machineConfigResponse===void 0)&&(this.machineDraft=Be(),this.machineBaseline=Be(),this.machineSubmission=void 0,this.machineLocalError=``),(e.has(`machineConfigResponse`)||e.has(`targetId`))&&this.machineConfigResponse!==void 0){let e=He(this.machineConfigResponse.effectiveConfig),t=this.machineSubmission,n=t!==void 0&&Dt(e,t.expected);this.machineDraft=Ue(this.machineDraft,n?t.draft:this.machineBaseline,e);for(let[t,n]of[[`installationName`,`installationName`],[`allowedPathsText`,`pathAccess/allowedPaths`],[`uploadDefaultFolder`,`uploads/defaultFolder`],[`attachmentDefaultFolder`,`attachments/defaultFolder`]])N(this.machineConfigResponse,`/${n}`)!==void 0&&Object.assign(this.machineDraft,{[t]:e[t]});this.machineBaseline=e,n&&(this.machineSubmission=void 0)}}render(){return w`
|
|
174
|
-
<settings-panel-frame
|
|
175
|
-
heading=${M.t(`heading`)}
|
|
176
|
-
.description=${xt(this.displayTarget)}
|
|
177
|
-
actionLabel=${M.t(`refresh`)}
|
|
178
|
-
.actionDisabled=${this.loading||this.machineLoading}
|
|
179
|
-
.notices=${this.panelNotices()}
|
|
180
|
-
.onAction=${()=>{this.reloadAll()}}
|
|
181
|
-
>
|
|
182
|
-
<div class="settings-sections ui-settings-list">
|
|
183
|
-
<slot name="appearance"></slot>
|
|
184
|
-
<settings-localization-panel .configResponse=${this.configResponse}></settings-localization-panel>
|
|
185
|
-
${this.renderChatDisplaySettings()}
|
|
186
|
-
${this.renderGatewayServerSettings()}
|
|
187
|
-
${this.renderSelectedMachineAccessSettings()}
|
|
188
|
-
</div>
|
|
189
|
-
</settings-panel-frame>
|
|
190
|
-
`}renderChatDisplaySettings(){let e=this.configResponse,t=e?.effectiveConfig.quietMode===!0;return w`
|
|
191
|
-
<section class="settings-card ui-settings-section" aria-label=${M.t(`chatAria`)}>
|
|
192
|
-
<div class="card-heading ui-settings-heading">
|
|
193
|
-
<h3>${M.t(`chat`)}</h3>
|
|
194
|
-
<p>${M.t(`chatHelp`)}</p>
|
|
195
|
-
</div>
|
|
196
|
-
${e===void 0?w`<div class="loading-card">${this.loading?M.t(`loadingGateway`):M.t(`chatUnavailable`)}</div>`:w`
|
|
197
|
-
<div class="field ui-form-field">
|
|
198
|
-
<label class="ui-checkbox-field">
|
|
199
|
-
<input
|
|
200
|
-
type="checkbox"
|
|
201
|
-
id="quiet-mode"
|
|
202
|
-
aria-describedby="quiet-mode-help"
|
|
203
|
-
.checked=${h(t)}
|
|
204
|
-
?disabled=${this.loading||this.saving||N(e,`/quietMode`)!==void 0}
|
|
205
|
-
@change=${e=>{this.setQuietMode(e)}}
|
|
206
|
-
>
|
|
207
|
-
<span>${M.t(`quiet`)}</span>
|
|
208
|
-
</label>
|
|
209
|
-
<small id="quiet-mode-help">${M.t(`quietHelp`)}</small>
|
|
210
|
-
${P(e,`/quietMode`,this.loading||this.saving,this.onReset)}
|
|
211
|
-
</div>
|
|
212
|
-
`}
|
|
213
|
-
</section>
|
|
214
|
-
`}renderGatewayServerSettings(){let e=this.configResponse;return w`
|
|
215
|
-
<section class="settings-card ui-settings-section" aria-label=${M.t(`gatewayAria`)}>
|
|
216
|
-
<div class="card-heading ui-settings-heading">
|
|
217
|
-
<h3>${M.t(`gateway`)}</h3>
|
|
218
|
-
<p>${M.t(`gatewayHelp`)}</p>
|
|
219
|
-
</div>
|
|
220
|
-
${e===void 0?w`<div class="loading-card">${this.loading?M.t(`loadingGateway`):M.t(`gatewayUnavailable`)}</div>`:w`
|
|
221
|
-
<div class="config-path-card ui-settings-path">
|
|
222
|
-
<span>${M.t(`gatewayFile`)}</span>
|
|
223
|
-
<code dir="ltr">${e.path}</code>
|
|
224
|
-
<small>${e.exists?M.t(`exists`):M.t(`createFile`)}</small>
|
|
225
|
-
</div>
|
|
226
|
-
<form class="config-form ui-settings-fields" @submit=${e=>{this.saveGatewayConfig(e)}}>
|
|
227
|
-
<label class="field ui-form-field">
|
|
228
|
-
<span class="field-heading">
|
|
229
|
-
<span>${M.t(`host`)}</span>
|
|
230
|
-
</span>
|
|
231
|
-
<input class="ui-input" ?disabled=${N(e,`/host`)!==void 0} .value=${this.gatewayDraft.host} placeholder="127.0.0.1" autocomplete="off" spellcheck="false" @input=${e=>{this.updateGatewayDraft({host:wt(e)})}}>
|
|
232
|
-
<small>${M.t(`hostHelp`)}</small>
|
|
233
|
-
</label>
|
|
234
|
-
${this.renderOverrideBadge(`host`)}
|
|
235
|
-
|
|
236
|
-
<label class="field ui-form-field">
|
|
237
|
-
<span class="field-heading">
|
|
238
|
-
<span>${M.t(`port`)}</span>
|
|
239
|
-
</span>
|
|
240
|
-
<input class="ui-input" ?disabled=${N(e,`/port`)!==void 0} .value=${this.gatewayDraft.port} inputmode="numeric" pattern="[0-9]*" placeholder="8504" autocomplete="off" @input=${e=>{this.updateGatewayDraft({port:wt(e)})}}>
|
|
241
|
-
<small>${M.t(`portHelp`,{min:1,max:65535})}</small>
|
|
242
|
-
</label>
|
|
243
|
-
${this.renderOverrideBadge(`port`)}
|
|
244
|
-
|
|
245
|
-
<div class="field ui-form-field">
|
|
246
|
-
<span class="field-heading">
|
|
247
|
-
<label for="allowed-hosts-mode">${M.t(`allowedHosts`)}</label>
|
|
248
|
-
${this.renderOverrideBadge(`allowedHosts`)}
|
|
249
|
-
</span>
|
|
250
|
-
<select class="ui-input" ?disabled=${N(e,`/allowedHosts`)!==void 0} id="allowed-hosts-mode" aria-describedby="allowed-hosts-help" .value=${this.gatewayDraft.allowedHostsMode} @change=${e=>{this.updateGatewayDraft({allowedHostsMode:Tt(e)===`all`?`all`:`list`})}}>
|
|
251
|
-
<option value="list">${M.t(`hostsList`)}</option>
|
|
252
|
-
<option value="all">${M.t(`hostsAll`)}</option>
|
|
253
|
-
</select>
|
|
254
|
-
<label for="allowed-hosts-list">${M.t(`hostList`)}</label>
|
|
255
|
-
<textarea class="ui-input" id="allowed-hosts-list" aria-describedby="allowed-hosts-help" .value=${this.gatewayDraft.allowedHostsText} ?disabled=${this.gatewayDraft.allowedHostsMode===`all`||N(e,`/allowedHosts`)!==void 0} rows="4" placeholder="example.local 192.168.1.20" spellcheck="false" @input=${e=>{this.updateGatewayDraft({allowedHostsText:Et(e)})}}></textarea>
|
|
256
|
-
<small id="allowed-hosts-help">${M.t(`hostsHelp`)}</small>
|
|
257
|
-
</div>
|
|
258
|
-
|
|
259
|
-
${this.renderGatewayEffectiveConfig()}
|
|
260
|
-
|
|
261
|
-
<footer class="form-actions ui-settings-actions">
|
|
262
|
-
${Dt(this.gatewayDraft,this.gatewayBaseline)?null:w`<small>${M.t(`unsaved`)}</small>`}
|
|
263
|
-
<button class="primary ui-button ui-button--action ui-button--primary" ?disabled=${this.loading||this.saving}>${this.saving?M.t(`saving`):M.t(`saveGateway`)}</button>
|
|
264
|
-
</footer>
|
|
265
|
-
</form>
|
|
266
|
-
`}
|
|
267
|
-
</section>
|
|
268
|
-
`}renderSelectedMachineAccessSettings(){let e=this.machineConfigResponse;return w`
|
|
269
|
-
<section class="settings-card ui-settings-section" aria-label=${M.t(`machine`)}>
|
|
270
|
-
<div class="card-heading ui-settings-heading">
|
|
271
|
-
<h3>${M.t(`machine`)}</h3>
|
|
272
|
-
<p>${M.t(`machineHelp`,{target:this.displayTarget})}</p>
|
|
273
|
-
</div>
|
|
274
|
-
${this.renderMachineMessages()}
|
|
275
|
-
${e===void 0?w`<div class="loading-card">${this.machineLoading?M.t(`loadingMachine`):M.t(`machineUnavailable`)}</div>`:w`
|
|
276
|
-
<div class="config-path-card ui-settings-path">
|
|
277
|
-
<span>${M.t(`machineFile`)}</span>
|
|
278
|
-
<code dir="ltr">${e.path}</code>
|
|
279
|
-
<small>${e.exists?M.t(`exists`):M.t(`createFile`)}</small>
|
|
280
|
-
</div>
|
|
281
|
-
<form class="config-form ui-settings-fields" @submit=${e=>{this.saveMachineAccessConfig(e)}}>
|
|
282
|
-
<label class="field ui-form-field">
|
|
283
|
-
<span>${M.t(`name`)}</span>
|
|
284
|
-
<input class="ui-input" ?disabled=${N(e,`/installationName`)!==void 0} dir="auto" name="installationName" maxlength="120" .value=${this.machineDraft.installationName} placeholder="PI-WEB" autocomplete="off" @input=${e=>{this.updateMachineDraft({installationName:wt(e)})}}>
|
|
285
|
-
<small>${M.t(`nameHelp`)}</small>
|
|
286
|
-
</label>
|
|
287
|
-
${P(e,`/installationName`,this.machineLoading||this.saving,this.onResetMachine)}
|
|
288
|
-
<label class="field ui-form-field">
|
|
289
|
-
<span class="field-heading">
|
|
290
|
-
<span>${M.t(`roots`)}</span>
|
|
291
|
-
</span>
|
|
292
|
-
<textarea class="ui-input" ?disabled=${N(e,`/pathAccess/allowedPaths`)!==void 0} .value=${this.machineDraft.allowedPathsText} rows="4" placeholder="~/SDKs /opt/reference" spellcheck="false" @input=${e=>{this.updateMachineDraft({allowedPathsText:Et(e)})}}></textarea>
|
|
293
|
-
<small>${M.rich(`rootsHelp`,{target:this.displayTarget,code:Ot})}</small>
|
|
294
|
-
</label>
|
|
295
|
-
${P(e,`/pathAccess/allowedPaths`,this.machineLoading||this.saving,this.onResetMachine)}
|
|
296
|
-
|
|
297
|
-
<label class="field ui-form-field">
|
|
298
|
-
<span class="field-heading">
|
|
299
|
-
<span>${M.t(`upload`)}</span>
|
|
300
|
-
</span>
|
|
301
|
-
<input class="ui-input" ?disabled=${N(e,`/uploads/defaultFolder`)!==void 0} .value=${this.machineDraft.uploadDefaultFolder} placeholder=${be} autocomplete="off" spellcheck="false" @input=${e=>{this.updateMachineDraft({uploadDefaultFolder:wt(e)})}}>
|
|
302
|
-
<small>${M.rich(`uploadHelp`,{target:this.displayTarget,folder:be,code:Ot})}</small>
|
|
303
|
-
</label>
|
|
304
|
-
${P(e,`/uploads/defaultFolder`,this.machineLoading||this.saving,this.onResetMachine)}
|
|
305
|
-
|
|
306
|
-
<label class="field ui-form-field">
|
|
307
|
-
<span class="field-heading">
|
|
308
|
-
<span>${M.t(`attachment`)}</span>
|
|
309
|
-
</span>
|
|
310
|
-
<input class="ui-input" ?disabled=${N(e,`/attachments/defaultFolder`)!==void 0} .value=${this.machineDraft.attachmentDefaultFolder} placeholder=${u} autocomplete="off" spellcheck="false" @input=${e=>{this.updateMachineDraft({attachmentDefaultFolder:wt(e)})}}>
|
|
311
|
-
<small>${M.rich(`attachmentHelp`,{target:this.displayTarget,folder:u,code:Ot})}</small>
|
|
312
|
-
</label>
|
|
313
|
-
${P(e,`/attachments/defaultFolder`,this.machineLoading||this.saving,this.onResetMachine)}
|
|
314
|
-
|
|
315
|
-
${this.renderMachineEffectiveConfig()}
|
|
316
|
-
|
|
317
|
-
<footer class="form-actions ui-settings-actions">
|
|
318
|
-
${Dt(this.machineDraft,this.machineBaseline)?null:w`<small>${M.t(`unsaved`)}</small>`}
|
|
319
|
-
<button class="primary ui-button ui-button--action ui-button--primary" ?disabled=${this.machineLoading||this.saving}>${this.saving?M.t(`saving`):M.t(`saveMachine`)}</button>
|
|
320
|
-
</footer>
|
|
321
|
-
</form>
|
|
322
|
-
`}
|
|
323
|
-
</section>
|
|
324
|
-
`}panelNotices(){let e=[],t=this.gatewayLocalError===``?this.error:Qe(this.gatewayLocalError);return t!==``&&e.push({type:`error`,title:M.t(`configuration`),content:t}),this.savedMessage!==``&&e.push({type:`success`,content:this.savedMessage}),e}renderMachineMessages(){let e=this.machineLocalError===``?this.machineError:Qe(this.machineLocalError);return e===``?null:w`<div class="message error-message ui-form-error" role="alert">${e}</div>`}renderOverrideBadge(e){return P(this.configResponse,`/${e}`,this.loading||this.saving,this.onReset)}renderGatewayEffectiveConfig(){let e=this.configResponse?.effectiveConfig??{};return w`
|
|
325
|
-
<section class="effective-card ui-settings-summary" aria-label=${M.t(`effectiveGatewayAria`)}>
|
|
326
|
-
<h3>${M.t(`effectiveGateway`)}</h3>
|
|
327
|
-
<p>${M.t(`effectiveHelp`)}</p>
|
|
328
|
-
<dl>
|
|
329
|
-
<div><dt>${M.t(`host`)}</dt><dd><bdi>${e.host??w`<span class="muted">${M.t(`defaultValue`,{value:`127.0.0.1`})}</span>`}</bdi></dd></div>
|
|
330
|
-
<div><dt>${M.t(`port`)}</dt><dd>${e.port===void 0?w`<span class="muted">${M.t(`defaultValue`,{value:`8504`})}</span>`:x.number(e.port)}</dd></div>
|
|
331
|
-
<div><dt>${M.t(`allowedHosts`)}</dt><dd>${St(e.allowedHosts)}</dd></div>
|
|
332
|
-
</dl>
|
|
333
|
-
</section>
|
|
334
|
-
`}renderMachineEffectiveConfig(){let e=this.machineConfigResponse?.effectiveConfig??{};return w`
|
|
335
|
-
<section class="effective-card ui-settings-summary" aria-label=${M.t(`effectiveMachineAria`)}>
|
|
336
|
-
<h3>${M.t(`effectiveMachine`)}</h3>
|
|
337
|
-
<p>${M.t(`machineSummaryHelp`)}</p>
|
|
338
|
-
<dl>
|
|
339
|
-
<div><dt>${M.t(`baseRoots`)}</dt><dd>
|
|
340
|
-
<div>${Ct(e.basePaths)}</div>
|
|
341
|
-
<div class="field ui-form-field">
|
|
342
|
-
<small>${M.t(`baseRootsHelp`)}</small>
|
|
343
|
-
${P(this.machineConfigResponse,`/basePaths`,this.machineLoading||this.saving)}
|
|
344
|
-
</div>
|
|
345
|
-
</dd></div>
|
|
346
|
-
<div><dt>${M.t(`externalRoots`)}</dt><dd>${Ct(e.pathAccess?.allowedPaths)}</dd></div>
|
|
347
|
-
<div><dt>${M.t(`uploadFolder`)}</dt><dd>${e.uploads?.defaultFolder===void 0?w`<span class="muted">${M.t(`defaultValue`,{value:be})}</span>`:w`<bdi dir="ltr">${e.uploads.defaultFolder}</bdi>`}</dd></div>
|
|
348
|
-
<div><dt>${M.t(`attachmentFolder`)}</dt><dd>${e.attachments?.defaultFolder===void 0?w`<span class="muted">${M.t(`defaultValue`,{value:u})}</span>`:w`<bdi dir="ltr">${e.attachments.defaultFolder}</bdi>`}</dd></div>
|
|
349
|
-
</dl>
|
|
350
|
-
${(e.basePaths?.length??0)===0&&(e.pathAccess?.allowedPaths?.length??0)===0?w`<p>${M.t(`denied`)}</p>`:null}
|
|
351
|
-
</section>
|
|
352
|
-
`}reloadAll(){this.onReload?.(),this.onReloadMachine?.()}setQuietMode(e){let t=e.target instanceof HTMLInputElement&&e.target.checked;this.configResponse===void 0||this.loading||this.saving||this.onSetQuietMode===void 0||(this.gatewayLocalError=``,this.onSetQuietMode(t))}async saveGatewayConfig(e){if(e.preventDefault(),!(this.configResponse===void 0||this.loading||this.saving||this.onSave===void 0)){this.gatewayLocalError=``;try{let e=We(this.gatewayDraft),t=We(this.gatewayBaseline),n=ft(this.configResponse,e,t).set??{},r=[`host`,`port`].filter(n=>e[n]===void 0&&t[n]!==void 0&&N(this.configResponse,`/${n}`)===void 0),i={...this.configResponse.effectiveConfig,...n};for(let e of r){Reflect.deleteProperty(i,e);let t=this.configResponse.defaultsConfig?.[e];t!==void 0&&Object.assign(i,{[e]:t})}let a={draft:this.gatewayDraft,expected:Ve(i)};this.gatewaySubmission=a;try{r.length===0?await this.onSave(n):await this.onSave(n,r.map(e=>`/${e}`)),this.isConnected&&await this.updateComplete}finally{this.gatewaySubmission===a&&(this.gatewaySubmission=void 0)}}catch(e){this.gatewayLocalError=e}}}async saveMachineAccessConfig(e){if(e.preventDefault(),this.machineConfigResponse===void 0||this.machineLoading||this.saving||this.onSaveMachineConfig===void 0)return;this.machineLocalError=``;let t=this.targetId;try{let e=Ge(this.machineDraft),t=Ge(this.machineBaseline),n=ft(this.machineConfigResponse,e,t).set??{},r=pt(this.machineConfigResponse,[`uploads`,`attachments`].filter(n=>e[n]?.defaultFolder===void 0&&t[n]?.defaultFolder!==void 0).map(e=>`/${e}/defaultFolder`)).unset??[],i=at(this.machineConfigResponse.effectiveConfig,n);for(let e of[`uploads`,`attachments`])r.includes(`/${e}/defaultFolder`)&&Object.assign(i,{[e]:this.machineConfigResponse.defaultsConfig?.[e]??{}});let a={draft:this.machineDraft,expected:He(i)};this.machineSubmission=a;try{r.length?await this.onSaveMachineConfig(n,r):await this.onSaveMachineConfig(n),this.isConnected&&await this.updateComplete}finally{this.machineSubmission===a&&(this.machineSubmission=void 0)}}catch(e){this.targetId===t&&(this.machineLocalError=e)}}updateGatewayDraft(e){this.gatewayDraft={...this.gatewayDraft,...e},this.gatewayLocalError=``}updateMachineDraft(e){this.machineDraft={...this.machineDraft,...e},this.machineLocalError=``}static{this.styles=[e,g,E,S`
|
|
353
|
-
@layer pi-web-base {
|
|
354
|
-
:host { display: block; overflow-wrap: anywhere; }
|
|
355
|
-
h3, p { margin: 0; }
|
|
356
|
-
h3 { font-size: 13px; line-height: 1.3; }
|
|
357
|
-
p { color: var(--pi-muted); line-height: 1.45; }
|
|
358
|
-
.loading-card { color: var(--pi-muted); }
|
|
359
|
-
.config-path-card span, .field-heading, dt { color: var(--pi-muted); font-size: 12px; font-weight: 600; }
|
|
360
|
-
code { border: 1px solid var(--pi-border-muted); border-radius: 5px; background: var(--pi-bg); padding: 1px 4px; color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
361
|
-
.config-path-card small, .field small { color: var(--pi-muted); }
|
|
362
|
-
.field-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
363
|
-
input:not([name="installationName"]), textarea { direction: ltr; text-align: start; }
|
|
364
|
-
.override-badge { overflow-wrap: anywhere; }
|
|
365
|
-
textarea { resize: vertical; min-height: 94px; --ui-input-font-family: var(--pi-control-monospace-font-family, var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)); }
|
|
366
|
-
textarea:disabled { opacity: .55; }
|
|
367
|
-
.override-badge { border: 1px solid var(--pi-warning-border); border-radius: 999px; color: var(--pi-warning); background: var(--pi-warning-surface); padding: 2px 7px; font-size: 11px; font-weight: 600; text-transform: none; }
|
|
368
|
-
.effective-card dl { display: grid; gap: 8px; margin: 0; }
|
|
369
|
-
.effective-card dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline; }
|
|
370
|
-
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
|
371
|
-
.muted { color: var(--pi-muted); }
|
|
372
|
-
.form-actions small { align-self: center; color: var(--pi-muted); padding-inline-end: 12px; }
|
|
373
|
-
|
|
374
|
-
@media (max-width: 760px) {
|
|
375
|
-
.effective-card dl > div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
`]}};c([m({attribute:!1})],L.prototype,`configResponse`,void 0),c([m({attribute:!1})],L.prototype,`machineConfigResponse`,void 0),c([m({type:Boolean})],L.prototype,`loading`,void 0),c([m({type:Boolean})],L.prototype,`machineLoading`,void 0),c([m({type:Boolean})],L.prototype,`saving`,void 0),c([m()],L.prototype,`error`,void 0),c([m()],L.prototype,`machineError`,void 0),c([m()],L.prototype,`savedMessage`,void 0),c([m()],L.prototype,`targetLabel`,void 0),c([m()],L.prototype,`targetId`,void 0),c([m({attribute:!1})],L.prototype,`onReload`,void 0),c([m({attribute:!1})],L.prototype,`onReloadMachine`,void 0),c([m({attribute:!1})],L.prototype,`onSave`,void 0),c([m({attribute:!1})],L.prototype,`onSetQuietMode`,void 0),c([m({attribute:!1})],L.prototype,`onSaveMachineConfig`,void 0),c([m({attribute:!1})],L.prototype,`onReset`,void 0),c([m({attribute:!1})],L.prototype,`onResetMachine`,void 0),c([p()],L.prototype,`gatewayDraft`,void 0),c([p()],L.prototype,`machineDraft`,void 0),c([p()],L.prototype,`gatewayLocalError`,void 0),c([p()],L.prototype,`machineLocalError`,void 0),L=c([l(`settings-general-panel`)],L);function St(e){return e===!0?M.t(`anyHost`):Array.isArray(e)?e.length===0?w`<span class="muted">${M.t(`noHosts`)}</span>`:w`<bdi dir="ltr">${x.list(e)}</bdi>`:w`<span class="muted">${M.t(`unset`)}</span>`}function Ct(e){return e===void 0||e.length===0?w`<span class="muted">${M.t(`noPaths`)}</span>`:w`<bdi dir="ltr">${x.list(e)}</bdi>`}function wt(e){return e.target instanceof HTMLInputElement?e.target.value:``}function Tt(e){return e.target instanceof HTMLSelectElement?e.target.value:``}function Et(e){return e.target instanceof HTMLTextAreaElement?e.target.value:``}function Dt(e,t){for(let n in e)if(e[n]!==t[n])return!1;return!0}function Ot(e){return w`<code dir="ltr">${e}</code>`}var R=class extends T{constructor(){super(),this.themes=[],this.preference=r,this.defaultPreference=r,this.activeThemeId=``,this.hasLocalOverride=!1,this.loading=!1,this.saving=!1,this.catalogLoading=!1,this.catalogError=``,this.draft={...r},new y(this),n.createController(this)}willUpdate(e){e.has(`preference`)&&(this.draft={...this.preference}),N(this.configResponse,`/defaultTheme`)!==void 0&&(this.draft={...this.configResponse?.effectiveConfig.defaultTheme??this.preference})}updated(){let e=this.renderRoot.querySelector(`select`);e!==null&&(e.value=a(this.themes,this.draft.themeId)?.id??this.draft.themeId)}render(){let e=a(this.themes,this.draft.themeId)!==void 0,t=this.loading||this.saving||N(this.configResponse,`/defaultTheme`)!==void 0,n=t||this.catalogLoading,r=!e&&!this.catalogLoading&&!this.catalogError;return w`
|
|
379
|
-
<section class="theme-card ui-settings-section" aria-labelledby="theme-heading">
|
|
380
|
-
<header class="ui-settings-heading">
|
|
381
|
-
<h3 id="theme-heading">${D.t(`heading`)}</h3>
|
|
382
|
-
<p>${D.t(`description`)}</p>
|
|
383
|
-
</header>
|
|
384
|
-
<div class="current-theme ui-settings-summary" role="status">
|
|
385
|
-
<strong>${D.t(this.hasLocalOverride?`local`:`default`)}</strong>
|
|
386
|
-
<span>${D.t(`current`,{name:this.themeName(this.activeThemeId||this.preference.themeId)})}</span>
|
|
387
|
-
<span>${D.t(`gateway`,{name:this.themeName(this.defaultPreference.themeId),auto:this.defaultPreference.auto?`yes`:`no`})}</span>
|
|
388
|
-
</div>
|
|
389
|
-
${this.catalogLoading?w`<p role="status">${D.t(`catalogLoading`)}</p>`:this.catalogError?w`
|
|
390
|
-
<div role="alert">
|
|
391
|
-
<p>${D.t(`catalogError`,{error:this.catalogError})}</p>
|
|
392
|
-
${this.onRetryCatalog?w`<button class="ui-button ui-button--action" @click=${()=>this.onRetryCatalog?.()}>${D.t(`retryCatalog`)}</button>`:null}
|
|
393
|
-
</div>
|
|
394
|
-
`:null}
|
|
395
|
-
<label class="field ui-form-field">
|
|
396
|
-
<span>${D.t(`heading`)}</span>
|
|
397
|
-
<select class="ui-input" aria-label=${D.t(`heading`)} aria-describedby=${r?`theme-unavailable-help theme-scope-help`:`theme-scope-help`} ?disabled=${n} @change=${e=>{e.target instanceof HTMLSelectElement&&(this.draft={...this.draft,themeId:e.target.value})}}>
|
|
398
|
-
${e?null:w`<option value=${this.draft.themeId}>${r?D.t(`unavailable`,{id:this.draft.themeId}):this.draft.themeId}</option>`}
|
|
399
|
-
${this.themes.map(e=>w`<option value=${e.id}>${e.name}</option>`)}
|
|
400
|
-
</select>
|
|
401
|
-
</label>
|
|
402
|
-
${r?w`<p id="theme-unavailable-help" role="status">${D.t(`unavailableHelp`)}</p>`:null}
|
|
403
|
-
<label class="auto-field ui-checkbox-field">
|
|
404
|
-
<input type="checkbox" .checked=${this.draft.auto} ?disabled=${n} @change=${e=>{e.target instanceof HTMLInputElement&&(this.draft={...this.draft,auto:e.target.checked})}}>
|
|
405
|
-
<span>${D.t(`auto`)} <small>${D.t(`autoHelp`)}</small></span>
|
|
406
|
-
</label>
|
|
407
|
-
<div class="theme-actions ui-settings-actions">
|
|
408
|
-
<button class="primary ui-button ui-button--action ui-button--primary" ?disabled=${n||!e} @click=${()=>this.onUseLocal?.({...this.draft})}>${D.t(`useLocal`)}</button>
|
|
409
|
-
<button class="ui-button ui-button--action" ?disabled=${n||!e} @click=${()=>{this.onSetDefault?.({...this.draft})}}>${D.t(`setDefault`)}</button>
|
|
410
|
-
<button class="ui-button ui-button--action" ?disabled=${t||!this.hasLocalOverride} @click=${()=>this.onUseDefault?.()}>${D.t(`useDefault`)}</button>
|
|
411
|
-
</div>
|
|
412
|
-
${P(this.configResponse,`/defaultTheme`,this.loading||this.saving,this.onReset)}
|
|
413
|
-
<p class="hint" id="theme-scope-help">${D.t(`scope`)}</p>
|
|
414
|
-
</section>
|
|
415
|
-
`}themeName(e){return this.themes.find(t=>t.id===e)?.name??(this.catalogLoading||this.catalogError?e:D.t(`unavailable`,{id:e}))}static{this.styles=[e,g,E,S`
|
|
416
|
-
:host { display: block; }
|
|
417
|
-
p { margin: 0; }
|
|
418
|
-
p, small { color: var(--pi-muted); line-height: 1.45; }
|
|
419
|
-
.current-theme span { color: var(--pi-text-secondary); font-size: 12px; overflow-wrap: anywhere; }
|
|
420
|
-
.auto-field span { display: grid; gap: 3px; }
|
|
421
|
-
.hint { font-size: 12px; }
|
|
422
|
-
`]}};c([m({attribute:!1})],R.prototype,`configResponse`,void 0),c([m({attribute:!1})],R.prototype,`onReset`,void 0),c([m({attribute:!1})],R.prototype,`themes`,void 0),c([m({attribute:!1})],R.prototype,`preference`,void 0),c([m({attribute:!1})],R.prototype,`defaultPreference`,void 0),c([m()],R.prototype,`activeThemeId`,void 0),c([m({type:Boolean})],R.prototype,`hasLocalOverride`,void 0),c([m({type:Boolean})],R.prototype,`loading`,void 0),c([m({type:Boolean})],R.prototype,`saving`,void 0),c([m({type:Boolean})],R.prototype,`catalogLoading`,void 0),c([m()],R.prototype,`catalogError`,void 0),c([m({attribute:!1})],R.prototype,`onRetryCatalog`,void 0),c([m({attribute:!1})],R.prototype,`onUseLocal`,void 0),c([m({attribute:!1})],R.prototype,`onSetDefault`,void 0),c([m({attribute:!1})],R.prototype,`onUseDefault`,void 0),c([p()],R.prototype,`draft`,void 0),R=c([l(`settings-theme-panel`)],R);var kt={heading:_(`File icons`,`File icon theme settings heading and selector label`),scope:_(`Applies only in this browser, independently of the color theme.`,`Browser-local file icon preference scope`),none:_(`None`,`Option to turn off themed file icons`),reset:_(`Reset to Material`,`Remove the browser file icon override`),unavailable:_(`{id} (unavailable)`,`Unavailable saved file icon theme; preserve id`),unavailableHelp:_(`This icon theme is unavailable. Using Material until it returns.`,`Unavailable file icon theme fallback explanation`)},At=x.registerMessages(`core.settingsFileIconTheme`,kt),jt=class extends T{constructor(){super(),this.themes=[],new y(this),n.createController(this)}updated(){let e=this.renderRoot.querySelector(`select`);e!==null&&(e.value=this.preference??`themes:material`)}render(){let e=this.preference??`themes:material`,t=e===`none`||this.themes.some(({id:t})=>t===e);return w`
|
|
423
|
-
<section class="ui-settings-section" aria-labelledby="file-icons-heading">
|
|
424
|
-
<header class="ui-settings-heading">
|
|
425
|
-
<h3 id="file-icons-heading">${At.t(`heading`)}</h3>
|
|
426
|
-
<p id="file-icons-scope">${At.t(`scope`)}</p>
|
|
427
|
-
</header>
|
|
428
|
-
<label class="ui-form-field">
|
|
429
|
-
<span>${At.t(`heading`)}</span>
|
|
430
|
-
<select class="ui-select" aria-describedby=${t?`file-icons-scope`:`file-icons-scope file-icons-unavailable`} @change=${e=>{e.target instanceof HTMLSelectElement&&this.onSelect?.(e.target.value)}}>
|
|
431
|
-
${t?null:w`<option value=${e}>${At.t(`unavailable`,{id:e})}</option>`}
|
|
432
|
-
<option value=${pe}>${At.t(`none`)}</option>
|
|
433
|
-
${this.themes.map(e=>w`<option value=${e.id}>${e.name}</option>`)}
|
|
434
|
-
</select>
|
|
435
|
-
</label>
|
|
436
|
-
${t?null:w`<p id="file-icons-unavailable" role="status">${At.t(`unavailableHelp`)}</p>`}
|
|
437
|
-
<div class="ui-settings-actions">
|
|
438
|
-
<button class="ui-button ui-button--action" ?disabled=${this.preference===void 0} @click=${()=>this.onReset?.()}>${At.t(`reset`)}</button>
|
|
439
|
-
</div>
|
|
440
|
-
</section>
|
|
441
|
-
`}static{this.styles=[e,g,E,S`
|
|
442
|
-
:host { display: block; }
|
|
443
|
-
p { margin: 0; color: var(--pi-muted); line-height: 1.45; }
|
|
444
|
-
`]}};c([m({attribute:!1})],jt.prototype,`themes`,void 0),c([m({attribute:!1})],jt.prototype,`preference`,void 0),c([m({attribute:!1})],jt.prototype,`onSelect`,void 0),c([m({attribute:!1})],jt.prototype,`onReset`,void 0),jt=c([l(`settings-file-icon-theme-panel`)],jt);var Mt={heading:_(`Session daemon`,`Session daemon settings heading`),description:_(`Configure agent permissions on {target}. Changes require that machine’s session daemon to restart. Restarting interrupts active sessions and running work.`,`Selected machine scope and restart consequences; target is a raw machine label`),selectedMachine:_(`selected machine`,`Fallback when no selected machine label is supplied`),refresh:_(`Refresh settings`,`Reload selected machine daemon configuration`),configFile:_(`Config file`,`Selected machine configuration path label`),spawn:_(`Allow agents to start sessions`,`Agent session spawning permission toggle`),spawnHelp:_(`Agents can start sessions in any workspace of the same registered project with <code>{tool}</code>.`,`Session spawning guidance; tool is an untranslated tool identifier`),subsessions:_(`Allow agents to track child sessions`,`Tracked child session permission toggle`),subsessionsHelp:_(`Agents can start child sessions, check progress, and receive completion notifications with <code>{spawn}</code>, <code>{list}</code>, <code>{check}</code>, and <code>{read}</code>.`,`Tracked child session guidance; spawn/list/check/read are untranslated tool identifiers`),spawnRequired:_(`Requires “Allow agents to start sessions”.`,`Child-session permission dependency when session spawning is enabled`),enableSpawn:_(`Enable “Allow agents to start sessions” first.`,`Child-session permission dependency when session spawning is disabled`),sessionMessages:_(`Allow agents to message other sessions`,`Cross-session messaging permission toggle`),sessionMessagesHelp:_(`Agents can send messages to sessions in the same registered project with <code>{tool}</code>. This does not grant access to their results or control over them.`,`Cross-session messaging guidance; tool is an untranslated tool identifier`),askUser:_(`Allow agents to ask you questions`,`Question form permission toggle`),askUserHelp:_(`Agents can show a question form and wait for your answers with <code>{tool}</code>.`,`Question form guidance; tool is an untranslated tool identifier`),envOverride:_(`Read-only because <code>{variable}</code> overrides this setting. Change or remove it in the daemon environment to edit here.`,`Permission environment override; variable is an untranslated environment variable name`),restartHeading:_(`After the next daemon restart`,`Saved permission summary heading, not running daemon state`),restartHelp:_(`Saved agent permissions with environment overrides applied. This does not show the running daemon’s active settings.`,`Saved permission summary scope`),spawnSummary:_(`Spawn sessions`,`Saved session spawning permission label`),subsessionsSummary:_(`Subsessions`,`Saved tracked-child-session permission label`),sessionMessagesSummary:_(`Session messages`,`Saved cross-session messaging permission label`),askUserSummary:_(`Ask questions`,`Saved question form permission label`),enabled:_(`Enabled`,`Permission enabled value`),disabled:_(`Disabled`,`Permission disabled value`),loading:_(`Loading configuration…`,`Selected machine configuration loading status`),unavailable:_(`Configuration is unavailable. Refresh settings to try again.`,`Selected machine configuration unavailable recovery`)};function Nt(e){return{spawnSessions:e}}function Pt(e){return{subsessions:e}}function Ft(e){return{sessionMessages:e}}function It(e){return{askUser:e}}function Lt(e,t){let n=e?.effectiveConfig.agent;return n?.dir===void 0||t===void 0?`unavailable`:n.dir===t.dir?`active`:`restart-required`}function Rt(e,t){return e?.agentDirSource===`pi-web`||e?.agentDirSource===`pi-compatibility`||e?.agentDir===!0}function zt(e,t){let n={...e.envOverrides,spawnSessions:t.envOverrides.spawnSessions,subsessions:t.envOverrides.subsessions,sessionMessages:t.envOverrides.sessionMessages,askUser:t.envOverrides.askUser,agentCommand:t.envOverrides.agentCommand,agentDir:t.envOverrides.agentDir,agentSessionDir:t.envOverrides.agentSessionDir};return t.envOverrides.agentDirSource===void 0?delete n.agentDirSource:n.agentDirSource=t.envOverrides.agentDirSource,{...mt(e,t,[`spawnSessions`,`subsessions`,`sessionMessages`,`askUser`,`agent`]),envOverrides:n}}var z=x.registerMessages(`core.settingsSessiond`,Mt),B=e=>w`<code dir="ltr">${e}</code>`,V=class extends T{constructor(){super(),this.loading=!1,this.saving=!1,this.error=``,this.savedMessage=``,this.targetLabel=``,this.agentProfileSupport={state:`supported`},this.targetId=`local`,this.agentDraft=Fe(),this.agentDraftDirty=!1,this.agentLocalError=``,new y(this),n.createController(this)}willUpdate(e){e.has(`targetId`)&&(this.agentDraft=Fe(),this.agentDraftDirty=!1,this.agentLocalError=``),e.has(`configResponse`)&&(this.configResponse===void 0?(this.agentDraft=Fe(),this.agentDraftDirty=!1,this.agentLocalError=``):(!this.agentDraftDirty||Re(this.agentDraft,this.configResponse.config))&&(this.agentDraft=Ie(this.configResponse.config),this.agentDraftDirty=!1,this.agentLocalError=``))}render(){let e=this.configResponse,t=this.targetId,n=N(e,`/spawnSessions`)!==void 0,r=e?.effectiveConfig.spawnSessions!==!1,i=N(e,`/subsessions`)!==void 0,a=e?.effectiveConfig.subsessions===!0&&r,o=N(e,`/sessionMessages`)!==void 0,s=e?.effectiveConfig.sessionMessages!==!1,c=N(e,`/askUser`)!==void 0,ee=e?.effectiveConfig.askUser!==void 0,l=e?.effectiveConfig.askUser===!0,u=e?.envOverrides.agentCommand===!0,d=this.agentProfileSupport.state===`supported`,te=u?e.effectiveConfig.agent?.command??this.agentDraft.command:this.agentDraft.command,f=Rt(e?.envOverrides,te),p=e?.envOverrides.agentDir===!0,m=e?.effectiveConfig.agent,ne=Lt(e,this.activeAgentProfile);return w`
|
|
445
|
-
<settings-panel-frame
|
|
446
|
-
.heading=${z.t(`heading`)}
|
|
447
|
-
.description=${z.t(`description`,{target:this.targetLabel||z.t(`selectedMachine`)})}
|
|
448
|
-
.actionLabel=${z.t(`refresh`)}
|
|
449
|
-
.actionDisabled=${this.loading||this.saving}
|
|
450
|
-
.notices=${this.panelNotices(e)}
|
|
451
|
-
.onAction=${this.onReload}
|
|
452
|
-
>
|
|
453
|
-
<section class="ui-settings-section">
|
|
454
|
-
${e===void 0?w`<div class="loading-card">${z.t(this.loading?`loading`:`unavailable`)}</div>`:w`
|
|
455
|
-
<div class="config-path-card ui-settings-path">
|
|
456
|
-
<span>${z.t(`configFile`)}</span>
|
|
457
|
-
<code dir="ltr">${e.path}</code>
|
|
458
|
-
</div>
|
|
459
|
-
<form class="profile-form ui-settings-fields" aria-label="${b(`ui.settingsSessiondPanel.piCompatibleAgentProfile`,`Pi-compatible agent profile`)}" @submit=${e=>{this.saveAgentProfile(e,t)}}>
|
|
460
|
-
${d?null:w`<div class="profile-support-message">${this.agentProfileSupport.message??b(`ui.settingsSessiondPanel.thisMachineDoesNotSupportEditingPiCompatible`,`This machine does not support editing Pi-compatible agent profiles.`)}</div>`}
|
|
461
|
-
<label class="field ui-form-field">
|
|
462
|
-
<span class="field-heading">
|
|
463
|
-
<span>${b(`ui.settingsSessiondPanel.companionCliCommand`,`Companion CLI command`)}</span>
|
|
464
|
-
${u?w`<span class="override-badge">${b(`ui.settingsGeneralPanel.environmentOverrides`,`Environment overrides`)}</span>`:null}
|
|
465
|
-
</span>
|
|
466
|
-
<input
|
|
467
|
-
class="text-input ui-input"
|
|
468
|
-
type="text"
|
|
469
|
-
autocomplete="off"
|
|
470
|
-
spellcheck="false"
|
|
471
|
-
.value=${this.agentDraft.command}
|
|
472
|
-
placeholder="pi"
|
|
473
|
-
?disabled=${this.loading||this.saving||!d||u}
|
|
474
|
-
@input=${e=>{this.updateAgentDraft({command:Vt(e)})}}
|
|
475
|
-
>
|
|
476
|
-
<small>${b(`ui.settingsSessiondPanel.setThePiCompatibleCompanionCliUsedFor`,`Set the Pi-compatible companion CLI used for diagnostics and update checks. Embedded sessions still use the Pi SDK bundled with PI WEB.`)}</small>
|
|
477
|
-
</label>
|
|
478
|
-
<label class="field ui-form-field">
|
|
479
|
-
<span class="field-heading">
|
|
480
|
-
<span>${b(`ui.settingsSessiondPanel.profileStateDirectory`,`Profile state directory`)}</span>
|
|
481
|
-
${p?w`<span class="override-badge">${b(`ui.settingsGeneralPanel.environmentOverrides`,`Environment overrides`)}</span>`:null}
|
|
482
|
-
</span>
|
|
483
|
-
<input
|
|
484
|
-
class="text-input ui-input"
|
|
485
|
-
type="text"
|
|
486
|
-
autocomplete="off"
|
|
487
|
-
spellcheck="false"
|
|
488
|
-
.value=${this.agentDraft.dir}
|
|
489
|
-
placeholder="${b(`ui.settingsSessiondPanel.piAgentOrAgentProfilesWork`,`~/.pi/agent or ~/agent-profiles/work`)}"
|
|
490
|
-
?disabled=${this.loading||this.saving||!d||f}
|
|
491
|
-
@input=${e=>{this.updateAgentDraft({dir:Vt(e)})}}
|
|
492
|
-
>
|
|
493
|
-
<small>${b(`ui.settingsSessiondPanel.chooseThePiCompatibleAuthenticationModelSettingsAnd`,`Choose the Pi-compatible authentication, model, settings, and session directory PI WEB reads. Alternate commands are saved with their required state directory.`)}</small>
|
|
494
|
-
</label>
|
|
495
|
-
<footer class="form-actions ui-settings-actions">
|
|
496
|
-
<button class="primary ui-button ui-button--action ui-button--primary" type="submit" ?disabled=${this.loading||this.saving||!d||u&&f}>${this.saving?b(`ui.settingsGeneralPanel.saving`,`Saving…`):b(`ui.settingsSessiondPanel.saveAgentProfile`,`Save agent profile`)}</button>
|
|
497
|
-
</footer>
|
|
498
|
-
</form>
|
|
499
|
-
<div class="field ui-form-field">
|
|
500
|
-
<span class="field-heading">
|
|
501
|
-
<span>${b(`ui.settingsSessiondPanel.allowAgentsToStartSessions`,`Allow agents to start sessions`)}</span>
|
|
502
|
-
${n?w`<span class="override-badge">${b(`ui.settingsGeneralPanel.environmentOverrides`,`Environment overrides`)}</span>`:null}
|
|
503
|
-
</span>
|
|
504
|
-
<label class="toggle ui-checkbox-field">
|
|
505
|
-
<input type="checkbox" id="spawn-sessions" aria-describedby="spawn-sessions-help"
|
|
506
|
-
.checked=${h(r)} ?disabled=${this.loading||this.saving||n}
|
|
507
|
-
@change=${e=>{this.toggleSpawnSessions(e)}}>
|
|
508
|
-
<span>${z.t(`spawn`)}</span>
|
|
509
|
-
</label>
|
|
510
|
-
<small id="spawn-sessions-help">
|
|
511
|
-
${z.rich(`spawnHelp`,{code:B,tool:`spawn_session`})}
|
|
512
|
-
${n?z.rich(`envOverride`,{variable:`PI_WEB_SPAWN_SESSIONS`,code:B}):null}
|
|
513
|
-
</small>
|
|
514
|
-
</div>
|
|
515
|
-
<div class="field ui-form-field">
|
|
516
|
-
<span class="field-heading">
|
|
517
|
-
<span>${b(`ui.settingsSessiondPanel.allowAgentsToStartTrackedSubsessions`,`Allow agents to start tracked subsessions`)}</span>
|
|
518
|
-
${i?w`<span class="override-badge">${b(`ui.settingsGeneralPanel.environmentOverrides`,`Environment overrides`)}</span>`:null}
|
|
519
|
-
</span>
|
|
520
|
-
<label class="toggle ui-checkbox-field">
|
|
521
|
-
<input type="checkbox" id="subsessions" aria-describedby="subsessions-help"
|
|
522
|
-
.checked=${h(a)} ?disabled=${this.loading||this.saving||i||!r}
|
|
523
|
-
@change=${e=>{this.toggleSubsessions(e)}}>
|
|
524
|
-
<span>${z.t(`subsessions`)}</span>
|
|
525
|
-
</label>
|
|
526
|
-
<small id="subsessions-help">
|
|
527
|
-
${z.rich(`subsessionsHelp`,{code:B,spawn:`spawn_subsession`,list:`list_subsessions`,check:`check_subsession`,read:`read_subsession`})}
|
|
528
|
-
${z.t(r?`spawnRequired`:`enableSpawn`)}
|
|
529
|
-
${i?z.rich(`envOverride`,{variable:`PI_WEB_SUBSESSIONS`,code:B}):null}
|
|
530
|
-
</small>
|
|
531
|
-
</div>
|
|
532
|
-
<div class="field ui-form-field">
|
|
533
|
-
<span class="field-heading">
|
|
534
|
-
<span>${b(`ui.settingsSessiondPanel.allowAgentsToAskQuestions`,`Allow agents to ask questions`)}</span>
|
|
535
|
-
${c?w`<span class="override-badge">${b(`ui.settingsGeneralPanel.environmentOverrides`,`Environment overrides`)}</span>`:null}
|
|
536
|
-
</span>
|
|
537
|
-
<label class="toggle ui-checkbox-field">
|
|
538
|
-
<input type="checkbox" id="session-messages" aria-describedby="session-messages-help"
|
|
539
|
-
.checked=${h(s)} ?disabled=${this.loading||this.saving||o}
|
|
540
|
-
@change=${e=>{this.toggleSessionMessages(e)}}>
|
|
541
|
-
<span>${z.t(`sessionMessages`)}</span>
|
|
542
|
-
</label>
|
|
543
|
-
<small id="session-messages-help">
|
|
544
|
-
${z.rich(`sessionMessagesHelp`,{code:B,tool:`send_session_message`})}
|
|
545
|
-
${o?z.rich(`envOverride`,{variable:`PI_WEB_SESSION_MESSAGES`,code:B}):null}
|
|
546
|
-
</small>
|
|
547
|
-
</div>
|
|
548
|
-
<div class="field ui-form-field">
|
|
549
|
-
<label class="toggle ui-checkbox-field">
|
|
550
|
-
<input type="checkbox" id="ask-user" aria-describedby="ask-user-help" aria-label=${z.t(`askUser`)}
|
|
551
|
-
.checked=${h(l)} ?disabled=${this.loading||this.saving||c||!ee}
|
|
552
|
-
@change=${e=>{this.toggleAskUser(e)}}>
|
|
553
|
-
<span>${z.t(`askUser`)}</span>
|
|
554
|
-
</label>
|
|
555
|
-
<small id="ask-user-help">
|
|
556
|
-
${z.rich(`askUserHelp`,{code:B,tool:`ask_user`})}
|
|
557
|
-
${c?z.rich(`envOverride`,{variable:`PI_WEB_ASK_USER`,code:B}):null}
|
|
558
|
-
</small>
|
|
559
|
-
</div>
|
|
560
|
-
${[`spawnSessions`,`subsessions`,`sessionMessages`,`askUser`].map(t=>P(e,`/${t}`,this.loading||this.saving,this.onReset))}
|
|
561
|
-
<section class="effective-card ui-settings-summary" aria-labelledby="restart-summary-heading" aria-describedby="restart-summary-help">
|
|
562
|
-
<h3 id="restart-summary-heading">${z.t(`restartHeading`)}</h3>
|
|
563
|
-
<small id="restart-summary-help">${z.t(`restartHelp`)}</small>
|
|
564
|
-
<dl>
|
|
565
|
-
<div><dt>${b(`ui.settingsSessiondPanel.desiredCommand`,`Desired command`)}</dt><dd>${m?.command??b(`bundled.info.unavailable.460b35`,`Unavailable`)}</dd></div>
|
|
566
|
-
<div><dt>${b(`ui.settingsSessiondPanel.desiredStateDirectory`,`Desired state directory`)}</dt><dd>${m?.dir??b(`bundled.info.unavailable.460b35`,`Unavailable`)}</dd></div>
|
|
567
|
-
<div><dt>${b(`ui.settingsSessiondPanel.currentStateDirectory`,`Current state directory`)}</dt><dd>${this.activeAgentProfile?.dir??b(`bundled.info.unavailable.460b35`,`Unavailable`)}</dd></div>
|
|
568
|
-
<div><dt>${b(`ui.settingsSessiondPanel.profileStatus`,`Profile status`)}</dt><dd>${Bt(ne)}</dd></div>
|
|
569
|
-
<div><dt>${z.t(`spawnSummary`)}</dt><dd>${r?z.t(`enabled`):w`<span class="muted">${z.t(`disabled`)}</span>`}</dd></div>
|
|
570
|
-
<div><dt>${z.t(`subsessionsSummary`)}</dt><dd>${a?z.t(`enabled`):w`<span class="muted">${z.t(`disabled`)}</span>`}</dd></div>
|
|
571
|
-
<div><dt>${z.t(`sessionMessagesSummary`)}</dt><dd>${s?z.t(`enabled`):w`<span class="muted">${z.t(`disabled`)}</span>`}</dd></div>
|
|
572
|
-
<div><dt>${z.t(`askUserSummary`)}</dt><dd>${l?z.t(`enabled`):w`<span class="muted">${z.t(`disabled`)}</span>`}</dd></div>
|
|
573
|
-
</dl>
|
|
574
|
-
</section>
|
|
575
|
-
`}
|
|
576
|
-
</section>
|
|
577
|
-
</settings-panel-frame>
|
|
578
|
-
`}panelNotices(e){return Ut(e,{error:this.agentLocalError||this.error,savedMessage:this.savedMessage,activeProfile:this.activeAgentProfile,targetLabel:this.targetLabel,profileEditingSupported:this.agentProfileSupport.state===`supported`})}renderUnavailableConfigState(){return w`<div class="loading-card">${z.t(this.loading?`loading`:`unavailable`)}</div>`}async saveAgentProfile(e,t=this.targetId){if(e.preventDefault(),!(t!==this.targetId||this.loading||this.saving||this.agentProfileSupport.state!==`supported`||this.configResponse===void 0)){this.agentLocalError=``;try{await this.onSave?.(Le(this.agentDraft))}catch(e){this.agentLocalError=Ht(e)}}}updateAgentDraft(e){this.agentDraft={...this.agentDraft,...e},this.agentDraftDirty=!0,this.agentLocalError=``}async toggleSpawnSessions(e){let t=e.target instanceof HTMLInputElement&&e.target.checked;await this.onSave?.(Nt(t))}async toggleSubsessions(e){let t=e.target instanceof HTMLInputElement&&e.target.checked;await this.onSave?.(Pt(t))}async toggleSessionMessages(e){let t=e.target instanceof HTMLInputElement&&e.target.checked;await this.onSave?.(Ft(t))}async toggleAskUser(e){let t=e.target instanceof HTMLInputElement&&e.target.checked;await this.onSave?.(It(t))}static{this.styles=[e,g,E,S`
|
|
579
|
-
@layer pi-web-base {
|
|
580
|
-
:host { display: block; }
|
|
581
|
-
h3 { margin: 0; font-size: 13px; line-height: 1.3; }
|
|
582
|
-
.loading-card { color: var(--pi-muted); }
|
|
583
|
-
.config-path-card span, dt { color: var(--pi-muted); font-size: 12px; font-weight: 600; }
|
|
584
|
-
code { border: 1px solid var(--pi-border-muted); border-radius: 5px; background: var(--pi-bg); padding: 1px 4px; color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
585
|
-
.field small, .effective-card small { color: var(--pi-muted); line-height: 1.45; }
|
|
586
|
-
.effective-card dl { display: grid; gap: 8px; margin: 0; }
|
|
587
|
-
.effective-card dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: baseline; }
|
|
588
|
-
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
|
|
589
|
-
.muted { color: var(--pi-muted); }
|
|
590
|
-
|
|
591
|
-
@media (max-width: 760px) {
|
|
592
|
-
.effective-card dl > div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
`]}};c([m({attribute:!1})],V.prototype,`configResponse`,void 0),c([m({type:Boolean})],V.prototype,`loading`,void 0),c([m({type:Boolean})],V.prototype,`saving`,void 0),c([m()],V.prototype,`error`,void 0),c([m()],V.prototype,`savedMessage`,void 0),c([m()],V.prototype,`targetLabel`,void 0),c([m({attribute:!1})],V.prototype,`activeAgentProfile`,void 0),c([m({attribute:!1})],V.prototype,`agentProfileSupport`,void 0),c([m({attribute:!1})],V.prototype,`onReload`,void 0),c([m({attribute:!1})],V.prototype,`onSave`,void 0),c([m({attribute:!1})],V.prototype,`onReset`,void 0),c([m()],V.prototype,`targetId`,void 0),c([p()],V.prototype,`agentDraft`,void 0),c([p()],V.prototype,`agentDraftDirty`,void 0),c([p()],V.prototype,`agentLocalError`,void 0),V=c([l(`settings-sessiond-panel`)],V);function Bt(e){return e===`active`?b(`ui.settingsSessiondPanel.applied`,`Applied`):e===`restart-required`?b(`bundled.info.restart.needed.1ffd00`,`Restart needed`):w`<span class="muted">${b(`bundled.info.unavailable.460b35`,`Unavailable`)}</span>`}function Vt(e){return e.target instanceof HTMLInputElement?e.target.value:``}function Ht(e){return e instanceof Error?e.message:String(e)}function Ut(e,t){let n=[];t.error!==``&&n.push({type:`error`,content:t.error}),t.savedMessage!==``&&n.push({type:`success`,content:t.savedMessage});let r=Lt(e,t.activeProfile);return r===`restart-required`?n.push({type:`warning`,title:b(`ui.settingsSessiondPanel.piCompatibleAgentProfileOnRequiresARestart`,`Pi-compatible agent profile on {targetLabel} requires a restart`,{targetLabel:t.targetLabel}),content:w`${b(`ui.main.cbc1edd666c2`,`The desired state directory differs from the running session daemon. On that machine, run `)} <code>pi-web restart</code>${b(`ui.main.44de61cea1d8`,` (or restart its session daemon service) to apply the state directory.`)}`}):e!==void 0&&r===`unavailable`&&t.profileEditingSupported&&n.push({type:`info`,title:b(`ui.settingsSessiondPanel.unableToGetTheActivePiCompatibleAgent`,`Unable to get the active Pi-compatible agent profile on {targetLabel}`,{targetLabel:t.targetLabel}),content:b(`ui.settingsSessiondPanel.piWebCannotCompareTheDesiredProfileWith`,`PI WEB cannot compare the desired profile with the running session daemon profile. Reload when the daemon is available.`)}),n}var Wt={relayName:_(`Relays`,`Shipped Relay package display name`),relayDescription:_(`Tool-agnostic Relay method, opinionated runner profile, and human-gated preparation prompts for independent Pi session chains.`,`Shipped Relay package description`),workflowsName:_(`Workflows`,`Shipped Workflows package display name`),workflowsDescription:_(`Opinionated workflow prompts and shortcuts, starting with /worktree for named Git worktrees based on the invoking checkout's HEAD.`,`Shipped Workflows package description; preserve /worktree command`),heading:_(`Pi packages`,`Pi package management heading`),description:_(`Managing Pi packages on <strong>{target}</strong>. Install, remove, and update packages managed by Pi on the selected machine. Pi packages can provide extensions, skills, prompt templates, themes, context/system prompt files, and PI WEB browser plugins.`,`Panel scope; safe emphasis on raw target label`),target:_(`{name} ({kind, select, local {local gateway} other {remote machine}})`,`Machine target label; name is unchanged`),refresh:_(`Refresh package list`,`Reload package list action`),refreshTitle:_(`Refresh Pi packages from {target}`,`Refresh title; raw target label`),community:_(`Find community plugins ↗`,`Link to community plugin directory`),trusted:_(`<strong>Trusted code warning:</strong> Pi packages and PI WEB plugins can run with your user permissions. Install packages and enable plugins only from sources you trust.`,`Security notice; safe emphasis`),loading:_(`Loading Pi packages from {target}…`,`Package load status`),unavailable:_(`Pi package list unavailable for {target}. Choose Refresh package list to try again.`,`Package load unavailable guidance`),availableAria:_(`Available known Pi packages`,`Known package section accessible name`),available:_(`Available packages`,`Known package section heading`),availableHelp:_(`Install a package included with PI WEB on {target}.`,`Known package installation target`),installAria:_(`Install {name}`,`Install suggested package; raw package label`),installing:_(`Installing…`,`Pending install action`),install:_(`Install`,`Install package action`),source:_(`Pi package source`,`Package source input label`),placeholder:_(`npm:@scope/package, git URL, or local path`,`Package source placeholder; preserve npm syntax`),installTitle:_(`Install this Pi package`,`Source form install title`),sourceHelp:_(`Enter an npm package, Git URL, or path on {target}. Packages install in Pi’s default location, as with <code>{command}</code>.`,`Source help; unchanged command in safe code markup`),validation:_(`Enter an npm package, Git URL, or local path.`,`Missing package source validation`),configured:_(`Configured Pi packages`,`Installed package list heading and accessible name`),configuredHelp:_(`This list comes from Pi's package manager settings on {target}.`,`Package list provenance`),updateAllTitle:_(`Update all user-scope Pi packages`,`Update all title`),updateAll:_(`Update all`,`Update all user packages action`),updating:_(`Updating…`,`Pending package update`),refreshing:_(`Refreshing Pi packages from {target}…`,`Refreshing loaded package list`),empty:_(`No Pi packages configured in Pi settings on {target} yet.`,`Empty package list`),metadata:_(`{scope, select, project {Project scope} other {User scope}} · {filtered, select, yes {Filtered by current Pi package settings} other {Available in this PI WEB process}}`,`Complete package scope and availability metadata`),installedPath:_(`Installed path: <code>{path}</code>`,`Installed path label with safe unchanged path`),pathUnknown:_(`Installed path not reported by Pi`,`Missing installed path fallback`),projectUpdate:_(`Update this project package from its project folder using Pi’s package manager. This view updates user packages only.`,`Why a project package cannot be updated here`),noUpdates:_(`No Pi packages are configured yet.`,`Empty update-all disabled reason`),mixedUpdates:_(`Update all is disabled while project-scope Pi packages are listed; update user-scope packages individually.`,`Mixed scopes update-all disabled reason`),updateAria:_(`Update {name}`,`Update package accessible name; unchanged source`),updateTitle:_(`Update this Pi package`,`Update package title`),update:_(`Update`,`Update package action`),removeAria:_(`Remove {name}`,`Remove package accessible name; unchanged source`),removeTitle:_(`Remove this Pi package`,`Remove package title`),removing:_(`Removing…`,`Pending package removal`),remove:_(`Remove`,`Remove package action`)};function Gt(e){return e===void 0?{id:`local`,name:b(`ui.piPackageSettings.local`,`Local`),kind:`local`}:{id:e.id,name:e.name,kind:e.kind}}function Kt(e){return e.kind===`local`?b(`ui.settingsMachineTarget.localGateway`,`{name} (local gateway)`,{name:e.name}):b(`ui.settingsMachineTarget.remoteMachine`,`{name} (remote machine)`,{name:e.name})}function qt(e,t){return e.kind===`local`||t?.ok===!0?{state:`supported`}:{state:`unknown`}}function Jt(e){return`${e.state}:${e.message??``}`}function Yt(e){return e?.state===`unsupported`}function Xt(e){return b(`ui.piPackageSettings.doesNotSupportPiPackageManagementUpdateAnd`,`{name} does not support Pi package management. Update and restart PI WEB on that machine, then retry.`,{name:e.name})}function Zt(e){return e.kind===`local`}function Qt(e){return e.trim()}function $t(e){if(Qt(e)===``)return b(`ui.piPackageSettings.enterAPiSupportedPackageSourceSuchAs`,`Enter a Pi-supported package source, such as npm:@scope/package, a Git/URL source, or a local path.`)}function en(e){return{packages:e.packages,...e.installableKnownPackages===void 0?{}:{installableKnownPackages:e.installableKnownPackages}}}function tn(e){return e.scope===`user`}function nn(e){return e.length>0&&e.every(tn)}function rn(e,t,n){return e?.kind===t?n===void 0||e.source===n:!1}function an(e,t){let n=e.trim();return t.kind===`remote`?on(n)?Xt(t):n===`Remote machine timeout`?b(`ui.piPackageSettings.timedOutContactingForPiPackageManagementThe`,`Timed out contacting {name} for Pi package management. The operation may still be running remotely; reload the package list before retrying.`,{name:t.name}):n===`Remote machine unavailable`?b(`ui.piPackageSettings.unableToConnectToForPiPackageManagement`,`Unable to connect to {name} for Pi package management. Check the machine connection and retry.`,{name:t.name}):n:n}function on(e){return e===`Not Found`||/route\s+(GET|POST):?\/api\/pi-packages\b.*not found/iu.test(e)||/cannot\s+(GET|POST)\s+.*\/api\/pi-packages\b/iu.test(e)}var H=x.registerMessages(`core.settingsPackages`,Wt),sn=e=>w`<strong>${e}</strong>`,cn=e=>w`<code dir="ltr">${e}</code>`;function ln(e){switch(e.id){case`@jmfederico/pi-relay`:return{label:H.t(`relayName`),description:H.t(`relayDescription`)};case`@jmfederico/pi-web-workflows`:return{label:H.t(`workflowsName`),description:H.t(`workflowsDescription`)};default:return e}}var U=class extends T{constructor(){super(),this.loading=!1,this.error=``,this.operationMessage=``,this.installSource=``,this.validationFailed=!1,new y(this),n.createController(this)}render(){let e=this.packagesResponse?.packages??[],t=this.packageTarget,n=H.t(`target`,{name:t.name,kind:t.kind}),r=this.packageManagementUnavailable,i=this.packagesResponse!==void 0&&!r;return w`
|
|
597
|
-
<settings-panel-frame
|
|
598
|
-
heading=${H.t(`heading`)}
|
|
599
|
-
.description=${w`${H.rich(`description`,{target:n,strong:sn})}`}
|
|
600
|
-
actionLabel=${H.t(`refresh`)}
|
|
601
|
-
actionTitle=${r?this.packageManagementUnavailableMessage(n):H.t(`refreshTitle`,{target:n})}
|
|
602
|
-
.actionDisabled=${this.loading||this.isOperating||r}
|
|
603
|
-
.notices=${this.panelNotices(n,i)}
|
|
604
|
-
.onAction=${this.onReload}
|
|
605
|
-
>
|
|
606
|
-
<p><a href="https://pi-web.dev/community-plugins" target="_blank" rel="noopener noreferrer">${H.t(`community`)}</a></p>
|
|
607
|
-
${this.renderPanelContent(e,t,n)}
|
|
608
|
-
</settings-panel-frame>
|
|
609
|
-
`}panelNotices(e,t){let n=[];return this.packageManagementUnavailable?n.push({type:`availability`,content:this.packageManagementUnavailableMessage(e)}):this.error!==``&&n.push({type:`error`,content:this.error}),this.operationMessage!==``&&n.push({type:`success`,content:this.operationMessage}),t&&n.push({type:`security`,content:w`${H.rich(`trusted`,{strong:sn})}`}),n}renderPanelContent(e,t,n){return this.packageManagementUnavailable?null:this.packagesResponse===void 0?w`<div class="loading-card ui-settings-summary">${H.t(this.loading?`loading`:`unavailable`,{target:n})}</div>`:w`
|
|
610
|
-
${this.renderInstallableKnownPackages(n)}
|
|
611
|
-
${this.renderInstallForm(n)}
|
|
612
|
-
${this.renderPackageList(e,t)}
|
|
613
|
-
`}renderInstallableKnownPackages(e){let t=this.packagesResponse?.installableKnownPackages??[];return t.length===0?null:w`
|
|
614
|
-
<section class="known-package-section ui-settings-section" aria-label=${H.t(`availableAria`)}>
|
|
615
|
-
<div class="ui-settings-heading">
|
|
616
|
-
<h3>${H.t(`available`)}</h3>
|
|
617
|
-
<p>${H.t(`availableHelp`,{target:e})}</p>
|
|
618
|
-
</div>
|
|
619
|
-
<div class="known-package-list ui-settings-list">
|
|
620
|
-
${t.map(e=>this.renderInstallableKnownPackage(e))}
|
|
621
|
-
</div>
|
|
622
|
-
</section>
|
|
623
|
-
`}renderInstallableKnownPackage(e){let t=rn(this.operation,`install`,e.source),n=ln(e);return w`
|
|
624
|
-
<article class="known-package-card ui-settings-row">
|
|
625
|
-
<div class="package-main">
|
|
626
|
-
<strong dir="auto">${n.label}</strong>
|
|
627
|
-
<small dir="auto">${n.description}</small>
|
|
628
|
-
</div>
|
|
629
|
-
<button class="ui-button ui-button--action ui-button--primary" title=${H.t(`installAria`,{name:n.label})} aria-label=${H.t(`installAria`,{name:n.label})} ?disabled=${this.isOperating} @click=${()=>{this.installKnownPackage(e.source)}}>${H.t(t?`installing`:`install`)}</button>
|
|
630
|
-
</article>
|
|
631
|
-
`}renderInstallForm(e){return w`
|
|
632
|
-
<form class="install-card ui-settings-section" @submit=${e=>{this.installPackage(e)}}>
|
|
633
|
-
<label class="ui-form-field" for="package-source">${H.t(`source`)}</label>
|
|
634
|
-
<div class="install-row">
|
|
635
|
-
<input class="ui-input" id="package-source" dir="ltr" aria-describedby="package-source-help package-source-error" aria-invalid=${this.validationFailed?`true`:`false`} .value=${this.installSource} ?disabled=${this.isOperating} placeholder=${H.t(`placeholder`)} @input=${e=>{this.updateInstallSource(e)}}>
|
|
636
|
-
<button class="ui-button ui-button--action ui-button--primary" type="submit" title=${H.t(`installTitle`)} ?disabled=${this.isOperating}>${H.t(rn(this.operation,`install`)?`installing`:`install`)}</button>
|
|
637
|
-
</div>
|
|
638
|
-
<div id="package-source-error" class="field-error" role="alert">${this.validationFailed?H.t(`validation`):``}</div>
|
|
639
|
-
<small id="package-source-help">${H.rich(`sourceHelp`,{target:e,command:`pi install <source>`,code:cn})}</small>
|
|
640
|
-
</form>
|
|
641
|
-
`}renderPackageList(e,t){let n=H.t(`target`,{name:t.name,kind:t.kind}),r=nn(e)?void 0:H.t(e.length===0?`noUpdates`:`mixedUpdates`),i=r!==void 0&&e.length>0,a=r??H.t(`updateAllTitle`);return w`
|
|
642
|
-
<section class="package-section ui-settings-section" aria-label=${H.t(`configured`)}>
|
|
643
|
-
<div class="package-toolbar">
|
|
644
|
-
<div class="ui-settings-heading">
|
|
645
|
-
<h3>${H.t(`configured`)}</h3>
|
|
646
|
-
<p>${H.t(`configuredHelp`,{target:n})}</p>
|
|
647
|
-
</div>
|
|
648
|
-
<button class="secondary ui-button ui-button--action" title=${a} ?disabled=${this.isOperating||r!==void 0} @click=${()=>{this.updatePackage()}}>
|
|
649
|
-
${H.t(rn(this.operation,`update-all`)?`updating`:`updateAll`)}
|
|
650
|
-
</button>
|
|
651
|
-
</div>
|
|
652
|
-
${i?w`<div class="action-note">${r}</div>`:null}
|
|
653
|
-
${this.loading&&e.length>0?w`<div class="action-note">${H.t(`refreshing`,{target:n})}</div>`:null}
|
|
654
|
-
${this.renderPackageListContent(e,n)}
|
|
655
|
-
</section>
|
|
656
|
-
`}renderPackageListContent(e,t){return this.loading&&e.length===0?w`<div class="loading-card ui-settings-summary">${H.t(`loading`,{target:t})}</div>`:e.length===0?w`<div class="loading-card ui-settings-summary">${H.t(`empty`,{target:t})}</div>`:w`
|
|
657
|
-
<div class="package-list ui-settings-list">
|
|
658
|
-
${e.map(e=>this.renderPackage(e))}
|
|
659
|
-
</div>
|
|
660
|
-
`}renderPackage(e){let t=H.t(`target`,{name:this.packageTarget.name,kind:this.packageTarget.kind}),n=this.packageManagementUnavailable,r=n?this.packageManagementUnavailableMessage(t):tn(e)?void 0:H.t(`projectUpdate`),i=n?this.packageManagementUnavailableMessage(t):H.t(`removeTitle`),a=rn(this.operation,`update`,e.source),o=rn(this.operation,`remove`,e.source);return w`
|
|
661
|
-
<article class=${`package-card ui-settings-row${e.filtered?` filtered`:``}`}>
|
|
662
|
-
<div class="package-main">
|
|
663
|
-
<strong dir="auto">${e.source}</strong>
|
|
664
|
-
<small>${H.t(`metadata`,{scope:e.scope,filtered:e.filtered?`yes`:`no`})}</small>
|
|
665
|
-
<small>${H.rich(`installedPath`,{path:e.installedPath??H.t(`pathUnknown`),code:cn})}</small>
|
|
666
|
-
${r===void 0?null:w`<small class="action-note">${r}</small>`}
|
|
667
|
-
</div>
|
|
668
|
-
<div class="package-actions ui-settings-actions">
|
|
669
|
-
<button class="secondary ui-button ui-button--action" aria-label=${H.t(`updateAria`,{name:e.source})} title=${r??H.t(`updateTitle`)} ?disabled=${this.isOperating||r!==void 0} @click=${()=>{this.updatePackage(e.source)}}>${H.t(a?`updating`:`update`)}</button>
|
|
670
|
-
<button class="danger ui-button ui-button--action" aria-label=${H.t(`removeAria`,{name:e.source})} title=${i} ?disabled=${this.isOperating||n} @click=${()=>{this.removePackage(e)}}>${H.t(o?`removing`:`remove`)}</button>
|
|
671
|
-
</div>
|
|
672
|
-
</article>
|
|
673
|
-
`}updateInstallSource(e){this.installSource=e.target instanceof HTMLInputElement?e.target.value:``,this.validationFailed=!1}async installPackage(e){if(e.preventDefault(),$t(this.installSource)!==void 0){this.validationFailed=!0;return}let t=Qt(this.installSource);try{await this.onInstallPackage?.(t),this.installSource=``,this.validationFailed=!1}catch{}}async removePackage(e){try{await this.onRemovePackage?.(e.source,e.scope)}catch{}}async installKnownPackage(e){try{await this.onInstallPackage?.(e)}catch{}}async updatePackage(e){try{await this.onUpdatePackage?.(e)}catch{}}get packageTarget(){return this.targetMachine??Gt(void 0)}get packageManagementUnavailable(){return Yt(this.managementSupport)}packageManagementUnavailableMessage(e){return this.managementSupport?.message??b(`ui.settingsPackagesPanel.doesNotSupportPiPackageManagement`,`{targetLabel} does not support Pi package management.`,{targetLabel:e})}get isOperating(){return this.operation!==void 0}static{this.styles=[e,g,E,S`
|
|
674
|
-
@layer pi-web-base {
|
|
675
|
-
:host { display: block; }
|
|
676
|
-
.package-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; }
|
|
677
|
-
.package-toolbar > div { flex: 1 1 240px; min-width: 0; }
|
|
678
|
-
.package-main { flex: 1 1 240px; display: grid; gap: 6px; min-width: 0; }
|
|
679
|
-
small { color: var(--pi-muted); line-height: 1.45; }
|
|
680
|
-
.secondary { flex: 0 0 auto; }
|
|
681
|
-
.field-error { color: var(--pi-danger); font-size: 12px; }
|
|
682
|
-
.field-error:empty { display: none; }
|
|
683
|
-
.install-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
|
|
684
|
-
.known-package-section, .package-section { padding: 0; gap: 0; }
|
|
685
|
-
.known-package-section > .ui-settings-heading, .package-toolbar { padding: 16px; }
|
|
686
|
-
.loading-card, .action-note { color: var(--pi-muted); }
|
|
687
|
-
.action-note { font-size: 12px; }
|
|
688
|
-
.package-section > .action-note { padding: 0 16px 12px; }
|
|
689
|
-
.package-card, .known-package-card { align-items: center; }
|
|
690
|
-
.package-card.filtered { opacity: .82; }
|
|
691
|
-
.package-main strong, .package-main small { overflow-wrap: anywhere; }
|
|
692
|
-
code { color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
693
|
-
|
|
694
|
-
@media (max-width: 760px) {
|
|
695
|
-
.install-row { grid-template-columns: minmax(0, 1fr); }
|
|
696
|
-
.install-row > .ui-button { justify-self: start; }
|
|
697
|
-
.package-main { flex-basis: 100%; }
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
`]}};c([m({attribute:!1})],U.prototype,`packagesResponse`,void 0),c([m({type:Boolean})],U.prototype,`loading`,void 0),c([m({attribute:!1})],U.prototype,`operation`,void 0),c([m({attribute:!1})],U.prototype,`targetMachine`,void 0),c([m({attribute:!1})],U.prototype,`managementSupport`,void 0),c([m()],U.prototype,`error`,void 0),c([m()],U.prototype,`operationMessage`,void 0),c([m({attribute:!1})],U.prototype,`onReload`,void 0),c([m({attribute:!1})],U.prototype,`onInstallPackage`,void 0),c([m({attribute:!1})],U.prototype,`onRemovePackage`,void 0),c([m({attribute:!1})],U.prototype,`onUpdatePackage`,void 0),c([p()],U.prototype,`installSource`,void 0),c([p()],U.prototype,`validationFailed`,void 0),U=c([l(`settings-packages-panel`)],U);var un={heading:_(`PI WEB plugins`,`Plugin settings heading`),description:_(`Manage saved plugin settings and check running server plugins on <strong>{target}</strong>. This is separate from installing Pi packages.`,`Panel scope; strong safely emphasizes the raw machine name`),localTarget:_(`local (local gateway)`,`Fallback target for standalone plugin settings`),refresh:_(`Refresh plugins`,`Reload plugin settings and runtime status`),refreshTitle:_(`Refresh plugin settings and status from {target}`,`Refresh button title; raw machine label`),unavailableConfig:_(`Plugin settings are unavailable. Choose Refresh plugins to try again before making changes.`,`Missing saved config warning`),unavailableTitle:_(`Running plugin status unavailable`,`Unavailable runtime notice heading`),unavailableRuntime:_(`You can edit saved settings, but PI WEB cannot verify which server plugins are running. {detail}`,`Unavailable runtime notice; raw diagnostic or localized connection guidance`),connectionHelp:_(`Check the machine connection, then choose Refresh plugins.`,`Fallback runtime-unavailable guidance`),incompatibleTitle:_(`Plugin lifecycle version mismatch`,`Incompatible protocol notice heading`),incompatible:_(`{detail} Update and restart both components before loading server-backed browser plugins.`,`Incompatible protocol guidance; diagnostic remains raw`),incompatibleFallback:_(`The web process and session daemon do not support the same plugin lifecycle protocol.`,`Fallback incompatible protocol diagnostic`),safeTitle:_(`Server-plugin safe mode active`,`Active safe-start notice heading`),safeBundled:_(`Only bundled server plugins were imported. Clear safe mode with <code>{command}</code>.`,`Bundled-only mode guidance; code wraps the unchanged recovery command`),safeNone:_(`No server plugins were loaded. Terminal is unavailable; use the folder workspace to investigate. Clear safe mode with <code>{command}</code>.`,`No-server-plugins mode guidance; code wraps the unchanged recovery command`),pendingTitle:_(`Safe-mode restart pending`,`Saved safe-start mode differs from running mode`),pendingOff:_(`Safe mode is turned off in saved settings, but remains active until the session daemon restarts.`,`Saved safe mode disabled but still active`),pendingSafe:_(`Saved settings request {mode} safe mode. It takes effect on the next session daemon restart.`,`Pending safe mode; mode is the raw config identifier`),restartTitle:_(`Saved changes aren’t active yet`,`Restart-required notice heading`),restart:_(`Restart the session daemon on {target} to apply server-plugin settings or package updates. Restarting interrupts active sessions.`,`Restart consequence; raw machine target`),conflictTitle:_(`Plugin id conflict`,`Discovery conflict heading`),diagnosticTitle:_(`Plugin discovery diagnostic`,`Discovery warning heading`),diagnostic:_(`{snapshot, select, active {Running plugins} other {Available plugins}}: {detail}`,`Diagnostic source; detail is unchanged backend prose`),trusted:_(`<strong>Trusted code warning:</strong> PI WEB plugins and Pi packages can run with your user permissions. Enable plugins only from sources you trust.`,`Security notice with safe emphasis`),savedRestart:_(`{saved} Restart the session daemon to apply server-plugin changes. Restarting interrupts active sessions. Reload this browser tab to apply browser-only changes.`,`Parent-owned saved feedback plus restart/reload guidance`),savedBrowser:_(`{saved} Reload this browser tab to apply browser-only plugin changes.`,`Parent-owned saved feedback plus browser reload guidance`),loading:_(`Loading PI WEB plugins…`,`Plugin discovery loading state`),unavailableList:_(`PI WEB plugin list unavailable for {target}. Choose Refresh plugins to try again.`,`Missing plugin response; raw target`),empty:_(`No PI WEB plugins are discovered or active on {target}.`,`Empty plugin list; raw target`),automatic:_(`Changes save automatically on {target}. Toggles show saved settings, not whether a plugin is running. Reload this browser tab for browser-only changes; server-plugin changes require a session daemon restart.`,`Saved versus runtime state guidance; raw target`),requiredState:_(`Required · cannot be disabled here`,`Required plugin saved state`),missingState:_(`Package no longer available in saved settings`,`Runtime-only plugin absent from saved packages`),disabledState:_(`Saved: disabled`,`Explicit saved disabled state`),enabledState:_(`Saved: enabled`,`Explicit saved enabled state`),defaultState:_(`Using package default`,`Saved state inherits the package default, which can be enabled or disabled`),configOnly:_(`Saved settings only · package not found`,`Config-only plugin provenance`),provenance:_(`{source} · {scope, select, bundled {bundled} local {local} user {user} other {project}}{machine, select, yes { · machine-specific} other {}}{required, select, yes { · required} other {}}{discovered, select, yes {} other { · running version only}}`,`Complete plugin provenance; source is a raw package specifier, scope is a settings location`),healthDetail:_(`Health: {detail}`,`Raw health diagnostic`),offlineDisable:_(`Offline disable: <code>{command}</code>`,`Offline disable command, safely rendered unchanged`),requiredAria:_(`{id} is required`,`Required plugin checkbox name; raw id`),enableAria:_(`Enable {id}`,`Plugin checkbox name; raw id`),required:_(`Required`,`Required plugin toggle label`),enable:_(`Enable plugin`,`Plugin enable checkbox label`),statesAria:_(`{id} plugin states`,`Plugin state group accessible name`),configuredOnly:_(`Configured only`,`Config-only status badge`),browserOnly:_(`Browser only`,`Plugin without server component status badge`),serverState:_(`{state, select, active {Active} failed {Failed} incompatible {Incompatible} disabled {Disabled} missing {Not active} other {Active state unavailable}}`,`Server lifecycle state badge`),conflict:_(`Conflict`,`Plugin conflict badge`),updatePending:_(`Package update pending`,`Server package differs from saved version`),restartRequired:_(`Restart required`,`Server plugin restart badge`),health:_(`{status, select, healthy {Health healthy} degraded {Health degraded} other {Health unhealthy}}`,`Complete health status badge`),recoveryAria:_(`Offline server-plugin recovery commands`,`Recovery command section accessible name`),recoveryTitle:_(`Offline recovery on {target}`,`Recovery section heading; raw target`),recoveryHelp:_(`Run these commands in a terminal on {target}. They edit settings without connecting to the session daemon or loading plugins. They never include machine credentials.`,`Offline recovery scope; raw target`),recoveryRestart:_(`Commands with <code>--restart</code> restart services and interrupt active sessions.`,`Recovery warning; flag is literal source code`),showSafe:_(`Check safe mode`,`Show safe mode recovery command label`),bundledOnly:_(`Start with bundled server plugins only`,`Bundled-only recovery command label`),noServer:_(`Start without server plugins (including Terminal)`,`No-server-plugins recovery command label`),clearSafe:_(`Clear safe mode and start normally`,`Clear safe mode recovery command label`)},W=x.registerMessages(`core.settingsPlugins`,un),dn=e=>w`<strong>${e}</strong>`,fn=e=>w`<code dir="ltr">${e}</code>`,G=class extends T{constructor(){super(),this.loading=!1,this.saving=!1,this.recoveryCommandsSupported=!1,this.error=``,this.savedMessage=``,this.targetLabel=``,new y(this),n.createController(this)}get target(){return this.targetLabel||W.t(`localTarget`)}render(){let e=pn(this.pluginsResponse,this.configResponse),t=this.pluginsResponse!==void 0;return w`
|
|
702
|
-
<settings-panel-frame
|
|
703
|
-
.heading=${W.t(`heading`)}
|
|
704
|
-
.description=${w`${W.rich(`description`,{target:this.target,strong:dn})}`}
|
|
705
|
-
.actionLabel=${W.t(`refresh`)}
|
|
706
|
-
.actionTitle=${W.t(`refreshTitle`,{target:this.target})}
|
|
707
|
-
.actionDisabled=${this.loading}
|
|
708
|
-
.notices=${this.panelNotices(e.length>0)}
|
|
709
|
-
.onAction=${this.onReload}
|
|
710
|
-
>
|
|
711
|
-
${this.renderPanelContent(e,t)}
|
|
712
|
-
</settings-panel-frame>
|
|
713
|
-
`}panelNotices(e){let t=[];this.error!==``&&t.push({type:`error`,content:this.error}),this.shouldShowConfigUnavailableNotice(e)&&t.push({type:`availability`,content:W.t(`unavailableConfig`)}),this.savedMessage!==``&&t.push({type:`success`,content:this.savedNotice()});let n=this.pluginsResponse?.serverRuntime;n?.status===`unavailable`?t.push({type:`availability`,title:W.t(`unavailableTitle`),content:W.t(`unavailableRuntime`,{detail:n.message??W.t(`connectionHelp`)})}):n?.status===`incompatible`&&t.push({type:`error`,title:W.t(`incompatibleTitle`),content:W.t(`incompatible`,{detail:n.message??W.t(`incompatibleFallback`)})}),n?.safeStart!==void 0&&t.push({type:`warning`,title:W.t(`safeTitle`),content:w`${W.rich(n.safeStart===`bundled-only`?`safeBundled`:`safeNone`,{command:n.recovery.clearSafeStart,code:fn})}`}),n?.desiredSafeStart!==void 0&&n.desiredSafeStart!==(n.safeStart??`off`)&&t.push({type:`warning`,title:W.t(`pendingTitle`),content:n.desiredSafeStart===`off`?W.t(`pendingOff`):W.t(`pendingSafe`,{mode:n.desiredSafeStart})}),n?.restartRequired===!0&&t.push({type:`warning`,title:W.t(`restartTitle`),content:W.t(`restart`,{target:this.target})});for(let e of this.pluginsResponse?.diagnostics??[])t.push({type:e.kind===`conflict`?`error`:`warning`,title:W.t(e.kind===`conflict`?`conflictTitle`:`diagnosticTitle`),content:W.t(`diagnostic`,{snapshot:e.snapshot,detail:e.message})});return e&&t.push({type:`security`,content:w`${W.rich(`trusted`,{strong:dn})}`}),t}savedNotice(){return this.pluginsResponse?.serverRuntime.status!==`available`||this.pluginsResponse.serverRuntime.restartRequired?W.t(`savedRestart`,{saved:this.savedMessage}):W.t(`savedBrowser`,{saved:this.savedMessage})}shouldShowConfigUnavailableNotice(e){return e&&this.configResponse===void 0&&!this.loading&&this.error===``}renderPanelContent(e,t){return!t&&e.length===0?w`
|
|
714
|
-
<div class="loading-card ui-settings-summary">${this.loading?W.t(`loading`):W.t(`unavailableList`,{target:this.target})}</div>
|
|
715
|
-
${this.renderRecoveryCommands()}
|
|
716
|
-
`:e.length===0?w`
|
|
717
|
-
<div class="loading-card ui-settings-summary">${W.t(`empty`,{target:this.target})}</div>
|
|
718
|
-
${this.renderRecoveryCommands()}
|
|
719
|
-
`:w`
|
|
720
|
-
<div class="plugin-note ui-settings-summary">${W.t(`automatic`,{target:this.target})}</div>
|
|
721
|
-
<div class="plugin-list ui-settings-list">
|
|
722
|
-
${e.map(e=>this.renderPlugin(e))}
|
|
723
|
-
</div>
|
|
724
|
-
${this.renderRecoveryCommands()}
|
|
725
|
-
`}renderPlugin(e){let t=ut(`plugins`,e.id,`enabled`),n=this.configResponse?.config.plugins?.[e.id],r=e.required===!0?W.t(`requiredState`):!e.discovered&&n===void 0?W.t(`missingState`):W.t(n?.enabled===!1?`disabledState`:n?.enabled===!0?`enabledState`:`defaultState`);return w`
|
|
726
|
-
<article class=${`plugin-card ui-settings-row${e.enabled?``:` disabled`}`}>
|
|
727
|
-
<div class="plugin-main">
|
|
728
|
-
<strong dir="auto">${e.id}</strong>
|
|
729
|
-
<small>${e.configOnly?W.t(`configOnly`):W.t(`provenance`,{source:e.source,scope:e.scope,machine:e.machineSpecific?`yes`:`no`,required:e.required===!0?`yes`:`no`,discovered:e.discovered?`yes`:`no`})}</small>
|
|
730
|
-
<small>${r}</small>
|
|
731
|
-
${P(this.configResponse,t,this.loading||this.saving||!e.editable,this.onResetPlugin?()=>this.onResetPlugin?.(e.id):void 0)}
|
|
732
|
-
${this.renderPluginStatuses(e)}
|
|
733
|
-
${e.server?.message===void 0?C:w`<small class="diagnostic" dir="auto">${e.server.message}</small>`}
|
|
734
|
-
${e.server?.health?.message===void 0?C:w`<small class="diagnostic">${W.t(`healthDetail`,{detail:e.server.health.message})}</small>`}
|
|
735
|
-
${e.server===void 0||e.required===!0?C:w`<small class="command">${W.rich(`offlineDisable`,{command:e.server.disableCommand,code:fn})}</small>`}
|
|
736
|
-
</div>
|
|
737
|
-
<label class="toggle ui-checkbox-field">
|
|
738
|
-
<input type="checkbox" aria-label=${W.t(e.required===!0?`requiredAria`:`enableAria`,{id:e.id})} .checked=${h(e.required===!0||(this.configResponse?.effectiveConfig.plugins?.[e.id]?.enabled??e.enabled))} ?disabled=${this.loading||this.saving||this.configResponse===void 0||!e.editable||N(this.configResponse,t)!==void 0} @change=${t=>{this.togglePlugin(e,t)}}>
|
|
739
|
-
<span>${W.t(e.required===!0?`required`:`enable`)}</span>
|
|
740
|
-
</label>
|
|
741
|
-
</article>
|
|
742
|
-
`}renderPluginStatuses(e){let t=e.server;return w`
|
|
743
|
-
<div class="status-list" aria-label=${W.t(`statesAria`,{id:e.id})}>
|
|
744
|
-
${t===void 0?w`<span class="status neutral">${W.t(e.configOnly?`configuredOnly`:`browserOnly`)}</span>`:w`<span class=${`status ${mn(t.state)}`}>${W.t(`serverState`,{state:t.state})}</span>`}
|
|
745
|
-
${e.conflict?w`<span class="status error">${W.t(`conflict`)}</span>`:C}
|
|
746
|
-
${t?.staleRevision===!0?w`<span class="status warning">${W.t(`updatePending`)}</span>`:C}
|
|
747
|
-
${t?.restartRequired===!0?w`<span class="status warning">${W.t(`restartRequired`)}</span>`:C}
|
|
748
|
-
${t?.health===void 0?C:w`<span class=${`status ${hn(t.health.status)}`}>${W.t(`health`,{status:t.health.status})}</span>`}
|
|
749
|
-
</div>
|
|
750
|
-
`}renderRecoveryCommands(){let e=this.pluginsResponse?.serverRuntime,t=(e?.status===`incompatible`&&!this.recoveryCommandsSupported?void 0:e?.recovery)??(this.recoveryCommandsSupported?he:void 0);return t===void 0?C:w`
|
|
751
|
-
<aside class="recovery ui-settings-summary" aria-label=${W.t(`recoveryAria`)}>
|
|
752
|
-
<strong>${W.t(`recoveryTitle`,{target:this.target})}</strong>
|
|
753
|
-
<small>${W.t(`recoveryHelp`,{target:this.target})}</small>
|
|
754
|
-
<small>${W.rich(`recoveryRestart`,{code:fn})}</small>
|
|
755
|
-
<span>${W.t(`showSafe`)}</span><code dir="ltr">${t.showSafeStart}</code>
|
|
756
|
-
<span>${W.t(`bundledOnly`)}</span><code dir="ltr">${t.bundledOnly}</code>
|
|
757
|
-
<span>${W.t(`noServer`)}</span><code dir="ltr">${t.noServerPlugins}</code>
|
|
758
|
-
<span>${W.t(`clearSafe`)}</span><code dir="ltr">${t.clearSafeStart}</code>
|
|
759
|
-
</aside>
|
|
760
|
-
`}async togglePlugin(e,t){if(!e.editable||e.required===!0||e.id===`pi-web.terminal`)return;let n=t.target instanceof HTMLInputElement?t.target.checked:e.enabled;await this.onTogglePlugin?.(e.id,n)}static{this.styles=[e,g,E,S`
|
|
761
|
-
@layer pi-web-base {
|
|
762
|
-
:host { display: block; overflow-wrap: anywhere; }
|
|
763
|
-
.loading-card, .plugin-note { color: var(--pi-muted); }
|
|
764
|
-
code { color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
765
|
-
.plugin-card { align-items: center; }
|
|
766
|
-
.plugin-card.disabled { opacity: .8; }
|
|
767
|
-
.plugin-main { flex: 1 1 280px; min-width: 0; display: grid; gap: 5px; }
|
|
768
|
-
.plugin-main > strong, .plugin-main > small:not(.command) { overflow-wrap: anywhere; }
|
|
769
|
-
.plugin-main small { color: var(--pi-muted); }
|
|
770
|
-
.diagnostic { color: var(--pi-text) !important; }
|
|
771
|
-
.command { line-height: 1.5; }
|
|
772
|
-
.status-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
|
|
773
|
-
.status { border: 1px solid var(--pi-border-muted); border-radius: 999px; padding: 2px 7px; color: var(--pi-muted); font-size: 11px; line-height: 1.3; }
|
|
774
|
-
.status.success { border-color: var(--pi-success-border); color: var(--pi-success); background: var(--pi-success-surface); }
|
|
775
|
-
.status.warning { border-color: var(--pi-warning-border); color: var(--pi-text); background: var(--pi-warning-surface); }
|
|
776
|
-
.status.error { border-color: var(--pi-danger); color: var(--pi-danger); }
|
|
777
|
-
.toggle { min-width: 0; }
|
|
778
|
-
.recovery small { color: var(--pi-muted); line-height: 1.4; }
|
|
779
|
-
.recovery code { display: block; width: fit-content; max-width: 100%; }
|
|
780
|
-
|
|
781
|
-
@media (max-width: 760px) {
|
|
782
|
-
.plugin-main { flex-basis: 100%; }
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
`]}};c([m({attribute:!1})],G.prototype,`pluginsResponse`,void 0),c([m({attribute:!1})],G.prototype,`configResponse`,void 0),c([m({type:Boolean})],G.prototype,`loading`,void 0),c([m({type:Boolean})],G.prototype,`saving`,void 0),c([m({type:Boolean})],G.prototype,`recoveryCommandsSupported`,void 0),c([m()],G.prototype,`error`,void 0),c([m()],G.prototype,`savedMessage`,void 0),c([m()],G.prototype,`targetLabel`,void 0),c([m({attribute:!1})],G.prototype,`onReload`,void 0),c([m({attribute:!1})],G.prototype,`onResetPlugin`,void 0),c([m({attribute:!1})],G.prototype,`onTogglePlugin`,void 0),G=c([l(`settings-plugins-panel`)],G);function pn(e,t){let n=t?.config.plugins??{},r=(e?.plugins??[]).map(e=>{let t=n[e.id],r=e.required===!0?!0:t?.enabled??e.enabled;return{...e,enabled:r,configOnly:!1,editable:e.required!==!0&&(e.discovered||t!==void 0)}}),i=new Set(r.map(({id:e})=>e));for(let[e,t]of Object.entries(n)){if(i.has(e))continue;let n=e===Se;r.push({id:e,...n?{required:!0}:{},source:`config`,scope:`local`,machineSpecific:!1,enabled:n||t.enabled!==!1,discovered:!1,conflict:!1,configOnly:!0,editable:!n})}return r.sort((e,t)=>e.id.localeCompare(t.id))}function mn(e){switch(e){case`active`:return`success`;case`disabled`:case`missing`:return`warning`;case`failed`:case`incompatible`:return`error`;case`unknown`:return`neutral`}}function hn(e){switch(e){case`healthy`:return`success`;case`degraded`:return`warning`;case`unhealthy`:return`error`}}var gn={capture:!0};function _n(){return[{value:`auto`,label:b(`ui.settingsShortcutsPanel.autoDefault`,`Auto/default`),description:b(`ui.settingsShortcutsPanel.enterSendsOnDesktopEnterInsertsANewline`,`Enter sends on wide screens; Enter inserts a newline when the viewport is at most 760px wide.`)},{value:`send`,label:b(`ui.settingsShortcutsPanel.enterSendsMessages`,`Enter sends messages`),description:b(`ui.settingsShortcutsPanel.enterSendsChatMessagesShiftEnterInsertsA`,`Enter sends chat messages; Shift+Enter inserts a newline when supported.`)},{value:`newline`,label:b(`ui.settingsShortcutsPanel.enterInsertsNewline`,`Enter inserts newline`),description:b(`ui.settingsShortcutsPanel.enterInsertsANewlineShiftEnterSendsChat`,`Enter inserts a newline; Shift+Enter sends chat messages when supported.`)}]}function vn(){return w`${O.rich(`description`,{code:e=>w`<code dir="ltr">${e}</code>`})}`}var K=class extends T{constructor(){super(),this.actions=[],this.loading=!1,this.saving=!1,this.error=``,this.savedMessage=``,this.drafts={},this.promptEnterPreference=ue(),this.pendingSaves=new Map,this.localizationPending=!1,this.recordingListenerActive=!1,this.onRecordKeyDown=e=>{let t=this.recording;if(t===void 0)return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){this.stopRecording();return}let n=ee(e);if(n===void 0){this.localError={kind:`invalidKey`};return}if(t.tokens.length>0&&de(t.actionId)){this.localError={kind:`singleChord`};return}let r=[...t.tokens,n];this.localError=void 0,this.drafts={...this.drafts,[t.actionId]:r.join(` `)},this.recording={actionId:t.actionId,tokens:r},de(t.actionId)?this.stopRecording():this.armRecordingTimer()},new y(this,x,()=>{this.localizationPending=!0}),n.createController(this)}willUpdate(e){if(this.localizationPending){this.localizationPending=!1;let e=this.getRootNode(),t=`activeElement`in e&&e.activeElement===this?this.shadowRoot?.activeElement:null;t instanceof HTMLElement&&(this.focusAfterLocalization=t)}if((this.configResponse===void 0||this.loading||this.saving||N(this.configResponse,`/shortcuts`)!==void 0)&&this.stopRecording(),e.has(`configResponse`)&&this.configResponse!==void 0)for(let[e,t]of this.pendingSaves)te(t.action,this.configResponse.config.shortcuts)===t.preference&&(this.drafts[e]===t.draft&&(this.drafts=Object.fromEntries(Object.entries(this.drafts).filter(([t])=>t!==e))),this.pendingSaves.delete(e))}updated(){let e=this.focusAfterLocalization;this.focusAfterLocalization=void 0,e?.isConnected===!0&&this.shadowRoot?.activeElement===null&&e.focus({preventScroll:!0})}disconnectedCallback(){this.focusAfterLocalization=void 0,this.stopRecording(),super.disconnectedCallback()}render(){let e=Sn([...le(void 0,e=>({title:O.t(`composerTitle`,{screen:e?`mobile`:`desktop`}),description:O.t(`composerDescription`)})),...this.actions]),t=this.shortcutResolutions();return w`
|
|
787
|
-
<settings-panel-frame
|
|
788
|
-
heading=${O.t(`heading`)}
|
|
789
|
-
.description=${vn()}
|
|
790
|
-
actionLabel=${O.t(`refresh`)}
|
|
791
|
-
.actionDisabled=${this.loading}
|
|
792
|
-
.notices=${this.panelNotices()}
|
|
793
|
-
.onAction=${this.onReload}
|
|
794
|
-
>
|
|
795
|
-
${this.renderPromptEnterPreferenceCard()}
|
|
796
|
-
${this.configResponse===void 0&&this.loading?w`<div class="loading-card ui-settings-path">${O.t(`loading`)}</div>`:w`
|
|
797
|
-
${this.configResponse===void 0?w`<div class="loading-card ui-settings-path" role="status">${O.t(`unavailable`)}</div>`:null}
|
|
798
|
-
<details class="config-path-card ui-settings-path">
|
|
799
|
-
<summary>${O.t(`details`)}</summary>
|
|
800
|
-
<p>${O.t(`editableHelp`)}</p>
|
|
801
|
-
<p>${O.t(`screenHelp`)}</p>
|
|
802
|
-
<p>${O.t(`priorityHelp`)}</p>
|
|
803
|
-
<span>${O.t(`configFile`)}</span>
|
|
804
|
-
<code dir="ltr">${this.configResponse?.path??O.t(`unknown`)}</code>
|
|
805
|
-
<small>${O.rich(`configHelp`,{code:e=>w`<code dir="ltr">${e}</code>`})}</small>
|
|
806
|
-
</details>
|
|
807
|
-
<section class="shortcut-group ui-settings-section">
|
|
808
|
-
<div class="ui-settings-heading"><h3>${O.t(`sendBehavior`)}</h3></div>
|
|
809
|
-
<label class="shortcut-input-label ui-form-field">
|
|
810
|
-
<span>${O.t(`sendWhileRunning`)}</span>
|
|
811
|
-
<select class="ui-select" aria-label=${O.t(`sendWhileRunning`)} .value=${h(this.configResponse?.effectiveConfig.defaultStreamingBehavior??`steer`)} ?disabled=${this.loading||this.saving||this.configResponse===void 0||N(this.configResponse,`/defaultStreamingBehavior`)!==void 0} @change=${e=>{this.saveSendBehavior(e)}}>
|
|
812
|
-
<option value="steer">${O.t(`steer`)}</option>
|
|
813
|
-
<option value="followUp">${O.t(`followUp`)}</option>
|
|
814
|
-
</select>
|
|
815
|
-
</label>
|
|
816
|
-
<p>${O.t(`sendHelp`)}</p>
|
|
817
|
-
${P(this.configResponse,`/defaultStreamingBehavior`,this.loading||this.saving,this.onReset)}
|
|
818
|
-
</section>
|
|
819
|
-
${P(this.configResponse,`/shortcuts`,this.loading||this.saving,this.onReset)}
|
|
820
|
-
${e.length===0?w`<div class="loading-card ui-settings-path">${O.t(`noActions`)}</div>`:ae(e,e=>e.id,e=>w`
|
|
821
|
-
<section class="shortcut-group ui-settings-section">
|
|
822
|
-
<div class="ui-settings-heading"><h3>${e.name}</h3></div>
|
|
823
|
-
<div class="shortcut-list ui-settings-list">
|
|
824
|
-
${ae(e.actions,e=>e.id,e=>this.renderShortcutRow(e,t.get(e.id)))}
|
|
825
|
-
</div>
|
|
826
|
-
</section>
|
|
827
|
-
`)}
|
|
828
|
-
`}
|
|
829
|
-
</settings-panel-frame>
|
|
830
|
-
`}async saveSendBehavior(e){let t=e.target instanceof HTMLSelectElement?e.target.value:void 0;this.loading||this.saving||this.configResponse===void 0||N(this.configResponse,`/defaultStreamingBehavior`)!==void 0||t!==`steer`&&t!==`followUp`||await this.onSave?.({defaultStreamingBehavior:t})}panelNotices(){let e=[],t=this.localError,n=t?.kind===`parse`?oe(t.input,En):void 0,r=t===void 0?this.error:t.kind===`parse`?n?.ok===!1?n.message:``:t.kind===`save`?O.t(`saveFailure`,{diagnostic:t.diagnostic}):O.t(t.kind);return r!==``&&e.push({type:`error`,content:r}),this.savedMessage!==``&&e.push({type:`success`,content:this.savedMessage}),e}renderPromptEnterPreferenceCard(){return w`
|
|
831
|
-
<section class="prompt-enter-card ui-settings-section" aria-labelledby="prompt-enter-preference-title">
|
|
832
|
-
<div class="prompt-enter-copy ui-settings-heading">
|
|
833
|
-
<span class="card-eyebrow">${b(`ui.settingsShortcutsPanel.chatInput`,`Chat input`)}</span>
|
|
834
|
-
<h3 id="prompt-enter-preference-title">${b(`ui.settingsShortcutsPanel.enterKeyBehavior`,`Enter key behavior`)}</h3>
|
|
835
|
-
<p>${b(`ui.settingsShortcutsPanel.chooseEnterBehaviorInThisBrowserShiftEnter`,`Choose Enter behavior in this browser. Shift+Enter performs the opposite action when supported; touch-keyboard auto-capitalization is ignored to prevent accidental sends.`)}</p>
|
|
836
|
-
</div>
|
|
837
|
-
<div class="prompt-enter-options ui-settings-fields" role="radiogroup" aria-label="${b(`ui.settingsShortcutsPanel.enterAndShiftEnterBehaviorInChatInput`,`Enter and Shift Enter behavior in chat input`)}">
|
|
838
|
-
${_n().map(e=>w`
|
|
839
|
-
<label class="prompt-enter-option ui-checkbox-field">
|
|
840
|
-
<input
|
|
841
|
-
type="radio"
|
|
842
|
-
name="prompt-enter-preference"
|
|
843
|
-
.value=${e.value}
|
|
844
|
-
.checked=${this.promptEnterPreference===e.value}
|
|
845
|
-
@change=${()=>{this.updatePromptEnterPreference(e.value)}}
|
|
846
|
-
>
|
|
847
|
-
<span class="ui-form-field">
|
|
848
|
-
<strong>${e.label}</strong>
|
|
849
|
-
<small>${e.description}</small>
|
|
850
|
-
</span>
|
|
851
|
-
</label>
|
|
852
|
-
`)}
|
|
853
|
-
</div>
|
|
854
|
-
</section>
|
|
855
|
-
`}updatePromptEnterPreference(e){this.promptEnterPreference=e,ne(e)}renderShortcutRow(e,t){let n=this.configResponse?.effectiveConfig.shortcuts,r=te(e,n),i=Tn(e,n),a=this.shortcutInputText(e),o=a.trim()===``?void 0:oe(a),s=o?.ok===!0?o.shortcut:wn(e,n),c=r!==void 0,ee=this.drafts[e.id]!==void 0,l=ee&&a.trim()!==``?`custom`:i,u=this.recordingHint(e.id),d=xn(t),f=this.loading||this.saving||this.configResponse===void 0||N(this.configResponse,`/shortcuts`)!==void 0;return w`
|
|
856
|
-
<article class=${`ui-settings-row ${yn(t)}`}>
|
|
857
|
-
<div class="shortcut-main">
|
|
858
|
-
<strong dir="auto">${e.title}</strong>
|
|
859
|
-
${e.description!==void 0&&e.description!==``?w`<small dir="auto">${e.description}</small>`:null}
|
|
860
|
-
<small class="shortcut-id" dir="ltr">${e.id}</small>
|
|
861
|
-
<small>${e.shortcut!==void 0&&e.shortcut!==``?O.rich(`defaultShortcut`,{shortcut:se(e.shortcut),key:e=>w`<kbd dir="ltr">${e}</kbd>`}):O.t(`noDefaultShortcut`)}</small>
|
|
862
|
-
</div>
|
|
863
|
-
<div class="shortcut-editor">
|
|
864
|
-
<div class="shortcut-status">
|
|
865
|
-
${s!==void 0&&s!==``?w`<kbd dir="ltr">${se(s)}</kbd>`:w`<span class="unassigned">${O.t(i===`disabled`?`disabled`:`unassigned`)}</span>`}
|
|
866
|
-
<small class=${l}>${O.t(`state`,{state:l,unsaved:ee?`yes`:`no`})}</small>
|
|
867
|
-
${d===void 0?null:w`<small class=${bn(t)}>${d}</small>`}
|
|
868
|
-
</div>
|
|
869
|
-
<label class="shortcut-input-label ui-form-field">
|
|
870
|
-
<span>${O.t(`shortcut`)}</span>
|
|
871
|
-
<input
|
|
872
|
-
class="shortcut-input ui-input"
|
|
873
|
-
dir="ltr"
|
|
874
|
-
data-action-id=${e.id}
|
|
875
|
-
aria-label=${O.t(`shortcutFor`,{title:e.title})}
|
|
876
|
-
aria-describedby=${u===``?C:`recording-${e.id}`}
|
|
877
|
-
.value=${a}
|
|
878
|
-
placeholder=${e.shortcut??`mod+k`}
|
|
879
|
-
autocomplete="off"
|
|
880
|
-
autocapitalize="off"
|
|
881
|
-
spellcheck="false"
|
|
882
|
-
?disabled=${f}
|
|
883
|
-
@input=${t=>{this.updateDraft(e.id,Dn(t))}}
|
|
884
|
-
>
|
|
885
|
-
</label>
|
|
886
|
-
${u===``?null:w`<small class="recording-hint" id=${`recording-${e.id}`} role="status">${u}</small>`}
|
|
887
|
-
<div class="shortcut-actions ui-settings-actions">
|
|
888
|
-
<button class="primary ui-button ui-button--action ui-button--primary" aria-label=${O.t(`saveFor`,{title:e.title})} ?disabled=${f||!ee||a.trim()===``} @click=${()=>{this.saveShortcut(e)}}>${O.t(`save`)}</button>
|
|
889
|
-
<button class="ui-button ui-button--action" aria-label=${O.t(`recordFor`,{title:e.title,recording:this.recording?.actionId===e.id?`yes`:`no`})} ?disabled=${f} @click=${()=>{this.toggleRecording(e.id)}}>${O.t(this.recording?.actionId===e.id?`cancelRecording`:`record`)}</button>
|
|
890
|
-
<button class="ui-button ui-button--action" aria-label=${O.t(`disableFor`,{title:e.title})} ?disabled=${f||r===null} @click=${()=>{this.setShortcutNone(e)}}>${O.t(`disable`)}</button>
|
|
891
|
-
<button class="ui-button ui-button--action" aria-label=${O.t(`restoreFor`,{title:e.title})} ?disabled=${f||!c} @click=${()=>{this.resetShortcut(e)}}>${O.t(`restore`)}</button>
|
|
892
|
-
</div>
|
|
893
|
-
</div>
|
|
894
|
-
</article>
|
|
895
|
-
`}shortcutInputText(e){let t=this.drafts[e.id];if(t!==void 0&&N(this.configResponse,`/shortcuts`)===void 0)return t;let n=te(e,this.configResponse?.effectiveConfig.shortcuts);return n===null?``:n??e.shortcut??``}recordingHint(e){let t=this.recording;return t?.actionId===e?t.tokens.length===0?O.t(`recording`):O.t(`recordingSequence`,{shortcut:se(t.tokens.join(` `))}):``}updateDraft(e,t){this.drafts={...this.drafts,[e]:t},this.localError=void 0}async saveShortcut(e){this.stopRecording();let t=this.shortcutInputText(e).trim(),n=oe(t);n.ok?de(e.id)&&n.tokens.length!==1?this.localError={kind:`singleChord`}:(this.localError=void 0,await this.saveShortcutPreference(e,n.shortcut)):this.localError={kind:`parse`,input:t}}async setShortcutNone(e){this.stopRecording(),this.localError=void 0,await this.saveShortcutPreference(e,null)}async resetShortcut(e){this.stopRecording(),this.localError=void 0,await this.saveShortcutPreference(e,void 0)}async saveShortcutPreference(e,t){if(this.configResponse===void 0||this.onSave===void 0||N(this.configResponse,`/shortcuts`)!==void 0)return;let n=this.configResponse.effectiveConfig.shortcuts===void 0?{}:{shortcuts:this.configResponse.effectiveConfig.shortcuts},r=Cn(n.shortcuts??{},[e.id,...e.shortcutAliases??[]]);t!==void 0&&(r[e.id]=t),n.shortcuts=Object.keys(r).length===0?{}:r;let i={action:e,preference:t,draft:this.drafts[e.id]};this.pendingSaves.set(e.id,i);try{await this.onSave(n),this.requestUpdate()}catch(t){this.pendingSaves.get(e.id)===i&&this.pendingSaves.delete(e.id),this.localError={kind:`save`,diagnostic:t instanceof Error?t.message:String(t)}}}shortcutResolutions(){let e=this.previewShortcutConfig(),t=[...d(this.actions.filter(e=>!de(e.id)),e,{enabledOnly:!0}),...le().flatMap(t=>d([t],e))];return new Map(t.map(e=>[e.action.id,e]))}previewShortcutConfig(){let e={...this.configResponse?.effectiveConfig.shortcuts??{}};for(let[t,n]of Object.entries(N(this.configResponse,`/shortcuts`)===void 0?this.drafts:{})){let r=n.trim();if(r===``)continue;let i=oe(r);i.ok&&(e[t]=i.shortcut)}return Object.keys(e).length===0?void 0:e}async toggleRecording(e){this.recording?.actionId===e?this.stopRecording():(this.stopRecording(),this.localError=void 0,this.recording={actionId:e,tokens:[]},this.ensureRecordingListener(),await this.updateComplete,this.focusShortcutInput(e))}focusShortcutInput(e){for(let t of this.renderRoot.querySelectorAll(`.shortcut-input`))if(t.dataset.actionId===e){t.focus(),t.select();return}}armRecordingTimer(){this.clearRecordingTimer(),this.recordingTimer=window.setTimeout(()=>{this.recordingTimer=void 0,this.stopRecording()},f)}stopRecording(){this.clearRecordingTimer(),this.removeRecordingListener(),this.recording=void 0}clearRecordingTimer(){this.recordingTimer!==void 0&&(window.clearTimeout(this.recordingTimer),this.recordingTimer=void 0)}ensureRecordingListener(){this.recordingListenerActive||=(window.addEventListener(`keydown`,this.onRecordKeyDown,gn),!0)}removeRecordingListener(){this.recordingListenerActive&&=(window.removeEventListener(`keydown`,this.onRecordKeyDown,gn),!1)}static{this.styles=[e,g,E,S`
|
|
896
|
-
@layer pi-web-base {
|
|
897
|
-
:host { display: block; }
|
|
898
|
-
h3, p { margin: 0; }
|
|
899
|
-
p { color: var(--pi-muted); line-height: 1.45; }
|
|
900
|
-
.config-path-card span { color: var(--pi-muted); font-size: 12px; font-weight: 600; }
|
|
901
|
-
code { border: 1px solid var(--pi-border-muted); border-radius: 5px; background: var(--pi-bg); padding: 1px 4px; color: var(--pi-text); font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); overflow-wrap: anywhere; }
|
|
902
|
-
.shortcut-group { margin: 0; }
|
|
903
|
-
.shortcut-group:has(.shortcut-list) { padding: 0; gap: 0; }
|
|
904
|
-
.shortcut-group:has(.shortcut-list) > .ui-settings-heading { padding: 16px; background: var(--pi-surface); }
|
|
905
|
-
.shortcut-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 48%); align-items: start; }
|
|
906
|
-
.shortcut-row.shadowed { background: color-mix(in srgb, var(--pi-warning) 5%, var(--pi-surface)); }
|
|
907
|
-
.shortcut-row.shadowing { background: color-mix(in srgb, var(--pi-accent) 5%, var(--pi-surface)); }
|
|
908
|
-
.shortcut-row:last-child { border-bottom: 0; }
|
|
909
|
-
.shortcut-main { min-width: 0; display: grid; gap: 4px; }
|
|
910
|
-
.shortcut-main strong, .shortcut-main small { overflow-wrap: anywhere; }
|
|
911
|
-
.shortcut-main small { color: var(--pi-muted); }
|
|
912
|
-
.shortcut-id { font-family: var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); }
|
|
913
|
-
.shortcut-editor { min-width: 0; display: grid; gap: 8px; }
|
|
914
|
-
.shortcut-status { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
|
|
915
|
-
.shortcut-status small { color: var(--pi-muted); font-size: 11px; }
|
|
916
|
-
.shortcut-status small.custom { color: var(--pi-accent); }
|
|
917
|
-
.shortcut-status small.disabled { color: var(--pi-warning); }
|
|
918
|
-
.shortcut-status small.conflict.shadowing { color: var(--pi-accent); }
|
|
919
|
-
.shortcut-status small.conflict.shadowed { color: var(--pi-warning); }
|
|
920
|
-
.shortcut-input { --ui-input-font-family: var(--pi-control-monospace-font-family, var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)); }
|
|
921
|
-
kbd { border: 1px solid var(--pi-border); border-radius: 6px; background: var(--pi-bg); color: var(--pi-text-secondary); padding: 3px 7px; font: 12px var(--pi-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); white-space: nowrap; }
|
|
922
|
-
.unassigned { color: var(--pi-muted); font-size: 12px; }
|
|
923
|
-
.recording-hint { color: var(--pi-accent); font-size: 12px; }
|
|
924
|
-
|
|
925
|
-
@media (max-width: 760px) {
|
|
926
|
-
.shortcut-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
927
|
-
.shortcut-status, .shortcut-actions { justify-content: flex-start; }
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
}
|
|
931
|
-
`]}};c([m({attribute:!1})],K.prototype,`actions`,void 0),c([m({attribute:!1})],K.prototype,`configResponse`,void 0),c([m({type:Boolean})],K.prototype,`loading`,void 0),c([m({type:Boolean})],K.prototype,`saving`,void 0),c([m()],K.prototype,`error`,void 0),c([m()],K.prototype,`savedMessage`,void 0),c([m({attribute:!1})],K.prototype,`onReload`,void 0),c([m({attribute:!1})],K.prototype,`onReset`,void 0),c([m({attribute:!1})],K.prototype,`onSave`,void 0),c([p()],K.prototype,`drafts`,void 0),c([p()],K.prototype,`localError`,void 0),c([p()],K.prototype,`recording`,void 0),c([p()],K.prototype,`promptEnterPreference`,void 0),K=c([l(`settings-shortcuts-panel`)],K);function yn(e){return e?.active===!1?`shortcut-row shadowed`:e?.active===!0&&e.shadows.length>0?`shortcut-row shadowing`:`shortcut-row`}function bn(e){return e?.active===!1?`conflict shadowed`:`conflict shadowing`}function xn(e){if(e===void 0)return;if(!e.active)return O.t(`inactive`,{title:e.shadowedBy?.action.title??O.t(`anotherAction`)});let t=e.shadows.length;if(t!==0)return O.t(`conflict`,{count:t,names:x.list(e.shadows.slice(0,2).map(e=>e.action.title)),more:Math.max(0,t-2)})}function Sn(e){let t=new Map;for(let n of e){let e=de(n.id),r=e?`composer`:JSON.stringify([n.group??null]),i=t.get(r)??{id:r,name:e?O.t(`composerGroup`):n.group??O.t(`otherGroup`),actions:[]};i.actions.push(n),t.set(r,i)}return[...t.values()].sort((e,t)=>e.name.localeCompare(t.name,x.language)).map(e=>({...e,actions:e.actions.sort((e,t)=>e.title.localeCompare(t.title,x.language))}))}function Cn(e,t){let n=new Set(t);return Object.fromEntries(Object.entries(e).filter(([e])=>!n.has(e)))}function wn(e,t){let n=te(e,t);if(n!==null)return n??e.shortcut}function Tn(e,t){let n=te(e,t);return n===null?`disabled`:n===void 0?e.shortcut===void 0||e.shortcut===``?`unassigned`:`default`:`custom`}function En(e){return`value`in e?O.t(e.kind,{value:e.value}):O.t(e.kind)}function Dn(e){return e.target instanceof HTMLInputElement?e.target.value:``}async function On(e){let[t,n]=await Promise.allSettled([e.loadConfig(),e.loadPlugins()]),r={error:``},i=[];if(t.status===`fulfilled`)r.config=t.value;else{let e=An(t.reason);r.failure={config:e},i.push(`config: ${e}`)}if(n.status===`fulfilled`)r.plugins=n.value;else{let e=An(n.reason);r.failure={...r.failure,plugins:e},i.push(`PI WEB plugins: ${e}`)}return i.length>0&&(r.error=b(`ui.settingsDataLoading.failedToLoadSettings`,`Failed to load settings: {join}`,{join:i.join(`;`)})),r}async function kn(e,t,n){if(Yt(n))return{error:n.message??b(`ui.settingsDataLoading.doesNotSupportPiPackageManagement`,`{piPackageTargetLabeltarget} does not support Pi package management.`,{piPackageTargetLabeltarget:Kt(e)}),skipped:!0};try{return{packagesResponse:await t(e.id),error:``}}catch(t){let n=An(t);return{failure:n,error:`Failed to load Pi packages from ${Kt(e)}: ${an(n,e)}`}}}function An(e){return e instanceof Error?e.message:String(e)}function jn(e,t){return mt(e,t,[`installationName`,`basePaths`,`pathAccess`,`uploads`,`attachments`,`maxUploadBytes`])}function Mn(e,t){return e.kind===`local`?{state:`supported`}:t?.ok===!0?me(t,_e.pluginLifecycle)?{state:`supported`}:{state:`unsupported`,message:Rn(e)}:{state:`unknown`}}function Nn(e){return e===void 0?{id:`local`,name:b(`ui.settingsMachineTarget.local`,`Local`),kind:`local`}:{id:e.id,name:e.name,kind:e.kind}}function q(e){return e.kind===`local`?b(`ui.settingsMachineTarget.localGateway`,`{name} (local gateway)`,{name:e.name}):b(`ui.settingsMachineTarget.remoteMachine`,`{name} (remote machine)`,{name:e.name})}function Pn(e,t){return e.kind===`local`||t?.ok===!0?{state:`supported`}:{state:`unknown`}}function Fn(e,t){return e.kind===`local`||t?.ok===!0?{state:`supported`}:{state:`unknown`,message:b(`ui.settingsMachineTarget.unableToConfirmWhetherSupportsPiCompatibleAgent`,`Unable to confirm whether {name} supports Pi-compatible agent profiles. Reload machine status before changing the profile.`,{name:e.name})}}function In(e){return`${e.state}:${e.message??``}`}function J(e){return e?.state===`unsupported`}function Ln(e){return e?.state===`supported`}function Rn(e){return b(`ui.main.a5ae99c3f3cd`,`{arg0} does not support plugin lifecycle diagnostics. Update and restart PI WEB on that machine before loading server-dependent plugins.`,{arg0:e.name})}function zn(e,t){return mt(e,t,[`plugins`])}var Bn={label:_(`PI WEB settings`,`Settings modal accessible name`),heading:_(`Settings`,`Settings dialog title`),close:_(`Close settings`,`Settings close button`),sections:_(`Settings sections`,`Settings navigation accessible name`),general:_(`General`,`General settings tab`),generalDetail:_(`Appearance, gateway, and machine`,`General tab scope`),sessiond:_(`Session daemon`,`Session daemon tab`),selectedMachine:_(`Selected machine`,`Selected machine tab scope`),packages:_(`Pi packages`,`Packages tab`),plugins:_(`PI WEB plugins`,`Plugins tab`),mcp:_(`MCP`,`MCP tab`),selectedSession:_(`Selected session`,`MCP tab scope`),shortcuts:_(`Keyboard shortcuts`,`Keyboard tab`),gateway:_(`This gateway`,`Keyboard tab scope`),connected:_(`Connected`,`Machine connection status`),unchecked:_(`Connection not checked`,`Unknown machine connection status`),unavailable:_(`Unavailable`,`Machine unavailable status`),configure:_(`Configure machine`,`Machine selector label`),machineOption:_(`{name}{kind, select, local { (this gateway)} other {}}`,`Machine selector option; name is raw`),scopeHeading:_(`What changes?`,`Machine scope disclosure`),scopeHelp:_(`Agent permissions, packages, plugins, file access, and upload settings apply to this machine. Gateway settings, the default theme, and keyboard shortcuts stay on this server. Your browser theme, workspace, and session stay unchanged.`,`Machine selector scope guidance`),machineUnavailable:_(`This machine is unavailable.`,`Machine unavailable fallback`),connectionHelp:_(`Check the machine connection, then refresh settings.`,`Machine connection recovery`),unsaved:_(`Unsaved machine settings`,`Machine switch confirmation accessible name`),switchPrompt:_(`You have unsaved file access or upload settings for {current}. Discard them and configure {next}?`,`Unsaved edits confirmation; machine names are raw`),discard:_(`Discard edits and switch`,`Discard machine edits`),keepEditing:_(`Keep editing`,`Cancel machine switch`),loadAccess:_(`Failed to load file access/upload config from {target}: {error}`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),loadSessiond:_(`Failed to load session-daemon config from {target}: {error}`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),pluginConfigMissing:_(`Plugin config is not loaded for {target}. Choose Refresh plugins before changing plugin settings.`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),savePlugins:_(`Failed to save PI WEB plugin config on {target}: {error}`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),saveAccess:_(`Failed to save machine config on {target}: {error}`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),saveSessiond:_(`Failed to save session-daemon config on {target}: {error}`,`Settings operation feedback; target is a machine label and error is a raw diagnostic`),configDiagnostic:_(`config: {error}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),pluginsDiagnostic:_(`PI WEB plugins: {error}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),loadGateway:_(`Failed to load settings: {errors}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),loadPackages:_(`Failed to load Pi packages from {target}: {error}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),loadPluginConfigUnsupported:_(`Failed to load PI WEB plugin config from {target}: {error}; {support}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),loadPluginSettings:_(`Failed to load PI WEB plugin settings from {target}: {errors}`,`Settings orchestration feedback; errors are raw diagnostics and targets are machine labels`),pluginsSaved:_(`Plugin settings saved for {name}.`,`Settings save outcome or failure; names and diagnostics are untranslated values`),machineSaved:_(`Machine settings saved for {name}.`,`Settings save outcome or failure; names and diagnostics are untranslated values`),themeSaved:_(`Default theme saved. Saved browser choices are unchanged.`,`Settings save outcome or failure; names and diagnostics are untranslated values`),themeFailure:_(`Couldn't save the default theme: {error}`,`Settings save outcome or failure; names and diagnostics are untranslated values`),quietFailure:_(`Couldn't save quiet mode: {error}`,`Settings save outcome or failure; names and diagnostics are untranslated values`),shortcutsSaved:_(`Keyboard settings saved.`,`Settings save outcome or failure; names and diagnostics are untranslated values`),gatewaySaved:_(`Gateway settings saved. Restart the web service to apply address changes.`,`Settings save outcome or failure; names and diagnostics are untranslated values`),settingsFailure:_(`Couldn't save settings: {error}`,`Settings save outcome or failure; names and diagnostics are untranslated values`),quietSaved:_(`{enabled, select, true {Quiet mode is on. Chat events start collapsed into one expandable “events” line.} other {Quiet mode is off. Chat events expand as you follow the conversation.}}`,`Settings save outcome or failure; names and diagnostics are untranslated values`),sessiondSaved:_(`Session daemon settings saved for {name}. Restart the session daemon to apply agent permission changes. Restarting interrupts active sessions.`,`Settings save outcome and restart consequences; name is an untranslated machine label`),operationRunning:_(`A settings operation is already running.`,`Settings operation feedback; machine label and diagnostic are untranslated values`),packageMutationFailure:_(`Failed to {operation, select, install {install Pi package} remove {remove Pi package} other {update Pi packages}} on {target}: {error}`,`Settings operation feedback; machine label and diagnostic are untranslated values`),refreshGatewayFailure:_(`Failed to refresh gateway PI WEB plugins: {error}`,`Settings operation feedback; machine label and diagnostic are untranslated values`),refreshPluginsFailure:_(`Config saved, but failed to refresh PI WEB plugins from {target}: {error}`,`Settings operation feedback; machine label and diagnostic are untranslated values`)},Vn={target:_(`{kind, select, local {{name} (local gateway)} other {{name} (remote machine)}}`,`Complete settings target label; machine name remains unchanged`),lifecycleUnavailable:_(`Plugin lifecycle diagnostics are not available on {name}. Update and restart PI WEB on that machine before loading server-backed plugins.`,`Unavailable selected-machine plugin lifecycle guidance; raw machine name`),packageFollowUp:_(`{kind, select, local {Pi package {action, select, install {installed} remove {removed} other {updated}}. Type {reload} in each idle PI WEB session to refresh extensions, skills, prompts, and themes. Reload this browser tab for PI WEB browser plugin changes. Server-plugin changes may also need a session daemon restart; restarting interrupts active sessions.} other {Pi package {action, select, install {installed} remove {removed} other {updated}} on {name}. Type {reload} in each idle PI WEB session on {name} to refresh extensions, skills, prompts, and themes. Reload this browser tab for PI WEB browser plugin changes served by {name}. Server-plugin changes may also need a session daemon restart; restarting interrupts active sessions.}}`,`Complete package mutation follow-up by action and target; preserve raw machine name and reload command; restart interrupts active sessions`)},Hn=x.registerMessages(`core.settingsFeedback`,Vn);function Y(e){return Hn.t(`target`,{kind:e.kind,name:e.name})}function Un(e){return Hn.t(`lifecycleUnavailable`,{name:e.name})}function X(e,t){return e.trim()}function Wn(e,t){return e.trim()}function Gn(e,t){return Hn.t(`packageFollowUp`,{action:e,kind:t.kind,name:t.name,reload:`/reload`})}var Z=x.registerMessages(`core.settingsDialog`,Bn),Kn=e=>typeof e==`function`?e():e,Q=class extends T{constructor(){super(),this.section=`general`,this.presentationContext={mode:`normal`},this.actions=[],this.themes=[],this.onThemeCatalogLoaded=()=>void 0,this.themeCatalogLoading=!1,this.themeCatalogError=``,this.themeCatalogRequested=!1,this.fileIconThemes=[],this.themePreference=r,this.activeThemeId=``,this.hasLocalThemeOverride=!1,this.machines=[],this.machineStatuses={},this.machineRuntimes={},this.loading=!0,this.accessLoading=!0,this.sessiondLoading=!0,this.pluginLoading=!0,this.packageLoading=!0,this.saving=!1,this.errorPresentation=``,this.accessErrorPresentation=``,this.sessiondErrorPresentation=``,this.pluginErrorPresentation=``,this.packageErrorPresentation=``,this.savedMessagePresentation=``,this.packageMessagePresentation=``,this.loadRequestSeq=0,this.accessLoadRequestSeq=0,this.sessiondLoadRequestSeq=0,this.pluginLoadRequestSeq=0,this.packageLoadRequestSeq=0,this.packageMutationSeq=0,new y(this),n.createController(this)}get error(){return Kn(this.errorPresentation)}set error(e){this.errorPresentation=e}get accessError(){return Kn(this.accessErrorPresentation)}set accessError(e){this.accessErrorPresentation=e}get sessiondError(){return Kn(this.sessiondErrorPresentation)}set sessiondError(e){this.sessiondErrorPresentation=e}get pluginError(){return Kn(this.pluginErrorPresentation)}set pluginError(e){this.pluginErrorPresentation=e}get packageError(){return Kn(this.packageErrorPresentation)}set packageError(e){this.packageErrorPresentation=e}get savedMessage(){return Kn(this.savedMessagePresentation)}set savedMessage(e){this.savedMessagePresentation=e}get packageMessage(){return Kn(this.packageMessagePresentation)}set packageMessage(e){this.packageMessagePresentation=e}connectedCallback(){super.connectedCallback(),this.loadThemeCatalogForGeneral(),this.loadConfig(),this.loadAccessConfigForTarget(),this.reloadSessiondState(),this.loadPluginsForTarget(),this.loadPackagesForTarget()}disconnectedCallback(){this.savedMessageTimer!==void 0&&window.clearTimeout(this.savedMessageTimer),this.savedMessageTimer=void 0,super.disconnectedCallback()}updated(e){if(e.has(`section`)&&(this.loadThemeCatalogForGeneral(),this.renderRoot.querySelector(`modal-surface`)?.updateComplete.then(()=>{this.isConnected&&this.renderRoot.querySelector(`.settings-nav button.selected`)?.scrollIntoView({block:`nearest`,inline:`nearest`})})),this.isConnected){let e=this.renderRoot.querySelector(`settings-general-panel`);e!==null&&(this.generalPanel=e)}let t=this.settingsTarget();if((e.has(`machine`)||e.has(`machines`))&&Nn(this.selectedSettingsMachine(e.has(`machines`)?e.get(`machines`)??[]:this.machines,e.has(`machine`)?e.get(`machine`):this.machine,this.settingsMachineId)).id!==t.id){this.resetAccessStateForTargetChange(),this.isConnected&&this.loadAccessConfigForTarget(t),this.resetSessiondStateForTargetChange(),this.isConnected&&this.reloadSessiondState(t),this.resetPluginStateForTargetChange(),this.isConnected&&this.loadPluginsForTarget(t),this.resetPackageStateForTargetChange(),this.isConnected&&this.loadPackagesForTarget(t);return}if(!e.has(`machineRuntime`)&&!e.has(`machineRuntimes`))return;let n=this.settingsRuntime(e.has(`machineRuntimes`)?e.get(`machineRuntimes`)??{}:this.machineRuntimes,e.has(`machineRuntime`)?e.get(`machineRuntime`):this.machineRuntime,t),r=In(Mn(t,n))!==In(Mn(t,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,t)));this.selectedMachineSettingsSupportNeedsReload(n,t)&&(this.resetAccessStateForTargetChange(),this.isConnected&&this.loadAccessConfigForTarget(t),this.resetSessiondStateForTargetChange(),this.isConnected&&this.loadSessiondConfigForTarget(t)),r&&(this.resetPluginStateForTargetChange(),this.isConnected&&this.loadPluginsForTarget(t)),this.packageManagementSupportNeedsReload(n,t)&&(this.resetPackageStateForTargetChange(),this.isConnected&&this.loadPackagesForTarget(t))}loadThemeCatalogForGeneral(){this.isConnected&&this.section===`general`&&!this.themeCatalogRequested&&this.loadThemeInventory()}async loadThemeInventory(){if(!this.themeCatalogLoading){this.themeCatalogRequested=!0,this.themeCatalogLoading=!0,this.themeCatalogError=``;try{let e=await o();this.isConnected&&this.onThemeCatalogLoaded(e)}catch(e){this.isConnected&&(this.themeCatalogError=e instanceof Error?e.message:String(e))}finally{this.themeCatalogLoading=!1}}}render(){return w`
|
|
932
|
-
<modal-surface .onClose=${()=>this.onClose?.()} .busy=${this.saving} .label=${Z.t(`label`)}>
|
|
933
|
-
<header class="settings-header ui-dialog-header">
|
|
934
|
-
<h1 class="ui-dialog-title">${Z.t(`heading`)}</h1>
|
|
935
|
-
<button type="button" class="close-button ui-button ui-button--icon" title=${Z.t(`close`)} aria-label=${Z.t(`close`)} @click=${()=>this.onClose?.()}><span class="settings-back-icon" aria-hidden="true">×</span><span class="settings-back-label">${b(`ui.settingsDialog.backToApp`,`Back to app`)}</span></button>
|
|
936
|
-
</header>
|
|
937
|
-
<div class="settings-body">
|
|
938
|
-
<pi-web-ui-presentation region="settings-navigation" .runtime=${this.presentationRuntime} .context=${this.presentationContext}>
|
|
939
|
-
<nav slot="navigation" class="settings-nav" aria-label=${Z.t(`sections`)}>
|
|
940
|
-
${this.renderNavButton(`general`,Z.t(`general`),Z.t(`generalDetail`))}
|
|
941
|
-
${this.renderNavButton(`sessiond`,Z.t(`sessiond`),Z.t(`selectedMachine`))}
|
|
942
|
-
${this.renderNavButton(`packages`,Z.t(`packages`),Z.t(`selectedMachine`))}
|
|
943
|
-
${this.renderNavButton(`plugins`,Z.t(`plugins`),Z.t(`selectedMachine`))}
|
|
944
|
-
${this.renderNavButton(`mcp`,Z.t(`mcp`),Z.t(`selectedSession`))}
|
|
945
|
-
${this.renderNavButton(`shortcuts`,Z.t(`shortcuts`),Z.t(`gateway`))}
|
|
946
|
-
</nav>
|
|
947
|
-
</pi-web-ui-presentation>
|
|
948
|
-
<main class="settings-main">
|
|
949
|
-
${this.renderMachineSelector()}
|
|
950
|
-
${this.renderMachineSwitchConfirmation()}
|
|
951
|
-
<div class="settings-content">${ce(this.renderActiveSection())}</div>
|
|
952
|
-
</main>
|
|
953
|
-
</div>
|
|
954
|
-
</modal-surface>
|
|
955
|
-
`}renderMachineSelector(){if(this.machines.length<=1)return null;let e=this.settingsTarget(),t=this.machineStatuses[e.id],n=this.machines.find(t=>t.id===e.id),r=this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e),i=t?.status??(t===void 0?n?.status??(r===void 0?`unknown`:r.ok?`online`:`offline`):t.ok?`online`:`offline`),a=Z.t(i===`online`?`connected`:i===`unknown`?`unchecked`:`unavailable`),o=i===`offline`||i===`error`,s=o?t?.error??n?.statusMessage??r?.error:void 0;return w`
|
|
956
|
-
<div class="settings-machine">
|
|
957
|
-
<label for="settings-machine">${Z.t(`configure`)}</label>
|
|
958
|
-
<select class="ui-select" id="settings-machine" aria-describedby=${o?`settings-machine-help settings-machine-status settings-machine-error`:`settings-machine-help settings-machine-status`} .value=${h(e.id)} ?disabled=${this.saving} @change=${e=>{e.target instanceof HTMLSelectElement&&this.requestMachineSwitch(e.target.value)}}>
|
|
959
|
-
${this.machines.map(e=>w`<option value=${e.id}>${Z.t(`machineOption`,{name:e.name,kind:e.kind})}</option>`)}
|
|
960
|
-
</select>
|
|
961
|
-
<small id="settings-machine-status" class=${o?`machine-status unavailable`:`machine-status`} role="status">${a}</small>
|
|
962
|
-
<details class="machine-scope">
|
|
963
|
-
<summary>${Z.t(`scopeHeading`)}</summary>
|
|
964
|
-
<p id="settings-machine-help">${Z.t(`scopeHelp`)}</p>
|
|
965
|
-
</details>
|
|
966
|
-
${o?w`<p id="settings-machine-error" class="machine-connection-error" role="status"><span dir="auto">${s??Z.t(`machineUnavailable`)}</span><br>${Z.t(`connectionHelp`)}</p>`:null}
|
|
967
|
-
</div>
|
|
968
|
-
`}requestMachineSwitch(e){!this.saving&&this.machines.some(t=>t.id===e)&&(e===this.settingsTarget().id?this.pendingMachineId=void 0:this.generalPanel?.hasUnsavedMachineChanges===!0?this.pendingMachineId=e:this.switchSettingsMachine(e),this.requestUpdate())}switchSettingsMachine(e){this.settingsMachineId=e,this.pendingMachineId=void 0,this.reloadForTargetChange(this.settingsTarget())}reloadForTargetChange(e){this.resetAccessStateForTargetChange(),this.resetSessiondStateForTargetChange(),this.resetPluginStateForTargetChange(),this.resetPackageStateForTargetChange(),this.isConnected&&(this.loadAccessConfigForTarget(e),this.reloadSessiondState(e),this.loadPluginsForTarget(e),this.loadPackagesForTarget(e))}renderMachineSwitchConfirmation(){let e=this.machines.find(e=>e.id===this.pendingMachineId);return e===void 0?null:w`
|
|
969
|
-
<section class="machine-switch-confirmation" role="alert" aria-label=${Z.t(`unsaved`)}>
|
|
970
|
-
<p>${Z.t(`switchPrompt`,{current:this.settingsTarget().name,next:e.name})}</p>
|
|
971
|
-
<button class="ui-button ui-button--action danger" ?disabled=${this.saving} @click=${()=>{this.generalPanel?.discardMachineChanges(),this.switchSettingsMachine(e.id)}}>${Z.t(`discard`)}</button>
|
|
972
|
-
<button class="ui-button ui-button--action" @click=${()=>{this.pendingMachineId=void 0}}>${Z.t(`keepEditing`)}</button>
|
|
973
|
-
</section>
|
|
974
|
-
`}renderActiveSection(){if(this.section===`mcp`){let e=this.settingsTarget();return w`
|
|
975
|
-
<settings-mcp-panel
|
|
976
|
-
.context=${this.mcpContext?.machineId===e.id?this.mcpContext:void 0}
|
|
977
|
-
.targetLabel=${Y(e)}
|
|
978
|
-
.onMcpAuth=${this.onMcpAuth}
|
|
979
|
-
></settings-mcp-panel>
|
|
980
|
-
`}if(this.section===`sessiond`){let e=this.settingsTarget();return w`
|
|
981
|
-
<settings-sessiond-panel
|
|
982
|
-
.configResponse=${this.sessiondConfigResponse}
|
|
983
|
-
.targetId=${e.id}
|
|
984
|
-
.loading=${this.sessiondLoading}
|
|
985
|
-
.saving=${this.saving}
|
|
986
|
-
.error=${this.sessiondError}
|
|
987
|
-
.savedMessage=${this.savedSection===`sessiond`?this.savedMessage:``}
|
|
988
|
-
.targetLabel=${Y(this.settingsTarget())}
|
|
989
|
-
.activeAgentProfile=${this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e)?.components?.sessiond.activeAgentProfile}
|
|
990
|
-
.agentProfileSupport=${this.agentProfileSettingsSupport(e)}
|
|
991
|
-
.onReload=${()=>this.reloadSessiondState()}
|
|
992
|
-
.onSave=${(t,n)=>this.saveSessiondConfig(t,n,e)}
|
|
993
|
-
.onReset=${t=>this.saveSessiondConfig({},t,e)}
|
|
994
|
-
></settings-sessiond-panel>
|
|
995
|
-
`}return this.section===`shortcuts`?w`
|
|
996
|
-
<settings-shortcuts-panel
|
|
997
|
-
.actions=${this.actions}
|
|
998
|
-
.configResponse=${this.configResponse}
|
|
999
|
-
.loading=${this.loading}
|
|
1000
|
-
.saving=${this.saving}
|
|
1001
|
-
.error=${this.error}
|
|
1002
|
-
.savedMessage=${this.savedSection===`shortcuts`?this.savedMessage:``}
|
|
1003
|
-
.onReload=${()=>this.loadConfig()}
|
|
1004
|
-
.onSave=${e=>this.saveConfig(e)}
|
|
1005
|
-
.onReset=${e=>this.saveConfig({},e)}
|
|
1006
|
-
></settings-shortcuts-panel>
|
|
1007
|
-
`:this.section===`packages`?w`
|
|
1008
|
-
<settings-packages-panel
|
|
1009
|
-
.packagesResponse=${this.packagesResponse}
|
|
1010
|
-
.targetMachine=${this.packageTarget()}
|
|
1011
|
-
.managementSupport=${this.packageManagementSupport()}
|
|
1012
|
-
.loading=${this.packageLoading}
|
|
1013
|
-
.operation=${this.packageOperation}
|
|
1014
|
-
.error=${this.packageError}
|
|
1015
|
-
.operationMessage=${this.packageMessage}
|
|
1016
|
-
.onReload=${()=>this.loadPackagesForTarget()}
|
|
1017
|
-
.onInstallPackage=${e=>this.installPiPackage(e)}
|
|
1018
|
-
.onRemovePackage=${(e,t)=>this.removePiPackage(e,t)}
|
|
1019
|
-
.onUpdatePackage=${e=>this.updatePiPackage(e)}
|
|
1020
|
-
></settings-packages-panel>
|
|
1021
|
-
`:this.section===`plugins`?w`
|
|
1022
|
-
<settings-plugins-panel
|
|
1023
|
-
.configResponse=${this.selectedPluginConfigResponse}
|
|
1024
|
-
.pluginsResponse=${this.selectedPluginsResponse}
|
|
1025
|
-
.loading=${this.pluginLoading}
|
|
1026
|
-
.saving=${this.saving}
|
|
1027
|
-
.recoveryCommandsSupported=${Mn(this.settingsTarget(),this.settingsRuntime(this.machineRuntimes,this.machineRuntime,this.settingsTarget())).state===`supported`}
|
|
1028
|
-
.error=${this.pluginError}
|
|
1029
|
-
.savedMessage=${this.savedSection===`plugins`?this.savedMessage:``}
|
|
1030
|
-
.targetLabel=${Y(this.settingsTarget())}
|
|
1031
|
-
.onReload=${()=>this.loadPluginsForTarget()}
|
|
1032
|
-
.onTogglePlugin=${(e,t)=>this.togglePlugin(e,t)}
|
|
1033
|
-
.onResetPlugin=${e=>this.togglePlugin(e)}
|
|
1034
|
-
></settings-plugins-panel>
|
|
1035
|
-
`:w`
|
|
1036
|
-
<settings-general-panel
|
|
1037
|
-
.configResponse=${this.configResponse}
|
|
1038
|
-
.machineConfigResponse=${this.accessConfigResponse}
|
|
1039
|
-
.loading=${this.loading}
|
|
1040
|
-
.machineLoading=${this.accessLoading}
|
|
1041
|
-
.saving=${this.saving}
|
|
1042
|
-
.error=${this.error}
|
|
1043
|
-
.machineError=${this.accessError}
|
|
1044
|
-
.savedMessage=${this.savedSection===`general`?this.savedMessage:``}
|
|
1045
|
-
.targetLabel=${Y(this.settingsTarget())}
|
|
1046
|
-
.targetId=${this.settingsTarget().id}
|
|
1047
|
-
.onReload=${()=>this.loadConfig()}
|
|
1048
|
-
.onReloadMachine=${()=>this.loadAccessConfigForTarget()}
|
|
1049
|
-
.onSave=${(e,t)=>this.saveConfig(e,t)}
|
|
1050
|
-
.onReset=${e=>this.saveConfig({},e)}
|
|
1051
|
-
.onResetMachine=${e=>this.saveMachineAccessConfig({},e)}
|
|
1052
|
-
.onSetQuietMode=${e=>this.saveQuietMode(e)}
|
|
1053
|
-
.onSaveMachineConfig=${(e,t)=>this.saveMachineAccessConfig(e,t)}
|
|
1054
|
-
>
|
|
1055
|
-
<settings-theme-panel
|
|
1056
|
-
slot="appearance"
|
|
1057
|
-
.themes=${this.themes}
|
|
1058
|
-
.catalogLoading=${this.themeCatalogLoading}
|
|
1059
|
-
.catalogError=${this.themeCatalogError}
|
|
1060
|
-
.onRetryCatalog=${()=>this.loadThemeInventory()}
|
|
1061
|
-
.configResponse=${this.configResponse}
|
|
1062
|
-
.onReset=${e=>this.saveConfig({},e)}
|
|
1063
|
-
.preference=${this.themePreference}
|
|
1064
|
-
.defaultPreference=${i(void 0,this.configResponse?.effectiveConfig.defaultTheme)}
|
|
1065
|
-
.activeThemeId=${this.activeThemeId}
|
|
1066
|
-
.hasLocalOverride=${this.hasLocalThemeOverride}
|
|
1067
|
-
.loading=${this.loading||this.configResponse===void 0}
|
|
1068
|
-
.saving=${this.saving}
|
|
1069
|
-
.onUseLocal=${this.onUseLocalTheme}
|
|
1070
|
-
.onUseDefault=${this.onUseDefaultTheme}
|
|
1071
|
-
.onSetDefault=${e=>this.saveDefaultTheme(e)}
|
|
1072
|
-
></settings-theme-panel>
|
|
1073
|
-
<settings-file-icon-theme-panel
|
|
1074
|
-
slot="appearance"
|
|
1075
|
-
.themes=${this.fileIconThemes}
|
|
1076
|
-
.preference=${this.fileIconPreference}
|
|
1077
|
-
.onSelect=${this.onSelectFileIconTheme}
|
|
1078
|
-
.onReset=${this.onResetFileIconTheme}
|
|
1079
|
-
></settings-file-icon-theme-panel>
|
|
1080
|
-
</settings-general-panel>
|
|
1081
|
-
`}renderNavButton(e,t,n){let r=this.section===e;return w`
|
|
1082
|
-
<button class=${`ui-button ui-selection-option${r?` selected`:``}`} aria-current=${r?`page`:`false`} @click=${()=>{this.navigate(e)}}>
|
|
1083
|
-
<strong>${t}</strong>
|
|
1084
|
-
<small>${n}</small>
|
|
1085
|
-
</button>
|
|
1086
|
-
`}navigate(e){this.onNavigate?.(e)}publishGatewayConfig(e){s(e),ye(e).catch(e=>{console.warn(`Failed to apply gateway localization policy`,e)}),this.onConfigSaved?.(e.effectiveConfig)}async loadConfig(){let e=++this.loadRequestSeq;this.loading=!0,this.error=``;try{let t=await On({loadConfig:()=>v.config(),loadPlugins:()=>ge.plugins()});if(!this.isCurrentLoad(e))return;t.config!==void 0&&(this.configResponse=t.config,this.publishGatewayConfig(t.config)),t.plugins!==void 0&&(this.pluginsResponse=t.plugins);let n=t.failure;this.error=n===void 0?``:()=>Z.t(`loadGateway`,{errors:x.list([...n.config===void 0?[]:[Z.t(`configDiagnostic`,{error:n.config})],...n.plugins===void 0?[]:[Z.t(`pluginsDiagnostic`,{error:n.plugins})]])})}finally{this.isCurrentLoad(e)&&(this.loading=!1)}}async loadAccessConfigForTarget(e=this.settingsTarget()){let t=++this.accessLoadRequestSeq,n=this.selectedMachineSettingsSupport(e);if(J(n))this.accessConfigResponse=void 0,this.accessLoading=!1,this.accessError=n.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(e)});else{this.accessLoading=!0,this.accessError=``;try{let n=await v.config(e.id);if(!this.isCurrentAccessLoad(t,e))return;this.accessConfigResponse=n}catch(n){if(this.isCurrentAccessLoad(t,e)){let t=$(n);this.accessError=()=>Z.t(`loadAccess`,{target:Y(e),error:X(t,e)})}}finally{this.isCurrentAccessLoad(t,e)&&(this.accessLoading=!1)}}}async reloadSessiondState(e=this.settingsTarget()){await Promise.all([this.loadSessiondConfigForTarget(e),this.onRefreshMachineRuntime?.(e.id)])}async loadSessiondConfigForTarget(e=this.settingsTarget()){let t=++this.sessiondLoadRequestSeq,n=this.selectedMachineSettingsSupport(e);if(J(n))this.sessiondConfigResponse=void 0,this.sessiondLoading=!1,this.sessiondError=n.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(e)});else{this.sessiondLoading=!0,this.sessiondError=``;try{let n=await v.config(e.id);if(!this.isCurrentSessiondLoad(t,e))return;this.sessiondConfigResponse=n}catch(n){if(this.isCurrentSessiondLoad(t,e)){let t=$(n);this.sessiondError=()=>Z.t(`loadSessiond`,{target:Y(e),error:X(t,e)})}}finally{this.isCurrentSessiondLoad(t,e)&&(this.sessiondLoading=!1)}}}async loadPluginsForTarget(e=this.settingsTarget()){let t=++this.pluginLoadRequestSeq,n=this.selectedMachineSettingsSupport(e);if(J(n))this.selectedPluginConfigResponse=void 0,this.selectedPluginsResponse=void 0,this.pluginLoading=!1,this.pluginError=n.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(e)});else{this.pluginLoading=!0,this.pluginError=``;try{if(J(Mn(e,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e)))){try{let n=await v.config(e.id);if(!this.isCurrentPluginLoad(t,e))return;this.selectedPluginConfigResponse=n,this.selectedPluginsResponse=void 0,this.pluginError=()=>Un(e)}catch(n){if(!this.isCurrentPluginLoad(t,e))return;let r=$(n);this.pluginError=()=>Z.t(`loadPluginConfigUnsupported`,{target:Y(e),error:X(r,e),support:Un(e)})}return}let[n,r]=await Promise.allSettled([v.config(e.id),ge.plugins(e.id)]);if(!this.isCurrentPluginLoad(t,e))return;let i=[];n.status===`fulfilled`?this.selectedPluginConfigResponse=n.value:i.push(()=>Z.t(`configDiagnostic`,{error:X($(n.reason),e)})),r.status===`fulfilled`?this.selectedPluginsResponse=r.value:i.push(()=>Z.t(`pluginsDiagnostic`,{error:X($(r.reason),e)})),this.pluginError=i.length===0?``:()=>Z.t(`loadPluginSettings`,{target:Y(e),errors:x.list(i.map(e=>e()))})}finally{this.isCurrentPluginLoad(t,e)&&(this.pluginLoading=!1)}}}async loadPackagesForTarget(e=this.packageTarget()){let t=++this.packageLoadRequestSeq;this.packageLoading=!0,this.packageError=``,this.packageMessage=``;try{let n=await kn(e,e=>Ce.packages(e),this.packageManagementSupport(e));if(!this.isCurrentPackageLoad(t,e))return;this.packagesResponse=n.packagesResponse;let r=n.failure;this.packageError=r===void 0?``:()=>Z.t(`loadPackages`,{target:Y(e),error:Wn(r,e)})}finally{this.isCurrentPackageLoad(t,e)&&(this.packageLoading=!1)}}async togglePlugin(e,t){if(e===`pi-web.terminal`||this.selectedPluginsResponse?.plugins.find(({id:t})=>t===e)?.required===!0||this.saving)return;let n=this.settingsTarget(),r=this.selectedMachineSettingsSupport(n);if(J(r)){this.pluginError=r.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(n)});return}if(this.selectedPluginConfigResponse===void 0){this.pluginError=()=>Z.t(`pluginConfigMissing`,{target:Y(n)});return}let i=ut(`plugins`,e,`enabled`);if(N(this.selectedPluginConfigResponse,i)!==void 0)return;let a=t===void 0?pt(this.selectedPluginConfigResponse,[i]):{set:{plugins:{[e]:{enabled:t}}}};this.saving=!0,this.pluginError=``,this.savedMessage=``;try{let e=await v.updateConfig(a,n.id);if(!this.isCurrentSettingsTarget(n))return;this.selectedPluginConfigResponse=e,n.kind===`local`&&this.configResponse!==void 0&&(this.configResponse=zn(this.configResponse,e),this.publishGatewayConfig(this.configResponse));let t;if(J(Mn(n,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,n)))?(this.selectedPluginsResponse=void 0,t=()=>Un(n)):t=await this.refreshPluginsForTarget(n),!this.isCurrentSettingsTarget(n))return;t!==void 0&&(this.pluginError=t),this.showSavedMessage(()=>Z.t(`pluginsSaved`,{name:n.name}),`plugins`)}catch(e){if(this.isCurrentSettingsTarget(n)){let t=$(e);this.pluginError=()=>Z.t(`savePlugins`,{target:Y(n),error:X(t,n)})}}finally{this.saving=!1}}async saveConfig(e,t=[]){if(this.saving)return;let n=this.section===`shortcuts`?`shortcuts`:`general`;this.loadRequestSeq+=1,this.loading=!1,this.saving=!0,this.error=``,this.savedMessage=``;try{let r=await v.updateConfig({...ft(this.configResponse,e),...pt(this.configResponse,t)});this.configResponse=r,this.publishGatewayConfig(r),this.showSavedMessage(()=>n===`shortcuts`?Z.t(`shortcutsSaved`):t.length===1&&t[0]===`/defaultTheme`?Z.t(`themeSaved`):t.length===1&&t[0]===`/quietMode`?Z.t(`quietSaved`,{enabled:String(r.effectiveConfig.quietMode===!0)}):Z.t(`gatewaySaved`),n)}catch(e){let t=$(e);this.error=()=>Z.t(`settingsFailure`,{error:t})}finally{this.saving=!1}}async saveDefaultTheme(e){await this.saveFocusedGatewayConfig({defaultTheme:e},()=>Z.t(`themeSaved`),`themeFailure`)}async saveQuietMode(e){await this.saveFocusedGatewayConfig({quietMode:e},()=>Z.t(`quietSaved`,{enabled:String(e)}),`quietFailure`)}async saveFocusedGatewayConfig(e,t,n){if(!this.saving){this.loadRequestSeq+=1,this.loading=!1,this.saving=!0,this.error=``,this.savedMessage=``;try{let n=await v.updateConfig(ft(this.configResponse,e));this.configResponse=n,this.publishGatewayConfig(n),this.showSavedMessage(t,`general`)}catch(e){let t=$(e);this.error=()=>Z.t(n,{error:t})}finally{this.saving=!1}}}async saveMachineAccessConfig(e,t=[]){if(this.saving)return;let n=this.settingsTarget(),r=this.selectedMachineSettingsSupport(n);if(J(r))this.accessError=r.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(n)});else{this.accessLoadRequestSeq+=1,this.accessLoading=!1,n.kind===`local`&&(this.loadRequestSeq+=1,this.loading=!1),this.saving=!0,this.accessError=``,this.savedMessage=``;try{let r=await v.updateConfig({...ft(this.accessConfigResponse,e),...pt(this.accessConfigResponse,t)},n.id);if(this.onMachineConfigSaved?.(n.id),n.kind===`local`&&(this.loadRequestSeq+=1,this.loading=!1,this.configResponse!==void 0&&(this.configResponse=jn(this.configResponse,r),this.publishGatewayConfig(this.configResponse))),!this.isCurrentSettingsTarget(n))return;this.accessLoadRequestSeq+=1,this.accessLoading=!1,this.accessConfigResponse=r,this.showSavedMessage(()=>Z.t(`machineSaved`,{name:n.name}),`general`)}catch(e){if(this.isCurrentSettingsTarget(n)){let t=$(e);this.accessError=()=>Z.t(`saveAccess`,{target:Y(n),error:X(t,n)})}}finally{this.saving=!1}}}async saveSessiondConfig(e,t=[],n=this.settingsTarget()){if(this.saving||!this.isCurrentSettingsTarget(n))return;let r=this.selectedMachineSettingsSupport(n);if(J(r))this.sessiondError=r.message??b(`ui.settingsDialog.doesNotSupportSelectedMachineSettings`,`{value1} does not support selected-machine settings.`,{value1:q(n)});else{if(e.agent!==void 0||t.some(e=>e===`/agent`||e.startsWith(`/agent/`))){let e=this.agentProfileSettingsSupport(n);if(!Ln(e)){this.sessiondError=e.message??b(`ui.settingsDialog.doesNotSupportPiCompatibleAgentProfileSettings`,`{value1} does not support Pi-compatible agent profile settings.`,{value1:q(n)});return}}this.sessiondLoadRequestSeq+=1,this.sessiondLoading=!1,this.saving=!0,this.sessiondError=``,this.savedMessage=``;try{let r=await v.updateConfig({...ft(this.sessiondConfigResponse,e),...pt(this.sessiondConfigResponse,t)},n.id);if(!this.isCurrentSettingsTarget(n))return;this.sessiondConfigResponse=r,n.kind===`local`&&this.configResponse!==void 0&&(this.configResponse=zt(this.configResponse,r)),this.showSavedMessage(()=>Z.t(`sessiondSaved`,{name:n.name}),`sessiond`)}catch(e){if(this.isCurrentSettingsTarget(n)){let t=$(e);this.sessiondError=()=>Z.t(`saveSessiond`,{target:Y(n),error:X(t,n)})}}finally{this.saving=!1}}}async installPiPackage(e){let t=this.packageTarget();await this.runPiPackageMutation({kind:`install`,source:e},t,()=>Ce.install(e,t.id))}async removePiPackage(e,t){let n=this.packageTarget();await this.runPiPackageMutation({kind:`remove`,source:e},n,()=>Ce.remove(e,t,n.id))}async updatePiPackage(e){let t=this.packageTarget();await this.runPiPackageMutation(e===void 0?{kind:`update-all`}:{kind:`update`,source:e},t,()=>Ce.update(e,t.id))}async runPiPackageMutation(e,t,n){let r=this.packageManagementSupport(t);if(Yt(r))throw this.packageError=r.message??b(`ui.settingsDataLoading.doesNotSupportPiPackageManagement`,`{piPackageTargetLabeltarget} does not support Pi package management.`,{piPackageTargetLabeltarget:Kt(t)}),Error(this.packageError);if(this.saving)throw Error(Z.t(`operationRunning`));let i=++this.packageMutationSeq;this.packageLoadRequestSeq+=1,this.packageLoading=!1,this.saving=!0,this.packageOperation=e,this.packageError=``,this.packageMessage=``;try{let e=await n();if(!this.isCurrentPackageMutation(i,t))return;this.packagesResponse=en(e);let r=Zt(t)?await this.refreshGatewayPlugins():void 0;if(!this.isCurrentPackageMutation(i,t))return;r!==void 0&&(this.packageError=r),this.packageMessage=()=>Gn(e.action,t)}catch(n){if(this.isCurrentPackageMutation(i,t)){let r=$(n);this.packageError=()=>Z.t(`packageMutationFailure`,{operation:e.kind,target:Y(t),error:Wn(r,t)})}throw n}finally{this.packageMutationSeq===i&&(this.packageOperation=void 0,this.saving=!1)}}async refreshGatewayPlugins(){try{this.pluginsResponse=await ge.plugins();return}catch(e){let t=$(e);return()=>Z.t(`refreshGatewayFailure`,{error:t})}}async refreshPluginsForTarget(e){try{let t=await ge.plugins(e.id);this.isCurrentSettingsTarget(e)&&(this.selectedPluginsResponse=t);return}catch(t){this.isCurrentSettingsTarget(e)&&(this.selectedPluginsResponse=void 0);let n=$(t);return()=>Z.t(`refreshPluginsFailure`,{target:Y(e),error:X(n,e)})}}selectedSettingsMachine(e,t,n){return e.length===0?t:e.find(e=>e.id===(n??t?.id))??e.find(e=>e.kind===`local`)??e[0]}settingsTarget(){return Nn(this.selectedSettingsMachine(this.machines,this.machine,this.settingsMachineId))}settingsRuntime(e,t,n){return e[n.id]??(t?.machineId===n.id?t:void 0)}packageTarget(){return this.settingsTarget()}selectedMachineSettingsSupport(e=this.settingsTarget()){return Pn(e,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e))}agentProfileSettingsSupport(e=this.settingsTarget()){return Fn(e,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e))}selectedMachineSettingsSupportNeedsReload(e,t){let n=Pn(t,e),r=this.selectedMachineSettingsSupport(t);return In(n)!==In(r)}packageManagementSupport(e=this.packageTarget()){return qt(e,this.settingsRuntime(this.machineRuntimes,this.machineRuntime,e))}packageManagementSupportNeedsReload(e,t){let n=qt(t,e),r=this.packageManagementSupport(t);return Jt(n)===Jt(r)?!1:n.state===`unsupported`||r.state===`unsupported`}isCurrentLoad(e){return e===this.loadRequestSeq}isCurrentAccessLoad(e,t){return e===this.accessLoadRequestSeq&&this.isCurrentSettingsTarget(t)}isCurrentSessiondLoad(e,t){return e===this.sessiondLoadRequestSeq&&this.isCurrentSettingsTarget(t)}isCurrentPluginLoad(e,t){return e===this.pluginLoadRequestSeq&&this.isCurrentSettingsTarget(t)}isCurrentPackageLoad(e,t){return e===this.packageLoadRequestSeq&&this.isCurrentPackageTarget(t)}isCurrentPackageMutation(e,t){return e===this.packageMutationSeq&&this.isCurrentPackageTarget(t)}isCurrentPackageTarget(e){return this.packageTarget().id===e.id}isCurrentSettingsTarget(e){return this.settingsTarget().id===e.id}resetAccessStateForTargetChange(){this.accessLoadRequestSeq+=1,this.accessLoading=!1,this.accessError=``,this.accessConfigResponse=void 0,this.savedMessage=``}resetSessiondStateForTargetChange(){this.sessiondLoadRequestSeq+=1,this.sessiondLoading=!1,this.sessiondError=``,this.sessiondConfigResponse=void 0,this.savedMessage=``}resetPluginStateForTargetChange(){this.pluginLoadRequestSeq+=1,this.pluginLoading=!1,this.pluginError=``,this.selectedPluginConfigResponse=void 0,this.selectedPluginsResponse=void 0,this.savedMessage=``}resetPackageStateForTargetChange(){let e=this.packageOperation!==void 0;this.packageLoadRequestSeq+=1,this.packageMutationSeq+=1,this.packageLoading=!1,this.packageOperation=void 0,this.packageMessage=``,this.packageError=``,this.packagesResponse=void 0,e&&(this.saving=!1)}showSavedMessage(e,t){this.savedMessage=e,this.savedSection=t,this.savedMessageTimer!==void 0&&window.clearTimeout(this.savedMessageTimer),this.savedMessageTimer=window.setTimeout(()=>{this.savedMessage===e&&(this.savedMessage=``),this.savedMessageTimer=void 0},3e3)}static{this.styles=[re,ie,S`
|
|
1087
|
-
@layer pi-web-base {
|
|
1088
|
-
:host { position: fixed; inset: 0; z-index: 30; color: var(--pi-text); font: 14px var(--pi-font, system-ui, sans-serif); }
|
|
1089
|
-
modal-surface { --modal-surface-backdrop-padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); --modal-surface-width: min(980px, 100%); --modal-surface-max-height: min(760px, 100%); --modal-surface-min-height: min(620px, 100%); --modal-surface-radius: 14px; }
|
|
1090
|
-
.settings-machine { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--pi-border); }
|
|
1091
|
-
.settings-machine label { font-size: 12px; font-weight: 700; }
|
|
1092
|
-
.settings-machine select { flex: 1 1 160px; max-width: 280px; background: var(--pi-bg); }
|
|
1093
|
-
.machine-status { color: var(--pi-muted); line-height: 1.35; }
|
|
1094
|
-
.machine-status.unavailable { color: var(--pi-warning); }
|
|
1095
|
-
.machine-scope { color: var(--pi-muted); font-size: 12px; }
|
|
1096
|
-
.machine-scope summary { cursor: pointer; }
|
|
1097
|
-
.machine-scope[open] { flex-basis: 100%; }
|
|
1098
|
-
.machine-scope p { margin: 8px 0 0; line-height: 1.45; }
|
|
1099
|
-
.machine-connection-error { flex-basis: 100%; margin: 0; font-size: 12px; line-height: 1.45; color: var(--pi-warning); overflow-wrap: anywhere; }
|
|
1100
|
-
.machine-scope summary:focus-visible { outline: 2px solid var(--pi-accent); outline-offset: 2px; }
|
|
1101
|
-
.machine-switch-confirmation { flex: 0 0 auto; padding: 12px 16px; border-bottom: 1px solid var(--pi-warning-border); background: var(--pi-warning-surface); }
|
|
1102
|
-
.machine-switch-confirmation p { margin: 0 0 8px; }
|
|
1103
|
-
.machine-switch-confirmation button + button { margin-inline-start: 8px; }
|
|
1104
|
-
.settings-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
|
|
1105
|
-
.settings-nav { min-height: 0; flex: 1 1 auto; border-inline-end: 1px solid var(--pi-border); background: var(--pi-surface); overflow: auto; }
|
|
1106
|
-
.settings-nav button { display: grid; justify-content: stretch; gap: 2px; }
|
|
1107
|
-
.settings-machine, .machine-switch-confirmation, .settings-nav button { overflow-wrap: anywhere; }
|
|
1108
|
-
.settings-machine select { min-width: 0; }
|
|
1109
|
-
.settings-nav strong, .settings-nav small { min-width: 0; }
|
|
1110
|
-
.settings-nav small { color: var(--pi-muted); }
|
|
1111
|
-
.settings-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
|
|
1112
|
-
.settings-content { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; padding: 0; }
|
|
1113
|
-
.settings-back-label { display: none; }
|
|
1114
|
-
|
|
1115
|
-
@media (max-width: 760px) {
|
|
1116
|
-
modal-surface { --modal-surface-backdrop-padding: 0; --modal-surface-place-items: stretch; --modal-surface-width: 100%; --modal-surface-max-height: none; --modal-surface-min-height: 0; --modal-surface-border: 0; --modal-surface-radius: 0; }
|
|
1117
|
-
.settings-header { padding-top: env(safe-area-inset-top); }
|
|
1118
|
-
.settings-machine { padding: 10px 12px; }
|
|
1119
|
-
.settings-machine label { flex-basis: 100%; }
|
|
1120
|
-
.settings-machine select { max-width: none; }
|
|
1121
|
-
.machine-scope { flex-basis: 100%; }
|
|
1122
|
-
.settings-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
|
|
1123
|
-
.settings-nav { display: flex; gap: 0; padding: 0; border-inline-end: 0; border-bottom: 1px solid var(--pi-border); overflow-x: auto; overflow-y: hidden; }
|
|
1124
|
-
.settings-nav button { flex: 0 0 auto; width: auto; white-space: nowrap; border-inline-end: 1px solid var(--pi-border-muted); }
|
|
1125
|
-
.settings-nav small { display: none; }
|
|
1126
|
-
.settings-content { padding-bottom: env(safe-area-inset-bottom); }
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
`]}};c([m({attribute:!1})],Q.prototype,`section`,void 0),c([m({attribute:!1})],Q.prototype,`presentationRuntime`,void 0),c([m({attribute:!1})],Q.prototype,`presentationContext`,void 0),c([m({attribute:!1})],Q.prototype,`actions`,void 0),c([m({attribute:!1})],Q.prototype,`themes`,void 0),c([m({attribute:!1})],Q.prototype,`onThemeCatalogLoaded`,void 0),c([p()],Q.prototype,`themeCatalogLoading`,void 0),c([p()],Q.prototype,`themeCatalogError`,void 0),c([m({attribute:!1})],Q.prototype,`fileIconThemes`,void 0),c([m({attribute:!1})],Q.prototype,`fileIconPreference`,void 0),c([m({attribute:!1})],Q.prototype,`onSelectFileIconTheme`,void 0),c([m({attribute:!1})],Q.prototype,`onResetFileIconTheme`,void 0),c([m({attribute:!1})],Q.prototype,`themePreference`,void 0),c([m()],Q.prototype,`activeThemeId`,void 0),c([m({type:Boolean})],Q.prototype,`hasLocalThemeOverride`,void 0),c([m({attribute:!1})],Q.prototype,`onUseLocalTheme`,void 0),c([m({attribute:!1})],Q.prototype,`onUseDefaultTheme`,void 0),c([m({attribute:!1})],Q.prototype,`mcpContext`,void 0),c([m({attribute:!1})],Q.prototype,`onMcpAuth`,void 0),c([m({attribute:!1})],Q.prototype,`machine`,void 0),c([m({attribute:!1})],Q.prototype,`machineRuntime`,void 0),c([m({attribute:!1})],Q.prototype,`machines`,void 0),c([m({attribute:!1})],Q.prototype,`machineStatuses`,void 0),c([m({attribute:!1})],Q.prototype,`machineRuntimes`,void 0),c([p()],Q.prototype,`settingsMachineId`,void 0),c([p()],Q.prototype,`pendingMachineId`,void 0),c([m({attribute:!1})],Q.prototype,`onNavigate`,void 0),c([m({attribute:!1})],Q.prototype,`onClose`,void 0),c([m({attribute:!1})],Q.prototype,`onMachineConfigSaved`,void 0),c([m({attribute:!1})],Q.prototype,`onConfigSaved`,void 0),c([m({attribute:!1})],Q.prototype,`onRefreshMachineRuntime`,void 0),c([p()],Q.prototype,`configResponse`,void 0),c([p()],Q.prototype,`accessConfigResponse`,void 0),c([p()],Q.prototype,`sessiondConfigResponse`,void 0),c([p()],Q.prototype,`pluginsResponse`,void 0),c([p()],Q.prototype,`selectedPluginConfigResponse`,void 0),c([p()],Q.prototype,`selectedPluginsResponse`,void 0),c([p()],Q.prototype,`packagesResponse`,void 0),c([p()],Q.prototype,`loading`,void 0),c([p()],Q.prototype,`accessLoading`,void 0),c([p()],Q.prototype,`sessiondLoading`,void 0),c([p()],Q.prototype,`pluginLoading`,void 0),c([p()],Q.prototype,`packageLoading`,void 0),c([p()],Q.prototype,`saving`,void 0),c([p()],Q.prototype,`packageOperation`,void 0),c([p()],Q.prototype,`errorPresentation`,void 0),c([p()],Q.prototype,`accessErrorPresentation`,void 0),c([p()],Q.prototype,`sessiondErrorPresentation`,void 0),c([p()],Q.prototype,`pluginErrorPresentation`,void 0),c([p()],Q.prototype,`packageErrorPresentation`,void 0),c([p()],Q.prototype,`savedMessagePresentation`,void 0),c([p()],Q.prototype,`savedSection`,void 0),c([p()],Q.prototype,`packageMessagePresentation`,void 0),Q=c([l(`settings-dialog`)],Q);function $(e){return e instanceof Error?e.message:String(e)}function qn(e){switch(e){case`sessiond`:return`settings-sessiond-panel`;case`packages`:return`settings-packages-panel`;case`plugins`:return`settings-plugins-panel`;case`shortcuts`:return`settings-shortcuts-panel`;case`mcp`:return`settings-mcp-panel`;case`general`:return`settings-general-panel`}}export{Q as SettingsDialog,qn as activeSettingsPanelTag,Z as settingsDialogMessages};
|