dsh-home-hosted 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/docs/DESIGN.md +130 -13
- package/lib/client.js +6 -6
- package/lib/index.js +1101 -262
- package/lib/index.js.map +4 -4
- package/lib/types/config.d.ts +6 -0
- package/lib/types/home-hosted/dsh-entry.d.ts +14 -7
- package/lib/types/home-hosted/entries.d.ts +4 -18
- package/lib/types/home-hosted/instances-notice.d.ts +35 -0
- package/lib/types/home-hosted/instances.d.ts +34 -0
- package/lib/types/home-hosted/launcher.d.ts +20 -1
- package/lib/types/home-hosted/panel-control.d.ts +14 -0
- package/lib/types/home-hosted/resolve.d.ts +1 -5
- package/lib/types/home-hosted/token.d.ts +8 -3
- package/lib/types/service.d.ts +75 -12
- package/lib/types/shared/contracts.d.ts +92 -11
- package/lib/types/util/paths.d.ts +21 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ running.
|
|
|
78
78
|
| 📦 **Ships its own panel** | The pinned `home-hosted` is a dependency, so boot runs the version this plugin is tested against. |
|
|
79
79
|
| 🖥️ **Server control** | Add, edit, start, stop and restart entries — written through the panel's API, so nothing restarts behind your back. |
|
|
80
80
|
| 🧭 **Token warnings that mean something** | A missing or refused API token is called out on the page, with one click to mint a working one. |
|
|
81
|
+
| 🪟 **Knows the other panels** | Several panels on one machine? The agent is told which one this plugin manages, and asks before touching another. |
|
|
81
82
|
| 🤖 **Agent tools** | On by default, session permissions still gate every write. |
|
|
82
83
|
|
|
83
84
|
## 🤖 Agent tools
|
|
@@ -93,6 +94,7 @@ running.
|
|
|
93
94
|
|
|
94
95
|
A tool that changes something asks for approval **only** when the session is not already Full access.
|
|
95
96
|
<sub>A refused token is re-enrolled on the spot and the tool retries — see **automatic regeneration** below.</sub>
|
|
97
|
+
<sub>Every tool takes an optional `instance` (a panel's `--home` or URL). Omit it for the panel this plugin manages; with several panels found the call asks which one you mean, and naming another panel asks first too — then reaches it by editing its config file, running the CLI against it, or minting a token and using its API.</sub>
|
|
96
98
|
|
|
97
99
|
## 🧩 Depth
|
|
98
100
|
|
|
@@ -169,6 +171,10 @@ The Cordis row config is for operator overrides only:
|
|
|
169
171
|
|
|
170
172
|
Everything a person toggles lives in `<stateDir>/settings.json`.
|
|
171
173
|
|
|
174
|
+
Each install drives its own panel root — `<stateDir>/panel`, or `$HHOSTED_HOME` when set — and names
|
|
175
|
+
its own boot entry, so two dsh installs no longer share one panel. An existing `~/.home-hosted`
|
|
176
|
+
panel is adopted as-is, and the page shows which root this install owns.
|
|
177
|
+
|
|
172
178
|
</details>
|
|
173
179
|
|
|
174
180
|
<details>
|
package/docs/DESIGN.md
CHANGED
|
@@ -37,6 +37,49 @@ node_modules (flat or pnpm), then PATH — and forwards its argv, so the entry
|
|
|
37
37
|
survives plugin upgrades and profile reinstalls. The plugin preflights the
|
|
38
38
|
launcher the way the unit invokes it and shows the version it answers.
|
|
39
39
|
|
|
40
|
+
## The dsh entry boots the image the plugin was installed on
|
|
41
|
+
|
|
42
|
+
The panel starts `dsh web` from a server row, so a boot entry never runs dsh
|
|
43
|
+
itself. That row points at a second generated launcher (`bin/dsh.mjs`), and the
|
|
44
|
+
launcher has to answer "which dsh" without the plugin running. A local build is
|
|
45
|
+
the obvious case and the one that broke: a user ran a source checkout while
|
|
46
|
+
sharing the global `~/.dsh`, and the panel started a *different* global dsh that
|
|
47
|
+
shared the same data directory and crashed on the version mismatch. Choosing by
|
|
48
|
+
highest version, with the recorded path only as a tie-breaker, is what allowed
|
|
49
|
+
that: an unrelated install that reports a bigger number won.
|
|
50
|
+
|
|
51
|
+
So the record (`bin/dsh-resolved.json`) carries `pinned` — the image this plugin
|
|
52
|
+
was installed on — and the launcher checks it before any version sort. A pin is
|
|
53
|
+
carried, never guessed: only a caller that *is* the running image adopts a new
|
|
54
|
+
one (`repin`), so an upgrade that lands elsewhere is adopted but a copy found on
|
|
55
|
+
PATH never displaces the pin. A build whose path is genuinely gone falls back to
|
|
56
|
+
its recorded roots, then to real dsh installs, then to a bare build file, and
|
|
57
|
+
only then to PATH.
|
|
58
|
+
|
|
59
|
+
Candidates are ordered by how they were found, not just by version: a dsh by
|
|
60
|
+
construction (a manifest, `node_modules/dsh`, a pnpm store) beats a root that
|
|
61
|
+
merely offers `lib/bin.js` (a clone), which beats a `dsh` on PATH. A clone has
|
|
62
|
+
no manifest, so it is found by that build-file name — a guess that must never
|
|
63
|
+
outrank a real install.
|
|
64
|
+
|
|
65
|
+
The row's stored command is repaired to that launcher while the plugin runs
|
|
66
|
+
(`launcherRepair`), including a row that names a bare `dsh`: PATH is exactly what
|
|
67
|
+
pointed at the copy that stopped working. An entry that runs a different absolute
|
|
68
|
+
dsh is somebody's deliberate choice and is never rewritten.
|
|
69
|
+
|
|
70
|
+
## One panel root and one boot artifact per state root
|
|
71
|
+
|
|
72
|
+
Two dsh installs share `~/.dsh` far more often than they should, and each one
|
|
73
|
+
installing this plugin used to mean two plugins editing one `servers.config.json`
|
|
74
|
+
and one autostart unit under one ownership marker — so the second install quietly
|
|
75
|
+
replaced the first's boot entry. A panel root is now derived per instance: an
|
|
76
|
+
explicit `$HHOSTED_HOME` still wins, and a panel already living at
|
|
77
|
+
`~/.home-hosted` is adopted rather than abandoned (an upgrade must never make
|
|
78
|
+
every server look like it vanished), but otherwise the root is the instance's own
|
|
79
|
+
`<stateDir>/panel`. The boot unit name follows the state root (`home-hosted` for
|
|
80
|
+
the default install, `home-hosted-<hash>` otherwise), so two instances cannot
|
|
81
|
+
overwrite or delete each other's artifact.
|
|
82
|
+
|
|
40
83
|
## Agent tools are merged and on by default
|
|
41
84
|
|
|
42
85
|
Six tools, not ten: `servers_lifecycle` carries start/stop/restart, `servers_edit`
|
|
@@ -45,6 +88,14 @@ carries create/update/delete, `autostart_manage` carries install/uninstall, and
|
|
|
45
88
|
They are registered on by default; what gates a mutating call is the session's
|
|
46
89
|
own permission mode, not a plugin-level default.
|
|
47
90
|
|
|
91
|
+
Structured tool parameters are declared as objects, never as `type: 'json'`: an
|
|
92
|
+
author-only `json` node projects to a schema with no `type` at all, and a real
|
|
93
|
+
session then delivers something the handler cannot read — `create`/`update` were
|
|
94
|
+
unusable because of it, while every test passed, since tests call the handler
|
|
95
|
+
directly. A declared object is validated by the runtime before the handler, so a
|
|
96
|
+
wrong shape is rejected with the parameter named and an absent one is reported as
|
|
97
|
+
absent.
|
|
98
|
+
|
|
48
99
|
## The dsh entry is the only entry the page manages
|
|
49
100
|
|
|
50
101
|
The page shows one toggle: manage `dsh` as a home-hosted entry, or not. Adding
|
|
@@ -79,10 +130,7 @@ is passed through untouched rather than fought over. `authNotice` turns it off;
|
|
|
79
130
|
|
|
80
131
|
A managed entry asks for `persistent: true`: home-hosted then runs it under its
|
|
81
132
|
nanny, which owns the child and outlives `stopAll()`/`dispose()` — so restarting
|
|
82
|
-
or stopping the *panel* no longer ends a prompt mid-flight.
|
|
83
|
-
home-hosted 0.6.3, so the write and the drift check both consult the panel's
|
|
84
|
-
version: an older panel gets no such key (it would only be dropped and warned),
|
|
85
|
-
while the stored intent keeps what the person asked for.
|
|
133
|
+
or stopping the *panel* no longer ends a prompt mid-flight.
|
|
86
134
|
|
|
87
135
|
## Approvals follow the session's sandbox
|
|
88
136
|
|
|
@@ -94,15 +142,84 @@ about. Below full access the tool still asks and still fails closed, and the
|
|
|
94
142
|
refusal names the mode and the remedy (Full access, or an answerable approval
|
|
95
143
|
channel).
|
|
96
144
|
|
|
97
|
-
## Config compatibility
|
|
98
|
-
|
|
99
|
-
`onPortConflict: kill`
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
145
|
+
## Config compatibility was dropped, deliberately
|
|
146
|
+
|
|
147
|
+
`onPortConflict: kill` arrived in home-hosted 0.6.0 and `persistent` in 0.6.3, and
|
|
148
|
+
an older panel handed either key can refuse to *boot* from the config. The plugin
|
|
149
|
+
used to consult the answering panel's version and refuse or drop them
|
|
150
|
+
(`KILL_UNSUPPORTED`). That is gone on purpose: it pins `home-hosted@^0.6.7` and
|
|
151
|
+
autostarts its own copy, so a panel older than those keys is only reachable by
|
|
152
|
+
deliberately preferring an old global install — and this is pre-1.0. Supporting
|
|
153
|
+
older panels again means bringing that check back from history, not re-deriving
|
|
154
|
+
it.
|
|
155
|
+
|
|
156
|
+
## Several panels on one machine
|
|
157
|
+
|
|
158
|
+
`home-hosted` is not one panel per machine: it can be installed per project, and
|
|
159
|
+
one install can run several panels from different `--home` roots. This plugin
|
|
160
|
+
drives exactly one of them — the state root it resolved — so a person with two
|
|
161
|
+
panels used to be indistinguishable from a person with one.
|
|
162
|
+
|
|
163
|
+
Discovery is bounded, never a scan of the disk: the managed root (always listed,
|
|
164
|
+
even before its first start), `$HHOSTED_HOME`, the operator's `instanceRoots`,
|
|
165
|
+
and the `~/.home-hosted*` siblings. Another root counts only when it holds a
|
|
166
|
+
`servers.config.json` or a `run.json`. The inventory is cached
|
|
167
|
+
(`INSTANCES_CACHE_MS`); the prompt path re-measures a stale cache in place
|
|
168
|
+
(`instancesNow()`), because a provider that only read a snapshot would never
|
|
169
|
+
notice a panel started while this dsh was already running.
|
|
170
|
+
|
|
171
|
+
The agent is told rather than left to guess: with more than one panel found, the
|
|
172
|
+
`instancesNotice` setting contributes one runtime-context line naming the managed
|
|
173
|
+
panel and the others (`ctx.systemPrompt.context`, `instances-notice.ts`). Every
|
|
174
|
+
tool also takes an optional `instance` (a state root or URL); a mutating call
|
|
175
|
+
that names none asks the user which panel it means, through `ctx.userQuestions`,
|
|
176
|
+
after the approval gate so a call the session may not make prompts for nothing.
|
|
177
|
+
The question is asked only when a human channel can answer — no answerer, or a
|
|
178
|
+
delegated child — and an unexpected ask failure is refused rather than treated as
|
|
179
|
+
consent, because changing a panel the user never confirmed is the outcome this
|
|
180
|
+
exists to prevent. Its wording is English like every other host-side message: the
|
|
181
|
+
locale service is a browser-side seat, and first-party host plugins ask in English
|
|
182
|
+
too.
|
|
183
|
+
|
|
184
|
+
The page shows the same inventory under the panel details, including which panel
|
|
185
|
+
hosts this dsh, and the Agent-tools section carries the `instancesNotice` toggle.
|
|
186
|
+
|
|
187
|
+
A call that names another panel is no dead end. The plugin asks the user how to
|
|
188
|
+
reach it, offering every way that endpoint has, least invasive first:
|
|
189
|
+
|
|
190
|
+
- `file` edits that panel's `servers.config.json` — no credential, but no live
|
|
191
|
+
status either, and a running panel applies a changed definition at that
|
|
192
|
+
entry's next start;
|
|
193
|
+
- `cli` runs the home-hosted CLI against its state root — the only runtime path
|
|
194
|
+
the panel itself offers (`start`/`stop`; a restart is a stop then a start,
|
|
195
|
+
because the CLI has no server restart);
|
|
196
|
+
- `api` mints a token for that panel, enrols it and uses its HTTP API — the only
|
|
197
|
+
way to get live status, and it replaces any token that panel had, which the
|
|
198
|
+
question says outright.
|
|
199
|
+
|
|
200
|
+
The endpoint's first mechanism is the default when a caller names none, so a
|
|
201
|
+
host that cannot reach a person still does the least invasive thing. A read is
|
|
202
|
+
the one silent upgrade: with a token this plugin already holds for that panel it
|
|
203
|
+
uses the API, because that carries live status and mints nothing. Every such
|
|
204
|
+
result ends by naming the panel and the mechanism it used.
|
|
205
|
+
|
|
206
|
+
A config edit reaches a running panel through its file watcher, so a newly added
|
|
207
|
+
`autostart` entry is written disabled and then flipped — the same two-phase add
|
|
208
|
+
the managed path uses.
|
|
209
|
+
|
|
210
|
+
The credential for another panel lives beside the managed one, under its own slot
|
|
211
|
+
(`panel-tokens/<slot>.token`, 0600), minted on first use of that mechanism and
|
|
212
|
+
never shared with the managed panel's token.
|
|
213
|
+
|
|
214
|
+
Machine-wide and self-referential endpoints are the exception: `home_hosted_status`
|
|
215
|
+
describes the panel this plugin manages (its payload already lists the others),
|
|
216
|
+
and the OS boot entry is one entry for that same panel. Those refuse a `home`
|
|
217
|
+
rather than ignoring it, so a caller is never left believing it aimed a boot
|
|
218
|
+
entry at a panel it did not.
|
|
219
|
+
|
|
220
|
+
The settings stamp moved to 3 for `instancesNotice`, while the tool-name
|
|
221
|
+
migration stays bound to the release that merged the tools: a stamp bump must
|
|
222
|
+
never re-read a current file's explicit two-tool allowlist as "nobody chose".
|
|
106
223
|
|
|
107
224
|
## macOS: agent or daemon
|
|
108
225
|
|
package/lib/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-home-hosted", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
|
-
"use strict";var ce=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var wt=Object.prototype.hasOwnProperty;var St=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},kt=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xt(t))!wt.call(e,o)&&o!==n&&ce(e,o,{get:()=>t[o],enumerable:!(a=yt(t,o))||a.enumerable});return e};var Tt=e=>kt(ce({},"__esModule",{value:!0}),e);var Jt={};St(Jt,{apply:()=>qt,inject:()=>Yt});module.exports=Tt(Jt);var ae="homeHosted",de={tab:"Home Hosted",loading:"Loading\u2026",refresh:"Refresh",retry:"Retry",errorTitle:"Error",statusUnavailable:"The panel did not answer.",yes:"Yes",no:"No",copy:"Copy",copied:"Copied",details:"Details",uiStyleLabel:"Page style",uiStyleDetailed:"Detailed",uiStyleCompact:"Compact",sigPanel:"Panel",sigAutostart:"Autostart",sigEntry:"{id} entry",stateAnswering:"answering",stateNotAnswering:"not answering",stateManaged:"managed",stateNotManaged:"not managed",panelTitle:"Panel",panelCopy:"Which copy runs the panel",panelCopyHint:"The pinned copy ships with this plugin; the global one is on PATH.",optionsPreferPinned:"Pinned dependency",optionsPreferGlobal:"Global install",optionsRecommended:"recommended",optionsConfigOverride:"The plugin row sets homeHostedCommand, and that always wins.",optionsInstallLabel:"Install a global copy",optionsInstallHint:"No global install was found. Install the pinned range, then choose it above:",optionsInstall:"Install globally",panelHome:"$HHOSTED_HOME",panelUrl:"URL",panelVersion:"Version",panelPid:"PID",panelWriteVia:"Writes via",panelToken:"API token",panelCliSource:"CLI",panelCliPath:"CLI path",panelCliConfig:"configured command",panelCliDependency:"pinned dependency",panelCliPathSource:"global install (PATH)",panelCliMissing:"not found",panelCliNotPinned:"This host resolved a global home-hosted instead of the pinned copy ({range}).",panelCliUnsupported:"This home-hosted is older than the oldest release the plugin supports.",panelCliLauncherFailed:"The boot launcher did not answer, so a boot entry may fail to start the panel.",panelPort:"Panel port",panelPortHint:"Only changeable while the panel is stopped.",panelPortFree:"Leave empty to use the port in the config.",panelPortInvalid:"Enter a port between 1 and 65535.",panelStart:"Start the panel",panelReplace:"Replace with {copy}",panelCopyPinned:"pinned dependency",panelCopyGlobal:"global install",panelTakeoverTitle:"Replace the running panel?",panelTakeoverBody:"This stops the panel and every server it supervises \u2014 this session included, so the page disconnects. It needs the {id} entry adopted with autostart on.",confirmCancel:"Cancel",confirmReplace:"Replace",writeViaApi:"authenticated API",writeViaFile:"config file",writeViaNone:"unavailable",tokenEnrolled:"enrolled",tokenPresent:"present",tokenAbsent:"absent",tokenStale:"stale",tokenUnknown:"unknown",panelTokenWarningTitle:"The panel API token is missing or refused",panelTokenWarnAbsent:"This plugin has no API token for the panel, so it cannot read or write the panel; regenerate one.",panelTokenWarnPresent:"home-hosted holds an API token this plugin does not have, so the plugin cannot authenticate; regenerate one to replace it.",panelTokenWarnStale:"The panel refused this plugin's API token; regenerate it.",panelTokenWarnUnreachable:"The plugin could not reach the panel to check its API token, so it cannot read or write the panel; the panel may need starting.",panelTokenWarnPanelDown:"The panel is not answering right now, so it may need starting too.",panelTokenRegenerate:"Regenerate token",panelTokenRegenerated:"A fresh API token was enrolled for the panel.",panelTokenRegenerateFailed:"The token was not replaced: {message}",bootTitle:"Autostart",bootEnabled:"Enable autostart",bootUninstall:"Uninstall",bootSwitchMode:"Switch autostart",bootRecheck:"Re-check",bootMechanism:"Mechanism",bootMechanismAuto:"Automatic",bootState:"State",bootStateNotInstalled:"not installed",bootStateInstalledDisabled:"installed, off",bootStateEnabledRunning:"enabled, running",bootStateEnabledFailing:"enabled, failing",bootStateUnsupported:"unsupported",bootBootCapable:"Starts before login",bootPrivileged:"This process can install it",bootUnitPath:"Unit path",bootCommandsLabel:"Install by hand",bootCommandsExplain:"This process cannot elevate. Run these commands to install autostart:",bootRequestedNotInstalled:"Autostart is requested, but no boot entry is installed.",bootActionInstall:"install",bootActionUninstall:"uninstall",bootAttemptFailed:"{action} failed",bootAttemptSucceeded:"{action} succeeded \u2014 {detail}",bootAttemptNoDetail:"The host did not explain the refusal.",bootAttemptCommands:"Run these yourself:",entriesTitle:"Managed entry",entriesManage:"Manage {id}",entriesManageNote:"Hands {id} to home-hosted: boot autostart, panel control, port reclaim.",entriesManageWinWarning:"On Windows, `{id}` is managed via the `kill` onPortConflict policy, so when it is restarted detached by another plugin it may briefly fail to boot while home-hosted reclaims the process and port.",entriesEmpty:"{id} is not managed yet.",entriesExists:"exists",entriesMissing:"missing",entriesManaged:"managed",entriesUnmanaged:"unmanaged",entriesDrift:"drift",entriesNotRunning:"not running",agentTitle:"Agent tools",agentCount:"{enabled} of {total} on",agentMaster:"Let the agent use these tools",agentApproval:"Tools that change something ask for approval first.",agentApprovalBadge:"approval",reclaimAutoLabel:"Regenerate token automatically",reclaimAutoHint:"A tool call that finds a refused token re-enrols one and retries instead of failing.",agentToolStatus:"Status",agentToolServersList:"List servers",agentToolServersLifecycle:"Start, stop, restart",agentToolServersEdit:"Create, update, delete",agentToolAutostartManage:"Manage boot autostart",agentToolUiManage:"Manage Panel UI",agentToolDescStatus:"Read the panel, the CLI copy in use and the managed entry. Nothing changes.",agentToolDescServersList:"List the servers the panel supervises, with status, port and URL.",agentToolDescServersLifecycle:"Start, stop and restart supervised servers.",agentToolDescServersEdit:"Create, update and delete the panel's server entries.",agentToolDescAutostartManage:"Install or remove the boot entry that starts the panel.",agentToolDescUiManage:"Inspect, update, revert or switch the panel's own UI build.",serversTitle:"Servers",serversCount:"{running} of {total} running",serversHintPanel:"Entries are managed in the home-hosted panel:",serversHintNoPanel:"Entries cannot be managed right now: the panel is not running.",serversEmpty:"The panel reports no servers.",serversPid:"PID",serversUrl:"URL",serversCommand:"Command",serversArgs:"Args",serversCwd:"Working dir",serversPort:"Port",serversOnPortConflict:"On port conflict",serversAutostart:"Autostart",serversPersistent:"Persistent",serversPersistentHint:"Run by home-hosted's own nanny, so stopping or restarting the panel leaves it alive.",serversHealth:"Health",serversRestartPolicy:"Restart",serversConfiguration:"Configuration",serversRawConfig:"Raw config",serversDisabled:"disabled",serversEnabled:"enabled",serversHealthHttp:"HTTP {status} on {path}",serversHealthHttpBelow:"HTTP <{status} on {path}",serversHealthHttpProbe:"HTTP probe on {path}",serversHealthPort:"port {port}",serversHealthProbe:"port probe",serversHealthEvery:"every {seconds}",serversRestartSummary:"{retries} retries \xB7 {base} \u2192 \xD7{factor}",serversStart:"Start",serversStop:"Stop",serversRestart:"Restart"},ve={tab:"Home Hosted",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",retry:"\u91CD\u8BD5",errorTitle:"\u9519\u8BEF",statusUnavailable:"\u9762\u677F\u6CA1\u6709\u54CD\u5E94\u3002",yes:"\u662F",no:"\u5426",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",details:"\u8BE6\u60C5",uiStyleLabel:"\u9875\u9762\u6837\u5F0F",uiStyleDetailed:"\u8BE6\u7EC6",uiStyleCompact:"\u7D27\u51D1",sigPanel:"\u9762\u677F",sigAutostart:"\u5F00\u673A\u81EA\u542F",sigEntry:"{id} \u6761\u76EE",stateAnswering:"\u54CD\u5E94\u4E2D",stateNotAnswering:"\u672A\u54CD\u5E94",stateManaged:"\u5DF2\u63A5\u7BA1",stateNotManaged:"\u672A\u63A5\u7BA1",panelTitle:"\u9762\u677F",panelCopy:"\u7531\u54EA\u4E2A\u526F\u672C\u8FD0\u884C\u9762\u677F",panelCopyHint:"\u56FA\u5B9A\u526F\u672C\u968F\u63D2\u4EF6\u4E00\u8D77\u5B89\u88C5\uFF1B\u5168\u5C40\u526F\u672C\u6765\u81EA PATH\u3002",optionsPreferPinned:"\u56FA\u5B9A\u4F9D\u8D56",optionsPreferGlobal:"\u5168\u5C40\u5B89\u88C5",optionsRecommended:"\u63A8\u8350",optionsConfigOverride:"\u63D2\u4EF6\u884C\u4E2D\u7684 homeHostedCommand \u4F18\u5148\u7EA7\u6700\u9AD8\uFF0C\u59CB\u7EC8\u751F\u6548\u3002",optionsInstallLabel:"\u5B89\u88C5\u5168\u5C40\u526F\u672C",optionsInstallHint:"\u672A\u627E\u5230\u5168\u5C40\u5B89\u88C5\u3002\u5B89\u88C5\u56FA\u5B9A\u7248\u672C\u8303\u56F4\u540E\uFF0C\u5728\u4E0A\u65B9\u9009\u62E9\u5B83\uFF1A",optionsInstall:"\u5168\u5C40\u5B89\u88C5",panelHome:"$HHOSTED_HOME",panelUrl:"URL",panelVersion:"\u7248\u672C",panelPid:"PID",panelWriteVia:"\u5199\u5165\u65B9\u5F0F",panelToken:"API \u4EE4\u724C",panelCliSource:"CLI",panelCliPath:"CLI \u8DEF\u5F84",panelCliConfig:"\u914D\u7F6E\u7684\u547D\u4EE4",panelCliDependency:"\u56FA\u5B9A\u7684\u4F9D\u8D56\u7248\u672C",panelCliPathSource:"\u5168\u5C40\u5B89\u88C5\uFF08PATH\uFF09",panelCliMissing:"\u672A\u627E\u5230",panelCliNotPinned:"\u6B64\u5BBF\u4E3B\u89E3\u6790\u5230\u7684\u662F\u5168\u5C40 home-hosted\uFF0C\u800C\u4E0D\u662F\u56FA\u5B9A\u526F\u672C\uFF08{range}\uFF09\u3002",panelCliUnsupported:"\u6B64 home-hosted \u65E9\u4E8E\u63D2\u4EF6\u652F\u6301\u7684\u6700\u8001\u7248\u672C\u3002",panelCliLauncherFailed:"\u5F00\u673A\u542F\u52A8\u5668\u6CA1\u6709\u5E94\u7B54\uFF0C\u5F00\u673A\u9879\u53EF\u80FD\u65E0\u6CD5\u542F\u52A8\u9762\u677F\u3002",panelPort:"\u9762\u677F\u7AEF\u53E3",panelPortHint:"\u4EC5\u5728\u9762\u677F\u505C\u6B62\u65F6\u53EF\u4FEE\u6539\u3002",panelPortFree:"\u7559\u7A7A\u5219\u4F7F\u7528\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u7AEF\u53E3\u3002",panelPortInvalid:"\u8BF7\u8F93\u5165 1 \u5230 65535 \u4E4B\u95F4\u7684\u7AEF\u53E3\u3002",panelStart:"\u542F\u52A8\u9762\u677F",panelReplace:"\u66FF\u6362\u4E3A{copy}",panelCopyPinned:"\u56FA\u5B9A\u4F9D\u8D56",panelCopyGlobal:"\u5168\u5C40\u5B89\u88C5",panelTakeoverTitle:"\u66FF\u6362\u6B63\u5728\u8FD0\u884C\u7684\u9762\u677F\uFF1F",panelTakeoverBody:"\u8FD9\u4F1A\u505C\u6B62\u9762\u677F\u4EE5\u53CA\u5B83\u76D1\u7BA1\u7684\u6240\u6709\u670D\u52A1\u5668\u2014\u2014\u5305\u62EC\u672C\u4F1A\u8BDD\uFF0C\u56E0\u6B64\u672C\u9875\u9762\u4F1A\u65AD\u5F00\u8FDE\u63A5\u3002\u4EC5\u5F53 {id} \u6761\u76EE\u5DF2\u88AB\u63A5\u7BA1\u4E14\u542F\u7528\u81EA\u542F\u65F6\u624D\u53EF\u7528\u3002",confirmCancel:"\u53D6\u6D88",confirmReplace:"\u66FF\u6362",writeViaApi:"\u5DF2\u8BA4\u8BC1 API",writeViaFile:"\u914D\u7F6E\u6587\u4EF6",writeViaNone:"\u4E0D\u53EF\u7528",tokenEnrolled:"\u5DF2\u767B\u8BB0",tokenPresent:"\u5DF2\u5B58\u5728",tokenAbsent:"\u4E0D\u5B58\u5728",tokenStale:"\u5DF2\u5931\u6548",tokenUnknown:"\u672A\u77E5",panelTokenWarningTitle:"\u9762\u677F API \u4EE4\u724C\u7F3A\u5931\u6216\u5DF2\u88AB\u62D2\u7EDD",panelTokenWarnAbsent:"\u672C\u63D2\u4EF6\u6CA1\u6709\u6B64\u9762\u677F\u7684 API \u4EE4\u724C\uFF0C\u65E0\u6CD5\u8BFB\u53D6\u6216\u5199\u5165\u9762\u677F\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u4E00\u4E2A\u3002",panelTokenWarnPresent:"home-hosted \u6301\u6709\u4E00\u4E2A\u672C\u63D2\u4EF6\u6CA1\u6709\u7684 API \u4EE4\u724C\uFF0C\u63D2\u4EF6\u65E0\u6CD5\u901A\u8FC7\u8BA4\u8BC1\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u4E00\u4E2A\u4EE5\u66FF\u6362\u5B83\u3002",panelTokenWarnStale:"\u9762\u677F\u62D2\u7EDD\u4E86\u672C\u63D2\u4EF6\u7684 API \u4EE4\u724C\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u3002",panelTokenWarnUnreachable:"\u672C\u63D2\u4EF6\u65E0\u6CD5\u8BBF\u95EE\u9762\u677F\u4EE5\u68C0\u67E5\u5176 API \u4EE4\u724C\uFF0C\u56E0\u6B64\u65E0\u6CD5\u8BFB\u53D6\u6216\u5199\u5165\u9762\u677F\uFF1B\u9762\u677F\u53EF\u80FD\u8FD8\u9700\u8981\u5148\u542F\u52A8\u3002",panelTokenWarnPanelDown:"\u9762\u677F\u5F53\u524D\u6CA1\u6709\u54CD\u5E94\uFF0C\u53EF\u80FD\u8FD8\u9700\u8981\u5148\u542F\u52A8\u9762\u677F\u3002",panelTokenRegenerate:"\u91CD\u65B0\u751F\u6210\u4EE4\u724C",panelTokenRegenerated:"\u5DF2\u4E3A\u9762\u677F\u767B\u8BB0\u65B0\u4EE4\u724C\u3002",panelTokenRegenerateFailed:"\u4EE4\u724C\u672A\u66FF\u6362\uFF1A{message}",bootTitle:"\u5F00\u673A\u81EA\u542F",bootEnabled:"\u542F\u7528\u5F00\u673A\u81EA\u542F",bootUninstall:"\u5378\u8F7D",bootSwitchMode:"\u5207\u6362\u81EA\u542F\u673A\u5236",bootRecheck:"\u91CD\u65B0\u68C0\u67E5",bootMechanism:"\u673A\u5236",bootMechanismAuto:"\u81EA\u52A8",bootState:"\u72B6\u6001",bootStateNotInstalled:"\u672A\u5B89\u88C5",bootStateInstalledDisabled:"\u5DF2\u5B89\u88C5\uFF0C\u672A\u542F\u7528",bootStateEnabledRunning:"\u5DF2\u542F\u7528\uFF0C\u8FD0\u884C\u4E2D",bootStateEnabledFailing:"\u5DF2\u542F\u7528\uFF0C\u542F\u52A8\u5931\u8D25",bootStateUnsupported:"\u4E0D\u652F\u6301",bootBootCapable:"\u767B\u5F55\u524D\u542F\u52A8",bootPrivileged:"\u672C\u8FDB\u7A0B\u53EF\u5B89\u88C5",bootUnitPath:"\u5355\u5143\u6587\u4EF6\u8DEF\u5F84",bootCommandsLabel:"\u624B\u52A8\u5B89\u88C5",bootCommandsExplain:"\u672C\u8FDB\u7A0B\u65E0\u6CD5\u63D0\u6743\u3002\u8BF7\u81EA\u884C\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u6765\u5B89\u88C5\u81EA\u542F\uFF1A",bootRequestedNotInstalled:"\u5DF2\u8BF7\u6C42\u5F00\u673A\u81EA\u542F\uFF0C\u4F46\u5C1A\u672A\u5B89\u88C5\u4EFB\u4F55\u5F00\u673A\u9879\u3002",bootActionInstall:"\u5B89\u88C5",bootActionUninstall:"\u5378\u8F7D",bootAttemptFailed:"{action}\u5931\u8D25",bootAttemptSucceeded:"{action}\u6210\u529F \u2014 {detail}",bootAttemptNoDetail:"\u5BBF\u4E3B\u6CA1\u6709\u8BF4\u660E\u5931\u8D25\u539F\u56E0\u3002",bootAttemptCommands:"\u4F60\u53EF\u4EE5\u81EA\u884C\u8FD0\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A",entriesTitle:"\u53D7\u7BA1\u6761\u76EE",entriesManage:"\u63A5\u7BA1 {id}",entriesManageNote:"\u628A {id} \u4EA4\u7ED9 home-hosted\uFF1A\u5F00\u673A\u81EA\u542F\u3001\u9762\u677F\u63A7\u5236\u3001\u7AEF\u53E3\u56DE\u6536\u3002",entriesManageWinWarning:"\u5728 Windows \u4E0A\uFF0C`{id}` \u901A\u8FC7 `kill` \u7AEF\u53E3\u51B2\u7A81\u7B56\u7565\u7BA1\u7406\uFF1B\u5F53\u5B83\u88AB\u5176\u4ED6\u63D2\u4EF6\u4EE5\u5206\u79BB\u65B9\u5F0F\u91CD\u542F\u65F6\uFF0Chome-hosted \u56DE\u6536\u8FDB\u7A0B\u4E0E\u7AEF\u53E3\u671F\u95F4\u53EF\u80FD\u77ED\u6682\u65E0\u6CD5\u542F\u52A8\u3002",entriesEmpty:"\u5C1A\u672A\u63A5\u7BA1 {id}\u3002",entriesExists:"\u5B58\u5728",entriesMissing:"\u7F3A\u5931",entriesManaged:"\u5DF2\u63A5\u7BA1",entriesUnmanaged:"\u672A\u63A5\u7BA1",entriesDrift:"\u6F02\u79FB",entriesNotRunning:"\u672A\u8FD0\u884C",agentTitle:"Agent \u5DE5\u5177",agentCount:"\u5DF2\u5F00\u542F {enabled}/{total}",agentMaster:"\u5141\u8BB8 Agent \u8C03\u7528\u8FD9\u4E9B\u5DE5\u5177",agentApproval:"\u4F1A\u6539\u53D8\u72B6\u6001\u7684\u5DE5\u5177\u5728\u8FD0\u884C\u524D\u4F1A\u8BF7\u6C42\u6279\u51C6\u3002",agentApprovalBadge:"\u9700\u6279\u51C6",reclaimAutoLabel:"\u88AB\u62D2\u7EDD\u65F6\u81EA\u52A8\u91CD\u65B0\u751F\u6210\u4EE4\u724C",reclaimAutoHint:"\u5DE5\u5177\u8C03\u7528\u9047\u5230\u88AB\u62D2\u7EDD\u7684\u4EE4\u724C\u65F6\u4F1A\u91CD\u65B0\u767B\u8BB0\u5E76\u91CD\u8BD5\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5931\u8D25\u3002",agentToolStatus:"\u67E5\u770B\u72B6\u6001",agentToolServersList:"\u5217\u51FA\u670D\u52A1\u5668",agentToolServersLifecycle:"\u542F\u52A8\u3001\u505C\u6B62\u3001\u91CD\u542F",agentToolServersEdit:"\u521B\u5EFA\u3001\u66F4\u65B0\u3001\u5220\u9664",agentToolAutostartManage:"\u7BA1\u7406\u5F00\u673A\u81EA\u542F",agentToolUiManage:"\u7BA1\u7406\u9762\u677F UI",agentToolDescStatus:"\u8BFB\u53D6\u9762\u677F\u3001\u6B63\u5728\u4F7F\u7528\u7684 CLI \u526F\u672C\u548C\u53D7\u7BA1\u6761\u76EE\u3002\u4E0D\u6539\u53D8\u4EFB\u4F55\u72B6\u6001\u3002",agentToolDescServersList:"\u5217\u51FA\u9762\u677F\u76D1\u7BA1\u7684\u670D\u52A1\u5668\u53CA\u5176\u72B6\u6001\u3001\u7AEF\u53E3\u548C URL\u3002",agentToolDescServersLifecycle:"\u542F\u52A8\u3001\u505C\u6B62\u548C\u91CD\u542F\u53D7\u76D1\u7BA1\u7684\u670D\u52A1\u5668\u3002",agentToolDescServersEdit:"\u521B\u5EFA\u3001\u66F4\u65B0\u548C\u5220\u9664\u9762\u677F\u7684\u670D\u52A1\u5668\u6761\u76EE\u3002",agentToolDescAutostartManage:"\u5B89\u88C5\u6216\u79FB\u9664\u542F\u52A8\u9762\u677F\u7684\u5F00\u673A\u9879\u3002",agentToolDescUiManage:"\u67E5\u770B\u3001\u66F4\u65B0\u3001\u56DE\u9000\u6216\u5207\u6362\u9762\u677F\u81EA\u8EAB\u7684 UI \u6784\u5EFA\u3002",serversTitle:"\u670D\u52A1\u5668",serversCount:"{total} \u4E2A\u4E2D {running} \u4E2A\u8FD0\u884C\u4E2D",serversHintPanel:"\u5728 home-hosted \u9762\u677F\u4E2D\u7BA1\u7406\u6761\u76EE\uFF1A",serversHintNoPanel:"\u5F53\u524D\u65E0\u6CD5\u7BA1\u7406\u6761\u76EE\uFF1A\u9762\u677F\u6CA1\u6709\u8FD0\u884C\u3002",serversEmpty:"\u9762\u677F\u672A\u62A5\u544A\u4EFB\u4F55\u670D\u52A1\u5668\u3002",serversPid:"PID",serversUrl:"URL",serversCommand:"\u547D\u4EE4",serversArgs:"\u53C2\u6570",serversCwd:"\u5DE5\u4F5C\u76EE\u5F55",serversPort:"\u7AEF\u53E3",serversOnPortConflict:"\u7AEF\u53E3\u51B2\u7A81\u65F6",serversAutostart:"\u81EA\u542F",serversPersistent:"\u6301\u4E45\u5316",serversPersistentHint:"\u7531 home-hosted \u81EA\u5E26\u7684 nanny \u6258\u7BA1\uFF0C\u505C\u6B62\u6216\u91CD\u542F\u9762\u677F\u4E0D\u4F1A\u505C\u6B62\u5B83\u3002",serversHealth:"\u5065\u5EB7\u68C0\u67E5",serversRestartPolicy:"\u91CD\u542F",serversConfiguration:"\u914D\u7F6E",serversRawConfig:"\u539F\u59CB\u914D\u7F6E",serversDisabled:"\u5DF2\u505C\u7528",serversEnabled:"\u5DF2\u542F\u7528",serversHealthHttp:"HTTP {status} \u4E8E {path}",serversHealthHttpBelow:"HTTP <{status} \u4E8E {path}",serversHealthHttpProbe:"HTTP \u63A2\u6D4B {path}",serversHealthPort:"\u7AEF\u53E3 {port}",serversHealthProbe:"\u7AEF\u53E3\u63A2\u6D4B",serversHealthEvery:"\u6BCF {seconds}",serversRestartSummary:"{retries} \u6B21\u91CD\u8BD5 \xB7 {base} \u2192 \xD7{factor}",serversStart:"\u542F\u52A8",serversStop:"\u505C\u6B62",serversRestart:"\u91CD\u542F"};function Ct(e,t){return t===void 0?e:e.replace(/\{(\w+)\}/g,(n,a)=>Object.prototype.hasOwnProperty.call(t,a)?String(t[a]):n)}var ye=(e,t)=>Ct(de[e]??e,t);function xe(e){if(e!==void 0)try{let t=e.bind(ae);if(typeof t=="function")return t}catch{}return ye}function we(e,t=ye){return e===void 0?t:(n,a)=>{let o;try{o=e(n,a)}catch{o=void 0}return o===void 0||o.length===0||o===n?t(n,a):o}}var V=require("react");var O=require("react");var Se="/home-hosted";var G=["status","servers_list","servers_lifecycle","servers_edit","autostart_manage","ui_manage"],ke=["servers_lifecycle","servers_edit","autostart_manage","ui_manage"],Pt=2,Qt={version:Pt,autostart:{enabled:!1,mechanism:"auto"},manageDsh:!1,entries:[],agentTools:{enabled:!0,allow:[...G]},panel:{port:null},authNotice:!0,reclaimToken:!0,uiStyle:"detailed",cli:{prefer:"pinned"}};var Nt="/api";function M(e,t,n){return{ok:!1,error:n===void 0?{code:e,message:t}:{code:e,message:t,detail:n}}}function he(e){return typeof e=="object"&&e!==null}function Et(e){return e instanceof Error?e.message:String(e)}function Rt(e){if(!he(e))return M("bad-response","The panel returned a non-object response");if(typeof e.v=="number"&&e.v!==1)return M("version-mismatch",`Response protocol v${e.v} does not match the expected v${1}`);let t=e.result;if(!he(t))return M("bad-response","The panel returned no result");if(t.ok===!0)return"value"in t?{ok:!0,value:t.value}:M("bad-response","A successful response carried no value");if(t.ok===!1){let n=t.error;return he(n)&&typeof n.message=="string"?M(typeof n.code=="string"?n.code:"error",n.message,n.detail):M("error","The panel reported a failure without a message")}return M("bad-response","The panel returned an unrecognised result")}async function w(e,t,n={}){let a=n.fetch??globalThis.fetch;if(typeof a!="function")return M("no-fetch","No fetch implementation is available");let o={v:1,endpoint:e,payload:t},r;try{r=await a(`${Nt}${Se}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(o)})}catch(s){return M("network",Et(s))}if(!r.ok){let s=r.statusText.length>0?` ${r.statusText}`:"";return M("http",`HTTP ${r.status}${s}`)}let i;try{i=await r.json()}catch{return M("bad-json","The panel returned invalid JSON")}return Rt(i)}function Te(e,t={}){return w("settings.update",{patch:e},t)}var At=5e3;function Ce(e=At){let[t,n]=(0,O.useState)(null),[a,o]=(0,O.useState)(null),[r,i]=(0,O.useState)(!0),s=(0,O.useRef)(!0),p=(0,O.useCallback)(async()=>{let c=await w("status",{});s.current&&(c.ok?(n(c.value),o(null)):o(c.error),i(!1))},[]);return(0,O.useEffect)(()=>{s.current=!0,p();let c=setInterval(()=>{p()},e);return()=>{s.current=!1,clearInterval(c)}},[p,e]),{data:t,error:a,loading:r,refresh:p}}var m=require("react/jsx-runtime");function _({size:e=14,children:t}){return(0,m.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:t})}function Pe(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("rect",{x:"2.2",y:"3",width:"11.6",height:"7.6",rx:"1.6"}),(0,m.jsx)("path",{d:"M6.6 13.4h2.8M8 10.6v2.8"})]})}function Ne(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M8 2.4v5.2"}),(0,m.jsx)("path",{d:"M11.6 4.4a5 5 0 1 1-7.2 0"})]})}function Ee(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("rect",{x:"2.2",y:"2.8",width:"11.6",height:"10.4",rx:"1.6"}),(0,m.jsx)("path",{d:"M5.2 6.9l1.8 1.8-1.8 1.8M8.7 10.5h2.2"})]})}function Re(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M2.4 5.4h11.2M2.4 10.6h11.2"}),(0,m.jsx)("circle",{cx:"6",cy:"5.4",r:"1.6",fill:"currentColor",stroke:"none"}),(0,m.jsx)("circle",{cx:"10.4",cy:"10.6",r:"1.6",fill:"currentColor",stroke:"none"})]})}function Ae(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M8 2.3l5.4 2.9L8 8.1 2.6 5.2z"}),(0,m.jsx)("path",{d:"M2.6 8.6l5.4 2.9 5.4-2.9"}),(0,m.jsx)("path",{d:"M2.6 11.4l5.4 2.9 5.4-2.9"})]})}function He(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M13.4 9.4A5.5 5.5 0 1 1 12.2 4.4"}),(0,m.jsx)("path",{d:"M12.8 1.7v2.9h-2.9"})]})}function Ie(e){return(0,m.jsx)(_,{...e,children:(0,m.jsx)("path",{d:"M6.2 3.8L10.4 8l-4.2 4.2"})})}function Me(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M6.6 3.4H3.4v9.2h9.2V9.4"}),(0,m.jsx)("path",{d:"M9.4 3.4h3.2v3.2M12.6 3.4L7.8 8.2"})]})}function re(e){return(0,m.jsxs)(_,{...e,children:[(0,m.jsx)("path",{d:"M8 2.6l5.7 10.2H2.3z"}),(0,m.jsx)("path",{d:"M8 6.4v3.1M8 11.5h.01"})]})}function Le(e){return(0,m.jsx)(_,{...e,children:(0,m.jsx)("path",{d:"M3 8.4l3.3 3.3L13 5"})})}var L="\u2014";function x(e){if(e==null)return L;let t=String(e);return t.length>0?t:L}function Be(e){return e.length>0?e.join(", "):L}function ue(e){return ke.includes(e)}var ge={status:"agentToolStatus",servers_list:"agentToolServersList",servers_lifecycle:"agentToolServersLifecycle",servers_edit:"agentToolServersEdit",autostart_manage:"agentToolAutostartManage",ui_manage:"agentToolUiManage"},Oe={status:"agentToolDescStatus",servers_list:"agentToolDescServersList",servers_lifecycle:"agentToolDescServersLifecycle",servers_edit:"agentToolDescServersEdit",autostart_manage:"agentToolDescAutostartManage",ui_manage:"agentToolDescUiManage"},_e={api:"writeViaApi",file:"writeViaFile",none:"writeViaNone"},Ue={enrolled:"tokenEnrolled",present:"tokenPresent",absent:"tokenAbsent",stale:"tokenStale",unknown:"tokenUnknown"},ie={"not-installed":"bootStateNotInstalled","installed-disabled":"bootStateInstalledDisabled","enabled-running":"bootStateEnabledRunning","enabled-failing":"bootStateEnabledFailing",unsupported:"bootStateUnsupported"},De={config:"panelCliConfig",dependency:"panelCliDependency",path:"panelCliPathSource",none:"panelCliMissing"};function se(e,t=52){if(e.length<=t)return e;let n=e.includes("\\")?"\\":"/",a=e.split(/[\\/]/).filter(s=>s.length>0);if(a.length<4)return e;let o=/^[A-Za-z]:$/.test(a[0]??"")?3:2;if(a.length<=o)return e;let i=`${/^[\\/]/.test(e)?n:""}${a.slice(0,o).join(n)}${n}\u2026${n}${a.slice(-2).join(n)}`;return i.length<e.length?i:e}function Fe(e){let t=n=>e.source===n&&e.path!==null?{source:n,path:e.path,version:e.version}:null;return{dependency:e.dependency??t("dependency"),global:e.global??t("path")}}function Ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ht(e,t){if(Object.is(e,t))return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function $e(e,t){let n={};for(let a of Object.keys(t)){let o=e[a],r=t[a];if(Ve(o)&&Ve(r)){let i=$e(o,r);Object.keys(i).length>0&&(n[a]=i)}else Ht(o,r)||(n[a]=r)}return n}function je(e,t){return $e(e,t)}function ze(e,t,n){let a=new Set(e);return n?a.add(t):a.delete(t),G.filter(o=>a.has(o))}var We=require("react");async function Ge(e){try{if(typeof navigator<"u"&&navigator.clipboard!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var l=require("react/jsx-runtime");function It(...e){return e.filter(t=>typeof t=="string"&&t.length>0).join(" ")}function U({icon:e,title:t,action:n,children:a}){return(0,l.jsxs)("section",{className:"hh-section",children:[(0,l.jsxs)("header",{className:"hh-section-head",children:[e===void 0?null:(0,l.jsx)("span",{className:"hh-section-icon",children:e}),(0,l.jsx)("h3",{className:"hh-section-title",children:t}),(0,l.jsx)("span",{className:"hh-section-rule","aria-hidden":"true"}),n===void 0?null:(0,l.jsx)("span",{className:"hh-section-action",children:n})]}),(0,l.jsx)("div",{className:"hh-section-body",children:a})]})}function b({label:e,children:t}){return(0,l.jsxs)("div",{className:"hh-spec",children:[(0,l.jsx)("span",{className:"hh-spec-label",children:e}),(0,l.jsx)("span",{className:"hh-spec-value",children:t})]})}function D({children:e}){return(0,l.jsx)("code",{className:"hh-code",children:e})}function y({children:e}){return typeof e=="string"&&e.length===0?null:(0,l.jsx)("p",{className:"hh-hint",children:e})}function R({tone:e,children:t}){return(0,l.jsx)("span",{className:"hh-chip","data-tone":e??"idle",children:t})}function W({href:e,children:t}){return(0,l.jsxs)("a",{className:"hh-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t??e,(0,l.jsx)("span",{className:"hh-link-icon","aria-hidden":"true",children:(0,l.jsx)(Me,{size:11})})]})}function F({label:e,open:t=!1,children:n}){return(0,l.jsxs)("details",{className:"hh-details",open:t||void 0,children:[(0,l.jsxs)("summary",{className:"hh-summary",children:[(0,l.jsx)("span",{className:"hh-chevron","aria-hidden":"true",children:(0,l.jsx)(Ie,{size:12})}),e]}),(0,l.jsx)("div",{className:"hh-details-body",children:n})]})}function K({tone:e="bad",icon:t=!0,title:n,children:a}){return(0,l.jsxs)("div",{className:"hh-note","data-tone":e,role:e==="bad"?"alert":"note",children:[t?(0,l.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,l.jsx)(re,{size:13})}):null,(0,l.jsxs)("div",{className:"hh-note-body",children:[n===void 0?null:(0,l.jsx)("span",{className:"hh-note-title",children:n}),typeof a=="string"?(0,l.jsx)("p",{children:a}):a]})]})}function Ke({title:e,detail:t}){return(0,l.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,l.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,l.jsx)(re,{size:13})}),(0,l.jsxs)("div",{className:"hh-note-body",children:[(0,l.jsx)("strong",{children:e}),t.length>0?(0,l.jsx)("p",{children:t}):null]})]})}function te({error:e,title:t}){return e===null?null:(0,l.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,l.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,l.jsx)(re,{size:13})}),(0,l.jsxs)("div",{className:"hh-note-body",children:[(0,l.jsx)("strong",{children:t}),(0,l.jsxs)("p",{children:[(0,l.jsx)("code",{children:e.code})," \u2014 ",e.message]})]})]})}function Mt(){return(0,l.jsx)("span",{className:"hh-spinner","aria-hidden":"true"})}function S({children:e,onClick:t,disabled:n,busy:a,variant:o="default",icon:r,title:i}){let s=n===!0||a===!0;return(0,l.jsxs)("button",{type:"button",className:It("hh-btn",o!=="default"&&`hh-btn-${o}`),onClick:t,disabled:s,title:i,children:[a===!0?(0,l.jsx)(Mt,{}):r,e]})}function ne({label:e,checked:t,disabled:n,onChange:a}){return(0,l.jsxs)("button",{type:"button",role:"switch",className:"hh-switch","aria-checked":t,disabled:n,onClick:()=>a(!t),children:[(0,l.jsx)("span",{className:"hh-switch-track","aria-hidden":"true",children:(0,l.jsx)("span",{className:"hh-switch-knob"})}),(0,l.jsx)("span",{className:"hh-check-label",children:e})]})}function Ye({label:e,checked:t,disabled:n,onChange:a}){return(0,l.jsxs)("label",{className:"hh-check",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,disabled:n,onChange:o=>a(o.target.checked)}),(0,l.jsx)("span",{className:"hh-check-label",children:e})]})}function le({value:e,options:t,disabled:n,label:a,onChange:o}){return(0,l.jsx)("select",{className:"hh-select",value:e,disabled:n,"aria-label":a,onChange:r=>o(r.target.value),children:t.map(r=>(0,l.jsx)("option",{value:r.value,children:r.label},r.value))})}function me({label:e,meta:t,path:n,hint:a,checked:o,disabled:r,onChange:i}){return(0,l.jsxs)("label",{className:"hh-choice-option","data-disabled":r===!0,children:[(0,l.jsx)("input",{type:"radio",checked:o,disabled:r,onChange:()=>i()}),(0,l.jsxs)("span",{className:"hh-choice-label",children:[(0,l.jsx)("span",{children:e}),a]}),t===void 0?null:(0,l.jsx)("span",{className:"hh-choice-meta",children:t}),n===void 0?null:(0,l.jsx)("span",{className:"hh-choice-path",title:n,children:se(n)})]})}function qe({children:e}){return(0,l.jsxs)(R,{tone:"accent",children:[(0,l.jsx)(Le,{size:10}),e]})}function oe({text:e,copyLabel:t,copiedLabel:n}){let[a,o]=(0,We.useState)(!1);return(0,l.jsxs)("div",{className:"hh-code-box",children:[(0,l.jsx)("textarea",{className:"hh-code-text",readOnly:!0,value:e,rows:Math.min(e.split(`
|
|
4
|
-
`).length,4)}),(0,
|
|
5
|
-
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null]}):null,
|
|
6
|
-
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null,(0,
|
|
7
|
-
`),copyLabel:e("copy"),copiedLabel:e("copied")}),(0,
|
|
3
|
+
"use strict";var de=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var Et=(e,t)=>{for(var n in t)de(e,n,{get:t[n],enumerable:!0})},Rt=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pt(t))!Nt.call(e,o)&&o!==n&&de(e,o,{get:()=>t[o],enumerable:!(a=Ct(t,o))||a.enumerable});return e};var At=e=>Rt(de({},"__esModule",{value:!0}),e);var nn={};Et(nn,{apply:()=>tn,inject:()=>en});module.exports=At(nn);var re="homeHosted",pe={tab:"Home Hosted",loading:"Loading\u2026",refresh:"Refresh",retry:"Retry",errorTitle:"Error",statusUnavailable:"The panel did not answer.",yes:"Yes",no:"No",copy:"Copy",copied:"Copied",details:"Details",uiStyleLabel:"Page style",uiStyleDetailed:"Detailed",uiStyleCompact:"Compact",sigPanel:"Panel",sigAutostart:"Autostart",sigEntry:"{id} entry",stateAnswering:"answering",stateNotAnswering:"not answering",stateManaged:"managed",stateNotManaged:"not managed",panelTitle:"Panel",panelCopy:"Which copy runs the panel",panelCopyHint:"The pinned copy ships with this plugin; the global one is on PATH.",optionsPreferPinned:"Pinned dependency",optionsPreferGlobal:"Global install",optionsRecommended:"recommended",optionsConfigOverride:"The plugin row sets homeHostedCommand, and that always wins.",optionsInstallLabel:"Install a global copy",optionsInstallHint:"No global install was found. Install the pinned range, then choose it above:",optionsInstall:"Install globally",panelHome:"$HHOSTED_HOME",panelUrl:"URL",panelVersion:"Version",panelPid:"PID",panelWriteVia:"Writes via",panelToken:"API token",panelCliSource:"CLI",panelCliPath:"CLI path",panelCliConfig:"configured command",panelCliDependency:"pinned dependency",panelCliPathSource:"global install (PATH)",panelCliMissing:"not found",panelCliNotPinned:"This host resolved a global home-hosted instead of the pinned copy ({range}).",panelCliUnsupported:"This home-hosted is older than the oldest release the plugin supports.",panelCliLauncherFailed:"The boot launcher did not answer, so a boot entry may fail to start the panel.",panelPort:"Panel port",panelPortHint:"Only changeable while the panel is stopped.",panelPortFree:"Leave empty to use the port in the config.",panelPortInvalid:"Enter a port between 1 and 65535.",panelStart:"Start the panel",panelStop:"Stop the panel",panelStopTitle:"Stop the running panel?",panelStopBody:"This stops the panel and every server it supervises \u2014 this session included, so the page may disconnect. An autostart entry starts them again at the next panel start.",panelStopping:"Stopping the panel\u2026",panelStopped:"The panel stopped.",panelStopFailed:"The panel did not stop: {message}",panelRootLabel:"Panel root",panelRootLegacy:"Adopted from ~/.home-hosted. Set HHOSTED_HOME to give this dsh its own panel.",confirmStop:"Stop",panelReplace:"Replace with {copy}",panelCopyPinned:"pinned dependency",panelCopyGlobal:"global install",panelTakeoverTitle:"Replace the running panel?",panelTakeoverBody:"This stops the panel and every server it supervises \u2014 this session included, so the page disconnects. It needs the {id} entry adopted with autostart on.",confirmCancel:"Cancel",confirmReplace:"Replace",writeViaApi:"authenticated API",writeViaFile:"config file",writeViaNone:"unavailable",tokenEnrolled:"enrolled",tokenPresent:"present",tokenAbsent:"absent",tokenStale:"stale",tokenUnknown:"unknown",panelTokenWarningTitle:"The panel API token is missing or refused",panelTokenWarnAbsent:"This plugin has no API token for the panel, so it cannot read or write the panel; regenerate one.",panelTokenWarnPresent:"home-hosted holds an API token this plugin does not have, so the plugin cannot authenticate; regenerate one to replace it.",panelTokenWarnStale:"The panel refused this plugin's API token; regenerate it.",panelTokenWarnUnreachable:"The plugin could not reach the panel to check its API token, so it cannot read or write the panel; the panel may need starting.",panelTokenWarnPanelDown:"The panel is not answering right now, so it may need starting too.",panelTokenRegenerate:"Regenerate token",panelTokenRegenerated:"A fresh API token was enrolled for the panel.",panelTokenRegenerateFailed:"The token was not replaced: {message}",panelInstances:"{count} panels found",panelInstanceManaged:"managed by this plugin",panelInstanceOther:"another panel",panelInstanceHosts:"hosts this dsh",panelInstancesHint:"This plugin drives only the managed one; the others are read from their state roots and never written to.",bootTitle:"Autostart",bootEnabled:"Enable autostart",bootUninstall:"Uninstall",bootSwitchMode:"Switch autostart",bootRecheck:"Re-check",bootMechanism:"Mechanism",bootMechanismAuto:"Automatic",bootState:"State",bootStateNotInstalled:"not installed",bootStateInstalledDisabled:"installed, off",bootStateEnabledRunning:"enabled, running",bootStateEnabledFailing:"enabled, failing",bootStateUnsupported:"unsupported",bootBootCapable:"Starts before login",bootPrivileged:"This process can install it",bootUnitPath:"Unit path",bootCommandsLabel:"Install by hand",bootCommandsExplain:"This process cannot elevate. Run these commands to install autostart:",bootRequestedNotInstalled:"Autostart is requested, but no boot entry is installed.",bootActionInstall:"install",bootActionUninstall:"uninstall",bootAttemptFailed:"{action} failed",bootAttemptSucceeded:"{action} succeeded \u2014 {detail}",bootAttemptNoDetail:"The host did not explain the refusal.",bootAttemptCommands:"Run these yourself:",entriesTitle:"Managed entry",entriesManage:"Manage {id}",entriesManageNote:"Hands {id} to home-hosted: boot autostart, panel control, port reclaim.",entriesManageWinWarning:"On Windows, `{id}` is managed via the `kill` onPortConflict policy, so when it is restarted detached by another plugin it may briefly fail to boot while home-hosted reclaims the process and port.",entriesEmpty:"{id} is not managed yet.",entriesExists:"exists",entriesMissing:"missing",entriesManaged:"managed",entriesUnmanaged:"unmanaged",entriesDrift:"drift",entriesNotRunning:"not running",agentTitle:"Agent tools",agentCount:"{enabled} of {total} on",agentMaster:"Let the agent use these tools",agentApproval:"Tools that change something ask for approval first.",agentApprovalBadge:"approval",reclaimAutoLabel:"Regenerate token automatically",reclaimAutoHint:"A tool call that finds a refused token re-enrols one and retries instead of failing.",instancesNoticeLabel:"Tell the agent about other panels",instancesNoticeHint:"Adds the panel inventory to the agent's context, and asks which panel to act on when several exist.",agentToolStatus:"Status",agentToolServersList:"List servers",agentToolServersLifecycle:"Start, stop, restart",agentToolServersEdit:"Create, update, delete",agentToolAutostartManage:"Manage boot autostart",agentToolUiManage:"Manage Panel UI",agentToolDescStatus:"Read the panel, the CLI copy in use and the managed entry. Nothing changes.",agentToolDescServersList:"List the servers the panel supervises, with status, port and URL.",agentToolDescServersLifecycle:"Start, stop and restart supervised servers.",agentToolDescServersEdit:"Create, update and delete the panel's server entries.",agentToolDescAutostartManage:"Install or remove the boot entry that starts the panel.",agentToolDescUiManage:"Inspect, update, revert or switch the panel's own UI build.",serversTitle:"Servers",serversCount:"{running} of {total} running",serversHintPanel:"Entries are managed in the home-hosted panel:",serversHintNoPanel:"Entries cannot be managed right now: the panel is not running.",serversEmpty:"The panel reports no servers.",serversPid:"PID",serversUrl:"URL",serversCommand:"Command",serversArgs:"Args",serversCwd:"Working dir",serversPort:"Port",serversOnPortConflict:"On port conflict",serversAutostart:"Autostart",serversPersistent:"Persistent",serversPersistentHint:"Run by home-hosted's own nanny, so stopping or restarting the panel leaves it alive.",serversHealth:"Health",serversRestartPolicy:"Restart",serversConfiguration:"Configuration",serversRawConfig:"Raw config",serversDisabled:"disabled",serversEnabled:"enabled",serversHealthHttp:"HTTP {status} on {path}",serversHealthHttpBelow:"HTTP <{status} on {path}",serversHealthHttpProbe:"HTTP probe on {path}",serversHealthPort:"port {port}",serversHealthProbe:"port probe",serversHealthEvery:"every {seconds}",serversRestartSummary:"{retries} retries \xB7 {base} \u2192 \xD7{factor}",serversStart:"Start",serversStop:"Stop",serversRestart:"Restart"},xe={tab:"Home Hosted",loading:"\u52A0\u8F7D\u4E2D\u2026",refresh:"\u5237\u65B0",retry:"\u91CD\u8BD5",errorTitle:"\u9519\u8BEF",statusUnavailable:"\u9762\u677F\u6CA1\u6709\u54CD\u5E94\u3002",yes:"\u662F",no:"\u5426",copy:"\u590D\u5236",copied:"\u5DF2\u590D\u5236",details:"\u8BE6\u60C5",uiStyleLabel:"\u9875\u9762\u6837\u5F0F",uiStyleDetailed:"\u8BE6\u7EC6",uiStyleCompact:"\u7D27\u51D1",sigPanel:"\u9762\u677F",sigAutostart:"\u5F00\u673A\u81EA\u542F",sigEntry:"{id} \u6761\u76EE",stateAnswering:"\u54CD\u5E94\u4E2D",stateNotAnswering:"\u672A\u54CD\u5E94",stateManaged:"\u5DF2\u63A5\u7BA1",stateNotManaged:"\u672A\u63A5\u7BA1",panelTitle:"\u9762\u677F",panelCopy:"\u7531\u54EA\u4E2A\u526F\u672C\u8FD0\u884C\u9762\u677F",panelCopyHint:"\u56FA\u5B9A\u526F\u672C\u968F\u63D2\u4EF6\u4E00\u8D77\u5B89\u88C5\uFF1B\u5168\u5C40\u526F\u672C\u6765\u81EA PATH\u3002",optionsPreferPinned:"\u56FA\u5B9A\u4F9D\u8D56",optionsPreferGlobal:"\u5168\u5C40\u5B89\u88C5",optionsRecommended:"\u63A8\u8350",optionsConfigOverride:"\u63D2\u4EF6\u884C\u4E2D\u7684 homeHostedCommand \u4F18\u5148\u7EA7\u6700\u9AD8\uFF0C\u59CB\u7EC8\u751F\u6548\u3002",optionsInstallLabel:"\u5B89\u88C5\u5168\u5C40\u526F\u672C",optionsInstallHint:"\u672A\u627E\u5230\u5168\u5C40\u5B89\u88C5\u3002\u5B89\u88C5\u56FA\u5B9A\u7248\u672C\u8303\u56F4\u540E\uFF0C\u5728\u4E0A\u65B9\u9009\u62E9\u5B83\uFF1A",optionsInstall:"\u5168\u5C40\u5B89\u88C5",panelHome:"$HHOSTED_HOME",panelUrl:"URL",panelVersion:"\u7248\u672C",panelPid:"PID",panelWriteVia:"\u5199\u5165\u65B9\u5F0F",panelToken:"API \u4EE4\u724C",panelCliSource:"CLI",panelCliPath:"CLI \u8DEF\u5F84",panelCliConfig:"\u914D\u7F6E\u7684\u547D\u4EE4",panelCliDependency:"\u56FA\u5B9A\u7684\u4F9D\u8D56\u7248\u672C",panelCliPathSource:"\u5168\u5C40\u5B89\u88C5\uFF08PATH\uFF09",panelCliMissing:"\u672A\u627E\u5230",panelCliNotPinned:"\u6B64\u5BBF\u4E3B\u89E3\u6790\u5230\u7684\u662F\u5168\u5C40 home-hosted\uFF0C\u800C\u4E0D\u662F\u56FA\u5B9A\u526F\u672C\uFF08{range}\uFF09\u3002",panelCliUnsupported:"\u6B64 home-hosted \u65E9\u4E8E\u63D2\u4EF6\u652F\u6301\u7684\u6700\u8001\u7248\u672C\u3002",panelCliLauncherFailed:"\u5F00\u673A\u542F\u52A8\u5668\u6CA1\u6709\u5E94\u7B54\uFF0C\u5F00\u673A\u9879\u53EF\u80FD\u65E0\u6CD5\u542F\u52A8\u9762\u677F\u3002",panelPort:"\u9762\u677F\u7AEF\u53E3",panelPortHint:"\u4EC5\u5728\u9762\u677F\u505C\u6B62\u65F6\u53EF\u4FEE\u6539\u3002",panelPortFree:"\u7559\u7A7A\u5219\u4F7F\u7528\u914D\u7F6E\u6587\u4EF6\u4E2D\u7684\u7AEF\u53E3\u3002",panelPortInvalid:"\u8BF7\u8F93\u5165 1 \u5230 65535 \u4E4B\u95F4\u7684\u7AEF\u53E3\u3002",panelStart:"\u542F\u52A8\u9762\u677F",panelStop:"\u505C\u6B62\u9762\u677F",panelStopTitle:"\u505C\u6B62\u6B63\u5728\u8FD0\u884C\u7684\u9762\u677F\uFF1F",panelStopBody:"\u8FD9\u4F1A\u505C\u6B62\u9762\u677F\u4EE5\u53CA\u5B83\u76D1\u7BA1\u7684\u6240\u6709\u670D\u52A1\u5668\u2014\u2014\u5305\u62EC\u672C\u4F1A\u8BDD\uFF0C\u56E0\u6B64\u672C\u9875\u9762\u53EF\u80FD\u4F1A\u65AD\u5F00\u8FDE\u63A5\u3002\u5E26\u6709\u81EA\u542F\u7684\u6761\u76EE\u4F1A\u5728\u4E0B\u6B21\u542F\u52A8\u9762\u677F\u65F6\u91CD\u65B0\u542F\u52A8\u3002",panelStopping:"\u6B63\u5728\u505C\u6B62\u9762\u677F\u2026",panelStopped:"\u9762\u677F\u5DF2\u505C\u6B62\u3002",panelStopFailed:"\u9762\u677F\u672A\u80FD\u505C\u6B62\uFF1A{message}",panelRootLabel:"\u9762\u677F\u6839\u76EE\u5F55",panelRootLegacy:"\u6CBF\u7528\u4E86 ~/.home-hosted\u3002\u8BBE\u7F6E HHOSTED_HOME \u53EF\u8BA9\u6B64 dsh \u4F7F\u7528\u81EA\u5DF1\u7684\u9762\u677F\u3002",confirmStop:"\u505C\u6B62",panelReplace:"\u66FF\u6362\u4E3A{copy}",panelCopyPinned:"\u56FA\u5B9A\u4F9D\u8D56",panelCopyGlobal:"\u5168\u5C40\u5B89\u88C5",panelTakeoverTitle:"\u66FF\u6362\u6B63\u5728\u8FD0\u884C\u7684\u9762\u677F\uFF1F",panelTakeoverBody:"\u8FD9\u4F1A\u505C\u6B62\u9762\u677F\u4EE5\u53CA\u5B83\u76D1\u7BA1\u7684\u6240\u6709\u670D\u52A1\u5668\u2014\u2014\u5305\u62EC\u672C\u4F1A\u8BDD\uFF0C\u56E0\u6B64\u672C\u9875\u9762\u4F1A\u65AD\u5F00\u8FDE\u63A5\u3002\u4EC5\u5F53 {id} \u6761\u76EE\u5DF2\u88AB\u63A5\u7BA1\u4E14\u542F\u7528\u81EA\u542F\u65F6\u624D\u53EF\u7528\u3002",confirmCancel:"\u53D6\u6D88",confirmReplace:"\u66FF\u6362",writeViaApi:"\u5DF2\u8BA4\u8BC1 API",writeViaFile:"\u914D\u7F6E\u6587\u4EF6",writeViaNone:"\u4E0D\u53EF\u7528",tokenEnrolled:"\u5DF2\u767B\u8BB0",tokenPresent:"\u5DF2\u5B58\u5728",tokenAbsent:"\u4E0D\u5B58\u5728",tokenStale:"\u5DF2\u5931\u6548",tokenUnknown:"\u672A\u77E5",panelTokenWarningTitle:"\u9762\u677F API \u4EE4\u724C\u7F3A\u5931\u6216\u5DF2\u88AB\u62D2\u7EDD",panelTokenWarnAbsent:"\u672C\u63D2\u4EF6\u6CA1\u6709\u6B64\u9762\u677F\u7684 API \u4EE4\u724C\uFF0C\u65E0\u6CD5\u8BFB\u53D6\u6216\u5199\u5165\u9762\u677F\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u4E00\u4E2A\u3002",panelTokenWarnPresent:"home-hosted \u6301\u6709\u4E00\u4E2A\u672C\u63D2\u4EF6\u6CA1\u6709\u7684 API \u4EE4\u724C\uFF0C\u63D2\u4EF6\u65E0\u6CD5\u901A\u8FC7\u8BA4\u8BC1\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u4E00\u4E2A\u4EE5\u66FF\u6362\u5B83\u3002",panelTokenWarnStale:"\u9762\u677F\u62D2\u7EDD\u4E86\u672C\u63D2\u4EF6\u7684 API \u4EE4\u724C\uFF1B\u8BF7\u91CD\u65B0\u751F\u6210\u3002",panelTokenWarnUnreachable:"\u672C\u63D2\u4EF6\u65E0\u6CD5\u8BBF\u95EE\u9762\u677F\u4EE5\u68C0\u67E5\u5176 API \u4EE4\u724C\uFF0C\u56E0\u6B64\u65E0\u6CD5\u8BFB\u53D6\u6216\u5199\u5165\u9762\u677F\uFF1B\u9762\u677F\u53EF\u80FD\u8FD8\u9700\u8981\u5148\u542F\u52A8\u3002",panelTokenWarnPanelDown:"\u9762\u677F\u5F53\u524D\u6CA1\u6709\u54CD\u5E94\uFF0C\u53EF\u80FD\u8FD8\u9700\u8981\u5148\u542F\u52A8\u9762\u677F\u3002",panelTokenRegenerate:"\u91CD\u65B0\u751F\u6210\u4EE4\u724C",panelTokenRegenerated:"\u5DF2\u4E3A\u9762\u677F\u767B\u8BB0\u65B0\u4EE4\u724C\u3002",panelTokenRegenerateFailed:"\u4EE4\u724C\u672A\u66FF\u6362\uFF1A{message}",panelInstances:"\u53D1\u73B0 {count} \u4E2A\u9762\u677F",panelInstanceManaged:"\u7531\u672C\u63D2\u4EF6\u7BA1\u7406",panelInstanceOther:"\u5176\u4ED6\u9762\u677F",panelInstanceHosts:"\u6258\u7BA1\u5F53\u524D dsh",panelInstancesHint:"\u672C\u63D2\u4EF6\u53EA\u9A71\u52A8\u88AB\u7BA1\u7406\u7684\u90A3\u4E00\u4E2A\uFF1B\u5176\u4ED6\u9762\u677F\u4EC5\u4ECE\u5176\u72B6\u6001\u76EE\u5F55\u8BFB\u53D6\uFF0C\u7EDD\u4E0D\u5199\u5165\u3002",bootTitle:"\u5F00\u673A\u81EA\u542F",bootEnabled:"\u542F\u7528\u5F00\u673A\u81EA\u542F",bootUninstall:"\u5378\u8F7D",bootSwitchMode:"\u5207\u6362\u81EA\u542F\u673A\u5236",bootRecheck:"\u91CD\u65B0\u68C0\u67E5",bootMechanism:"\u673A\u5236",bootMechanismAuto:"\u81EA\u52A8",bootState:"\u72B6\u6001",bootStateNotInstalled:"\u672A\u5B89\u88C5",bootStateInstalledDisabled:"\u5DF2\u5B89\u88C5\uFF0C\u672A\u542F\u7528",bootStateEnabledRunning:"\u5DF2\u542F\u7528\uFF0C\u8FD0\u884C\u4E2D",bootStateEnabledFailing:"\u5DF2\u542F\u7528\uFF0C\u542F\u52A8\u5931\u8D25",bootStateUnsupported:"\u4E0D\u652F\u6301",bootBootCapable:"\u767B\u5F55\u524D\u542F\u52A8",bootPrivileged:"\u672C\u8FDB\u7A0B\u53EF\u5B89\u88C5",bootUnitPath:"\u5355\u5143\u6587\u4EF6\u8DEF\u5F84",bootCommandsLabel:"\u624B\u52A8\u5B89\u88C5",bootCommandsExplain:"\u672C\u8FDB\u7A0B\u65E0\u6CD5\u63D0\u6743\u3002\u8BF7\u81EA\u884C\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u6765\u5B89\u88C5\u81EA\u542F\uFF1A",bootRequestedNotInstalled:"\u5DF2\u8BF7\u6C42\u5F00\u673A\u81EA\u542F\uFF0C\u4F46\u5C1A\u672A\u5B89\u88C5\u4EFB\u4F55\u5F00\u673A\u9879\u3002",bootActionInstall:"\u5B89\u88C5",bootActionUninstall:"\u5378\u8F7D",bootAttemptFailed:"{action}\u5931\u8D25",bootAttemptSucceeded:"{action}\u6210\u529F \u2014 {detail}",bootAttemptNoDetail:"\u5BBF\u4E3B\u6CA1\u6709\u8BF4\u660E\u5931\u8D25\u539F\u56E0\u3002",bootAttemptCommands:"\u4F60\u53EF\u4EE5\u81EA\u884C\u8FD0\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF1A",entriesTitle:"\u53D7\u7BA1\u6761\u76EE",entriesManage:"\u63A5\u7BA1 {id}",entriesManageNote:"\u628A {id} \u4EA4\u7ED9 home-hosted\uFF1A\u5F00\u673A\u81EA\u542F\u3001\u9762\u677F\u63A7\u5236\u3001\u7AEF\u53E3\u56DE\u6536\u3002",entriesManageWinWarning:"\u5728 Windows \u4E0A\uFF0C`{id}` \u901A\u8FC7 `kill` \u7AEF\u53E3\u51B2\u7A81\u7B56\u7565\u7BA1\u7406\uFF1B\u5F53\u5B83\u88AB\u5176\u4ED6\u63D2\u4EF6\u4EE5\u5206\u79BB\u65B9\u5F0F\u91CD\u542F\u65F6\uFF0Chome-hosted \u56DE\u6536\u8FDB\u7A0B\u4E0E\u7AEF\u53E3\u671F\u95F4\u53EF\u80FD\u77ED\u6682\u65E0\u6CD5\u542F\u52A8\u3002",entriesEmpty:"\u5C1A\u672A\u63A5\u7BA1 {id}\u3002",entriesExists:"\u5B58\u5728",entriesMissing:"\u7F3A\u5931",entriesManaged:"\u5DF2\u63A5\u7BA1",entriesUnmanaged:"\u672A\u63A5\u7BA1",entriesDrift:"\u6F02\u79FB",entriesNotRunning:"\u672A\u8FD0\u884C",agentTitle:"Agent \u5DE5\u5177",agentCount:"\u5DF2\u5F00\u542F {enabled}/{total}",agentMaster:"\u5141\u8BB8 Agent \u8C03\u7528\u8FD9\u4E9B\u5DE5\u5177",agentApproval:"\u4F1A\u6539\u53D8\u72B6\u6001\u7684\u5DE5\u5177\u5728\u8FD0\u884C\u524D\u4F1A\u8BF7\u6C42\u6279\u51C6\u3002",agentApprovalBadge:"\u9700\u6279\u51C6",reclaimAutoLabel:"\u88AB\u62D2\u7EDD\u65F6\u81EA\u52A8\u91CD\u65B0\u751F\u6210\u4EE4\u724C",reclaimAutoHint:"\u5DE5\u5177\u8C03\u7528\u9047\u5230\u88AB\u62D2\u7EDD\u7684\u4EE4\u724C\u65F6\u4F1A\u91CD\u65B0\u767B\u8BB0\u5E76\u91CD\u8BD5\uFF0C\u800C\u4E0D\u662F\u76F4\u63A5\u5931\u8D25\u3002",instancesNoticeLabel:"\u5411 Agent \u8BF4\u660E\u5176\u4ED6\u9762\u677F",instancesNoticeHint:"\u628A\u9762\u677F\u6E05\u5355\u52A0\u5165 Agent \u4E0A\u4E0B\u6587\uFF1B\u5B58\u5728\u591A\u4E2A\u9762\u677F\u65F6\u4F1A\u5148\u8BE2\u95EE\u8981\u64CD\u4F5C\u54EA\u4E00\u4E2A\u3002",agentToolStatus:"\u67E5\u770B\u72B6\u6001",agentToolServersList:"\u5217\u51FA\u670D\u52A1\u5668",agentToolServersLifecycle:"\u542F\u52A8\u3001\u505C\u6B62\u3001\u91CD\u542F",agentToolServersEdit:"\u521B\u5EFA\u3001\u66F4\u65B0\u3001\u5220\u9664",agentToolAutostartManage:"\u7BA1\u7406\u5F00\u673A\u81EA\u542F",agentToolUiManage:"\u7BA1\u7406\u9762\u677F UI",agentToolDescStatus:"\u8BFB\u53D6\u9762\u677F\u3001\u6B63\u5728\u4F7F\u7528\u7684 CLI \u526F\u672C\u548C\u53D7\u7BA1\u6761\u76EE\u3002\u4E0D\u6539\u53D8\u4EFB\u4F55\u72B6\u6001\u3002",agentToolDescServersList:"\u5217\u51FA\u9762\u677F\u76D1\u7BA1\u7684\u670D\u52A1\u5668\u53CA\u5176\u72B6\u6001\u3001\u7AEF\u53E3\u548C URL\u3002",agentToolDescServersLifecycle:"\u542F\u52A8\u3001\u505C\u6B62\u548C\u91CD\u542F\u53D7\u76D1\u7BA1\u7684\u670D\u52A1\u5668\u3002",agentToolDescServersEdit:"\u521B\u5EFA\u3001\u66F4\u65B0\u548C\u5220\u9664\u9762\u677F\u7684\u670D\u52A1\u5668\u6761\u76EE\u3002",agentToolDescAutostartManage:"\u5B89\u88C5\u6216\u79FB\u9664\u542F\u52A8\u9762\u677F\u7684\u5F00\u673A\u9879\u3002",agentToolDescUiManage:"\u67E5\u770B\u3001\u66F4\u65B0\u3001\u56DE\u9000\u6216\u5207\u6362\u9762\u677F\u81EA\u8EAB\u7684 UI \u6784\u5EFA\u3002",serversTitle:"\u670D\u52A1\u5668",serversCount:"{total} \u4E2A\u4E2D {running} \u4E2A\u8FD0\u884C\u4E2D",serversHintPanel:"\u5728 home-hosted \u9762\u677F\u4E2D\u7BA1\u7406\u6761\u76EE\uFF1A",serversHintNoPanel:"\u5F53\u524D\u65E0\u6CD5\u7BA1\u7406\u6761\u76EE\uFF1A\u9762\u677F\u6CA1\u6709\u8FD0\u884C\u3002",serversEmpty:"\u9762\u677F\u672A\u62A5\u544A\u4EFB\u4F55\u670D\u52A1\u5668\u3002",serversPid:"PID",serversUrl:"URL",serversCommand:"\u547D\u4EE4",serversArgs:"\u53C2\u6570",serversCwd:"\u5DE5\u4F5C\u76EE\u5F55",serversPort:"\u7AEF\u53E3",serversOnPortConflict:"\u7AEF\u53E3\u51B2\u7A81\u65F6",serversAutostart:"\u81EA\u542F",serversPersistent:"\u6301\u4E45\u5316",serversPersistentHint:"\u7531 home-hosted \u81EA\u5E26\u7684 nanny \u6258\u7BA1\uFF0C\u505C\u6B62\u6216\u91CD\u542F\u9762\u677F\u4E0D\u4F1A\u505C\u6B62\u5B83\u3002",serversHealth:"\u5065\u5EB7\u68C0\u67E5",serversRestartPolicy:"\u91CD\u542F",serversConfiguration:"\u914D\u7F6E",serversRawConfig:"\u539F\u59CB\u914D\u7F6E",serversDisabled:"\u5DF2\u505C\u7528",serversEnabled:"\u5DF2\u542F\u7528",serversHealthHttp:"HTTP {status} \u4E8E {path}",serversHealthHttpBelow:"HTTP <{status} \u4E8E {path}",serversHealthHttpProbe:"HTTP \u63A2\u6D4B {path}",serversHealthPort:"\u7AEF\u53E3 {port}",serversHealthProbe:"\u7AEF\u53E3\u63A2\u6D4B",serversHealthEvery:"\u6BCF {seconds}",serversRestartSummary:"{retries} \u6B21\u91CD\u8BD5 \xB7 {base} \u2192 \xD7{factor}",serversStart:"\u542F\u52A8",serversStop:"\u505C\u6B62",serversRestart:"\u91CD\u542F"};function Ht(e,t){return t===void 0?e:e.replace(/\{(\w+)\}/g,(n,a)=>Object.prototype.hasOwnProperty.call(t,a)?String(t[a]):n)}var Se=(e,t)=>Ht(pe[e]??e,t);function we(e){if(e!==void 0)try{let t=e.bind(re);if(typeof t=="function")return t}catch{}return Se}function ke(e,t=Se){return e===void 0?t:(n,a)=>{let o;try{o=e(n,a)}catch{o=void 0}return o===void 0||o.length===0||o===n?t(n,a):o}}var j=require("react");var _=require("react");var Te="/home-hosted";var Y=["status","servers_list","servers_lifecycle","servers_edit","autostart_manage","ui_manage"],Ce=["servers_lifecycle","servers_edit","autostart_manage","ui_manage"],It=3,rn={version:It,autostart:{enabled:!1,mechanism:"auto"},manageDsh:!1,entries:[],agentTools:{enabled:!0,allow:[...Y]},panel:{port:null},authNotice:!0,reclaimToken:!0,instancesNotice:!0,uiStyle:"detailed",cli:{prefer:"pinned"}};var Mt="/api";function M(e,t,n){return{ok:!1,error:n===void 0?{code:e,message:t}:{code:e,message:t,detail:n}}}function he(e){return typeof e=="object"&&e!==null}function Lt(e){return e instanceof Error?e.message:String(e)}function Bt(e){if(!he(e))return M("bad-response","The panel returned a non-object response");if(typeof e.v=="number"&&e.v!==1)return M("version-mismatch",`Response protocol v${e.v} does not match the expected v${1}`);let t=e.result;if(!he(t))return M("bad-response","The panel returned no result");if(t.ok===!0)return"value"in t?{ok:!0,value:t.value}:M("bad-response","A successful response carried no value");if(t.ok===!1){let n=t.error;return he(n)&&typeof n.message=="string"?M(typeof n.code=="string"?n.code:"error",n.message,n.detail):M("error","The panel reported a failure without a message")}return M("bad-response","The panel returned an unrecognised result")}async function k(e,t,n={}){let a=n.fetch??globalThis.fetch;if(typeof a!="function")return M("no-fetch","No fetch implementation is available");let o={v:1,endpoint:e,payload:t},i;try{i=await a(`${Mt}${Te}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(o)})}catch(l){return M("network",Lt(l))}if(!i.ok){let l=i.statusText.length>0?` ${i.statusText}`:"";return M("http",`HTTP ${i.status}${l}`)}let s;try{s=await i.json()}catch{return M("bad-json","The panel returned invalid JSON")}return Bt(s)}function Pe(e,t={}){return k("settings.update",{patch:e},t)}var Ot=5e3;function Ne(e=Ot){let[t,n]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[i,s]=(0,_.useState)(!0),l=(0,_.useRef)(!0),h=(0,_.useCallback)(async()=>{let c=await k("status",{});l.current&&(c.ok?(n(c.value),o(null)):o(c.error),s(!1))},[]);return(0,_.useEffect)(()=>{l.current=!0,h();let c=setInterval(()=>{h()},e);return()=>{l.current=!1,clearInterval(c)}},[h,e]),{data:t,error:a,loading:i,refresh:h}}var m=require("react/jsx-runtime");function U({size:e=14,children:t}){return(0,m.jsx)("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:t})}function Ee(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("rect",{x:"2.2",y:"3",width:"11.6",height:"7.6",rx:"1.6"}),(0,m.jsx)("path",{d:"M6.6 13.4h2.8M8 10.6v2.8"})]})}function Re(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M8 2.4v5.2"}),(0,m.jsx)("path",{d:"M11.6 4.4a5 5 0 1 1-7.2 0"})]})}function Ae(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("rect",{x:"2.2",y:"2.8",width:"11.6",height:"10.4",rx:"1.6"}),(0,m.jsx)("path",{d:"M5.2 6.9l1.8 1.8-1.8 1.8M8.7 10.5h2.2"})]})}function He(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M2.4 5.4h11.2M2.4 10.6h11.2"}),(0,m.jsx)("circle",{cx:"6",cy:"5.4",r:"1.6",fill:"currentColor",stroke:"none"}),(0,m.jsx)("circle",{cx:"10.4",cy:"10.6",r:"1.6",fill:"currentColor",stroke:"none"})]})}function Ie(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M8 2.3l5.4 2.9L8 8.1 2.6 5.2z"}),(0,m.jsx)("path",{d:"M2.6 8.6l5.4 2.9 5.4-2.9"}),(0,m.jsx)("path",{d:"M2.6 11.4l5.4 2.9 5.4-2.9"})]})}function Me(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M13.4 9.4A5.5 5.5 0 1 1 12.2 4.4"}),(0,m.jsx)("path",{d:"M12.8 1.7v2.9h-2.9"})]})}function Le(e){return(0,m.jsx)(U,{...e,children:(0,m.jsx)("path",{d:"M6.2 3.8L10.4 8l-4.2 4.2"})})}function Be(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M6.6 3.4H3.4v9.2h9.2V9.4"}),(0,m.jsx)("path",{d:"M9.4 3.4h3.2v3.2M12.6 3.4L7.8 8.2"})]})}function ie(e){return(0,m.jsxs)(U,{...e,children:[(0,m.jsx)("path",{d:"M8 2.6l5.7 10.2H2.3z"}),(0,m.jsx)("path",{d:"M8 6.4v3.1M8 11.5h.01"})]})}function Oe(e){return(0,m.jsx)(U,{...e,children:(0,m.jsx)("path",{d:"M3 8.4l3.3 3.3L13 5"})})}var L="\u2014";function x(e){if(e==null)return L;let t=String(e);return t.length>0?t:L}function _e(e){return e.length>0?e.join(", "):L}function ge(e){return Ce.includes(e)}var me={status:"agentToolStatus",servers_list:"agentToolServersList",servers_lifecycle:"agentToolServersLifecycle",servers_edit:"agentToolServersEdit",autostart_manage:"agentToolAutostartManage",ui_manage:"agentToolUiManage"},Ue={status:"agentToolDescStatus",servers_list:"agentToolDescServersList",servers_lifecycle:"agentToolDescServersLifecycle",servers_edit:"agentToolDescServersEdit",autostart_manage:"agentToolDescAutostartManage",ui_manage:"agentToolDescUiManage"},De={api:"writeViaApi",file:"writeViaFile",none:"writeViaNone"},Fe={enrolled:"tokenEnrolled",present:"tokenPresent",absent:"tokenAbsent",stale:"tokenStale",unknown:"tokenUnknown"},se={"not-installed":"bootStateNotInstalled","installed-disabled":"bootStateInstalledDisabled","enabled-running":"bootStateEnabledRunning","enabled-failing":"bootStateEnabledFailing",unsupported:"bootStateUnsupported"},$e={config:"panelCliConfig",dependency:"panelCliDependency",path:"panelCliPathSource",none:"panelCliMissing"};function le(e,t=52){if(e.length<=t)return e;let n=e.includes("\\")?"\\":"/",a=e.split(/[\\/]/).filter(l=>l.length>0);if(a.length<4)return e;let o=/^[A-Za-z]:$/.test(a[0]??"")?3:2;if(a.length<=o)return e;let s=`${/^[\\/]/.test(e)?n:""}${a.slice(0,o).join(n)}${n}\u2026${n}${a.slice(-2).join(n)}`;return s.length<e.length?s:e}function Ve(e){let t=n=>e.source===n&&e.path!==null?{source:n,path:e.path,version:e.version}:null;return{dependency:e.dependency??t("dependency"),global:e.global??t("path")}}function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _t(e,t){if(Object.is(e,t))return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function ze(e,t){let n={};for(let a of Object.keys(t)){let o=e[a],i=t[a];if(je(o)&&je(i)){let s=ze(o,i);Object.keys(s).length>0&&(n[a]=s)}else _t(o,i)||(n[a]=i)}return n}function Ge(e,t){return ze(e,t)}function We(e,t,n){let a=new Set(e);return n?a.add(t):a.delete(t),Y.filter(o=>a.has(o))}var Ye=require("react");async function Ke(e){try{if(typeof navigator<"u"&&navigator.clipboard!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var d=require("react/jsx-runtime");function Ut(...e){return e.filter(t=>typeof t=="string"&&t.length>0).join(" ")}function D({icon:e,title:t,action:n,children:a}){return(0,d.jsxs)("section",{className:"hh-section",children:[(0,d.jsxs)("header",{className:"hh-section-head",children:[e===void 0?null:(0,d.jsx)("span",{className:"hh-section-icon",children:e}),(0,d.jsx)("h3",{className:"hh-section-title",children:t}),(0,d.jsx)("span",{className:"hh-section-rule","aria-hidden":"true"}),n===void 0?null:(0,d.jsx)("span",{className:"hh-section-action",children:n})]}),(0,d.jsx)("div",{className:"hh-section-body",children:a})]})}function y({label:e,children:t}){return(0,d.jsxs)("div",{className:"hh-spec",children:[(0,d.jsx)("span",{className:"hh-spec-label",children:e}),(0,d.jsx)("span",{className:"hh-spec-value",children:t})]})}function B({children:e}){return(0,d.jsx)("code",{className:"hh-code",children:e})}function f({children:e}){return typeof e=="string"&&e.length===0?null:(0,d.jsx)("p",{className:"hh-hint",children:e})}function R({tone:e,children:t}){return(0,d.jsx)("span",{className:"hh-chip","data-tone":e??"idle",children:t})}function $({href:e,children:t}){return(0,d.jsxs)("a",{className:"hh-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t??e,(0,d.jsx)("span",{className:"hh-link-icon","aria-hidden":"true",children:(0,d.jsx)(Be,{size:11})})]})}function F({label:e,open:t=!1,children:n}){return(0,d.jsxs)("details",{className:"hh-details",open:t||void 0,children:[(0,d.jsxs)("summary",{className:"hh-summary",children:[(0,d.jsx)("span",{className:"hh-chevron","aria-hidden":"true",children:(0,d.jsx)(Le,{size:12})}),e]}),(0,d.jsx)("div",{className:"hh-details-body",children:n})]})}function q({tone:e="bad",icon:t=!0,title:n,children:a}){return(0,d.jsxs)("div",{className:"hh-note","data-tone":e,role:e==="bad"?"alert":"note",children:[t?(0,d.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,d.jsx)(ie,{size:13})}):null,(0,d.jsxs)("div",{className:"hh-note-body",children:[n===void 0?null:(0,d.jsx)("span",{className:"hh-note-title",children:n}),typeof a=="string"?(0,d.jsx)("p",{children:a}):a]})]})}function qe({title:e,detail:t}){return(0,d.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,d.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,d.jsx)(ie,{size:13})}),(0,d.jsxs)("div",{className:"hh-note-body",children:[(0,d.jsx)("strong",{children:e}),t.length>0?(0,d.jsx)("p",{children:t}):null]})]})}function oe({error:e,title:t}){return e===null?null:(0,d.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,d.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,d.jsx)(ie,{size:13})}),(0,d.jsxs)("div",{className:"hh-note-body",children:[(0,d.jsx)("strong",{children:t}),(0,d.jsxs)("p",{children:[(0,d.jsx)("code",{children:e.code})," \u2014 ",e.message]})]})]})}function Dt(){return(0,d.jsx)("span",{className:"hh-spinner","aria-hidden":"true"})}function S({children:e,onClick:t,disabled:n,busy:a,variant:o="default",icon:i,title:s}){let l=n===!0||a===!0;return(0,d.jsxs)("button",{type:"button",className:Ut("hh-btn",o!=="default"&&`hh-btn-${o}`),onClick:t,disabled:l,title:s,children:[a===!0?(0,d.jsx)(Dt,{}):i,e]})}function Q({label:e,checked:t,disabled:n,onChange:a}){return(0,d.jsxs)("button",{type:"button",role:"switch",className:"hh-switch","aria-checked":t,disabled:n,onClick:()=>a(!t),children:[(0,d.jsx)("span",{className:"hh-switch-track","aria-hidden":"true",children:(0,d.jsx)("span",{className:"hh-switch-knob"})}),(0,d.jsx)("span",{className:"hh-check-label",children:e})]})}function Je({label:e,checked:t,disabled:n,onChange:a}){return(0,d.jsxs)("label",{className:"hh-check",children:[(0,d.jsx)("input",{type:"checkbox",checked:t,disabled:n,onChange:o=>a(o.target.checked)}),(0,d.jsx)("span",{className:"hh-check-label",children:e})]})}function ce({value:e,options:t,disabled:n,label:a,onChange:o}){return(0,d.jsx)("select",{className:"hh-select",value:e,disabled:n,"aria-label":a,onChange:i=>o(i.target.value),children:t.map(i=>(0,d.jsx)("option",{value:i.value,children:i.label},i.value))})}function fe({label:e,meta:t,path:n,hint:a,checked:o,disabled:i,onChange:s}){return(0,d.jsxs)("label",{className:"hh-choice-option","data-disabled":i===!0,children:[(0,d.jsx)("input",{type:"radio",checked:o,disabled:i,onChange:()=>s()}),(0,d.jsxs)("span",{className:"hh-choice-label",children:[(0,d.jsx)("span",{children:e}),a]}),t===void 0?null:(0,d.jsx)("span",{className:"hh-choice-meta",children:t}),n===void 0?null:(0,d.jsx)("span",{className:"hh-choice-path",title:n,children:le(n)})]})}function Xe({children:e}){return(0,d.jsxs)(R,{tone:"accent",children:[(0,d.jsx)(Oe,{size:10}),e]})}function ae({text:e,copyLabel:t,copiedLabel:n}){let[a,o]=(0,Ye.useState)(!1);return(0,d.jsxs)("div",{className:"hh-code-box",children:[(0,d.jsx)("textarea",{className:"hh-code-text",readOnly:!0,value:e,rows:Math.min(e.split(`
|
|
4
|
+
`).length,4)}),(0,d.jsx)("div",{className:"hh-btn-row",children:(0,d.jsx)(S,{variant:"ghost",onClick:()=>{Ke(e).then(o)},children:a?n:t})})]})}var b=require("react/jsx-runtime");function Ze({t:e,status:t,updateSettings:n,busy:a,uiStyle:o}){let i=t.settings.agentTools,s=i.allow??[],l=Y.filter(c=>s.includes(c)).length,h=(c,u)=>{n(T=>({...T,agentTools:{...T.agentTools,allow:We(T.agentTools.allow??[],c,u)}}))};return(0,b.jsxs)(D,{icon:(0,b.jsx)(He,{}),title:e("agentTitle"),action:(0,b.jsx)(R,{children:e("agentCount",{enabled:l,total:Y.length})}),children:[(0,b.jsx)(Q,{label:e("agentMaster"),checked:i.enabled,onChange:c=>n(u=>({...u,agentTools:{...u.agentTools,enabled:c}}))}),(0,b.jsxs)("div",{className:"hh-field-block",children:[(0,b.jsx)(Q,{label:e("reclaimAutoLabel"),checked:t.settings.reclaimToken!==!1,disabled:a==="settings",onChange:c=>n(u=>({...u,reclaimToken:c}))}),(0,b.jsx)(f,{children:e("reclaimAutoHint")})]}),(0,b.jsxs)("div",{className:"hh-field-block",children:[(0,b.jsx)(Q,{label:e("instancesNoticeLabel"),checked:t.settings.instancesNotice!==!1,disabled:a==="settings",onChange:c=>n(u=>({...u,instancesNotice:c}))}),(0,b.jsx)(f,{children:e("instancesNoticeHint")})]}),(0,b.jsx)(f,{children:e("agentApproval")}),o==="detailed"?(0,b.jsx)("div",{className:"hh-tool-cards",children:Y.map(c=>(0,b.jsxs)("label",{className:"hh-tool-card",children:[(0,b.jsx)("input",{type:"checkbox",checked:s.includes(c),disabled:!i.enabled,onChange:u=>h(c,u.target.checked)}),(0,b.jsxs)("span",{className:"hh-tool-card-body",children:[(0,b.jsxs)("span",{className:"hh-tool-card-head",children:[(0,b.jsx)("span",{className:"hh-tool-card-name",children:e(me[c])}),ge(c)?(0,b.jsx)(R,{tone:"warn",children:e("agentApprovalBadge")}):null]}),(0,b.jsx)("span",{className:"hh-tool-card-desc",children:e(Ue[c])})]})]},c))}):(0,b.jsx)("div",{className:"hh-tools",children:Y.map(c=>(0,b.jsx)(Je,{label:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"hh-check-text",children:e(me[c])}),ge(c)?(0,b.jsx)(R,{tone:"warn",children:e("agentApprovalBadge")}):null]}),checked:s.includes(c),disabled:!i.enabled,onChange:u=>h(c,u)},c))})]})}var rt=require("react");function Qe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function et(e){if(typeof e!="object"||e===null)return null;let t=e.result;if(typeof t!="object"||t===null)return null;let{ok:n,detail:a,commands:o}=t;return n!==!1?null:{detail:typeof a=="string"?a:"",commands:Qe(o)}}function tt(e){return e===void 0?null:{ok:e.ok===!0,action:e.action==="uninstall"?"uninstall":"install",detail:typeof e.detail=="string"?e.detail:"",commands:Qe(e.commands)}}var Ft=["enabled-running","enabled-failing","installed-disabled"];function nt(e,t){let n=e.filter(i=>i.available).map(i=>i.mechanism),a=n.filter(i=>i!=="unsupported"),o=["auto",...a.length>0?a:n];return o.includes(t)||o.push(t),o}function ot(e,t){return e!==null&&e!==t}function at(e,t){return e===null||e.ok?!1:e.action==="install"?Ft.includes(t):t==="not-installed"}var v=require("react/jsx-runtime");function it({t:e,status:t,run:n,updateSettings:a,busy:o,uiStyle:i}){let s=t.boot,l=t.settings.autostart,h=s.candidates??[],c=s.commands??[],[u,T]=(0,rt.useState)(null),N=o==="boot.install"||o==="boot.uninstall",X=nt(h,l.mechanism).map(H=>({value:H,label:H==="auto"?e("bootMechanismAuto"):H})),te=ot(s.mechanism,l.mechanism),O=s.mechanism!==null,C=H=>e(H==="install"?"bootActionInstall":"bootActionUninstall"),I=async H=>{let G=await n(`boot.${H}`,async()=>H==="install"?k("boot.install",l.mechanism==="auto"?{}:{mechanism:l.mechanism}):k("boot.uninstall",{}));if(!G.ok){T(null);return}let W=et(G.value);T(W===null?null:{ok:!1,action:H,detail:W.detail,commands:W.commands})},A=tt(l.lastAttempt),Z=at(A,s.state),E=u??(Z?null:A);return(0,v.jsxs)(D,{icon:(0,v.jsx)(Re,{}),title:e("bootTitle"),action:(0,v.jsx)(ce,{value:l.mechanism,options:X,label:e("bootMechanism"),disabled:o==="settings"||N,onChange:H=>a(G=>({...G,autostart:{...G.autostart,mechanism:H}}))}),children:[(0,v.jsxs)("div",{className:"hh-btn-row",children:[(0,v.jsx)(S,{variant:O?"default":"primary",disabled:l.mechanism==="unsupported",busy:o==="boot.install",onClick:()=>{I("install")},children:e(te?"bootSwitchMode":"bootEnabled")}),(0,v.jsx)(S,{disabled:!O,busy:o==="boot.uninstall",onClick:()=>{I("uninstall")},children:e("bootUninstall")}),(0,v.jsx)(S,{variant:"ghost",busy:o==="boot.verify",onClick:()=>{n("boot.verify",()=>k("boot.verify",{}))},children:e("bootRecheck")})]}),l.enabled&&s.state==="not-installed"?(0,v.jsx)(q,{tone:"warn",children:e("bootRequestedNotInstalled")}):null,E!==null&&!E.ok?(0,v.jsxs)("div",{className:"hh-section-body",children:[(0,v.jsx)(qe,{title:e("bootAttemptFailed",{action:C(E.action)}),detail:E.detail.length>0?E.detail:e("bootAttemptNoDetail")}),E.commands.length>0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(f,{children:e("bootAttemptCommands")}),(0,v.jsx)(ae,{text:E.commands.join(`
|
|
5
|
+
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null]}):null,E!==null&&E.ok?(0,v.jsx)(f,{children:e("bootAttemptSucceeded",{action:C(E.action),detail:E.detail})}):null,c.length>0?(0,v.jsxs)(F,{label:e("bootCommandsLabel"),open:i==="detailed",children:[(0,v.jsx)(f,{children:e("bootCommandsExplain")}),(0,v.jsx)(ae,{text:c.join(`
|
|
6
|
+
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null,(0,v.jsxs)(F,{label:e("details"),open:i==="detailed",children:[(0,v.jsx)(y,{label:e("bootState"),children:e(se[s.state]??"bootStateUnsupported")}),(0,v.jsx)(y,{label:e("bootBootCapable"),children:s.bootCapable?e("yes"):e("no")}),(0,v.jsx)(y,{label:e("bootPrivileged"),children:s.privileged?e("yes"):e("no")}),(0,v.jsx)(y,{label:e("bootUnitPath"),children:(0,v.jsx)(B,{children:x(s.unitPath)})}),s.detail.length>0?(0,v.jsx)(f,{children:s.detail}):null]})]})}var P=require("react/jsx-runtime");function $t(e){return e.defaultEntryId??"dsh"}function st({t:e,status:t,run:n,busy:a}){let o=t.entries??[],i=t.settings.manageDsh===!0,s=t.boot.platform==="win32",l=$t(t),h=c=>{if(c){let u={id:l,autostart:!0};n("entries.apply",()=>k("entries.apply",{intents:[u]}))}else n("entries.remove",()=>k("entries.remove",{id:l}))};return(0,P.jsxs)(D,{icon:(0,P.jsx)(Ae,{}),title:e("entriesTitle"),children:[(0,P.jsx)(Q,{label:e("entriesManage",{id:l}),checked:i,disabled:a!==null,onChange:h}),(0,P.jsx)(f,{children:e("entriesManageNote",{id:l})}),s?(0,P.jsx)(q,{tone:"warn",children:e("entriesManageWinWarning",{id:l})}):null,o.length===0?(0,P.jsx)(f,{children:e("entriesEmpty",{id:l})}):(0,P.jsx)("div",{className:"hh-list",children:o.map(c=>{let u=c.live;return(0,P.jsxs)("div",{className:"hh-item",children:[(0,P.jsxs)("span",{className:"hh-item-main",children:[(0,P.jsx)("span",{className:"hh-item-name",children:c.intent.id}),(0,P.jsx)(R,{tone:c.exists?"ok":"bad",children:c.exists?e("entriesExists"):e("entriesMissing")}),(0,P.jsx)(R,{children:c.managed?e("entriesManaged"):e("entriesUnmanaged")}),c.drift.length>0?(0,P.jsx)(R,{tone:"warn",children:`${e("entriesDrift")} ${_e(c.drift)}`}):null]}),(0,P.jsx)("span",{className:"hh-item-spacer"}),(0,P.jsx)("span",{className:"hh-item-meta",children:u===null?e("entriesNotRunning"):`${x(u.status)}${u.pid===null?"":` \xB7 pid ${u.pid}`}`})]},c.intent.id)})})]})}var V=require("react");var r=require("react/jsx-runtime"),Vt={absent:"panelTokenWarnAbsent",present:"panelTokenWarnPresent",stale:"panelTokenWarnStale"};function jt(e){if(e.token!=="enrolled")return e.token!=="unknown"?Vt[e.token]:e.url===null?void 0:"panelTokenWarnUnreachable"}function zt(e,t){if(!e.ok)return t("panelTokenRegenerateFailed",{message:e.error.message});let n=e.value?.panel;return n!==void 0&&n.detail.length>0?n.detail:t("panelTokenRegenerated")}function Gt({value:e,label:t,hint:n,invalidLabel:a,placeholder:o,disabled:i,onChange:s}){let[l,h]=(0,V.useState)(e===null?"":String(e));(0,V.useEffect)(()=>{h(e===null?"":String(e))},[e]);let c=l.trim()===""?null:Number(l),u=c!==null&&(!Number.isInteger(c)||c<1||c>65535),T=()=>{if(u){h(e===null?"":String(e));return}c!==e&&s(c)};return(0,r.jsxs)("div",{className:"hh-field-block",children:[(0,r.jsxs)("div",{className:"hh-field",children:[(0,r.jsx)("label",{className:"hh-field-label",htmlFor:"hh-panel-port",children:t}),(0,r.jsx)("input",{id:"hh-panel-port",className:"hh-input",type:"number",value:l,placeholder:o,disabled:i,onChange:N=>h(N.target.value),onBlur:T,onKeyDown:N=>{N.key==="Enter"&&T()}})]}),(0,r.jsx)(f,{children:u?a:n})]})}function lt({t:e,status:t,run:n,updateSettings:a,busy:o,uiStyle:i}){let s=t.panel,l=t.cli,h=t.instances??[],c=l?.prefer??t.settings.cli?.prefer??"pinned",[u,T]=(0,V.useState)(!1),[N,J]=(0,V.useState)(null),[X,te]=(0,V.useState)(null),[O,C]=(0,V.useState)(!1),[I,A]=(0,V.useState)(null),Z=jt(s),E=l?.version??null,H=E!==null&&s.version!==null,G=s.reachable&&H&&E!==s.version,{dependency:W,global:ne}=l===void 0?{dependency:null,global:null}:Ve(l),St=l===void 0?[]:[`pnpm add -g home-hosted@${l.expectedRange}`,`npm install -g home-hosted@${l.expectedRange}`],ye=w=>{a(K=>({...K,cli:{...K.cli,prefer:w}}))},wt=async()=>{let w=await n("cli.installGlobal",()=>k("cli.installGlobal",{}));if(!w.ok)return;let K=w.value;J(typeof K?.output=="string"?K.output:null)},kt=async()=>{te(zt(await n("panel.reclaimToken",()=>k("panel.reclaimToken",{})),e))},Tt=async()=>{C(!1),A(e("panelStopping"));let w=await n("panel.stop",()=>k("panel.stop",{}));A(w.ok?w.value?.detail||e("panelStopped"):e("panelStopFailed",{message:w.error.message}))};return(0,r.jsxs)(D,{icon:(0,r.jsx)(Ee,{}),title:e("panelTitle"),children:[Z===void 0?null:(0,r.jsxs)(q,{tone:"warn",title:e("panelTokenWarningTitle"),children:[(0,r.jsx)("p",{children:e(Z)}),s.reachable||s.token==="unknown"?null:(0,r.jsx)("p",{children:e("panelTokenWarnPanelDown")}),(0,r.jsx)("div",{className:"hh-note-actions",children:(0,r.jsx)(S,{variant:"primary",busy:o==="panel.reclaimToken",onClick:()=>{kt()},children:e("panelTokenRegenerate")})})]}),X===null?null:(0,r.jsx)(f,{children:X}),l===void 0?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"hh-choice",role:"radiogroup","aria-label":e("panelCopy"),children:[(0,r.jsx)(fe,{label:e("optionsPreferPinned"),hint:(0,r.jsx)(Xe,{children:e("optionsRecommended")}),meta:W===null?void 0:x(W.version),path:W?.path??void 0,checked:c==="pinned",disabled:W===null||o==="settings",onChange:()=>ye("pinned")}),(0,r.jsx)(fe,{label:e("optionsPreferGlobal"),meta:ne===null?void 0:x(ne.version),path:ne?.path??void 0,checked:c==="global",disabled:ne===null||o==="settings",onChange:()=>ye("global")})]}),(0,r.jsx)(f,{children:e("panelCopyHint")}),l.source==="config"?(0,r.jsx)(f,{children:e("optionsConfigOverride")}):null,l.source==="path"&&c!=="global"?(0,r.jsx)(f,{children:e("panelCliNotPinned",{range:l.expectedRange})}):null,l.supported?null:(0,r.jsx)(q,{tone:"warn",children:e("panelCliUnsupported")}),l.launcherPath!=null&&l.launcherVersion==null?(0,r.jsx)(q,{tone:"warn",children:e("panelCliLauncherFailed")}):null]}),(0,r.jsx)(Gt,{value:t.settings.panel?.port??null,label:e("panelPort"),hint:s.reachable?e("panelPortHint"):e("panelPortFree"),invalidLabel:e("panelPortInvalid"),placeholder:s.configPort==null?void 0:String(s.configPort),disabled:s.reachable||o!==null,onChange:w=>a(K=>({...K,panel:{...K.panel,port:w}}))}),t.panelRoot===void 0?null:(0,r.jsxs)(y,{label:e("panelRootLabel"),children:[(0,r.jsx)(B,{children:t.panelRoot}),t.bootUnitName===void 0?null:` \xB7 ${t.bootUnitName}`]}),t.panelRootSource!=="legacy"?null:(0,r.jsx)(f,{children:e("panelRootLegacy")}),h.length<=1?null:(0,r.jsxs)(F,{label:e("panelInstances",{count:h.length}),open:i==="detailed",children:[h.map(w=>(0,r.jsxs)(y,{label:w.managed?e("panelInstanceManaged"):e("panelInstanceOther"),children:[(0,r.jsx)(B,{children:w.home}),w.url===null?null:(0,r.jsxs)(r.Fragment,{children:[" \xB7 ",(0,r.jsx)($,{href:w.url,children:w.url})]}),` \xB7 ${w.running?e("stateAnswering"):e("stateNotAnswering")}`,w.version===null?null:` \xB7 ${w.version}`,w.hosting?` \xB7 ${e("panelInstanceHosts")}`:null]},w.home)),(0,r.jsx)(f,{children:e("panelInstancesHint")})]}),(0,r.jsxs)("div",{className:"hh-btn-row",children:[s.reachable?null:(0,r.jsx)(S,{variant:"primary",busy:o==="panel.start",onClick:()=>{n("panel.start",()=>k("panel.start",{}))},children:e("panelStart")}),s.reachable?(0,r.jsx)(S,{variant:"danger",disabled:o!==null,onClick:()=>C(!0),children:e("panelStop")}):null,G&&!u?(0,r.jsx)(S,{variant:"primary",onClick:()=>T(!0),children:e("panelReplace",{copy:e(c==="global"?"panelCopyGlobal":"panelCopyPinned")})}):null]}),I===null?null:(0,r.jsx)(f,{children:I}),O?(0,r.jsx)("div",{className:"hh-note",role:"alertdialog","aria-label":e("panelStopTitle"),children:(0,r.jsxs)("div",{className:"hh-note-body",children:[(0,r.jsx)("strong",{children:e("panelStopTitle")}),(0,r.jsx)("p",{children:e("panelStopBody",{id:t.defaultEntryId??"dsh"})}),(0,r.jsxs)("div",{className:"hh-note-actions",children:[(0,r.jsx)(S,{onClick:()=>C(!1),children:e("confirmCancel")}),(0,r.jsx)(S,{variant:"danger",busy:o==="panel.stop",onClick:()=>{Tt()},children:e("confirmStop")})]})]})}):null,G&&u?(0,r.jsx)("div",{className:"hh-note",role:"alertdialog","aria-label":e("panelTakeoverTitle"),children:(0,r.jsxs)("div",{className:"hh-note-body",children:[(0,r.jsx)("strong",{children:e("panelTakeoverTitle")}),(0,r.jsx)("p",{children:e("panelTakeoverBody",{id:t.defaultEntryId??"dsh"})}),(0,r.jsxs)("div",{className:"hh-note-actions",children:[(0,r.jsx)(S,{onClick:()=>T(!1),children:e("confirmCancel")}),(0,r.jsx)(S,{variant:"danger",busy:o==="panel.takeover",onClick:()=>{T(!1),n("panel.takeover",()=>k("panel.takeover",{}))},children:e("confirmReplace")})]})]})}):null,l!==void 0&&ne===null?(0,r.jsxs)(F,{label:e("optionsInstallLabel"),open:i==="detailed",children:[(0,r.jsx)(f,{children:e("optionsInstallHint")}),(0,r.jsx)(ae,{text:St.join(`
|
|
7
|
+
`),copyLabel:e("copy"),copiedLabel:e("copied")}),(0,r.jsx)("div",{className:"hh-btn-row",children:(0,r.jsx)(S,{busy:o==="cli.installGlobal",onClick:()=>{wt()},children:e("optionsInstall")})}),N===null?null:(0,r.jsx)("pre",{className:"hh-output",children:N})]}):null,(0,r.jsxs)(F,{label:e("details"),open:i==="detailed",children:[(0,r.jsx)(y,{label:e("panelHome"),children:(0,r.jsx)(B,{children:s.home})}),(0,r.jsx)(y,{label:e("panelUrl"),children:s.url===null?x(s.url):(0,r.jsx)($,{href:s.url,children:s.url})}),(0,r.jsx)(y,{label:e("panelVersion"),children:x(s.version)}),(0,r.jsx)(y,{label:e("panelPid"),children:x(s.pid)}),(0,r.jsx)(y,{label:e("panelWriteVia"),children:e(De[s.writeVia]??"writeViaNone")}),(0,r.jsx)(y,{label:e("panelToken"),children:e(Fe[s.token]??"tokenUnknown")}),l===void 0?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(y,{label:e("panelCliSource"),children:`${e($e[l.source]??"panelCliMissing")} \xB7 ${x(l.version)}`}),(0,r.jsx)(y,{label:e("panelCliPath"),children:(0,r.jsx)(B,{children:x(l.path)})})]}),s.detail.length>0?(0,r.jsx)(f,{children:s.detail}):null]})]})}var Wt=5e3;function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ee(e,t){let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function ct(e,t){let n=e[t];return typeof n=="string"&&n.length>0?n:null}function dt(e){let t=e/1e3;return`${Number.isInteger(t)?t:t.toFixed(1)}s`}function pt(e,t,n){if(!be(e))return L;if(e.enabled!==!0)return n("serversDisabled");let a=ct(e,"mode"),o=be(e.http)?e.http:null,i;if(a==="http"||a===null&&o!==null){let l=(o===null?null:ct(o,"path"))??"/",h=o===null?null:ee(o,"expectStatus"),c=o===null?null:ee(o,"expectStatusBelow");i=h!==null?n("serversHealthHttp",{status:h,path:l}):c!==null?n("serversHealthHttpBelow",{status:c,path:l}):n("serversHealthHttpProbe",{path:l})}else t!==null?i=n("serversHealthPort",{port:t}):i=n("serversHealthProbe");let s=ee(e,"intervalMs");return s!==null&&s!==Wt?`${i} \xB7 ${n("serversHealthEvery",{seconds:dt(s)})}`:i}function ht(e,t){if(!be(e))return L;if(e.enabled===!1)return t("serversDisabled");let n=ee(e,"maxRetries"),a=ee(e,"baseDelayMs"),o=ee(e,"factor");return n===null||a===null||o===null?t("serversEnabled"):t("serversRestartSummary",{retries:n,base:dt(a),factor:o})}var Kt={"not-installed":"idle","installed-disabled":"warn","enabled-running":"ok","enabled-failing":"bad",unsupported:"idle"};function Yt(...e){return e.filter(t=>t!==null&&t.length>0).join(" \xB7 ")}function qt(e,t){let{panel:n}=e;return n.reachable?{key:"panel",tone:"ok",name:t("sigPanel"),state:t("stateAnswering"),meta:x(n.version),href:n.url}:{key:"panel",tone:e.lastError===null?"idle":"bad",name:t("sigPanel"),state:t("stateNotAnswering"),meta:n.home,href:null}}function Jt(e,t){let{boot:n}=e,o=e.settings.autostart.enabled&&n.state==="not-installed"?"warn":Kt[n.state]??"idle",i=n.mechanism??(e.settings.autostart.mechanism==="auto"?null:e.settings.autostart.mechanism);return{key:"autostart",tone:o,name:t("sigAutostart"),state:t(se[n.state]??"bootStateUnsupported"),meta:i??"",href:null}}function Xt(e,t){let n=e.entries??[],a=t("sigEntry",{id:e.defaultEntryId??"dsh"}),o=e.settings.manageDsh===!0,i=n.filter(c=>!c.exists).length,s=n.filter(c=>c.drift.length>0).length,l=n.find(c=>c.live!==null)?.live??null;return{key:"entry",tone:o?i>0?"bad":s>0?"warn":l!==null?"ok":"warn":"idle",name:a,state:t(o?"stateManaged":"stateNotManaged"),meta:l===null?t("entriesNotRunning"):Yt(x(l.status),l.pid===null?null:`pid ${l.pid}`),href:null}}function ut(e,t){return[qt(e,t),Jt(e,t),Xt(e,t)]}function gt(e,t){let n=e.filter(a=>a.status==="running").length;return t("serversCount",{running:n,total:e.length})}var p=require("react/jsx-runtime");function mt({t:e,server:t,run:n,busy:a,offline:o}){let i=t.status==="running";return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(S,{variant:"ghost",disabled:o||i,busy:a===`servers.start:${t.id}`,onClick:()=>{n(`servers.start:${t.id}`,()=>k("servers.start",{id:t.id}))},children:e("serversStart")}),(0,p.jsx)(S,{variant:"ghost",disabled:o||!i,busy:a===`servers.stop:${t.id}`,onClick:()=>{n(`servers.stop:${t.id}`,()=>k("servers.stop",{id:t.id}))},children:e("serversStop")}),(0,p.jsx)(S,{variant:"ghost",disabled:o||!i,busy:a===`servers.restart:${t.id}`,onClick:()=>{n(`servers.restart:${t.id}`,()=>k("servers.restart",{id:t.id}))},children:e("serversRestart")})]})}function Zt({text:e}){return e.length===0?(0,p.jsx)(p.Fragment,{children:L}):(0,p.jsx)("span",{className:"hh-nowrap",title:e,children:(0,p.jsx)(B,{children:e})})}function ft({t:e,status:t,run:n,busy:a,uiStyle:o}){let i=t.servers??[],s=!t.panel.reachable||a!==null,l=new Map((t.entries??[]).map(h=>[h.intent.id,h.intent]));return(0,p.jsxs)(D,{icon:(0,p.jsx)(Ie,{}),title:e("serversTitle"),action:(0,p.jsx)(R,{children:gt(i,e)}),children:[(0,p.jsx)(f,{children:t.panel.url===null?e("serversHintNoPanel"):(0,p.jsxs)(p.Fragment,{children:[`${e("serversHintPanel")} `,(0,p.jsx)($,{href:t.panel.url,children:t.panel.url})]})}),i.length===0?(0,p.jsx)(f,{children:e("serversEmpty")}):(0,p.jsx)("div",{className:o==="detailed"?"hh-cards":"hh-list",children:i.map(h=>{let c=h.status==="running",u=h.config;if(o==="detailed"){let T=(u.args??[]).join(" "),N=u.cwd??"",J=l.get(h.id)?.persistent;return(0,p.jsxs)("article",{className:"hh-card",children:[(0,p.jsxs)("div",{className:"hh-card-head",children:[(0,p.jsx)("span",{className:"hh-item-name",children:h.id}),(0,p.jsx)(R,{tone:c?"ok":"idle",children:x(h.status)}),J===!0?(0,p.jsx)("span",{title:e("serversPersistentHint"),children:(0,p.jsx)(R,{tone:"accent",children:e("serversPersistent")})}):null,(0,p.jsx)("span",{className:"hh-item-spacer"}),(0,p.jsx)("span",{className:"hh-item-actions",children:(0,p.jsx)(mt,{t:e,server:h,run:n,busy:a,offline:s})})]}),(0,p.jsxs)("div",{className:"hh-card-facts",children:[(0,p.jsx)(y,{label:e("serversUrl"),children:h.url===null?x(h.url):(0,p.jsx)($,{href:h.url,children:h.url})}),(0,p.jsx)(y,{label:e("serversPid"),children:x(h.pid)}),(0,p.jsx)(y,{label:e("serversPort"),children:x(u.port)}),(0,p.jsx)(y,{label:e("serversAutostart"),children:u.autostart===void 0?L:u.autostart?e("yes"):e("no")})]}),(0,p.jsxs)(F,{label:e("serversConfiguration"),children:[(0,p.jsx)(y,{label:e("serversCommand"),children:u.command===void 0||u.command.length===0?L:(0,p.jsx)("span",{className:"hh-nowrap",title:u.command,children:(0,p.jsx)(B,{children:u.command})})}),(0,p.jsx)(y,{label:e("serversArgs"),children:(0,p.jsx)(Zt,{text:T})}),(0,p.jsx)(y,{label:e("serversCwd"),children:N.length===0?L:(0,p.jsx)("span",{className:"hh-nowrap",title:N,children:(0,p.jsx)(B,{children:le(N)})})}),(0,p.jsx)(y,{label:e("serversOnPortConflict"),children:x(u.onPortConflict)}),(0,p.jsx)(y,{label:e("serversHealth"),children:pt(u.health,u.port??null,e)}),(0,p.jsx)(y,{label:e("serversRestartPolicy"),children:ht(u.restart,e)})]}),(0,p.jsx)(F,{label:e("serversRawConfig"),children:(0,p.jsx)("pre",{className:"hh-output",children:JSON.stringify(u,null,2)})})]},h.id)}return(0,p.jsxs)("div",{className:"hh-item",children:[(0,p.jsxs)("span",{className:"hh-item-main",children:[(0,p.jsx)("span",{className:"hh-item-name",children:h.id}),(0,p.jsx)(R,{tone:c?"ok":"idle",children:x(h.status)}),h.url===null?null:(0,p.jsx)($,{href:h.url,children:h.url})]}),(0,p.jsx)("span",{className:"hh-item-spacer"}),h.pid===null?null:(0,p.jsx)("span",{className:"hh-item-meta",children:`${e("serversPid")} ${h.pid}`}),(0,p.jsx)("span",{className:"hh-item-actions",children:(0,p.jsx)(mt,{t:e,server:h,run:n,busy:a,offline:s})})]},h.id)})})]})}var ve=`
|
|
8
8
|
.hh-root {
|
|
9
9
|
--hh-line: var(--dsw-alias-border-l2, rgba(128, 128, 128, 0.25));
|
|
10
10
|
--hh-line-soft: var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.15));
|
|
@@ -758,6 +758,6 @@ var module = { exports: {} }; var exports = module.exports;
|
|
|
758
758
|
.hh-tool-cards { grid-template-columns: minmax(0, 1fr); }
|
|
759
759
|
.hh-card-facts { grid-template-columns: minmax(0, 1fr); }
|
|
760
760
|
}
|
|
761
|
-
`;var g=require("react/jsx-runtime");function
|
|
761
|
+
`;var g=require("react/jsx-runtime");function Qt({signal:e}){return(0,g.jsxs)("div",{className:"hh-signal","data-tone":e.tone,children:[(0,g.jsx)("span",{className:"hh-signal-dot","aria-hidden":"true"}),(0,g.jsx)("span",{className:"hh-signal-name",children:e.name}),(0,g.jsx)("span",{className:"hh-signal-state",children:e.state}),e.meta.length===0&&e.href===null?null:(0,g.jsxs)("span",{className:"hh-signal-meta",children:[e.meta,e.href===null?null:(0,g.jsxs)(g.Fragment,{children:[e.meta.length===0?null:" \xB7 ",(0,g.jsx)($,{href:e.href,children:e.href})]})]})]})}function bt(e){let t=ke(e.t),{data:n,error:a,loading:o,refresh:i}=Ne(),[s,l]=(0,j.useState)(null),[h,c]=(0,j.useState)(null),u=(0,j.useCallback)((C,I)=>(c(C),l(null),(async()=>{try{let A=await I();return A.ok||l(A.error),A}catch(A){let Z={code:"client",message:A instanceof Error?A.message:String(A)};return l(Z),{ok:!1,error:Z}}finally{c(null),await i()}})()),[i]),T=(0,j.useCallback)(C=>{if(n===null)return;let I=Ge(n.settings,C(n.settings));Object.keys(I).length!==0&&u("settings",()=>Pe(I))},[n,u]),N=n?.settings.uiStyle??"detailed",[J,X]=(0,j.useState)(N);(0,j.useEffect)(()=>{X(N)},[N]);let te=C=>{X(C),T(I=>({...I,uiStyle:C}))};if(n===null)return(0,g.jsxs)("div",{className:"hh-root",children:[(0,g.jsx)("style",{children:ve}),o?(0,g.jsx)(f,{children:t("loading")}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(oe,{error:a??{code:"status",message:t("statusUnavailable")},title:t("errorTitle")}),(0,g.jsx)("div",{className:"hh-btn-row",children:(0,g.jsx)(S,{onClick:()=>{i()},children:t("retry")})})]})]});let O={t,status:n,run:u,updateSettings:T,busy:h,uiStyle:J};return(0,g.jsxs)("div",{className:"hh-root",children:[(0,g.jsx)("style",{children:ve}),(0,g.jsxs)("header",{className:"hh-head",children:[(0,g.jsx)("h2",{className:"hh-title",children:t("tab")}),(0,g.jsx)("span",{className:"hh-head-spacer"}),(0,g.jsx)(ce,{value:J,label:t("uiStyleLabel"),disabled:h==="settings",options:[{value:"detailed",label:t("uiStyleDetailed")},{value:"compact",label:t("uiStyleCompact")}],onChange:C=>te(C)}),(0,g.jsx)(S,{variant:"ghost",icon:(0,g.jsx)(Me,{size:13}),busy:h==="status.refresh",onClick:()=>{u("status.refresh",()=>k("status",{refresh:!0}))},children:t("refresh")})]}),(0,g.jsx)("div",{className:"hh-signals","data-busy":h!==null,children:ut(n,t).map(C=>(0,g.jsx)(Qt,{signal:C},C.key))}),n.lastError===null?null:(0,g.jsx)(oe,{error:{code:"panel",message:n.lastError},title:t("errorTitle")}),(0,g.jsx)(oe,{error:a,title:t("errorTitle")}),(0,g.jsx)(oe,{error:s,title:t("errorTitle")}),(0,g.jsx)(lt,{...O}),(0,g.jsx)(it,{...O}),(0,g.jsx)(st,{...O}),(0,g.jsx)(Ze,{...O}),(0,g.jsx)(ft,{...O})]})}var en=["slots","locale"],vt="[dsh-home-hosted]";function z(e,t){t===void 0?console.warn(`${vt} ${e}`):console.warn(`${vt} ${e}`,t)}function yt(e,t){try{let n=e.get?.(t);if(n!=null)return n}catch{}try{let n=e[t];if(n!=null)return n}catch{}}function xt(e,t,n){if(typeof e.effect=="function")try{e.effect(t,n);return}catch(a){z(`registering the effect "${n}" failed`,a);return}try{t()}catch(a){z(`the effect "${n}" failed`,a)}}function tn(e){try{let t=yt(e,"locale"),n=we(t);t===void 0?z("the locale service is unavailable; the page keeps its bundled English copy"):xt(e,()=>{let o=[];try{o.push(t.register(re,{en:pe,zh:xe}))}catch(i){z("registering the dictionaries failed",i)}return()=>{for(let i of o)try{i()}catch(s){z("disposing a dictionary failed",s)}}},"dsh-home-hosted: dictionaries");let a=yt(e,"slots");if(a===void 0){z("the slots service is unavailable; the settings section was not registered");return}xt(e,()=>{try{return a.inject("settings.section",()=>{try{return a.register({name:"settings.section",id:"home-hosted",order:60,label:()=>n("tab"),locale:re,inject:()=>({t:n})},bt)}catch(o){return z("registering the settings section failed",o),()=>{}}})}catch(o){return z("injecting into settings.section failed",o),()=>{}}},"dsh-home-hosted: settings section")}catch(t){z("client bootstrap failed",t)}}
|
|
762
762
|
|
|
763
763
|
return module.exports; } });
|