@sshirkit/dsh-orchestrator 0.9.1 → 1.0.0

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.
@@ -24,11 +24,9 @@
24
24
  * Kinds of claim:
25
25
  * - `file` — one exact path, whether it exists yet or the worker is about to create it;
26
26
  * - `dir` — a directory prefix, spelled `src/` or `src/**`;
27
- * - `root` — "I claim everything", spelled `*` or reached by a filesystem root such as
28
- * `/` or `C:/`. A root claim intersects every other scope, including paths outside the
29
- * workspace: that is the conservative reading of an unknown writer that
30
- * `docs/zh/03-issue-0001-write-scope.md` §6.1 asks for, and it is why `*` is the
31
- * discouraged escape hatch rather than a convenient default.
27
+ * - `root` — the whole dispatch directory (`*`) or an explicit filesystem root such as `/`
28
+ * or `C:/`. Leases compare its physical path, not its spelling: sibling worktrees are
29
+ * disjoint, while claims in the same directory or nested under it still intersect.
32
30
  *
33
31
  * A scope says nothing about *time*. Two disjoint scopes may run at once; two intersecting
34
32
  * ones must be serialized or refused by the caller, which is what `lib/write-lease.js`
@@ -223,6 +221,7 @@ function resolveEntry(claim, win, base, fold) {
223
221
  if (claim.kind !== SCOPE_KIND.root && GLOB_CHARS.test(text)) return { reason: REJECT_REASON.glob }
224
222
  if (HOME_PREFIX.test(text)) return { reason: REJECT_REASON.home }
225
223
  if (win && WIN_DRIVE_RELATIVE.test(text)) return { reason: REJECT_REASON.driveRelative }
224
+ // The `*` claim retains the physical cwd (and its realpath when supplied) as its key.
226
225
  const workspaceClaim = claim.kind === SCOPE_KIND.root && text === '.'
227
226
  // `/repo/a` on Windows is rooted on the current drive, not a sibling of the cwd. The
228
227
  // drive is the one the dispatch cwd is on, which is also what `path.resolve` uses.
@@ -247,12 +246,7 @@ function underKey(key, prefix) {
247
246
  return key.startsWith(prefix.endsWith('/') ? prefix : `${prefix}/`)
248
247
  }
249
248
 
250
- /**
251
- * Whether one normalized entry covers another: a root covers all, a dir covers its
252
- * subtree, a file covers only itself. A root *target* is a subtree of its own path, so it
253
- * is covered exactly when that path is; `overlaps` is the separate, much stricter rule
254
- * that a root claim intersects everything.
255
- */
249
+ /** Retain the established containment semantics used by logical write auditing. */
256
250
  function entryContains(holder, target) {
257
251
  if (holder.kind === SCOPE_KIND.root) return true
258
252
  if (holder.kind === SCOPE_KIND.dir) return underKey(target.key, holder.key)
@@ -385,15 +379,17 @@ export function normalizeScope(entries, cwd, { caseInsensitive, realpath } = {})
385
379
  }
386
380
  }
387
381
 
388
- /**
389
- * Whether two normalized entries claim the same bytes on disk. A root claim matches every
390
- * other entry, which is what makes `*` a real exclusion rather than a comment.
391
- */
382
+ function isLegacyGlobalRoot(entry) {
383
+ return entry.kind === SCOPE_KIND.root &&
384
+ (typeof entry.key !== 'string' || (!entry.key.startsWith('/') && !isAbsoluteFor(entry.key, true)))
385
+ }
386
+
387
+ /** Whether two normalized entries claim the same physical path or an intersecting subtree. */
392
388
  export function overlaps(left, right) {
393
389
  if (left === undefined || left === null || right === undefined || right === null) return false
394
- if (left.kind === SCOPE_KIND.root || right.kind === SCOPE_KIND.root) return true
395
- // Either side may be the directory, and two directories may nest in either order.
396
- if (left.kind === SCOPE_KIND.dir || right.kind === SCOPE_KIND.dir) {
390
+ if (isLegacyGlobalRoot(left) || isLegacyGlobalRoot(right)) return true
391
+ // Root and directory entries both use the absolute comparison key as a prefix.
392
+ if (left.kind !== SCOPE_KIND.file || right.kind !== SCOPE_KIND.file) {
397
393
  return underKey(left.key, right.key) || underKey(right.key, left.key)
398
394
  }
399
395
  return left.key === right.key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sshirkit/dsh-orchestrator",
3
- "version": "0.9.1",
3
+ "version": "1.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/schemastery": ">=3.18.5 <4.0.0",
40
- "@deepseek-ai/dsh-tools": ">=0.2.2-rc.2 <0.2.3-0",
41
- "@deepseek-ai/dsh-llm": ">=0.2.2-rc.2 <0.2.3-0"
40
+ "@deepseek-ai/dsh-tools": ">=0.0.1-rc.1 <0.1.0 || >=0.2.2-rc.2 <0.2.3-0",
41
+ "@deepseek-ai/dsh-llm": ">=0.0.1-rc.5 <0.1.0 || >=0.2.2-rc.2 <0.2.3-0"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@deepseek-ai/dsh-llm": {