@dypai-ai/mcp 1.5.29 → 1.5.30
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
CHANGED
|
@@ -60,7 +60,3 @@ export async function compileFromDypaiDir(projectId, dypaiRootDir, projectRoot =
|
|
|
60
60
|
}
|
|
61
61
|
return { ok: true, snapshot }
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
export function shouldUseLocalFlowCompiler() {
|
|
65
|
-
return Boolean(process.env.DYPAI_MONOREPO_ROOT || process.env.DYPAI_USE_LOCAL_FLOW_COMPILER === "1")
|
|
66
|
-
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Effective workflow runner — cloud compiler
|
|
2
|
+
* Effective workflow runner — cloud compiler only (MCP Cloud → backend_compile_snapshot).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { existsSync } from "node:fs"
|
|
7
|
-
import { dirname, join, resolve as resolvePath, basename } from "node:path"
|
|
8
|
-
import { fileURLToPath } from "node:url"
|
|
5
|
+
import { basename, dirname, resolve as resolvePath } from "node:path"
|
|
9
6
|
import {
|
|
10
7
|
buildSnapshotPayload,
|
|
11
8
|
cloudBuildEffectivePushPayloads,
|
|
@@ -14,115 +11,13 @@ import {
|
|
|
14
11
|
cloudListEffectiveEntries,
|
|
15
12
|
cloudResolveEffectiveEndpoint,
|
|
16
13
|
cloudValidateSnapshot,
|
|
17
|
-
shouldUseLocalFlowCompiler,
|
|
18
14
|
} from "./cloudBackendCompiler.js"
|
|
19
15
|
|
|
20
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
21
|
-
|
|
22
16
|
export function resolveProjectRootFromDypaiDir(dypaiRootDir) {
|
|
23
17
|
const resolved = resolvePath(dypaiRootDir)
|
|
24
18
|
return basename(resolved) === "dypai" ? dirname(resolved) : resolved
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
export function resolveMonorepoRoot() {
|
|
28
|
-
if (process.env.DYPAI_MONOREPO_ROOT) {
|
|
29
|
-
return resolvePath(process.env.DYPAI_MONOREPO_ROOT)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let cursor = __dirname
|
|
33
|
-
for (let i = 0; i < 10; i++) {
|
|
34
|
-
if (existsSync(join(cursor, "dypai-workspace")) && existsSync(join(cursor, "dypai-flow"))) {
|
|
35
|
-
return cursor
|
|
36
|
-
}
|
|
37
|
-
const parent = dirname(cursor)
|
|
38
|
-
if (parent === cursor) break
|
|
39
|
-
cursor = parent
|
|
40
|
-
}
|
|
41
|
-
return null
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function parseCliStdout(stdout) {
|
|
45
|
-
const trimmed = (stdout || "").trim()
|
|
46
|
-
if (!trimmed) return { error: "effective-workflows-cli returned empty output" }
|
|
47
|
-
try {
|
|
48
|
-
return JSON.parse(trimmed)
|
|
49
|
-
} catch {
|
|
50
|
-
return { error: `effective-workflows-cli returned non-JSON output: ${trimmed.slice(0, 300)}` }
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function runEffectiveWorkflowsCli(projectRoot, commandArgs = []) {
|
|
55
|
-
const monorepoRoot = resolveMonorepoRoot()
|
|
56
|
-
if (!monorepoRoot) {
|
|
57
|
-
return {
|
|
58
|
-
ok: false,
|
|
59
|
-
unavailable: true,
|
|
60
|
-
warning: {
|
|
61
|
-
severity: "warn",
|
|
62
|
-
rule: "effective_workflow_runner_unavailable",
|
|
63
|
-
message: "Effective workflow runner unavailable (monorepo root not found). YAML workflows still work.",
|
|
64
|
-
fix_hint: "Flow validation now runs in DYPAI cloud by default. Ensure DYPAI_TOKEN is set.",
|
|
65
|
-
},
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const scriptPath = join(monorepoRoot, "dypai-workspace/scripts/effective-workflows-cli.ts")
|
|
70
|
-
if (!existsSync(scriptPath)) {
|
|
71
|
-
return {
|
|
72
|
-
ok: false,
|
|
73
|
-
unavailable: true,
|
|
74
|
-
warning: {
|
|
75
|
-
severity: "warn",
|
|
76
|
-
rule: "effective_workflow_runner_unavailable",
|
|
77
|
-
message: `Effective workflow CLI missing at ${scriptPath}.`,
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const bunBin = process.env.DYPAI_BUN_BIN || "bun"
|
|
83
|
-
const args = ["run", scriptPath, ...commandArgs, "--root", resolvePath(projectRoot)]
|
|
84
|
-
const result = spawnSync(bunBin, args, {
|
|
85
|
-
encoding: "utf8",
|
|
86
|
-
cwd: monorepoRoot,
|
|
87
|
-
env: process.env,
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
if (result.error) {
|
|
91
|
-
return {
|
|
92
|
-
ok: false,
|
|
93
|
-
unavailable: true,
|
|
94
|
-
warning: {
|
|
95
|
-
severity: "warn",
|
|
96
|
-
rule: "effective_workflow_runner_unavailable",
|
|
97
|
-
message: `Failed to spawn ${bunBin}: ${result.error.message}`,
|
|
98
|
-
fix_hint: "Install bun or set DYPAI_BUN_BIN to a working bun executable.",
|
|
99
|
-
},
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const parsed = parseCliStdout(result.stdout)
|
|
104
|
-
if (parsed.error && !parsed.diagnostics && !parsed.entries && !parsed.status) {
|
|
105
|
-
return {
|
|
106
|
-
ok: false,
|
|
107
|
-
unavailable: false,
|
|
108
|
-
error: parsed.error,
|
|
109
|
-
stderr: (result.stderr || "").trim() || undefined,
|
|
110
|
-
exitCode: result.status,
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (result.status !== 0 && !parsed.diagnostics && !parsed.entries && !parsed.status) {
|
|
115
|
-
return {
|
|
116
|
-
ok: false,
|
|
117
|
-
unavailable: false,
|
|
118
|
-
error: parsed.error || (result.stderr || "").trim() || `effective-workflows-cli exited with ${result.status}`,
|
|
119
|
-
exitCode: result.status,
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return { ok: true, data: parsed }
|
|
124
|
-
}
|
|
125
|
-
|
|
126
21
|
function endpointArg(commandArgs) {
|
|
127
22
|
const idx = commandArgs.indexOf("--endpoint")
|
|
128
23
|
if (idx < 0) return null
|
|
@@ -133,7 +28,9 @@ function commandFromArgs(commandArgs) {
|
|
|
133
28
|
return commandArgs[0] || "validate"
|
|
134
29
|
}
|
|
135
30
|
|
|
136
|
-
async function
|
|
31
|
+
export async function runEffectiveWorkflows(dypaiRootDir, projectId, commandArgs = []) {
|
|
32
|
+
const projectRoot = resolveProjectRootFromDypaiDir(dypaiRootDir)
|
|
33
|
+
|
|
137
34
|
if (!projectId) {
|
|
138
35
|
return {
|
|
139
36
|
ok: false,
|
|
@@ -198,13 +95,3 @@ async function runEffectiveWorkflowsCloud(dypaiRootDir, projectRoot, projectId,
|
|
|
198
95
|
}
|
|
199
96
|
}
|
|
200
97
|
}
|
|
201
|
-
|
|
202
|
-
export async function runEffectiveWorkflows(dypaiRootDir, projectId, commandArgs = []) {
|
|
203
|
-
const projectRoot = resolveProjectRootFromDypaiDir(dypaiRootDir)
|
|
204
|
-
if (shouldUseLocalFlowCompiler()) {
|
|
205
|
-
return runEffectiveWorkflowsCli(projectRoot, commandArgs)
|
|
206
|
-
}
|
|
207
|
-
return runEffectiveWorkflowsCloud(dypaiRootDir, projectRoot, projectId, commandArgs)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export { shouldUseLocalFlowCompiler }
|