opentool 0.8.28 → 0.9.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 +11 -31
- package/dist/adapters/hyperliquid/index.d.ts +19 -1
- package/dist/adapters/hyperliquid/index.js +62 -2
- package/dist/adapters/hyperliquid/index.js.map +1 -1
- package/dist/cli/index.d.ts +0 -10
- package/dist/cli/index.js +0 -194
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +29 -4
- package/dist/index.js +131 -3
- package/dist/index.js.map +1 -1
- package/dist/store/index.d.ts +12 -1
- package/dist/store/index.js +14 -2
- package/dist/store/index.js.map +1 -1
- package/package.json +9 -26
- package/templates/base/package.json +2 -2
package/dist/cli/index.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ interface BuildArtifacts {
|
|
|
16
16
|
defaultsApplied: string[];
|
|
17
17
|
tools: InternalToolDefinition[];
|
|
18
18
|
compiledTools: CompiledToolArtifact[];
|
|
19
|
-
workflowBundles: WorkflowBundleArtifact | null;
|
|
20
19
|
toolsManifestPath: string | null;
|
|
21
20
|
sharedModules?: SharedModulesInfo | null;
|
|
22
21
|
}
|
|
@@ -29,15 +28,6 @@ interface CompiledToolArtifact {
|
|
|
29
28
|
defaultMcpMethod?: string;
|
|
30
29
|
hasWallet: boolean;
|
|
31
30
|
}
|
|
32
|
-
interface WorkflowBundleArtifact {
|
|
33
|
-
sourceDir: string;
|
|
34
|
-
outputDir: string;
|
|
35
|
-
stepsBundlePath: string;
|
|
36
|
-
workflowsBundlePath: string;
|
|
37
|
-
webhookBundlePath: string;
|
|
38
|
-
clientBundlePath?: string;
|
|
39
|
-
manifestPath?: string;
|
|
40
|
-
}
|
|
41
31
|
interface SharedModulesInfo {
|
|
42
32
|
count: number;
|
|
43
33
|
outputDir: string;
|
package/dist/cli/index.js
CHANGED
|
@@ -1625,10 +1625,6 @@ async function buildProject(options) {
|
|
|
1625
1625
|
compiledTools,
|
|
1626
1626
|
outputDir
|
|
1627
1627
|
});
|
|
1628
|
-
const workflowBundles = await buildWorkflowsIfPresent({
|
|
1629
|
-
projectRoot,
|
|
1630
|
-
outputDir
|
|
1631
|
-
});
|
|
1632
1628
|
const shouldBuildMcpServer = compiledTools.some((artifact) => artifact.mcpEnabled);
|
|
1633
1629
|
if (shouldBuildMcpServer) {
|
|
1634
1630
|
await writeMcpServer({
|
|
@@ -1647,7 +1643,6 @@ async function buildProject(options) {
|
|
|
1647
1643
|
defaultsApplied,
|
|
1648
1644
|
tools,
|
|
1649
1645
|
compiledTools,
|
|
1650
|
-
workflowBundles,
|
|
1651
1646
|
toolsManifestPath,
|
|
1652
1647
|
sharedModules
|
|
1653
1648
|
};
|
|
@@ -1898,18 +1893,6 @@ function logBuildSummary(artifacts, options) {
|
|
|
1898
1893
|
if (artifacts.toolsManifestPath) {
|
|
1899
1894
|
console.log(" \u2022 tools.json (runtime tool manifest)");
|
|
1900
1895
|
}
|
|
1901
|
-
if (artifacts.workflowBundles) {
|
|
1902
|
-
console.log(" \u2022 .well-known/workflow/v1/ (workflow bundles)");
|
|
1903
|
-
console.log(" - flow.js");
|
|
1904
|
-
console.log(" - step.js");
|
|
1905
|
-
console.log(" - webhook.js");
|
|
1906
|
-
if (artifacts.workflowBundles.clientBundlePath) {
|
|
1907
|
-
console.log(" - client.js");
|
|
1908
|
-
}
|
|
1909
|
-
if (artifacts.workflowBundles.manifestPath) {
|
|
1910
|
-
console.log(" - manifest.json");
|
|
1911
|
-
}
|
|
1912
|
-
}
|
|
1913
1896
|
if (artifacts.defaultsApplied.length > 0) {
|
|
1914
1897
|
console.log("\nDefaults applied during metadata synthesis:");
|
|
1915
1898
|
artifacts.defaultsApplied.forEach((entry) => console.log(` \u2022 ${entry}`));
|
|
@@ -1918,183 +1901,6 @@ function logBuildSummary(artifacts, options) {
|
|
|
1918
1901
|
console.log("\n\u2139\uFE0F MCP adapter skipped (no tools opted in)");
|
|
1919
1902
|
}
|
|
1920
1903
|
}
|
|
1921
|
-
async function buildWorkflowsIfPresent(options) {
|
|
1922
|
-
const workflowsDir = options.workflowsDir ?? path6.join(options.projectRoot, "workflows");
|
|
1923
|
-
if (!fs4.existsSync(workflowsDir)) {
|
|
1924
|
-
return null;
|
|
1925
|
-
}
|
|
1926
|
-
if (!hasWorkflowSourceFiles(workflowsDir)) {
|
|
1927
|
-
return null;
|
|
1928
|
-
}
|
|
1929
|
-
const nodeVersion = process.versions?.node ?? "0.0.0";
|
|
1930
|
-
const nodeMajor = Number(nodeVersion.split(".")[0] ?? 0);
|
|
1931
|
-
if (!Number.isFinite(nodeMajor) || nodeMajor < 22) {
|
|
1932
|
-
console.warn(
|
|
1933
|
-
`[${timestamp()}] Workflow bundles skipped (requires Node >= 22, current ${nodeVersion})`
|
|
1934
|
-
);
|
|
1935
|
-
return null;
|
|
1936
|
-
}
|
|
1937
|
-
let BaseBuilder;
|
|
1938
|
-
try {
|
|
1939
|
-
({ BaseBuilder } = await import('@workflow/cli/dist/lib/builders/base-builder.js'));
|
|
1940
|
-
} catch (error) {
|
|
1941
|
-
const details = error instanceof Error ? `
|
|
1942
|
-
Reason: ${error.message}` : "";
|
|
1943
|
-
throw new Error(
|
|
1944
|
-
`[${timestamp()}] Workflow sources detected, but optional dependency '@workflow/cli' is not installed. Install it with "npm install @workflow/cli" (or add it to devDependencies) and rerun the build.` + details
|
|
1945
|
-
);
|
|
1946
|
-
}
|
|
1947
|
-
class OpenToolWorkflowBuilder extends BaseBuilder {
|
|
1948
|
-
constructor(config) {
|
|
1949
|
-
super(config);
|
|
1950
|
-
}
|
|
1951
|
-
async build() {
|
|
1952
|
-
const inputFiles = await this.getInputFiles();
|
|
1953
|
-
const tsConfig = await this.getTsConfigOptions();
|
|
1954
|
-
const shared = {
|
|
1955
|
-
inputFiles,
|
|
1956
|
-
...tsConfig.baseUrl ? { tsBaseUrl: tsConfig.baseUrl } : {},
|
|
1957
|
-
...tsConfig.paths ? { tsPaths: tsConfig.paths } : {}
|
|
1958
|
-
};
|
|
1959
|
-
await this.buildStepsBundle(shared);
|
|
1960
|
-
await this.buildWorkflowsBundle(shared);
|
|
1961
|
-
await this.buildWebhookRoute();
|
|
1962
|
-
await this.buildClientLibrary();
|
|
1963
|
-
}
|
|
1964
|
-
async buildStepsBundle(options2) {
|
|
1965
|
-
console.log(
|
|
1966
|
-
"Creating OpenTool workflow steps bundle at",
|
|
1967
|
-
this.config.stepsBundlePath
|
|
1968
|
-
);
|
|
1969
|
-
const stepsBundlePath2 = path6.resolve(
|
|
1970
|
-
this.config.workingDir,
|
|
1971
|
-
this.config.stepsBundlePath
|
|
1972
|
-
);
|
|
1973
|
-
await fs4.promises.mkdir(path6.dirname(stepsBundlePath2), { recursive: true });
|
|
1974
|
-
await this.createStepsBundle({
|
|
1975
|
-
outfile: stepsBundlePath2,
|
|
1976
|
-
...options2
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1979
|
-
async buildWorkflowsBundle(options2) {
|
|
1980
|
-
console.log(
|
|
1981
|
-
"Creating OpenTool workflow bundle at",
|
|
1982
|
-
this.config.workflowsBundlePath
|
|
1983
|
-
);
|
|
1984
|
-
const workflowBundlePath = path6.resolve(
|
|
1985
|
-
this.config.workingDir,
|
|
1986
|
-
this.config.workflowsBundlePath
|
|
1987
|
-
);
|
|
1988
|
-
await fs4.promises.mkdir(path6.dirname(workflowBundlePath), {
|
|
1989
|
-
recursive: true
|
|
1990
|
-
});
|
|
1991
|
-
await this.createWorkflowsBundle({
|
|
1992
|
-
outfile: workflowBundlePath,
|
|
1993
|
-
bundleFinalOutput: false,
|
|
1994
|
-
...options2
|
|
1995
|
-
});
|
|
1996
|
-
}
|
|
1997
|
-
async buildWebhookRoute() {
|
|
1998
|
-
console.log(
|
|
1999
|
-
"Creating OpenTool workflow webhook bundle at",
|
|
2000
|
-
this.config.webhookBundlePath
|
|
2001
|
-
);
|
|
2002
|
-
const webhookBundlePath2 = path6.resolve(
|
|
2003
|
-
this.config.workingDir,
|
|
2004
|
-
this.config.webhookBundlePath
|
|
2005
|
-
);
|
|
2006
|
-
await fs4.promises.mkdir(path6.dirname(webhookBundlePath2), {
|
|
2007
|
-
recursive: true
|
|
2008
|
-
});
|
|
2009
|
-
await this.createWebhookBundle({ outfile: webhookBundlePath2 });
|
|
2010
|
-
}
|
|
2011
|
-
async buildClientLibrary() {
|
|
2012
|
-
if (!this.config?.clientBundlePath) {
|
|
2013
|
-
return;
|
|
2014
|
-
}
|
|
2015
|
-
const clientBundlePath2 = path6.resolve(
|
|
2016
|
-
this.config.workingDir,
|
|
2017
|
-
this.config.clientBundlePath
|
|
2018
|
-
);
|
|
2019
|
-
await fs4.promises.mkdir(path6.dirname(clientBundlePath2), {
|
|
2020
|
-
recursive: true
|
|
2021
|
-
});
|
|
2022
|
-
await this.createWorkflowsBundle({
|
|
2023
|
-
outfile: clientBundlePath2,
|
|
2024
|
-
bundleFinalOutput: true
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
const relativeSourceDir = path6.relative(options.projectRoot, workflowsDir) || ".";
|
|
2029
|
-
const outputBase = path6.join(
|
|
2030
|
-
options.outputDir,
|
|
2031
|
-
".well-known",
|
|
2032
|
-
"workflow",
|
|
2033
|
-
"v1"
|
|
2034
|
-
);
|
|
2035
|
-
const stepsBundlePath = path6.join(outputBase, "step.js");
|
|
2036
|
-
const workflowsBundlePath = path6.join(outputBase, "flow.js");
|
|
2037
|
-
const webhookBundlePath = path6.join(outputBase, "webhook.js");
|
|
2038
|
-
const manifestPath = path6.join(outputBase, "manifest.json");
|
|
2039
|
-
const builder = new OpenToolWorkflowBuilder({
|
|
2040
|
-
workingDir: options.projectRoot,
|
|
2041
|
-
dirs: [relativeSourceDir],
|
|
2042
|
-
buildTarget: "standalone",
|
|
2043
|
-
stepsBundlePath,
|
|
2044
|
-
workflowsBundlePath,
|
|
2045
|
-
webhookBundlePath,
|
|
2046
|
-
...{},
|
|
2047
|
-
workflowManifestPath: manifestPath,
|
|
2048
|
-
externalPackages: [
|
|
2049
|
-
"workflow",
|
|
2050
|
-
"workflow/internal/builtins",
|
|
2051
|
-
"workflow/internal/private",
|
|
2052
|
-
"workflow/runtime",
|
|
2053
|
-
"workflow/api"
|
|
2054
|
-
]
|
|
2055
|
-
});
|
|
2056
|
-
console.log(
|
|
2057
|
-
`[${timestamp()}] Building workflows from ${workflowsDir} -> ${outputBase}`
|
|
2058
|
-
);
|
|
2059
|
-
await builder.build();
|
|
2060
|
-
return {
|
|
2061
|
-
sourceDir: workflowsDir,
|
|
2062
|
-
outputDir: outputBase,
|
|
2063
|
-
stepsBundlePath,
|
|
2064
|
-
workflowsBundlePath,
|
|
2065
|
-
webhookBundlePath,
|
|
2066
|
-
...{},
|
|
2067
|
-
manifestPath
|
|
2068
|
-
};
|
|
2069
|
-
}
|
|
2070
|
-
function hasWorkflowSourceFiles(directory) {
|
|
2071
|
-
const entries = fs4.readdirSync(directory, { withFileTypes: true });
|
|
2072
|
-
for (const entry of entries) {
|
|
2073
|
-
if (entry.isDirectory()) {
|
|
2074
|
-
if (hasWorkflowSourceFiles(path6.join(directory, entry.name))) {
|
|
2075
|
-
return true;
|
|
2076
|
-
}
|
|
2077
|
-
continue;
|
|
2078
|
-
}
|
|
2079
|
-
if (entry.isFile()) {
|
|
2080
|
-
const extension = path6.extname(entry.name).toLowerCase();
|
|
2081
|
-
if (WORKFLOW_SOURCE_EXTENSIONS.has(extension)) {
|
|
2082
|
-
return true;
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
return false;
|
|
2087
|
-
}
|
|
2088
|
-
var WORKFLOW_SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2089
|
-
".ts",
|
|
2090
|
-
".tsx",
|
|
2091
|
-
".js",
|
|
2092
|
-
".jsx",
|
|
2093
|
-
".mjs",
|
|
2094
|
-
".cjs",
|
|
2095
|
-
".mts",
|
|
2096
|
-
".cts"
|
|
2097
|
-
]);
|
|
2098
1904
|
function timestamp() {
|
|
2099
1905
|
return (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").slice(0, 19);
|
|
2100
1906
|
}
|