MCPcopy
hub / github.com/coder/mux / resolveWorkflowScript

Function resolveWorkflowScript

src/node/services/workflows/workflowScriptResolver.ts:48–79  ·  view source on GitHub ↗
(
  input: ResolveWorkflowScriptInput
)

Source from the content-addressed store, hash-verified

46const INLINE_SCRIPT_PATH_PREFIX = "inline://";
47
48export async function resolveWorkflowScript(
49 input: ResolveWorkflowScriptInput
50): Promise<ResolvedWorkflowScript> {
51 const hasPath = input.scriptPath != null;
52 const hasSource = input.scriptSource != null;
53 assert(
54 hasPath !== hasSource,
55 "resolveWorkflowScript: provide exactly one of scriptPath or scriptSource"
56 );
57 assert(input.workspacePath.length > 0, "resolveWorkflowScript: workspacePath is required");
58
59 if (hasSource) {
60 assert(input.scriptSource != null, "resolveWorkflowScript: scriptSource is required");
61 return buildInlineWorkflowScript({
62 source: input.scriptSource,
63 projectTrusted: input.projectTrusted,
64 });
65 }
66
67 assert(input.scriptPath != null, "resolveWorkflowScript: scriptPath is required");
68 const scriptPath = input.scriptPath.trim();
69 assert(scriptPath.length > 0, "resolveWorkflowScript: scriptPath is required");
70 if (scriptPath.startsWith(INLINE_SCRIPT_PATH_PREFIX)) {
71 throw new Error("inline:// workflow paths are provenance only; use script_source instead");
72 }
73
74 if (scriptPath.startsWith(SKILL_SCRIPT_PATH_PREFIX)) {
75 return await resolveSkillWorkflowScript({ ...input, scriptPath });
76 }
77
78 return await resolveWorkspaceFileWorkflowScript({ ...input, scriptPath });
79}
80
81function buildInlineWorkflowScript(input: {
82 source: string;

Callers 8

createWorkflowServiceFunction · 0.90
runWorkflowFunction · 0.90
streamMessageMethod · 0.90
createWorkflowRunToolFunction · 0.90
discoverWorkflowScriptsFunction · 0.90
resolveWorkflowContextFunction · 0.90
routerFunction · 0.90

Calls 4

assertFunction · 0.50

Tested by

no test coverage detected