skedyul 1.4.10 → 1.5.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
@@ -649,7 +649,7 @@ function setNgrokAuthtoken(authtoken) {
649
649
  saveConfig(config);
650
650
  }
651
651
  async function startOAuthCallback(serverUrl) {
652
- return new Promise((resolve15, reject) => {
652
+ return new Promise((resolve16, reject) => {
653
653
  let timeoutId = null;
654
654
  const cleanup = () => {
655
655
  if (timeoutId) {
@@ -711,7 +711,7 @@ async function startOAuthCallback(serverUrl) {
711
711
  `);
712
712
  cleanup();
713
713
  server2.close();
714
- resolve15({
714
+ resolve16({
715
715
  token,
716
716
  userId,
717
717
  username,
@@ -765,10 +765,10 @@ async function openBrowser(url) {
765
765
  } else {
766
766
  command = `xdg-open "${url}"`;
767
767
  }
768
- return new Promise((resolve15, reject) => {
768
+ return new Promise((resolve16, reject) => {
769
769
  exec(command, (error) => {
770
770
  if (error) reject(error);
771
- else resolve15();
771
+ else resolve16();
772
772
  });
773
773
  });
774
774
  }
@@ -2797,13 +2797,13 @@ function mergeRuntimeEnv() {
2797
2797
 
2798
2798
  // src/server/utils/http.ts
2799
2799
  function readRawRequestBody(req) {
2800
- return new Promise((resolve15, reject) => {
2800
+ return new Promise((resolve16, reject) => {
2801
2801
  let body = "";
2802
2802
  req.on("data", (chunk) => {
2803
2803
  body += chunk.toString();
2804
2804
  });
2805
2805
  req.on("end", () => {
2806
- resolve15(body);
2806
+ resolve16(body);
2807
2807
  });
2808
2808
  req.on("error", reject);
2809
2809
  });
@@ -3303,7 +3303,7 @@ function printStartupLog(config, tools, port) {
3303
3303
 
3304
3304
  // src/server/route-handlers/adapters.ts
3305
3305
  function fromLambdaEvent(event2) {
3306
- const path24 = event2.path || event2.rawPath || "/";
3306
+ const path25 = event2.path || event2.rawPath || "/";
3307
3307
  const method = event2.httpMethod || event2.requestContext?.http?.method || "POST";
3308
3308
  const forwardedProto = event2.headers?.["x-forwarded-proto"] ?? event2.headers?.["X-Forwarded-Proto"];
3309
3309
  const protocol = forwardedProto ?? "https";
@@ -3311,9 +3311,9 @@ function fromLambdaEvent(event2) {
3311
3311
  const queryString = event2.queryStringParameters ? "?" + new URLSearchParams(
3312
3312
  event2.queryStringParameters
3313
3313
  ).toString() : "";
3314
- const url = `${protocol}://${host}${path24}${queryString}`;
3314
+ const url = `${protocol}://${host}${path25}${queryString}`;
3315
3315
  return {
3316
- path: path24,
3316
+ path: path25,
3317
3317
  method,
3318
3318
  headers: event2.headers,
3319
3319
  query: event2.queryStringParameters ?? {},
@@ -3863,7 +3863,7 @@ async function handleOAuthCallback(parsedBody, hooks) {
3863
3863
  }
3864
3864
 
3865
3865
  // src/server/handlers/webhook-handler.ts
3866
- function parseWebhookRequest(parsedBody, method, url, path24, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
3866
+ function parseWebhookRequest(parsedBody, method, url, path25, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
3867
3867
  const isEnvelope = typeof parsedBody === "object" && parsedBody !== null && "env" in parsedBody && "request" in parsedBody && "context" in parsedBody;
3868
3868
  if (isEnvelope) {
3869
3869
  const envelope = parsedBody;
@@ -3917,7 +3917,7 @@ function parseWebhookRequest(parsedBody, method, url, path24, headers, query, ra
3917
3917
  const webhookRequest = {
3918
3918
  method,
3919
3919
  url,
3920
- path: path24,
3920
+ path: path25,
3921
3921
  headers,
3922
3922
  query,
3923
3923
  body: parsedBody,
@@ -4366,9 +4366,9 @@ async function handleMcpBatchRoute(req, ctx) {
4366
4366
  }
4367
4367
  const perCallTimeoutMs = deadline ? Math.min(deadline, 25e3) : 25e3;
4368
4368
  const executeWithTimeout = async (call, timeoutMs) => {
4369
- return new Promise(async (resolve15) => {
4369
+ return new Promise(async (resolve16) => {
4370
4370
  const timeoutHandle = setTimeout(() => {
4371
- resolve15({
4371
+ resolve16({
4372
4372
  id: call.id,
4373
4373
  success: false,
4374
4374
  error: "Timeout",
@@ -4381,7 +4381,7 @@ async function handleMcpBatchRoute(req, ctx) {
4381
4381
  const found = findToolInRegistry(ctx.registry, toolName);
4382
4382
  if (!found) {
4383
4383
  clearTimeout(timeoutHandle);
4384
- resolve15({
4384
+ resolve16({
4385
4385
  id: call.id,
4386
4386
  success: false,
4387
4387
  error: `Tool "${toolName}" not found`
@@ -4399,13 +4399,13 @@ async function handleMcpBatchRoute(req, ctx) {
4399
4399
  clearTimeout(timeoutHandle);
4400
4400
  const isFailure = "success" in toolResult && toolResult.success === false || "error" in toolResult && toolResult.error != null;
4401
4401
  if (isFailure) {
4402
- resolve15({
4402
+ resolve16({
4403
4403
  id: call.id,
4404
4404
  success: false,
4405
4405
  error: "error" in toolResult && toolResult.error ? typeof toolResult.error === "string" ? toolResult.error : JSON.stringify(toolResult.error) : "Tool execution failed"
4406
4406
  });
4407
4407
  } else {
4408
- resolve15({
4408
+ resolve16({
4409
4409
  id: call.id,
4410
4410
  success: true,
4411
4411
  result: "output" in toolResult ? toolResult.output : toolResult
@@ -4413,7 +4413,7 @@ async function handleMcpBatchRoute(req, ctx) {
4413
4413
  }
4414
4414
  } catch (err) {
4415
4415
  clearTimeout(timeoutHandle);
4416
- resolve15({
4416
+ resolve16({
4417
4417
  id: call.id,
4418
4418
  success: false,
4419
4419
  error: err instanceof Error ? err.message : String(err)
@@ -4599,21 +4599,21 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
4599
4599
  return {
4600
4600
  async listen(listenPort) {
4601
4601
  const finalPort = listenPort ?? port;
4602
- return new Promise((resolve15, reject) => {
4602
+ return new Promise((resolve16, reject) => {
4603
4603
  httpServer.listen(finalPort, () => {
4604
4604
  printStartupLog(config, tools, finalPort);
4605
- resolve15();
4605
+ resolve16();
4606
4606
  });
4607
4607
  httpServer.once("error", reject);
4608
4608
  });
4609
4609
  },
4610
4610
  async close() {
4611
- return new Promise((resolve15, reject) => {
4611
+ return new Promise((resolve16, reject) => {
4612
4612
  const closable = httpServer;
4613
4613
  closable.closeAllConnections?.();
4614
4614
  httpServer.close((err) => {
4615
4615
  if (err) reject(err);
4616
- else resolve15();
4616
+ else resolve16();
4617
4617
  });
4618
4618
  });
4619
4619
  },
@@ -5010,11 +5010,11 @@ async function promptForMigrationApproval(impacts) {
5010
5010
  console.log("");
5011
5011
  console.log("These changes cannot be undone. Data will be permanently deleted.");
5012
5012
  console.log("");
5013
- return new Promise((resolve15) => {
5013
+ return new Promise((resolve16) => {
5014
5014
  rl.question("Do you want to proceed? (yes/no): ", (answer) => {
5015
5015
  rl.close();
5016
5016
  const normalized = answer.toLowerCase().trim();
5017
- resolve15(normalized === "yes" || normalized === "y");
5017
+ resolve16(normalized === "yes" || normalized === "y");
5018
5018
  });
5019
5019
  });
5020
5020
  }
@@ -5067,7 +5067,7 @@ async function waitForMigrationCompletion(serverUrl, token, migrationId, timeout
5067
5067
  );
5068
5068
  } catch {
5069
5069
  }
5070
- await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
5070
+ await new Promise((resolve16) => setTimeout(resolve16, pollInterval));
5071
5071
  }
5072
5072
  process.stdout.write("\n");
5073
5073
  return { completed: false, timedOut: true, denied: false };
@@ -5221,7 +5221,7 @@ async function promptInput(question, hidden = false) {
5221
5221
  input: process.stdin,
5222
5222
  output: process.stdout
5223
5223
  });
5224
- return new Promise((resolve15) => {
5224
+ return new Promise((resolve16) => {
5225
5225
  if (hidden) {
5226
5226
  process.stdout.write(question);
5227
5227
  let input = "";
@@ -5236,7 +5236,7 @@ async function promptInput(question, hidden = false) {
5236
5236
  if (stdin.setRawMode) stdin.setRawMode(wasRaw ?? false);
5237
5237
  process.stdout.write("\n");
5238
5238
  rl.close();
5239
- resolve15(input);
5239
+ resolve16(input);
5240
5240
  } else if (char === "") {
5241
5241
  process.exit(0);
5242
5242
  } else if (char === "\x7F" || char === "\b") {
@@ -5251,7 +5251,7 @@ async function promptInput(question, hidden = false) {
5251
5251
  } else {
5252
5252
  rl.question(question, (answer) => {
5253
5253
  rl.close();
5254
- resolve15(answer.trim());
5254
+ resolve16(answer.trim());
5255
5255
  });
5256
5256
  }
5257
5257
  });
@@ -5412,12 +5412,12 @@ var HEARTBEAT_INTERVAL_MS = 30 * 1e3;
5412
5412
  var DEFAULT_PORT = 6e4;
5413
5413
  var MAX_PORT_ATTEMPTS = 100;
5414
5414
  async function isPortAvailable(port) {
5415
- return new Promise((resolve15) => {
5415
+ return new Promise((resolve16) => {
5416
5416
  const server2 = net.createServer();
5417
- server2.once("error", () => resolve15(false));
5417
+ server2.once("error", () => resolve16(false));
5418
5418
  server2.once("listening", () => {
5419
5419
  server2.close();
5420
- resolve15(true);
5420
+ resolve16(true);
5421
5421
  });
5422
5422
  server2.listen(port, "127.0.0.1");
5423
5423
  });
@@ -5867,54 +5867,114 @@ Press Ctrl+C to stop`);
5867
5867
  }
5868
5868
 
5869
5869
  // src/cli/commands/validate.ts
5870
- var fs13 = __toESM(require("fs"));
5871
- var path13 = __toESM(require("path"));
5870
+ var fs14 = __toESM(require("fs"));
5871
+ var path14 = __toESM(require("path"));
5872
5872
  init_utils();
5873
5873
 
5874
5874
  // src/config/loader.ts
5875
+ var fs11 = __toESM(require("fs"));
5876
+ var path11 = __toESM(require("path"));
5877
+ var os2 = __toESM(require("os"));
5878
+
5879
+ // src/config/transpileConfigMetadata.ts
5880
+ var esbuild = __toESM(require("esbuild"));
5875
5881
  var fs10 = __toESM(require("fs"));
5876
5882
  var path10 = __toESM(require("path"));
5877
- var os2 = __toESM(require("os"));
5883
+ var SKEDYUL_SHIM_NAMESPACE = "skedyul-shim";
5884
+ var METADATA_STUB_NAMESPACE = "metadata-stub";
5885
+ function prepareConfigSource(content) {
5886
+ return content.replace(/import\s*\(\s*(['"])([^'"]+)\1\s*\)/g, "Promise.resolve(null)");
5887
+ }
5888
+ function isJsonImport(importPath) {
5889
+ return importPath.endsWith(".json");
5890
+ }
5891
+ async function transpileConfigMetadata(configPath) {
5892
+ const absolutePath = path10.resolve(configPath);
5893
+ const configDir = path10.dirname(absolutePath);
5894
+ const configBasename = path10.basename(absolutePath);
5895
+ const result = await esbuild.build({
5896
+ absWorkingDir: configDir,
5897
+ entryPoints: [absolutePath],
5898
+ bundle: true,
5899
+ format: "cjs",
5900
+ platform: "node",
5901
+ target: "node22",
5902
+ write: false,
5903
+ logLevel: "silent",
5904
+ plugins: [
5905
+ {
5906
+ name: "prepare-config-entry",
5907
+ setup(build2) {
5908
+ build2.onLoad({ filter: new RegExp(`/${configBasename.replace(".", "\\.")}$`) }, () => ({
5909
+ contents: prepareConfigSource(fs10.readFileSync(absolutePath, "utf-8")),
5910
+ loader: "ts"
5911
+ }));
5912
+ }
5913
+ },
5914
+ {
5915
+ name: "skedyul-shim",
5916
+ setup(build2) {
5917
+ build2.onResolve({ filter: /^skedyul$/ }, () => ({
5918
+ path: "skedyul-shim",
5919
+ namespace: SKEDYUL_SHIM_NAMESPACE
5920
+ }));
5921
+ build2.onLoad({ filter: /.*/, namespace: SKEDYUL_SHIM_NAMESPACE }, () => ({
5922
+ contents: [
5923
+ "function defineConfig(config) { return config; }",
5924
+ "module.exports = { defineConfig };"
5925
+ ].join("\n"),
5926
+ loader: "js"
5927
+ }));
5928
+ }
5929
+ },
5930
+ {
5931
+ name: "metadata-stub-imports",
5932
+ setup(build2) {
5933
+ build2.onResolve({ filter: /^\.{1,2}\// }, (args2) => {
5934
+ if (isJsonImport(args2.path)) {
5935
+ return void 0;
5936
+ }
5937
+ return {
5938
+ path: args2.path,
5939
+ namespace: METADATA_STUB_NAMESPACE
5940
+ };
5941
+ });
5942
+ build2.onLoad({ filter: /.*/, namespace: METADATA_STUB_NAMESPACE }, () => ({
5943
+ contents: "module.exports = {};\n",
5944
+ loader: "js"
5945
+ }));
5946
+ }
5947
+ }
5948
+ ]
5949
+ });
5950
+ if (result.errors.length > 0) {
5951
+ throw new Error(result.errors.map((error) => error.text).join("\n"));
5952
+ }
5953
+ if (result.outputFiles.length === 0) {
5954
+ throw new Error("Config transpile produced no output");
5955
+ }
5956
+ return result.outputFiles[0].text;
5957
+ }
5958
+
5959
+ // src/config/loader.ts
5878
5960
  var CONFIG_FILE_NAMES = [
5879
5961
  "skedyul.config.ts",
5880
5962
  "skedyul.config.js",
5881
5963
  "skedyul.config.mjs",
5882
5964
  "skedyul.config.cjs"
5883
5965
  ];
5884
- async function transpileTypeScript(filePath) {
5885
- const content = fs10.readFileSync(filePath, "utf-8");
5886
- const configDir = path10.dirname(path10.resolve(filePath));
5887
- let transpiled = content.replace(/import\s+type\s+\{[^}]+\}\s+from\s+['"][^'"]+['"]\s*;?\n?/g, "").replace(/import\s+\{\s*defineConfig\s*\}\s+from\s+['"]skedyul['"]\s*;?\n?/g, "").replace(/:\s*SkedyulConfig/g, "").replace(/export\s+default\s+/, "module.exports = ").replace(/defineConfig\s*\(\s*\{/, "{").replace(/\}\s*\)\s*;?\s*$/, "}");
5888
- transpiled = transpiled.replace(
5889
- /import\s+(\w+)\s+from\s+['"](\.[^'"]+)['"]\s*(?:with\s*\{[^}]*\})?/g,
5890
- (_match, varName, relativePath) => {
5891
- const absolutePath = path10.resolve(configDir, relativePath);
5892
- return `const ${varName} = require('${absolutePath.replace(/\\/g, "/")}')`;
5893
- }
5894
- );
5895
- transpiled = transpiled.replace(
5896
- /import\s+\{\s*([^}]+)\s*\}\s+from\s+['"](\.[^'"]+)['"]\s*;?\n?/g,
5897
- (_match, namedImports, relativePath) => {
5898
- const absolutePath = path10.resolve(configDir, relativePath);
5899
- return `const { ${namedImports.trim()} } = require('${absolutePath.replace(/\\/g, "/")}')
5900
- `;
5901
- }
5902
- );
5903
- transpiled = transpiled.replace(/import\s*\(\s*['"][^'"]+['"]\s*\)/g, "null");
5904
- return transpiled;
5905
- }
5906
5966
  async function loadConfig(configPath) {
5907
- const absolutePath = path10.resolve(configPath);
5908
- if (!fs10.existsSync(absolutePath)) {
5967
+ const absolutePath = path11.resolve(configPath);
5968
+ if (!fs11.existsSync(absolutePath)) {
5909
5969
  throw new Error(`Config file not found: ${absolutePath}`);
5910
5970
  }
5911
5971
  const isTypeScript = absolutePath.endsWith(".ts");
5912
5972
  try {
5913
5973
  if (isTypeScript) {
5914
5974
  try {
5915
- const transpiled = await transpileTypeScript(absolutePath);
5916
- const tempFile = path10.join(os2.tmpdir(), `skedyul-config-${Date.now()}.cjs`);
5917
- fs10.writeFileSync(tempFile, transpiled);
5975
+ const transpiled = await transpileConfigMetadata(absolutePath);
5976
+ const tempFile = path11.join(os2.tmpdir(), `skedyul-config-${Date.now()}.cjs`);
5977
+ fs11.writeFileSync(tempFile, transpiled);
5918
5978
  try {
5919
5979
  const module3 = require(tempFile);
5920
5980
  const config2 = module3.default || module3;
@@ -5927,7 +5987,7 @@ async function loadConfig(configPath) {
5927
5987
  return config2;
5928
5988
  } finally {
5929
5989
  try {
5930
- fs10.unlinkSync(tempFile);
5990
+ fs11.unlinkSync(tempFile);
5931
5991
  } catch {
5932
5992
  }
5933
5993
  }
@@ -5967,8 +6027,8 @@ function validateConfig(config) {
5967
6027
  }
5968
6028
 
5969
6029
  // src/config/schema-loader.ts
5970
- var fs11 = __toESM(require("fs"));
5971
- var path11 = __toESM(require("path"));
6030
+ var fs12 = __toESM(require("fs"));
6031
+ var path12 = __toESM(require("path"));
5972
6032
  var os3 = __toESM(require("os"));
5973
6033
 
5974
6034
  // src/schemas/crm-schema.ts
@@ -6121,39 +6181,39 @@ function validateCRMSchema(data) {
6121
6181
 
6122
6182
  // src/config/schema-loader.ts
6123
6183
  async function transpileSchemaTypeScript(filePath) {
6124
- const content = fs11.readFileSync(filePath, "utf-8");
6184
+ const content = fs12.readFileSync(filePath, "utf-8");
6125
6185
  let transpiled = content.replace(/import\s+type\s+\{[^}]+\}\s+from\s+['"][^'"]+['"]\s*;?\n?/g, "").replace(/import\s+\{\s*defineSchema\s*\}\s+from\s+['"]skedyul['"]\s*;?\n?/g, "").replace(/:\s*CRMSchema/g, "").replace(/export\s+default\s+/, "module.exports = ").replace(/defineSchema\s*\(\s*\{/, "{").replace(/\}\s*\)\s*;?\s*$/, "}");
6126
6186
  return transpiled;
6127
6187
  }
6128
6188
  async function loadSchema(schemaPath, options = {}) {
6129
6189
  const { validate = true } = options;
6130
- const absolutePath = path11.resolve(schemaPath);
6131
- if (!fs11.existsSync(absolutePath)) {
6190
+ const absolutePath = path12.resolve(schemaPath);
6191
+ if (!fs12.existsSync(absolutePath)) {
6132
6192
  throw new Error(`Schema file not found: ${absolutePath}`);
6133
6193
  }
6134
6194
  const isTypeScript = absolutePath.endsWith(".ts");
6135
6195
  const isJson = absolutePath.endsWith(".json");
6136
6196
  if (!isTypeScript && !isJson) {
6137
6197
  throw new Error(
6138
- `Unsupported schema file format: ${path11.extname(absolutePath)}. Use .schema.ts or .schema.json`
6198
+ `Unsupported schema file format: ${path12.extname(absolutePath)}. Use .schema.ts or .schema.json`
6139
6199
  );
6140
6200
  }
6141
6201
  let rawSchema;
6142
6202
  try {
6143
6203
  if (isJson) {
6144
- const content = fs11.readFileSync(absolutePath, "utf-8");
6204
+ const content = fs12.readFileSync(absolutePath, "utf-8");
6145
6205
  rawSchema = JSON.parse(content);
6146
6206
  } else {
6147
6207
  const transpiled = await transpileSchemaTypeScript(absolutePath);
6148
6208
  const tempDir = os3.tmpdir();
6149
- const tempFile = path11.join(tempDir, `skedyul-schema-${Date.now()}.cjs`);
6150
- fs11.writeFileSync(tempFile, transpiled);
6209
+ const tempFile = path12.join(tempDir, `skedyul-schema-${Date.now()}.cjs`);
6210
+ fs12.writeFileSync(tempFile, transpiled);
6151
6211
  try {
6152
6212
  const module2 = require(tempFile);
6153
6213
  rawSchema = module2.default || module2;
6154
6214
  } finally {
6155
6215
  try {
6156
- fs11.unlinkSync(tempFile);
6216
+ fs12.unlinkSync(tempFile);
6157
6217
  } catch {
6158
6218
  }
6159
6219
  }
@@ -6198,10 +6258,10 @@ export default defineSchema(${jsonContent})
6198
6258
  `;
6199
6259
  }
6200
6260
  async function saveSchema(schema, outputPath, options = {}) {
6201
- const absolutePath = path11.resolve(outputPath);
6261
+ const absolutePath = path12.resolve(outputPath);
6202
6262
  const isTypeScript = absolutePath.endsWith(".ts");
6203
6263
  const content = isTypeScript ? serializeSchemaToTypeScript(schema) : serializeSchemaToJson(schema, options);
6204
- fs11.writeFileSync(absolutePath, content, "utf-8");
6264
+ fs12.writeFileSync(absolutePath, content, "utf-8");
6205
6265
  }
6206
6266
  var FIELD_TYPE_MAP = {
6207
6267
  string: "STRING",
@@ -6348,8 +6408,8 @@ function transformToBackendSchema(schema) {
6348
6408
  }
6349
6409
 
6350
6410
  // src/config/resolver.ts
6351
- var fs12 = __toESM(require("fs"));
6352
- var path12 = __toESM(require("path"));
6411
+ var fs13 = __toESM(require("fs"));
6412
+ var path13 = __toESM(require("path"));
6353
6413
  async function loadConfigModule(absolutePath) {
6354
6414
  if (absolutePath.endsWith(".ts")) {
6355
6415
  const altPaths = [
@@ -6358,7 +6418,7 @@ async function loadConfigModule(absolutePath) {
6358
6418
  absolutePath.replace(".ts", ".js")
6359
6419
  ];
6360
6420
  for (const altPath of altPaths) {
6361
- if (fs12.existsSync(altPath)) {
6421
+ if (fs13.existsSync(altPath)) {
6362
6422
  return await import(altPath);
6363
6423
  }
6364
6424
  }
@@ -6375,7 +6435,7 @@ async function loadConfigModule(absolutePath) {
6375
6435
  return await import(absolutePath);
6376
6436
  }
6377
6437
  async function loadAndResolveConfig(configPath) {
6378
- const absolutePath = path12.resolve(configPath);
6438
+ const absolutePath = path13.resolve(configPath);
6379
6439
  const module2 = await loadConfigModule(absolutePath);
6380
6440
  const config = module2.default;
6381
6441
  if (!config || typeof config !== "object") {
@@ -6429,7 +6489,8 @@ function serializeResolvedConfig(config) {
6429
6489
  description: tool.description,
6430
6490
  // Read timeout/retries from top-level first, then fallback to config
6431
6491
  timeout: tool.timeout ?? tool.config?.timeout,
6432
- retries: tool.retries ?? tool.config?.retries
6492
+ retries: tool.retries ?? tool.config?.retries,
6493
+ queueTouchPoints: tool.queueTouchPoints ?? tool.config?.queueTouchPoints
6433
6494
  })) : [],
6434
6495
  webhooks: config.webhooks ? Object.values(config.webhooks).map((w) => ({
6435
6496
  name: w.name,
@@ -6481,8 +6542,8 @@ Examples:
6481
6542
  }
6482
6543
  function findConfigFile2(startDir) {
6483
6544
  for (const fileName of CONFIG_FILE_NAMES) {
6484
- const filePath = path13.join(startDir, fileName);
6485
- if (fs13.existsSync(filePath)) {
6545
+ const filePath = path14.join(startDir, fileName);
6546
+ if (fs14.existsSync(filePath)) {
6486
6547
  return filePath;
6487
6548
  }
6488
6549
  }
@@ -6516,9 +6577,9 @@ async function validateCommand(args2) {
6516
6577
  }
6517
6578
  configPath = foundConfig;
6518
6579
  } else {
6519
- configPath = path13.resolve(process.cwd(), configPath);
6580
+ configPath = path14.resolve(process.cwd(), configPath);
6520
6581
  }
6521
- if (!fs13.existsSync(configPath)) {
6582
+ if (!fs14.existsSync(configPath)) {
6522
6583
  const result2 = {
6523
6584
  valid: false,
6524
6585
  configPath,
@@ -6563,8 +6624,8 @@ async function validateCommand(args2) {
6563
6624
  if (provision?.workflows) {
6564
6625
  for (const workflow of provision.workflows) {
6565
6626
  if (workflow.path) {
6566
- const absoluteWorkflowPath = path13.resolve(path13.dirname(configPath), workflow.path);
6567
- if (!fs13.existsSync(absoluteWorkflowPath)) {
6627
+ const absoluteWorkflowPath = path14.resolve(path14.dirname(configPath), workflow.path);
6628
+ if (!fs14.existsSync(absoluteWorkflowPath)) {
6568
6629
  warnings.push(`Workflow file not found: ${workflow.path}`);
6569
6630
  }
6570
6631
  }
@@ -6659,8 +6720,8 @@ async function validateCommand(args2) {
6659
6720
  }
6660
6721
 
6661
6722
  // src/cli/commands/diff.ts
6662
- var fs14 = __toESM(require("fs"));
6663
- var path14 = __toESM(require("path"));
6723
+ var fs15 = __toESM(require("fs"));
6724
+ var path15 = __toESM(require("path"));
6664
6725
  init_utils();
6665
6726
  function printHelp6() {
6666
6727
  console.log(`
@@ -6693,8 +6754,8 @@ Examples:
6693
6754
  }
6694
6755
  function findConfigFile3(startDir) {
6695
6756
  for (const fileName of CONFIG_FILE_NAMES) {
6696
- const filePath = path14.join(startDir, fileName);
6697
- if (fs14.existsSync(filePath)) {
6757
+ const filePath = path15.join(startDir, fileName);
6758
+ if (fs15.existsSync(filePath)) {
6698
6759
  return filePath;
6699
6760
  }
6700
6761
  }
@@ -6750,9 +6811,9 @@ async function diffCommand(args2) {
6750
6811
  }
6751
6812
  configPath = foundConfig;
6752
6813
  } else {
6753
- configPath = path14.resolve(process.cwd(), configPath);
6814
+ configPath = path15.resolve(process.cwd(), configPath);
6754
6815
  }
6755
- if (!fs14.existsSync(configPath)) {
6816
+ if (!fs15.existsSync(configPath)) {
6756
6817
  if (jsonOutput) {
6757
6818
  console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
6758
6819
  } else {
@@ -6794,7 +6855,7 @@ async function diffCommand(args2) {
6794
6855
  const registryPath = flags.registry || flags.r;
6795
6856
  if (registryPath) {
6796
6857
  try {
6797
- const registry = await loadRegistry(path14.resolve(process.cwd(), registryPath));
6858
+ const registry = await loadRegistry(path15.resolve(process.cwd(), registryPath));
6798
6859
  const toolNames = Object.values(registry).map((t) => t.name);
6799
6860
  toolsDiff = {
6800
6861
  added: toolNames,
@@ -6867,8 +6928,8 @@ async function diffCommand(args2) {
6867
6928
  }
6868
6929
 
6869
6930
  // src/cli/commands/deploy.ts
6870
- var fs15 = __toESM(require("fs"));
6871
- var path15 = __toESM(require("path"));
6931
+ var fs16 = __toESM(require("fs"));
6932
+ var path16 = __toESM(require("path"));
6872
6933
  var readline3 = __toESM(require("readline"));
6873
6934
  init_utils();
6874
6935
  function printHelp7() {
@@ -6904,8 +6965,8 @@ Examples:
6904
6965
  }
6905
6966
  function findConfigFile4(startDir) {
6906
6967
  for (const fileName of CONFIG_FILE_NAMES) {
6907
- const filePath = path15.join(startDir, fileName);
6908
- if (fs15.existsSync(filePath)) {
6968
+ const filePath = path16.join(startDir, fileName);
6969
+ if (fs16.existsSync(filePath)) {
6909
6970
  return filePath;
6910
6971
  }
6911
6972
  }
@@ -6930,11 +6991,11 @@ async function promptForApproval(impacts) {
6930
6991
  console.log("");
6931
6992
  console.log("These changes cannot be undone. Data will be permanently deleted.");
6932
6993
  console.log("");
6933
- return new Promise((resolve15) => {
6994
+ return new Promise((resolve16) => {
6934
6995
  rl.question("Do you want to proceed? (yes/no): ", (answer) => {
6935
6996
  rl.close();
6936
6997
  const normalized = answer.toLowerCase().trim();
6937
- resolve15(normalized === "yes" || normalized === "y");
6998
+ resolve16(normalized === "yes" || normalized === "y");
6938
6999
  });
6939
7000
  });
6940
7001
  }
@@ -6970,7 +7031,7 @@ async function waitForMigrationApproval(serverUrl, token, migrationId, timeoutMs
6970
7031
  process.stdout.write(`\r Status: ${data.status} | Time remaining: ${remaining} minutes `);
6971
7032
  } catch {
6972
7033
  }
6973
- await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
7034
+ await new Promise((resolve16) => setTimeout(resolve16, pollInterval));
6974
7035
  }
6975
7036
  return { approved: false, timedOut: true };
6976
7037
  }
@@ -7019,9 +7080,9 @@ async function deployCommand(args2) {
7019
7080
  }
7020
7081
  configPath = foundConfig;
7021
7082
  } else {
7022
- configPath = path15.resolve(process.cwd(), configPath);
7083
+ configPath = path16.resolve(process.cwd(), configPath);
7023
7084
  }
7024
- if (!fs15.existsSync(configPath)) {
7085
+ if (!fs16.existsSync(configPath)) {
7025
7086
  if (jsonOutput) {
7026
7087
  console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
7027
7088
  } else {
@@ -7338,8 +7399,8 @@ async function logoutCommand(args2) {
7338
7399
  }
7339
7400
 
7340
7401
  // src/cli/commands/auth/status.ts
7341
- var fs16 = __toESM(require("fs"));
7342
- var path16 = __toESM(require("path"));
7402
+ var fs17 = __toESM(require("fs"));
7403
+ var path17 = __toESM(require("path"));
7343
7404
  init_utils();
7344
7405
  function printHelp10() {
7345
7406
  console.log(`
@@ -7413,17 +7474,17 @@ async function statusCommand(args2) {
7413
7474
  console.log("");
7414
7475
  console.log(" * = active profile");
7415
7476
  }
7416
- const linksDir = path16.join(process.cwd(), ".skedyul", "links");
7477
+ const linksDir = path17.join(process.cwd(), ".skedyul", "links");
7417
7478
  console.log("");
7418
7479
  console.log("LINKED WORKPLACES (this project)");
7419
7480
  console.log("\u2500".repeat(60));
7420
- if (fs16.existsSync(linksDir)) {
7421
- const linkFiles = fs16.readdirSync(linksDir).filter((f) => f.endsWith(".json"));
7481
+ if (fs17.existsSync(linksDir)) {
7482
+ const linkFiles = fs17.readdirSync(linksDir).filter((f) => f.endsWith(".json"));
7422
7483
  if (linkFiles.length > 0) {
7423
7484
  for (const file2 of linkFiles) {
7424
7485
  const subdomain = file2.replace(".json", "");
7425
7486
  try {
7426
- const content = fs16.readFileSync(path16.join(linksDir, file2), "utf-8");
7487
+ const content = fs17.readFileSync(path17.join(linksDir, file2), "utf-8");
7427
7488
  const link = JSON.parse(content);
7428
7489
  console.log(` - ${subdomain} (${link.appHandle})`);
7429
7490
  } catch {
@@ -7780,8 +7841,8 @@ EXAMPLES
7780
7841
  }
7781
7842
 
7782
7843
  // src/cli/commands/config-export.ts
7783
- var fs17 = __toESM(require("fs"));
7784
- var path17 = __toESM(require("path"));
7844
+ var fs18 = __toESM(require("fs"));
7845
+ var path18 = __toESM(require("path"));
7785
7846
  function printHelp13() {
7786
7847
  console.log(`
7787
7848
  SKEDYUL CONFIG:EXPORT - Export resolved config to JSON
@@ -7827,8 +7888,8 @@ async function configExportCommand(args2) {
7827
7888
  const cwd = process.cwd();
7828
7889
  let configPath = null;
7829
7890
  for (const name of CONFIG_FILE_NAMES) {
7830
- const testPath = path17.join(cwd, name);
7831
- if (fs17.existsSync(testPath)) {
7891
+ const testPath = path18.join(cwd, name);
7892
+ if (fs18.existsSync(testPath)) {
7832
7893
  configPath = testPath;
7833
7894
  break;
7834
7895
  }
@@ -7838,16 +7899,16 @@ async function configExportCommand(args2) {
7838
7899
  console.error("Make sure you are in the root of your integration project.");
7839
7900
  process.exit(1);
7840
7901
  }
7841
- console.log(`Loading config from ${path17.basename(configPath)}...`);
7902
+ console.log(`Loading config from ${path18.basename(configPath)}...`);
7842
7903
  try {
7843
7904
  const resolvedConfig = await loadAndResolveConfig(configPath);
7844
7905
  const serialized = serializeResolvedConfig(resolvedConfig);
7845
- const outputDir = path17.dirname(path17.resolve(cwd, outputPath));
7846
- if (!fs17.existsSync(outputDir)) {
7847
- fs17.mkdirSync(outputDir, { recursive: true });
7906
+ const outputDir = path18.dirname(path18.resolve(cwd, outputPath));
7907
+ if (!fs18.existsSync(outputDir)) {
7908
+ fs18.mkdirSync(outputDir, { recursive: true });
7848
7909
  }
7849
- const fullOutputPath = path17.resolve(cwd, outputPath);
7850
- fs17.writeFileSync(fullOutputPath, JSON.stringify(serialized, null, 2), "utf-8");
7910
+ const fullOutputPath = path18.resolve(cwd, outputPath);
7911
+ fs18.writeFileSync(fullOutputPath, JSON.stringify(serialized, null, 2), "utf-8");
7851
7912
  console.log(``);
7852
7913
  console.log(`Config exported successfully!`);
7853
7914
  console.log(` Output: ${outputPath}`);
@@ -8048,7 +8109,7 @@ async function promptHidden(question) {
8048
8109
  input: process.stdin,
8049
8110
  output: process.stdout
8050
8111
  });
8051
- return new Promise((resolve15) => {
8112
+ return new Promise((resolve16) => {
8052
8113
  process.stdout.write(question);
8053
8114
  let input = "";
8054
8115
  const stdin = process.stdin;
@@ -8062,7 +8123,7 @@ async function promptHidden(question) {
8062
8123
  if (stdin.setRawMode) stdin.setRawMode(wasRaw ?? false);
8063
8124
  process.stdout.write("\n");
8064
8125
  rl.close();
8065
- resolve15(input.trim());
8126
+ resolve16(input.trim());
8066
8127
  } else if (char === "") {
8067
8128
  process.exit(0);
8068
8129
  } else if (char === "\x7F" || char === "\b") {
@@ -8092,17 +8153,17 @@ async function prompt(options) {
8092
8153
  input: process.stdin,
8093
8154
  output: process.stdout
8094
8155
  });
8095
- return new Promise((resolve15) => {
8156
+ return new Promise((resolve16) => {
8096
8157
  const displayMessage = defaultValue ? `${message} [${defaultValue}]: ` : `${message}: `;
8097
8158
  rl.question(displayMessage, (answer) => {
8098
8159
  rl.close();
8099
8160
  const value = answer.trim() || defaultValue || "";
8100
8161
  if (required && !value) {
8101
8162
  console.error("Value is required.");
8102
- resolve15(prompt(options));
8163
+ resolve16(prompt(options));
8103
8164
  return;
8104
8165
  }
8105
- resolve15(value);
8166
+ resolve16(value);
8106
8167
  });
8107
8168
  });
8108
8169
  }
@@ -8489,8 +8550,8 @@ async function handleCreateMany(modelHandle, flags) {
8489
8550
  console.error("Usage: skedyul instances create-many <model> --file data.json --workplace <subdomain>");
8490
8551
  process.exit(1);
8491
8552
  }
8492
- const fs24 = await import("fs");
8493
- const fileContent = fs24.readFileSync(filePath, "utf-8");
8553
+ const fs25 = await import("fs");
8554
+ const fileContent = fs25.readFileSync(filePath, "utf-8");
8494
8555
  const items = JSON.parse(fileContent);
8495
8556
  if (!Array.isArray(items)) {
8496
8557
  console.error("Error: File must contain a JSON array of items");
@@ -8517,8 +8578,8 @@ async function handleUpsertMany(modelHandle, flags) {
8517
8578
  console.error("Usage: skedyul instances upsert-many <model> --file data.json --match-field <field> --workplace <subdomain>");
8518
8579
  process.exit(1);
8519
8580
  }
8520
- const fs24 = await import("fs");
8521
- const fileContent = fs24.readFileSync(filePath, "utf-8");
8581
+ const fs25 = await import("fs");
8582
+ const fileContent = fs25.readFileSync(filePath, "utf-8");
8522
8583
  const items = JSON.parse(fileContent);
8523
8584
  if (!Array.isArray(items)) {
8524
8585
  console.error("Error: File must contain a JSON array of items");
@@ -8530,8 +8591,8 @@ async function handleUpsertMany(modelHandle, flags) {
8530
8591
 
8531
8592
  // src/cli/commands/build.ts
8532
8593
  var import_child_process = require("child_process");
8533
- var fs18 = __toESM(require("fs"));
8534
- var path18 = __toESM(require("path"));
8594
+ var fs19 = __toESM(require("fs"));
8595
+ var path19 = __toESM(require("path"));
8535
8596
  function printBuildHelp() {
8536
8597
  console.log(`
8537
8598
  SKEDYUL BUILD - Build your integration
@@ -8600,8 +8661,8 @@ async function buildCommand(args2) {
8600
8661
  const cwd = process.cwd();
8601
8662
  let configPath = null;
8602
8663
  for (const name of CONFIG_FILE_NAMES) {
8603
- const testPath = path18.join(cwd, name);
8604
- if (fs18.existsSync(testPath)) {
8664
+ const testPath = path19.join(cwd, name);
8665
+ if (fs19.existsSync(testPath)) {
8605
8666
  configPath = testPath;
8606
8667
  break;
8607
8668
  }
@@ -8611,8 +8672,8 @@ async function buildCommand(args2) {
8611
8672
  console.error("Make sure you are in the root of your integration project.");
8612
8673
  process.exit(1);
8613
8674
  }
8614
- console.log(`Loading config from ${path18.basename(configPath)}...`);
8615
- const tempConfigPath = path18.join(cwd, ".skedyul-tsup.config.mjs");
8675
+ console.log(`Loading config from ${path19.basename(configPath)}...`);
8676
+ const tempConfigPath = path19.join(cwd, ".skedyul-tsup.config.mjs");
8616
8677
  let createdTempConfig = false;
8617
8678
  try {
8618
8679
  const config = await loadConfig(configPath);
@@ -8621,8 +8682,8 @@ async function buildCommand(args2) {
8621
8682
  const baseExternals = ["skedyul", `skedyul/${computeLayer}`, "zod"];
8622
8683
  const userExternals = config.build && "external" in config.build ? config.build.external ?? [] : [];
8623
8684
  const allExternals = [...baseExternals, ...userExternals];
8624
- const userTsupConfig = path18.join(cwd, "tsup.config.ts");
8625
- const hasUserConfig = fs18.existsSync(userTsupConfig);
8685
+ const userTsupConfig = path19.join(cwd, "tsup.config.ts");
8686
+ const hasUserConfig = fs19.existsSync(userTsupConfig);
8626
8687
  console.log(``);
8627
8688
  console.log(`Building ${config.name ?? "integration"}...`);
8628
8689
  console.log(` Compute layer: ${computeLayer}`);
@@ -8642,7 +8703,7 @@ async function buildCommand(args2) {
8642
8703
  }
8643
8704
  } else {
8644
8705
  const tsupConfigContent = generateTsupConfig(format, allExternals);
8645
- fs18.writeFileSync(tempConfigPath, tsupConfigContent, "utf-8");
8706
+ fs19.writeFileSync(tempConfigPath, tsupConfigContent, "utf-8");
8646
8707
  createdTempConfig = true;
8647
8708
  tsupArgs = [
8648
8709
  "tsup",
@@ -8660,14 +8721,14 @@ async function buildCommand(args2) {
8660
8721
  });
8661
8722
  tsup.on("error", (error) => {
8662
8723
  console.error("Failed to start tsup:", error.message);
8663
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8664
- fs18.unlinkSync(tempConfigPath);
8724
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8725
+ fs19.unlinkSync(tempConfigPath);
8665
8726
  }
8666
8727
  process.exit(1);
8667
8728
  });
8668
8729
  tsup.on("close", (code) => {
8669
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8670
- fs18.unlinkSync(tempConfigPath);
8730
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8731
+ fs19.unlinkSync(tempConfigPath);
8671
8732
  }
8672
8733
  if (code === 0) {
8673
8734
  console.log(``);
@@ -8676,8 +8737,8 @@ async function buildCommand(args2) {
8676
8737
  process.exit(code ?? 0);
8677
8738
  });
8678
8739
  } catch (error) {
8679
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8680
- fs18.unlinkSync(tempConfigPath);
8740
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8741
+ fs19.unlinkSync(tempConfigPath);
8681
8742
  }
8682
8743
  console.error(
8683
8744
  "Error loading config:",
@@ -8690,8 +8751,8 @@ async function buildCommand(args2) {
8690
8751
  // src/cli/commands/smoke-test.ts
8691
8752
  var import_child_process2 = require("child_process");
8692
8753
  var http3 = __toESM(require("http"));
8693
- var fs19 = __toESM(require("fs"));
8694
- var path19 = __toESM(require("path"));
8754
+ var fs20 = __toESM(require("fs"));
8755
+ var path20 = __toESM(require("path"));
8695
8756
  var SMOKE_TEST_PORT = 3456;
8696
8757
  var HEALTH_CHECK_INTERVAL_MS = 500;
8697
8758
  var HEALTH_CHECK_MAX_RETRIES = 30;
@@ -8722,13 +8783,13 @@ WHAT IT DOES
8722
8783
  6. Exits with code 0 (success) or 1 (failure)
8723
8784
  `);
8724
8785
  }
8725
- function makeRequest(port, path24, method, body) {
8726
- return new Promise((resolve15, reject) => {
8786
+ function makeRequest(port, path25, method, body) {
8787
+ return new Promise((resolve16, reject) => {
8727
8788
  const postData = body ? JSON.stringify(body) : void 0;
8728
8789
  const options = {
8729
8790
  hostname: "localhost",
8730
8791
  port,
8731
- path: path24,
8792
+ path: path25,
8732
8793
  method,
8733
8794
  headers: {
8734
8795
  "Content-Type": "application/json",
@@ -8744,9 +8805,9 @@ function makeRequest(port, path24, method, body) {
8744
8805
  res.on("end", () => {
8745
8806
  try {
8746
8807
  const parsed = data ? JSON.parse(data) : {};
8747
- resolve15({ status: res.statusCode ?? 0, body: parsed });
8808
+ resolve16({ status: res.statusCode ?? 0, body: parsed });
8748
8809
  } catch {
8749
- resolve15({ status: res.statusCode ?? 0, body: data });
8810
+ resolve16({ status: res.statusCode ?? 0, body: data });
8750
8811
  }
8751
8812
  });
8752
8813
  });
@@ -8766,7 +8827,7 @@ async function waitForHealth(port) {
8766
8827
  }
8767
8828
  } catch {
8768
8829
  }
8769
- await new Promise((resolve15) => setTimeout(resolve15, HEALTH_CHECK_INTERVAL_MS));
8830
+ await new Promise((resolve16) => setTimeout(resolve16, HEALTH_CHECK_INTERVAL_MS));
8770
8831
  }
8771
8832
  return false;
8772
8833
  }
@@ -8816,8 +8877,8 @@ async function smokeTestCommand(args2) {
8816
8877
  const cwd = process.cwd();
8817
8878
  let configPath = null;
8818
8879
  for (const name of CONFIG_FILE_NAMES) {
8819
- const testPath = path19.join(cwd, name);
8820
- if (fs19.existsSync(testPath)) {
8880
+ const testPath = path20.join(cwd, name);
8881
+ if (fs20.existsSync(testPath)) {
8821
8882
  configPath = testPath;
8822
8883
  break;
8823
8884
  }
@@ -8833,10 +8894,10 @@ async function smokeTestCommand(args2) {
8833
8894
  }
8834
8895
  const serverExt = computeLayer === "serverless" ? "mjs" : "js";
8835
8896
  let serverPath = `dist/server/mcp_server.${serverExt}`;
8836
- if (!fs19.existsSync(serverPath)) {
8897
+ if (!fs20.existsSync(serverPath)) {
8837
8898
  const fallbackExt = serverExt === "mjs" ? "js" : "mjs";
8838
8899
  const fallbackPath = `dist/server/mcp_server.${fallbackExt}`;
8839
- if (fs19.existsSync(fallbackPath)) {
8900
+ if (fs20.existsSync(fallbackPath)) {
8840
8901
  console.warn(`[SmokeTest] Warning: Expected ${serverPath} but found ${fallbackPath}`);
8841
8902
  console.warn(`[SmokeTest] Using ${fallbackPath} instead`);
8842
8903
  serverPath = fallbackPath;
@@ -8897,7 +8958,7 @@ async function smokeTestCommand(args2) {
8897
8958
  server2.on("error", (err) => {
8898
8959
  console.error(`[SmokeTest] Failed to spawn server: ${err.message}`);
8899
8960
  });
8900
- await new Promise((resolve15) => setTimeout(resolve15, 1e3));
8961
+ await new Promise((resolve16) => setTimeout(resolve16, 1e3));
8901
8962
  if (serverExited) {
8902
8963
  console.error("[SmokeTest] FAILED: Server crashed during startup");
8903
8964
  console.error(`[SmokeTest] Exit code: ${serverExitCode}`);
@@ -9046,11 +9107,11 @@ async function promptForApproval2(impacts) {
9046
9107
  console.log("");
9047
9108
  console.log("These changes cannot be undone. Data will be permanently deleted.");
9048
9109
  console.log("");
9049
- return new Promise((resolve15) => {
9110
+ return new Promise((resolve16) => {
9050
9111
  rl.question("Do you want to proceed? (yes/no): ", (answer) => {
9051
9112
  rl.close();
9052
9113
  const normalized = answer.toLowerCase().trim();
9053
- resolve15(normalized === "yes" || normalized === "y");
9114
+ resolve16(normalized === "yes" || normalized === "y");
9054
9115
  });
9055
9116
  });
9056
9117
  }
@@ -9354,8 +9415,8 @@ async function crmCommand(args2) {
9354
9415
  }
9355
9416
 
9356
9417
  // src/cli/commands/agents.ts
9357
- var fs20 = __toESM(require("fs"));
9358
- var path20 = __toESM(require("path"));
9418
+ var fs21 = __toESM(require("fs"));
9419
+ var path21 = __toESM(require("path"));
9359
9420
  var import_yaml = require("yaml");
9360
9421
  init_utils();
9361
9422
 
@@ -10416,11 +10477,11 @@ function isAgentV3(agent) {
10416
10477
  return "handle" in obj && !("stages" in obj) && !("agents" in obj);
10417
10478
  }
10418
10479
  async function loadAgentFile(filePath) {
10419
- const absolutePath = path20.resolve(filePath);
10420
- if (!fs20.existsSync(absolutePath)) {
10480
+ const absolutePath = path21.resolve(filePath);
10481
+ if (!fs21.existsSync(absolutePath)) {
10421
10482
  throw new Error(`Agent file not found: ${absolutePath}`);
10422
10483
  }
10423
- const content = fs20.readFileSync(absolutePath, "utf-8");
10484
+ const content = fs21.readFileSync(absolutePath, "utf-8");
10424
10485
  const isJson = absolutePath.endsWith(".json");
10425
10486
  const isYaml = absolutePath.endsWith(".yml") || absolutePath.endsWith(".yaml");
10426
10487
  let rawAgent;
@@ -10430,7 +10491,7 @@ async function loadAgentFile(filePath) {
10430
10491
  rawAgent = (0, import_yaml.parse)(content);
10431
10492
  } else {
10432
10493
  throw new Error(
10433
- `Unsupported agent file format: ${path20.extname(absolutePath)}. Use .agent.yml or .agent.json`
10494
+ `Unsupported agent file format: ${path21.extname(absolutePath)}. Use .agent.yml or .agent.json`
10434
10495
  );
10435
10496
  }
10436
10497
  const detectedV3 = isAgentV3(rawAgent);
@@ -10440,8 +10501,8 @@ async function loadAgentFile(filePath) {
10440
10501
  return { agent: v3Result.data, content, isV3: true };
10441
10502
  }
10442
10503
  const errorMessages = v3Result.error.issues.map((e) => {
10443
- const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
10444
- return ` - ${path24}: ${e.message}`;
10504
+ const path25 = e.path.length > 0 ? e.path.join(".") : "(root)";
10505
+ return ` - ${path25}: ${e.message}`;
10445
10506
  }).join("\n");
10446
10507
  throw new Error(`Agent v3 validation failed:
10447
10508
  ${errorMessages}`);
@@ -10453,8 +10514,8 @@ ${errorMessages}`);
10453
10514
  const v3Result = validateAgentYAMLV3(rawAgent);
10454
10515
  if (!v3Result.success) {
10455
10516
  const errorMessages2 = v3Result.error.issues.map((e) => {
10456
- const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
10457
- return ` - ${path24}: ${e.message}`;
10517
+ const path25 = e.path.length > 0 ? e.path.join(".") : "(root)";
10518
+ return ` - ${path25}: ${e.message}`;
10458
10519
  }).join("\n");
10459
10520
  throw new Error(`Agent v3 validation failed:
10460
10521
  ${errorMessages2}`);
@@ -11150,14 +11211,14 @@ async function* parseSSEStream(response, debug2 = false) {
11150
11211
  }
11151
11212
 
11152
11213
  // src/cli/utils/mock-context.ts
11153
- var fs21 = __toESM(require("fs"));
11154
- var path21 = __toESM(require("path"));
11214
+ var fs22 = __toESM(require("fs"));
11215
+ var path22 = __toESM(require("path"));
11155
11216
  function loadContext(filePath) {
11156
- const absolutePath = path21.resolve(filePath);
11157
- if (!fs21.existsSync(absolutePath)) {
11217
+ const absolutePath = path22.resolve(filePath);
11218
+ if (!fs22.existsSync(absolutePath)) {
11158
11219
  throw new Error(`Context file not found: ${absolutePath}`);
11159
11220
  }
11160
- const content = fs21.readFileSync(absolutePath, "utf-8");
11221
+ const content = fs22.readFileSync(absolutePath, "utf-8");
11161
11222
  let rawContext;
11162
11223
  try {
11163
11224
  rawContext = JSON.parse(content);
@@ -11694,9 +11755,9 @@ async function chatCommand(args2) {
11694
11755
  output: process.stdout
11695
11756
  });
11696
11757
  const askQuestion = (prompt2) => {
11697
- return new Promise((resolve15) => {
11758
+ return new Promise((resolve16) => {
11698
11759
  rl.question(prompt2, (answer) => {
11699
- resolve15(answer);
11760
+ resolve16(answer);
11700
11761
  });
11701
11762
  });
11702
11763
  };
@@ -12243,8 +12304,8 @@ Error: ${input.name} is required`);
12243
12304
  }
12244
12305
 
12245
12306
  // src/cli/commands/skills.ts
12246
- var fs22 = __toESM(require("fs"));
12247
- var path22 = __toESM(require("path"));
12307
+ var fs23 = __toESM(require("fs"));
12308
+ var path23 = __toESM(require("path"));
12248
12309
  var import_yaml2 = require("yaml");
12249
12310
  init_utils();
12250
12311
  function printHelp21() {
@@ -12316,12 +12377,12 @@ async function getWorkplaceToken6(workplaceSubdomain, serverUrl, cliToken) {
12316
12377
  );
12317
12378
  }
12318
12379
  async function loadSkillFile(filePath) {
12319
- const absolutePath = path22.resolve(filePath);
12320
- if (!fs22.existsSync(absolutePath)) {
12380
+ const absolutePath = path23.resolve(filePath);
12381
+ if (!fs23.existsSync(absolutePath)) {
12321
12382
  throw new Error(`File not found: ${absolutePath}`);
12322
12383
  }
12323
- const content = fs22.readFileSync(absolutePath, "utf-8");
12324
- const ext = path22.extname(absolutePath).toLowerCase();
12384
+ const content = fs23.readFileSync(absolutePath, "utf-8");
12385
+ const ext = path23.extname(absolutePath).toLowerCase();
12325
12386
  if (ext !== ".yml" && ext !== ".yaml") {
12326
12387
  throw new Error("Skill file must be a .skill.yml or .skill.yaml file");
12327
12388
  }
@@ -12766,8 +12827,8 @@ async function skillsCommand(args2) {
12766
12827
  }
12767
12828
 
12768
12829
  // src/cli/commands/workflows.ts
12769
- var fs23 = __toESM(require("fs"));
12770
- var path23 = __toESM(require("path"));
12830
+ var fs24 = __toESM(require("fs"));
12831
+ var path24 = __toESM(require("path"));
12771
12832
  var readline7 = __toESM(require("readline"));
12772
12833
  var import_yaml3 = require("yaml");
12773
12834
  init_utils();
@@ -13032,12 +13093,12 @@ async function getWorkplaceToken7(workplaceSubdomain, serverUrl, cliToken) {
13032
13093
  );
13033
13094
  }
13034
13095
  async function loadWorkflowFile(filePath) {
13035
- const absolutePath = path23.resolve(filePath);
13036
- if (!fs23.existsSync(absolutePath)) {
13096
+ const absolutePath = path24.resolve(filePath);
13097
+ if (!fs24.existsSync(absolutePath)) {
13037
13098
  throw new Error(`File not found: ${absolutePath}`);
13038
13099
  }
13039
- const content = fs23.readFileSync(absolutePath, "utf-8");
13040
- const ext = path23.extname(absolutePath).toLowerCase();
13100
+ const content = fs24.readFileSync(absolutePath, "utf-8");
13101
+ const ext = path24.extname(absolutePath).toLowerCase();
13041
13102
  if (ext !== ".yml" && ext !== ".yaml") {
13042
13103
  throw new Error("Workflow file must be a .yml or .yaml file");
13043
13104
  }
@@ -13077,8 +13138,8 @@ function isTerminalRunStatus(status) {
13077
13138
  return status === "completed" || status === "failed" || status === "cancelled";
13078
13139
  }
13079
13140
  function sleep(ms) {
13080
- return new Promise((resolve15) => {
13081
- setTimeout(resolve15, ms);
13141
+ return new Promise((resolve16) => {
13142
+ setTimeout(resolve16, ms);
13082
13143
  });
13083
13144
  }
13084
13145
  async function handleList5(args2) {
@@ -13396,8 +13457,8 @@ async function handlePull2(args2) {
13396
13457
  console.log(JSON.stringify(result, null, 2));
13397
13458
  return;
13398
13459
  }
13399
- const outputPath = path23.resolve(output || `./${handle}.workflow.yml`);
13400
- fs23.writeFileSync(outputPath, result.yaml, "utf-8");
13460
+ const outputPath = path24.resolve(output || `./${handle}.workflow.yml`);
13461
+ fs24.writeFileSync(outputPath, result.yaml, "utf-8");
13401
13462
  console.log(`Saved v${result.version} to ${outputPath}`);
13402
13463
  }
13403
13464
  async function handlePublish3(args2) {
@@ -13444,9 +13505,9 @@ async function promptForMissingInputs(schema, inputs) {
13444
13505
  input: process.stdin,
13445
13506
  output: process.stdout
13446
13507
  });
13447
- const askQuestion = (prompt2) => new Promise((resolve15) => {
13508
+ const askQuestion = (prompt2) => new Promise((resolve16) => {
13448
13509
  rl.question(prompt2, (answer) => {
13449
- resolve15(answer);
13510
+ resolve16(answer);
13450
13511
  });
13451
13512
  });
13452
13513
  const resolved = { ...inputs };