@huaqiu/dsh-tool-symbol-footprint 0.3.13 → 0.3.15

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 CHANGED
@@ -303,6 +303,8 @@ window.__ModuleLoader__.load({
303
303
  .hq-genhit__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; }
304
304
  .hq-genhit__login-status { margin: 0 0 10px; font: var(--dsw-font-xxs-12, 12px/1.4 system-ui, sans-serif); line-height: 1.5; }
305
305
  .hq-genhit__login-iframe { width: 100%; height: 440px; border: 0; border-radius: 8px; display: block; }
306
+ .hq-genhit__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; }
307
+ .hq-genhit__login-btn:hover { filter: brightness(1.08); }
306
308
  `;
307
309
  function injectStyles() {
308
310
  if (document.getElementById("hq-genhit-styles")) return;
@@ -396,6 +398,8 @@ window.__ModuleLoader__.load({
396
398
  "card.auth.desc": "工具「{tool}」需要登录华秋 EDA 账号才能继续。请在下方的登录框完成登录(或点击左侧「华秋EDA登录」按钮);登录完成后,回复助手「已登录,请重试」,助手会自动重新调用该工具。",
397
399
  "card.auth.loggedIn": "✓ 已登录{nickname}—— 现在可以回复助手「已登录,请重试」,助手会重新调用工具。",
398
400
  "card.auth.loggedOut": "未登录 —— 请在上方登录华秋 EDA(eda.cn)账号,或点击左侧「华秋EDA登录」按钮;登录完成后让助手重试。",
401
+ "card.auth.descHost": "工具「{tool}」需要登录华秋 EDA 账号才能继续。点击下方按钮后,EDA(KiCad)将弹出登录窗口,请在弹出的窗口中完成登录;登录完成后回复助手「已登录,请重试」,助手会自动重新调用该工具。",
402
+ "card.auth.loginBtn": "登录华秋 EDA",
399
403
  "card.nicknameSep": ":{nickname}",
400
404
  "field.maxOf": "{field}(最大)",
401
405
  "field.minOf": "{field}(最小)",
@@ -485,6 +489,8 @@ window.__ModuleLoader__.load({
485
489
  "card.auth.desc": "Tool \"{tool}\" requires a Huaqiu EDA login. Complete the login below (or use the 华秋EDA AI login button in the sidebar); then reply \"I have logged in, please retry\" so the assistant can retry the tool.",
486
490
  "card.auth.loggedIn": "✓ Logged in{nickname} — reply \"I have logged in, please retry\" and the assistant will retry.",
487
491
  "card.auth.loggedOut": "Not logged in — complete the login above, or use the 华秋EDA AI sidebar button.",
492
+ "card.auth.descHost": "Tool \"{tool}\" requires a Huaqiu EDA 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.",
493
+ "card.auth.loginBtn": "Sign in to Huaqiu EDA",
488
494
  "card.nicknameSep": ": {nickname}",
489
495
  "field.maxOf": "{field} (max)",
490
496
  "field.minOf": "{field} (min)",
@@ -201449,15 +201455,21 @@ ${indent})`;
201449
201455
  ]
201450
201456
  });
201451
201457
  }
201452
- function LoginCard({ toolName, authState, t }) {
201458
+ function LoginCard({ toolName, authState, t, getAuth }) {
201453
201459
  const dark = useTheme();
201454
201460
  const locale = useLocale();
201461
+ const authClient = getAuth?.()?.auth;
201455
201462
  const src = (0, react.useMemo)(() => buildLoginUrl({
201456
201463
  lang: locale,
201457
201464
  theme: dark ? "dark" : "light"
201458
201465
  }), [locale, dark]);
201459
201466
  const remountKey = `${locale}|${dark ? "d" : "l"}`;
201460
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201467
+ const statusLine = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
201468
+ className: "hq-genhit__login-status",
201469
+ style: { color: authState?.authenticated ? "#1677ff" : "#d4380d" },
201470
+ children: authState?.authenticated ? t("card.auth.loggedIn", { nickname: authState.nickname ? t("card.nicknameSep", { nickname: authState.nickname }) : "" }) : t("card.auth.loggedOut")
201471
+ });
201472
+ if (authClient?.isHostMode?.()) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201461
201473
  className: "hq-genhit",
201462
201474
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201463
201475
  className: "hq-genhit__header",
@@ -201473,13 +201485,42 @@ ${indent})`;
201473
201485
  children: [
201474
201486
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
201475
201487
  className: "hq-genhit__login-desc",
201476
- children: t("card.auth.desc", { tool: toolName })
201488
+ children: t("card.auth.descHost", { tool: toolName })
201477
201489
  }),
201490
+ statusLine,
201491
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
201492
+ type: "button",
201493
+ className: "hq-genhit__login-btn",
201494
+ onClick: () => {
201495
+ authClient?.login?.({
201496
+ lang: locale,
201497
+ theme: dark ? "dark" : "light"
201498
+ }).catch(() => {});
201499
+ },
201500
+ children: t("card.auth.loginBtn")
201501
+ })
201502
+ ]
201503
+ })]
201504
+ });
201505
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201506
+ className: "hq-genhit",
201507
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201508
+ className: "hq-genhit__header",
201509
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
201510
+ className: "hq-genhit__icon",
201511
+ children: "⛁"
201512
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
201513
+ className: "hq-genhit__title",
201514
+ children: t("card.auth.title")
201515
+ })]
201516
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
201517
+ className: "hq-genhit__login",
201518
+ children: [
201478
201519
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
201479
- className: "hq-genhit__login-status",
201480
- style: { color: authState?.authenticated ? "#1677ff" : "#d4380d" },
201481
- children: authState?.authenticated ? t("card.auth.loggedIn", { nickname: authState.nickname ? t("card.nicknameSep", { nickname: authState.nickname }) : "" }) : t("card.auth.loggedOut")
201520
+ className: "hq-genhit__login-desc",
201521
+ children: t("card.auth.desc", { tool: toolName })
201482
201522
  }),
201523
+ statusLine,
201483
201524
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("iframe", {
201484
201525
  src,
201485
201526
  title: t("card.auth.title"),
@@ -201651,7 +201692,8 @@ ${indent})`;
201651
201692
  if (state.phase === "needs_auth") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoginCard, {
201652
201693
  toolName: props.toolName,
201653
201694
  authState: props.authState,
201654
- t
201695
+ t,
201696
+ getAuth: props.getAuth
201655
201697
  });
201656
201698
  const headerKind = result ? result.kind : kindFromToolName(props.toolName);
201657
201699
  if (state.phase === "generating" || state.phase === "cancelled") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -205001,6 +205043,7 @@ ${indent})`;
205001
205043
  sessionId: props.sessionId,
205002
205044
  sendPrompt,
205003
205045
  authState: useAuthState(),
205046
+ getAuth: () => authService,
205004
205047
  getHqEdge
205005
205048
  });
205006
205049
  for (const toolName of TOOLVIEW_KEYS) disposers.push(slots.inject("tool.call.toolview", () => slots.register({