@woosau/dsh-custom-env 0.1.0 → 0.1.4

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/lib/client.js CHANGED
@@ -209,6 +209,28 @@ var upsert$parameter$2$schema$value;
209
209
  var upsert$parameter$2$schema = () => upsert$parameter$2$schema$value ??= import_zod.z.string();
210
210
  var remove$parameter$0$schema$value;
211
211
  var remove$parameter$0$schema = () => remove$parameter$0$schema$value ??= import_zod.z.string();
212
+ var setVar$parameter$0$schema$value;
213
+ var setVar$parameter$0$schema = () => setVar$parameter$0$schema$value ??= import_zod.z.string();
214
+ var setVar$parameter$1$schema$value;
215
+ var setVar$parameter$1$schema = () => setVar$parameter$1$schema$value ??= import_zod.z.string();
216
+ var setVars$parameter$0$schema$value;
217
+ var setVars$parameter$0$schema = () => setVars$parameter$0$schema$value ??= import_zod.z.array(import_zod.z.object({
218
+ name: import_zod.z.string().readonly(),
219
+ value: import_zod.z.string().readonly()
220
+ }).readonly()).readonly();
221
+ var removeVar$parameter$0$schema$value;
222
+ var removeVar$parameter$0$schema = () => removeVar$parameter$0$schema$value ??= import_zod.z.string();
223
+ var removeVars$parameter$0$schema$value;
224
+ var removeVars$parameter$0$schema = () => removeVars$parameter$0$schema$value ??= import_zod.z.array(import_zod.z.string()).readonly();
225
+ var envVarWriteJsonSchema = {
226
+ type: "object",
227
+ properties: {
228
+ name: { type: "string" },
229
+ value: { type: "string" }
230
+ },
231
+ required: ["name", "value"],
232
+ additionalProperties: false
233
+ };
212
234
  var restore$parameter$0$schema$value;
213
235
  var restore$parameter$0$schema = () => restore$parameter$0$schema$value ??= import_zod.z.string();
214
236
  var cliStatusJsonSchema = {
@@ -295,7 +317,7 @@ var TYPERT_REMOTE = createTypertRemoteInfo({
295
317
  },
296
318
  {
297
319
  name: "value",
298
- description: "non-empty value.",
320
+ description: "value (empty string allowed).",
299
321
  source: "json",
300
322
  codec: {
301
323
  mode: "strict",
@@ -314,6 +336,121 @@ var TYPERT_REMOTE = createTypertRemoteInfo({
314
336
  },
315
337
  sourceLocation: { file: "src/index.ts", line: 1, column: 1 }
316
338
  },
339
+ "customEnv/setVars": {
340
+ service: "customEnv",
341
+ description: "Create or replace many variables by name in one rewrite. Empty values write NAME=.",
342
+ invocation: { kind: "direct" },
343
+ parameters: [
344
+ {
345
+ name: "entries",
346
+ description: "name/value pairs (last duplicate name wins).",
347
+ source: "json",
348
+ codec: {
349
+ mode: "strict",
350
+ typeSymbol: "readonly EnvVarWrite[]",
351
+ create: setVars$parameter$0$schema,
352
+ jsonSchema: { type: "array", items: envVarWriteJsonSchema }
353
+ }
354
+ }
355
+ ],
356
+ result: {
357
+ mode: "strict",
358
+ typeSymbol: "void",
359
+ create: () => import_zod.z.undefined(),
360
+ description: "no return value.",
361
+ jsonSchema: { type: "null" }
362
+ },
363
+ sourceLocation: { file: "src/index.ts", line: 1, column: 1 }
364
+ },
365
+ "customEnv/setVar": {
366
+ service: "customEnv",
367
+ description: "Create or replace one variable by name. Empty value writes NAME=.",
368
+ invocation: { kind: "direct" },
369
+ parameters: [
370
+ {
371
+ name: "name",
372
+ description: "writable variable name.",
373
+ source: "json",
374
+ codec: {
375
+ mode: "strict",
376
+ typeSymbol: "string",
377
+ create: setVar$parameter$0$schema,
378
+ jsonSchema: { type: "string" }
379
+ }
380
+ },
381
+ {
382
+ name: "value",
383
+ description: "value to store (empty string allowed).",
384
+ source: "json",
385
+ codec: {
386
+ mode: "strict",
387
+ typeSymbol: "string",
388
+ create: setVar$parameter$1$schema,
389
+ jsonSchema: { type: "string" }
390
+ }
391
+ }
392
+ ],
393
+ result: {
394
+ mode: "strict",
395
+ typeSymbol: "void",
396
+ create: () => import_zod.z.undefined(),
397
+ description: "no return value.",
398
+ jsonSchema: { type: "null" }
399
+ },
400
+ sourceLocation: { file: "src/index.ts", line: 1, column: 1 }
401
+ },
402
+ "customEnv/removeVars": {
403
+ service: "customEnv",
404
+ description: "Remove many variables by name from the file, Host, and OS user environment.",
405
+ invocation: { kind: "direct" },
406
+ parameters: [
407
+ {
408
+ name: "names",
409
+ description: "writable variable names.",
410
+ source: "json",
411
+ codec: {
412
+ mode: "strict",
413
+ typeSymbol: "readonly string[]",
414
+ create: removeVars$parameter$0$schema,
415
+ jsonSchema: { type: "array", items: { type: "string" } }
416
+ }
417
+ }
418
+ ],
419
+ result: {
420
+ mode: "strict",
421
+ typeSymbol: "number",
422
+ create: () => import_zod.z.number(),
423
+ description: "number of .env lines removed.",
424
+ jsonSchema: { type: "number" }
425
+ },
426
+ sourceLocation: { file: "src/index.ts", line: 1, column: 1 }
427
+ },
428
+ "customEnv/removeVar": {
429
+ service: "customEnv",
430
+ description: "Remove one variable by name from the file, Host, and OS user environment.",
431
+ invocation: { kind: "direct" },
432
+ parameters: [
433
+ {
434
+ name: "name",
435
+ description: "writable variable name.",
436
+ source: "json",
437
+ codec: {
438
+ mode: "strict",
439
+ typeSymbol: "string",
440
+ create: removeVar$parameter$0$schema,
441
+ jsonSchema: { type: "string" }
442
+ }
443
+ }
444
+ ],
445
+ result: {
446
+ mode: "strict",
447
+ typeSymbol: "boolean",
448
+ create: () => import_zod.z.boolean(),
449
+ description: "true when a .env line was removed.",
450
+ jsonSchema: { type: "boolean" }
451
+ },
452
+ sourceLocation: { file: "src/index.ts", line: 1, column: 1 }
453
+ },
317
454
  "customEnv/deleteEntry": {
318
455
  service: "customEnv",
319
456
  description: "Delete one entry from the file, Host, and OS user environment.",
@@ -402,6 +539,20 @@ var typert_remote_client_default = TYPERT_REMOTE;
402
539
  var import_react = require("react");
403
540
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
404
541
 
542
+ // src/client/format-remote-error.ts
543
+ function isRemoteFailure(value) {
544
+ return typeof value === "object" && value !== null && value.isDSHRemoteError === true && typeof value.code === "string";
545
+ }
546
+ function formatRemoteError(error, t) {
547
+ if (isRemoteFailure(error)) {
548
+ if (error.code === "custom-env/invalid-name") return t("error.invalidName");
549
+ if (error.code === "custom-env/invalid-value") return t("error.invalidValue");
550
+ if (error.code === "custom-env/restore-failed") return t("error.restoreFailed");
551
+ if (error.code === "custom-env/cli-install-failed") return t("error.cliInstall");
552
+ }
553
+ return t("error.generic");
554
+ }
555
+
405
556
  // src/client/EnvSettingsSection.module.css
406
557
  var css = ".EnvSettingsSection_section {\n display: flex;\n flex-direction: column;\n gap: 16px;\n max-width: 760px;\n color: var(--dsw-alias-label-primary);\n}\n\n.EnvSettingsSection_heading {\n margin: 0;\n font-size: 18px;\n font-weight: 500;\n line-height: 1.3;\n}\n\n/* \u2014\u2014 dsh CLI: exactly two lines (label + path) \u2014\u2014 */\n.EnvSettingsSection_cli {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n\n.EnvSettingsSection_cliHeading {\n margin: 0;\n font-size: 13px;\n font-weight: 500;\n line-height: 20px;\n color: var(--dsw-alias-label-secondary);\n}\n\n.EnvSettingsSection_cliBody {\n display: grid;\n grid-template-columns: minmax(0, 1fr) 28px;\n gap: 8px;\n align-items: center;\n height: 28px;\n}\n\n.EnvSettingsSection_cliPath {\n margin: 0;\n min-width: 0;\n font-size: 13px;\n line-height: 28px;\n color: var(--dsw-alias-label-tertiary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.EnvSettingsSection_cliSlot {\n display: flex;\n width: 28px;\n height: 28px;\n align-items: center;\n justify-content: center;\n}\n\n.EnvSettingsSection_cliSlot[data-empty='true'] {\n visibility: hidden;\n pointer-events: none;\n}\n\n.EnvSettingsSection_notice,\n.EnvSettingsSection_empty {\n margin: 0;\n font-size: 13px;\n line-height: 18px;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.EnvSettingsSection_notice[data-tone='error'] {\n color: var(--dsw-alias-label-danger, #c62828);\n}\n\n/* \u2014\u2014 variable list: CSS grid, not table (avoids Input overflow overlap) \u2014\u2014 */\n.EnvSettingsSection_list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n min-width: 0;\n}\n\n.EnvSettingsSection_header,\n.EnvSettingsSection_row {\n display: grid;\n grid-template-columns: minmax(120px, 0.85fr) minmax(0, 1.55fr) 100px;\n gap: 10px;\n align-items: center;\n min-width: 0;\n}\n\n.EnvSettingsSection_header {\n padding: 0 0 2px;\n}\n\n.EnvSettingsSection_headerLabel {\n margin: 0;\n font-size: 12px;\n font-weight: 500;\n line-height: 1.3;\n color: var(--dsw-alias-label-tertiary);\n}\n\n.EnvSettingsSection_headerActions {\n width: 100px;\n}\n\n.EnvSettingsSection_field {\n min-width: 0;\n overflow: hidden;\n}\n\n.EnvSettingsSection_fieldInput {\n display: flex;\n box-sizing: border-box;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n}\n\n.EnvSettingsSection_actions {\n display: grid;\n grid-template-columns: repeat(3, 28px);\n gap: 4px;\n align-items: center;\n justify-content: end;\n width: 100px;\n margin-left: auto;\n flex-shrink: 0;\n}\n\n.EnvSettingsSection_slot {\n display: flex;\n width: 28px;\n height: 28px;\n align-items: center;\n justify-content: center;\n}\n\n.EnvSettingsSection_slot[data-empty='true'] {\n visibility: hidden;\n pointer-events: none;\n}\n\n.EnvSettingsSection_iconButton {\n display: inline-flex;\n width: 28px;\n height: 28px;\n margin: 0;\n padding: 0;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: var(--dsw-radius-sm, 6px);\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n cursor: pointer;\n}\n\n.EnvSettingsSection_iconButton:hover:not(:disabled) {\n background: var(--dsw-alias-fill-hover, rgba(127, 127, 127, 0.12));\n color: var(--dsw-alias-label-primary);\n}\n\n.EnvSettingsSection_iconButton:disabled {\n opacity: 0.45;\n cursor: default;\n}\n\n.EnvSettingsSection_iconButtonDanger:hover:not(:disabled) {\n color: var(--dsw-alias-label-danger, #c62828);\n}\n\n.EnvSettingsSection_iconButtonPrimary {\n color: var(--dsw-alias-brand-primary, #247bbf);\n}\n\n.EnvSettingsSection_restartBadge {\n display: inline-flex;\n width: 28px;\n height: 28px;\n align-items: center;\n justify-content: center;\n color: var(--dsw-alias-label-warning, #c67c00);\n}\n\n.EnvSettingsSection_spinner {\n animation: spin 1s linear infinite;\n}\n\n@keyframes spin {\n to { transform: rotate(360deg); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .EnvSettingsSection_spinner {\n animation: none;\n }\n}\n";
407
558
  if (typeof document !== "undefined" && !document.getElementById("dsh-custom-env-css")) {
@@ -453,10 +604,10 @@ function RowActions({
453
604
  onRestore,
454
605
  onRemove
455
606
  }) {
456
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.actions, role: "group", "aria-label": t("actions"), children: [
457
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !dirty && !pending, children: dirty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: loading ? t("loading") : t("confirm"), primary: true, disabled: busy || !canConfirm, onClick: onConfirm, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconLoadingOutlineRegular, { className: EnvSettingsSection_default.spinner, size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tooltip, { portal: true, label: t("restartRequired"), side: "top", delayMs: 400, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: EnvSettingsSection_default.restartBadge, role: "img", "aria-label": t("restartRequired"), title: t("restartRequired"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconWarningOutlineRegular, { size: 14 }) }) }) }),
458
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !dirty && !pending, children: dirty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("cancel"), disabled: busy, onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("restore"), disabled: busy, onClick: onRestore, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 14 }) }) }),
459
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !showRemove, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("remove"), danger: true, disabled: busy, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconTrashOutlineRegular, { size: 14 }) }) })
607
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.actions, role: "group", "aria-label": t("field.actions"), children: [
608
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !dirty && !pending, children: dirty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: loading ? t("panel.loading") : t("action.confirm"), primary: true, disabled: busy || !canConfirm, onClick: onConfirm, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconLoadingOutlineRegular, { className: EnvSettingsSection_default.spinner, size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tooltip, { portal: true, label: t("status.restartRequired"), side: "top", delayMs: 400, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: EnvSettingsSection_default.restartBadge, role: "img", "aria-label": t("status.restartRequired"), title: t("status.restartRequired"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconWarningOutlineRegular, { size: 14 }) }) }) }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !dirty && !pending, children: dirty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("action.cancel"), disabled: busy, onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("action.restore"), disabled: busy, onClick: onRestore, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 14 }) }) }),
610
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slot, { empty: !showRemove, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconAction, { label: t("action.remove"), danger: true, disabled: busy, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconTrashOutlineRegular, { size: 14 }) }) })
460
611
  ] });
461
612
  }
462
613
  function Field(props) {
@@ -515,8 +666,8 @@ function EnvSettingsSection({
515
666
  setError(void 0);
516
667
  try {
517
668
  applySnapshot(await action());
518
- } catch {
519
- setError(t("error"));
669
+ } catch (err) {
670
+ setError(formatRemoteError(err, t));
520
671
  } finally {
521
672
  setBusyTarget(void 0);
522
673
  }
@@ -531,8 +682,8 @@ function EnvSettingsSection({
531
682
  } catch {
532
683
  setCli(void 0);
533
684
  }
534
- } catch {
535
- setError(t("error"));
685
+ } catch (err) {
686
+ setError(formatRemoteError(err, t));
536
687
  } finally {
537
688
  setBusyTarget(void 0);
538
689
  }
@@ -558,11 +709,11 @@ function EnvSettingsSection({
558
709
  const cliInstalling = busyTarget === "cli";
559
710
  const cliBooting = busyTarget === "boot" || cli === void 0;
560
711
  const showCliAction = cli?.canInstall === true || cliInstalling;
561
- const notice = error ?? (nameError ? t("invalidName") : void 0) ?? (cli?.reason === "could-not-resolve-expected-cli" ? t("cliReasonUnresolved") : void 0) ?? (cli?.reason === "unsupported-platform" ? t("cliReasonUnsupported") : void 0);
712
+ const notice = error ?? (nameError ? t("error.invalidName") : void 0) ?? (cli?.reason === "could-not-resolve-expected-cli" ? t("error.cliUnresolved") : void 0) ?? (cli?.reason === "unsupported-platform" ? t("error.cliUnsupported") : void 0);
562
713
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.section, children: [
563
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: EnvSettingsSection_default.heading, children: t("title") }),
564
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: EnvSettingsSection_default.cli, "aria-label": t("cliTitle"), children: [
565
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: EnvSettingsSection_default.cliHeading, children: t("cliTitle") }),
714
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: EnvSettingsSection_default.heading, children: t("panel.title") }),
715
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: EnvSettingsSection_default.cli, "aria-label": t("cli.title"), children: [
716
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: EnvSettingsSection_default.cliHeading, children: t("cli.title") }),
566
717
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.cliBody, children: [
567
718
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
568
719
  "p",
@@ -570,13 +721,13 @@ function EnvSettingsSection({
570
721
  className: EnvSettingsSection_default.cliPath,
571
722
  title: cliBooting ? void 0 : cli.activePath ?? void 0,
572
723
  "aria-busy": cliBooting || cliInstalling,
573
- children: cliBooting ? t("loading") : cli.activePath === null ? t("cliActiveMissing") : cli.activePath
724
+ children: cliBooting ? t("panel.loading") : cli.activePath === null ? t("cli.activeMissing") : cli.activePath
574
725
  }
575
726
  ),
576
727
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: EnvSettingsSection_default.cliSlot, "data-empty": showCliAction ? "false" : "true", children: showCliAction ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
577
728
  IconAction,
578
729
  {
579
- label: cliInstalling ? t("loading") : cli?.platform === "darwin" ? t("cliMacConflict") : t("cliInstall"),
730
+ label: cliInstalling ? t("panel.loading") : cli?.platform === "darwin" ? t("cli.macConflict") : t("cli.install"),
580
731
  disabled: busy,
581
732
  onClick: () => {
582
733
  if (busyTarget !== void 0) return;
@@ -585,8 +736,8 @@ function EnvSettingsSection({
585
736
  void (async () => {
586
737
  try {
587
738
  setCli(await cliInstall());
588
- } catch {
589
- setError(t("cliInstallError"));
739
+ } catch (err) {
740
+ setError(formatRemoteError(err, t));
590
741
  } finally {
591
742
  setBusyTarget(void 0);
592
743
  }
@@ -600,11 +751,11 @@ function EnvSettingsSection({
600
751
  notice !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.notice, "data-tone": error !== void 0 || nameError ? "error" : void 0, role: "status", children: notice }) : null,
601
752
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.list, children: [
602
753
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: EnvSettingsSection_default.header, children: [
603
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.headerLabel, children: t("name") }),
604
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.headerLabel, children: t("value") }),
754
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.headerLabel, children: t("field.name") }),
755
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.headerLabel, children: t("field.value") }),
605
756
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: EnvSettingsSection_default.headerActions, "aria-hidden": "true" })
606
757
  ] }),
607
- snapshot !== void 0 && entries.length === 0 && notice === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.empty, children: t("empty") }) : null,
758
+ snapshot !== void 0 && entries.length === 0 && notice === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: EnvSettingsSection_default.empty, children: t("panel.empty") }) : null,
608
759
  entries.map((entry) => {
609
760
  const draft = drafts[entry.id] ?? { name: entry.name, value: entry.value };
610
761
  const dirty = draft.name !== entry.name || draft.value !== entry.value;
@@ -621,7 +772,7 @@ function EnvSettingsSection({
621
772
  disabled: busy,
622
773
  title: draft.name,
623
774
  invalid: nameError && dirty,
624
- label: t("name"),
775
+ label: t("field.name"),
625
776
  onChange: (name) => {
626
777
  setNameError(false);
627
778
  setDraft(entry.id, { name });
@@ -635,7 +786,7 @@ function EnvSettingsSection({
635
786
  value: draft.value,
636
787
  disabled: busy,
637
788
  title: draft.value,
638
- label: t("value"),
789
+ label: t("field.value"),
639
790
  onChange: (value) => {
640
791
  setDraft(entry.id, { value });
641
792
  }
@@ -674,10 +825,10 @@ function EnvSettingsSection({
674
825
  id: "env-new-name",
675
826
  value: newDraft.name,
676
827
  disabled: busy,
677
- placeholder: t("namePlaceholder"),
678
- title: newDraft.name || t("namePlaceholder"),
828
+ placeholder: t("field.namePlaceholder"),
829
+ title: newDraft.name || t("field.namePlaceholder"),
679
830
  invalid: nameError,
680
- label: t("name"),
831
+ label: t("field.name"),
681
832
  onChange: (name) => {
682
833
  setNameError(false);
683
834
  setDraft(NEW_ID, { name });
@@ -690,9 +841,9 @@ function EnvSettingsSection({
690
841
  id: "env-new-value",
691
842
  value: newDraft.value,
692
843
  disabled: busy,
693
- placeholder: t("valuePlaceholder"),
694
- title: newDraft.value || t("valuePlaceholder"),
695
- label: t("value"),
844
+ placeholder: t("field.valuePlaceholder"),
845
+ title: newDraft.value || t("field.valuePlaceholder"),
846
+ label: t("field.value"),
696
847
  onChange: (value) => {
697
848
  setDraft(NEW_ID, { value });
698
849
  }
@@ -727,13 +878,13 @@ function EnvSettingsSection({
727
878
  onClose: () => {
728
879
  if (!busy) setPendingRemove(void 0);
729
880
  },
730
- title: t("removeConfirmTitle"),
731
- closeLabel: t("close"),
732
- description: pendingRemove ? t("removeConfirm", { name: pendingRemove.name }) : void 0,
881
+ title: t("action.removeConfirmTitle"),
882
+ closeLabel: t("action.close"),
883
+ description: pendingRemove ? t("action.removeConfirm", { name: pendingRemove.name }) : void 0,
733
884
  footer: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
734
885
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { variant: "outline", disabled: busy, onClick: () => {
735
886
  setPendingRemove(void 0);
736
- }, children: t("cancel") }),
887
+ }, children: t("action.cancel") }),
737
888
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
738
889
  import_dsh_client_ui_primitives.Button,
739
890
  {
@@ -745,7 +896,7 @@ function EnvSettingsSection({
745
896
  setPendingRemove(void 0);
746
897
  void run(`row:${id}`, () => remove(id));
747
898
  },
748
- children: t("remove")
899
+ children: t("action.remove")
749
900
  }
750
901
  )
751
902
  ] })
@@ -756,61 +907,65 @@ function EnvSettingsSection({
756
907
 
757
908
  // src/client/locales.ts
758
909
  var NS = "settings.env";
759
- var en = {
760
- nav: "Environment",
761
- title: "Environment",
762
- empty: "No variables",
763
- name: "Name",
764
- value: "Value",
765
- actions: "Actions",
766
- confirm: "Confirm",
767
- cancel: "Cancel",
768
- remove: "Delete",
769
- removeConfirmTitle: "Delete variable",
770
- removeConfirm: "Delete {name}?",
771
- restore: "Restore original",
772
- close: "Close",
773
- namePlaceholder: "MY_VAR",
774
- valuePlaceholder: "value",
775
- loading: "Loading\u2026",
776
- error: "Update failed",
777
- invalidName: "Invalid name",
778
- restartRequired: "Restart the client",
779
- cliTitle: "dsh",
780
- cliActiveMissing: "Not found",
781
- cliInstall: "Install",
782
- cliMacConflict: "Replaces /usr/local/bin/dsh",
783
- cliInstallError: "Install failed",
784
- cliReasonUnresolved: "Install unavailable",
785
- cliReasonUnsupported: "Windows / macOS only"
786
- };
787
910
  var zh = {
788
- nav: "\u73AF\u5883\u53D8\u91CF",
789
- title: "\u73AF\u5883\u53D8\u91CF",
790
- empty: "\u6682\u65E0\u53D8\u91CF",
791
- name: "\u540D\u79F0",
792
- value: "\u503C",
793
- actions: "\u64CD\u4F5C",
794
- confirm: "\u786E\u5B9A",
795
- cancel: "\u53D6\u6D88",
796
- remove: "\u5220\u9664",
797
- removeConfirmTitle: "\u5220\u9664\u53D8\u91CF",
798
- removeConfirm: "\u5220\u9664 {name}\uFF1F",
799
- restore: "\u6062\u590D\u539F\u503C",
800
- close: "\u5173\u95ED",
801
- namePlaceholder: "MY_VAR",
802
- valuePlaceholder: "\u503C",
803
- loading: "\u52A0\u8F7D\u4E2D\u2026",
804
- error: "\u66F4\u65B0\u5931\u8D25",
805
- invalidName: "\u540D\u79F0\u65E0\u6548",
806
- restartRequired: "\u9700\u91CD\u542F\u5BA2\u6237\u7AEF",
807
- cliTitle: "dsh",
808
- cliActiveMissing: "\u672A\u627E\u5230",
809
- cliInstall: "\u5B89\u88C5",
810
- cliMacConflict: "\u5C06\u66FF\u6362 /usr/local/bin/dsh",
811
- cliInstallError: "\u5B89\u88C5\u5931\u8D25",
812
- cliReasonUnresolved: "\u65E0\u6CD5\u5B89\u88C5",
813
- cliReasonUnsupported: "\u4EC5 Windows / macOS"
911
+ "panel.nav": "\u73AF\u5883\u53D8\u91CF",
912
+ "panel.title": "\u73AF\u5883\u53D8\u91CF",
913
+ "panel.empty": "\u6682\u65E0\u53D8\u91CF",
914
+ "panel.loading": "\u52A0\u8F7D\u4E2D\u2026",
915
+ "field.name": "\u540D\u79F0",
916
+ "field.value": "\u503C",
917
+ "field.actions": "\u64CD\u4F5C",
918
+ "field.namePlaceholder": "MY_VAR",
919
+ "field.valuePlaceholder": "\u503C",
920
+ "action.confirm": "\u786E\u5B9A",
921
+ "action.cancel": "\u53D6\u6D88",
922
+ "action.remove": "\u5220\u9664",
923
+ "action.removeConfirmTitle": "\u5220\u9664\u53D8\u91CF",
924
+ "action.removeConfirm": "\u5220\u9664 {name}\uFF1F",
925
+ "action.restore": "\u6062\u590D\u539F\u503C",
926
+ "action.close": "\u5173\u95ED",
927
+ "status.restartRequired": "\u9700\u91CD\u542F\u5BA2\u6237\u7AEF",
928
+ "cli.title": "dsh",
929
+ "cli.activeMissing": "\u672A\u627E\u5230",
930
+ "cli.install": "\u5B89\u88C5",
931
+ "cli.macConflict": "\u5C06\u66FF\u6362 /usr/local/bin/dsh",
932
+ "error.generic": "\u66F4\u65B0\u5931\u8D25",
933
+ "error.invalidName": "\u540D\u79F0\u65E0\u6548",
934
+ "error.invalidValue": "\u503C\u65E0\u6548",
935
+ "error.restoreFailed": "\u6062\u590D\u5931\u8D25",
936
+ "error.cliInstall": "\u5B89\u88C5\u5931\u8D25",
937
+ "error.cliUnresolved": "\u65E0\u6CD5\u5B89\u88C5",
938
+ "error.cliUnsupported": "\u4EC5 Windows / macOS"
939
+ };
940
+ var en = {
941
+ "panel.nav": "Environment",
942
+ "panel.title": "Environment",
943
+ "panel.empty": "No variables",
944
+ "panel.loading": "Loading\u2026",
945
+ "field.name": "Name",
946
+ "field.value": "Value",
947
+ "field.actions": "Actions",
948
+ "field.namePlaceholder": "MY_VAR",
949
+ "field.valuePlaceholder": "value",
950
+ "action.confirm": "Confirm",
951
+ "action.cancel": "Cancel",
952
+ "action.remove": "Delete",
953
+ "action.removeConfirmTitle": "Delete variable",
954
+ "action.removeConfirm": "Delete {name}?",
955
+ "action.restore": "Restore original",
956
+ "action.close": "Close",
957
+ "status.restartRequired": "Restart the client",
958
+ "cli.title": "dsh",
959
+ "cli.activeMissing": "Not found",
960
+ "cli.install": "Install",
961
+ "cli.macConflict": "Replaces /usr/local/bin/dsh",
962
+ "error.generic": "Update failed",
963
+ "error.invalidName": "Invalid name",
964
+ "error.invalidValue": "Invalid value",
965
+ "error.restoreFailed": "Restore failed",
966
+ "error.cliInstall": "Install failed",
967
+ "error.cliUnresolved": "Install unavailable",
968
+ "error.cliUnsupported": "Windows / macOS only"
814
969
  };
815
970
 
816
971
  // src/client/mount.ts
@@ -826,7 +981,7 @@ function registerUi(ctx) {
826
981
  name: "settings.section",
827
982
  id: "env",
828
983
  order: 25,
829
- label: () => t("nav"),
984
+ label: () => t("panel.nav"),
830
985
  locale: NS,
831
986
  inject: () => ({
832
987
  load: async () => call(await ctx.remote.customEnv.list()),