dsh-home-hosted 0.7.0 → 0.7.1
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/docs/BOOT.md +10 -0
- package/lib/client.js +1 -1
- package/lib/index.js +37 -13
- package/lib/index.js.map +2 -2
- package/lib/types/home-hosted/panel.d.ts +8 -5
- package/lib/types/home-hosted/runtime.d.ts +6 -0
- package/lib/types/service.d.ts +3 -12
- package/lib/types/shared/contracts.d.ts +32 -0
- package/package.json +1 -1
package/docs/BOOT.md
CHANGED
|
@@ -128,11 +128,21 @@ carries the other mechanisms' removal steps in the activation plan, and each pro
|
|
|
128
128
|
`retireCommands()` is the no-`--now` form for the same reason. launchd has no unload-without-stopping,
|
|
129
129
|
so its retirement is only safe once the panel is down and the new entry is up.
|
|
130
130
|
|
|
131
|
+
Retirement re-proves ownership before it removes anything. `status()` reports a systemd unit as
|
|
132
|
+
installed from its *name* alone, and `home-hosted` is the generic name the machine-default install
|
|
133
|
+
uses, so a unit somebody else wrote anywhere on the search path would otherwise be `disable`d and
|
|
134
|
+
deleted by a switch. The marker check is what makes "only an artifact carrying this plugin's marker is
|
|
135
|
+
ever removed" true here too.
|
|
136
|
+
|
|
131
137
|
A mechanism that cannot start anything now answers `activate() → null`: a `Run` value and a `.desktop`
|
|
132
138
|
file are read by the shell or the session at login. Nothing is stopped then — leaving a working panel
|
|
133
139
|
up beats killing it for an entry that would not bring it back. A handover that could not be spawned is
|
|
134
140
|
reported with the exact commands, and the panel is still up.
|
|
135
141
|
|
|
142
|
+
Those displayed commands are the ones the helper would actually run, never a daemon-shaped rewrite: an
|
|
143
|
+
agent's `bootout` is unprivileged and names its own `gui/<uid>` domain, so a person copying the
|
|
144
|
+
fallback gets a command that works.
|
|
145
|
+
|
|
136
146
|
Enabling and switching differ only in the retirement: a switch already has an entry keeping the panel
|
|
137
147
|
alive, so its plan carries the old mechanism's removal.
|
|
138
148
|
|
package/lib/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-home-hosted", factory: (require) => {
|
|
2
2
|
var module = { exports: {} }; var exports = module.exports;
|
|
3
3
|
"use strict";var Re=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var qt=Object.prototype.hasOwnProperty;var Jt=(e,t)=>{for(var n in t)Re(e,n,{get:t[n],enumerable:!0})},Xt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yt(t))!qt.call(e,o)&&o!==n&&Re(e,o,{get:()=>t[o],enumerable:!(r=Kt(t,o))||r.enumerable});return e};var Zt=e=>Xt(Re({},"__esModule",{value:!0}),e);var Fn={};Jt(Fn,{apply:()=>Mn,inject:()=>Hn});module.exports=Zt(Fn);var ke="homeHosted",Ae={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",workspacesTitle:"Workspaces",workspacesHint:"Every workspace this panel serves. Viewing one decides what this page lists.",workspacesViewLabel:"Workspace to view",workspacesEmpty:"The panel reports no workspaces yet.",workspacesManagedTag:"managed by the plugin",workspacesViewingTag:"viewing",workspacesCounts:"{servers} servers \xB7 {running} running",workspacesCountsFile:"{servers} in the config files",workspacesDegraded:"The panel is not answering, so these counts \u2014 and the entry list below \u2014 come from the workspace config files, not from live state.",workspaceLegacyTitle:"This state root still uses the pre-0.7 layout",workspaceLegacyBody:"The plugin cannot read or write its files until they move into .hh. Starting the panel once does the same move; this runs it directly.",workspaceMigrate:"Migrate state root",workspaceMigrateFailed:"The migration did not run.",workspaceMigrateDone:"The state root was migrated.",sigPanel:"Panel",sigAutostart:"Autostart",sigEntry:"{id} entry",stateAnswering:"answering",stateNotAnswering:"not answering",stateManaged:"managed",stateNotManaged:"not managed",stateWebOnly:"web only",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:"Panel root",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}",panelStartFailed:"The panel did not start: {message}",panelReplaceFailed:"The panel was not replaced: {message}",panelInstallFailed:"Installing home-hosted globally failed: {message}",panelRootLegacy:"Adopted from ~/.home-hosted. Set HHOSTED_HOME to give this dsh its own panel.",confirmStop:"Stop",panelOutdated:"Outdated panel",panelReplace:"Restart with {copy}",panelCopyPinned:"pinned dependency",panelCopyGlobal:"global install",panelTakeoverTitle:"Restart 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:"Restart",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.",bootHandover:"Enabling this stops the panel this plugin started and starts it through the entry, so this page disconnects and comes back.",bootSwitchRetires:"Switching stops the panel and removes the previous autostart entry, so this page disconnects and comes back.",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.",entriesManageDesktop:"Available for dsh web only. Desktop starts its own profile, so it is never one of the panel's entries \u2014 servers are still managed here.",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",agentToolWorkspacesList:"List workspaces",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.",agentToolDescWorkspacesList:"List every workspace the panel serves, with its entry and running counts. A server id is only unique inside a workspace.",agentToolDescServersList:"List the servers of one workspace, with status, port and URL.",agentToolDescServersLifecycle:"Start, stop and restart supervised servers.",agentToolDescServersEdit:"Create, update and delete server entries.",agentToolDescAutostartManage:"Install or remove the boot entry that starts the panel.",agentToolDescUiManage:"Inspect, update, revert or install an official 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",serversWorkspace:"Workspace",serversAdd:"Add server",serversEdit:"Edit",serversEditTitle:"Edit {id}",serversCreateTitle:"Add a server",serversEditorHint:"Only the fields you change are written; everything else keeps inheriting the workspace defaults.",serversCreate:"Create",serversSave:"Save",serversDelete:"Delete",serversDeleteTitle:"Delete {id}?",serversDeleteBody:"This removes the entry from workspace {workspace}. A running server is stopped with it.",serversDeleteGo:"Delete",serversFreePort:"Free port",serversFreePortTitle:"Free port {port}?",serversFreePortBody:"Stops whatever holds the port, unless the panel supervises it. Processes get SIGTERM first, then a forced stop.",serversFreePortGo:"Free",serversPortFreed:"Port {port} is free.",serversPortHeld:"Port {port} is still held.",serversPortSkipped:"The listener belongs to a server the panel supervises, so it was left alone.",serversPortRefused:"The port was not freed: {message}",fieldId:"Id",fieldIdHint:"Lowercase letters, digits, `_` and `-`; unique inside the workspace.",fieldIdInvalid:"An id starts with a lowercase letter or digit and uses only a-z, 0-9, _ and -.",fieldLabel:"Label",fieldCommand:"Command",fieldArgs:"Arguments",fieldArgsHint:"One argument per line.",fieldCwd:"Working directory",fieldPort:"Port",fieldPortHint:"Empty means the entry has no port.",fieldPortInvalid:"Enter a port between 1 and 65535, or leave it empty.",fieldAutostart:"Start with the panel",fieldOnPortConflict:"On port conflict",fieldInherit:"Inherit",fieldRequired:"Id and command are required."},Ue={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",workspacesTitle:"\u5DE5\u4F5C\u533A",workspacesHint:"\u6B64\u9762\u677F\u63D0\u4F9B\u7684\u6240\u6709\u5DE5\u4F5C\u533A\u3002\u67E5\u770B\u54EA\u4E2A\u5C31\u5217\u51FA\u54EA\u4E2A\u3002",workspacesViewLabel:"\u8981\u67E5\u770B\u7684\u5DE5\u4F5C\u533A",workspacesEmpty:"\u9762\u677F\u5C1A\u672A\u62A5\u544A\u4EFB\u4F55\u5DE5\u4F5C\u533A\u3002",workspacesManagedTag:"\u7531\u63D2\u4EF6\u7BA1\u7406",workspacesViewingTag:"\u6B63\u5728\u67E5\u770B",workspacesCounts:"{servers} \u4E2A\u670D\u52A1\u5668 \xB7 {running} \u4E2A\u8FD0\u884C\u4E2D",workspacesCountsFile:"\u914D\u7F6E\u6587\u4EF6\u4E2D {servers} \u4E2A",workspacesDegraded:"\u9762\u677F\u6CA1\u6709\u54CD\u5E94\uFF0C\u56E0\u6B64\u8FD9\u4E9B\u8BA1\u6570\u2014\u2014\u4EE5\u53CA\u4E0B\u65B9\u7684\u6761\u76EE\u5217\u8868\u2014\u2014\u6765\u81EA\u5DE5\u4F5C\u533A\u914D\u7F6E\u6587\u4EF6\uFF0C\u800C\u4E0D\u662F\u5B9E\u65F6\u72B6\u6001\u3002",workspaceLegacyTitle:"\u8BE5\u72B6\u6001\u76EE\u5F55\u4ECD\u662F 0.7 \u4E4B\u524D\u7684\u5E03\u5C40",workspaceLegacyBody:"\u5728\u6587\u4EF6\u79FB\u5165 .hh \u4E4B\u524D\uFF0C\u63D2\u4EF6\u65E0\u6CD5\u8BFB\u53D6\u6216\u5199\u5165\u5B83\u4EEC\u3002\u542F\u52A8\u4E00\u6B21\u9762\u677F\u5373\u53EF\u5B8C\u6210\u540C\u6837\u7684\u8FC1\u79FB\uFF1B\u6B64\u6309\u94AE\u76F4\u63A5\u6267\u884C\u8BE5\u547D\u4EE4\u3002",workspaceMigrate:"\u8FC1\u79FB\u72B6\u6001\u76EE\u5F55",workspaceMigrateFailed:"\u8FC1\u79FB\u6CA1\u6709\u6267\u884C\u3002",workspaceMigrateDone:"\u72B6\u6001\u76EE\u5F55\u5DF2\u8FC1\u79FB\u3002",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",stateWebOnly:"\u4EC5 web",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:"\u9762\u677F\u6839\u76EE\u5F55",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}",panelStartFailed:"\u9762\u677F\u672A\u80FD\u542F\u52A8\uFF1A{message}",panelReplaceFailed:"\u9762\u677F\u672A\u80FD\u66FF\u6362\uFF1A{message}",panelInstallFailed:"\u5168\u5C40\u5B89\u88C5 home-hosted \u5931\u8D25\uFF1A{message}",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",panelOutdated:"\u9762\u677F\u5DF2\u8FC7\u65F6",panelReplace:"\u4F7F\u7528{copy}\u91CD\u542F",panelCopyPinned:"\u56FA\u5B9A\u4F9D\u8D56",panelCopyGlobal:"\u5168\u5C40\u5B89\u88C5",panelTakeoverTitle:"\u91CD\u542F\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:"\u91CD\u542F",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",bootHandover:"\u542F\u7528\u540E\u4F1A\u505C\u6B62\u672C\u63D2\u4EF6\u542F\u52A8\u7684\u9762\u677F\uFF0C\u6539\u7531\u8BE5\u5F00\u673A\u9879\u542F\u52A8\uFF0C\u672C\u9875\u9762\u4F1A\u65AD\u5F00\u5E76\u81EA\u884C\u6062\u590D\u3002",bootSwitchRetires:"\u5207\u6362\u4F1A\u505C\u6B62\u9762\u677F\u5E76\u79FB\u9664\u5148\u524D\u7684\u81EA\u542F\u9879\uFF0C\u672C\u9875\u9762\u4F1A\u65AD\u5F00\u5E76\u81EA\u884C\u6062\u590D\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",entriesManageDesktop:"\u4EC5\u9002\u7528\u4E8E dsh web\u3002Desktop \u542F\u52A8\u81EA\u5DF1\u7684 profile\uFF0C\u56E0\u6B64\u5B83\u6C38\u8FDC\u4E0D\u4F1A\u6210\u4E3A\u9762\u677F\u4E2D\u7684\u6761\u76EE\u2014\u2014\u670D\u52A1\u5668\u4ECD\u53EF\u5728\u6B64\u7BA1\u7406\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",agentToolWorkspacesList:"\u5217\u51FA\u5DE5\u4F5C\u533A",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",agentToolDescWorkspacesList:"\u5217\u51FA\u9762\u677F\u63D0\u4F9B\u7684\u6240\u6709\u5DE5\u4F5C\u533A\u53CA\u5176\u6761\u76EE\u6570\u548C\u8FD0\u884C\u6570\u3002\u670D\u52A1\u5668 id \u53EA\u5728\u5DE5\u4F5C\u533A\u5185\u552F\u4E00\u3002",agentToolDescServersList:"\u5217\u51FA\u67D0\u4E2A\u5DE5\u4F5C\u533A\u4E2D\u88AB\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\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\u5B89\u88C5\u5B98\u65B9 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",serversWorkspace:"\u5DE5\u4F5C\u533A",serversAdd:"\u6DFB\u52A0\u670D\u52A1\u5668",serversEdit:"\u7F16\u8F91",serversEditTitle:"\u7F16\u8F91 {id}",serversCreateTitle:"\u6DFB\u52A0\u670D\u52A1\u5668",serversEditorHint:"\u53EA\u5199\u5165\u4F60\u6539\u52A8\u7684\u5B57\u6BB5\uFF0C\u5176\u4F59\u4ECD\u7EE7\u627F\u5DE5\u4F5C\u533A\u9ED8\u8BA4\u503C\u3002",serversCreate:"\u521B\u5EFA",serversSave:"\u4FDD\u5B58",serversDelete:"\u5220\u9664",serversDeleteTitle:"\u5220\u9664 {id}\uFF1F",serversDeleteBody:"\u8FD9\u4F1A\u4ECE\u5DE5\u4F5C\u533A {workspace} \u4E2D\u79FB\u9664\u8BE5\u6761\u76EE\uFF0C\u8FD0\u884C\u4E2D\u7684\u670D\u52A1\u5668\u4E5F\u4F1A\u968F\u4E4B\u505C\u6B62\u3002",serversDeleteGo:"\u5220\u9664",serversFreePort:"\u91CA\u653E\u7AEF\u53E3",serversFreePortTitle:"\u91CA\u653E\u7AEF\u53E3 {port}\uFF1F",serversFreePortBody:"\u505C\u6B62\u5360\u7528\u8BE5\u7AEF\u53E3\u7684\u8FDB\u7A0B\uFF0C\u9664\u975E\u5B83\u7531\u9762\u677F\u76D1\u7BA1\u3002\u8FDB\u7A0B\u5148\u6536\u5230 SIGTERM\uFF0C\u4E4B\u540E\u4F1A\u88AB\u5F3A\u5236\u505C\u6B62\u3002",serversFreePortGo:"\u91CA\u653E",serversPortFreed:"\u7AEF\u53E3 {port} \u5DF2\u91CA\u653E\u3002",serversPortHeld:"\u7AEF\u53E3 {port} \u4ECD\u88AB\u5360\u7528\u3002",serversPortSkipped:"\u8BE5\u76D1\u542C\u8005\u5C5E\u4E8E\u9762\u677F\u76D1\u7BA1\u7684\u670D\u52A1\u5668\uFF0C\u56E0\u6B64\u672A\u88AB\u52A8\u5B83\u3002",serversPortRefused:"\u7AEF\u53E3\u672A\u80FD\u91CA\u653E\uFF1A{message}",fieldId:"Id",fieldIdHint:"\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001`_` \u548C `-`\uFF1B\u5728\u5DE5\u4F5C\u533A\u5185\u552F\u4E00\u3002",fieldIdInvalid:"id \u4EE5\u5C0F\u5199\u5B57\u6BCD\u6216\u6570\u5B57\u5F00\u5934\uFF0C\u53EA\u80FD\u5305\u542B a-z\u30010-9\u3001_ \u548C -\u3002",fieldLabel:"\u6807\u7B7E",fieldCommand:"\u547D\u4EE4",fieldArgs:"\u53C2\u6570",fieldArgsHint:"\u6BCF\u884C\u4E00\u4E2A\u53C2\u6570\u3002",fieldCwd:"\u5DE5\u4F5C\u76EE\u5F55",fieldPort:"\u7AEF\u53E3",fieldPortHint:"\u7559\u7A7A\u8868\u793A\u8BE5\u6761\u76EE\u6CA1\u6709\u7AEF\u53E3\u3002",fieldPortInvalid:"\u8BF7\u8F93\u5165 1 \u5230 65535 \u4E4B\u95F4\u7684\u7AEF\u53E3\uFF0C\u6216\u7559\u7A7A\u3002",fieldAutostart:"\u968F\u9762\u677F\u542F\u52A8",fieldOnPortConflict:"\u7AEF\u53E3\u51B2\u7A81\u65F6",fieldInherit:"\u7EE7\u627F",fieldRequired:"Id \u548C\u547D\u4EE4\u4E3A\u5FC5\u586B\u3002"};function Qt(e,t){return t===void 0?e:e.replace(/\{(\w+)\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?String(t[r]):n)}var We=(e,t)=>Qt(Ae[e]??e,t);function Ve(e){if(e!==void 0)try{let t=e.bind(ke);if(typeof t=="function")return t}catch{}return We}function $e(e,t=We){return e===void 0?t:(n,r)=>{let o;try{o=e(n,r)}catch{o=void 0}return o===void 0||o.length===0||o===n?t(n,r):o}}var V=require("react");var ne=require("react");var je="/home-hosted";var ze="default";var Ge=["block","warn","follow","reclaim","kill"];var ce=["status","workspaces_list","servers_list","servers_lifecycle","servers_edit","autostart_manage","ui_manage"],Ke=["servers_lifecycle","servers_edit","autostart_manage","ui_manage"],en=3,Dn={version:en,autostart:{enabled:!1,mechanism:"auto"},manageDsh:!1,entries:[],agentTools:{enabled:!0,allow:[...ce]},panel:{port:null},authNotice:!0,reclaimToken:!0,instancesNotice:!0,uiStyle:"detailed",cli:{prefer:"pinned"}};var tn="/api";function ee(e,t,n){return{ok:!1,error:n===void 0?{code:e,message:t}:{code:e,message:t,detail:n}}}function Ie(e){return typeof e=="object"&&e!==null}function nn(e){return e instanceof Error?e.message:String(e)}function on(e){if(!Ie(e))return ee("bad-response","The panel returned a non-object response");if(typeof e.v=="number"&&e.v!==1)return ee("version-mismatch",`Response protocol v${e.v} does not match the expected v${1}`);let t=e.result;if(!Ie(t))return ee("bad-response","The panel returned no result");if(t.ok===!0)return"value"in t?{ok:!0,value:t.value}:ee("bad-response","A successful response carried no value");if(t.ok===!1){let n=t.error;return Ie(n)&&typeof n.message=="string"?ee(typeof n.code=="string"?n.code:"error",n.message,n.detail):ee("error","The panel reported a failure without a message")}return ee("bad-response","The panel returned an unrecognised result")}async function P(e,t,n={}){let r=n.fetch??globalThis.fetch;if(typeof r!="function")return ee("no-fetch","No fetch implementation is available");let o={v:1,endpoint:e,payload:t},a;try{a=await r(`${tn}${je}`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(o)})}catch(d){return ee("network",nn(d))}if(!a.ok){let d=a.statusText.length>0?` ${a.statusText}`:"";return ee("http",`HTTP ${a.status}${d}`)}let i;try{i=await a.json()}catch{return ee("bad-json","The panel returned invalid JSON")}return on(i)}function Ye(e,t={}){return P("settings.update",{patch:e},t)}var rn=5e3;function qe(e=rn){let[t,n]=(0,ne.useState)(null),[r,o]=(0,ne.useState)(null),[a,i]=(0,ne.useState)(!0),d=(0,ne.useRef)(!0),p=(0,ne.useCallback)(async()=>{let h=await P("status",{});d.current&&(h.ok?(n(h.value),o(null)):o(h.error),i(!1))},[]);return(0,ne.useEffect)(()=>{d.current=!0,p();let h=setInterval(()=>{p()},e);return()=>{d.current=!1,clearInterval(h)}},[p,e]),{data:t,error:r,loading:a,refresh:p}}var w=require("react/jsx-runtime");function oe({size:e=14,children:t}){return(0,w.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 Je(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("rect",{x:"2.2",y:"3",width:"11.6",height:"7.6",rx:"1.6"}),(0,w.jsx)("path",{d:"M6.6 13.4h2.8M8 10.6v2.8"})]})}function Xe(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M8 2.4v5.2"}),(0,w.jsx)("path",{d:"M11.6 4.4a5 5 0 1 1-7.2 0"})]})}function Ze(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("rect",{x:"2.2",y:"2.8",width:"11.6",height:"10.4",rx:"1.6"}),(0,w.jsx)("path",{d:"M5.2 6.9l1.8 1.8-1.8 1.8M8.7 10.5h2.2"})]})}function Qe(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M2.4 5.4h11.2M2.4 10.6h11.2"}),(0,w.jsx)("circle",{cx:"6",cy:"5.4",r:"1.6",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"10.4",cy:"10.6",r:"1.6",fill:"currentColor",stroke:"none"})]})}function xe(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M8 2.3l5.4 2.9L8 8.1 2.6 5.2z"}),(0,w.jsx)("path",{d:"M2.6 8.6l5.4 2.9 5.4-2.9"}),(0,w.jsx)("path",{d:"M2.6 11.4l5.4 2.9 5.4-2.9"})]})}function et(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M13.4 9.4A5.5 5.5 0 1 1 12.2 4.4"}),(0,w.jsx)("path",{d:"M12.8 1.7v2.9h-2.9"})]})}function tt(e){return(0,w.jsx)(oe,{...e,children:(0,w.jsx)("path",{d:"M6.2 3.8L10.4 8l-4.2 4.2"})})}function nt(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M6.6 3.4H3.4v9.2h9.2V9.4"}),(0,w.jsx)("path",{d:"M9.4 3.4h3.2v3.2M12.6 3.4L7.8 8.2"})]})}function Se(e){return(0,w.jsxs)(oe,{...e,children:[(0,w.jsx)("path",{d:"M8 2.6l5.7 10.2H2.3z"}),(0,w.jsx)("path",{d:"M8 6.4v3.1M8 11.5h.01"})]})}function ot(e){return(0,w.jsx)(oe,{...e,children:(0,w.jsx)("path",{d:"M3 8.4l3.3 3.3L13 5"})})}var J="\u2014";function A(e){if(e==null)return J;let t=String(e);return t.length>0?t:J}function rt(e){return e.length>0?e.join(", "):J}function Me(e){return Ke.includes(e)}var Fe={status:"agentToolStatus",workspaces_list:"agentToolWorkspacesList",servers_list:"agentToolServersList",servers_lifecycle:"agentToolServersLifecycle",servers_edit:"agentToolServersEdit",autostart_manage:"agentToolAutostartManage",ui_manage:"agentToolUiManage"},at={status:"agentToolDescStatus",workspaces_list:"agentToolDescWorkspacesList",servers_list:"agentToolDescServersList",servers_lifecycle:"agentToolDescServersLifecycle",servers_edit:"agentToolDescServersEdit",autostart_manage:"agentToolDescAutostartManage",ui_manage:"agentToolDescUiManage"},it={api:"writeViaApi",file:"writeViaFile",none:"writeViaNone"},st={enrolled:"tokenEnrolled",present:"tokenPresent",absent:"tokenAbsent",stale:"tokenStale",unknown:"tokenUnknown"},Te={"not-installed":"bootStateNotInstalled","installed-disabled":"bootStateInstalledDisabled","enabled-running":"bootStateEnabledRunning","enabled-failing":"bootStateEnabledFailing",unsupported:"bootStateUnsupported"},lt={config:"panelCliConfig",dependency:"panelCliDependency",path:"panelCliPathSource",none:"panelCliMissing"};function Pe(e,t=52){if(e.length<=t)return e;let n=e.includes("\\")?"\\":"/",r=e.split(/[\\/]/).filter(d=>d.length>0);if(r.length<4)return e;let o=/^[A-Za-z]:$/.test(r[0]??"")?3:2;if(r.length<=o)return e;let i=`${/^[\\/]/.test(e)?n:""}${r.slice(0,o).join(n)}${n}\u2026${n}${r.slice(-2).join(n)}`;return i.length<e.length?i:e}function dt(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 ct(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function an(e,t){if(Object.is(e,t))return!0;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function pt(e,t){let n={};for(let r of Object.keys(t)){let o=e[r],a=t[r];if(ct(o)&&ct(a)){let i=pt(o,a);Object.keys(i).length>0&&(n[r]=i)}else an(o,a)||(n[r]=a)}return n}function ht(e,t){return pt(e,t)}function ut(e,t,n){let r=new Set(e);return n?r.add(t):r.delete(t),ce.filter(o=>r.has(o))}var mt=require("react");async function gt(e){try{if(typeof navigator<"u"&&navigator.clipboard!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}return!1}var c=require("react/jsx-runtime");function sn(...e){return e.filter(t=>typeof t=="string"&&t.length>0).join(" ")}function X({icon:e,title:t,action:n,children:r}){return(0,c.jsxs)("section",{className:"hh-section",children:[(0,c.jsxs)("header",{className:"hh-section-head",children:[e===void 0?null:(0,c.jsx)("span",{className:"hh-section-icon",children:e}),(0,c.jsx)("h3",{className:"hh-section-title",children:t}),(0,c.jsx)("span",{className:"hh-section-rule","aria-hidden":"true"}),n===void 0?null:(0,c.jsx)("span",{className:"hh-section-action",children:n})]}),(0,c.jsx)("div",{className:"hh-section-body",children:r})]})}function N({label:e,children:t}){return(0,c.jsxs)("div",{className:"hh-spec",children:[(0,c.jsx)("span",{className:"hh-spec-label",children:e}),(0,c.jsx)("span",{className:"hh-spec-value",children:t})]})}function te({children:e}){return(0,c.jsx)("code",{className:"hh-code",children:e})}function m({children:e}){return typeof e=="string"&&e.length===0?null:(0,c.jsx)("p",{className:"hh-hint",children:e})}function U({tone:e,children:t}){return(0,c.jsx)("span",{className:"hh-chip","data-tone":e??"idle",children:t})}function ie({href:e,children:t}){return(0,c.jsxs)("a",{className:"hh-link",href:e,target:"_blank",rel:"noreferrer noopener",children:[t??e,(0,c.jsx)("span",{className:"hh-link-icon","aria-hidden":"true",children:(0,c.jsx)(nt,{size:11})})]})}function re({label:e,open:t=!1,children:n}){return(0,c.jsxs)("details",{className:"hh-details",open:t||void 0,children:[(0,c.jsxs)("summary",{className:"hh-summary",children:[(0,c.jsx)("span",{className:"hh-chevron","aria-hidden":"true",children:(0,c.jsx)(tt,{size:12})}),e]}),(0,c.jsx)("div",{className:"hh-details-body",children:n})]})}function j({tone:e="bad",icon:t=!0,title:n,children:r}){return(0,c.jsxs)("div",{className:"hh-note","data-tone":e,role:e==="bad"?"alert":"note",children:[t?(0,c.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,c.jsx)(Se,{size:13})}):null,(0,c.jsxs)("div",{className:"hh-note-body",children:[n===void 0?null:(0,c.jsx)("span",{className:"hh-note-title",children:n}),typeof r=="string"?(0,c.jsx)("p",{children:r}):r]})]})}function Ce({title:e,detail:t}){return(0,c.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,c.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,c.jsx)(Se,{size:13})}),(0,c.jsxs)("div",{className:"hh-note-body",children:[(0,c.jsx)("strong",{children:e}),t.length>0?(0,c.jsx)("p",{children:t}):null]})]})}function ve({error:e,title:t}){return e===null?null:(0,c.jsxs)("div",{className:"hh-note",role:"alert",children:[(0,c.jsx)("span",{className:"hh-note-icon","aria-hidden":"true",children:(0,c.jsx)(Se,{size:13})}),(0,c.jsxs)("div",{className:"hh-note-body",children:[(0,c.jsx)("strong",{children:t}),(0,c.jsxs)("p",{children:[(0,c.jsx)("code",{children:e.code})," \u2014 ",e.message]})]})]})}function ln(){return(0,c.jsx)("span",{className:"hh-spinner","aria-hidden":"true"})}function y({children:e,onClick:t,disabled:n,busy:r,variant:o="default",icon:a,title:i}){let d=n===!0||r===!0;return(0,c.jsxs)("button",{type:"button",className:sn("hh-btn",o!=="default"&&`hh-btn-${o}`),onClick:t,disabled:d,title:i,children:[r===!0?(0,c.jsx)(ln,{}):a,e]})}function ge({label:e,checked:t,disabled:n,onChange:r}){return(0,c.jsxs)("button",{type:"button",role:"switch",className:"hh-switch","aria-checked":t,disabled:n,onClick:()=>r(!t),children:[(0,c.jsx)("span",{className:"hh-switch-track","aria-hidden":"true",children:(0,c.jsx)("span",{className:"hh-switch-knob"})}),(0,c.jsx)("span",{className:"hh-check-label",children:e})]})}function ft({label:e,checked:t,disabled:n,onChange:r}){return(0,c.jsxs)("label",{className:"hh-check",children:[(0,c.jsx)("input",{type:"checkbox",checked:t,disabled:n,onChange:o=>r(o.target.checked)}),(0,c.jsx)("span",{className:"hh-check-label",children:e})]})}function ue({value:e,options:t,disabled:n,label:r,onChange:o}){return(0,c.jsx)("select",{className:"hh-select",value:e,disabled:n,"aria-label":r,onChange:a=>o(a.target.value),children:t.map(a=>(0,c.jsx)("option",{value:a.value,children:a.label},a.value))})}function be({label:e,meta:t,path:n,hint:r,checked:o,disabled:a,onChange:i}){return(0,c.jsxs)("label",{className:"hh-choice-option","data-disabled":a===!0,children:[(0,c.jsx)("input",{type:"radio",checked:o,disabled:a,onChange:()=>i()}),(0,c.jsxs)("span",{className:"hh-choice-label",children:[(0,c.jsx)("span",{children:e}),r]}),t===void 0?null:(0,c.jsx)("span",{className:"hh-choice-meta",children:t}),n===void 0?null:(0,c.jsx)("span",{className:"hh-choice-path",title:n,children:Pe(n)})]})}function Ne({children:e}){return(0,c.jsxs)(U,{tone:"accent",children:[(0,c.jsx)(ot,{size:10}),e]})}function ye({text:e,copyLabel:t,copiedLabel:n}){let[r,o]=(0,mt.useState)(!1);return(0,c.jsxs)("div",{className:"hh-code-box",children:[(0,c.jsx)("textarea",{className:"hh-code-text",readOnly:!0,value:e,rows:Math.min(e.split(`
|
|
4
|
-
`).length,4)}),(0,c.jsx)("div",{className:"hh-btn-row",children:(0,c.jsx)(y,{variant:"ghost",onClick:()=>{gt(e).then(o)},children:r?n:t})})]})}var C=require("react/jsx-runtime");function vt({t:e,status:t,updateSettings:n,busy:r,uiStyle:o}){let a=t.settings.agentTools,i=a.allow??[],d=ce.filter(h=>i.includes(h)).length,p=(h,g)=>{n(b=>({...b,agentTools:{...b.agentTools,allow:ut(b.agentTools.allow??[],h,g)}}))};return(0,C.jsxs)(X,{icon:(0,C.jsx)(Qe,{}),title:e("agentTitle"),action:(0,C.jsx)(U,{children:e("agentCount",{enabled:d,total:ce.length})}),children:[(0,C.jsx)(ge,{label:e("agentMaster"),checked:a.enabled,onChange:h=>n(g=>({...g,agentTools:{...g.agentTools,enabled:h}}))}),(0,C.jsxs)("div",{className:"hh-field-block",children:[(0,C.jsx)(ge,{label:e("reclaimAutoLabel"),checked:t.settings.reclaimToken!==!1,disabled:r==="settings",onChange:h=>n(g=>({...g,reclaimToken:h}))}),(0,C.jsx)(m,{children:e("reclaimAutoHint")})]}),(0,C.jsxs)("div",{className:"hh-field-block",children:[(0,C.jsx)(ge,{label:e("instancesNoticeLabel"),checked:t.settings.instancesNotice!==!1,disabled:r==="settings",onChange:h=>n(g=>({...g,instancesNotice:h}))}),(0,C.jsx)(m,{children:e("instancesNoticeHint")})]}),(0,C.jsx)(m,{children:e("agentApproval")}),o==="detailed"?(0,C.jsx)("div",{className:"hh-tool-cards",children:ce.map(h=>(0,C.jsxs)("label",{className:"hh-tool-card",children:[(0,C.jsx)("input",{type:"checkbox",checked:i.includes(h),disabled:!a.enabled,onChange:g=>p(h,g.target.checked)}),(0,C.jsxs)("span",{className:"hh-tool-card-body",children:[(0,C.jsxs)("span",{className:"hh-tool-card-head",children:[(0,C.jsx)("span",{className:"hh-tool-card-name",children:e(Fe[h])}),Me(h)?(0,C.jsx)(U,{tone:"warn",children:e("agentApprovalBadge")}):null]}),(0,C.jsx)("span",{className:"hh-tool-card-desc",children:e(at[h])})]})]},h))}):(0,C.jsx)("div",{className:"hh-tools",children:ce.map(h=>(0,C.jsx)(ft,{label:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"hh-check-text",children:e(Fe[h])}),Me(h)?(0,C.jsx)(U,{tone:"warn",children:e("agentApprovalBadge")}):null]}),checked:i.includes(h),disabled:!a.enabled,onChange:g=>p(h,g)},h))})]})}var Tt=require("react");function bt(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function yt(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:r,commands:o}=t;return n!==!1?null:{detail:typeof r=="string"?r:"",commands:bt(o)}}function wt(e){return e===void 0?null:{ok:e.ok===!0,action:e.action==="uninstall"?"uninstall":"install",detail:typeof e.detail=="string"?e.detail:"",commands:bt(e.commands)}}var dn=["enabled-running","enabled-failing","installed-disabled"];function kt(e,t){let n=e.filter(a=>a.available).map(a=>a.mechanism),r=n.filter(a=>a!=="unsupported"),o=["auto",...r.length>0?r:n];return o.includes(t)||o.push(t),o}function xt(e,t){return e!==null&&e!==t}function cn(e,t){return e===null||e.ok?!1:e.action==="install"?dn.includes(t):t==="not-installed"}function St(e,t,n,r){return e!==null&&e.state===n&&e.mechanism===r?e:cn(t,n)?null:t}var x=require("react/jsx-runtime");function Pt({t:e,status:t,run:n,updateSettings:r,busy:o,uiStyle:a}){let i=t.boot,d=t.settings.autostart,p=i.candidates??[],h=i.commands??[],[g,b]=(0,Tt.useState)(null),B=o==="boot.install"||o==="boot.uninstall",E=kt(p,d.mechanism).map(F=>({value:F,label:F==="auto"?e("bootMechanismAuto"):F})),R=xt(i.mechanism,d.mechanism),$=i.mechanism!==null,z=t.panel.reachable&&!R&&!$,k=t.panel.reachable&&R,D=F=>e(F==="install"?"bootActionInstall":"bootActionUninstall"),K=async F=>{let Y=await n(`boot.${F}`,async()=>F==="install"?P("boot.install",d.mechanism==="auto"?{}:{mechanism:d.mechanism}):P("boot.uninstall",{}));if(!Y.ok){b(null);return}let q=yt(Y.value);b(q===null?null:{ok:!1,action:F,detail:q.detail,commands:q.commands,state:i.state,mechanism:i.mechanism})},Q=wt(d.lastAttempt),M=St(g,Q,i.state,i.mechanism);return(0,x.jsxs)(X,{icon:(0,x.jsx)(Xe,{}),title:e("bootTitle"),action:(0,x.jsx)(ue,{value:d.mechanism,options:E,label:e("bootMechanism"),disabled:o==="settings"||B,onChange:F=>r(Y=>({...Y,autostart:{...Y.autostart,mechanism:F}}))}),children:[z?(0,x.jsx)(m,{children:e("bootHandover")}):null,k?(0,x.jsx)(j,{tone:"warn",children:e("bootSwitchRetires")}):null,(0,x.jsxs)("div",{className:"hh-btn-row",children:[(0,x.jsx)(y,{variant:$?"default":"primary",disabled:d.mechanism==="unsupported",busy:o==="boot.install",onClick:()=>{K("install")},children:e(R?"bootSwitchMode":"bootEnabled")}),(0,x.jsx)(y,{disabled:!$,busy:o==="boot.uninstall",onClick:()=>{K("uninstall")},children:e("bootUninstall")}),(0,x.jsx)(y,{variant:"ghost",busy:o==="boot.verify",onClick:()=>{n("boot.verify",()=>P("boot.verify",{}))},children:e("bootRecheck")})]}),d.enabled&&i.state==="not-installed"?(0,x.jsx)(j,{tone:"warn",children:e("bootRequestedNotInstalled")}):null,M!==null&&!M.ok?(0,x.jsxs)("div",{className:"hh-section-body",children:[(0,x.jsx)(Ce,{title:e("bootAttemptFailed",{action:D(M.action)}),detail:M.detail.length>0?M.detail:e("bootAttemptNoDetail")}),M.commands.length>0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(m,{children:e("bootAttemptCommands")}),(0,x.jsx)(ye,{text:M.commands.join(`
|
|
4
|
+
`).length,4)}),(0,c.jsx)("div",{className:"hh-btn-row",children:(0,c.jsx)(y,{variant:"ghost",onClick:()=>{gt(e).then(o)},children:r?n:t})})]})}var C=require("react/jsx-runtime");function vt({t:e,status:t,updateSettings:n,busy:r,uiStyle:o}){let a=t.settings.agentTools,i=a.allow??[],d=ce.filter(h=>i.includes(h)).length,p=(h,g)=>{n(b=>({...b,agentTools:{...b.agentTools,allow:ut(b.agentTools.allow??[],h,g)}}))};return(0,C.jsxs)(X,{icon:(0,C.jsx)(Qe,{}),title:e("agentTitle"),action:(0,C.jsx)(U,{children:e("agentCount",{enabled:d,total:ce.length})}),children:[(0,C.jsx)(ge,{label:e("agentMaster"),checked:a.enabled,disabled:r==="settings",onChange:h=>n(g=>({...g,agentTools:{...g.agentTools,enabled:h}}))}),(0,C.jsxs)("div",{className:"hh-field-block",children:[(0,C.jsx)(ge,{label:e("reclaimAutoLabel"),checked:t.settings.reclaimToken!==!1,disabled:r==="settings",onChange:h=>n(g=>({...g,reclaimToken:h}))}),(0,C.jsx)(m,{children:e("reclaimAutoHint")})]}),(0,C.jsxs)("div",{className:"hh-field-block",children:[(0,C.jsx)(ge,{label:e("instancesNoticeLabel"),checked:t.settings.instancesNotice!==!1,disabled:r==="settings",onChange:h=>n(g=>({...g,instancesNotice:h}))}),(0,C.jsx)(m,{children:e("instancesNoticeHint")})]}),(0,C.jsx)(m,{children:e("agentApproval")}),o==="detailed"?(0,C.jsx)("div",{className:"hh-tool-cards",children:ce.map(h=>(0,C.jsxs)("label",{className:"hh-tool-card",children:[(0,C.jsx)("input",{type:"checkbox",checked:i.includes(h),disabled:!a.enabled,onChange:g=>p(h,g.target.checked)}),(0,C.jsxs)("span",{className:"hh-tool-card-body",children:[(0,C.jsxs)("span",{className:"hh-tool-card-head",children:[(0,C.jsx)("span",{className:"hh-tool-card-name",children:e(Fe[h])}),Me(h)?(0,C.jsx)(U,{tone:"warn",children:e("agentApprovalBadge")}):null]}),(0,C.jsx)("span",{className:"hh-tool-card-desc",children:e(at[h])})]})]},h))}):(0,C.jsx)("div",{className:"hh-tools",children:ce.map(h=>(0,C.jsx)(ft,{label:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"hh-check-text",children:e(Fe[h])}),Me(h)?(0,C.jsx)(U,{tone:"warn",children:e("agentApprovalBadge")}):null]}),checked:i.includes(h),disabled:!a.enabled,onChange:g=>p(h,g)},h))})]})}var Tt=require("react");function bt(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function yt(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:r,commands:o}=t;return n!==!1?null:{detail:typeof r=="string"?r:"",commands:bt(o)}}function wt(e){return e===void 0?null:{ok:e.ok===!0,action:e.action==="uninstall"?"uninstall":"install",detail:typeof e.detail=="string"?e.detail:"",commands:bt(e.commands)}}var dn=["enabled-running","enabled-failing","installed-disabled"];function kt(e,t){let n=e.filter(a=>a.available).map(a=>a.mechanism),r=n.filter(a=>a!=="unsupported"),o=["auto",...r.length>0?r:n];return o.includes(t)||o.push(t),o}function xt(e,t){return e!==null&&e!==t}function cn(e,t){return e===null||e.ok?!1:e.action==="install"?dn.includes(t):t==="not-installed"}function St(e,t,n,r){return e!==null&&e.state===n&&e.mechanism===r?e:cn(t,n)?null:t}var x=require("react/jsx-runtime");function Pt({t:e,status:t,run:n,updateSettings:r,busy:o,uiStyle:a}){let i=t.boot,d=t.settings.autostart,p=i.candidates??[],h=i.commands??[],[g,b]=(0,Tt.useState)(null),B=o==="boot.install"||o==="boot.uninstall",E=kt(p,d.mechanism).map(F=>({value:F,label:F==="auto"?e("bootMechanismAuto"):F})),R=xt(i.mechanism,d.mechanism),$=i.mechanism!==null,z=t.panel.reachable&&!R&&!$,k=t.panel.reachable&&R,D=F=>e(F==="install"?"bootActionInstall":"bootActionUninstall"),K=async F=>{let Y=await n(`boot.${F}`,async()=>F==="install"?P("boot.install",d.mechanism==="auto"?{}:{mechanism:d.mechanism}):P("boot.uninstall",{}));if(!Y.ok){b(null);return}let q=yt(Y.value);b(q===null?null:{ok:!1,action:F,detail:q.detail,commands:q.commands,state:i.state,mechanism:i.mechanism})},Q=wt(d.lastAttempt),M=St(g,Q,i.state,i.mechanism);return(0,x.jsxs)(X,{icon:(0,x.jsx)(Xe,{}),title:e("bootTitle"),action:(0,x.jsx)(ue,{value:d.mechanism,options:E,label:e("bootMechanism"),disabled:o==="settings"||B,onChange:F=>r(Y=>({...Y,autostart:{...Y.autostart,mechanism:F}}))}),children:[z?(0,x.jsx)(m,{children:e("bootHandover")}):null,k?(0,x.jsx)(j,{tone:"warn",children:e("bootSwitchRetires")}):null,(0,x.jsxs)("div",{className:"hh-btn-row",children:[(0,x.jsx)(y,{variant:$?"default":"primary",disabled:d.mechanism==="unsupported",busy:o==="boot.install",onClick:()=>{K("install")},children:e(R?"bootSwitchMode":"bootEnabled")}),(0,x.jsx)(y,{disabled:!$,busy:o==="boot.uninstall",onClick:()=>{K("uninstall")},children:e("bootUninstall")}),(0,x.jsx)(y,{variant:"ghost",busy:o==="boot.verify",onClick:()=>{n("boot.verify",()=>P("boot.verify",{}))},children:e("bootRecheck")})]}),d.enabled&&i.state==="not-installed"?(0,x.jsx)(j,{tone:"warn",children:e("bootRequestedNotInstalled")}):null,M!==null&&!M.ok?(0,x.jsxs)("div",{className:"hh-section-body",children:[(0,x.jsx)(Ce,{title:e("bootAttemptFailed",{action:D(M.action)}),detail:M.detail.length>0?M.detail:e("bootAttemptNoDetail")}),M.commands.length>0?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(m,{children:e("bootAttemptCommands")}),(0,x.jsx)(ye,{text:M.commands.join(`
|
|
5
5
|
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null]}):null,M!==null&&M.ok?(0,x.jsx)(m,{children:e("bootAttemptSucceeded",{action:D(M.action),detail:M.detail})}):null,h.length>0?(0,x.jsxs)(re,{label:e("bootCommandsLabel"),open:a==="detailed",children:[(0,x.jsx)(m,{children:e("bootCommandsExplain")}),(0,x.jsx)(ye,{text:h.join(`
|
|
6
6
|
`),copyLabel:e("copy"),copiedLabel:e("copied")})]}):null,(0,x.jsxs)(re,{label:e("details"),open:a==="detailed",children:[(0,x.jsx)(N,{label:e("bootState"),children:e(Te[i.state]??"bootStateUnsupported")}),(0,x.jsx)(N,{label:e("bootBootCapable"),children:i.bootCapable?e("yes"):e("no")}),(0,x.jsx)(N,{label:e("bootPrivileged"),children:i.privileged?e("yes"):e("no")}),(0,x.jsx)(N,{label:e("bootUnitPath"),children:(0,x.jsx)(te,{children:A(i.unitPath)})}),i.detail.length>0?(0,x.jsx)(m,{children:i.detail}):null]})]})}var O=require("react/jsx-runtime");function pn(e){return e.defaultEntryId??"dsh"}function Ct({t:e,status:t,run:n,busy:r}){let o=t.entries??[],a=t.settings.manageDsh===!0,i=t.boot.platform==="win32",d=t.surface==="desktop",p=pn(t),h=g=>{if(g){let b={id:p,autostart:!0};n("entries.apply",()=>P("entries.apply",{intents:[b]}))}else n("entries.remove",()=>P("entries.remove",{id:p}))};return(0,O.jsxs)(X,{icon:(0,O.jsx)(Ze,{}),title:e("entriesTitle"),children:[(0,O.jsx)(ge,{label:e("entriesManage",{id:p}),checked:d?!1:a,disabled:r!==null||d,onChange:h}),d?(0,O.jsx)(j,{tone:"warn",children:e("entriesManageDesktop",{id:p})}):(0,O.jsx)(m,{children:e("entriesManageNote",{id:p})}),i?(0,O.jsx)(j,{tone:"warn",children:e("entriesManageWinWarning",{id:p})}):null,o.length===0?(0,O.jsx)(m,{children:e("entriesEmpty",{id:p})}):(0,O.jsx)("div",{className:"hh-list",children:o.map(g=>{let b=g.live;return(0,O.jsxs)("div",{className:"hh-item",children:[(0,O.jsxs)("span",{className:"hh-item-main",children:[(0,O.jsx)("span",{className:"hh-item-name",children:g.intent.id}),(0,O.jsx)(U,{tone:g.exists?"ok":"bad",children:g.exists?e("entriesExists"):e("entriesMissing")}),(0,O.jsx)(U,{children:g.managed?e("entriesManaged"):e("entriesUnmanaged")}),g.drift.length>0?(0,O.jsx)(U,{tone:"warn",children:`${e("entriesDrift")} ${rt(g.drift)}`}):null]}),(0,O.jsx)("span",{className:"hh-item-spacer"}),(0,O.jsx)("span",{className:"hh-item-meta",children:b===null?e("entriesNotRunning"):`${A(b.status)}${b.pid===null?"":` \xB7 pid ${b.pid}`}`})]},g.intent.id)})})]})}var ae=require("react");var s=require("react/jsx-runtime"),hn={absent:"panelTokenWarnAbsent",present:"panelTokenWarnPresent",stale:"panelTokenWarnStale"};function un(e){if(e.token!=="enrolled")return e.token!=="unknown"?hn[e.token]:e.url===null?void 0:"panelTokenWarnUnreachable"}function gn(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 mn(e,t){return e.ok?e.value?.detail||t("panelStopped"):e.error.code==="client"?t("panelStopping"):t("panelStopFailed",{message:e.error.message})}function Nt(e,t,n){let r=n==="start"?"panelStartFailed":"panelReplaceFailed";if(!e.ok)return t(r,{message:e.error.message});let o=e.value;return o?.ok===!1?t(r,{message:o.detail??""}):o?.detail&&o.detail.length>0?o.detail:null}function fn({value:e,label:t,hint:n,invalidLabel:r,placeholder:o,disabled:a,onChange:i}){let[d,p]=(0,ae.useState)(e===null?"":String(e));(0,ae.useEffect)(()=>{p(e===null?"":String(e))},[e]);let h=d.trim()===""?null:Number(d),g=h!==null&&(!Number.isInteger(h)||h<1||h>65535),b=()=>{if(g){p(e===null?"":String(e));return}h!==e&&i(h)};return(0,s.jsxs)("div",{className:"hh-field-block",children:[(0,s.jsxs)("div",{className:"hh-field",children:[(0,s.jsx)("label",{className:"hh-field-label",htmlFor:"hh-panel-port",children:t}),(0,s.jsx)("input",{id:"hh-panel-port",className:"hh-input",type:"number",value:d,placeholder:o,disabled:a,onChange:B=>p(B.target.value),onBlur:b,onKeyDown:B=>{B.key==="Enter"&&b()}})]}),(0,s.jsx)(m,{children:g?r:n})]})}function Et({t:e,status:t,run:n,updateSettings:r,busy:o,uiStyle:a}){let i=t.panel,d=t.cli,p=t.instances??[],h=d?.prefer??t.settings.cli?.prefer??"pinned",[g,b]=(0,ae.useState)(!1),[B,H]=(0,ae.useState)(null),[E,R]=(0,ae.useState)(null),[$,z]=(0,ae.useState)(!1),[k,D]=(0,ae.useState)(null),[K,Q]=(0,ae.useState)(null),M=un(i),F=d?.version??null,Y=F!==null&&i.version!==null,q=i.reachable&&Y&&F!==i.version,{dependency:le,global:_}=d===void 0?{dependency:null,global:null}:dt(d),u=d===void 0?[]:[`pnpm add -g home-hosted@${d.expectedRange}`,`npm install -g home-hosted@${d.expectedRange}`],T=I=>{r(G=>({...G,cli:{...G.cli,prefer:I}}))},v=async()=>{let I=await n("cli.installGlobal",()=>P("cli.installGlobal",{}));if(!I.ok){H(e("panelInstallFailed",{message:I.error.message}));return}let G=I.value;G?.ok===!1?H(G.output&&G.output.length>0?G.output:e("panelInstallFailed",{message:G.detail??""})):H(typeof G?.output=="string"?G.output:null)},L=async()=>{R(gn(await n("panel.reclaimToken",()=>P("panel.reclaimToken",{})),e))},de=async()=>{Q(Nt(await n("panel.start",()=>P("panel.start",{})),e,"start"))},we=async()=>{b(!1),Q(Nt(await n("panel.takeover",()=>P("panel.takeover",{})),e,"replace"))},fe=async()=>{z(!1),D(e("panelStopping")),D(mn(await n("panel.stop",()=>P("panel.stop",{})),e))};return(0,s.jsxs)(X,{icon:(0,s.jsx)(Je,{}),title:e("panelTitle"),children:[M===void 0?null:(0,s.jsxs)(j,{tone:"warn",title:e("panelTokenWarningTitle"),children:[(0,s.jsx)("p",{children:e(M)}),i.reachable||i.token==="unknown"?null:(0,s.jsx)("p",{children:e("panelTokenWarnPanelDown")}),(0,s.jsx)("div",{className:"hh-note-actions",children:(0,s.jsx)(y,{variant:"primary",busy:o==="panel.reclaimToken",onClick:()=>{L()},children:e("panelTokenRegenerate")})})]}),E===null?null:(0,s.jsx)(m,{children:E}),d===void 0?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"hh-choice",role:"radiogroup","aria-label":e("panelCopy"),children:[(0,s.jsx)(be,{label:e("optionsPreferPinned"),hint:(0,s.jsx)(Ne,{children:e("optionsRecommended")}),meta:le===null?void 0:A(le.version),path:le?.path??void 0,checked:h==="pinned",disabled:le===null||o==="settings",onChange:()=>T("pinned")}),(0,s.jsx)(be,{label:e("optionsPreferGlobal"),meta:_===null?void 0:A(_.version),path:_?.path??void 0,checked:h==="global",disabled:_===null||o==="settings",onChange:()=>T("global")})]}),(0,s.jsx)(m,{children:e("panelCopyHint")}),d.source==="config"?(0,s.jsx)(m,{children:e("optionsConfigOverride")}):null,d.source==="path"&&h!=="global"?(0,s.jsx)(m,{children:e("panelCliNotPinned",{range:d.expectedRange})}):null,d.supported?null:(0,s.jsx)(j,{tone:"warn",children:e("panelCliUnsupported")}),d.launcherPath!=null&&d.launcherVersion==null?(0,s.jsx)(j,{tone:"warn",children:e("panelCliLauncherFailed")}):null]}),(0,s.jsx)(fn,{value:t.settings.panel?.port??null,label:e("panelPort"),hint:i.reachable?e("panelPortHint"):e("panelPortFree"),invalidLabel:e("panelPortInvalid"),placeholder:i.configPort==null?void 0:String(i.configPort),disabled:i.reachable||o!==null,onChange:I=>r(G=>({...G,panel:{...G.panel,port:I}}))}),t.panelRootSource!=="legacy"?null:(0,s.jsx)(m,{children:e("panelRootLegacy")}),p.length<=1?null:(0,s.jsxs)(re,{label:e("panelInstances",{count:p.length}),open:a==="detailed",children:[p.map(I=>(0,s.jsxs)(N,{label:I.managed?e("panelInstanceManaged"):e("panelInstanceOther"),children:[(0,s.jsx)(te,{children:I.home}),I.url===null?null:(0,s.jsxs)(s.Fragment,{children:[" \xB7 ",(0,s.jsx)(ie,{href:I.url,children:I.url})]}),` \xB7 ${I.running?e("stateAnswering"):e("stateNotAnswering")}`,I.version===null?null:` \xB7 ${I.version}`,I.hosting?` \xB7 ${e("panelInstanceHosts")}`:null]},I.home)),(0,s.jsx)(m,{children:e("panelInstancesHint")})]}),q?(0,s.jsx)(m,{children:e("panelOutdated")}):null,(0,s.jsxs)("div",{className:"hh-btn-row",children:[i.reachable?null:(0,s.jsx)(y,{variant:"primary",busy:o==="panel.start",onClick:()=>{de()},children:e("panelStart")}),i.reachable?(0,s.jsx)(y,{variant:"danger",disabled:o!==null,onClick:()=>z(!0),children:e("panelStop")}):null,q&&!g?(0,s.jsx)(y,{variant:"primary",onClick:()=>b(!0),children:e("panelReplace",{copy:e(h==="global"?"panelCopyGlobal":"panelCopyPinned")})}):null]}),k===null?null:(0,s.jsx)(m,{children:k}),K===null?null:(0,s.jsx)(m,{children:K}),$?(0,s.jsx)("div",{className:"hh-note",role:"alertdialog","aria-label":e("panelStopTitle"),children:(0,s.jsxs)("div",{className:"hh-note-body",children:[(0,s.jsx)("strong",{children:e("panelStopTitle")}),(0,s.jsx)("p",{children:e("panelStopBody")}),(0,s.jsxs)("div",{className:"hh-note-actions",children:[(0,s.jsx)(y,{onClick:()=>z(!1),children:e("confirmCancel")}),(0,s.jsx)(y,{variant:"danger",busy:o==="panel.stop",onClick:()=>{fe()},children:e("confirmStop")})]})]})}):null,q&&g?(0,s.jsx)("div",{className:"hh-note",role:"alertdialog","aria-label":e("panelTakeoverTitle"),children:(0,s.jsxs)("div",{className:"hh-note-body",children:[(0,s.jsx)("strong",{children:e("panelTakeoverTitle")}),(0,s.jsx)("p",{children:e("panelTakeoverBody",{id:t.defaultEntryId??"dsh"})}),(0,s.jsxs)("div",{className:"hh-note-actions",children:[(0,s.jsx)(y,{onClick:()=>b(!1),children:e("confirmCancel")}),(0,s.jsx)(y,{variant:"danger",busy:o==="panel.takeover",onClick:()=>{we()},children:e("confirmReplace")})]})]})}):null,d!==void 0&&_===null?(0,s.jsxs)(re,{label:e("optionsInstallLabel"),open:a==="detailed",children:[(0,s.jsx)(m,{children:e("optionsInstallHint")}),(0,s.jsx)(ye,{text:u.join(`
|
|
7
7
|
`),copyLabel:e("copy"),copiedLabel:e("copied")}),(0,s.jsx)("div",{className:"hh-btn-row",children:(0,s.jsx)(y,{busy:o==="cli.installGlobal",onClick:()=>{v()},children:e("optionsInstall")})}),B===null?null:(0,s.jsx)("pre",{className:"hh-output",children:B})]}):null,(0,s.jsxs)(re,{label:e("details"),open:a==="detailed",children:[(0,s.jsxs)(N,{label:e("panelHome"),children:[(0,s.jsx)(te,{children:i.home}),t.bootUnitName===void 0?null:(0,s.jsxs)(s.Fragment,{children:[" \xB7 ",t.bootUnitName]})]}),(0,s.jsx)(N,{label:e("panelUrl"),children:i.url===null?A(i.url):(0,s.jsx)(ie,{href:i.url,children:i.url})}),(0,s.jsx)(N,{label:e("panelVersion"),children:A(i.version)}),(0,s.jsx)(N,{label:e("panelPid"),children:A(i.pid)}),(0,s.jsx)(N,{label:e("panelWriteVia"),children:e(it[i.writeVia]??"writeViaNone")}),(0,s.jsx)(N,{label:e("panelToken"),children:e(st[i.token]??"tokenUnknown")}),d===void 0?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N,{label:e("panelCliSource"),children:`${e(lt[d.source]??"panelCliMissing")} \xB7 ${A(d.version)}`}),(0,s.jsx)(N,{label:e("panelCliPath"),children:(0,s.jsx)(te,{children:A(d.path)})})]}),i.detail.length>0?(0,s.jsx)(m,{children:i.detail}):null]})]})}var he=require("react");var Rt=require("react");var S=require("react/jsx-runtime");function Le(e){return{id:e.id,label:e.label??"",command:e.command??"",args:(e.args??[]).join(`
|
package/lib/index.js
CHANGED
|
@@ -258,11 +258,11 @@ function warnAccount(ctx, message) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
function uidOf(ctx) {
|
|
261
|
-
const configured = numberFrom(ctx.env.UID);
|
|
262
|
-
if (configured !== null)
|
|
263
|
-
return String(configured);
|
|
264
261
|
const uid = ctx.uid === void 0 ? process.getuid?.() ?? null : ctx.uid;
|
|
265
|
-
|
|
262
|
+
if (uid !== null)
|
|
263
|
+
return String(uid);
|
|
264
|
+
const configured = numberFrom(ctx.env.UID);
|
|
265
|
+
return configured === null ? null : String(configured);
|
|
266
266
|
}
|
|
267
267
|
function inspectOwned(file, marker) {
|
|
268
268
|
if (!fs2.existsSync(file))
|
|
@@ -837,10 +837,20 @@ function createSystemdUserProvider(ctx) {
|
|
|
837
837
|
async stopCommands(spec) {
|
|
838
838
|
return [["systemctl", "--user", "stop", unitOf(spec)]];
|
|
839
839
|
},
|
|
840
|
-
/**
|
|
840
|
+
/**
|
|
841
|
+
* No `--now`: the panel is already down when a switch runs this.
|
|
842
|
+
*
|
|
843
|
+
* Only our own artifact is retired. `status()` reports a unit as installed from
|
|
844
|
+
* its name alone (`installed = own.owned || probe.installed`), so a
|
|
845
|
+
* `home-hosted.service` somebody else wrote anywhere on the search path would
|
|
846
|
+
* otherwise reach `disable` here — and `home-hosted` is the generic name the
|
|
847
|
+
* machine-default install uses. The marker is what proves it is ours.
|
|
848
|
+
*/
|
|
841
849
|
async retireCommands(spec) {
|
|
842
850
|
const unit = unitOf(spec);
|
|
843
851
|
const file = pathOf(spec);
|
|
852
|
+
if (!inspectOwned(file, spec.marker).owned)
|
|
853
|
+
return { commands: [], display: [] };
|
|
844
854
|
return {
|
|
845
855
|
commands: [
|
|
846
856
|
["systemctl", "--user", "disable", unit],
|
|
@@ -1064,6 +1074,8 @@ function createSystemdSystemProvider(ctx) {
|
|
|
1064
1074
|
async retireCommands(spec) {
|
|
1065
1075
|
const unit = unitOf(spec);
|
|
1066
1076
|
const file = pathOf(spec);
|
|
1077
|
+
if (!inspectOwned(file, spec.marker).owned)
|
|
1078
|
+
return { commands: [], display: [] };
|
|
1067
1079
|
const elevate = (args) => ctx.isRoot ? args : ["sudo", "-n", ...args];
|
|
1068
1080
|
return {
|
|
1069
1081
|
commands: [
|
|
@@ -1460,9 +1472,12 @@ function createLaunchdProvider(ctx, mode) {
|
|
|
1460
1472
|
const remove = mode === "daemon" ? ["sudo", "-n", "rm", "-f", file] : ["rm", "-f", file];
|
|
1461
1473
|
return {
|
|
1462
1474
|
commands: [...bootout === null ? [] : [bootout], remove],
|
|
1475
|
+
// The display mirrors the command that actually runs: an agent's bootout is
|
|
1476
|
+
// unprivileged and names the agent's own domain, so printing the `system/`
|
|
1477
|
+
// form with `sudo` showed a person a command this plugin never runs.
|
|
1463
1478
|
display: [
|
|
1464
|
-
...bootout === null ? [] : [shellCommand(
|
|
1465
|
-
shellCommand(
|
|
1479
|
+
...bootout === null ? [] : [shellCommand(bootout[0], bootout.slice(1))],
|
|
1480
|
+
shellCommand(remove[0], remove.slice(1))
|
|
1466
1481
|
]
|
|
1467
1482
|
};
|
|
1468
1483
|
}
|
|
@@ -3687,8 +3702,8 @@ function pidAlive(pid) {
|
|
|
3687
3702
|
try {
|
|
3688
3703
|
process8.kill(pid, 0);
|
|
3689
3704
|
return true;
|
|
3690
|
-
} catch {
|
|
3691
|
-
return
|
|
3705
|
+
} catch (error) {
|
|
3706
|
+
return error.code === "EPERM";
|
|
3692
3707
|
}
|
|
3693
3708
|
}
|
|
3694
3709
|
async function probePanel(url, timeoutMs = 2e3) {
|
|
@@ -3971,7 +3986,9 @@ function fail(line) {
|
|
|
3971
3986
|
|
|
3972
3987
|
function alive(pid) {
|
|
3973
3988
|
if (typeof pid !== 'number') return false
|
|
3974
|
-
|
|
3989
|
+
// EPERM means the pid exists and is not ours to signal; treating it as gone
|
|
3990
|
+
// would skip the escalation and start a second panel over a live one.
|
|
3991
|
+
try { process.kill(pid, 0); return true } catch (error) { return error?.code === 'EPERM' }
|
|
3975
3992
|
}
|
|
3976
3993
|
|
|
3977
3994
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
@@ -4058,7 +4075,9 @@ function log(line) {
|
|
|
4058
4075
|
|
|
4059
4076
|
function alive(pid) {
|
|
4060
4077
|
if (typeof pid !== 'number') return false
|
|
4061
|
-
|
|
4078
|
+
// EPERM means the pid exists and is not ours to signal; treating it as gone
|
|
4079
|
+
// would skip the escalation and start a second panel over a live one.
|
|
4080
|
+
try { process.kill(pid, 0); return true } catch (error) { return error?.code === 'EPERM' }
|
|
4062
4081
|
}
|
|
4063
4082
|
|
|
4064
4083
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
@@ -4257,7 +4276,12 @@ var PanelClient = class {
|
|
|
4257
4276
|
async settings() {
|
|
4258
4277
|
return await this.request("GET", "/api/settings");
|
|
4259
4278
|
}
|
|
4260
|
-
/**
|
|
4279
|
+
/**
|
|
4280
|
+
* Re-list the port's listeners and stop what is not the panel's own tree.
|
|
4281
|
+
*
|
|
4282
|
+
* The page reads `free`, `port` and `skipped`; `stopped` is what the panel
|
|
4283
|
+
* answers today. Declared as the shared contract so both halves agree on it.
|
|
4284
|
+
*/
|
|
4261
4285
|
async freePort(id, workspace) {
|
|
4262
4286
|
return await this.request("POST", this.ws(`/api/servers/${encodeURIComponent(id)}/free-port`, workspace));
|
|
4263
4287
|
}
|
|
@@ -5455,7 +5479,7 @@ var HomeHostedService = class extends Service {
|
|
|
5455
5479
|
const status = await this.ladder().status(legacy, mechanism);
|
|
5456
5480
|
if (status.unitPath === null || status.state === "not-installed" || status.state === "unsupported")
|
|
5457
5481
|
return;
|
|
5458
|
-
if (!fs16.existsSync(status.unitPath))
|
|
5482
|
+
if (path15.isAbsolute(status.unitPath) && !fs16.existsSync(status.unitPath))
|
|
5459
5483
|
return;
|
|
5460
5484
|
await this.ladder().uninstall(legacy, status.mechanism ?? mechanism);
|
|
5461
5485
|
} catch {
|