@mars-sea/dsh-commandcode-provider 0.14.0 → 0.14.2

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
@@ -3129,7 +3129,7 @@ window.__ModuleLoader__.load({
3129
3129
  visibleModelsStaleHint: "有 {count} 个已选模型在目录中找不到了(可能已下架),不影响其他模型;可清理或保留。",
3130
3130
  visibleModelsCleanStale: "清理失效({count})",
3131
3131
  contextWindow: "自定义上下文长度",
3132
- contextWindowHint: "覆盖模型目录公布的上下文窗口(token):上下文计量、自动压缩时机与模型选择器的上下文标注都按此值计算,对未单独设置的模型生效。留空则跟随目录;支持 32K、1M 这样的简写(二进制换算:32K = 32 768,1M = 1 048 576)。",
3132
+ contextWindowHint: "覆盖模型目录公布的上下文窗口(对未单独覆盖的模型生效),影响上下文计量与自动压缩;留空跟随目录。支持 32K、1M 简写。",
3133
3133
  contextOverridesTitle: "按模型覆盖",
3134
3134
  contextOverridesHint: "为单个模型单独设置上下文长度,优先于上面的全局值;模型下拉只列出模型白名单中的可见模型(显示全部时即整个目录)。",
3135
3135
  contextOverrideAdd: "添加模型",
@@ -3141,7 +3141,7 @@ window.__ModuleLoader__.load({
3141
3141
  contextWindowTooLarge: "上下文长度不能大于 10,000,000",
3142
3142
  contextWindowInvalid: "请输入有效的整数 token 数",
3143
3143
  maxOutputTokens: "单轮输出上限",
3144
- maxOutputTokensHint: "每次请求发送的输出预算(token)。留空=按模型自身输出上限推导(默认,行为不变);填正整数=与推导值取较小者,永远不会超过模型上限或网关上限 131072。填 `0`=请求中不发送该字段,把单轮输出规模交回平台自行限制——这是「长回答被硬切」的解法,但仅 CLI 与 OpenAI 两条传输支持;Claude 走的 Messages 端点必填该字段,因此那里仍按推导值发送,填 0 对它无效。会话标题这类由宿主明确限定预算的辅助调用也不受此设置影响。支持 64K 这样的简写。",
3144
+ maxOutputTokensHint: "留空=按模型推导(默认);正整数=不超过模型上限与网关上限 131072;0=不发送该字段(仅 CLI 与 OpenAI 有效,Claude 的 Messages 端点必填)。支持 64K 简写。",
3145
3145
  maxOutputTokensTooSmall: "输出上限不能小于 0(0 表示不发送该字段)",
3146
3146
  maxOutputTokensTooLarge: "输出上限不能大于 131072(网关上限)",
3147
3147
  maxOutputTokensInvalid: "请输入 0 或有效的整数 token 数",
@@ -3279,6 +3279,7 @@ window.__ModuleLoader__.load({
3279
3279
  modelCount: "已选 {count} 个模型",
3280
3280
  modelCatalogFailed: "模型目录获取失败,暂时无法选择模型;已保存的设置仍会生效。",
3281
3281
  modelsTitle: "模型与上下文",
3282
+ modelsInvalid: "模型与上下文中有未填好的数字,请展开修正后再保存。",
3282
3283
  privacyTitle: "隐私与安全",
3283
3284
  integrationsTitle: "集成与显示",
3284
3285
  enrollmentCreating: "正在创建账号",
@@ -3354,7 +3355,7 @@ window.__ModuleLoader__.load({
3354
3355
  visibleModelsStaleHint: "{count} selected model(s) are no longer in the catalog (possibly retired); other models are unaffected. Clean them up or keep them.",
3355
3356
  visibleModelsCleanStale: "Clean stale ({count})",
3356
3357
  contextWindow: "Custom context length",
3357
- contextWindowHint: "Overrides the context window published by the model catalog (in tokens): the context meter, auto-compaction timing and the model-picker annotation all follow it, for every model without a per-model override below. Empty follows the catalog; shorthand like 32K or 1M is accepted (binary units: 32K is 32,768, 1M is 1,048,576).",
3358
+ contextWindowHint: "Overrides the context window published by the model catalog, for every model without an override of its own below; the context meter and auto-compaction follow it. Empty follows the catalog. Shorthand like 32K or 1M is accepted.",
3358
3359
  contextOverridesTitle: "Per-model overrides",
3359
3360
  contextOverridesHint: "Set a context length for one model; it wins over the global value above. The picker lists only the models kept by the visible-models allowlist (the whole catalog while showing all).",
3360
3361
  contextOverrideAdd: "Add model",
@@ -3366,7 +3367,7 @@ window.__ModuleLoader__.load({
3366
3367
  contextWindowTooLarge: "Context length must not exceed 10,000,000",
3367
3368
  contextWindowInvalid: "Enter a valid whole-token count",
3368
3369
  maxOutputTokens: "Output limit per turn",
3369
- maxOutputTokensHint: "The output budget sent with each request, in tokens. Empty derives it from the model’s own ceiling (the default; nothing changes). A positive number is taken as a cap alongside that derived value, so it can never exceed the model ceiling or the gateway’s 131,072. `0` sends no such field at all and leaves the per-turn output size to the platform — the fix for answers being cut short — but only the CLI and OpenAI transports support it: the Messages endpoint Claude uses requires the field, so Claude keeps its derived budget and `0` has no effect there. Auxiliary calls whose budget the host fixes itself, such as the session title, are unaffected too. Shorthand like 64K is accepted.",
3370
+ maxOutputTokensHint: "Empty derives it from the model (default). A positive number never exceeds the model ceiling or the gateway’s 131,072. 0 omits the field (CLI and OpenAI only; Claude’s Messages endpoint requires it). 64K shorthand accepted.",
3370
3371
  maxOutputTokensTooSmall: "Output limit must be at least 0 (0 omits the field)",
3371
3372
  maxOutputTokensTooLarge: "Output limit must not exceed 131,072 (the gateway cap)",
3372
3373
  maxOutputTokensInvalid: "Enter 0 or a valid whole-token count",
@@ -3504,6 +3505,7 @@ window.__ModuleLoader__.load({
3504
3505
  modelCount: "{count} models selected",
3505
3506
  modelCatalogFailed: "The model catalog could not be loaded; saved settings still apply.",
3506
3507
  modelsTitle: "Models & context",
3508
+ modelsInvalid: "A number in Models & context is not ready to save; expand to fix it.",
3507
3509
  privacyTitle: "Privacy & security",
3508
3510
  integrationsTitle: "Integrations & display",
3509
3511
  enrollmentCreating: "Creating the account",
@@ -3702,7 +3704,7 @@ window.__ModuleLoader__.load({
3702
3704
  }
3703
3705
  //#endregion
3704
3706
  //#region package.json
3705
- var version = "0.14.0";
3707
+ var version = "0.14.2";
3706
3708
  var repository = {
3707
3709
  "type": "git",
3708
3710
  "url": "git+https://github.com/Mars-Sea/dsh-commandcode-provider.git"
@@ -3892,6 +3894,13 @@ window.__ModuleLoader__.load({
3892
3894
  * below Accounts is a flat group of rows (title/description left, control
3893
3895
  * right) inside the staged form the floating save bar writes.
3894
3896
  *
3897
+ * Two of those groups fold from their own heading — Models & context (issue
3898
+ * #94) and Advanced — and both start collapsed on every visit, with no
3899
+ * remembered state. While a group is collapsed its rows are not on screen, so
3900
+ * anything inside it that blocks the save is reported on the heading itself
3901
+ * (see `CollapsibleGroup`); the save bar alone would leave the disabled Save
3902
+ * button unexplained.
3903
+ *
3895
3904
  * Styles are injected once by the client entry (see src/client/index.ts) and
3896
3905
  * class-prefixed `cc-` to stay local.
3897
3906
  */
@@ -3902,6 +3911,28 @@ window.__ModuleLoader__.load({
3902
3911
  "transportMaxRetries",
3903
3912
  "offloadSeenImagesForCache"
3904
3913
  ];
3914
+ const MODELS_FIELDS = [
3915
+ "filterModelsByPlan",
3916
+ "contextWindow",
3917
+ "maxOutputTokens"
3918
+ ];
3919
+ /**
3920
+ * Whether anything the collapsed Advanced card owns is blocking the save. The
3921
+ * card is folded on arrival, so this drives the warning badge on its heading.
3922
+ */
3923
+ function advancedGroupInvalid(state) {
3924
+ return ADVANCED_FIELDS.some((field) => state[field].invalid);
3925
+ }
3926
+ /**
3927
+ * Whether anything the collapsed Models & context group owns is blocking the
3928
+ * save (issue #94). Besides its staged drafts — the plan switch and the two
3929
+ * numbers — that group owns the per-model context rows, whose drafts are
3930
+ * validated one by one: a bad row must surface on the heading just like a bad
3931
+ * number, or Save would sit disabled with nothing on screen explaining why.
3932
+ */
3933
+ function modelsGroupInvalid(state) {
3934
+ return MODELS_FIELDS.some((field) => state[field].invalid) || state.contextWindowOverrides.some((row) => row.invalid);
3935
+ }
3905
3936
  /** The "customized" tag and reset link a staged field shows once it differs from the default. */
3906
3937
  function FieldOverride({ label, state, disabled, t, onReset }) {
3907
3938
  if (!state.overridden && !state.clear) return null;
@@ -4453,17 +4484,86 @@ window.__ModuleLoader__.load({
4453
4484
  });
4454
4485
  }
4455
4486
  /**
4487
+ * The heading of a foldable group: the whole row is the toggle and the chevron
4488
+ * sits at its trailing edge. Shared by Models & context (issue #94: the
4489
+ * reporter asked for it to fold "like Advanced below") and Advanced itself, so
4490
+ * the two cannot drift apart in either markup or behaviour.
4491
+ *
4492
+ * The title is a `span`, not the `h3` a static group uses, because a heading
4493
+ * element cannot sit inside a button — the same trade-off Advanced has always
4494
+ * made on its own.
4495
+ */
4496
+ function DisclosureHead({ title, bodyId, expanded, onToggle, badges }) {
4497
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4498
+ type: "button",
4499
+ className: "cc-groupHead cc-disclosure",
4500
+ "aria-expanded": expanded,
4501
+ "aria-controls": bodyId,
4502
+ onClick: onToggle,
4503
+ children: [
4504
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4505
+ className: "cc-groupTitle",
4506
+ children: title
4507
+ }),
4508
+ badges?.(expanded),
4509
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cc-spacer" }),
4510
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4511
+ className: expanded ? "cc-chevron cc-chevronUp" : "cc-chevron",
4512
+ "aria-hidden": "true"
4513
+ })
4514
+ ]
4515
+ });
4516
+ }
4517
+ /**
4518
+ * A titled group that folds from its own heading and starts collapsed. The
4519
+ * state is deliberately component-local — not persisted, not lifted into the
4520
+ * controller — so every visit opens at the same, predictable page length, and
4521
+ * folding can never turn into a stored preference the settings document would
4522
+ * have to carry.
4523
+ */
4524
+ function CollapsibleGroup({ title, bodyId, divided = false, badges, footer, children }) {
4525
+ const [expanded, setExpanded] = (0, react.useState)(false);
4526
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4527
+ className: divided ? "cc-group cc-groupDivided" : "cc-group",
4528
+ "aria-label": title,
4529
+ children: [
4530
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DisclosureHead, {
4531
+ title,
4532
+ bodyId,
4533
+ expanded,
4534
+ onToggle: () => setExpanded((value) => !value),
4535
+ badges
4536
+ }),
4537
+ expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4538
+ id: bodyId,
4539
+ className: "cc-rows",
4540
+ children
4541
+ }) : null,
4542
+ expanded ? footer : null
4543
+ ]
4544
+ });
4545
+ }
4546
+ /**
4456
4547
  * Models & context: the plan filter and the allowlist sit together because both
4457
4548
  * decide what the model picker lists (the allowlist applies after the plan
4458
4549
  * filter), and the context-length fields follow them because they are the same
4459
4550
  * subject seen from the other side — the window each listed model advertises.
4460
4551
  * Those fields carry no heading or divider of their own: they are rows of this
4461
- * group, not a section inside it.
4552
+ * group, not a section inside it. The group folds from its heading and starts
4553
+ * collapsed (issue #94, "same as Advanced below"): it is the longest group on
4554
+ * the page and its rows are set-and-forget, so folding keeps Accounts and the
4555
+ * two switches below it reachable without scrolling past the allowlist.
4462
4556
  */
4463
4557
  function ModelsCard({ state, disabled, t, onEdit, onReset, onSelect, onClear, onOverrides }) {
4464
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SettingsGroup, {
4558
+ const invalid = modelsGroupInvalid(state);
4559
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CollapsibleGroup, {
4465
4560
  title: t("modelsTitle"),
4561
+ bodyId: "cc-models-body",
4466
4562
  divided: true,
4563
+ badges: (expanded) => !expanded && invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4564
+ className: "cc-badge cc-badgeWarn",
4565
+ children: t("modelsInvalid")
4566
+ }) : null,
4467
4567
  children: [
4468
4568
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleField, {
4469
4569
  id: "cc-filter-models-by-plan",
@@ -4699,116 +4799,92 @@ window.__ModuleLoader__.load({
4699
4799
  });
4700
4800
  }
4701
4801
  /**
4702
- * The collapsed "Advanced" card: the API base and the network limits. Starts
4703
- * collapsed on every visit; while collapsed, a badge names the customized
4802
+ * The collapsed "Advanced" card: the API base and the network limits. Folds
4803
+ * through the same `CollapsibleGroup` the Models & context group uses, so the
4804
+ * two disclosures stay identical; while collapsed, a badge names the customized
4704
4805
  * count and an invalid number (which blocks save) is surfaced on the header.
4705
4806
  */
4706
4807
  function AdvancedSection({ state, disabled, t, onEdit, onReset }) {
4707
- const [expanded, setExpanded] = (0, react.useState)(false);
4708
4808
  const overridden = ADVANCED_FIELDS.filter((field) => state[field].overridden).length;
4709
- const invalid = ADVANCED_FIELDS.some((field) => state[field].invalid);
4710
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
4711
- className: "cc-group cc-groupDivided",
4712
- "aria-label": t("advancedSettings"),
4809
+ const invalid = advancedGroupInvalid(state);
4810
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CollapsibleGroup, {
4811
+ title: t("advancedSettings"),
4812
+ bodyId: "cc-advanced-body",
4813
+ divided: true,
4814
+ badges: (expanded) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [overridden > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4815
+ className: "cc-badge",
4816
+ children: overridden === 1 ? t("advancedOverriddenOne") : t("advancedOverriddenMany", { count: overridden })
4817
+ }) : null, !expanded && invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4818
+ className: "cc-badge cc-badgeWarn",
4819
+ children: t("advancedInvalid")
4820
+ }) : null] }),
4821
+ footer: invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4822
+ className: "cc-rowError",
4823
+ role: "status",
4824
+ children: t("advancedInvalid")
4825
+ }) : null,
4713
4826
  children: [
4714
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4715
- type: "button",
4716
- className: "cc-groupHead cc-disclosure",
4717
- "aria-expanded": expanded,
4718
- "aria-controls": "cc-advanced-body",
4719
- onClick: () => setExpanded((value) => !value),
4720
- children: [
4721
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4722
- className: "cc-groupTitle",
4723
- children: t("advancedSettings")
4724
- }),
4725
- overridden > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4726
- className: "cc-badge",
4727
- children: overridden === 1 ? t("advancedOverriddenOne") : t("advancedOverriddenMany", { count: overridden })
4728
- }) : null,
4729
- !expanded && invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4730
- className: "cc-badge cc-badgeWarn",
4731
- children: t("advancedInvalid")
4732
- }) : null,
4733
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "cc-spacer" }),
4734
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4735
- className: expanded ? "cc-chevron cc-chevronUp" : "cc-chevron",
4736
- "aria-hidden": "true"
4737
- })
4738
- ]
4827
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4828
+ className: "cc-groupDesc",
4829
+ children: t("advancedSettingsHint")
4739
4830
  }),
4740
- expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4741
- id: "cc-advanced-body",
4742
- className: "cc-rows",
4743
- children: [
4744
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4745
- className: "cc-groupDesc",
4746
- children: t("advancedSettingsHint")
4747
- }),
4748
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4749
- id: "cc-api-base",
4750
- label: t("apiBase"),
4751
- hint: t("apiBaseHint"),
4752
- state: state.apiBase,
4753
- disabled,
4754
- wide: true,
4755
- onEdit: (text) => onEdit("apiBase", text),
4756
- onReset: () => onReset("apiBase"),
4757
- t
4758
- }),
4759
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4760
- id: "cc-request-timeout",
4761
- label: t("requestTimeoutMs"),
4762
- hint: t("requestTimeoutMsHint"),
4763
- state: state.requestTimeoutMs,
4764
- disabled,
4765
- numeric: true,
4766
- decimal: true,
4767
- onEdit: (text) => onEdit("requestTimeoutMs", text),
4768
- onReset: () => onReset("requestTimeoutMs"),
4769
- t
4770
- }),
4771
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4772
- id: "cc-stream-idle-timeout",
4773
- label: t("streamIdleTimeoutMs"),
4774
- hint: t("streamIdleTimeoutMsHint"),
4775
- state: state.streamIdleTimeoutMs,
4776
- disabled,
4777
- numeric: true,
4778
- decimal: true,
4779
- onEdit: (text) => onEdit("streamIdleTimeoutMs", text),
4780
- onReset: () => onReset("streamIdleTimeoutMs"),
4781
- t
4782
- }),
4783
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4784
- id: "cc-transport-max-retries",
4785
- label: t("transportMaxRetries"),
4786
- hint: t("transportMaxRetriesHint"),
4787
- state: state.transportMaxRetries,
4788
- disabled,
4789
- numeric: true,
4790
- onEdit: (text) => onEdit("transportMaxRetries", text),
4791
- onReset: () => onReset("transportMaxRetries"),
4792
- t
4793
- }),
4794
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleField, {
4795
- id: "cc-offload-seen-images-for-cache",
4796
- label: t("offloadSeenImagesForCache"),
4797
- hint: t("offloadSeenImagesForCacheHint"),
4798
- state: state.offloadSeenImagesForCache,
4799
- disabled,
4800
- defaultChecked: false,
4801
- onEdit: (text) => onEdit("offloadSeenImagesForCache", text),
4802
- onReset: () => onReset("offloadSeenImagesForCache"),
4803
- t
4804
- })
4805
- ]
4806
- }) : null,
4807
- expanded && invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4808
- className: "cc-rowError",
4809
- role: "status",
4810
- children: t("advancedInvalid")
4811
- }) : null
4831
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4832
+ id: "cc-api-base",
4833
+ label: t("apiBase"),
4834
+ hint: t("apiBaseHint"),
4835
+ state: state.apiBase,
4836
+ disabled,
4837
+ wide: true,
4838
+ onEdit: (text) => onEdit("apiBase", text),
4839
+ onReset: () => onReset("apiBase"),
4840
+ t
4841
+ }),
4842
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4843
+ id: "cc-request-timeout",
4844
+ label: t("requestTimeoutMs"),
4845
+ hint: t("requestTimeoutMsHint"),
4846
+ state: state.requestTimeoutMs,
4847
+ disabled,
4848
+ numeric: true,
4849
+ decimal: true,
4850
+ onEdit: (text) => onEdit("requestTimeoutMs", text),
4851
+ onReset: () => onReset("requestTimeoutMs"),
4852
+ t
4853
+ }),
4854
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4855
+ id: "cc-stream-idle-timeout",
4856
+ label: t("streamIdleTimeoutMs"),
4857
+ hint: t("streamIdleTimeoutMsHint"),
4858
+ state: state.streamIdleTimeoutMs,
4859
+ disabled,
4860
+ numeric: true,
4861
+ decimal: true,
4862
+ onEdit: (text) => onEdit("streamIdleTimeoutMs", text),
4863
+ onReset: () => onReset("streamIdleTimeoutMs"),
4864
+ t
4865
+ }),
4866
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
4867
+ id: "cc-transport-max-retries",
4868
+ label: t("transportMaxRetries"),
4869
+ hint: t("transportMaxRetriesHint"),
4870
+ state: state.transportMaxRetries,
4871
+ disabled,
4872
+ numeric: true,
4873
+ onEdit: (text) => onEdit("transportMaxRetries", text),
4874
+ onReset: () => onReset("transportMaxRetries"),
4875
+ t
4876
+ }),
4877
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleField, {
4878
+ id: "cc-offload-seen-images-for-cache",
4879
+ label: t("offloadSeenImagesForCache"),
4880
+ hint: t("offloadSeenImagesForCacheHint"),
4881
+ state: state.offloadSeenImagesForCache,
4882
+ disabled,
4883
+ defaultChecked: false,
4884
+ onEdit: (text) => onEdit("offloadSeenImagesForCache", text),
4885
+ onReset: () => onReset("offloadSeenImagesForCache"),
4886
+ t
4887
+ })
4812
4888
  ]
4813
4889
  });
4814
4890
  }