@smithers-orchestrator/graph 0.22.0 → 0.24.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/package.json +2 -2
- package/src/dom/extract.js +4 -8
- package/src/extract.js +3 -5
- package/src/index.d.ts +11 -4
- package/src/index.js +1 -0
- package/src/types.ts +0 -3
- package/src/worktree-path.js +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithers-orchestrator/graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Framework-neutral Smithers workflow graph model and extraction helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"drizzle-orm": "^0.45.2",
|
|
24
24
|
"zod": "^4.3.6",
|
|
25
|
-
"@smithers-orchestrator/errors": "0.
|
|
25
|
+
"@smithers-orchestrator/errors": "0.24.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/bun": "latest",
|
package/src/dom/extract.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
// @smithers-type-exports-end
|
|
5
5
|
|
|
6
6
|
import { resolveStableId } from "@smithers-orchestrator/graph/utils/tree-ids";
|
|
7
|
-
import { isAbsolute, resolve as resolvePath } from "node:path";
|
|
8
7
|
import { getTableName } from "drizzle-orm";
|
|
9
8
|
import { DEFAULT_MERGE_QUEUE_CONCURRENCY, WORKTREE_EMPTY_PATH_ERROR, } from "@smithers-orchestrator/graph/constants";
|
|
10
9
|
import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
|
|
10
|
+
import { resolveWorktreePath } from "@smithers-orchestrator/graph/worktree-path";
|
|
11
11
|
|
|
12
12
|
/** @typedef {import("../ExtractOptions.ts").ExtractOptions} ExtractOptions */
|
|
13
13
|
/** @typedef {import("../ExtractResult.ts").ExtractResult} ExtractResult */
|
|
@@ -251,13 +251,7 @@ export function extractFromHost(root, opts) {
|
|
|
251
251
|
if (!pathVal) {
|
|
252
252
|
throw new SmithersError("WORKTREE_EMPTY_PATH", WORKTREE_EMPTY_PATH_ERROR);
|
|
253
253
|
}
|
|
254
|
-
const
|
|
255
|
-
const base = typeof baseRoot === "string" && baseRoot.length > 0
|
|
256
|
-
? baseRoot
|
|
257
|
-
: process.cwd();
|
|
258
|
-
const normPath = isAbsolute(pathVal)
|
|
259
|
-
? resolvePath(pathVal)
|
|
260
|
-
: resolvePath(base, pathVal);
|
|
254
|
+
const normPath = resolveWorktreePath(pathVal, { baseRootDir: opts?.baseRootDir });
|
|
261
255
|
const branch = node.rawProps?.branch ? String(node.rawProps.branch) : undefined;
|
|
262
256
|
const baseBranch = node.rawProps?.baseBranch ? String(node.rawProps.baseBranch) : undefined;
|
|
263
257
|
nextWorktreeStack = [...worktreeStack, { id, path: normPath, branch, baseBranch }];
|
|
@@ -464,6 +458,7 @@ export function extractFromHost(root, opts) {
|
|
|
464
458
|
config: {
|
|
465
459
|
image: raw.image,
|
|
466
460
|
env: raw.env,
|
|
461
|
+
egress: raw.egress,
|
|
467
462
|
ports: raw.ports,
|
|
468
463
|
volumes: raw.volumes,
|
|
469
464
|
memoryLimit: raw.memoryLimit,
|
|
@@ -488,6 +483,7 @@ export function extractFromHost(root, opts) {
|
|
|
488
483
|
__sandboxConfig: {
|
|
489
484
|
image: raw.image,
|
|
490
485
|
env: raw.env,
|
|
486
|
+
egress: raw.egress,
|
|
491
487
|
ports: raw.ports,
|
|
492
488
|
volumes: raw.volumes,
|
|
493
489
|
memoryLimit: raw.memoryLimit,
|
package/src/extract.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isAbsolute, resolve as resolvePath } from "node:path";
|
|
2
1
|
import { getTableName } from "drizzle-orm";
|
|
3
2
|
import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
|
|
4
3
|
import { validateForkSources } from "./validateForkSources.js";
|
|
4
|
+
import { resolveWorktreePath } from "./worktree-path.js";
|
|
5
5
|
/** @typedef {import("./TaskDescriptor.ts").TaskDescriptor} TaskDescriptor */
|
|
6
6
|
/** @typedef {import("./XmlNode.ts").XmlNode} XmlNode */
|
|
7
7
|
/** @typedef {import("./ExtractOptions.ts").ExtractOptions} ExtractOptions */
|
|
@@ -364,14 +364,11 @@ export function extractGraph(root, opts) {
|
|
|
364
364
|
if (!pathVal) {
|
|
365
365
|
throw new SmithersError("WORKTREE_EMPTY_PATH", WORKTREE_EMPTY_PATH_ERROR);
|
|
366
366
|
}
|
|
367
|
-
const base = typeof opts?.baseRootDir === "string" && opts.baseRootDir.length > 0
|
|
368
|
-
? opts.baseRootDir
|
|
369
|
-
: process.cwd();
|
|
370
367
|
nextWorktreeStack = [
|
|
371
368
|
...ctx.worktreeStack,
|
|
372
369
|
{
|
|
373
370
|
id,
|
|
374
|
-
path:
|
|
371
|
+
path: resolveWorktreePath(pathVal, opts),
|
|
375
372
|
...(raw.branch ? { branch: String(raw.branch) } : {}),
|
|
376
373
|
...(raw.baseBranch ? { baseBranch: String(raw.baseBranch) } : {}),
|
|
377
374
|
},
|
|
@@ -463,6 +460,7 @@ export function extractGraph(root, opts) {
|
|
|
463
460
|
__sandboxConfig: {
|
|
464
461
|
image: raw.image,
|
|
465
462
|
env: raw.env,
|
|
463
|
+
egress: raw.egress,
|
|
466
464
|
ports: raw.ports,
|
|
467
465
|
volumes: raw.volumes,
|
|
468
466
|
memoryLimit: raw.memoryLimit,
|
package/src/index.d.ts
CHANGED
|
@@ -26,9 +26,6 @@ type HostText$1 = {
|
|
|
26
26
|
type RetryPolicy$1 = {
|
|
27
27
|
backoff?: "fixed" | "linear" | "exponential";
|
|
28
28
|
initialDelayMs?: number;
|
|
29
|
-
maxDelayMs?: number;
|
|
30
|
-
multiplier?: number;
|
|
31
|
-
jitter?: boolean;
|
|
32
29
|
};
|
|
33
30
|
type CachePolicy$1<Ctx = unknown> = {
|
|
34
31
|
by?: (ctx: Ctx) => unknown;
|
|
@@ -192,6 +189,16 @@ declare function extractGraph(root: HostNode$1 | null, opts?: ExtractOptions$1):
|
|
|
192
189
|
* @returns {WorkflowGraph}
|
|
193
190
|
*/
|
|
194
191
|
declare function extractFromHost(root: HostNode$1 | null, opts?: ExtractOptions$1): WorkflowGraph$1;
|
|
192
|
+
/**
|
|
193
|
+
* Resolve a <Worktree path> prop exactly the way graph extraction resolves it.
|
|
194
|
+
*
|
|
195
|
+
* @param {unknown} path
|
|
196
|
+
* @param {{ baseRootDir?: string }} [opts]
|
|
197
|
+
* @returns {string}
|
|
198
|
+
*/
|
|
199
|
+
declare function resolveWorktreePath(path: unknown, opts?: {
|
|
200
|
+
baseRootDir?: string;
|
|
201
|
+
}): string;
|
|
195
202
|
type ExtractOptions$1 = ExtractOptions$2;
|
|
196
203
|
type HostNode$1 = HostNode$2;
|
|
197
204
|
type WorkflowGraph$1 = WorkflowGraph$2;
|
|
@@ -222,4 +229,4 @@ type XmlElement = XmlElement$1;
|
|
|
222
229
|
type XmlNode = XmlNode$1;
|
|
223
230
|
type XmlText = XmlText$1;
|
|
224
231
|
|
|
225
|
-
export { type AgentLike, type ApprovalOption, type CachePolicy, type ExtractGraph, type ExtractOptions, type GraphSnapshot, type HostElement, type HostNode, type HostText, type MemoryNamespace, type MemoryNamespaceKind, type RetryPolicy, type SamplingConfig, type ScoreResult, type Scorer, type ScorerBinding, type ScorerFn, type ScorerInput, type ScorersMap, type TaskDescriptor, type TaskMemoryConfig, type WorkflowGraph, type XmlElement, type XmlNode, type XmlText, extractFromHost, extractGraph };
|
|
232
|
+
export { type AgentLike, type ApprovalOption, type CachePolicy, type ExtractGraph, type ExtractOptions, type GraphSnapshot, type HostElement, type HostNode, type HostText, type MemoryNamespace, type MemoryNamespaceKind, type RetryPolicy, type SamplingConfig, type ScoreResult, type Scorer, type ScorerBinding, type ScorerFn, type ScorerInput, type ScorersMap, type TaskDescriptor, type TaskMemoryConfig, type WorkflowGraph, type XmlElement, type XmlNode, type XmlText, extractFromHost, extractGraph, resolveWorktreePath };
|
package/src/index.js
CHANGED
package/src/types.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { SmithersError } from "@smithers-orchestrator/errors/SmithersError";
|
|
3
|
+
import { WORKTREE_EMPTY_PATH_ERROR } from "./constants.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a <Worktree path> prop exactly the way graph extraction resolves it.
|
|
7
|
+
*
|
|
8
|
+
* @param {unknown} path
|
|
9
|
+
* @param {{ baseRootDir?: string }} [opts]
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function resolveWorktreePath(path, opts) {
|
|
13
|
+
const pathVal = String(path ?? "").trim();
|
|
14
|
+
if (!pathVal) {
|
|
15
|
+
throw new SmithersError("WORKTREE_EMPTY_PATH", WORKTREE_EMPTY_PATH_ERROR);
|
|
16
|
+
}
|
|
17
|
+
if (isAbsolute(pathVal)) {
|
|
18
|
+
return resolve(pathVal);
|
|
19
|
+
}
|
|
20
|
+
const base = typeof opts?.baseRootDir === "string" && opts.baseRootDir.length > 0
|
|
21
|
+
? opts.baseRootDir
|
|
22
|
+
: process.cwd();
|
|
23
|
+
return resolve(base, pathVal);
|
|
24
|
+
}
|