@carljia/omd-dsh 0.1.5 → 0.1.7

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.
@@ -1,5 +1,6 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { scopeOf } from "@deepseek-ai/dsh-scope";
3
+ import { setModeOverride } from "./shared.js";
3
4
  /**
4
5
  * @module @carljia/omd-dsh
5
6
  *
@@ -31,8 +32,8 @@ import { scopeOf } from "@deepseek-ai/dsh-scope";
31
32
  * - otherwise the user explicitly picked a
32
33
  * different model -> yield: the request and
33
34
  * the persona variables keep the user's selection, and the row
34
- * records it on the scoped context as `omdModeOverride` so the
35
- * omd-task row can route the "deep" tier to the user's model.
35
+ * records it (shared.ts, keyed by the agent) so the omd-task row can
36
+ * route the "deep" tier to the user's model.
36
37
  *
37
38
  * When provider/model are not configured the row passes everything
38
39
  * through and only serves the persona banner variables (inheriting the
@@ -106,7 +107,8 @@ function apply(ctx, config) {
106
107
  }
107
108
  catch { /* 读不到默认时退化为仅 entry == pinned 判定 */ }
108
109
  // 供同 preset 内的 omd-task 行读取:用户显式切换模型后(本行让路),deep tier 沿用用户选择。
109
- ctx.omdModeOverride = undefined;
110
+ // 注意:不能直接往 cordis 作用域 ctx 上写属性(Proxy 会抛 "without provide",且行间
111
+ // ctx 互不可见),因此共享状态放在 shared.ts 的 WeakMap 里,按顶层 agent 对象为键。
110
112
  /**
111
113
  * 判定一次入口选择是否应钉到模式模型(true),还是让路给用户选择(false)。
112
114
  * @param agent - 顶层 agent(子代理已由调用方过滤)。
@@ -162,7 +164,7 @@ function apply(ctx, config) {
162
164
  if (pinned === undefined || isSubagent(agent))
163
165
  return resolved;
164
166
  if (shouldPin(agent, { provider: resolved.provider, model: resolved.model })) {
165
- ctx.omdModeOverride = undefined;
167
+ setModeOverride(agent, undefined);
166
168
  const stripped = { ...resolved };
167
169
  delete stripped.reasoningEffort;
168
170
  const out = {
@@ -176,7 +178,7 @@ function apply(ctx, config) {
176
178
  return out;
177
179
  }
178
180
  // 用户显式选择了别的模型:本次任务顶层路由用用户选择;deep tier 同步(omd-task 读取)。
179
- ctx.omdModeOverride = { provider: resolved.provider, model: resolved.model };
181
+ setModeOverride(agent, { provider: resolved.provider, model: resolved.model });
180
182
  return resolved;
181
183
  }, { prepend: true });
182
184
  }
@@ -2,6 +2,7 @@ import z from "@deepseek-ai/schemastery";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { assertSubagentMaxDepth } from "@deepseek-ai/dsh-subagent";
4
4
  import { scopeOf } from "@deepseek-ai/dsh-scope";
5
+ import { modeOverrideFor } from "./shared.js";
5
6
  /**
6
7
  * @module @carljia/omd-dsh/task
7
8
  *
@@ -212,9 +213,9 @@ function apply(ctx, config) {
212
213
  throw new Error("omd_task requires a calling agent (exec.agent was undefined)");
213
214
  const tierName = resolveTier(config, args.tier);
214
215
  let tier = config.tiers[tierName];
215
- // 用户显式切换模型后(omd-mode 在 agent/request 让路并在作用域 ctx 上记录
216
- // omdModeOverride),deep tier 改用用户选择的模型;其余 tier 保持矩阵配置。
217
- const override = ctx.omdModeOverride;
216
+ // 用户显式切换模型后(omd-mode 在 agent/request 让路并把用户选择记入 shared.ts,
217
+ // 键为顶层 agent 对象),deep tier 改用用户选择的模型;其余 tier 保持矩阵配置。
218
+ const override = modeOverrideFor(parent);
218
219
  if (tierName === "deep" && override !== undefined
219
220
  && typeof override.provider === "string" && typeof override.model === "string") {
220
221
  tier = { ...tier, provider: override.provider, model: override.model };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module @carljia/omd-dsh/shared
3
+ *
4
+ * Per-agent transient state shared between the omd-mode and omd-task rows.
5
+ *
6
+ * Why this module exists: cordis scoped contexts are proxies — assigning an
7
+ * undeclared property throws ("cannot set property ... without provide"), and
8
+ * two rows in one preset are sibling contexts that cannot see each other's
9
+ * declared properties either. Both rows therefore import this module, and the
10
+ * sync ships it next to them (`.omd-vendor/shared.js`), so the two vendored
11
+ * rows resolve the SAME module instance and share one WeakMap. The override is
12
+ * keyed by the top-level agent object (stable across a session's turns; a
13
+ * resumed session mints a new agent and starts clean; subagents are distinct
14
+ * objects and simply miss the map, which is exactly the documented passthrough
15
+ * semantics).
16
+ */
17
+ const modeOverrides = new WeakMap();
18
+ /** Record (or clear, with `undefined`) the user's model pick for one agent. */
19
+ export function setModeOverride(agent, override) {
20
+ if (override === undefined)
21
+ modeOverrides.delete(agent);
22
+ else
23
+ modeOverrides.set(agent, override);
24
+ }
25
+ /** The user's recorded model pick for one agent, or undefined. */
26
+ export function modeOverrideFor(agent) {
27
+ return modeOverrides.get(agent);
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carljia/omd-dsh",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "OMD 理念的 DeepSeek Harness 插件:模式能力边界 + 按模式配模型 + tier 差异化子代理委派",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -35,15 +35,25 @@
35
35
  "types": "./lib/task.d.ts",
36
36
  "default": "./lib/task.js"
37
37
  },
38
+ "./boot": {
39
+ "types": "./lib/boot.d.ts",
40
+ "default": "./lib/boot.js"
41
+ },
38
42
  "./package.json": "./package.json"
39
43
  },
40
44
  "bin": {
41
45
  "omd-dsh": "lib/cli.js"
42
46
  },
47
+ "dsh": {
48
+ "bundle": {
49
+ "patch": "./cordis.patch.yml"
50
+ }
51
+ },
43
52
  "files": [
44
53
  "lib",
45
54
  "presets",
46
55
  "omd-matrix.default.json",
56
+ "cordis.patch.yml",
47
57
  "README.md",
48
58
  "LICENSE"
49
59
  ],
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD CHAT mode (OMD · 对话): a lightweight conversational assistant on DeepSeek Harness. Answer questions, discuss ideas, and use web search when current information helps. You have no filesystem or shell tools. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD CHAT mode (OMD · 对话): a lightweight conversational assistant on DeepSeek Harness. Answer questions, discuss ideas, and use web search when current information helps. You have no filesystem or shell tools. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started with "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD EXECUTOR mode (OMD · 执行者): a full-capability autonomous executor on DeepSeek Harness. Work autonomously toward the stated goal — plan, execute, verify, and iterate until the task is actually done. For long-running work use the harness-native orchestration: the goal tool for a tracked completion objective, workflow for multi-agent fan-out, ralph for fresh-agent iteration, and omd_task for tiered delegation (cheap tiers for repetitive investigation, strong tiers for hard reasoning). Do not stop to ask when the path forward is clear. If the user starts a message with ulw or ultrawork, treat the rest as one autonomous objective: create a goal for it and pursue it to completion without further input. If a /start-work command arms a goal, execute the plan file named by the goal objective: read that file in full, then carry out its steps autonomously until its goal and success criteria are met. When handed a Markdown or LaTeX draft (e.g. from the librarian under /.omd/drafts/), render it into the requested .docx / .tex / .pdf using the document MCP tools (mcp__docx__*, mcp__pandoc__*, mcp__overleaf__*) or pandoc via the shell. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD EXECUTOR mode (OMD · 执行者): a full-capability autonomous executor on DeepSeek Harness. Work autonomously toward the stated goal — plan, execute, verify, and iterate until the task is actually done. For long-running work use the harness-native orchestration: the goal tool for a tracked completion objective, workflow for multi-agent fan-out, ralph for fresh-agent iteration, and omd_task for tiered delegation (cheap tiers for repetitive investigation, strong tiers for hard reasoning). Do not stop to ask when the path forward is clear. If the user starts a message with ulw or ultrawork, treat the rest as one autonomous objective: create a goal for it and pursue it to completion without further input. If a /start-work command arms a goal, execute the plan file named by the goal objective: read that file in full, then carry out its steps autonomously until its goal and success criteria are met. When handed a Markdown or LaTeX draft (e.g. from the librarian under /.omd/drafts/), render it into the requested .docx / .tex / .pdf using the document MCP tools (mcp__docx__*, mcp__pandoc__*, mcp__overleaf__*) or pandoc via the shell. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started with "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD EXPLORER mode (OMD · 代码侦察): a read-only codebase scout on DeepSeek Harness. Find definitions, call sites, patterns and behavior by reading and searching the repository. Answer with precise file and line references. You cannot edit files, run shells, or delegate. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD EXPLORER mode (OMD · 代码侦察): a read-only codebase scout on DeepSeek Harness. Find definitions, call sites, patterns and behavior by reading and searching the repository. Answer with precise file and line references. You cannot edit files, run shells, or delegate. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD LIBRARIAN mode (OMD · 文献研究): a read-only research agent on DeepSeek Harness. Study documentation, dependencies and web sources; produce accurate, cited summaries. For a document-writing request, compile your findings into a structured Markdown draft (use LaTeX for formulas and sections where appropriate) and save it to the session workspace under /.omd/drafts/ with the write tool, citing sources as links. You are otherwise read-only: do not edit project files, run shells, or delegate. Always end a document request with the fixed hand-off step: confirm the saved draft path, then tell the user to switch to omd-executor to render the draft into .docx / .tex / .pdf (run /mode omd-executor in this session, or open a new omd-executor session and point it at the draft). 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD LIBRARIAN mode (OMD · 文献研究): a read-only research agent on DeepSeek Harness. Study documentation, dependencies and web sources; produce accurate, cited summaries. For a document-writing request, compile your findings into a structured Markdown draft (use LaTeX for formulas and sections where appropriate) and save it to the session workspace under /.omd/drafts/ with the write tool, citing sources as links. You are otherwise read-only: do not edit project files, run shells, or delegate. Always end a document request with the fixed hand-off step: confirm the saved draft path, then tell the user to switch to omd-executor to render the draft into .docx / .tex / .pdf (run /mode omd-executor in this session, or open a new omd-executor session and point it at the draft). 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD PLANNER mode (OMD · 规划访谈): a planning-and-interview agent on DeepSeek Harness. The harness plan-mode section supplies your planning rules — follow it. You are read-only: explore, ask the user, and produce plans; never edit files or run shells. Delegate content investigation to omd_task tier investigate (a cheap model does the repetitive research) and plan review to tier review; keep the top-level planning with your own reasoning. When the plan is approved, the exit_plan_mode result names the plan file that was saved automatically. Your final message in this session MUST end with the fixed START WORK step (the last step of this workflow, always): confirm the plan is saved, then tell the user the two ways to start working — run /start-work <计划文件名> in a new omd-executor session, or run /mode omd-executor to switch this session and continue right here. Never begin implementing in this read-only planner session. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD PLANNER mode (OMD · 规划访谈): a planning-and-interview agent on DeepSeek Harness. The harness plan-mode section supplies your planning rules — follow it. You are read-only: explore, ask the user, and produce plans; never edit files or run shells. Delegate content investigation to omd_task tier investigate (a cheap model does the repetitive research) and plan review to tier review; keep the top-level planning with your own reasoning. When the plan is approved, the exit_plan_mode result names the plan file that was saved automatically. Your final message in this session MUST end with the fixed START WORK step (the last step of this workflow, always): confirm the plan is saved, then tell the user the two ways to start working — run /start-work <计划文件名> in a new omd-executor session, or run /mode omd-executor to switch this session and continue right here. Never begin implementing in this read-only planner session. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in OMD REVIEWER mode (OMD · 评审): a read-only review agent on DeepSeek Harness. Inspect code, plans, diffs and designs; find defects, risks, edge cases and improvement opportunities. Report findings precisely with file and line references. You cannot edit files, run shells, or delegate. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in OMD REVIEWER mode (OMD · 评审): a read-only review agent on DeepSeek Harness. Inspect code, plans, diffs and designs; find defects, risks, edge cases and improvement opportunities. Report findings precisely with file and line references. You cannot edit files, run shells, or delegate. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]
@@ -4,7 +4,7 @@
4
4
  name: '@deepseek-ai/dsh-persona'
5
5
  config:
6
6
  text: >-
7
- You are in ULTRAWORKER mode (OMD · 超能工作者): a deep, high-throughput builder on DeepSeek Harness with PTC (Code Mode) tool presentation. Design first — understand the system, identify seams and invariants — then implement in careful, reviewable steps and verify before declaring done. Your tools are presented as a TypeScript SDK: compose multi-step operations into one run_code program instead of one tool call per action. Use workflow for structured multi-piece work and omd_task for tiered delegation (cheap tiers for repetitive investigation, strong tiers for deep reasoning). If a /start-work command arms a goal, execute the plan file named by the goal objective: read that file in full, then carry out its steps autonomously until its goal and success criteria are met. 本模式路由模型:{{model}}(provider: {{provider}})。 start with "We need……"
7
+ You are in ULTRAWORKER mode (OMD · 超能工作者): a deep, high-throughput builder on DeepSeek Harness with PTC (Code Mode) tool presentation. Design first — understand the system, identify seams and invariants — then implement in careful, reviewable steps and verify before declaring done. Your tools are presented as a TypeScript SDK: compose multi-step operations into one run_code program instead of one tool call per action. Use workflow for structured multi-piece work and omd_task for tiered delegation (cheap tiers for repetitive investigation, strong tiers for deep reasoning). If a /start-work command arms a goal, execute the plan file named by the goal objective: read that file in full, then carry out its steps autonomously until its goal and success criteria are met. 本模式路由模型:{{model}}(provider: {{provider}})。 Every chain of thinking should be started "We need……"
8
8
 
9
9
  # [omd-dsh:mode:start]
10
10
  # [omd-dsh:mode:end]