dsh-trellis 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -44,12 +44,12 @@ dsh plugin --profile headless add file:C:/path/to/dsh-trellis
44
44
 
45
45
  `file:` 插件会作为 profile 内的 pnpm 快照安装;拉取源码更新后,尤其是版本新增文件时,需要先 remove 再 add 刷新该 profile。
46
46
 
47
- 配套要求:项目的 Trellis 平台需包含 dsh(`trellis init --dsh`,见 Trellis-DeepSeekHarness 适配分支),且 `.trellis/scripts` 需包含读取原生 `DSH_SESSION_ID` 的适配(已含在同一分支)。插件以 DSH `0.1.0-rc.8` 作为开发/测试基线;Host 功能的 peer dependency 下限仍是 `rc.6`,用于兼容已安装的旧 profile,Web 配置卡片则只在具备 settings/client surface 的 rc.8 profile 中加载。
47
+ 配套要求:项目的 Trellis 平台需包含 dsh(`trellis init --dsh`,见 Trellis-DeepSeekHarness 适配分支),且 `.trellis/scripts` 需包含读取原生 `DSH_SESSION_ID` 的适配(已含在同一分支)。v0.1.3 的 Host peer 范围显式覆盖 DSH `0.1.0-rc.6+`、`0.1.1-rc.1+` 与 `0.1.2-alpha.1+` 三条已知预发布线,避免 npm 的 prerelease 语义把新版 Host 误判为不兼容;Host 侧 Settings 桥同时兼容 rc.8 的包级 helper 与 alpha.2/alpha.3 的 provider 方法。本仓开发依赖仍固定在 `0.1.0-rc.8`,Web 配置卡片只在具备 settings/client surface 的 profile 中加载。
48
48
 
49
49
  ### DSH rc.8 对齐说明
50
50
 
51
51
  - 已采用:command lifecycle 的 `recordInput`、command attachment envelope 的 fail-closed 输入检查、`subagent/end` 的 run/provider/final-output 元数据、rc.8 的 report-before-settlement 与 idle-parent 原生唤醒语义。
52
- - 已接入:Host `dsh-trellis` settings namespace 与 `dsh.client` 浏览器卡片。保存值写入 DSH 的 `settings.yaml` 用户层,并实时重挂插件 runtime;rc.6 不具备该服务时自动退回原有 loader 配置,不影响 Host 插件加载。
52
+ - 已接入:Host `dsh-trellis` settings namespace 与 `dsh.client` 浏览器卡片。保存值写入 DSH 的 `settings.yaml` 用户层,并实时重挂插件 runtime;settings provider 单独重载时退回 loader 配置,插件自身卸载时则不会错误重挂 runtime。没有 settings 服务的 profile 继续使用原有 loader 配置。DSH 0.1.2 alpha 已将可选 Settings 生命周期迁到 `settings.installSection()`;插件会在运行时选择对应 API,不再静态导入已移除的 helper。
53
53
  - 保持可选:`trellis_wait` 仍是“父会话还在当前轮里、需要明确同步点”时的工具;已经 yield 的父会话直接由 DSH 原生 settlement notice 唤醒。
54
54
  - 暂不接入:Agent Teams 在 rc.8 仍位于 `packages/experimental` 且不随正式 npm family 发布。Trellis 不应为此引入私有依赖;等它进入公开稳定面后再评估共享 task board / mailbox 映射。
55
55
 
package/lib/config.js CHANGED
@@ -6,7 +6,7 @@
6
6
  import z from "@deepseek-ai/schemastery";
7
7
 
8
8
  export const Config = z.object({
9
- /** Runtime master switch; the rc.8 settings namespace remains available for re-enabling. */
9
+ /** Runtime master switch; the settings namespace remains available for re-enabling. */
10
10
  enabled: z
11
11
  .boolean()
12
12
  .default(true)
package/lib/index.js CHANGED
@@ -19,15 +19,17 @@
19
19
  *
20
20
  * @module dsh-trellis
21
21
  */
22
- import { isDeepStrictEqual } from "node:util";
23
- import { Config, resolveConfig } from "./config.js";
24
- import { createBreadcrumbComposer, isBreadcrumbMessage } from "./breadcrumb.js";
25
- import { registerCommands } from "./commands.js";
26
- import { registerSessionEnv } from "./session-env.js";
27
- import { registerWaitTool } from "./wait-tool.js";
28
-
29
- export const name = "dsh-trellis";
30
- export const SETTINGS_NAMESPACE = "dsh-trellis";
22
+ import { isDeepStrictEqual } from "node:util";
23
+ import * as settingsModule from "@deepseek-ai/dsh-settings";
24
+ import { Config, resolveConfig } from "./config.js";
25
+ import { createBreadcrumbComposer, isBreadcrumbMessage } from "./breadcrumb.js";
26
+ import { registerCommands } from "./commands.js";
27
+ import { registerSessionEnv } from "./session-env.js";
28
+ import { installSettingsSectionCompat } from "./settings-compat.js";
29
+ import { registerWaitTool } from "./wait-tool.js";
30
+
31
+ export const name = "dsh-trellis";
32
+ export const SETTINGS_NAMESPACE = "dsh-trellis";
31
33
 
32
34
  /** @type {string[]} */
33
35
  export const inject = ["commands", "shellEnv", "subagents", "tools"];
@@ -46,9 +48,10 @@ function sameBreadcrumbPayload(left, right) {
46
48
  }
47
49
 
48
50
  /** @param {import("@deepseek-ai/cordis").Context} ctx */
49
- export function apply(ctx, config = {}) {
50
- let stopped = false;
51
- let disposeRuntime = () => {};
51
+ export function apply(ctx, config = {}) {
52
+ let stopped = false;
53
+ let disposeRuntime = () => {};
54
+ let currentConfig = () => config;
52
55
 
53
56
  const mountRuntime = (nextConfig) => {
54
57
  if (stopped) return;
@@ -74,37 +77,55 @@ export function apply(ctx, config = {}) {
74
77
  disposeRuntime = () => stopAll(disposers);
75
78
  };
76
79
 
77
- // Keep the composition entry working when no settings provider is mounted.
78
- // Once rc.8's settings service appears, its resolved section becomes the
79
- // live source and a saved Web card edit remounts only this plugin's runtime.
80
- ctx.effect(() => {
81
- mountRuntime(config);
82
- return () => {
83
- stopped = true;
84
- disposeRuntime();
80
+ // Keep the composition entry working when no settings provider is mounted.
81
+ // Once the service appears, its resolved section becomes the live source and
82
+ // a saved Web card edit remounts only this plugin's runtime.
83
+ ctx.effect(() => {
84
+ mountRuntime(currentConfig());
85
+ return () => {
86
+ stopped = true;
87
+ disposeRuntime();
85
88
  };
86
89
  }, "dsh-trellis.runtime");
87
90
 
88
- // Optional by design: rc.6 profiles have no settings service and retain the
89
- // loader-config behavior, while rc.8 Web profiles expose this namespace.
90
- ctx.inject(["settings"], (settingsCtx) => {
91
- const scope = settingsCtx.settings.register(
92
- SETTINGS_NAMESPACE,
93
- Config,
94
- { base: config, applies: "live" },
95
- );
96
- const adopt = () => mountRuntime(scope.get());
97
- adopt();
98
- const unwatch = scope.watch(adopt);
99
- settingsCtx.effect(
100
- () => () => {
101
- unwatch();
102
- mountRuntime(config);
103
- },
104
- "dsh-trellis.settings",
105
- );
106
- });
107
- }
91
+ // Optional by design: profiles without a settings service retain the
92
+ // loader-config behavior. The canonical bridge also distinguishes a settings
93
+ // provider reload (fall back to config) from this plugin's own teardown
94
+ // (leave the runtime alone until its owning effect disposes it).
95
+ installSettingsSectionCompat(
96
+ ctx,
97
+ settingsModule,
98
+ SETTINGS_NAMESPACE,
99
+ Config,
100
+ config,
101
+ {
102
+ setSource(source) {
103
+ currentConfig = source;
104
+ },
105
+ onChange() {
106
+ mountRuntime(currentConfig());
107
+ },
108
+ },
109
+ );
110
+ }
111
+
112
+ /**
113
+ * Insert a breadcrumb without discarding decision metadata added by DSH or
114
+ * another pre-step participant (for example `startsRequestSeries`).
115
+ *
116
+ * @param {{ messages: unknown[], [key: string]: unknown }} decision
117
+ * @param {unknown[]} claimedMessages
118
+ * @param {unknown} desired
119
+ */
120
+ export function insertBreadcrumbDecision(decision, claimedMessages, desired) {
121
+ const lastClaimedIndex = decision.messages.findLastIndex((message) =>
122
+ claimedMessages.includes(message),
123
+ );
124
+ return {
125
+ ...decision,
126
+ messages: decision.messages.toSpliced(lastClaimedIndex + 1, 0, desired),
127
+ };
128
+ }
108
129
 
109
130
  function registerBreadcrumb(ctx, resolved) {
110
131
  const { compose } = createBreadcrumbComposer(resolved, ctx);
@@ -175,12 +196,6 @@ function registerBreadcrumb(ctx, resolved) {
175
196
  ) {
176
197
  return decision;
177
198
  }
178
- const lastClaimedIndex = decision.messages.findLastIndex((message) =>
179
- messages.includes(message),
180
- );
181
- return {
182
- kind: "enter",
183
- messages: decision.messages.toSpliced(lastClaimedIndex + 1, 0, desired),
184
- };
185
- });
186
- }
199
+ return insertBreadcrumbDecision(decision, messages, desired);
200
+ });
201
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Install an optional settings section across the two published DSH APIs.
3
+ *
4
+ * DSH through 0.1.1 exposes `installSettingsSection` as a package helper.
5
+ * The 0.1.2 alpha line moved the same lifecycle onto
6
+ * `SettingsProvider.installSection` and removed the helper export. A namespace
7
+ * import keeps this module loadable on both lines while the provider remains
8
+ * optional for profiles that do not mount settings.
9
+ *
10
+ * @param {import("@deepseek-ai/cordis").Context} ctx
11
+ * @param {{ installSettingsSection?: Function }} settingsModule
12
+ * @param {string} namespace
13
+ * @param {unknown} schema
14
+ * @param {unknown} entry
15
+ * @param {{ setSource: Function, onChange: Function, validate?: Function }} hooks
16
+ */
17
+ export function installSettingsSectionCompat(
18
+ ctx,
19
+ settingsModule,
20
+ namespace,
21
+ schema,
22
+ entry,
23
+ hooks,
24
+ ) {
25
+ if (typeof settingsModule.installSettingsSection === "function") {
26
+ settingsModule.installSettingsSection(
27
+ ctx,
28
+ namespace,
29
+ schema,
30
+ entry,
31
+ hooks,
32
+ );
33
+ return;
34
+ }
35
+
36
+ ctx.inject(["settings"], (settingsCtx) => {
37
+ if (typeof settingsCtx.settings?.installSection !== "function") {
38
+ throw new TypeError(
39
+ "The mounted DSH settings service does not expose installSection().",
40
+ );
41
+ }
42
+ settingsCtx.settings.installSection(
43
+ ctx,
44
+ namespace,
45
+ schema,
46
+ entry,
47
+ hooks,
48
+ );
49
+ });
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-trellis",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Trellis workflow integration for DeepSeek Harness: per-turn workflow-state breadcrumbs, utility commands, and native session identity.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -54,14 +54,15 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@deepseek-ai/cordis": "^4.0.1",
57
- "@deepseek-ai/dsh-commands": "^0.1.0-rc.6",
58
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8",
59
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.8",
60
- "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.0-rc.8",
61
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
62
- "@deepseek-ai/dsh-shell-env": "^0.1.0-rc.6",
63
- "@deepseek-ai/dsh-subagent": "^0.1.0-rc.6",
64
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
57
+ "@deepseek-ai/dsh-commands": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
58
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.8 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
59
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.8 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
60
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.0-rc.8 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
61
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
62
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
63
+ "@deepseek-ai/dsh-shell-env": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
64
+ "@deepseek-ai/dsh-subagent": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
65
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
65
66
  "@deepseek-ai/schemastery": "^3.18.1",
66
67
  "react": "^18.2.0"
67
68
  },
@@ -81,9 +82,12 @@
81
82
  "@deepseek-ai/dsh-client-ui-settings-plugins": {
82
83
  "optional": true
83
84
  },
84
- "@deepseek-ai/dsh-llm": {
85
- "optional": true
86
- },
85
+ "@deepseek-ai/dsh-llm": {
86
+ "optional": true
87
+ },
88
+ "@deepseek-ai/dsh-settings": {
89
+ "optional": true
90
+ },
87
91
  "@deepseek-ai/dsh-shell-env": {
88
92
  "optional": true
89
93
  },
@@ -103,7 +107,8 @@
103
107
  "devDependencies": {
104
108
  "@deepseek-ai/cordis": "^4.0.1",
105
109
  "@deepseek-ai/dsh-commands": "0.1.0-rc.8",
106
- "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
110
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
111
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
107
112
  "@deepseek-ai/dsh-shell-env": "0.1.0-rc.8",
108
113
  "@deepseek-ai/dsh-subagent": "0.1.0-rc.8",
109
114
  "@deepseek-ai/dsh-tools": "0.1.0-rc.8",