@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.
- package/dist/{chunk-QZDOYPUU.js → chunk-JFPTU3O3.js} +28 -109
- package/dist/dsh/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -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 = "
|
|
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: "
|
|
19643
|
+
description: "Open the DSH model selector",
|
|
19647
19644
|
kind: "built-in" /* BUILT_IN */,
|
|
19648
19645
|
autoExecute: true,
|
|
19649
|
-
action:
|
|
19650
|
-
|
|
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: "
|
|
19677
|
-
content:
|
|
19650
|
+
messageType: "error",
|
|
19651
|
+
content: "Usage: /model"
|
|
19678
19652
|
};
|
|
19679
19653
|
}
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
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: "
|
|
19742
|
-
|
|
19743
|
-
|
|
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
|
-
|
|
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
|
-
|
|
24911
|
-
|
|
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
package/dist/index.js
CHANGED