@huaqiu/dsh-tool-schematic-gen 0.3.12 → 0.3.14
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 +54 -9
- package/lib/client.js.map +1 -1
- package/lib/index.mjs +8 -8
- package/package.json +7 -7
- package/src/client/hit-card.tsx +68 -9
- package/src/client/i18n.ts +4 -0
- package/src/client/index.ts +1 -0
- package/src/client/theme.ts +2 -0
- package/src/index.ts +8 -3
- package/src/tools.ts +4 -4
package/lib/client.js
CHANGED
|
@@ -380,6 +380,8 @@ window.__ModuleLoader__.load({
|
|
|
380
380
|
.hq-sch__login-desc { margin: 0 0 10px; font: var(--dsw-font-xxs-12, 12px/1.4 system-ui, sans-serif); color: var(--dsw-alias-label-secondary, currentColor); line-height: 1.5; }
|
|
381
381
|
.hq-sch__login-status { margin: 0 0 10px; font: var(--dsw-font-xxs-12, 12px/1.4 system-ui, sans-serif); line-height: 1.5; }
|
|
382
382
|
.hq-sch__login-iframe { width: 100%; height: 440px; border: 0; border-radius: 8px; display: block; }
|
|
383
|
+
.hq-sch__login-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--dsw-alias-border-l1, currentColor); border-radius: 6px; padding: 6px 16px; background: var(--dsw-alias-interactive-bg-hover, rgba(127,127,127,0.08)); color: var(--dsw-alias-label-primary, currentColor); font: var(--dsw-font-xxs-12, 12px/1.4 system-ui, sans-serif); cursor: pointer; }
|
|
384
|
+
.hq-sch__login-btn:hover { filter: brightness(1.08); }
|
|
383
385
|
|
|
384
386
|
/* ── live call stack (long-running generations) ───────────────────────────── */
|
|
385
387
|
.hq-sch__progress { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; font: var(--dsw-font-xxs-12, 12px/1.4 system-ui, sans-serif); color: var(--dsw-alias-label-secondary, currentColor); }
|
|
@@ -499,6 +501,8 @@ window.__ModuleLoader__.load({
|
|
|
499
501
|
"card.auth.desc": "工具「{tool}」需要登录华秋 EDA AI 账号才能继续。请在下方的登录框完成登录(或点击左侧「华秋EDA AI登录」按钮);登录完成后,回复助手「已登录,请重试」,助手会自动重新调用该工具。",
|
|
500
502
|
"card.auth.loggedIn": "✓ 已登录{nickname}—— 现在可以回复助手「已登录,请重试」,助手会重新调用工具。",
|
|
501
503
|
"card.auth.loggedOut": "未登录 —— 请在上方登录华秋 EDA AI(eda.cn)账号,或点击左侧「华秋EDA AI 登录」按钮;登录完成后让助手重试。",
|
|
504
|
+
"card.auth.descHost": "工具「{tool}」需要登录华秋 EDA AI 账号才能继续。点击下方按钮后,EDA(KiCad)将弹出登录窗口,请在弹出的窗口中完成登录;登录完成后回复助手「已登录,请重试」,助手会自动重新调用该工具。",
|
|
505
|
+
"card.auth.loginBtn": "登录华秋 EDA AI",
|
|
502
506
|
"card.nicknameSep": ":{nickname}"
|
|
503
507
|
};
|
|
504
508
|
const COPY = {
|
|
@@ -550,6 +554,8 @@ window.__ModuleLoader__.load({
|
|
|
550
554
|
"card.auth.desc": "Tool \"{tool}\" requires a Huaqiu EDA AI login. Complete the login below (or use the 华秋EDA AI sidebar button); then reply \"I have logged in, please retry\" so the assistant can retry the tool.",
|
|
551
555
|
"card.auth.loggedIn": "✓ Logged in{nickname} — reply \"I have logged in, please retry\" and the assistant will retry.",
|
|
552
556
|
"card.auth.loggedOut": "Not logged in — complete the login above, or use the 华秋EDA AI sidebar button.",
|
|
557
|
+
"card.auth.descHost": "Tool \"{tool}\" requires a Huaqiu EDA AI account. Click the button below — EDA (KiCad) will open its login dialog. Complete the login there, then reply \"I have logged in, please retry\" so the assistant can retry the tool.",
|
|
558
|
+
"card.auth.loginBtn": "Sign in to Huaqiu EDA AI",
|
|
553
559
|
"card.nicknameSep": ": {nickname}"
|
|
554
560
|
}
|
|
555
561
|
};
|
|
@@ -105790,15 +105796,22 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
105790
105796
|
}), overlay]
|
|
105791
105797
|
});
|
|
105792
105798
|
}
|
|
105793
|
-
function LoginCard({ toolName, authState, t }) {
|
|
105799
|
+
function LoginCard({ toolName, authState, t, getAuth }) {
|
|
105794
105800
|
const dark = useTheme();
|
|
105795
105801
|
const locale = useLocale();
|
|
105802
|
+
const authClient = getAuth?.()?.auth;
|
|
105803
|
+
const hostMode = authClient?.isHostMode?.() ?? false;
|
|
105796
105804
|
const src = (0, react.useMemo)(() => buildLoginUrl({
|
|
105797
105805
|
lang: locale,
|
|
105798
105806
|
theme: dark ? "dark" : "light"
|
|
105799
105807
|
}), [locale, dark]);
|
|
105800
105808
|
const remountKey = `${locale}|${dark ? "d" : "l"}`;
|
|
105801
|
-
|
|
105809
|
+
const statusLine = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
105810
|
+
className: "hq-sch__login-status",
|
|
105811
|
+
style: { color: authState?.authenticated ? "#1677ff" : "#d4380d" },
|
|
105812
|
+
children: authState?.authenticated ? t("card.auth.loggedIn", { nickname: authState.nickname ? t("card.nicknameSep", { nickname: authState.nickname }) : "" }) : t("card.auth.loggedOut")
|
|
105813
|
+
});
|
|
105814
|
+
if (hostMode) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105802
105815
|
className: "hq-sch",
|
|
105803
105816
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105804
105817
|
className: "hq-sch__header",
|
|
@@ -105814,13 +105827,42 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
105814
105827
|
children: [
|
|
105815
105828
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
105816
105829
|
className: "hq-sch__login-desc",
|
|
105817
|
-
children: t("card.auth.
|
|
105830
|
+
children: t("card.auth.descHost", { tool: toolName })
|
|
105818
105831
|
}),
|
|
105832
|
+
statusLine,
|
|
105833
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
105834
|
+
type: "button",
|
|
105835
|
+
className: "hq-sch__login-btn",
|
|
105836
|
+
onClick: () => {
|
|
105837
|
+
authClient?.login?.({
|
|
105838
|
+
lang: locale,
|
|
105839
|
+
theme: dark ? "dark" : "light"
|
|
105840
|
+
}).catch(() => {});
|
|
105841
|
+
},
|
|
105842
|
+
children: t("card.auth.loginBtn")
|
|
105843
|
+
})
|
|
105844
|
+
]
|
|
105845
|
+
})]
|
|
105846
|
+
});
|
|
105847
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105848
|
+
className: "hq-sch",
|
|
105849
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105850
|
+
className: "hq-sch__header",
|
|
105851
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
105852
|
+
className: "hq-sch__icon",
|
|
105853
|
+
children: "⇶"
|
|
105854
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
105855
|
+
className: "hq-sch__title",
|
|
105856
|
+
children: t("card.auth.title")
|
|
105857
|
+
})]
|
|
105858
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105859
|
+
className: "hq-sch__login",
|
|
105860
|
+
children: [
|
|
105819
105861
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
105820
|
-
className: "hq-sch__login-
|
|
105821
|
-
|
|
105822
|
-
children: authState?.authenticated ? t("card.auth.loggedIn", { nickname: authState.nickname ? t("card.nicknameSep", { nickname: authState.nickname }) : "" }) : t("card.auth.loggedOut")
|
|
105862
|
+
className: "hq-sch__login-desc",
|
|
105863
|
+
children: t("card.auth.desc", { tool: toolName })
|
|
105823
105864
|
}),
|
|
105865
|
+
statusLine,
|
|
105824
105866
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
|
|
105825
105867
|
src,
|
|
105826
105868
|
title: t("card.auth.title"),
|
|
@@ -105966,7 +106008,8 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
105966
106008
|
if (state.phase === "needs_auth") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoginCard, {
|
|
105967
106009
|
toolName: props.toolName,
|
|
105968
106010
|
authState: props.authState,
|
|
105969
|
-
t
|
|
106011
|
+
t,
|
|
106012
|
+
getAuth: props.getAuth
|
|
105970
106013
|
});
|
|
105971
106014
|
const headerKind = result?.kind ?? kindOf(props.toolName);
|
|
105972
106015
|
if (state.phase === "generating") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -106164,7 +106207,8 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
106164
106207
|
}
|
|
106165
106208
|
function apply(ctx) {
|
|
106166
106209
|
const disposers = [];
|
|
106167
|
-
const
|
|
106210
|
+
const authService = ctx.get("huaqiuAuth");
|
|
106211
|
+
const useAuthState = createUseAuthState(authService?.auth);
|
|
106168
106212
|
const getHqEdge = () => ctx.get("hqEdge");
|
|
106169
106213
|
const sendPrompt = (sessionId, message) => {
|
|
106170
106214
|
const sessions = ctx.get("sessions");
|
|
@@ -106186,7 +106230,8 @@ while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]
|
|
|
106186
106230
|
callId: props.callId,
|
|
106187
106231
|
sendPrompt,
|
|
106188
106232
|
authState: useAuthState(),
|
|
106189
|
-
getHqEdge
|
|
106233
|
+
getHqEdge,
|
|
106234
|
+
getAuth: () => authService
|
|
106190
106235
|
});
|
|
106191
106236
|
for (const toolName of TOOLVIEW_KEYS) disposers.push(slots.inject("tool.call.toolview", () => slots.register({
|
|
106192
106237
|
name: "tool.call.toolview",
|