dsh-harbor-evolution 0.7.1 → 0.7.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/README.md CHANGED
@@ -14,10 +14,10 @@ npx --yes dsh-harbor-evolution@latest setup --project-root "$PWD"
14
14
 
15
15
  The setup command installs both required runtimes:
16
16
 
17
- - `harbor-dsh-evolution==0.7.1` in a managed Python environment.
18
- - `dsh-harbor-evolution@0.7.1` in the selected DSH profile.
17
+ - `harbor-dsh-evolution==0.7.2` in a managed Python environment.
18
+ - `dsh-harbor-evolution@0.7.2` in the selected DSH profile.
19
19
 
20
- It then stores the absolute Harbor executable paths and `projectRoot` in the profile's `harbor-evolution` block and verifies the integration. Existing unrelated profile entries are preserved, and rerunning setup updates the same block.
20
+ It then stores the absolute Harbor executable paths and a fallback `projectRoot` in the profile's `harbor-evolution` block and verifies the integration. Agent Tool calls always use the calling session's absolute working directory as their project root; the configured value remains the Web Workbench and non-Agent fallback. Existing unrelated profile entries are preserved, and rerunning setup updates the same block.
21
21
 
22
22
  The default profile is `web`. Use `--profile headless` only when that is the profile you actually run. See all options with:
23
23
 
@@ -79,7 +79,7 @@ The selected profile receives one id-targeted override:
79
79
  pythonPath: ""
80
80
  ```
81
81
 
82
- Keep `pythonPath` empty for the published Python package. `candidatePath`, `datasetPath`, `jobPath`, and `policyPath` are constrained to `projectRoot`.
82
+ Keep `pythonPath` empty for the published Python package. For Agent Tool calls, `projectRoot` is replaced by the calling session's working directory for that call. `candidatePath`, `datasetPath`, `jobPath`, and `policyPath` remain constrained to that request-local root, so concurrent sessions cannot redirect each other's Harbor operations.
83
83
 
84
84
  For source development from the repository:
85
85
 
package/index.js CHANGED
@@ -47,12 +47,20 @@ function jsonTool(definition, execute) {
47
47
  schema: { type: 'string' },
48
48
  render: (_args, value) => [{ type: 'text', text: value }],
49
49
  },
50
- async execute(args) {
51
- return JSON.stringify(await execute(args), null, 2)
50
+ async execute(args, exec) {
51
+ return JSON.stringify(await execute(args, exec), null, 2)
52
52
  },
53
53
  })
54
54
  }
55
55
 
56
+ function toolProjectRoot(exec) {
57
+ const cwd = exec?.agent?.session?.header?.cwd
58
+ if (typeof cwd !== 'string' || !path.isAbsolute(cwd)) {
59
+ throw new Error('Harbor tools require an Agent session with an absolute working directory')
60
+ }
61
+ return path.resolve(cwd)
62
+ }
63
+
56
64
  export function apply(ctx, config) {
57
65
  const resolved = {
58
66
  ...config,
@@ -66,7 +74,12 @@ export function apply(ctx, config) {
66
74
  ),
67
75
  }
68
76
  const modelRuntime = new CandidateModelRuntime(ctx, resolved)
69
- const service = new EvolutionService(resolved, { pluginVersion: packageJson.version }, modelRuntime)
77
+ const metadata = { pluginVersion: packageJson.version }
78
+ const service = new EvolutionService(resolved, metadata, modelRuntime)
79
+ const serviceForTool = exec => new EvolutionService({
80
+ ...resolved,
81
+ projectRoot: toolProjectRoot(exec),
82
+ }, metadata, modelRuntime)
70
83
 
71
84
  ctx.skills.register(loadBundledSkill())
72
85
  installDashboardWeb(ctx, service)
@@ -79,7 +92,7 @@ export function apply(ctx, config) {
79
92
  candidateId: { type: 'string' },
80
93
  version: { type: 'string' },
81
94
  },
82
- }, args => service.snapshot(args)))
95
+ }, (args, exec) => serviceForTool(exec).snapshot(args)))
83
96
 
84
97
  ctx.tools.register(jsonTool({
85
98
  name: 'harbor_evolution_init',
@@ -101,7 +114,7 @@ export function apply(ctx, config) {
101
114
  policyVersion: { type: 'string', required: true },
102
115
  minImprovement: { type: 'number', required: true },
103
116
  },
104
- }, args => service.initialize(args)))
117
+ }, (args, exec) => serviceForTool(exec).initialize(args)))
105
118
 
106
119
  ctx.tools.register(jsonTool({
107
120
  name: 'harbor_evolution_doctor',
@@ -116,7 +129,7 @@ export function apply(ctx, config) {
116
129
  candidateModel: { type: 'string' },
117
130
  candidateReasoningEffort: { type: 'string' },
118
131
  },
119
- }, args => service.doctor(args)))
132
+ }, (args, exec) => serviceForTool(exec).doctor(args)))
120
133
 
121
134
  ctx.tools.register(jsonTool({
122
135
  name: 'harbor_dataset_validate',
@@ -124,7 +137,7 @@ export function apply(ctx, config) {
124
137
  parameters: {
125
138
  datasetPath: { type: 'string', required: true },
126
139
  },
127
- }, args => service.validateDataset(args)))
140
+ }, (args, exec) => serviceForTool(exec).validateDataset(args)))
128
141
 
129
142
  ctx.tools.register(jsonTool({
130
143
  name: 'harbor_context_preview',
@@ -140,7 +153,7 @@ export function apply(ctx, config) {
140
153
  candidateModel: { type: 'string' },
141
154
  candidateReasoningEffort: { type: 'string' },
142
155
  },
143
- }, args => service.previewContext(args)))
156
+ }, (args, exec) => serviceForTool(exec).previewContext(args)))
144
157
 
145
158
  ctx.tools.register(jsonTool({
146
159
  name: 'harbor_eval_run',
@@ -158,7 +171,7 @@ export function apply(ctx, config) {
158
171
  candidateModel: { type: 'string' },
159
172
  candidateReasoningEffort: { type: 'string' },
160
173
  },
161
- }, args => service.run(args)))
174
+ }, (args, exec) => serviceForTool(exec).run(args)))
162
175
 
163
176
  ctx.tools.register(jsonTool({
164
177
  name: 'harbor_eval_result',
@@ -170,7 +183,7 @@ export function apply(ctx, config) {
170
183
  compareJob: { type: 'string', description: 'Optional previous Job for view=governance impact analysis' },
171
184
  since: { type: 'string', description: 'Optional ISO timestamp for incremental progress changes' },
172
185
  },
173
- }, args => service.result(args)))
186
+ }, (args, exec) => serviceForTool(exec).result(args)))
174
187
 
175
188
  ctx.tools.register(jsonTool({
176
189
  name: 'harbor_evaluator_inspect',
@@ -178,7 +191,7 @@ export function apply(ctx, config) {
178
191
  parameters: {
179
192
  stackPath: { type: 'string', description: 'Defaults to .harbor/evaluation-stack.yml' },
180
193
  },
181
- }, args => service.evaluatorInspect(args)))
194
+ }, (args, exec) => serviceForTool(exec).evaluatorInspect(args)))
182
195
 
183
196
  ctx.tools.register(jsonTool({
184
197
  name: 'harbor_evaluator_update',
@@ -191,7 +204,7 @@ export function apply(ctx, config) {
191
204
  newEvaluatorVersion: { type: 'string', required: true },
192
205
  newStackVersion: { type: 'string', required: true },
193
206
  },
194
- }, args => service.evaluator(args)))
207
+ }, (args, exec) => serviceForTool(exec).evaluator(args)))
195
208
 
196
209
  ctx.tools.register(jsonTool({
197
210
  name: 'harbor_ground_truth_init',
@@ -205,7 +218,7 @@ export function apply(ctx, config) {
205
218
  provenance: { type: 'string', required: true },
206
219
  criteria: { type: 'string', required: true, description: 'Comma-separated criterion ids' },
207
220
  },
208
- }, args => service.groundTruthInitialize(args)))
221
+ }, (args, exec) => serviceForTool(exec).groundTruthInitialize(args)))
209
222
 
210
223
  ctx.tools.register(jsonTool({
211
224
  name: 'harbor_evaluator_meta_evaluate',
@@ -215,7 +228,7 @@ export function apply(ctx, config) {
215
228
  observationsPath: { type: 'string', required: true },
216
229
  outputPath: { type: 'string', description: 'Defaults to .harbor/meta-evaluation-report.json' },
217
230
  },
218
- }, args => service.evaluatorMetaEvaluate(args)))
231
+ }, (args, exec) => serviceForTool(exec).evaluatorMetaEvaluate(args)))
219
232
 
220
233
  ctx.tools.register(jsonTool({
221
234
  name: 'harbor_candidate_compare',
@@ -225,5 +238,5 @@ export function apply(ctx, config) {
225
238
  candidateJob: { type: 'string', required: true },
226
239
  policyPath: { type: 'string', required: true },
227
240
  },
228
- }, args => service.compare(args)))
241
+ }, (args, exec) => serviceForTool(exec).compare(args)))
229
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-harbor-evolution",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "DeepSeek Harness plugin and bundled Skill for safely evolving Cordis Candidates with Harbor.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,7 +33,7 @@ Do not turn an inspection or diagnostic request into Agent mutation or deploymen
33
33
 
34
34
  Inspect the current workspace before asking questions. Look for Agent entry files, package metadata, curl examples, Dataset instructions, existing Harbor configuration/Jobs, tests, and available Codex or Claude Code commands. Reuse reliable findings and say what was inferred; do not ask the user to transcribe information already present in files.
35
35
 
36
- When no Harbor workspace exists, propose `./harbor-evolution/` under the current working directory as the managed evaluation workspace. Keep imported snapshots and generated evaluation files there. If the installed Plugin is configured to a different `projectRoot`, explain the mismatch and propose the exact configuration change before writing anything.
36
+ When no Harbor workspace exists, propose `./harbor-evolution/` under the current session working directory as the managed evaluation workspace. Agent-facing Harbor Tools derive `projectRoot` from the calling session for every invocation and keep imported snapshots and generated evaluation files inside that request-local root. Treat the Plugin's configured `projectRoot` only as the Web Workbench and non-Agent fallback; do not block initialization merely because it differs from the current session working directory.
37
37
 
38
38
  Ask only for missing parts of the four-concept intake, using the user's language and short examples:
39
39
 
@@ -33,6 +33,17 @@
33
33
  "The response maps the supplied paths and curl into the four-concept confirmation card.",
34
34
  "The response does not run initialization or evaluation before confirmation."
35
35
  ]
36
+ },
37
+ {
38
+ "id": 4,
39
+ "prompt": "当前 Session 工作目录是 /Users/mac/Documents/Harness,但 Harbor Plugin 配置里显示的 projectRoot 是 /Users/mac/Library/Application Support/XiaoHui Harness/workspace。请在当前项目下初始化 ./harbor-evolution。",
40
+ "expected_output": "把当前 Session 工作目录作为 Agent Tool 的项目根目录,继续准备 /Users/mac/Documents/Harness/harbor-evolution 的初始化确认卡;说明配置值只供 Web Workbench 或非 Agent 场景回退使用,不要求修改配置,也不因路径不同而拒绝初始化。",
41
+ "files": [],
42
+ "assertions": [
43
+ "The response treats the calling session working directory as the Agent Tool project root.",
44
+ "The response does not block initialization or require a projectRoot configuration change because the fallback differs.",
45
+ "The proposed managed workspace stays under /Users/mac/Documents/Harness."
46
+ ]
36
47
  }
37
48
  ]
38
49
  }
@@ -13,7 +13,7 @@ Keep onboarding anchored on four visible concepts:
13
13
  | 评测器(评测标准) (Evaluator) | 怎样算好? | evaluator curl/path, or natural-language criteria | Evaluator, Rubric, Judge identity, Evaluation Contract |
14
14
  | 优化器 (Optimizer) | 谁根据结果改进? | current Agent, Codex, Claude Code, or local command | Optimizer identity, mutation surface, rollback workflow |
15
15
 
16
- Inspect first and prefill everything reliable. Ask only about missing rows. Use `./harbor-evolution/` as the proposed managed workspace when no project exists, but do not write outside the Plugin's configured `projectRoot`; surface a configuration mismatch before initialization.
16
+ Inspect first and prefill everything reliable. Ask only about missing rows. Use `./harbor-evolution/` as the proposed managed workspace when no project exists. Agent-facing Harbor Tools resolve every path inside the calling session's working directory, so a different configured `projectRoot` is only a Web Workbench or non-Agent fallback and must not block initialization.
17
17
 
18
18
  Before any write, show the four rows plus inferred workspace, diagnostic/promotion scope, and deferred capabilities. The user may start initialization, modify the card, or open advanced configuration.
19
19