@toolforge-js/sdk 0.5.0 → 0.7.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/dist/cli/index.js CHANGED
@@ -13,7 +13,8 @@ import chokidar from "chokidar";
13
13
  import picocolors from "picocolors";
14
14
  import * as fs from "node:fs/promises";
15
15
  import * as os from "node:os";
16
- import { capitalize, kebabCase } from "es-toolkit/string";
16
+ import { camelCase, capitalize, kebabCase } from "es-toolkit/string";
17
+ import esbuild from "esbuild";
17
18
 
18
19
  //#region ../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/error.js
19
20
  var require_error = /* @__PURE__ */ __commonJS({ "../../node_modules/.bun/commander@14.0.2/node_modules/commander/lib/error.js": ((exports) => {
@@ -3041,87 +3042,181 @@ const { program, createCommand, createArgument, createOption, CommanderError, In
3041
3042
 
3042
3043
  //#endregion
3043
3044
  //#region src/internal/utils.ts
3045
+ const TOOL_FORGE_BUILD_DIR = ".toolforge";
3046
+ const TOOL_FORGE_BUILD_BUNDLE_FILE = "tools-bundle.js";
3047
+ async function setupOutputDir(outDir, shouldClean = true) {
3048
+ if (shouldClean) await fs.rm(outDir, {
3049
+ recursive: true,
3050
+ force: true
3051
+ });
3052
+ if (!await fs.exists(outDir)) await fs.mkdir(outDir, { recursive: true });
3053
+ return outDir;
3054
+ }
3044
3055
  /**
3045
- * Recursively gather forge items from the specified directory.
3056
+ * Gather forge items from the specified directory.
3057
+ * In production mode, loads the bundled tools from the build directory.
3058
+ * In development mode, gathers tool and agent entries and bundles them using esbuild.
3059
+ */
3060
+ async function gatherForgeItems(toolsDir, mode, logger) {
3061
+ if (mode === "production") {
3062
+ const bundleFilePath = path.resolve(process.cwd(), TOOL_FORGE_BUILD_DIR, TOOL_FORGE_BUILD_BUNDLE_FILE);
3063
+ logger.debug("loading bundled tools from %s", bundleFilePath);
3064
+ if (!await fs.exists(bundleFilePath)) throw new Error(`tools bundle not found at ${bundleFilePath}, please build the tools before loading in production mode`);
3065
+ return await import(bundleFilePath);
3066
+ }
3067
+ const { forgeItems, toolEntries, agentEntries } = await gatherToolAndAgentEntries(toolsDir, mode, logger);
3068
+ if (forgeItems.length || toolEntries.length || agentEntries.length) return await import(`${await bundleForge({
3069
+ toolEntries,
3070
+ agentEntries,
3071
+ forgeItems,
3072
+ toolsDir,
3073
+ logger
3074
+ })}?t=${Date.now()}`);
3075
+ return {
3076
+ forgeItems: [],
3077
+ tools: {},
3078
+ agents: {}
3079
+ };
3080
+ }
3081
+ /**
3082
+ * Gather tool and agent entries from the specified directory.
3046
3083
  * Ignores files and directories starting with '-'.
3047
3084
  * Uses cache busting in development mode to ensure the latest version of tools are loaded.
3085
+ * Returns the gathered forge items along with tool and agent entries.
3086
+ *
3087
+ * A tool entry contains the variable name (camelCase of the tool ID), ID, and relative path to the tool file.
3088
+ * An agent entry contains the variable name (camelCase of the agent ID), ID, and relative path to the agent file.
3089
+ * forgeItems is an array of ForgeItem objects representing the tools, agents, and directories.
3048
3090
  */
3049
- async function gatherForgeItems(toolsDir, mode, logger) {
3091
+ async function gatherToolAndAgentEntries(toolsDir, mode, logger) {
3050
3092
  const forgeItems = [];
3051
- const tools = {};
3052
- const agents = {};
3093
+ const toolEntries = [];
3094
+ const agentEntries = [];
3053
3095
  const nodes = [{
3054
3096
  dir: toolsDir,
3055
3097
  depth: -1
3056
3098
  }];
3057
3099
  while (nodes.length) {
3058
3100
  const node = nodes.pop();
3059
- if (node.dir.startsWith("-")) {
3060
- logger.warn(`skipping ${node} as it starts with -`);
3061
- continue;
3062
- }
3063
- const content = await fs.readdir(node.dir);
3064
- for (const item of content) {
3065
- if (item.startsWith("-")) continue;
3066
- const itemPath = path.join(node.dir, item);
3067
- const stat = await fs.stat(itemPath);
3101
+ const children = await fs.readdir(node.dir, { withFileTypes: true });
3102
+ for (const child of children) {
3103
+ if (child.name.startsWith("-")) {
3104
+ logger.debug(`skipping ${child.name} as it starts with -`);
3105
+ continue;
3106
+ }
3107
+ const itemPath = path.join(node.dir, child.name);
3068
3108
  const parent = toolsDir === node.dir ? void 0 : kebabCase(path.relative(toolsDir, node.dir));
3069
- const id = kebabCase(path.relative(toolsDir, itemPath));
3070
- if (stat.isDirectory()) {
3109
+ const itemId = kebabCase(path.relative(toolsDir, itemPath));
3110
+ if (child.isDirectory()) {
3071
3111
  nodes.push({
3072
3112
  dir: itemPath,
3073
3113
  depth: node.depth + 1
3074
3114
  });
3075
3115
  forgeItems.push({
3076
- id,
3116
+ id: itemId,
3077
3117
  type: "DIRECTORY",
3078
- name: convertToWords(item).map(capitalize).join(" "),
3118
+ name: convertToWords(child.name).map(capitalize).join(" "),
3079
3119
  parent,
3080
3120
  depth: node.depth + 1
3081
3121
  });
3082
- } else if (stat.isFile() && itemPath.endsWith(".ts")) try {
3083
- const fileExports = await (mode === "development" ? import(`${itemPath}?t=${Date.now()}`) : import(itemPath));
3084
- if ("default" in fileExports) {
3122
+ } else if (child.isFile() && (child.name.endsWith(".ts") || child.name.endsWith(".js"))) {
3123
+ const importPath = mode === "development" ? `${itemPath}?t=${Date.now()}` : itemPath;
3124
+ const id = itemId.replace(/(-ts|-js)$/, "");
3125
+ const fileExports = await import(importPath);
3126
+ if ("default" in fileExports && typeof fileExports.default === "object") {
3085
3127
  const defaultExport = fileExports.default;
3086
- if (typeof defaultExport !== "object") {
3087
- logger.warn(`default export in ${itemPath} is not an object, skipping`);
3088
- continue;
3089
- }
3090
3128
  if (isToolDefinition(defaultExport)) {
3091
- const toolId = id.replace(/-ts$/, "");
3092
3129
  forgeItems.push({
3093
3130
  type: "TOOL",
3094
- id: toolId,
3131
+ id,
3095
3132
  name: defaultExport.name,
3096
3133
  description: defaultExport.description,
3097
3134
  parent,
3098
3135
  depth: node.depth + 1
3099
3136
  });
3100
- tools[toolId] = defaultExport;
3137
+ toolEntries.push({
3138
+ variableName: camelCase(id),
3139
+ id,
3140
+ relPath: path.relative(toolsDir, itemPath)
3141
+ });
3101
3142
  } else if (isAgentDefinition(defaultExport)) {
3102
- const agentId = id.replace(/-ts$/, "");
3103
3143
  forgeItems.push({
3104
3144
  type: "AGENT",
3105
- id: agentId,
3145
+ id,
3106
3146
  name: defaultExport.name,
3107
3147
  description: defaultExport.description,
3108
3148
  parent,
3109
3149
  depth: node.depth + 1
3110
3150
  });
3111
- agents[agentId] = defaultExport;
3151
+ agentEntries.push({
3152
+ variableName: camelCase(id),
3153
+ id,
3154
+ relPath: path.relative(toolsDir, itemPath)
3155
+ });
3112
3156
  } else logger.warn(`default export in ${itemPath} is not a valid Tool or Agent definition, skipping`);
3113
3157
  }
3114
- } catch (error) {
3115
- logger.warn({ error }, "failed to load tool from %s", itemPath);
3116
3158
  }
3117
3159
  }
3118
3160
  }
3119
3161
  return {
3120
3162
  forgeItems,
3121
- tools,
3122
- agents
3163
+ toolEntries,
3164
+ agentEntries
3123
3165
  };
3124
3166
  }
3167
+ /**
3168
+ * Bundle the provided tool and agent entries using esbuild.
3169
+ * Generates an entry file that imports all tools and agents and exports them as records.
3170
+ * Outputs the bundled file to the build directory.
3171
+ * Returns the imported bundle module.
3172
+ */
3173
+ async function bundleForge({ toolEntries, agentEntries, forgeItems, toolsDir, logger }) {
3174
+ if (toolEntries.length || agentEntries.length || forgeItems.length) {
3175
+ const entryFileContentGroups = [];
3176
+ if (toolEntries.length) {
3177
+ const toolImports = toolEntries.map(({ variableName, relPath }) => `import tool_${variableName} from './${relPath.replace(/(.ts|.js)$/, "")}'`).join("\n");
3178
+ entryFileContentGroups.push(toolImports);
3179
+ const toolsRecord = `export const tools: Record<string, ToolDefinition> = {
3180
+ ${toolEntries.map(({ variableName, id }) => ` '${id}': tool_${variableName},`).join("\n")}
3181
+ }`;
3182
+ entryFileContentGroups.push(toolsRecord);
3183
+ }
3184
+ if (agentEntries.length) {
3185
+ const agentImports = agentEntries.map(({ variableName, relPath }) => `import agent_${variableName} from './${relPath.replace(/(.ts|.js)$/, "")}'`).join("\n");
3186
+ entryFileContentGroups.push(agentImports);
3187
+ const agentsRecord = `export const agents: Record<string, AgentDefinition> = {
3188
+ ${agentEntries.map(({ variableName, id }) => ` '${id}': agent_${variableName},`).join("\n")}
3189
+ }`;
3190
+ entryFileContentGroups.push(agentsRecord);
3191
+ }
3192
+ if (forgeItems.length) {
3193
+ const forgeItemsRecord = `export const forgeItems: ForgeItem[] = ${JSON.stringify(forgeItems, null, 2)}`;
3194
+ entryFileContentGroups.push(forgeItemsRecord);
3195
+ }
3196
+ const entryFileContent = entryFileContentGroups.join("\n\n");
3197
+ logger.debug(`generate file content\n${"-".repeat(70)}\n%s\n${"-".repeat(70)}`, entryFileContent);
3198
+ const outDir = path.resolve(process.cwd(), TOOL_FORGE_BUILD_DIR);
3199
+ const bundleFilePath = path.resolve(outDir, TOOL_FORGE_BUILD_BUNDLE_FILE);
3200
+ logger.debug("bundling tools to %s", bundleFilePath);
3201
+ await setupOutputDir(outDir);
3202
+ logger.debug("ensured output directory exists at %s", outDir);
3203
+ logger.debug("starting esbuild bundling...");
3204
+ await esbuild.build({
3205
+ stdin: {
3206
+ contents: entryFileContent,
3207
+ resolveDir: toolsDir,
3208
+ loader: "ts"
3209
+ },
3210
+ bundle: true,
3211
+ platform: "node",
3212
+ outfile: bundleFilePath,
3213
+ logLevel: "error",
3214
+ format: "esm"
3215
+ });
3216
+ logger.debug("esbuild bundling completed");
3217
+ return bundleFilePath;
3218
+ }
3219
+ }
3125
3220
  function isToolDefinition(obj) {
3126
3221
  return "__tf__tag__name__" in obj && obj.__tf__tag__name__ === TOOL_TAG_NAME && "handler" in obj && typeof obj.handler === "function" && "__tf__tag__name__" in obj.handler && obj.handler.__tf__tag__name__ === TOOL_HANDLER_TAG_NAME;
3127
3222
  }
@@ -3706,7 +3801,15 @@ var ForgeRunner = class extends EventEmitter {
3706
3801
  //#region src/cli/index.ts
3707
3802
  const version = JSON.parse(readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8")).version;
3708
3803
  program.name("toolforge-js").description("Tool Forge SDK").version(version);
3709
- program.command("dev").option("-c, --config <path>", "path to the tool-forge config file", "toolforge.config.ts").option("-d, --debug", "enable debug logging", false).action(async function startServer() {
3804
+ program.command("dev").description("start the tool forge development server").option("-c, --config <path>", "path to the tool-forge config file", "toolforge.config.ts").option("-d, --debug", "enable debug logging", false).action(async function startServer() {
3805
+ const debug = z$1.boolean().optional().default(false).parse(this.opts().debug);
3806
+ await startToolForge({
3807
+ configRelPath: z$1.string().parse(this.opts().config),
3808
+ debug,
3809
+ mode: "development"
3810
+ });
3811
+ });
3812
+ program.command("build").description("build the tools for production").option("-c, --config <path>", "path to the tool-forge config file", "toolforge.config.ts").option("-d, --debug", "enable debug logging", false).action(async function() {
3710
3813
  const logger = pino({
3711
3814
  level: z$1.boolean().optional().default(false).parse(this.opts().debug) ? "debug" : "info",
3712
3815
  transport: { target: "pino-pretty" }
@@ -3716,7 +3819,43 @@ program.command("dev").option("-c, --config <path>", "path to the tool-forge con
3716
3819
  const configPath = path.resolve(process.cwd(), configRelPath);
3717
3820
  const config = toolForgeConfigSchema.parse(await import(configPath).then((mod) => mod.default));
3718
3821
  logger.debug({ config }, "loaded config from %s", configPath);
3719
- const runner = new ForgeRunner(config, { mode: "development" }, logger);
3822
+ const toolsDir = path.resolve(process.cwd(), config.toolsDir);
3823
+ const { toolEntries, agentEntries, forgeItems } = await gatherToolAndAgentEntries(toolsDir, "production", logger);
3824
+ if (forgeItems.length === 0) {
3825
+ logger.warn("no tools or agents found to build");
3826
+ process.exit(0);
3827
+ }
3828
+ await bundleForge({
3829
+ toolEntries,
3830
+ agentEntries,
3831
+ forgeItems,
3832
+ toolsDir,
3833
+ logger
3834
+ });
3835
+ logger.info("tools built successfully");
3836
+ } catch (error) {
3837
+ logger.error(error, "failed to build tools");
3838
+ process.exit(1);
3839
+ }
3840
+ });
3841
+ program.command("start").description("start the tool forge server in production mode").option("-c, --config <path>", "path to the tool-forge config file", "toolforge.config.ts").option("-d, --debug", "enable debug logging", false).action(async function startServer() {
3842
+ const debug = z$1.boolean().optional().default(false).parse(this.opts().debug);
3843
+ await startToolForge({
3844
+ configRelPath: z$1.string().parse(this.opts().config),
3845
+ debug,
3846
+ mode: "production"
3847
+ });
3848
+ });
3849
+ async function startToolForge({ configRelPath, debug, mode }) {
3850
+ const logger = pino({
3851
+ level: debug ? "debug" : "info",
3852
+ transport: { target: "pino-pretty" }
3853
+ });
3854
+ try {
3855
+ const configPath = path.resolve(process.cwd(), configRelPath);
3856
+ const config = toolForgeConfigSchema.parse(await import(configPath).then((mod) => mod.default));
3857
+ logger.debug({ config }, "loaded config from %s", configPath);
3858
+ const runner = new ForgeRunner(config, { mode }, logger);
3720
3859
  runner.on("error", async (error) => {
3721
3860
  logger.error(error, "tool runner error - shutting down");
3722
3861
  await runner.stop();
@@ -3736,7 +3875,7 @@ program.command("dev").option("-c, --config <path>", "path to the tool-forge con
3736
3875
  logger.error(error, "failed to start tool runner");
3737
3876
  process.exit(1);
3738
3877
  }
3739
- });
3878
+ }
3740
3879
  program.parse(Bun.argv);
3741
3880
 
3742
3881
  //#endregion
@@ -99,8 +99,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
99
99
  chartType: z$1.ZodLiteral<"progress-bar">;
100
100
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
101
101
  default: "default";
102
- success: "success";
103
102
  error: "error";
103
+ success: "success";
104
104
  neutral: "neutral";
105
105
  warning: "warning";
106
106
  }>>>;
@@ -111,8 +111,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
111
111
  chartType: z$1.ZodLiteral<"progress-circle">;
112
112
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
113
113
  default: "default";
114
- success: "success";
115
114
  error: "error";
115
+ success: "success";
116
116
  neutral: "neutral";
117
117
  warning: "warning";
118
118
  }>>>;
@@ -615,8 +615,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
615
615
  label: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNumber]>>;
616
616
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
617
617
  default: "default";
618
- success: "success";
619
618
  error: "error";
619
+ success: "success";
620
620
  neutral: "neutral";
621
621
  warning: "warning";
622
622
  }>>>;
@@ -630,8 +630,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
630
630
  radius: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
631
631
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
632
632
  default: "default";
633
- success: "success";
634
633
  error: "error";
634
+ success: "success";
635
635
  neutral: "neutral";
636
636
  warning: "warning";
637
637
  }>>>;
@@ -888,8 +888,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
888
888
  chartType: z$1.ZodLiteral<"progress-bar">;
889
889
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
890
890
  default: "default";
891
- success: "success";
892
891
  error: "error";
892
+ success: "success";
893
893
  neutral: "neutral";
894
894
  warning: "warning";
895
895
  }>>>;
@@ -900,8 +900,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
900
900
  chartType: z$1.ZodLiteral<"progress-circle">;
901
901
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
902
902
  default: "default";
903
- success: "success";
904
903
  error: "error";
904
+ success: "success";
905
905
  neutral: "neutral";
906
906
  warning: "warning";
907
907
  }>>>;
@@ -1404,8 +1404,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1404
1404
  label: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNumber]>>;
1405
1405
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1406
1406
  default: "default";
1407
- success: "success";
1408
1407
  error: "error";
1408
+ success: "success";
1409
1409
  neutral: "neutral";
1410
1410
  warning: "warning";
1411
1411
  }>>>;
@@ -1419,8 +1419,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1419
1419
  radius: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
1420
1420
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1421
1421
  default: "default";
1422
- success: "success";
1423
1422
  error: "error";
1423
+ success: "success";
1424
1424
  neutral: "neutral";
1425
1425
  warning: "warning";
1426
1426
  }>>>;
@@ -1655,8 +1655,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1655
1655
  type: z$1.ZodLiteral<"badge">;
1656
1656
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1657
1657
  default: "default";
1658
- success: "success";
1659
1658
  error: "error";
1659
+ success: "success";
1660
1660
  neutral: "neutral";
1661
1661
  warning: "warning";
1662
1662
  }>>>;
@@ -1678,8 +1678,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1678
1678
  maxValue: z$1.ZodNumber;
1679
1679
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1680
1680
  default: "default";
1681
- success: "success";
1682
1681
  error: "error";
1682
+ success: "success";
1683
1683
  neutral: "neutral";
1684
1684
  warning: "warning";
1685
1685
  }>>>;
@@ -1769,8 +1769,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1769
1769
  type: z$1.ZodLiteral<"badge">;
1770
1770
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1771
1771
  default: "default";
1772
- success: "success";
1773
1772
  error: "error";
1773
+ success: "success";
1774
1774
  neutral: "neutral";
1775
1775
  warning: "warning";
1776
1776
  }>>>;
@@ -1792,8 +1792,8 @@ declare const showMessageMessageSchema: z$1.ZodObject<{
1792
1792
  maxValue: z$1.ZodNumber;
1793
1793
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
1794
1794
  default: "default";
1795
- success: "success";
1796
1795
  error: "error";
1796
+ success: "success";
1797
1797
  neutral: "neutral";
1798
1798
  warning: "warning";
1799
1799
  }>>>;
@@ -2913,8 +2913,8 @@ declare const chartBlock: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
2913
2913
  label: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNumber]>>;
2914
2914
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
2915
2915
  default: "default";
2916
- success: "success";
2917
2916
  error: "error";
2917
+ success: "success";
2918
2918
  neutral: "neutral";
2919
2919
  warning: "warning";
2920
2920
  }>>>;
@@ -2928,8 +2928,8 @@ declare const chartBlock: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
2928
2928
  radius: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
2929
2929
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
2930
2930
  default: "default";
2931
- success: "success";
2932
2931
  error: "error";
2932
+ success: "success";
2933
2933
  neutral: "neutral";
2934
2934
  warning: "warning";
2935
2935
  }>>>;
@@ -3304,8 +3304,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
3304
3304
  chartType: z$1.ZodLiteral<"progress-bar">;
3305
3305
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
3306
3306
  default: "default";
3307
- success: "success";
3308
3307
  error: "error";
3308
+ success: "success";
3309
3309
  neutral: "neutral";
3310
3310
  warning: "warning";
3311
3311
  }>>>;
@@ -3316,8 +3316,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
3316
3316
  chartType: z$1.ZodLiteral<"progress-circle">;
3317
3317
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
3318
3318
  default: "default";
3319
- success: "success";
3320
3319
  error: "error";
3320
+ success: "success";
3321
3321
  neutral: "neutral";
3322
3322
  warning: "warning";
3323
3323
  }>>>;
@@ -3820,8 +3820,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
3820
3820
  label: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNumber]>>;
3821
3821
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
3822
3822
  default: "default";
3823
- success: "success";
3824
3823
  error: "error";
3824
+ success: "success";
3825
3825
  neutral: "neutral";
3826
3826
  warning: "warning";
3827
3827
  }>>>;
@@ -3835,8 +3835,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
3835
3835
  radius: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
3836
3836
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
3837
3837
  default: "default";
3838
- success: "success";
3839
3838
  error: "error";
3839
+ success: "success";
3840
3840
  neutral: "neutral";
3841
3841
  warning: "warning";
3842
3842
  }>>>;
@@ -4093,8 +4093,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4093
4093
  chartType: z$1.ZodLiteral<"progress-bar">;
4094
4094
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4095
4095
  default: "default";
4096
- success: "success";
4097
4096
  error: "error";
4097
+ success: "success";
4098
4098
  neutral: "neutral";
4099
4099
  warning: "warning";
4100
4100
  }>>>;
@@ -4105,8 +4105,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4105
4105
  chartType: z$1.ZodLiteral<"progress-circle">;
4106
4106
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4107
4107
  default: "default";
4108
- success: "success";
4109
4108
  error: "error";
4109
+ success: "success";
4110
4110
  neutral: "neutral";
4111
4111
  warning: "warning";
4112
4112
  }>>>;
@@ -4609,8 +4609,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4609
4609
  label: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNumber]>>;
4610
4610
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4611
4611
  default: "default";
4612
- success: "success";
4613
4612
  error: "error";
4613
+ success: "success";
4614
4614
  neutral: "neutral";
4615
4615
  warning: "warning";
4616
4616
  }>>>;
@@ -4624,8 +4624,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4624
4624
  radius: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
4625
4625
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4626
4626
  default: "default";
4627
- success: "success";
4628
4627
  error: "error";
4628
+ success: "success";
4629
4629
  neutral: "neutral";
4630
4630
  warning: "warning";
4631
4631
  }>>>;
@@ -4860,8 +4860,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4860
4860
  type: z$1.ZodLiteral<"badge">;
4861
4861
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4862
4862
  default: "default";
4863
- success: "success";
4864
4863
  error: "error";
4864
+ success: "success";
4865
4865
  neutral: "neutral";
4866
4866
  warning: "warning";
4867
4867
  }>>>;
@@ -4883,8 +4883,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4883
4883
  maxValue: z$1.ZodNumber;
4884
4884
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4885
4885
  default: "default";
4886
- success: "success";
4887
4886
  error: "error";
4887
+ success: "success";
4888
4888
  neutral: "neutral";
4889
4889
  warning: "warning";
4890
4890
  }>>>;
@@ -4974,8 +4974,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4974
4974
  type: z$1.ZodLiteral<"badge">;
4975
4975
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4976
4976
  default: "default";
4977
- success: "success";
4978
4977
  error: "error";
4978
+ success: "success";
4979
4979
  neutral: "neutral";
4980
4980
  warning: "warning";
4981
4981
  }>>>;
@@ -4997,8 +4997,8 @@ declare const blockSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
4997
4997
  maxValue: z$1.ZodNumber;
4998
4998
  variant: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodEnum<{
4999
4999
  default: "default";
5000
- success: "success";
5001
5000
  error: "error";
5001
+ success: "success";
5002
5002
  neutral: "neutral";
5003
5003
  warning: "warning";
5004
5004
  }>>>;
@@ -5074,7 +5074,7 @@ declare class Block {
5074
5074
  type: "number" | "currency" | "percentage";
5075
5075
  decimals: number;
5076
5076
  currency: string;
5077
- currencyDisplay: "symbol" | "name" | "code";
5077
+ currencyDisplay: "symbol" | "code" | "name";
5078
5078
  thousandsSeparator: string;
5079
5079
  decimalSeparator: string;
5080
5080
  showPercentageSymbol: boolean;
@@ -5111,7 +5111,7 @@ declare class Block {
5111
5111
  type: "number" | "currency" | "percentage";
5112
5112
  decimals: number;
5113
5113
  currency: string;
5114
- currencyDisplay: "symbol" | "name" | "code";
5114
+ currencyDisplay: "symbol" | "code" | "name";
5115
5115
  thousandsSeparator: string;
5116
5116
  decimalSeparator: string;
5117
5117
  showPercentageSymbol: boolean;
@@ -5180,7 +5180,7 @@ declare class Block {
5180
5180
  type: "number" | "currency" | "percentage";
5181
5181
  decimals: number;
5182
5182
  currency: string;
5183
- currencyDisplay: "symbol" | "name" | "code";
5183
+ currencyDisplay: "symbol" | "code" | "name";
5184
5184
  thousandsSeparator: string;
5185
5185
  decimalSeparator: string;
5186
5186
  showPercentageSymbol: boolean;
@@ -5215,7 +5215,7 @@ declare class Block {
5215
5215
  type: "number" | "currency" | "percentage";
5216
5216
  decimals: number;
5217
5217
  currency: string;
5218
- currencyDisplay: "symbol" | "name" | "code";
5218
+ currencyDisplay: "symbol" | "code" | "name";
5219
5219
  thousandsSeparator: string;
5220
5220
  decimalSeparator: string;
5221
5221
  showPercentageSymbol: boolean;
@@ -5235,7 +5235,7 @@ declare class Block {
5235
5235
  chartType: "progress-bar";
5236
5236
  value: number;
5237
5237
  max: number;
5238
- variant: "error" | "default" | "success" | "neutral" | "warning";
5238
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5239
5239
  title?: string | undefined;
5240
5240
  description?: string | undefined;
5241
5241
  label?: string | number | undefined;
@@ -5251,7 +5251,7 @@ declare class Block {
5251
5251
  value: number;
5252
5252
  max: number;
5253
5253
  radius: number;
5254
- variant: "error" | "default" | "success" | "neutral" | "warning";
5254
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5255
5255
  title?: string | undefined;
5256
5256
  description?: string | undefined;
5257
5257
  };
@@ -5315,7 +5315,7 @@ declare class Block {
5315
5315
  type: "number" | "currency" | "percentage";
5316
5316
  decimals: number;
5317
5317
  currency: string;
5318
- currencyDisplay: "symbol" | "name" | "code";
5318
+ currencyDisplay: "symbol" | "code" | "name";
5319
5319
  thousandsSeparator: string;
5320
5320
  decimalSeparator: string;
5321
5321
  showPercentageSymbol: boolean;
@@ -5336,7 +5336,7 @@ declare class Block {
5336
5336
  type: "number" | "currency" | "percentage";
5337
5337
  decimals: number;
5338
5338
  currency: string;
5339
- currencyDisplay: "symbol" | "name" | "code";
5339
+ currencyDisplay: "symbol" | "code" | "name";
5340
5340
  thousandsSeparator: string;
5341
5341
  decimalSeparator: string;
5342
5342
  showPercentageSymbol: boolean;
@@ -5381,7 +5381,7 @@ declare class Block {
5381
5381
  type: "number" | "currency" | "percentage";
5382
5382
  decimals: number;
5383
5383
  currency: string;
5384
- currencyDisplay: "symbol" | "name" | "code";
5384
+ currencyDisplay: "symbol" | "code" | "name";
5385
5385
  thousandsSeparator: string;
5386
5386
  decimalSeparator: string;
5387
5387
  showPercentageSymbol: boolean;
@@ -5406,7 +5406,7 @@ declare class Block {
5406
5406
  type: "number" | "currency" | "percentage";
5407
5407
  decimals: number;
5408
5408
  currency: string;
5409
- currencyDisplay: "symbol" | "name" | "code";
5409
+ currencyDisplay: "symbol" | "code" | "name";
5410
5410
  thousandsSeparator: string;
5411
5411
  decimalSeparator: string;
5412
5412
  showPercentageSymbol: boolean;
@@ -5416,7 +5416,7 @@ declare class Block {
5416
5416
  suffix?: string | undefined;
5417
5417
  } | undefined;
5418
5418
  change?: string | number | undefined;
5419
- changeType?: "neutral" | "positive" | "negative" | undefined;
5419
+ changeType?: "positive" | "negative" | "neutral" | undefined;
5420
5420
  chart?: {
5421
5421
  values: (number | {
5422
5422
  value: number;
@@ -5436,14 +5436,14 @@ declare class Block {
5436
5436
  type: "chart";
5437
5437
  max: number;
5438
5438
  chartType: "progress-bar";
5439
- variant: "error" | "default" | "success" | "neutral" | "warning";
5439
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5440
5440
  label?: string | number | undefined;
5441
5441
  } | {
5442
5442
  value: number;
5443
5443
  type: "chart";
5444
5444
  max: number;
5445
5445
  chartType: "progress-circle";
5446
- variant: "error" | "default" | "success" | "neutral" | "warning";
5446
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5447
5447
  radius: number;
5448
5448
  } | {
5449
5449
  data: Record<string, any>[];
@@ -5486,7 +5486,7 @@ declare class Block {
5486
5486
  type: "default";
5487
5487
  } | {
5488
5488
  type: "badge";
5489
- variant: "error" | "default" | "success" | "neutral" | "warning";
5489
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5490
5490
  } | {
5491
5491
  type: "image";
5492
5492
  width: number;
@@ -5496,7 +5496,7 @@ declare class Block {
5496
5496
  type: "progress";
5497
5497
  chartType: "bar" | "circle";
5498
5498
  maxValue: number;
5499
- variant: "error" | "default" | "success" | "neutral" | "warning";
5499
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5500
5500
  } | {
5501
5501
  type: "link";
5502
5502
  target: "_blank" | "_self";
@@ -5507,7 +5507,7 @@ declare class Block {
5507
5507
  type: "number" | "currency" | "percentage";
5508
5508
  decimals: number;
5509
5509
  currency: string;
5510
- currencyDisplay: "symbol" | "name" | "code";
5510
+ currencyDisplay: "symbol" | "code" | "name";
5511
5511
  thousandsSeparator: string;
5512
5512
  decimalSeparator: string;
5513
5513
  showPercentageSymbol: boolean;
@@ -5572,7 +5572,7 @@ declare class Block {
5572
5572
  type: "number" | "currency" | "percentage";
5573
5573
  decimals: number;
5574
5574
  currency: string;
5575
- currencyDisplay: "symbol" | "name" | "code";
5575
+ currencyDisplay: "symbol" | "code" | "name";
5576
5576
  thousandsSeparator: string;
5577
5577
  decimalSeparator: string;
5578
5578
  showPercentageSymbol: boolean;
@@ -5582,7 +5582,7 @@ declare class Block {
5582
5582
  suffix?: string | undefined;
5583
5583
  } | undefined;
5584
5584
  change?: string | number | undefined;
5585
- changeType?: "neutral" | "positive" | "negative" | undefined;
5585
+ changeType?: "positive" | "negative" | "neutral" | undefined;
5586
5586
  chart?: {
5587
5587
  values: (number | {
5588
5588
  value: number;
@@ -5602,14 +5602,14 @@ declare class Block {
5602
5602
  type: "chart";
5603
5603
  max: number;
5604
5604
  chartType: "progress-bar";
5605
- variant: "error" | "default" | "success" | "neutral" | "warning";
5605
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5606
5606
  label?: string | number | undefined;
5607
5607
  } | {
5608
5608
  value: number;
5609
5609
  type: "chart";
5610
5610
  max: number;
5611
5611
  chartType: "progress-circle";
5612
- variant: "error" | "default" | "success" | "neutral" | "warning";
5612
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5613
5613
  radius: number;
5614
5614
  } | {
5615
5615
  data: Record<string, any>[];
@@ -5654,7 +5654,7 @@ declare class Block {
5654
5654
  type: "number" | "currency" | "percentage";
5655
5655
  decimals: number;
5656
5656
  currency: string;
5657
- currencyDisplay: "symbol" | "name" | "code";
5657
+ currencyDisplay: "symbol" | "code" | "name";
5658
5658
  thousandsSeparator: string;
5659
5659
  decimalSeparator: string;
5660
5660
  showPercentageSymbol: boolean;
@@ -5687,7 +5687,7 @@ declare class Block {
5687
5687
  type: "number" | "currency" | "percentage";
5688
5688
  decimals: number;
5689
5689
  currency: string;
5690
- currencyDisplay: "symbol" | "name" | "code";
5690
+ currencyDisplay: "symbol" | "code" | "name";
5691
5691
  thousandsSeparator: string;
5692
5692
  decimalSeparator: string;
5693
5693
  showPercentageSymbol: boolean;
@@ -5717,7 +5717,7 @@ declare class Block {
5717
5717
  type: "number" | "currency" | "percentage";
5718
5718
  decimals: number;
5719
5719
  currency: string;
5720
- currencyDisplay: "symbol" | "name" | "code";
5720
+ currencyDisplay: "symbol" | "code" | "name";
5721
5721
  thousandsSeparator: string;
5722
5722
  decimalSeparator: string;
5723
5723
  showPercentageSymbol: boolean;
@@ -5738,7 +5738,7 @@ declare class Block {
5738
5738
  type: "number" | "currency" | "percentage";
5739
5739
  decimals: number;
5740
5740
  currency: string;
5741
- currencyDisplay: "symbol" | "name" | "code";
5741
+ currencyDisplay: "symbol" | "code" | "name";
5742
5742
  thousandsSeparator: string;
5743
5743
  decimalSeparator: string;
5744
5744
  showPercentageSymbol: boolean;
@@ -5798,7 +5798,7 @@ declare class Block {
5798
5798
  type: "number" | "currency" | "percentage";
5799
5799
  decimals: number;
5800
5800
  currency: string;
5801
- currencyDisplay: "symbol" | "name" | "code";
5801
+ currencyDisplay: "symbol" | "code" | "name";
5802
5802
  thousandsSeparator: string;
5803
5803
  decimalSeparator: string;
5804
5804
  showPercentageSymbol: boolean;
@@ -5829,7 +5829,7 @@ declare class Block {
5829
5829
  type: "number" | "currency" | "percentage";
5830
5830
  decimals: number;
5831
5831
  currency: string;
5832
- currencyDisplay: "symbol" | "name" | "code";
5832
+ currencyDisplay: "symbol" | "code" | "name";
5833
5833
  thousandsSeparator: string;
5834
5834
  decimalSeparator: string;
5835
5835
  showPercentageSymbol: boolean;
@@ -5843,7 +5843,7 @@ declare class Block {
5843
5843
  chartType: "progress-bar";
5844
5844
  value: number;
5845
5845
  max: number;
5846
- variant: "error" | "default" | "success" | "neutral" | "warning";
5846
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5847
5847
  title?: string | undefined;
5848
5848
  description?: string | undefined;
5849
5849
  label?: string | number | undefined;
@@ -5853,7 +5853,7 @@ declare class Block {
5853
5853
  value: number;
5854
5854
  max: number;
5855
5855
  radius: number;
5856
- variant: "error" | "default" | "success" | "neutral" | "warning";
5856
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5857
5857
  title?: string | undefined;
5858
5858
  description?: string | undefined;
5859
5859
  } | {
@@ -5901,7 +5901,7 @@ declare class Block {
5901
5901
  type: "number" | "currency" | "percentage";
5902
5902
  decimals: number;
5903
5903
  currency: string;
5904
- currencyDisplay: "symbol" | "name" | "code";
5904
+ currencyDisplay: "symbol" | "code" | "name";
5905
5905
  thousandsSeparator: string;
5906
5906
  decimalSeparator: string;
5907
5907
  showPercentageSymbol: boolean;
@@ -5924,7 +5924,7 @@ declare class Block {
5924
5924
  type: "default";
5925
5925
  } | {
5926
5926
  type: "badge";
5927
- variant: "error" | "default" | "success" | "neutral" | "warning";
5927
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5928
5928
  } | {
5929
5929
  type: "image";
5930
5930
  width: number;
@@ -5934,7 +5934,7 @@ declare class Block {
5934
5934
  type: "progress";
5935
5935
  chartType: "bar" | "circle";
5936
5936
  maxValue: number;
5937
- variant: "error" | "default" | "success" | "neutral" | "warning";
5937
+ variant: "error" | "success" | "default" | "neutral" | "warning";
5938
5938
  } | {
5939
5939
  type: "link";
5940
5940
  target: "_blank" | "_self";
@@ -5945,7 +5945,7 @@ declare class Block {
5945
5945
  type: "number" | "currency" | "percentage";
5946
5946
  decimals: number;
5947
5947
  currency: string;
5948
- currencyDisplay: "symbol" | "name" | "code";
5948
+ currencyDisplay: "symbol" | "code" | "name";
5949
5949
  thousandsSeparator: string;
5950
5950
  decimalSeparator: string;
5951
5951
  showPercentageSymbol: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolforge-js/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "chokidar": "4.0.3",
21
21
  "es-toolkit": "1.39.10",
22
+ "esbuild": "0.27.0",
22
23
  "nanoid": "5.1.5",
23
24
  "picocolors": "1.1.1",
24
25
  "pino": "9.11.0",