@logictan/dsh-imagegen 2.0.2 → 2.0.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/README.md +1 -1
- package/lib/client.js +124 -124
- package/lib/client.js.map +1 -1
- package/lib/index.js +311 -61
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ dsh plugin --profile web add @logictan/dsh-imagegen
|
|
|
46
46
|
| --- | --- |
|
|
47
47
|
| 预设 | 常见厂商的预填(OpenAI 官方、xAI Grok Imagine、Google Nano Banana、字节 Seedream、智谱 GLM-Image、阿里 Qwen-Image、MiniMax image-01 等) |
|
|
48
48
|
| API 地址 | 该渠道的端点;非 OpenAI 兼容协议的厂商按其官方接口填写(预设里已说明) |
|
|
49
|
-
| API 密钥 |
|
|
49
|
+
| API 密钥 | 凭据,存于 `$DSH_HOME/.credentials.yaml`(渠道密钥为 `DSH_IMAGEGEN_CHANNEL_<渠道 ID>`,提示词增强为 `DSH_IMAGEGEN_PROMPT_KEY`);不写入插件配置行,生成时由宿主代理转发 |
|
|
50
50
|
| 模型目录 | 该渠道下可用的「别名 → 上游模型 id」映射 |
|
|
51
51
|
|
|
52
52
|
可选配置**提示词增强**:填一个 OpenAI 兼容的聊天端点与模型,生图前会把简短提示词扩写成更完整的描述。
|
package/lib/client.js
CHANGED
|
@@ -2583,9 +2583,11 @@ window.__ModuleLoader__.load({
|
|
|
2583
2583
|
*
|
|
2584
2584
|
* Storage rules (dictated by dsh-settings semantics):
|
|
2585
2585
|
* - the whole `channels` array is written wholesale via `path: ['channels']`;
|
|
2586
|
-
* - every channel's API key
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2586
|
+
* - every channel's API key is written to `path: ['channelSecrets', <id>]`,
|
|
2587
|
+
* one key at a time so untouched keys are never clobbered by a save the
|
|
2588
|
+
* reader could not see (keys are redacted out of the wire view). The host
|
|
2589
|
+
* bridge diverts that path into the credential store, so the value never
|
|
2590
|
+
* reaches the settings document — this module only speaks the wire shape;
|
|
2589
2591
|
* - path ops never navigate *inside* the channels array.
|
|
2590
2592
|
*/
|
|
2591
2593
|
/** Deep equality over JSON-compatible data (the change predicate). */
|
|
@@ -2988,7 +2990,7 @@ window.__ModuleLoader__.load({
|
|
|
2988
2990
|
*/
|
|
2989
2991
|
/** Settings namespace this plugin owns (host settings seam + bridge). */
|
|
2990
2992
|
const IMAGEGEN_SETTINGS_NAMESPACE = "imagegen";
|
|
2991
|
-
/** Same-origin route family (
|
|
2993
|
+
/** Same-origin route family (fenced by the composition's connection service). */
|
|
2992
2994
|
const SETTINGS_API = {
|
|
2993
2995
|
describe: "/api/dsh-imagegen/settings/describe",
|
|
2994
2996
|
mutate: "/api/dsh-imagegen/settings/mutate"
|
|
@@ -3002,7 +3004,7 @@ window.__ModuleLoader__.load({
|
|
|
3002
3004
|
const IMAGE_MODEL_API = { models: "/api/dsh-imagegen/image-models" };
|
|
3003
3005
|
/** Host-served built-in provider catalog (channels the user can instantiate). */
|
|
3004
3006
|
const PRESETS_API = "/api/dsh-imagegen/presets";
|
|
3005
|
-
/**
|
|
3007
|
+
/** Image reader for Agent tool-result previews (fenced by the connection service). */
|
|
3006
3008
|
const AGENT_IMAGE_API = "/api/dsh-imagegen/agent-image";
|
|
3007
3009
|
//#endregion
|
|
3008
3010
|
//#region src/client/use-language.ts
|
|
@@ -3028,132 +3030,132 @@ window.__ModuleLoader__.load({
|
|
|
3028
3030
|
document.head.appendChild(tag);
|
|
3029
3031
|
}
|
|
3030
3032
|
var settings_card_module_css_default = {
|
|
3031
|
-
"
|
|
3032
|
-
"
|
|
3033
|
-
"hint": "_5JdLea_hint",
|
|
3034
|
-
"modelSummary": "_5JdLea_modelSummary",
|
|
3035
|
-
"summaryValue": "_5JdLea_summaryValue",
|
|
3036
|
-
"channelDotReady": "_5JdLea_channelDotReady",
|
|
3037
|
-
"sectionToggleText": "_5JdLea_sectionToggleText",
|
|
3038
|
-
"editorBackdrop": "_5JdLea_editorBackdrop",
|
|
3033
|
+
"modelRow": "_5JdLea_modelRow",
|
|
3034
|
+
"overviewHead": "_5JdLea_overviewHead",
|
|
3039
3035
|
"versionLabel": "_5JdLea_versionLabel",
|
|
3036
|
+
"reset": "_5JdLea_reset",
|
|
3037
|
+
"summaryCard": "_5JdLea_summaryCard",
|
|
3038
|
+
"footer": "_5JdLea_footer",
|
|
3039
|
+
"channelMeta": "_5JdLea_channelMeta",
|
|
3040
3040
|
"channelName": "_5JdLea_channelName",
|
|
3041
|
-
"subscriptionDot": "_5JdLea_subscriptionDot",
|
|
3042
|
-
"channelHost": "_5JdLea_channelHost",
|
|
3043
|
-
"modelArrow": "_5JdLea_modelArrow",
|
|
3044
|
-
"pickerDialog": "_5JdLea_pickerDialog",
|
|
3045
|
-
"modelChip": "_5JdLea_modelChip",
|
|
3046
|
-
"pickerHeader": "_5JdLea_pickerHeader",
|
|
3047
|
-
"channelDotWarn": "_5JdLea_channelDotWarn",
|
|
3048
|
-
"inputInvalid": "_5JdLea_inputInvalid",
|
|
3049
|
-
"headText": "_5JdLea_headText",
|
|
3050
|
-
"channelControls": "_5JdLea_channelControls",
|
|
3051
|
-
"notExposed": "_5JdLea_notExposed",
|
|
3052
|
-
"editorFooter": "_5JdLea_editorFooter",
|
|
3053
|
-
"channelEmpty": "_5JdLea_channelEmpty",
|
|
3054
|
-
"presetHint": "_5JdLea_presetHint",
|
|
3055
|
-
"save": "_5JdLea_save",
|
|
3056
|
-
"modelBadge": "_5JdLea_modelBadge",
|
|
3057
|
-
"badges": "_5JdLea_badges",
|
|
3058
|
-
"select": "_5JdLea_select",
|
|
3059
|
-
"presetName": "_5JdLea_presetName",
|
|
3060
|
-
"manualModelRow": "_5JdLea_manualModelRow",
|
|
3061
|
-
"failed": "_5JdLea_failed",
|
|
3062
|
-
"channelSection": "_5JdLea_channelSection",
|
|
3063
|
-
"pickerEmpty": "_5JdLea_pickerEmpty",
|
|
3064
|
-
"channelRow": "_5JdLea_channelRow",
|
|
3065
|
-
"presetInlineHeader": "_5JdLea_presetInlineHeader",
|
|
3066
|
-
"pickerTitle": "_5JdLea_pickerTitle",
|
|
3067
|
-
"modelRowBadges": "_5JdLea_modelRowBadges",
|
|
3068
3041
|
"channelAdd": "_5JdLea_channelAdd",
|
|
3069
|
-
"overviewTitle": "_5JdLea_overviewTitle",
|
|
3070
|
-
"modelSection": "_5JdLea_modelSection",
|
|
3071
3042
|
"subscriptionWarning": "_5JdLea_subscriptionWarning",
|
|
3072
|
-
"
|
|
3073
|
-
"
|
|
3074
|
-
"discard": "_5JdLea_discard",
|
|
3075
|
-
"editorHeader": "_5JdLea_editorHeader",
|
|
3076
|
-
"channelList": "_5JdLea_channelList",
|
|
3077
|
-
"fieldHint": "_5JdLea_fieldHint",
|
|
3078
|
-
"disclosure": "_5JdLea_disclosure",
|
|
3079
|
-
"pickerTabs": "_5JdLea_pickerTabs",
|
|
3080
|
-
"modelRows": "_5JdLea_modelRows",
|
|
3081
|
-
"settingsSection": "_5JdLea_settingsSection",
|
|
3043
|
+
"manualModelRow": "_5JdLea_manualModelRow",
|
|
3044
|
+
"modelCandidateList": "_5JdLea_modelCandidateList",
|
|
3082
3045
|
"channelMain": "_5JdLea_channelMain",
|
|
3083
|
-
"
|
|
3046
|
+
"field": "_5JdLea_field",
|
|
3047
|
+
"header": "_5JdLea_header",
|
|
3048
|
+
"channelDotReady": "_5JdLea_channelDotReady",
|
|
3049
|
+
"presetRow": "_5JdLea_presetRow",
|
|
3050
|
+
"pickerEmpty": "_5JdLea_pickerEmpty",
|
|
3051
|
+
"editorPanel": "_5JdLea_editorPanel",
|
|
3052
|
+
"pending": "_5JdLea_pending",
|
|
3053
|
+
"name": "_5JdLea_name",
|
|
3054
|
+
"pickerHeader": "_5JdLea_pickerHeader",
|
|
3055
|
+
"editorTools": "_5JdLea_editorTools",
|
|
3056
|
+
"modelRowRemove": "_5JdLea_modelRowRemove",
|
|
3057
|
+
"presetMeta": "_5JdLea_presetMeta",
|
|
3058
|
+
"editorSectionHeader": "_5JdLea_editorSectionHeader",
|
|
3059
|
+
"subscriptionManual": "_5JdLea_subscriptionManual",
|
|
3060
|
+
"sectionTitle": "_5JdLea_sectionTitle",
|
|
3061
|
+
"fieldHint": "_5JdLea_fieldHint",
|
|
3084
3062
|
"channelAction": "_5JdLea_channelAction",
|
|
3085
|
-
"
|
|
3086
|
-
"
|
|
3087
|
-
"
|
|
3088
|
-
"footer": "_5JdLea_footer",
|
|
3089
|
-
"channelMeta": "_5JdLea_channelMeta",
|
|
3090
|
-
"editorClose": "_5JdLea_editorClose",
|
|
3063
|
+
"channelAddRow": "_5JdLea_channelAddRow",
|
|
3064
|
+
"inputInvalid": "_5JdLea_inputInvalid",
|
|
3065
|
+
"sectionHeader": "_5JdLea_sectionHeader",
|
|
3091
3066
|
"inlineDisclosure": "_5JdLea_inlineDisclosure",
|
|
3092
|
-
"
|
|
3067
|
+
"editorBackdrop": "_5JdLea_editorBackdrop",
|
|
3068
|
+
"presetInline": "_5JdLea_presetInline",
|
|
3093
3069
|
"versionRow": "_5JdLea_versionRow",
|
|
3094
|
-
"
|
|
3095
|
-
"
|
|
3096
|
-
"
|
|
3097
|
-
"
|
|
3098
|
-
"
|
|
3099
|
-
"
|
|
3070
|
+
"overviewTitle": "_5JdLea_overviewTitle",
|
|
3071
|
+
"disclosure": "_5JdLea_disclosure",
|
|
3072
|
+
"invalid": "_5JdLea_invalid",
|
|
3073
|
+
"notExposed": "_5JdLea_notExposed",
|
|
3074
|
+
"modelRows": "_5JdLea_modelRows",
|
|
3075
|
+
"subscriptionDot": "_5JdLea_subscriptionDot",
|
|
3076
|
+
"channelSection": "_5JdLea_channelSection",
|
|
3077
|
+
"versionValue": "_5JdLea_versionValue",
|
|
3078
|
+
"modelSection": "_5JdLea_modelSection",
|
|
3079
|
+
"settingsSection": "_5JdLea_settingsSection",
|
|
3100
3080
|
"pickerHint": "_5JdLea_pickerHint",
|
|
3101
|
-
"
|
|
3102
|
-
"
|
|
3103
|
-
"
|
|
3104
|
-
"presetInline": "_5JdLea_presetInline",
|
|
3105
|
-
"summaryGrid": "_5JdLea_summaryGrid",
|
|
3106
|
-
"modelRowInputs": "_5JdLea_modelRowInputs",
|
|
3107
|
-
"modelChoices": "_5JdLea_modelChoices",
|
|
3081
|
+
"hint": "_5JdLea_hint",
|
|
3082
|
+
"spacer": "_5JdLea_spacer",
|
|
3083
|
+
"readOnly": "_5JdLea_readOnly",
|
|
3108
3084
|
"label": "_5JdLea_label",
|
|
3085
|
+
"detectOk": "_5JdLea_detectOk",
|
|
3109
3086
|
"sectionSummary": "_5JdLea_sectionSummary",
|
|
3110
|
-
"
|
|
3111
|
-
"
|
|
3112
|
-
"
|
|
3113
|
-
"
|
|
3114
|
-
"
|
|
3115
|
-
"
|
|
3116
|
-
"
|
|
3117
|
-
"editorPanel": "_5JdLea_editorPanel",
|
|
3118
|
-
"presetRow": "_5JdLea_presetRow",
|
|
3119
|
-
"editorTools": "_5JdLea_editorTools",
|
|
3120
|
-
"badge": "_5JdLea_badge",
|
|
3121
|
-
"sectionContent": "_5JdLea_sectionContent",
|
|
3122
|
-
"body": "_5JdLea_body",
|
|
3123
|
-
"header": "_5JdLea_header",
|
|
3124
|
-
"spacer": "_5JdLea_spacer",
|
|
3125
|
-
"chevron": "_5JdLea_chevron",
|
|
3126
|
-
"presetMeta": "_5JdLea_presetMeta",
|
|
3087
|
+
"summaryValue": "_5JdLea_summaryValue",
|
|
3088
|
+
"presetName": "_5JdLea_presetName",
|
|
3089
|
+
"editorHeader": "_5JdLea_editorHeader",
|
|
3090
|
+
"defaultModelRow": "_5JdLea_defaultModelRow",
|
|
3091
|
+
"headText": "_5JdLea_headText",
|
|
3092
|
+
"editorFooter": "_5JdLea_editorFooter",
|
|
3093
|
+
"pickerTitle": "_5JdLea_pickerTitle",
|
|
3127
3094
|
"pickerSearch": "_5JdLea_pickerSearch",
|
|
3095
|
+
"pickerDialog": "_5JdLea_pickerDialog",
|
|
3096
|
+
"pickerTabs": "_5JdLea_pickerTabs",
|
|
3128
3097
|
"description": "_5JdLea_description",
|
|
3098
|
+
"presetAction": "_5JdLea_presetAction",
|
|
3099
|
+
"summaryLabel": "_5JdLea_summaryLabel",
|
|
3100
|
+
"head": "_5JdLea_head",
|
|
3129
3101
|
"channelBadge": "_5JdLea_channelBadge",
|
|
3102
|
+
"overview": "_5JdLea_overview",
|
|
3103
|
+
"sectionDivider": "_5JdLea_sectionDivider",
|
|
3104
|
+
"editorDivider": "_5JdLea_editorDivider",
|
|
3105
|
+
"sectionToggle": "_5JdLea_sectionToggle",
|
|
3106
|
+
"modelRowInputs": "_5JdLea_modelRowInputs",
|
|
3130
3107
|
"subscriptionAccount": "_5JdLea_subscriptionAccount",
|
|
3131
|
-
"
|
|
3132
|
-
"
|
|
3133
|
-
"
|
|
3134
|
-
"head": "_5JdLea_head",
|
|
3135
|
-
"summaryCard": "_5JdLea_summaryCard",
|
|
3108
|
+
"sectionToggleText": "_5JdLea_sectionToggleText",
|
|
3109
|
+
"editorField": "_5JdLea_editorField",
|
|
3110
|
+
"save": "_5JdLea_save",
|
|
3136
3111
|
"card": "_5JdLea_card",
|
|
3137
|
-
"
|
|
3138
|
-
"
|
|
3139
|
-
"
|
|
3140
|
-
"
|
|
3141
|
-
"
|
|
3142
|
-
"
|
|
3143
|
-
"
|
|
3144
|
-
"
|
|
3112
|
+
"badge": "_5JdLea_badge",
|
|
3113
|
+
"modelSummary": "_5JdLea_modelSummary",
|
|
3114
|
+
"badges": "_5JdLea_badges",
|
|
3115
|
+
"modelRowBadges": "_5JdLea_modelRowBadges",
|
|
3116
|
+
"failed": "_5JdLea_failed",
|
|
3117
|
+
"channelList": "_5JdLea_channelList",
|
|
3118
|
+
"modelFetch": "_5JdLea_modelFetch",
|
|
3119
|
+
"presetHint": "_5JdLea_presetHint",
|
|
3120
|
+
"checkboxRow": "_5JdLea_checkboxRow",
|
|
3121
|
+
"sectionToggleTitle": "_5JdLea_sectionToggleTitle",
|
|
3122
|
+
"deleteConfirmText": "_5JdLea_deleteConfirmText",
|
|
3123
|
+
"presetList": "_5JdLea_presetList",
|
|
3124
|
+
"channelControls": "_5JdLea_channelControls",
|
|
3125
|
+
"discard": "_5JdLea_discard",
|
|
3126
|
+
"channelDanger": "_5JdLea_channelDanger",
|
|
3127
|
+
"healthBadge": "_5JdLea_healthBadge",
|
|
3145
3128
|
"textareaInvalid": "_5JdLea_textareaInvalid",
|
|
3146
|
-
"
|
|
3129
|
+
"chevron": "_5JdLea_chevron",
|
|
3130
|
+
"sectionContent": "_5JdLea_sectionContent",
|
|
3131
|
+
"presetInlineHeader": "_5JdLea_presetInlineHeader",
|
|
3132
|
+
"modelCandidate": "_5JdLea_modelCandidate",
|
|
3133
|
+
"subscriptionBox": "_5JdLea_subscriptionBox",
|
|
3134
|
+
"optionalContent": "_5JdLea_optionalContent",
|
|
3147
3135
|
"sectionHint": "_5JdLea_sectionHint",
|
|
3148
|
-
"
|
|
3149
|
-
"
|
|
3150
|
-
"
|
|
3151
|
-
"
|
|
3136
|
+
"channelEmpty": "_5JdLea_channelEmpty",
|
|
3137
|
+
"channelDotWarn": "_5JdLea_channelDotWarn",
|
|
3138
|
+
"modelChoices": "_5JdLea_modelChoices",
|
|
3139
|
+
"channelRow": "_5JdLea_channelRow",
|
|
3140
|
+
"pickerOverlay": "_5JdLea_pickerOverlay",
|
|
3141
|
+
"select": "_5JdLea_select",
|
|
3142
|
+
"modelBadge": "_5JdLea_modelBadge",
|
|
3143
|
+
"overviewHint": "_5JdLea_overviewHint",
|
|
3144
|
+
"pickerList": "_5JdLea_pickerList",
|
|
3152
3145
|
"sectionChevron": "_5JdLea_sectionChevron",
|
|
3153
|
-
"
|
|
3154
|
-
"
|
|
3155
|
-
"
|
|
3156
|
-
"
|
|
3146
|
+
"modelFetchRow": "_5JdLea_modelFetchRow",
|
|
3147
|
+
"body": "_5JdLea_body",
|
|
3148
|
+
"modelChip": "_5JdLea_modelChip",
|
|
3149
|
+
"editorClose": "_5JdLea_editorClose",
|
|
3150
|
+
"chevronOpen": "_5JdLea_chevronOpen",
|
|
3151
|
+
"textarea": "_5JdLea_textarea",
|
|
3152
|
+
"addModel": "_5JdLea_addModel",
|
|
3153
|
+
"modelCandidateLabel": "_5JdLea_modelCandidateLabel",
|
|
3154
|
+
"summaryGrid": "_5JdLea_summaryGrid",
|
|
3155
|
+
"input": "_5JdLea_input",
|
|
3156
|
+
"channelHost": "_5JdLea_channelHost",
|
|
3157
|
+
"modelArrow": "_5JdLea_modelArrow",
|
|
3158
|
+
"sectionToggleHint": "_5JdLea_sectionToggleHint"
|
|
3157
3159
|
};
|
|
3158
3160
|
//#endregion
|
|
3159
3161
|
//#region src/client/SettingsCard.tsx
|
|
@@ -4393,11 +4395,11 @@ window.__ModuleLoader__.load({
|
|
|
4393
4395
|
//#region src/client/settings-scope.ts
|
|
4394
4396
|
/**
|
|
4395
4397
|
* Browser-side settings scope for the dsh-imagegen namespace, served by the
|
|
4396
|
-
* plugin's own
|
|
4398
|
+
* plugin's own same-origin bridge routes (/api/dsh-imagegen/settings). The
|
|
4397
4399
|
* official rc.6 settings scope answers "unavailable" for every third-party
|
|
4398
4400
|
* namespace (the host-apiproxy allowlist is hard-coded), so this package
|
|
4399
|
-
* re-serves its namespace through the host settings seam over a same-origin
|
|
4400
|
-
*
|
|
4401
|
+
* re-serves its namespace through the host settings seam over a same-origin
|
|
4402
|
+
* HTTP pair — the same pattern the dsh-web-ui family bridge
|
|
4401
4403
|
* uses, self-contained per plugin.
|
|
4402
4404
|
*/
|
|
4403
4405
|
/** Settings wire face over the bridge routes (fetch-backed). */
|
|
@@ -4585,7 +4587,7 @@ window.__ModuleLoader__.load({
|
|
|
4585
4587
|
/**
|
|
4586
4588
|
* Bind the dsh-imagegen settings scope over the bridge routes and start its
|
|
4587
4589
|
* initial read (the caller mounts nothing until the scope settles).
|
|
4588
|
-
* @param fetchFn - the fetch implementation (the global fetch
|
|
4590
|
+
* @param fetchFn - the fetch implementation (the global fetch by default).
|
|
4589
4591
|
* @returns the scope; unavailable when the bridge is unreachable.
|
|
4590
4592
|
*/
|
|
4591
4593
|
function bindImageGenScope(fetchFn = fetch) {
|
|
@@ -4605,16 +4607,16 @@ window.__ModuleLoader__.load({
|
|
|
4605
4607
|
document.head.appendChild(tag);
|
|
4606
4608
|
}
|
|
4607
4609
|
var image_toolview_module_css_default = {
|
|
4610
|
+
"root": "UtJPoq_root",
|
|
4608
4611
|
"header": "UtJPoq_header",
|
|
4612
|
+
"icon": "UtJPoq_icon",
|
|
4613
|
+
"error": "UtJPoq_error",
|
|
4614
|
+
"status": "UtJPoq_status",
|
|
4609
4615
|
"message": "UtJPoq_message",
|
|
4610
4616
|
"images": "UtJPoq_images",
|
|
4611
4617
|
"imageLink": "UtJPoq_imageLink",
|
|
4612
|
-
"icon": "UtJPoq_icon",
|
|
4613
4618
|
"image": "UtJPoq_image",
|
|
4614
|
-
"loading": "UtJPoq_loading"
|
|
4615
|
-
"error": "UtJPoq_error",
|
|
4616
|
-
"status": "UtJPoq_status",
|
|
4617
|
-
"root": "UtJPoq_root"
|
|
4619
|
+
"loading": "UtJPoq_loading"
|
|
4618
4620
|
};
|
|
4619
4621
|
//#endregion
|
|
4620
4622
|
//#region src/client/image-toolview.tsx
|
|
@@ -4845,9 +4847,7 @@ window.__ModuleLoader__.load({
|
|
|
4845
4847
|
return ctx.locale.subscribe(applyLocale);
|
|
4846
4848
|
}, "dsh-imagegen: follow host locale");
|
|
4847
4849
|
registerImageToolviews(ctx);
|
|
4848
|
-
const scope = bindImageGenScope(
|
|
4849
|
-
throw new Error("settings bridge is loopback-only");
|
|
4850
|
-
});
|
|
4850
|
+
const scope = bindImageGenScope();
|
|
4851
4851
|
ctx.effect(() => {
|
|
4852
4852
|
const disposers = [ctx.on("connection/reset", () => {
|
|
4853
4853
|
scope.load();
|