@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.
- package/README.md +153 -92
- package/README.zh.md +155 -94
- package/docs/images/dispatch-panel.png +0 -0
- package/docs/images/hero-banner.png +0 -0
- package/lib/api.js +1 -0
- package/lib/catalog.js +2 -1
- package/lib/client.js +212 -55
- package/lib/delegate-status.js +125 -0
- package/lib/delegate.js +299 -59
- package/lib/gate.js +57 -15
- package/lib/git-audit.js +383 -0
- package/lib/index.js +1185 -173
- package/lib/orchestrate.js +313 -89
- package/lib/reconcile.js +590 -0
- package/lib/retry.js +68 -5
- package/lib/rules.js +15 -2
- package/lib/state-store.js +455 -0
- package/lib/supervise.js +593 -87
- package/lib/timeline.js +464 -0
- package/lib/tool-surface.js +69 -21
- package/lib/worktree-manage.js +244 -0
- package/lib/worktree-tool.js +38 -0
- package/lib/worktree.js +687 -0
- package/lib/write-audit.js +333 -0
- package/lib/write-lease.js +161 -7
- package/lib/write-scope-tool.js +29 -0
- package/lib/write-scope.js +14 -18
- package/package.json +3 -3
package/lib/write-scope.js
CHANGED
|
@@ -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` —
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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
|
-
|
|
390
|
-
|
|
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
|
|
395
|
-
//
|
|
396
|
-
if (left.kind
|
|
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.
|
|
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": {
|