@cofy-x/dsh-console 0.1.0-alpha.1 → 0.1.0-alpha.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.
@@ -6039,7 +6039,7 @@ import { Box as Box25 } from "ink";
6039
6039
  import { Box as Box21, Text as Text20 } from "ink";
6040
6040
 
6041
6041
  // src/generated/git-commit.ts
6042
- var GIT_COMMIT_INFO = "ab17524";
6042
+ var GIT_COMMIT_INFO = "31b5700";
6043
6043
 
6044
6044
  // src/ui/components/dialogs/about-box.tsx
6045
6045
  import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -19638,118 +19638,38 @@ function ModelDialog({
19638
19638
  }
19639
19639
 
19640
19640
  // src/ui/commands/model-command.ts
19641
- function modalities(values) {
19642
- return values.join(", ");
19643
- }
19644
19641
  var modelCommand = {
19645
19642
  name: "model",
19646
- description: "Show or configure the DSH model route",
19643
+ description: "Open the DSH model selector",
19647
19644
  kind: "built-in" /* BUILT_IN */,
19648
19645
  autoExecute: true,
19649
- action: async (context, args) => {
19650
- const runtime = context.services.modelSelection;
19651
- if (!runtime) {
19652
- return { type: "message", messageType: "error", content: "DSH model selection is unavailable." };
19653
- }
19654
- const words = args.trim().split(/\s+/).filter(Boolean);
19655
- if (words.length === 0) {
19656
- return {
19657
- type: "custom_dialog",
19658
- component: React16.createElement(ModelDialog, {
19659
- runtime,
19660
- providerSetupRuntime: context.services.providerSetup,
19661
- onClose: context.ui.removeComponent,
19662
- onSwitched: (selection) => {
19663
- context.ui.addItem({
19664
- type: "info" /* INFO */,
19665
- text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
19666
- });
19667
- context.ui.removeComponent();
19668
- }
19669
- })
19670
- };
19671
- }
19672
- if (words[0] === "list" && words.length === 1) {
19673
- const models = await runtime.listModels();
19646
+ action: (context, args) => {
19647
+ if (args.trim()) {
19674
19648
  return {
19675
19649
  type: "message",
19676
- messageType: "info",
19677
- content: models.map((model) => `${modelSelectionLabel(model)} [${modalities(model.inputModalities)}]`).join("\n")
19650
+ messageType: "error",
19651
+ content: "Usage: /model"
19678
19652
  };
19679
19653
  }
19680
- if (words[0] === "set" && words.length === 3) {
19681
- const current = runtime.getSnapshot().current;
19682
- if (current.provider === words[1] && current.model === words[2]) {
19683
- return {
19684
- type: "message",
19685
- messageType: "info",
19686
- content: `Already using ${modelSelectionLabel(current)}.`
19687
- };
19688
- }
19689
- if (runtime.hasConversation() && context.overwriteConfirmed !== true) {
19690
- return {
19691
- type: "confirm_action",
19692
- prompt: "Changing model starts a new Agent and Session. Continue?",
19693
- originalInvocation: { raw: context.invocation?.raw ?? `/model ${args}` }
19694
- };
19695
- }
19696
- const providerSetup = context.services.providerSetup;
19697
- if (providerSetup) {
19698
- const setup = await providerSetup.describeProvider(
19699
- words[1],
19700
- context.invocation.signal
19701
- );
19702
- if (setup.status === "missing") {
19703
- if (!setup.writable) {
19704
- return {
19705
- type: "message",
19706
- messageType: "error",
19707
- content: `${setup.credentialLabel ?? "The provider credential"} is supplied by a read-only source and is not configured.`
19708
- };
19709
- }
19710
- return {
19711
- type: "custom_dialog",
19712
- component: React16.createElement(ProviderSetupDialog, {
19713
- runtime: providerSetup,
19714
- provider: words[1],
19715
- onCancel: context.ui.removeComponent,
19716
- onConfigured: () => {
19717
- void runtime.setModel(words[1], words[2]).then((selection) => {
19718
- context.ui.addItem({
19719
- type: "info" /* INFO */,
19720
- text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
19721
- });
19722
- }).catch(() => {
19723
- context.ui.addItem({
19724
- type: "error" /* ERROR */,
19725
- text: "The credential was saved, but DSH could not start the selected model."
19726
- });
19727
- }).finally(context.ui.removeComponent);
19728
- }
19729
- })
19730
- };
19731
- }
19732
- }
19733
- const selected = await runtime.setModel(words[1], words[2]);
19734
- return {
19735
- type: "message",
19736
- messageType: "info",
19737
- content: `Started a new Agent with ${modelSelectionLabel(selected)}.`
19738
- };
19654
+ const runtime = context.services.modelSelection;
19655
+ if (!runtime) {
19656
+ return { type: "message", messageType: "error", content: "DSH model selection is unavailable." };
19739
19657
  }
19740
19658
  return {
19741
- type: "message",
19742
- messageType: "error",
19743
- content: "Usage: /model | /model list | /model set <provider> <model>"
19659
+ type: "custom_dialog",
19660
+ component: React16.createElement(ModelDialog, {
19661
+ runtime,
19662
+ providerSetupRuntime: context.services.providerSetup,
19663
+ onClose: context.ui.removeComponent,
19664
+ onSwitched: (selection) => {
19665
+ context.ui.addItem({
19666
+ type: "info" /* INFO */,
19667
+ text: `Started a new Agent with ${modelSelectionLabel(selection)}.`
19668
+ });
19669
+ context.ui.removeComponent();
19670
+ }
19671
+ })
19744
19672
  };
19745
- },
19746
- completion: async (context, partialArg) => {
19747
- const runtime = context.services.modelSelection;
19748
- if (!runtime) return [];
19749
- const prefix = partialArg.trimStart();
19750
- if (!prefix.startsWith("set")) return ["list", "set "];
19751
- const models = await runtime.listModels();
19752
- return models.map((model) => `set ${model.provider} ${model.model}`).filter((candidate) => candidate.startsWith(prefix));
19753
19673
  }
19754
19674
  };
19755
19675
 
@@ -24891,7 +24811,8 @@ var DshModelSelectionRuntime = class _DshModelSelectionRuntime {
24891
24811
  } catch (rollbackError) {
24892
24812
  throw new AggregateError(
24893
24813
  [cause, rollbackError],
24894
- "Unable to activate the selected model or restore the previous default."
24814
+ "Unable to activate the selected model or restore the previous default.",
24815
+ { cause: rollbackError }
24895
24816
  );
24896
24817
  }
24897
24818
  throw cause;
@@ -24902,13 +24823,11 @@ var DshModelSelectionRuntime = class _DshModelSelectionRuntime {
24902
24823
  }
24903
24824
  async assertCurrentSupportsImages(signal) {
24904
24825
  if (this.snapshot.current.inputModalities.includes("image")) return;
24905
- const models = await this.listModels(signal);
24906
- const replacement = models.find(
24907
- (candidate) => candidate.provider === this.snapshot.current.provider && candidate.inputModalities.includes("image")
24908
- );
24826
+ signal?.throwIfAborted();
24909
24827
  const current = modelSelectionLabel(this.snapshot.current);
24910
- const suggestion = replacement ? ` Run /model set ${replacement.provider} ${replacement.model} to start a new Agent.` : " Select an image-capable model with /model list.";
24911
- throw new Error(`Current model ${current} does not support image input.${suggestion}`);
24828
+ throw new Error(
24829
+ `Current model ${current} does not support image input. Run /model and select an image-capable model to start a new Agent.`
24830
+ );
24912
24831
  }
24913
24832
  adoptCurrent(selection) {
24914
24833
  this.snapshot = { ...this.snapshot, current: selection };
package/dist/dsh/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  apply,
4
4
  inject,
5
5
  name
6
- } from "../chunk-QZDOYPUU.js";
6
+ } from "../chunk-JFPTU3O3.js";
7
7
  import "../chunk-N3EQS35J.js";
8
8
  export {
9
9
  Config,
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  Config,
3
3
  apply,
4
4
  name
5
- } from "./chunk-QZDOYPUU.js";
5
+ } from "./chunk-JFPTU3O3.js";
6
6
  import "./chunk-N3EQS35J.js";
7
7
  export {
8
8
  Config,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofy-x/dsh-console",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "A TypeScript and React/Ink terminal frontend for DeepSeek Harness.",
5
5
  "repository": {
6
6
  "type": "git",