@michengai/dsh-im-connect 0.1.37 → 0.1.39
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/CHANGELOG.md +17 -1
- package/CHANGELOG.zh-CN.md +17 -1
- package/README.en.md +60 -65
- package/README.md +60 -65
- package/SECURITY.md +7 -2
- package/client.js +31 -298
- package/lib/channels/channel-image-download.d.ts +22 -0
- package/lib/channels/channel-image-download.d.ts.map +1 -0
- package/lib/channels/channel-image-download.js +179 -0
- package/lib/channels/channel-image-download.js.map +1 -0
- package/lib/channels/dingtalk-token-cache.d.ts +18 -0
- package/lib/channels/dingtalk-token-cache.d.ts.map +1 -0
- package/lib/channels/dingtalk-token-cache.js +48 -0
- package/lib/channels/dingtalk-token-cache.js.map +1 -0
- package/lib/channels/dingtalk.d.ts +17 -4
- package/lib/channels/dingtalk.d.ts.map +1 -1
- package/lib/channels/dingtalk.js +111 -18
- package/lib/channels/dingtalk.js.map +1 -1
- package/lib/channels/factory.d.ts.map +1 -1
- package/lib/channels/factory.js +6 -3
- package/lib/channels/factory.js.map +1 -1
- package/lib/channels/feishu.d.ts +30 -2
- package/lib/channels/feishu.d.ts.map +1 -1
- package/lib/channels/feishu.js +141 -26
- package/lib/channels/feishu.js.map +1 -1
- package/lib/channels/image-host-policy.d.ts +4 -0
- package/lib/channels/image-host-policy.d.ts.map +1 -0
- package/lib/channels/image-host-policy.js +24 -0
- package/lib/channels/image-host-policy.js.map +1 -0
- package/lib/channels/qq.d.ts +1 -0
- package/lib/channels/qq.d.ts.map +1 -1
- package/lib/channels/qq.js +89 -18
- package/lib/channels/qq.js.map +1 -1
- package/lib/channels/telegram.d.ts.map +1 -1
- package/lib/channels/telegram.js +121 -16
- package/lib/channels/telegram.js.map +1 -1
- package/lib/channels/wecom.d.ts +8 -2
- package/lib/channels/wecom.d.ts.map +1 -1
- package/lib/channels/wecom.js +60 -11
- package/lib/channels/wecom.js.map +1 -1
- package/lib/channels/weixin.d.ts.map +1 -1
- package/lib/channels/weixin.js +169 -17
- package/lib/channels/weixin.js.map +1 -1
- package/lib/client.js +31 -298
- package/lib/engine/gateway.d.ts +2 -0
- package/lib/engine/gateway.d.ts.map +1 -1
- package/lib/engine/gateway.js +48 -11
- package/lib/engine/gateway.js.map +1 -1
- package/lib/engine/image-input.d.ts +8 -0
- package/lib/engine/image-input.d.ts.map +1 -0
- package/lib/engine/image-input.js +31 -0
- package/lib/engine/image-input.js.map +1 -0
- package/lib/engine/router.d.ts.map +1 -1
- package/lib/engine/router.js +29 -19
- package/lib/engine/router.js.map +1 -1
- package/lib/manager.d.ts +0 -10
- package/lib/manager.d.ts.map +1 -1
- package/lib/manager.js +231 -203
- package/lib/manager.js.map +1 -1
- package/package.json +1 -1
- package/src/channels/channel-image-download.ts +154 -0
- package/src/channels/dingtalk-token-cache.ts +39 -0
- package/src/channels/dingtalk.ts +106 -27
- package/src/channels/factory.ts +6 -3
- package/src/channels/feishu.ts +126 -24
- package/src/channels/image-host-policy.ts +21 -0
- package/src/channels/qq.ts +80 -26
- package/src/channels/telegram.ts +105 -16
- package/src/channels/wecom.ts +57 -12
- package/src/channels/weixin.ts +124 -14
- package/src/engine/gateway.ts +35 -6
- package/src/engine/image-input.ts +26 -0
- package/src/engine/router.ts +28 -18
- package/src/manager.ts +116 -84
package/client.js
CHANGED
|
@@ -12,7 +12,7 @@ window.__ModuleLoader__.load({
|
|
|
12
12
|
const { RiskConfirmation, IconListPenOutline16, IconRefreshOutline16, IconDownloadOutline16, IconCopyOutline16, IconCloseOutline16 } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
13
13
|
const EMPTY_EXTRA_TABS = [];
|
|
14
14
|
const inject = ["slots", "sessions", "workspaces", "locale"];
|
|
15
|
-
const API_BASE = "/dsh-im-connect
|
|
15
|
+
const API_BASE = "/api/dsh-im-connect";
|
|
16
16
|
const TAB_KEY = "dsh-im-connect.sidebar-tab";
|
|
17
17
|
const ACCOUNT_SELECTION_KEY = "dsh-im-connect.settings.selected-account";
|
|
18
18
|
const IM_LOCALE_NS = "im-connect";
|
|
@@ -95,13 +95,8 @@ window.__ModuleLoader__.load({
|
|
|
95
95
|
.ima-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;border:2px solid #111}
|
|
96
96
|
.ima-avatar.bot{background:#123524;margin-right:-8px;z-index:1}
|
|
97
97
|
.ima-avatar.user{background:#3d3428}
|
|
98
|
-
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:
|
|
99
|
-
.ima-sub{margin:
|
|
100
|
-
.ima-composer-wrap{margin:0 0 16px}
|
|
101
|
-
.ima-composer{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));align-items:center;gap:4px;padding:4px 6px;border:1px solid var(--ima-line);border-radius:14px;background:var(--ima-card)}
|
|
102
|
-
.ima-composer-left,.ima-composer-right{display:contents}
|
|
103
|
-
.ima-composer .ima-chip{width:100%;min-width:0}
|
|
104
|
-
.ima-composer .ima-chip-btn{width:100%;justify-content:center}
|
|
98
|
+
.ima-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px}.ima-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap;text-align:left}
|
|
99
|
+
.ima-sub{margin:12px 0 0;max-width:42em;color:var(--ima-muted);font-size:14px;line-height:22px;text-align:left}
|
|
105
100
|
.ima-chip{position:relative;min-width:0;z-index:1}
|
|
106
101
|
.ima-chip.is-open{z-index:30}
|
|
107
102
|
.ima-chip-btn{display:inline-flex;align-items:center;gap:6px;min-height:28px;height:28px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--ima-muted);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer}
|
|
@@ -115,7 +110,6 @@ window.__ModuleLoader__.load({
|
|
|
115
110
|
.ima-chip-row-main{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
116
111
|
.ima-chip-tick{width:6px;height:12px;border-right:1.6px solid var(--ima-accent);border-bottom:1.6px solid var(--ima-accent);transform:rotate(45deg) translateY(-2px);flex:none}
|
|
117
112
|
.ima-chip-empty{padding:14px 12px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
118
|
-
.ima-composer-hint{margin-top:8px;color:var(--ima-muted);font-size:12px;text-align:center}
|
|
119
113
|
.ima-chip svg{flex:none}
|
|
120
114
|
.ima-chip-row.is-kv .ima-chip-row-main{flex:none}
|
|
121
115
|
.ima-chip-row-side{display:inline-flex;align-items:center;gap:8px;color:var(--ima-muted);font-size:12px;min-width:0}
|
|
@@ -123,9 +117,9 @@ window.__ModuleLoader__.load({
|
|
|
123
117
|
.ima-chip-split{height:1px;margin:6px 8px;background:var(--ima-line)}
|
|
124
118
|
.ima-chip-effort{color:var(--ima-muted);font-weight:500}
|
|
125
119
|
.ima-model-select .ima-chip-btn{border-radius:24px;gap:4px}
|
|
126
|
-
.ima-model-select .ima-chip-menu{width:min(240px,calc(100vw - 32px));
|
|
120
|
+
.ima-model-select .ima-chip-menu{width:max-content;min-width:min(240px,calc(100vw - 32px));max-width:calc(100vw - 32px);box-sizing:border-box;max-height:min(360px,calc(100vh - 96px));padding:4px;border-radius:12px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff))}
|
|
127
121
|
.ima-model-select .ima-chip-row{min-height:40px;padding:0 10px;font-size:14px}
|
|
128
|
-
.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
122
|
+
.ima-model-select .ima-chip-row-side>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ima-model-select .ima-chip-row-side{font-size:13px;color:var(--dsw-alias-label-tertiary,var(--ima-muted))}
|
|
129
123
|
.ima-model-group+.ima-model-group{margin-top:4px}
|
|
130
124
|
.ima-model-group-title{position:sticky;top:0;z-index:1;padding:5px 8px 3px;background:var(--dsw-specific-menu,var(--dsw-alias-bg-base,#fff));color:var(--dsw-alias-label-tertiary,var(--ima-muted));font-size:12px;font-weight:500;line-height:18px}
|
|
131
125
|
.ima-model-option{display:flex;width:100%;min-height:38px;align-items:center;gap:8px;padding:6px 8px;border:0;border-radius:10px;background:transparent;color:var(--dsw-alias-label-primary,var(--ima-text));text-align:left;cursor:pointer}
|
|
@@ -208,8 +202,8 @@ window.__ModuleLoader__.load({
|
|
|
208
202
|
.ima-radio small{display:block;color:var(--ima-muted);margin-top:2px}
|
|
209
203
|
.ima-ok{color:var(--ima-ok);font-size:14px;text-align:center;padding:24px 0}
|
|
210
204
|
.ima-modal .ima-error{color:var(--ima-danger)}
|
|
211
|
-
.ima-page.ima-account-page{max-width:1120px;padding-bottom:40px}
|
|
212
|
-
.ima-account-shell{display:grid;grid-template-columns:
|
|
205
|
+
.ima-page.ima-account-page{container-type:inline-size;min-width:0;max-width:1120px;padding-bottom:40px}
|
|
206
|
+
.ima-account-shell{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));min-height:650px;border:1px solid var(--ima-line);border-radius:16px;overflow:hidden;background:transparent}
|
|
213
207
|
.ima-platforms{padding:0;border-right:1px solid var(--ima-line);background:transparent}
|
|
214
208
|
.ima-platform{border:0;border-bottom:1px solid var(--ima-line);border-radius:0;margin:0;overflow:visible;background:transparent}.ima-platform:last-child{border-bottom:0}.ima-platform.open{background:transparent}
|
|
215
209
|
.ima-platform-head{display:flex;align-items:center;gap:10px;width:100%;min-height:64px;padding:10px 18px;border:0;border-radius:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
|
|
@@ -225,14 +219,31 @@ window.__ModuleLoader__.load({
|
|
|
225
219
|
.ima-inspector-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:6px;padding-top:18px;border-top:1px solid var(--ima-line)}.ima-inspector-actions .ima-btn{flex:none;min-width:0;min-height:36px;padding:0 8px;font-size:12px;white-space:nowrap}.ima-inspector-actions .danger{margin-left:auto;color:var(--ima-danger);border-color:color-mix(in srgb,var(--ima-danger) 35%,transparent)}
|
|
226
220
|
.ima-save-note{min-height:18px;color:var(--ima-muted);font-size:11px}.ima-save-note.ok{color:var(--ima-ok)}
|
|
227
221
|
.ima-modal.ima-account-modal{width:min(560px,100%);max-height:min(760px,calc(100vh - 48px));overflow:auto}.ima-setup-section{margin:4px 0 14px;padding-bottom:14px;border-bottom:1px solid var(--ima-line)}
|
|
228
|
-
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max(100%,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
.ima-account-settings{display:grid;grid-template-columns:1fr 1fr;gap:12px}.ima-account-settings.compact{grid-template-columns:1fr}.ima-picker-field{display:flex;min-width:0;flex-direction:column;gap:7px}.ima-picker-field.wide{grid-column:1/-1}.ima-picker-label{color:var(--ima-muted);font-size:12px;font-weight:550}.ima-account-picker{width:100%}.ima-account-picker .ima-chip-btn{width:100%;height:auto;min-height:44px;justify-content:flex-start;padding:8px 12px;border:1px solid var(--ima-line);border-radius:9px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));color:var(--ima-text);font-size:13px;text-align:left}.ima-account-picker .ima-chip-btn:hover,.ima-account-picker.is-open .ima-chip-btn{border-color:var(--ima-accent);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.04));box-shadow:0 0 0 2px color-mix(in srgb,var(--ima-accent) 18%,transparent)}.ima-account-picker .ima-chip-label{flex:1}.ima-account-picker .ima-chip-btn em{margin-left:auto}.ima-account-picker .ima-chip-menu{width:100%;min-width:100%;max-height:min(320px,calc(100vh - 120px))}.ima-account-picker.ima-model-select .ima-chip-btn{border-radius:9px}.ima-account-picker.ima-model-select .ima-chip-menu{width:max-content;min-width:min(100%,calc(100vw - 32px));left:auto;right:0}.ima-account-settings .ima-chip-dialog{grid-column:1/-1;margin-top:0}.ima-picker-note{grid-column:1/-1;color:var(--ima-muted);font-size:11px;line-height:1.5}.ima-picker-note.warning{color:var(--ima-warning)}
|
|
223
|
+
.ima-account-shell,.ima-account-shell *{box-sizing:border-box}
|
|
224
|
+
.ima-platforms{min-width:0}
|
|
225
|
+
.ima-platform-head{display:grid;grid-template-columns:24px minmax(0,1fr) 12px;gap:8px;padding:12px;min-height:76px}
|
|
226
|
+
.ima-platform-head>.ima-logo,.ima-platform-head>.ima-logo svg{width:24px;height:24px}
|
|
227
|
+
.ima-platform-title{grid-column:2;grid-row:1;overflow-wrap:anywhere}
|
|
228
|
+
.ima-platform-caret{grid-column:3;grid-row:1;width:12px;margin:0}
|
|
229
|
+
.ima-platform-count{grid-column:1/3;grid-row:2;font-size:11px;white-space:normal;padding-right:80px}
|
|
230
|
+
.ima-platform-add{grid-column:1/4;grid-row:2;justify-self:end;min-height:28px;padding:0 8px;font-weight:500}
|
|
231
|
+
.ima-account-list{padding:0 8px 10px}
|
|
232
|
+
.ima-account-row{display:grid;grid-template-columns:7px minmax(0,1fr) 12px;gap:6px;min-height:60px;padding:10px 8px}
|
|
233
|
+
.ima-account-row>.ima-logo{display:none}
|
|
234
|
+
.ima-account-copy{grid-column:2;grid-row:1}
|
|
235
|
+
.ima-account-row>.ima-dot{grid-column:1;grid-row:1}
|
|
236
|
+
.ima-account-next{grid-column:3;grid-row:1;width:12px}
|
|
237
|
+
.ima-account-state{grid-column:2;grid-row:2;font-size:11px}
|
|
238
|
+
.ima-inspector{padding:18px 16px;overflow-wrap:anywhere}
|
|
239
|
+
.ima-switch-row{gap:10px}.ima-switch-copy{min-width:0}
|
|
240
|
+
@container(max-width:620px){.ima-inspector{padding:16px 12px}.ima-inspector-head{gap:8px}.ima-inspector-title{font-size:15px}.ima-platform-head{padding:10px 8px;gap:6px}.ima-platform-title{font-size:13px}.ima-inspector-empty{padding:16px;min-height:180px}}
|
|
241
|
+
@container(max-width:420px){.ima-title{font-size:22px}.ima-platform-count{grid-column:1/4;padding-right:0}.ima-platform-add{grid-row:3;justify-self:start}.ima-inspector{padding:12px 8px}.ima-inspector-head{flex-wrap:wrap}}
|
|
242
|
+
@media(max-width:620px){.ima-account-settings{grid-template-columns:1fr}.ima-picker-field.wide{grid-column:auto}}
|
|
232
243
|
@media (prefers-reduced-motion:reduce){.ima-switch i{transition:none}}
|
|
233
244
|
`;
|
|
234
245
|
|
|
235
|
-
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px;min-width:0}.ima-title-links{display:flex;align-items:center;gap:4px}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
246
|
+
const TITLE_LINK_CSS = ".ima-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}.ima-title-links{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.ima-title-link{display:inline-flex;align-items:center;gap:5px;min-height:28px;padding:0 8px;color:var(--dsw-alias-label-secondary);background:transparent;border:1px solid var(--dsw-alias-border-l2);border-radius:7px;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap}.ima-title-link:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}.ima-title-link:focus-visible{outline:2px solid var(--dsw-alias-state-success-primary);outline-offset:2px}.ima-title-link svg{flex:none}@media(max-width:720px){.ima-title-row{flex-wrap:wrap}}";
|
|
236
247
|
|
|
237
248
|
let styleEl = null;
|
|
238
249
|
const ensureStyle = () => {
|
|
@@ -243,7 +254,8 @@ window.__ModuleLoader__.load({
|
|
|
243
254
|
};
|
|
244
255
|
|
|
245
256
|
const api = (path, opts) => {
|
|
246
|
-
|
|
257
|
+
// 管理路由复用宿主登录 Cookie,不缓存账号状态或认证错误。
|
|
258
|
+
const request = Object.assign({}, opts || {}, { credentials: "same-origin", cache: "no-store" });
|
|
247
259
|
const method = String(request.method || "GET").toUpperCase();
|
|
248
260
|
if (method !== "GET" && method !== "HEAD") {
|
|
249
261
|
request.headers = Object.assign({ "content-type": "application/json" }, request.headers || {}, { "x-dsh-im-connect-client": "1" });
|
|
@@ -888,7 +900,6 @@ window.__ModuleLoader__.load({
|
|
|
888
900
|
...group.models.map((item) => h(ModelChoiceRow, {
|
|
889
901
|
key: item.value,
|
|
890
902
|
label: item.label,
|
|
891
|
-
description: item.description,
|
|
892
903
|
active: item.provider === provider && item.model === model,
|
|
893
904
|
onClick: () => {
|
|
894
905
|
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
@@ -962,284 +973,6 @@ window.__ModuleLoader__.load({
|
|
|
962
973
|
);
|
|
963
974
|
}
|
|
964
975
|
|
|
965
|
-
function ComposerBar(props) {
|
|
966
|
-
const t = props.t || fallbackT;
|
|
967
|
-
const items = typeof props.useWorkspaces === "function"
|
|
968
|
-
? (props.useWorkspaces((state) => (state && state.items) || []) || [])
|
|
969
|
-
: [];
|
|
970
|
-
const [providers, setProviders] = useState([]);
|
|
971
|
-
const [permissions, setPermissions] = useState([]);
|
|
972
|
-
const [provider, setProvider] = useState("");
|
|
973
|
-
const [model, setModel] = useState("");
|
|
974
|
-
const [effort, setEffort] = useState("");
|
|
975
|
-
const [cwd, setCwd] = useState("");
|
|
976
|
-
const [permission, setPermission] = useState("");
|
|
977
|
-
const [confirmingFullAccess, setConfirmingFullAccess] = useState(false);
|
|
978
|
-
const [fullAccessAcknowledged, setFullAccessAcknowledged] = useState(false);
|
|
979
|
-
const [open, setOpen] = useState("");
|
|
980
|
-
const [modelPane, setModelPane] = useState("root");
|
|
981
|
-
const [hint, setHint] = useState("");
|
|
982
|
-
const [adding, setAdding] = useState(false);
|
|
983
|
-
const [addPath, setAddPath] = useState("");
|
|
984
|
-
const [addBusy, setAddBusy] = useState(false);
|
|
985
|
-
|
|
986
|
-
useEffect(() => {
|
|
987
|
-
api("/assistant").then((data) => {
|
|
988
|
-
if (!data.ok) { setHint(serverText(data.error, t) || t("error.loadAssistant")); return; }
|
|
989
|
-
const list = data.providers || [];
|
|
990
|
-
setProviders(list);
|
|
991
|
-
setPermissions(data.permissions || []);
|
|
992
|
-
const current = data.assistant || {};
|
|
993
|
-
const nextProvider = current.provider || (list[0] && list[0].id) || "";
|
|
994
|
-
const models = ((list.find((item) => item.id === nextProvider) || {}).models) || [];
|
|
995
|
-
const nextModel = current.model || (models[0] && models[0].id) || "";
|
|
996
|
-
const found = models.find((item) => item.id === nextModel) || models[0];
|
|
997
|
-
setProvider(nextProvider);
|
|
998
|
-
setModel(nextModel);
|
|
999
|
-
setEffort(current.reasoningEffort || (found && found.reasoning && found.reasoning.defaultEffort) || "");
|
|
1000
|
-
setCwd(data.cwd || "");
|
|
1001
|
-
setPermission(data.permission || "");
|
|
1002
|
-
if (!list.length) setHint(t("error.noModels"));
|
|
1003
|
-
}).catch(() => setHint(t("error.loadAssistant")));
|
|
1004
|
-
}, []);
|
|
1005
|
-
|
|
1006
|
-
const save = (body) => {
|
|
1007
|
-
api("/assistant", {
|
|
1008
|
-
method: "POST",
|
|
1009
|
-
headers: { "content-type": "application/json" },
|
|
1010
|
-
body: JSON.stringify(body),
|
|
1011
|
-
}).then((data) => {
|
|
1012
|
-
if (!data.ok) setHint(serverText(data.error, t) || t("error.save"));
|
|
1013
|
-
else setHint("");
|
|
1014
|
-
}).catch(() => setHint(t("error.save")));
|
|
1015
|
-
};
|
|
1016
|
-
|
|
1017
|
-
const workspace = items.find((item) => item.path === cwd);
|
|
1018
|
-
const modelGroups = providers.map((item) => ({
|
|
1019
|
-
id: item.id,
|
|
1020
|
-
name: item.name || item.id,
|
|
1021
|
-
models: (item.models || []).map((entry) => ({
|
|
1022
|
-
value: item.id + "::" + entry.id,
|
|
1023
|
-
provider: item.id,
|
|
1024
|
-
providerName: item.name || item.id,
|
|
1025
|
-
model: entry.id,
|
|
1026
|
-
label: entry.name || entry.id,
|
|
1027
|
-
description: entry.description,
|
|
1028
|
-
reasoning: entry.reasoning,
|
|
1029
|
-
})),
|
|
1030
|
-
})).filter((item) => item.models.length > 0);
|
|
1031
|
-
const models = modelGroups.flatMap((item) => item.models);
|
|
1032
|
-
const currentModel = models.find((item) => item.provider === provider && item.model === model);
|
|
1033
|
-
const reasoning = currentModel && currentModel.reasoning;
|
|
1034
|
-
const effectiveEffort = effort || (reasoning && reasoning.defaultEffort) || "";
|
|
1035
|
-
const efforts = reasoning
|
|
1036
|
-
? [
|
|
1037
|
-
...(reasoning.defaultEffort ? [] : [{ id: "", name: props.modelT("effort.providerDefault") }]),
|
|
1038
|
-
...((reasoning.efforts || []).map((item) => ({ id: item.id, name: item.name || item.id, description: item.description }))),
|
|
1039
|
-
]
|
|
1040
|
-
: [];
|
|
1041
|
-
const effortLabel = reasoning
|
|
1042
|
-
? ((efforts.find((item) => item.id === effectiveEffort) || {}).name || effectiveEffort || props.modelT("effort.providerDefault"))
|
|
1043
|
-
: "";
|
|
1044
|
-
const permissionOptions = permissions.map((item) => ({
|
|
1045
|
-
...item,
|
|
1046
|
-
label: permissionLabel(item, t),
|
|
1047
|
-
}));
|
|
1048
|
-
const perm = permissionOptions.find((item) => item.value === permission) || { label: permission || t("composer.permission") };
|
|
1049
|
-
const modelFallback = props.modelT("trigger.fallback");
|
|
1050
|
-
|
|
1051
|
-
const addWorkspace = (path) => {
|
|
1052
|
-
const next = (path || "").trim();
|
|
1053
|
-
if (!next) { setHint(t("error.chooseWorkspace")); return Promise.resolve(); }
|
|
1054
|
-
if (typeof props.createWorkspace !== "function") { setHint(t("error.workspaceUnavailable")); return Promise.resolve(); }
|
|
1055
|
-
setAddBusy(true);
|
|
1056
|
-
return Promise.resolve(props.createWorkspace({ path: next })).then((created) => {
|
|
1057
|
-
const cwdPath = (created && (created.path || created.cwd)) || next;
|
|
1058
|
-
setCwd(cwdPath);
|
|
1059
|
-
save({ cwd: cwdPath });
|
|
1060
|
-
setAdding(false);
|
|
1061
|
-
setAddPath("");
|
|
1062
|
-
setOpen("");
|
|
1063
|
-
}).catch((error) => {
|
|
1064
|
-
setHint((error && error.message) || t("error.addWorkspace"));
|
|
1065
|
-
}).finally(() => setAddBusy(false));
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
const selectPermission = (next) => {
|
|
1069
|
-
setOpen("");
|
|
1070
|
-
if (next === permission) return;
|
|
1071
|
-
if (next === "danger-full-access") {
|
|
1072
|
-
setFullAccessAcknowledged(false);
|
|
1073
|
-
setConfirmingFullAccess(true);
|
|
1074
|
-
return;
|
|
1075
|
-
}
|
|
1076
|
-
setPermission(next);
|
|
1077
|
-
save({ permission: next });
|
|
1078
|
-
};
|
|
1079
|
-
|
|
1080
|
-
const onAddWorkspace = () => {
|
|
1081
|
-
setOpen("");
|
|
1082
|
-
if (typeof props.pickDirectory === "function") {
|
|
1083
|
-
Promise.resolve(props.pickDirectory()).then((picked) => {
|
|
1084
|
-
if (!picked) return;
|
|
1085
|
-
return addWorkspace(picked);
|
|
1086
|
-
}).catch(() => {
|
|
1087
|
-
setAdding(true);
|
|
1088
|
-
setAddPath("");
|
|
1089
|
-
});
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
setAdding(true);
|
|
1093
|
-
setAddPath("");
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
return h("div", { className: "ima-composer-wrap" },
|
|
1097
|
-
h("div", { className: "ima-composer", "aria-label": t("composer.aria") },
|
|
1098
|
-
h("div", { className: "ima-composer-left" },
|
|
1099
|
-
h(ChipMenu, {
|
|
1100
|
-
open: open === "ws",
|
|
1101
|
-
onToggle: (next) => setOpen(next ? "ws" : ""),
|
|
1102
|
-
icon: h(FolderIcon),
|
|
1103
|
-
label: (workspace && (workspace.title || workspace.path)) || cwd || t("composer.project"),
|
|
1104
|
-
ariaLabel: t("composer.projectAria"),
|
|
1105
|
-
},
|
|
1106
|
-
items.length === 0 && h("div", { className: "ima-chip-empty" }, t("composer.noWorkspaces")),
|
|
1107
|
-
...items.map((item) => h(ChipRow, {
|
|
1108
|
-
key: item.path,
|
|
1109
|
-
icon: h(FolderIcon),
|
|
1110
|
-
label: item.title || item.path,
|
|
1111
|
-
active: item.path === cwd,
|
|
1112
|
-
onClick: () => { setCwd(item.path); save({ cwd: item.path }); setOpen(""); },
|
|
1113
|
-
})),
|
|
1114
|
-
h("div", { className: "ima-chip-split" }),
|
|
1115
|
-
h(ChipRow, {
|
|
1116
|
-
icon: h(PlusIcon),
|
|
1117
|
-
label: t("composer.addWorkspace"),
|
|
1118
|
-
onClick: onAddWorkspace,
|
|
1119
|
-
}),
|
|
1120
|
-
),
|
|
1121
|
-
h(ChipMenu, {
|
|
1122
|
-
open: open === "perm",
|
|
1123
|
-
onToggle: (next) => setOpen(next ? "perm" : ""),
|
|
1124
|
-
icon: h(ShieldIcon),
|
|
1125
|
-
label: perm.label,
|
|
1126
|
-
ariaLabel: t("composer.permission"),
|
|
1127
|
-
},
|
|
1128
|
-
...permissionOptions.map((item) => h(ChipRow, {
|
|
1129
|
-
key: item.value,
|
|
1130
|
-
icon: h(ShieldIcon),
|
|
1131
|
-
label: item.label,
|
|
1132
|
-
active: item.value === permission,
|
|
1133
|
-
onClick: () => selectPermission(item.value),
|
|
1134
|
-
})),
|
|
1135
|
-
),
|
|
1136
|
-
),
|
|
1137
|
-
h("div", { className: "ima-composer-right" },
|
|
1138
|
-
h(ChipMenu, {
|
|
1139
|
-
open: open === "model",
|
|
1140
|
-
onToggle: (next) => {
|
|
1141
|
-
setOpen(next ? "model" : "");
|
|
1142
|
-
if (next) setModelPane("root");
|
|
1143
|
-
},
|
|
1144
|
-
align: "end",
|
|
1145
|
-
className: "ima-model-select",
|
|
1146
|
-
menuClassName: "ima-model-menu",
|
|
1147
|
-
menuAria: props.modelT("menu.aria"),
|
|
1148
|
-
label: (currentModel && currentModel.label) || modelFallback,
|
|
1149
|
-
suffix: effortLabel,
|
|
1150
|
-
ariaLabel: props.modelT("trigger.selectAria"),
|
|
1151
|
-
},
|
|
1152
|
-
modelPane === "root" && [
|
|
1153
|
-
h(ChipRow, {
|
|
1154
|
-
key: "model",
|
|
1155
|
-
kv: true,
|
|
1156
|
-
label: props.modelT("menu.model"),
|
|
1157
|
-
hint: (currentModel && currentModel.label) || modelFallback,
|
|
1158
|
-
chevron: true,
|
|
1159
|
-
onClick: () => setModelPane("model"),
|
|
1160
|
-
}),
|
|
1161
|
-
reasoning && h(ChipRow, {
|
|
1162
|
-
key: "effort",
|
|
1163
|
-
kv: true,
|
|
1164
|
-
label: props.modelT("menu.effort"),
|
|
1165
|
-
hint: effortLabel || props.modelT("effort.providerDefault"),
|
|
1166
|
-
chevron: true,
|
|
1167
|
-
onClick: () => setModelPane("effort"),
|
|
1168
|
-
}),
|
|
1169
|
-
],
|
|
1170
|
-
modelPane === "model" && (
|
|
1171
|
-
models.length === 0
|
|
1172
|
-
? h("div", { className: "ima-chip-empty" }, props.modelT("empty.models"))
|
|
1173
|
-
: modelGroups.map((group) => h("section", { key: group.id, className: "ima-model-group", role: "group", "aria-label": group.name },
|
|
1174
|
-
h("div", { className: "ima-model-group-title" }, group.name),
|
|
1175
|
-
...group.models.map((item) => h(ModelChoiceRow, {
|
|
1176
|
-
key: item.value,
|
|
1177
|
-
label: item.label,
|
|
1178
|
-
description: item.description,
|
|
1179
|
-
active: item.provider === provider && item.model === model,
|
|
1180
|
-
onClick: () => {
|
|
1181
|
-
const nextEffort = (item.reasoning && item.reasoning.defaultEffort) || "";
|
|
1182
|
-
setProvider(item.provider);
|
|
1183
|
-
setModel(item.model);
|
|
1184
|
-
setEffort(nextEffort);
|
|
1185
|
-
save({ provider: item.provider, model: item.model, reasoningEffort: nextEffort || null });
|
|
1186
|
-
setOpen("");
|
|
1187
|
-
},
|
|
1188
|
-
})),
|
|
1189
|
-
))
|
|
1190
|
-
),
|
|
1191
|
-
modelPane === "effort" && efforts.map((item) => h(ModelChoiceRow, {
|
|
1192
|
-
key: item.id,
|
|
1193
|
-
label: item.name,
|
|
1194
|
-
description: item.description,
|
|
1195
|
-
active: item.id === effectiveEffort,
|
|
1196
|
-
onClick: () => {
|
|
1197
|
-
setEffort(item.id);
|
|
1198
|
-
if (provider && model) save({ provider, model, reasoningEffort: item.id || null });
|
|
1199
|
-
setOpen("");
|
|
1200
|
-
},
|
|
1201
|
-
})),
|
|
1202
|
-
),
|
|
1203
|
-
),
|
|
1204
|
-
),
|
|
1205
|
-
adding && h("div", { className: "ima-chip-dialog" },
|
|
1206
|
-
h("strong", null, t("composer.addWorkspace")),
|
|
1207
|
-
h("input", {
|
|
1208
|
-
value: addPath,
|
|
1209
|
-
placeholder: t("composer.workspacePath"),
|
|
1210
|
-
"aria-label": t("composer.workspacePath"),
|
|
1211
|
-
onChange: (event) => setAddPath(event.target.value),
|
|
1212
|
-
}),
|
|
1213
|
-
h("div", { className: "ima-chip-dialog-actions" },
|
|
1214
|
-
h("button", { className: "ima-btn", onClick: () => { setAdding(false); setAddPath(""); } }, t("action.cancel")),
|
|
1215
|
-
h("button", {
|
|
1216
|
-
className: "ima-btn primary",
|
|
1217
|
-
disabled: addBusy || !addPath.trim(),
|
|
1218
|
-
onClick: () => addWorkspace(addPath),
|
|
1219
|
-
}, addBusy ? t("action.adding") : t("action.confirm")),
|
|
1220
|
-
),
|
|
1221
|
-
),
|
|
1222
|
-
hint && h("div", { className: "ima-composer-hint" }, hint),
|
|
1223
|
-
h(RiskConfirmation, {
|
|
1224
|
-
open: confirmingFullAccess,
|
|
1225
|
-
title: props.permissionT("confirm.title"),
|
|
1226
|
-
description: props.permissionT("confirm.description"),
|
|
1227
|
-
acknowledgeLabel: props.permissionT("confirm.acknowledge"),
|
|
1228
|
-
cancelLabel: props.permissionT("confirm.cancel"),
|
|
1229
|
-
confirmLabel: props.permissionT("confirm.enable"),
|
|
1230
|
-
acknowledged: fullAccessAcknowledged,
|
|
1231
|
-
onAcknowledgedChange: setFullAccessAcknowledged,
|
|
1232
|
-
onCancel: () => { setFullAccessAcknowledged(false); setConfirmingFullAccess(false); },
|
|
1233
|
-
onConfirm: () => {
|
|
1234
|
-
setPermission("danger-full-access");
|
|
1235
|
-
save({ permission: "danger-full-access" });
|
|
1236
|
-
setFullAccessAcknowledged(false);
|
|
1237
|
-
setConfirmingFullAccess(false);
|
|
1238
|
-
},
|
|
1239
|
-
}),
|
|
1240
|
-
);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
976
|
function AccountInspector({ account, catalog, permissions, workspaces, createWorkspace, pickDirectory, modelT, permissionT, t, onAction, onSave }) {
|
|
1244
977
|
const [draft, setDraft] = useState(account);
|
|
1245
978
|
const [note, setNote] = useState("");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ImMedia } from '../engine/types.js';
|
|
2
|
+
export declare const MAX_CHANNEL_IMAGE_BYTES: number;
|
|
3
|
+
export declare const MAX_CHANNEL_IMAGES = 4;
|
|
4
|
+
/** Only return fixed categories or HTTP status digits; raw SDK errors can hold secrets. */
|
|
5
|
+
export declare function channelImageFailureReason(error: unknown): string;
|
|
6
|
+
/** Diagnostic host only: never emit a signed path/query, userinfo, or AES key. */
|
|
7
|
+
export declare function channelImageDownloadHost(raw?: string): string;
|
|
8
|
+
/** Infer MIME from bytes, not an attacker-controlled filename or Content-Type. */
|
|
9
|
+
export declare function imageMedia(data: Buffer, maxBytes?: number): ImMedia;
|
|
10
|
+
/** HTTPS only; resolve inside the connection lookup, so DNS cannot rebind after validation.
|
|
11
|
+
* No redirects or ambient proxy/credentials. IPv4-only intentionally fails closed on IPv6-only hosts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function requestChannelBytes(rawUrl: string, options?: {
|
|
14
|
+
method?: 'GET' | 'POST';
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
body?: string;
|
|
17
|
+
maxBytes?: number;
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
additionalTrustedHosts?: readonly string[];
|
|
21
|
+
}): Promise<Buffer>;
|
|
22
|
+
//# sourceMappingURL=channel-image-download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-image-download.d.ts","sourceRoot":"","sources":["../../src/channels/channel-image-download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAMjD,eAAO,MAAM,uBAAuB,QAAmB,CAAA;AACvD,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiBhE;AAED,kFAAkF;AAClF,wBAAgB,wBAAwB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAA0B,GAAG,OAAO,CASpF;AA2BD;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;IACjE,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC3D,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACtC,GAAG,OAAO,CAAC,MAAM,CAAC,CAuEvB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import https from 'node:https';
|
|
2
|
+
import { validateAdditionalImageHosts } from './image-host-policy.js';
|
|
3
|
+
import dns from 'node:dns';
|
|
4
|
+
import { BlockList, isIP } from 'node:net';
|
|
5
|
+
export const MAX_CHANNEL_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
6
|
+
export const MAX_CHANNEL_IMAGES = 4;
|
|
7
|
+
/** Only return fixed categories or HTTP status digits; raw SDK errors can hold secrets. */
|
|
8
|
+
export function channelImageFailureReason(error) {
|
|
9
|
+
const value = error;
|
|
10
|
+
const message = typeof value?.message === 'string' ? value.message : '';
|
|
11
|
+
const rawCode = value?.code ?? value?.cause?.code;
|
|
12
|
+
const code = typeof rawCode === 'string' ? rawCode : undefined;
|
|
13
|
+
if (['图片地址不符合安全要求', '不安全的图片地址'].includes(message) || code === 'ERR_INVALID_URL')
|
|
14
|
+
return '下载地址被安全校验拦截';
|
|
15
|
+
const http = /^图片下载 HTTP (\d{3})$/.exec(message);
|
|
16
|
+
if (http)
|
|
17
|
+
return `下载服务器返回 HTTP ${http[1]}`;
|
|
18
|
+
if (/图片.*(大小|过大|数量)/.test(message))
|
|
19
|
+
return '图片数量或大小超过接收限制';
|
|
20
|
+
if (message === '图片下载超时' || ['TimeoutError', 'AbortError'].includes(value?.name ?? '') || code === 'ETIMEDOUT')
|
|
21
|
+
return '下载超时或已取消';
|
|
22
|
+
if (message === '图片解密失败' || code?.startsWith('ERR_OSSL_'))
|
|
23
|
+
return '图片解密失败';
|
|
24
|
+
if (message === '图片缺少下载地址或解密密钥')
|
|
25
|
+
return '图片缺少下载地址或解密信息';
|
|
26
|
+
if (message.startsWith('不支持的图片格式'))
|
|
27
|
+
return '不支持的图片格式';
|
|
28
|
+
if (message === '图片为空')
|
|
29
|
+
return '服务器返回了空图片';
|
|
30
|
+
if (code === 'ENOTFOUND' || code === 'EAI_AGAIN')
|
|
31
|
+
return 'DNS 解析失败';
|
|
32
|
+
if (code?.startsWith('ERR_TLS_') || code?.startsWith('ERR_SSL_') || code === 'CERT_HAS_EXPIRED')
|
|
33
|
+
return 'TLS 连接校验失败';
|
|
34
|
+
return '网络连接或图片处理失败';
|
|
35
|
+
}
|
|
36
|
+
/** Diagnostic host only: never emit a signed path/query, userinfo, or AES key. */
|
|
37
|
+
export function channelImageDownloadHost(raw) {
|
|
38
|
+
try {
|
|
39
|
+
const value = raw ?? '';
|
|
40
|
+
const url = new URL(value.startsWith('//') ? `https:${value}` : /^[a-z][a-z0-9+.-]*:/i.test(value) ? value : `https://${value}`);
|
|
41
|
+
return /^[a-z0-9.-]{1,253}$/i.test(url.hostname) ? url.hostname : '(invalid)';
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return '(invalid)';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Infer MIME from bytes, not an attacker-controlled filename or Content-Type. */
|
|
48
|
+
export function imageMedia(data, maxBytes = MAX_CHANNEL_IMAGE_BYTES) {
|
|
49
|
+
if (!data.length || data.length > maxBytes)
|
|
50
|
+
throw new Error('图片超过大小限制或为空');
|
|
51
|
+
let mediaType;
|
|
52
|
+
if (data.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex')))
|
|
53
|
+
mediaType = 'image/png';
|
|
54
|
+
else if (data.subarray(0, 3).equals(Buffer.from('ffd8ff', 'hex')))
|
|
55
|
+
mediaType = 'image/jpeg';
|
|
56
|
+
else if (/^GIF8[79]a$/.test(data.subarray(0, 6).toString('ascii')))
|
|
57
|
+
mediaType = 'image/gif';
|
|
58
|
+
else if (data.subarray(0, 4).toString() === 'RIFF' && data.subarray(8, 12).toString() === 'WEBP')
|
|
59
|
+
mediaType = 'image/webp';
|
|
60
|
+
if (!mediaType)
|
|
61
|
+
throw new Error('不支持的图片格式,请发送 PNG、JPEG、GIF 或 WebP');
|
|
62
|
+
return { kind: 'image', data, mediaType };
|
|
63
|
+
}
|
|
64
|
+
const blocked = new BlockList();
|
|
65
|
+
for (const [address, prefix] of [
|
|
66
|
+
['0.0.0.0', 8], ['10.0.0.0', 8], ['100.64.0.0', 10], ['127.0.0.0', 8],
|
|
67
|
+
['169.254.0.0', 16], ['172.16.0.0', 12], ['192.0.0.0', 24], ['192.0.2.0', 24],
|
|
68
|
+
['192.168.0.0', 16], ['198.18.0.0', 15], ['198.51.100.0', 24], ['203.0.113.0', 24],
|
|
69
|
+
['224.0.0.0', 4], ['240.0.0.0', 4],
|
|
70
|
+
])
|
|
71
|
+
blocked.addSubnet(address, prefix);
|
|
72
|
+
// Local proxy/TUN resolvers use RFC 2544 benchmark addresses as virtual routes.
|
|
73
|
+
// Limit this exception to exact platform hosts; never permit RFC1918/loopback,
|
|
74
|
+
// arbitrary hosts, redirects, or disabled TLS hostname/certificate validation.
|
|
75
|
+
const proxyFakeIps = new BlockList();
|
|
76
|
+
proxyFakeIps.addSubnet('198.18.0.0', 15);
|
|
77
|
+
const proxyCompatibleHosts = new Set([
|
|
78
|
+
'wework.qpic.cn', 'multimedia.nt.qq.com.cn', 'multimedia.nt.qq.com',
|
|
79
|
+
// QQ 聊天图片域名来源:https://github.com/takayama-lily/oicq/discussions/244
|
|
80
|
+
'gchat.qpic.cn',
|
|
81
|
+
// Exact WeCom AI-bot COS origin observed in authenticated image callbacks.
|
|
82
|
+
// Do not trust arbitrary tenant buckets under myqcloud.com.
|
|
83
|
+
'ww-aibot-img-1258476243.cos.ap-guangzhou.myqcloud.com',
|
|
84
|
+
'api.dingtalk.com', 'oapi.dingtalk.com',
|
|
85
|
+
// Exact image origin returned by DingTalk's authenticated messageFiles API.
|
|
86
|
+
'wukong-file-im-zjk.oss-cn-zhangjiakou.aliyuncs.com',
|
|
87
|
+
]);
|
|
88
|
+
/** HTTPS only; resolve inside the connection lookup, so DNS cannot rebind after validation.
|
|
89
|
+
* No redirects or ambient proxy/credentials. IPv4-only intentionally fails closed on IPv6-only hosts.
|
|
90
|
+
*/
|
|
91
|
+
export async function requestChannelBytes(rawUrl, options = {}) {
|
|
92
|
+
const additionalHosts = new Set(validateAdditionalImageHosts(options.additionalTrustedHosts));
|
|
93
|
+
options.signal?.throwIfAborted();
|
|
94
|
+
const url = new URL(rawUrl);
|
|
95
|
+
if (url.protocol !== 'https:' || url.username || url.password || (url.port && url.port !== '443')
|
|
96
|
+
|| isIP(url.hostname) || url.hostname.includes(':') || url.hostname.endsWith('.')) {
|
|
97
|
+
throw new Error('图片地址不符合安全要求');
|
|
98
|
+
}
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
let settled = false;
|
|
101
|
+
let timer;
|
|
102
|
+
let responseStream;
|
|
103
|
+
const finish = (error, data) => {
|
|
104
|
+
if (settled)
|
|
105
|
+
return;
|
|
106
|
+
settled = true;
|
|
107
|
+
clearTimeout(timer);
|
|
108
|
+
options.signal?.removeEventListener('abort', abort);
|
|
109
|
+
if (error)
|
|
110
|
+
reject(error);
|
|
111
|
+
else
|
|
112
|
+
resolve(data);
|
|
113
|
+
};
|
|
114
|
+
const abort = () => {
|
|
115
|
+
const error = new DOMException('图片下载已取消', 'AbortError');
|
|
116
|
+
finish(error);
|
|
117
|
+
responseStream?.destroy(error);
|
|
118
|
+
req.destroy(error);
|
|
119
|
+
};
|
|
120
|
+
const req = https.request(url, {
|
|
121
|
+
method: options.method ?? 'GET', headers: options.headers, agent: false,
|
|
122
|
+
lookup: (hostname, _options, callback) => {
|
|
123
|
+
dns.lookup(hostname, { all: true, family: 4 }, (error, addresses) => {
|
|
124
|
+
if (settled)
|
|
125
|
+
return;
|
|
126
|
+
if (error)
|
|
127
|
+
return callback(error, '', 4);
|
|
128
|
+
if (!addresses.length || addresses.some(item => item.family !== 4
|
|
129
|
+
|| (blocked.check(item.address) && !((proxyCompatibleHosts.has(hostname) || additionalHosts.has(hostname)) && proxyFakeIps.check(item.address))))) {
|
|
130
|
+
return callback(new Error('图片地址不符合安全要求'), '', 4);
|
|
131
|
+
}
|
|
132
|
+
if (_options.all)
|
|
133
|
+
callback(null, addresses);
|
|
134
|
+
else
|
|
135
|
+
callback(null, addresses[0].address, 4);
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
}, async (response) => {
|
|
139
|
+
if (settled) {
|
|
140
|
+
response.destroy();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
responseStream = response;
|
|
144
|
+
const chunks = [];
|
|
145
|
+
const maxBytes = options.maxBytes ?? MAX_CHANNEL_IMAGE_BYTES + 32;
|
|
146
|
+
let size = 0;
|
|
147
|
+
try {
|
|
148
|
+
if (response.statusCode !== 200)
|
|
149
|
+
throw new Error(`图片下载 HTTP ${response.statusCode}`);
|
|
150
|
+
if (Number(response.headers['content-length']) > maxBytes)
|
|
151
|
+
throw new Error('图片超过大小限制');
|
|
152
|
+
for await (const chunk of response) {
|
|
153
|
+
size += chunk.length;
|
|
154
|
+
if (size > maxBytes)
|
|
155
|
+
throw new Error('图片超过大小限制');
|
|
156
|
+
chunks.push(Buffer.from(chunk));
|
|
157
|
+
}
|
|
158
|
+
finish(undefined, Buffer.concat(chunks));
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
response.destroy();
|
|
162
|
+
finish(error);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
timer = setTimeout(() => {
|
|
166
|
+
const error = new Error('图片下载超时');
|
|
167
|
+
finish(error);
|
|
168
|
+
responseStream?.destroy(error);
|
|
169
|
+
req.destroy(error);
|
|
170
|
+
}, options.timeoutMs ?? 30_000);
|
|
171
|
+
req.on('error', error => finish(error));
|
|
172
|
+
options.signal?.addEventListener('abort', abort, { once: true });
|
|
173
|
+
if (options.signal?.aborted)
|
|
174
|
+
abort();
|
|
175
|
+
else
|
|
176
|
+
req.end(options.body);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=channel-image-download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-image-download.js","sourceRoot":"","sources":["../../src/channels/channel-image-download.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,GAAG,MAAM,UAAU,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC,2FAA2F;AAC3F,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,MAAM,KAAK,GAAG,KAAkG,CAAA;IAChH,MAAM,OAAO,GAAG,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;IACvE,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,KAAK,EAAE,IAAI,CAAA;IACjD,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;IAC9D,IAAI,C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AAQ,CAAC,OAAO,EAAE,CAAA;gBAClB,MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC;QACH,CAAC,CAAC,CAAA;QACF,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAA;YACjC,MAAM,CAAC,KAAK,CAAC,CAAA;YACb,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;YAC9B,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC,EAAE,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,CAAA;QAC/B,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QACvC,OAAO,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QAChE,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO;YAAE,KAAK,EAAE,CAAA;;YAC/B,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type TokenResponse = {
|
|
2
|
+
accessToken?: unknown;
|
|
3
|
+
expireIn?: unknown;
|
|
4
|
+
};
|
|
5
|
+
/** 缓存归固定凭据的单个适配器所有,不按 clientId 跨实例共享。 */
|
|
6
|
+
export declare class DingtalkTokenCache {
|
|
7
|
+
private readonly load;
|
|
8
|
+
private readonly now;
|
|
9
|
+
private cached?;
|
|
10
|
+
private pending?;
|
|
11
|
+
private generation;
|
|
12
|
+
clear(): void;
|
|
13
|
+
constructor(load: (signal: AbortSignal) => Promise<TokenResponse>, now?: () => number);
|
|
14
|
+
get(signal: AbortSignal): Promise<string>;
|
|
15
|
+
private fetch;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=dingtalk-token-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dingtalk-token-cache.d.ts","sourceRoot":"","sources":["../../src/channels/dingtalk-token-cache.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAElE,yCAAyC;AACzC,qBAAa,kBAAkB;IAYjB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAmD,OAAO,CAAC,QAAQ,CAAC,GAAG;IAXxG,OAAO,CAAC,MAAM,CAAC,CAAsC;IAErD,OAAO,CAAC,OAAO,CAAC,CAAiB;IACjC,OAAO,CAAC,UAAU,CAAI;IAEtB,KAAK,IAAI,IAAI;gBAMgB,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,EAAmB,GAAG,eAAW;IAE7G,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;YASjC,KAAK;CAYpB"}
|