@michengai/dsh-codex-pet 1.0.1 → 1.0.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/CHANGELOG.md +7 -0
- package/CHANGELOG.zh-CN.md +7 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/assets/screenshots/pet-settings.png +0 -0
- package/lib/client.js +155 -56
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.2] - 2026-10-19
|
|
4
|
+
|
|
5
|
+
- Settings navigation draws the pet icon with a skin-safe CSS mask. It covers both the native DSH settings dialog and the dsh-codex-ui settings page without rewriting the host SVG.
|
|
6
|
+
- The pet settings page uses the host Button primitive and host typography, spacing, 0.5px borders, layer tokens, and container queries. The create action is a 22px plus icon next to refresh.
|
|
7
|
+
- The settings dialog follows host modal tokens, and the pet description field follows host input metrics.
|
|
8
|
+
- The end-to-end suite covers the nav icon, full-width layout, and host control metrics. The isolated smoke test loads the host primitives and checks the mask icon.
|
|
9
|
+
|
|
3
10
|
## [1.0.1] - 2026-10-17
|
|
4
11
|
|
|
5
12
|
- Add compatibility with DSH `0.2.1-rc.2` without dropping `0.2.0-rc.1`, `0.2.0-rc.2`, or `0.2.1-rc.1`. Pin development types and the default end-to-end host to `0.2.1-rc.2`. Cordis stays `4.0.5`.
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.0.2] - 2026-10-19
|
|
4
|
+
|
|
5
|
+
- 设置导航的宠物图标改用皮肤安全的 CSS mask,同时覆盖原生 DSH 设置弹窗与 dsh-codex-ui 设置页,不再改写宿主 SVG。
|
|
6
|
+
- 宠物设置页接入宿主 Button 原语,并对齐宿主字号、间距、0.5px 边框、背景层和容器查询;创建入口改为刷新按钮旁的 22px 加号图标。
|
|
7
|
+
- 设置弹窗对齐宿主 Modal token,宠物描述输入框对齐宿主 Input 指标。
|
|
8
|
+
- 端到端测试覆盖导航图标、全宽布局与控件尺寸;隔离冒烟测试加载宿主原语并校验 mask 图标。
|
|
9
|
+
|
|
3
10
|
## [1.0.1] - 2026-10-17
|
|
4
11
|
|
|
5
12
|
- 新增 DSH `0.2.1-rc.2` 兼容,不移除已支持的 `0.2.0-rc.1`、`0.2.0-rc.2`、`0.2.1-rc.1`。开发类型和默认端到端宿主固定到 `0.2.1-rc.2`。Cordis 仍为 `4.0.5`。
|
package/README.md
CHANGED
|
@@ -104,7 +104,7 @@ The pet is a notification and action surface. Start new conversations and write
|
|
|
104
104
|
|
|
105
105
|
### Create a custom pet
|
|
106
106
|
|
|
107
|
-
1. Open pet settings, click
|
|
107
|
+
1. Open pet settings, click the **+** icon (`创建`), and describe the companion.
|
|
108
108
|
2. Click **Create in DSH** (`在 DSH 中创建`). The plugin opens a dedicated task and sends the bundled Skill instructions.
|
|
109
109
|
3. Follow that task's progress. Creation uses DSH's configured model and image tools.
|
|
110
110
|
4. Once the pet files are saved, refresh the pet library and select the new companion.
|
package/README.zh-CN.md
CHANGED
|
@@ -104,7 +104,7 @@ dsh plugin --profile web add @michengai/dsh-codex-pet@latest --registry=https://
|
|
|
104
104
|
|
|
105
105
|
### 创建自定义宠物
|
|
106
106
|
|
|
107
|
-
1. 打开宠物设置,点击
|
|
107
|
+
1. 打开宠物设置,点击 **+** 图标,描述想要的伙伴。
|
|
108
108
|
2. 点击 **在 DSH 中创建**,插件会打开独立任务并发送随包 Skill 指令。
|
|
109
109
|
3. 在该任务中查看进展,创建使用 DSH 当前配置的模型和图像工具。
|
|
110
110
|
4. 宠物文件生成并保存后,刷新宠物库并选择新伙伴。
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -272,6 +272,7 @@ function translator(language) {
|
|
|
272
272
|
|
|
273
273
|
// src/client.tsx
|
|
274
274
|
var import_react7 = require("react");
|
|
275
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
275
276
|
|
|
276
277
|
// src/library-store.ts
|
|
277
278
|
function createLibraryStore(request2) {
|
|
@@ -396,8 +397,8 @@ function updateErrorMessage(code, language) {
|
|
|
396
397
|
var UPDATE_HEADER = "x-michengai-plugin-update";
|
|
397
398
|
var STYLE_ID = "michengai-plugin-update-ui";
|
|
398
399
|
var CSS = `
|
|
399
|
-
.mpi-version{margin-left:8px;color:var(--dsw-alias-label-tertiary,#9da1aa);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}.mpi-check{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:28px;padding:0
|
|
400
|
-
.mpi-overlay{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.62)}.mpi-dialog{position:relative;box-sizing:border-box;width:min(680px,100%);max-height:calc(100vh - 48px);overflow:auto;border:
|
|
400
|
+
.mpi-version{margin-left:8px;color:var(--dsw-alias-label-tertiary,#9da1aa);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}.mpi-check{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:28px;height:28px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l3,var(--dsw-alias-border-l2,#4b4d52));border-radius:var(--dsw-radius-sm,7px);background:transparent;color:var(--dsw-alias-label-secondary,#b8bbc2);font:inherit;font-size:12px;font-weight:500;line-height:18px;white-space:nowrap;cursor:pointer}.mpi-check:hover{background:var(--dsw-alias-interactive-bg-hover,#3a3b3f);color:var(--dsw-alias-label-primary,#fff)}.mpi-check:focus-visible,.mpi-dialog .mpi-action:focus-visible,.mpi-dialog .mpi-dialog-close:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#4f8cff));outline-offset:2px}.mpi-icon{display:inline-flex;flex:0 0 auto;width:16px;height:16px;align-items:center;justify-content:center;pointer-events:none}.mpi-icon svg{display:block;width:16px;height:16px}
|
|
401
|
+
.mpi-overlay{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dsw-alias-bg-mask-1,rgba(0,0,0,.62));backdrop-filter:var(--dsw-mask-blur,none)}.mpi-dialog{position:relative;box-sizing:border-box;width:min(680px,100%);max-height:calc(100vh - 48px);overflow:auto;border:0;border-radius:var(--dsw-radius-panel,14px);padding:22px;background:var(--dsw-alias-bg-layer-2,var(--dsw-specific-menu,#202124));color:var(--dsw-alias-label-primary,#fff);box-shadow:var(--dsw-elevation-prominent,var(--dsw-shadow-lv3,0 16px 48px rgba(0,0,0,.24)));font-family:inherit}.mpi-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.mpi-dialog h2{margin:0;font-size:16px;line-height:24px;font-weight:500}.mpi-dialog .mpi-dialog-close{display:inline-flex;flex:0 0 28px;width:28px;height:28px;align-items:center;justify-content:center;padding:0;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-secondary,#b8bbc2);cursor:pointer}.mpi-dialog .mpi-dialog-close:hover{background:var(--dsw-alias-interactive-bg-hover,#3a3b3f);color:var(--dsw-alias-label-primary,#fff)}.mpi-intro{margin:8px 0 18px;color:var(--dsw-alias-label-secondary,#c2c4ca);font-size:13px;line-height:20px}.mpi-meta{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 18px;margin:0 0 16px;font-size:12px;line-height:18px}.mpi-meta dt{color:var(--dsw-alias-label-secondary,#c2c4ca)}.mpi-meta dd{margin:0;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.mpi-status{margin:0 0 18px;border-radius:var(--dsw-radius-sm,7px);padding:12px 14px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#252527));font-size:13px;font-weight:600;line-height:20px}.mpi-status[data-kind=error]{color:var(--dsw-alias-state-error-primary,#ff6464)}.mpi-status[data-kind=success]{color:var(--dsw-alias-state-success-primary,#36d67a)}.mpi-status[data-kind=update]{color:var(--dsw-alias-state-warn-primary,#e8b15a)}.mpi-manual{border-top:1px solid var(--dsw-alias-border-l2,#4b4d52);padding-top:16px}.mpi-manual h3{margin:0 0 6px;font-size:14px;line-height:20px}.mpi-manual p{margin:0 0 10px;color:var(--dsw-alias-label-secondary,#c2c4ca);font-size:12px;line-height:18px}.mpi-command{display:flex;align-items:center;gap:8px;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:var(--dsw-radius-sm,7px);padding:10px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#252527))}.mpi-command code{min-width:0;flex:1;overflow:auto;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:18px;white-space:nowrap}.mpi-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:18px}.mpi-actions-group{display:flex;gap:8px}.mpi-dialog .mpi-action{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;border:1px solid var(--dsw-alias-border-l2,#4b4d52);border-radius:var(--dsw-radius-sm,7px);padding:6px 10px;background:transparent;color:inherit;font:inherit;font-size:12px;cursor:pointer}.mpi-dialog .mpi-action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,#414247)}.mpi-dialog .mpi-action:disabled{cursor:not-allowed;opacity:.55}.mpi-dialog .mpi-primary{border-color:var(--dsw-alias-button-primary-fill,var(--dsw-alias-state-business-primary,#4f8cff));background:var(--dsw-alias-button-primary-fill,var(--dsw-alias-state-business-primary,#4f8cff));color:var(--dsw-alias-label-primary-foreground,#fff)}.mpi-progress{height:4px;margin-top:10px;overflow:hidden;border-radius:99px;background:var(--dsw-alias-border-l2,#4b4d52)}.mpi-progress::after{display:block;width:32%;height:100%;background:var(--dsw-alias-state-business-primary,#4f8cff);content:'';animation:mpi-wave 1.15s ease-in-out infinite}@keyframes mpi-wave{from{transform:translateX(-110%)}to{transform:translateX(330%)}}@media(max-width:560px){.mpi-overlay{padding:10px}.mpi-dialog{max-height:calc(100vh - 20px);padding:16px}.mpi-actions{align-items:stretch}.mpi-actions-group{justify-content:flex-end;flex-wrap:wrap}.mpi-meta{grid-template-columns:1fr;gap:2px}.mpi-meta dd{margin-bottom:6px}}
|
|
401
402
|
`;
|
|
402
403
|
var ZH = {
|
|
403
404
|
unpublished: "\u5C1A\u672A\u53D1\u5E03\u5230 npm\uFF0C\u53D1\u5E03\u540E\u5373\u53EF\u68C0\u67E5\u5E76\u5B89\u88C5\u66F4\u65B0\u3002",
|
|
@@ -592,7 +593,7 @@ function observePluginUpdate(options) {
|
|
|
592
593
|
const setMessage = (message, kind = "") => {
|
|
593
594
|
status.textContent = message;
|
|
594
595
|
status.dataset.kind = kind;
|
|
595
|
-
status.style.color = kind === "update" ? "
|
|
596
|
+
status.style.color = kind === "update" ? "var(--dsw-alias-state-warn-primary,#e8b15a)" : "";
|
|
596
597
|
};
|
|
597
598
|
const setBusy = (value) => {
|
|
598
599
|
busy = value;
|
|
@@ -829,13 +830,13 @@ function PluginUpdateHeader({ locale }) {
|
|
|
829
830
|
});
|
|
830
831
|
}, [language]);
|
|
831
832
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
832
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `.dcp-project-head{display:flex;align-items:center;justify-content:flex-start;gap:8px 12px;flex-wrap:wrap;margin-bottom:
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `.dcp-project-head{display:flex;align-items:center;justify-content:flex-start;gap:8px 12px;flex-wrap:wrap;margin-bottom:0}.dcp-project-head h1{display:inline-flex;align-items:baseline;margin:0;white-space:nowrap}.dcp-version{font-size:12px;font-weight:500;line-height:18px;color:var(--dsw-alias-label-tertiary,#9da1aa);margin-left:10px}.dcp-project-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.dcp-project-links a,.dcp-project-links button{display:inline-flex;align-items:center;justify-content:center;gap:4px;box-sizing:border-box;min-height:28px;height:28px;padding:0 10px;border:0.5px solid var(--dsw-alias-border-l3,var(--dsw-alias-border-l2,#383838));border-radius:var(--dsw-radius-sm,7px);background:transparent;color:var(--dsw-alias-label-primary,inherit);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;text-decoration:none;white-space:nowrap;cursor:pointer}.dcp-project-links a:hover,.dcp-project-links button:hover{background:var(--dsw-alias-interactive-bg-hover,#ffffff0a);color:var(--dsw-alias-label-primary,inherit)}.dcp-project-links a:focus-visible,.dcp-project-links button:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#4f8cff));outline-offset:2px}.dcp-project-links svg{display:block;flex:none;width:16px;height:16px}` }),
|
|
833
834
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { ref: root, className: "dcp-project-head", children: [
|
|
834
835
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h1", { children: [
|
|
835
836
|
zh2 ? "\u5BA0\u7269" : "Pets",
|
|
836
837
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dcp-version", children: [
|
|
837
838
|
"v",
|
|
838
|
-
"1.0.
|
|
839
|
+
"1.0.2"
|
|
839
840
|
] })
|
|
840
841
|
] }),
|
|
841
842
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", { className: "dcp-project-links", children: [
|
|
@@ -974,6 +975,24 @@ var MixerHorizontalIcon = /* @__PURE__ */ (0, import_react3.forwardRef)(function
|
|
|
974
975
|
clipRule: "evenodd"
|
|
975
976
|
}));
|
|
976
977
|
});
|
|
978
|
+
var _excluded$3x = ["color"];
|
|
979
|
+
var PlusIcon = /* @__PURE__ */ (0, import_react3.forwardRef)(function(_ref, forwardedRef) {
|
|
980
|
+
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$3x);
|
|
981
|
+
return (0, import_react3.createElement)("svg", Object.assign({
|
|
982
|
+
width: "15",
|
|
983
|
+
height: "15",
|
|
984
|
+
viewBox: "0 0 15 15",
|
|
985
|
+
fill: "none",
|
|
986
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
987
|
+
}, props, {
|
|
988
|
+
ref: forwardedRef
|
|
989
|
+
}), (0, import_react3.createElement)("path", {
|
|
990
|
+
d: "M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z",
|
|
991
|
+
fill: color,
|
|
992
|
+
fillRule: "evenodd",
|
|
993
|
+
clipRule: "evenodd"
|
|
994
|
+
}));
|
|
995
|
+
});
|
|
977
996
|
var _excluded$3A = ["color"];
|
|
978
997
|
var QuestionMarkCircledIcon = /* @__PURE__ */ (0, import_react3.forwardRef)(function(_ref, forwardedRef) {
|
|
979
998
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$3A);
|
|
@@ -1157,18 +1176,18 @@ var polishedTrayStyles = `
|
|
|
1157
1176
|
|
|
1158
1177
|
// src/ui.tsx
|
|
1159
1178
|
var import_react5 = require("react");
|
|
1179
|
+
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1160
1180
|
|
|
1161
1181
|
// src/styles.ts
|
|
1162
1182
|
var styles = `
|
|
1163
|
-
.dcp{--pet-bg:var(--dsw-alias-bg-base,#181818);--pet-card:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-base,#242424));--pet-line:var(--dsw-alias-border-l2,#343434);--pet-text:var(--dsw-alias-label-primary,#d7d7d7);--pet-muted:var(--dsw-alias-label-secondary,#929292);font-family:Arial,"Microsoft YaHei",sans-serif;color:var(--pet-text);font-size:13px;line-height:1.45;color-scheme:inherit}
|
|
1164
|
-
.dcp *{box-sizing:border-box}.dcp
|
|
1165
|
-
.dcp-page{
|
|
1166
|
-
.dcp-card{border:
|
|
1183
|
+
.dcp{--pet-bg:var(--dsw-alias-bg-base,#181818);--pet-card:var(--dsw-alias-bg-layer-2,var(--dsw-alias-bg-base,#242424));--pet-line:var(--dsw-alias-border-l2,#343434);--pet-text:var(--dsw-alias-label-primary,#d7d7d7);--pet-muted:var(--dsw-alias-label-secondary,#929292);font-family:var(--dsw-font-family,Arial,"Microsoft YaHei",sans-serif);color:var(--pet-text);font-size:13px;line-height:1.45;color-scheme:inherit}
|
|
1184
|
+
.dcp *{box-sizing:border-box}.dcp input,.dcp textarea{font:inherit}.dcp button:disabled{opacity:.4;cursor:not-allowed}.dcp button:focus-visible,.dcp input:focus-visible,.dcp textarea:focus-visible{outline:var(--dsw-focus-ring-width,1px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#9bc8ff));outline-offset:2px}.dcp-pet-button,.dcp-bubble,.dcp-menu button,.dcp-tray button{font:inherit;color:var(--pet-text);cursor:pointer}.dcp-pet-button,.dcp-bubble,.dcp-menu button,.dcp-tray button{border:0;background:transparent}.dcp-menu button:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,color-mix(in srgb,var(--pet-text) 8%,transparent))}
|
|
1185
|
+
.dcp-page{box-sizing:border-box;display:flex;flex-direction:column;gap:14px;width:100%;min-width:0;padding:2px 0 36px;font-size:14px;line-height:1.5;container-type:inline-size}.dcp-page h1{font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;margin:0}.dcp-page h2{font-size:14px;line-height:22px;font-weight:600;margin:0}.dcp-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.dcp-sub{color:var(--dsw-alias-label-tertiary,var(--pet-muted));margin:4px 0 0;font-size:14px;line-height:22px}.dcp-actions{display:flex;align-items:center;gap:8px}.dcp-icon-button{width:22px;min-width:22px;height:22px;padding:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-secondary,#b9b9b9);border-color:var(--dsw-alias-border-l2)}.dcp-icon-button:hover:not(:disabled){color:var(--dsw-alias-link,#4176e6);border-color:var(--dsw-alias-link,#4176e6)}.dcp svg{width:16px;height:16px;flex-shrink:0}
|
|
1186
|
+
.dcp-card{border:0.5px solid var(--pet-line);border-radius:var(--dsw-radius-lg,16px);background:var(--dsw-alias-bg-layer-1,var(--pet-card));overflow:hidden;padding:0 14px}.dcp-row{display:flex;align-items:center;gap:12px;min-height:76px;border-bottom:0.5px solid var(--dsw-alias-border-l1,var(--pet-line))}.dcp-preview{width:52px;flex-shrink:0;display:flex;justify-content:center;align-items:center}.dcp-info{flex:1;min-width:0}.dcp-name{font-size:14px;font-weight:650;margin-bottom:3px}.dcp-description{font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,var(--pet-muted));overflow-wrap:anywhere}.dcp-folder{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 0}.dcp-path{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;line-height:17px;color:var(--dsw-alias-label-tertiary,var(--pet-muted));overflow-wrap:anywhere}.dcp-folder-button{white-space:nowrap}.dcp-appearance{display:flex;flex-direction:column;gap:14px}.dcp-size{min-height:62px;display:flex;align-items:center;justify-content:space-between;padding:12px 16px}.dcp-size label{font-weight:600}.dcp-size input{width:160px;height:2px;accent-color:var(--dsw-alias-brand-primary,#fff);cursor:pointer}.dcp-size small{display:block;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,var(--pet-muted));font-weight:400;margin-top:2px}.dcp-note{margin:0;color:var(--dsw-alias-label-tertiary,var(--pet-muted));font-size:11px;line-height:17px}.dcp-error{padding:12px 14px;border:0.5px solid color-mix(in srgb,var(--dsw-alias-state-error-primary,#ed7272) 40%,transparent);border-radius:var(--dsw-radius-sm,8px);color:var(--dsw-alias-state-error-primary,#edb7a3);margin:0;font-size:12px;line-height:18px}.dcp-empty{padding:25px 14px;text-align:center;color:var(--dsw-alias-label-tertiary,var(--pet-muted));font-size:12px;line-height:18px}
|
|
1167
1187
|
.dcp-floating{position:fixed;z-index:2147483000;pointer-events:none}.dcp-pet-button{display:block!important;padding:0!important;background:transparent!important;touch-action:none;cursor:grab!important;pointer-events:auto;user-select:none;-webkit-user-select:none}.dcp-pet-button:active{cursor:grabbing!important}.dcp-sprite{background-repeat:no-repeat;pointer-events:none;flex-shrink:0}.dcp-bubble{position:absolute;bottom:calc(100% + 16px);right:0;min-width:160px;max-width:240px;width:max-content;padding:10px 16px!important;border:1px solid var(--pet-line)!important;border-radius:28px!important;background:var(--pet-card)!important;text-align:left;box-shadow:0 2px 12px #0002;pointer-events:auto}.dcp-bubble strong{display:block;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}.dcp-bubble span{display:block;font-size:12px;color:var(--pet-muted)}.dcp-menu{position:absolute;right:0;bottom:100%;width:160px;padding:6px;border:1px solid var(--pet-line);background:var(--pet-card);border-radius:10px;pointer-events:auto;box-shadow:0 8px 32px #0004}.dcp-menu button{display:block;width:100%;text-align:left;padding:8px;border-radius:5px}.dcp-menu hr{border:0;border-top:1px solid var(--pet-line);margin:5px}
|
|
1168
|
-
.dcp-dialog{color:var(--pet-text);background:var(--pet-card);border:
|
|
1169
|
-
.dcp-
|
|
1170
|
-
.dcp-
|
|
1171
|
-
@media(max-width:600px){.dcp-page h1{font-size:22px;margin-bottom:24px}.dcp-head{flex-wrap:wrap;gap:10px}.dcp-row{min-height:86px;gap:8px}.dcp-preview{width:44px}.dcp-description{font-size:11px}.dcp-card{padding:0 12px}.dcp-folder{align-items:flex-start}.dcp-folder-button{font-size:11px!important}.dcp-size{padding:12px}.dcp-size input{width:130px}.dcp-appearance{margin-top:32px}}
|
|
1188
|
+
.dcp-dialog{color:var(--pet-text);background:var(--dsw-alias-bg-layer-2,var(--pet-card));border:0;border-radius:var(--dsw-radius-panel,16px);width:min(480px,calc(100vw - 32px));padding:24px;box-shadow:var(--dsw-elevation-prominent,0 16px 48px #0004)}.dcp-dialog[open]{display:flex;flex-direction:column;gap:12px}.dcp-dialog-close{align-self:flex-start}.dcp-dialog::backdrop{background:var(--dsw-alias-bg-mask-1,#0008);backdrop-filter:var(--dsw-mask-blur,none)}.dcp-create-dialog h2{font-size:16px;line-height:24px;font-weight:500;margin:0 0 12px}.dcp textarea.dcp-textarea{display:block;resize:vertical;width:100%;min-height:120px;color:var(--pet-text);background:var(--dsw-alias-bg-layer-1,var(--pet-bg));border:0.5px solid var(--dsw-alias-border-l4,var(--pet-line));border-radius:var(--dsw-radius-md,12px);padding:8px 12px;margin:16px 0;font-size:14px;line-height:22px}.dcp textarea.dcp-textarea:focus{outline:none;border-color:var(--dsw-alias-state-business-primary,var(--pet-line))}.dcp-dialog footer{display:flex;justify-content:flex-end;gap:8px}.dcp-creation{border-top:0.5px solid var(--pet-line);padding-top:12px}
|
|
1189
|
+
.dcp-size input{-webkit-appearance:none;appearance:none;background:var(--pet-line);height:2px}.dcp-size input::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;border-radius:50%;background:var(--dsw-alias-brand-primary,var(--pet-text))}
|
|
1190
|
+
@container(max-width:520px){.dcp-page h1{font-size:22px}.dcp-head{flex-wrap:wrap;gap:10px}.dcp-row{min-height:68px;gap:8px}.dcp-preview{width:44px}.dcp-description{font-size:11px}.dcp-card{padding:0 12px}.dcp-folder{align-items:flex-start}.dcp-size{padding:12px}.dcp-size input{width:130px}}
|
|
1172
1191
|
@media(prefers-reduced-motion:reduce){.dcp *{animation:none!important;transition:none!important}}
|
|
1173
1192
|
`;
|
|
1174
1193
|
|
|
@@ -1268,6 +1287,7 @@ function Settings({
|
|
|
1268
1287
|
const [busy, setBusy] = (0, import_react5.useState)(false), [showCreate, setShowCreate] = (0, import_react5.useState)(false), [description, setDescription] = (0, import_react5.useState)("");
|
|
1269
1288
|
const [size, setSize] = (0, import_react5.useState)(library?.config.size ?? 120);
|
|
1270
1289
|
const dialog = (0, import_react5.useRef)(null);
|
|
1290
|
+
const createTitleId = (0, import_react5.useId)();
|
|
1271
1291
|
const [creationError, setCreationError] = (0, import_react5.useState)("");
|
|
1272
1292
|
(0, import_react5.useEffect)(() => {
|
|
1273
1293
|
if (library) setSize(library.config.size);
|
|
@@ -1295,29 +1315,39 @@ function Settings({
|
|
|
1295
1315
|
] }),
|
|
1296
1316
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dcp-actions", children: [
|
|
1297
1317
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1298
|
-
|
|
1318
|
+
import_dsh_client_ui_primitives.Button,
|
|
1299
1319
|
{
|
|
1300
|
-
|
|
1320
|
+
type: "button",
|
|
1321
|
+
variant: "outline",
|
|
1322
|
+
size: "sm",
|
|
1323
|
+
className: "dcp-icon-button",
|
|
1301
1324
|
title: t("\u5237\u65B0\u5BA0\u7269\u5E93"),
|
|
1302
1325
|
"aria-label": t("\u5237\u65B0\u5BA0\u7269\u5E93"),
|
|
1303
1326
|
disabled: busy,
|
|
1304
|
-
|
|
1305
|
-
|
|
1327
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReloadIcon, {}),
|
|
1328
|
+
onClick: () => void act(controller.refresh)
|
|
1306
1329
|
}
|
|
1307
1330
|
),
|
|
1308
1331
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1309
|
-
|
|
1332
|
+
import_dsh_client_ui_primitives.Button,
|
|
1310
1333
|
{
|
|
1311
|
-
|
|
1334
|
+
type: "button",
|
|
1335
|
+
variant: "outline",
|
|
1336
|
+
size: "sm",
|
|
1337
|
+
className: "dcp-icon-button",
|
|
1338
|
+
title: t("\u521B\u5EFA"),
|
|
1339
|
+
"aria-label": t("\u521B\u5EFA"),
|
|
1312
1340
|
disabled: !library || busy,
|
|
1313
|
-
|
|
1314
|
-
|
|
1341
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PlusIcon, {}),
|
|
1342
|
+
onClick: () => setShowCreate(true)
|
|
1315
1343
|
}
|
|
1316
1344
|
),
|
|
1317
1345
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1318
|
-
|
|
1346
|
+
import_dsh_client_ui_primitives.Button,
|
|
1319
1347
|
{
|
|
1320
|
-
|
|
1348
|
+
type: "button",
|
|
1349
|
+
variant: "outline",
|
|
1350
|
+
size: "sm",
|
|
1321
1351
|
disabled: !library || busy,
|
|
1322
1352
|
onClick: () => void act(
|
|
1323
1353
|
() => controller.update({ visible: !library?.config.visible })
|
|
@@ -1337,9 +1367,11 @@ function Settings({
|
|
|
1337
1367
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dcp-description", children: pet.description })
|
|
1338
1368
|
] }),
|
|
1339
1369
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1340
|
-
|
|
1370
|
+
import_dsh_client_ui_primitives.Button,
|
|
1341
1371
|
{
|
|
1342
|
-
|
|
1372
|
+
type: "button",
|
|
1373
|
+
variant: library.config.selected === pet.id ? "ghost" : "outline",
|
|
1374
|
+
size: "sm",
|
|
1343
1375
|
"aria-label": library.config.selected === pet.id ? `${t("\u5DF2\u9009\u62E9")} ${pet.name}` : `${t("\u9009\u62E9")} ${pet.name}`,
|
|
1344
1376
|
"aria-pressed": library.config.selected === pet.id,
|
|
1345
1377
|
disabled: busy || library.config.selected === pet.id,
|
|
@@ -1354,17 +1386,17 @@ function Settings({
|
|
|
1354
1386
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: t("DSH \u81EA\u5B9A\u4E49\u5BA0\u7269") }),
|
|
1355
1387
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dcp-path", children: library?.customPath ?? t("\u6B63\u5728\u8BFB\u53D6\u76EE\u5F55\u2026") })
|
|
1356
1388
|
] }),
|
|
1357
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1358
|
-
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1390
|
+
import_dsh_client_ui_primitives.Button,
|
|
1359
1391
|
{
|
|
1392
|
+
type: "button",
|
|
1393
|
+
variant: "outline",
|
|
1394
|
+
size: "sm",
|
|
1360
1395
|
className: "dcp-folder-button",
|
|
1361
1396
|
disabled: !library || busy,
|
|
1397
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowTopRightIcon, {}),
|
|
1362
1398
|
onClick: () => void act(controller.folder),
|
|
1363
|
-
children:
|
|
1364
|
-
t("\u6253\u5F00\u6587\u4EF6\u5939"),
|
|
1365
|
-
" ",
|
|
1366
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowTopRightIcon, {})
|
|
1367
|
-
]
|
|
1399
|
+
children: t("\u6253\u5F00\u6587\u4EF6\u5939")
|
|
1368
1400
|
}
|
|
1369
1401
|
)
|
|
1370
1402
|
] })
|
|
@@ -1405,7 +1437,8 @@ function Settings({
|
|
|
1405
1437
|
"dialog",
|
|
1406
1438
|
{
|
|
1407
1439
|
ref: dialog,
|
|
1408
|
-
className: "dcp-dialog",
|
|
1440
|
+
className: "dcp-dialog dcp-create-dialog",
|
|
1441
|
+
"aria-labelledby": createTitleId,
|
|
1409
1442
|
onCancel: () => setShowCreate(false),
|
|
1410
1443
|
onClose: () => setShowCreate(false),
|
|
1411
1444
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
@@ -1426,10 +1459,11 @@ function Settings({
|
|
|
1426
1459
|
).finally(() => setBusy(false));
|
|
1427
1460
|
},
|
|
1428
1461
|
children: [
|
|
1429
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t("\u521B\u5EFA\u5BA0\u7269") }),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { id: createTitleId, children: t("\u521B\u5EFA\u5BA0\u7269") }),
|
|
1430
1463
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1431
1464
|
"textarea",
|
|
1432
1465
|
{
|
|
1466
|
+
className: "dcp-textarea",
|
|
1433
1467
|
autoFocus: true,
|
|
1434
1468
|
"aria-label": t("\u5BA0\u7269\u63CF\u8FF0"),
|
|
1435
1469
|
placeholder: t(
|
|
@@ -1450,19 +1484,21 @@ function Settings({
|
|
|
1450
1484
|
creationError && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { role: "alert", className: "dcp-error", children: t(creationError) }),
|
|
1451
1485
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { children: [
|
|
1452
1486
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1453
|
-
|
|
1487
|
+
import_dsh_client_ui_primitives.Button,
|
|
1454
1488
|
{
|
|
1455
1489
|
type: "button",
|
|
1456
|
-
|
|
1490
|
+
variant: "ghost",
|
|
1491
|
+
size: "sm",
|
|
1457
1492
|
onClick: () => setShowCreate(false),
|
|
1458
1493
|
children: t("\u53D6\u6D88")
|
|
1459
1494
|
}
|
|
1460
1495
|
),
|
|
1461
1496
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1462
|
-
|
|
1497
|
+
import_dsh_client_ui_primitives.Button,
|
|
1463
1498
|
{
|
|
1464
1499
|
type: "submit",
|
|
1465
|
-
|
|
1500
|
+
variant: "primary",
|
|
1501
|
+
size: "sm",
|
|
1466
1502
|
disabled: busy || !description.trim() || !library?.skillAvailable || !create,
|
|
1467
1503
|
children: t("\u5728 DSH \u4E2D\u521B\u5EFA")
|
|
1468
1504
|
}
|
|
@@ -2067,25 +2103,86 @@ async function createPetSession(sessions, description, directory, skill) {
|
|
|
2067
2103
|
|
|
2068
2104
|
// src/settings-icon.ts
|
|
2069
2105
|
var PAW = '<circle cx="11" cy="4" r="2"/><circle cx="18" cy="8" r="2"/><circle cx="20" cy="16" r="2"/><path d="M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z"/>';
|
|
2106
|
+
var PAW_MASK = `url("data:image/svg+xml,${encodeURIComponent(
|
|
2107
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${PAW}</svg>`
|
|
2108
|
+
)}")`;
|
|
2109
|
+
var PET_NAV_ICON_MARKER = "data-dcp-nav-icon";
|
|
2110
|
+
var PET_NAV_ICON_CLASS = "dcp-settings-nav-icon";
|
|
2111
|
+
var PET_NAV_ROW_SELECTOR = '[role="dialog"] nav button, .dcu-settings-link';
|
|
2112
|
+
var NAV_ICON_STYLE_ID = "dcp-settings-nav-icon-style";
|
|
2113
|
+
var NAV_ICON_CSS = `[${PET_NAV_ICON_MARKER}]>svg{display:none!important}.${PET_NAV_ICON_CLASS}{display:inline-block;flex:none;width:16px;height:16px;color:var(--dcu-sidebar-icon,currentColor);background:currentColor;-webkit-mask:${PAW_MASK} center/contain no-repeat;mask:${PAW_MASK} center/contain no-repeat}`;
|
|
2114
|
+
function ensureNavIconStyle() {
|
|
2115
|
+
if (typeof document === "undefined") return;
|
|
2116
|
+
if (document.getElementById(NAV_ICON_STYLE_ID) !== null) return;
|
|
2117
|
+
const style = document.createElement("style");
|
|
2118
|
+
style.id = NAV_ICON_STYLE_ID;
|
|
2119
|
+
style.textContent = NAV_ICON_CSS;
|
|
2120
|
+
(document.head ?? document.documentElement).appendChild(style);
|
|
2121
|
+
}
|
|
2122
|
+
function isPetNavRow(button) {
|
|
2123
|
+
const label = button.textContent?.trim() ?? "";
|
|
2124
|
+
return label === "\u5BA0\u7269" || label === "Pets";
|
|
2125
|
+
}
|
|
2126
|
+
function applyPetSettingsIcon(button) {
|
|
2127
|
+
if (!isPetNavRow(button)) return false;
|
|
2128
|
+
if (button.querySelector(":scope > svg") === null) return false;
|
|
2129
|
+
if (button.getAttribute(PET_NAV_ICON_MARKER) === "pet" && button.querySelector(`.${PET_NAV_ICON_CLASS}`) !== null)
|
|
2130
|
+
return false;
|
|
2131
|
+
const doc = button.ownerDocument;
|
|
2132
|
+
if (!doc) return false;
|
|
2133
|
+
button.setAttribute(PET_NAV_ICON_MARKER, "pet");
|
|
2134
|
+
const icon = doc.createElement("span");
|
|
2135
|
+
icon.className = PET_NAV_ICON_CLASS;
|
|
2136
|
+
icon.setAttribute("aria-hidden", "true");
|
|
2137
|
+
button.prepend(icon);
|
|
2138
|
+
return true;
|
|
2139
|
+
}
|
|
2140
|
+
function restorePetSettingsIcon(button) {
|
|
2141
|
+
button.removeAttribute(PET_NAV_ICON_MARKER);
|
|
2142
|
+
const icon = button.querySelector(`.${PET_NAV_ICON_CLASS}`);
|
|
2143
|
+
if (!icon) return false;
|
|
2144
|
+
icon.remove();
|
|
2145
|
+
return true;
|
|
2146
|
+
}
|
|
2070
2147
|
function observePetSettingsIcon() {
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2148
|
+
if (typeof document === "undefined" || document.body === null)
|
|
2149
|
+
return () => {
|
|
2150
|
+
};
|
|
2151
|
+
ensureNavIconStyle();
|
|
2152
|
+
let disposed = false;
|
|
2153
|
+
let frame;
|
|
2154
|
+
const hasSettingsSurface = () => document.querySelector(
|
|
2155
|
+
'.dcu-settings-page, .dcu-settings-link, [data-shortcut-modal="settings"]'
|
|
2156
|
+
) !== null;
|
|
2157
|
+
const sync = () => {
|
|
2158
|
+
frame = void 0;
|
|
2159
|
+
if (disposed) return;
|
|
2160
|
+
if (!hasSettingsSurface() && document.querySelector(`[${PET_NAV_ICON_MARKER}]`) === null)
|
|
2161
|
+
return;
|
|
2162
|
+
for (const row of document.querySelectorAll(PET_NAV_ROW_SELECTOR)) {
|
|
2163
|
+
applyPetSettingsIcon(row);
|
|
2164
|
+
}
|
|
2165
|
+
};
|
|
2166
|
+
const schedule = () => {
|
|
2167
|
+
if (frame !== void 0 || disposed) return;
|
|
2168
|
+
frame = window.requestAnimationFrame(sync);
|
|
2169
|
+
};
|
|
2170
|
+
sync();
|
|
2171
|
+
const observer = new MutationObserver(schedule);
|
|
2172
|
+
observer.observe(document.body, {
|
|
2173
|
+
childList: true,
|
|
2174
|
+
subtree: true,
|
|
2175
|
+
characterData: true
|
|
2176
|
+
});
|
|
2177
|
+
return () => {
|
|
2178
|
+
disposed = true;
|
|
2179
|
+
observer.disconnect();
|
|
2180
|
+
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
2181
|
+
for (const row of document.querySelectorAll(`[${PET_NAV_ICON_MARKER}]`)) {
|
|
2182
|
+
restorePetSettingsIcon(row);
|
|
2083
2183
|
}
|
|
2184
|
+
document.getElementById(NAV_ICON_STYLE_ID)?.remove();
|
|
2084
2185
|
};
|
|
2085
|
-
apply2();
|
|
2086
|
-
const observer = new MutationObserver(apply2);
|
|
2087
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
2088
|
-
return () => observer.disconnect();
|
|
2089
2186
|
}
|
|
2090
2187
|
|
|
2091
2188
|
// src/global-overlay.tsx
|
|
@@ -2226,10 +2323,12 @@ function Overlay({
|
|
|
2226
2323
|
},
|
|
2227
2324
|
children: [
|
|
2228
2325
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2229
|
-
|
|
2326
|
+
import_dsh_client_ui_primitives2.Button,
|
|
2230
2327
|
{
|
|
2231
2328
|
type: "button",
|
|
2232
|
-
|
|
2329
|
+
variant: "ghost",
|
|
2330
|
+
size: "sm",
|
|
2331
|
+
className: "dcp-dialog-close",
|
|
2233
2332
|
onClick: () => settingsDialog.current?.close(),
|
|
2234
2333
|
children: t("\u5173\u95ED\u8BBE\u7F6E")
|
|
2235
2334
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-codex-pet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "DSH Codex Pet — 为 DeepSeek Harness 提供宠物陪伴、多任务提醒与交互,以及 Skill 自定义宠物 · A pet companion with multi-task notifications, interactions, and Skill-based custom pets for DeepSeek Harness",
|
|
6
6
|
"type": "module",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"assets:import": "tsx scripts/import-codex.ts"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
|
|
64
65
|
"@deepseek-ai/dsh-host-webserver": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
|
|
65
66
|
"react": "^18.2.0",
|
|
66
67
|
"react-dom": "^18.2.0"
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"@deepseek-ai/dsh": "0.2.1-rc.2",
|
|
76
77
|
"@deepseek-ai/dsh-api-session-controller": "0.2.1-rc.2",
|
|
77
78
|
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
|
|
78
80
|
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
|
|
79
81
|
"@deepseek-ai/dsh-client-ui-session": "0.2.1-rc.2",
|
|
80
82
|
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
|