@klarkxy/dsh-session-manager 0.2.1 → 0.3.1

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/index.js CHANGED
@@ -7,6 +7,7 @@ import { deriveEventMessage, foldSurface, isAppendSurfaceEvent } from "@deepseek
7
7
  import { BlockAssembler, ReasoningEffortId, createUserMessage } from "@deepseek-ai/dsh-llm";
8
8
  import { lstat, mkdir, realpath } from "node:fs/promises";
9
9
  import { join } from "node:path";
10
+ import { createModelSettingsChanges } from "@klarkxy/dsh-plugin-kit/model-settings-changes";
10
11
  import { defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
11
12
  import { z } from "zod";
12
13
  //#region src/contracts.ts
@@ -914,6 +915,18 @@ function isSubagentSession(session) {
914
915
  const humanFork = header.isSeeded === true && (header.delegationDepth === void 0 || header.delegationDepth === 0) && header.origin === void 0 && (header.classification === void 0 || header.classification === "ordinary" || header.classification === "free");
915
916
  return Boolean(header.parentSession) && !humanFork;
916
917
  }
918
+ /** `@klarkxy/dsh-git-commit` becomes `KlarkxyDshGitCommitModelSettingsChanges`. */
919
+ function modelSettingsChangesIdentity(packageName) {
920
+ const scoped = /^@([^/]+)\/(.+)$/.exec(packageName);
921
+ const parts = (scoped ? `${scoped[1]}/${scoped[2]}` : packageName).split(/[^A-Za-z0-9]+/).filter(Boolean);
922
+ if (!parts.length) throw new Error("Model settings package name has no RPC segment");
923
+ const segment = `${parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}ModelSettingsChanges`;
924
+ if (!/^[A-Z][A-Za-z0-9]*$/.test(segment)) throw new Error(`Model settings sync name is not an RPC segment: ${segment}`);
925
+ return {
926
+ service: segment,
927
+ namespace: segment
928
+ };
929
+ }
917
930
  //#endregion
918
931
  //#region ../dsh-plugin-kit/src/llm-call.ts
919
932
  function routeOf(value) {
@@ -973,10 +986,7 @@ async function readStream(stream, signal, live) {
973
986
  assembler.push(item.value);
974
987
  }
975
988
  } finally {
976
- try {
977
- const closing = iterator.return?.();
978
- if (closing) closing.catch(() => {});
979
- } catch {}
989
+ await iterator.return?.();
980
990
  }
981
991
  return assembler;
982
992
  }
@@ -991,7 +1001,7 @@ async function callLlmText(llm, request) {
991
1001
  model: request.route.model,
992
1002
  ...effort ? { reasoningEffort: ReasoningEffortId(effort) } : {},
993
1003
  maxTokens: request.maxTokens
994
- }, request.signal);
1004
+ }, request.signal, request.configure);
995
1005
  if (!live()) throw Object.assign(/* @__PURE__ */ new Error("调用已取消。"), { name: "AbortError" });
996
1006
  const options = {
997
1007
  provider: prepared.config.provider,
@@ -2961,6 +2971,7 @@ const Config = Schema.object({
2961
2971
  }
2962
2972
  });
2963
2973
  function apply(ctx, config = {}) {
2974
+ createModelSettingsChanges(ctx, modelSettingsChangesIdentity(PLUGIN_NAME), PLUGIN_NAME);
2964
2975
  const resolved = resolveConfig(config);
2965
2976
  const cursors = createCursorKey();
2966
2977
  ctx.effect(() => registerSessionTools(ctx, resolved, cursors));