dsh-context 0.38.3 → 0.38.5

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
@@ -249,6 +249,9 @@ window.__ModuleLoader__.load({
249
249
  "rich.md": "Markdown",
250
250
  "rich.toMd": "按 Markdown 渲染查看",
251
251
  "rich.toRaw": "查看原始文本",
252
+ "rich.md.copy": "复制",
253
+ "rich.md.copied": "已复制",
254
+ "rich.md.footnotes": "脚注",
252
255
  "block.thinking": "思考",
253
256
  "block.answer": "回答",
254
257
  "block.content": "内容",
@@ -517,6 +520,9 @@ window.__ModuleLoader__.load({
517
520
  "rich.md": "Markdown",
518
521
  "rich.toMd": "View as Markdown",
519
522
  "rich.toRaw": "View Raw Text",
523
+ "rich.md.copy": "Copy",
524
+ "rich.md.copied": "Copied",
525
+ "rich.md.footnotes": "Footnotes",
520
526
  "block.thinking": "Reasoning",
521
527
  "block.answer": "Response",
522
528
  "block.content": "Content",
@@ -1706,6 +1712,7 @@ window.__ModuleLoader__.load({
1706
1712
  }
1707
1713
  //#endregion
1708
1714
  //#region src/client/components/richText.tsx
1715
+ const Markdown = _deepseek_ai_dsh_client_ui_primitives.MarkdownText;
1709
1716
  function makeRichText(kit) {
1710
1717
  const { t } = kit;
1711
1718
  function useRichMode() {
@@ -1734,7 +1741,17 @@ window.__ModuleLoader__.load({
1734
1741
  }, line)));
1735
1742
  }
1736
1743
  function RichText(props) {
1737
- if (props.mode === "md") return /* @__PURE__ */ React.createElement("div", { className: "lc-ts-desc-md" }, /* @__PURE__ */ React.createElement(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, { text: props.text }));
1744
+ const mdLabels = React.useMemo(() => ({
1745
+ code: {
1746
+ copyLabel: t("rich.md.copy"),
1747
+ copiedLabel: t("rich.md.copied")
1748
+ },
1749
+ footnotes: t("rich.md.footnotes")
1750
+ }), [t]);
1751
+ if (props.mode === "md") return /* @__PURE__ */ React.createElement("div", { className: "lc-ts-desc-md" }, /* @__PURE__ */ React.createElement(Markdown, {
1752
+ text: props.text,
1753
+ labels: mdLabels
1754
+ }));
1738
1755
  return /* @__PURE__ */ React.createElement(RawText, { text: props.text });
1739
1756
  }
1740
1757
  return {
@@ -4816,7 +4833,7 @@ window.__ModuleLoader__.load({
4816
4833
  return function PluginInfo() {
4817
4834
  const [latest, setLatest] = React.useState(null);
4818
4835
  React.useEffect(() => {
4819
- if ("0.38.3".includes("-dev")) return;
4836
+ if ("0.38.5".includes("-dev")) return;
4820
4837
  let on = true;
4821
4838
  fetchLatestVersion().then((v) => {
4822
4839
  if (on && v) setLatest(v);
@@ -4825,8 +4842,8 @@ window.__ModuleLoader__.load({
4825
4842
  on = false;
4826
4843
  };
4827
4844
  }, []);
4828
- const update = latest !== null && isNewerVersion(latest, "0.38.3") ? latest : null;
4829
- const nameText = "dsh-context (v0.38.3)";
4845
+ const update = latest !== null && isNewerVersion(latest, "0.38.5") ? latest : null;
4846
+ const nameText = "dsh-context (v0.38.5)";
4830
4847
  const nameValue = [nameText];
4831
4848
  if (update) nameValue.push(/* @__PURE__ */ React.createElement("span", {
4832
4849
  key: "update",
package/lib/index.js CHANGED
@@ -2,7 +2,6 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { dirname, join, normalize } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { z } from "zod";
5
- import { settingsNamespace } from "@deepseek-ai/dsh-settings";
6
5
  import z$1 from "@deepseek-ai/schemastery";
7
6
  import { deriveEventMessage } from "@deepseek-ai/dsh-session";
8
7
  /**
@@ -91,7 +90,10 @@ const FIRST_PARTY_SOURCES = Object.freeze({
91
90
  * wraps that instance's `register` (once — an earlier wrapper of a previous
92
91
  * hook incarnation is peeled back to the original, so a plugin reload
93
92
  * re-wraps without stacking) to capture the reader at registration time
94
- * into a live map.
93
+ * into a live map. Every wrapper is undone when the plugin unloads: the
94
+ * original `register` goes back on the instance, unless a newer hook
95
+ * incarnation re-wrapped it first (that incarnation's own cleanup then
96
+ * owns the restore).
95
97
  * - When the reader slot is missing, root-named, or this plugin's own (e.g.
96
98
  * LOCAL-LINK plugins — dev installs via `dsh plugin add <path>` or
97
99
  * npm/pnpm link — whose anonymous entrypoints make cordis fall back to the
@@ -187,8 +189,8 @@ function callerPackageFrom(stack) {
187
189
  }
188
190
  /**
189
191
  * Install the runtime-attribution hook on a cordis app context. The hook
190
- * rides the calling fiber's lifetime (`ctx.on` / `ctx.get`), so it is
191
- * disposed with the plugin.
192
+ * rides the calling fiber's lifetime (`ctx.on`, and an effect that restores
193
+ * every patched `register`), so it is disposed with the plugin.
192
194
  * @param ctx - the context the dsh-context plugin runs in; its fiber name is
193
195
  * excluded from attributions.
194
196
  */
@@ -197,6 +199,7 @@ function createToolAttribution(ctx) {
197
199
  const wrapped = /* @__PURE__ */ new WeakSet();
198
200
  const self = ctx.fiber.name;
199
201
  let lastReader;
202
+ const patched = [];
200
203
  const wrapInstance = (tools) => {
201
204
  if (!tools || typeof tools !== "object" || wrapped.has(tools)) return;
202
205
  const register = tools.register;
@@ -224,6 +227,9 @@ function createToolAttribution(ctx) {
224
227
  };
225
228
  wrappedRegister.attributedOriginal = original;
226
229
  instance.register = wrappedRegister;
230
+ patched.push(() => {
231
+ if (instance.register === wrappedRegister) instance.register = original;
232
+ });
227
233
  };
228
234
  ctx.on("internal/get", (reader, name, _error, next) => {
229
235
  if (name !== "tools") return next();
@@ -232,6 +238,9 @@ function createToolAttribution(ctx) {
232
238
  wrapInstance(tools);
233
239
  return tools;
234
240
  });
241
+ ctx.effect(() => () => {
242
+ for (const restore of patched.splice(0)) restore();
243
+ }, "tools.register attribution");
235
244
  const toolsService = ctx.get("tools", false);
236
245
  wrapInstance(toolsService);
237
246
  const boot = /* @__PURE__ */ new Set();
@@ -657,7 +666,7 @@ const SettingsSchema = z$1.object({
657
666
  /** Serve the namespace while a settings provider is composed; inert otherwise. */
658
667
  function installSettings(ctx) {
659
668
  ctx.inject(["settings"], (sctx) => {
660
- sctx.settings.register(settingsNamespace(SETTINGS_NAMESPACE), SettingsSchema);
669
+ sctx.settings.register(SETTINGS_NAMESPACE, SettingsSchema);
661
670
  });
662
671
  }
663
672
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context",
3
- "version": "0.38.3",
3
+ "version": "0.38.5",
4
4
  "description": "A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.",
5
5
  "author": "bowenliang123",
6
6
  "repository": {
@@ -68,14 +68,16 @@
68
68
  "ui"
69
69
  ],
70
70
  "license": "Apache-2.0",
71
+ "dependencies": {
72
+ "zod": "^4.4.3"
73
+ },
71
74
  "peerDependencies": {
72
75
  "@deepseek-ai/cordis": "^4.0.1",
73
76
  "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.0-rc.7",
74
77
  "@deepseek-ai/dsh-session": ">=0.1.0-rc.7",
75
78
  "@deepseek-ai/dsh-settings": ">=0.1.0-rc.7",
76
79
  "@deepseek-ai/schemastery": "^3.18.1",
77
- "react": "^18.3.1",
78
- "zod": "^4.4.3"
80
+ "react": "^18.3.1"
79
81
  },
80
82
  "peerDependenciesMeta": {
81
83
  "@deepseek-ai/dsh-client-ui-primitives": {
@@ -92,6 +94,7 @@
92
94
  "@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
93
95
  "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
94
96
  "@deepseek-ai/schemastery": "^3.18.1",
97
+ "zod": "^4.4.3",
95
98
  "@stylistic/eslint-plugin": "^5.10.0",
96
99
  "@types/node": "^26.2.0",
97
100
  "@types/react": "^18.3.31",