skedyul 1.4.11 → 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") {
@@ -6482,8 +6542,8 @@ Examples:
6482
6542
  }
6483
6543
  function findConfigFile2(startDir) {
6484
6544
  for (const fileName of CONFIG_FILE_NAMES) {
6485
- const filePath = path13.join(startDir, fileName);
6486
- if (fs13.existsSync(filePath)) {
6545
+ const filePath = path14.join(startDir, fileName);
6546
+ if (fs14.existsSync(filePath)) {
6487
6547
  return filePath;
6488
6548
  }
6489
6549
  }
@@ -6517,9 +6577,9 @@ async function validateCommand(args2) {
6517
6577
  }
6518
6578
  configPath = foundConfig;
6519
6579
  } else {
6520
- configPath = path13.resolve(process.cwd(), configPath);
6580
+ configPath = path14.resolve(process.cwd(), configPath);
6521
6581
  }
6522
- if (!fs13.existsSync(configPath)) {
6582
+ if (!fs14.existsSync(configPath)) {
6523
6583
  const result2 = {
6524
6584
  valid: false,
6525
6585
  configPath,
@@ -6564,8 +6624,8 @@ async function validateCommand(args2) {
6564
6624
  if (provision?.workflows) {
6565
6625
  for (const workflow of provision.workflows) {
6566
6626
  if (workflow.path) {
6567
- const absoluteWorkflowPath = path13.resolve(path13.dirname(configPath), workflow.path);
6568
- if (!fs13.existsSync(absoluteWorkflowPath)) {
6627
+ const absoluteWorkflowPath = path14.resolve(path14.dirname(configPath), workflow.path);
6628
+ if (!fs14.existsSync(absoluteWorkflowPath)) {
6569
6629
  warnings.push(`Workflow file not found: ${workflow.path}`);
6570
6630
  }
6571
6631
  }
@@ -6660,8 +6720,8 @@ async function validateCommand(args2) {
6660
6720
  }
6661
6721
 
6662
6722
  // src/cli/commands/diff.ts
6663
- var fs14 = __toESM(require("fs"));
6664
- var path14 = __toESM(require("path"));
6723
+ var fs15 = __toESM(require("fs"));
6724
+ var path15 = __toESM(require("path"));
6665
6725
  init_utils();
6666
6726
  function printHelp6() {
6667
6727
  console.log(`
@@ -6694,8 +6754,8 @@ Examples:
6694
6754
  }
6695
6755
  function findConfigFile3(startDir) {
6696
6756
  for (const fileName of CONFIG_FILE_NAMES) {
6697
- const filePath = path14.join(startDir, fileName);
6698
- if (fs14.existsSync(filePath)) {
6757
+ const filePath = path15.join(startDir, fileName);
6758
+ if (fs15.existsSync(filePath)) {
6699
6759
  return filePath;
6700
6760
  }
6701
6761
  }
@@ -6751,9 +6811,9 @@ async function diffCommand(args2) {
6751
6811
  }
6752
6812
  configPath = foundConfig;
6753
6813
  } else {
6754
- configPath = path14.resolve(process.cwd(), configPath);
6814
+ configPath = path15.resolve(process.cwd(), configPath);
6755
6815
  }
6756
- if (!fs14.existsSync(configPath)) {
6816
+ if (!fs15.existsSync(configPath)) {
6757
6817
  if (jsonOutput) {
6758
6818
  console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
6759
6819
  } else {
@@ -6795,7 +6855,7 @@ async function diffCommand(args2) {
6795
6855
  const registryPath = flags.registry || flags.r;
6796
6856
  if (registryPath) {
6797
6857
  try {
6798
- const registry = await loadRegistry(path14.resolve(process.cwd(), registryPath));
6858
+ const registry = await loadRegistry(path15.resolve(process.cwd(), registryPath));
6799
6859
  const toolNames = Object.values(registry).map((t) => t.name);
6800
6860
  toolsDiff = {
6801
6861
  added: toolNames,
@@ -6868,8 +6928,8 @@ async function diffCommand(args2) {
6868
6928
  }
6869
6929
 
6870
6930
  // src/cli/commands/deploy.ts
6871
- var fs15 = __toESM(require("fs"));
6872
- var path15 = __toESM(require("path"));
6931
+ var fs16 = __toESM(require("fs"));
6932
+ var path16 = __toESM(require("path"));
6873
6933
  var readline3 = __toESM(require("readline"));
6874
6934
  init_utils();
6875
6935
  function printHelp7() {
@@ -6905,8 +6965,8 @@ Examples:
6905
6965
  }
6906
6966
  function findConfigFile4(startDir) {
6907
6967
  for (const fileName of CONFIG_FILE_NAMES) {
6908
- const filePath = path15.join(startDir, fileName);
6909
- if (fs15.existsSync(filePath)) {
6968
+ const filePath = path16.join(startDir, fileName);
6969
+ if (fs16.existsSync(filePath)) {
6910
6970
  return filePath;
6911
6971
  }
6912
6972
  }
@@ -6931,11 +6991,11 @@ async function promptForApproval(impacts) {
6931
6991
  console.log("");
6932
6992
  console.log("These changes cannot be undone. Data will be permanently deleted.");
6933
6993
  console.log("");
6934
- return new Promise((resolve15) => {
6994
+ return new Promise((resolve16) => {
6935
6995
  rl.question("Do you want to proceed? (yes/no): ", (answer) => {
6936
6996
  rl.close();
6937
6997
  const normalized = answer.toLowerCase().trim();
6938
- resolve15(normalized === "yes" || normalized === "y");
6998
+ resolve16(normalized === "yes" || normalized === "y");
6939
6999
  });
6940
7000
  });
6941
7001
  }
@@ -6971,7 +7031,7 @@ async function waitForMigrationApproval(serverUrl, token, migrationId, timeoutMs
6971
7031
  process.stdout.write(`\r Status: ${data.status} | Time remaining: ${remaining} minutes `);
6972
7032
  } catch {
6973
7033
  }
6974
- await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
7034
+ await new Promise((resolve16) => setTimeout(resolve16, pollInterval));
6975
7035
  }
6976
7036
  return { approved: false, timedOut: true };
6977
7037
  }
@@ -7020,9 +7080,9 @@ async function deployCommand(args2) {
7020
7080
  }
7021
7081
  configPath = foundConfig;
7022
7082
  } else {
7023
- configPath = path15.resolve(process.cwd(), configPath);
7083
+ configPath = path16.resolve(process.cwd(), configPath);
7024
7084
  }
7025
- if (!fs15.existsSync(configPath)) {
7085
+ if (!fs16.existsSync(configPath)) {
7026
7086
  if (jsonOutput) {
7027
7087
  console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
7028
7088
  } else {
@@ -7339,8 +7399,8 @@ async function logoutCommand(args2) {
7339
7399
  }
7340
7400
 
7341
7401
  // src/cli/commands/auth/status.ts
7342
- var fs16 = __toESM(require("fs"));
7343
- var path16 = __toESM(require("path"));
7402
+ var fs17 = __toESM(require("fs"));
7403
+ var path17 = __toESM(require("path"));
7344
7404
  init_utils();
7345
7405
  function printHelp10() {
7346
7406
  console.log(`
@@ -7414,17 +7474,17 @@ async function statusCommand(args2) {
7414
7474
  console.log("");
7415
7475
  console.log(" * = active profile");
7416
7476
  }
7417
- const linksDir = path16.join(process.cwd(), ".skedyul", "links");
7477
+ const linksDir = path17.join(process.cwd(), ".skedyul", "links");
7418
7478
  console.log("");
7419
7479
  console.log("LINKED WORKPLACES (this project)");
7420
7480
  console.log("\u2500".repeat(60));
7421
- if (fs16.existsSync(linksDir)) {
7422
- 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"));
7423
7483
  if (linkFiles.length > 0) {
7424
7484
  for (const file2 of linkFiles) {
7425
7485
  const subdomain = file2.replace(".json", "");
7426
7486
  try {
7427
- const content = fs16.readFileSync(path16.join(linksDir, file2), "utf-8");
7487
+ const content = fs17.readFileSync(path17.join(linksDir, file2), "utf-8");
7428
7488
  const link = JSON.parse(content);
7429
7489
  console.log(` - ${subdomain} (${link.appHandle})`);
7430
7490
  } catch {
@@ -7781,8 +7841,8 @@ EXAMPLES
7781
7841
  }
7782
7842
 
7783
7843
  // src/cli/commands/config-export.ts
7784
- var fs17 = __toESM(require("fs"));
7785
- var path17 = __toESM(require("path"));
7844
+ var fs18 = __toESM(require("fs"));
7845
+ var path18 = __toESM(require("path"));
7786
7846
  function printHelp13() {
7787
7847
  console.log(`
7788
7848
  SKEDYUL CONFIG:EXPORT - Export resolved config to JSON
@@ -7828,8 +7888,8 @@ async function configExportCommand(args2) {
7828
7888
  const cwd = process.cwd();
7829
7889
  let configPath = null;
7830
7890
  for (const name of CONFIG_FILE_NAMES) {
7831
- const testPath = path17.join(cwd, name);
7832
- if (fs17.existsSync(testPath)) {
7891
+ const testPath = path18.join(cwd, name);
7892
+ if (fs18.existsSync(testPath)) {
7833
7893
  configPath = testPath;
7834
7894
  break;
7835
7895
  }
@@ -7839,16 +7899,16 @@ async function configExportCommand(args2) {
7839
7899
  console.error("Make sure you are in the root of your integration project.");
7840
7900
  process.exit(1);
7841
7901
  }
7842
- console.log(`Loading config from ${path17.basename(configPath)}...`);
7902
+ console.log(`Loading config from ${path18.basename(configPath)}...`);
7843
7903
  try {
7844
7904
  const resolvedConfig = await loadAndResolveConfig(configPath);
7845
7905
  const serialized = serializeResolvedConfig(resolvedConfig);
7846
- const outputDir = path17.dirname(path17.resolve(cwd, outputPath));
7847
- if (!fs17.existsSync(outputDir)) {
7848
- 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 });
7849
7909
  }
7850
- const fullOutputPath = path17.resolve(cwd, outputPath);
7851
- 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");
7852
7912
  console.log(``);
7853
7913
  console.log(`Config exported successfully!`);
7854
7914
  console.log(` Output: ${outputPath}`);
@@ -8049,7 +8109,7 @@ async function promptHidden(question) {
8049
8109
  input: process.stdin,
8050
8110
  output: process.stdout
8051
8111
  });
8052
- return new Promise((resolve15) => {
8112
+ return new Promise((resolve16) => {
8053
8113
  process.stdout.write(question);
8054
8114
  let input = "";
8055
8115
  const stdin = process.stdin;
@@ -8063,7 +8123,7 @@ async function promptHidden(question) {
8063
8123
  if (stdin.setRawMode) stdin.setRawMode(wasRaw ?? false);
8064
8124
  process.stdout.write("\n");
8065
8125
  rl.close();
8066
- resolve15(input.trim());
8126
+ resolve16(input.trim());
8067
8127
  } else if (char === "") {
8068
8128
  process.exit(0);
8069
8129
  } else if (char === "\x7F" || char === "\b") {
@@ -8093,17 +8153,17 @@ async function prompt(options) {
8093
8153
  input: process.stdin,
8094
8154
  output: process.stdout
8095
8155
  });
8096
- return new Promise((resolve15) => {
8156
+ return new Promise((resolve16) => {
8097
8157
  const displayMessage = defaultValue ? `${message} [${defaultValue}]: ` : `${message}: `;
8098
8158
  rl.question(displayMessage, (answer) => {
8099
8159
  rl.close();
8100
8160
  const value = answer.trim() || defaultValue || "";
8101
8161
  if (required && !value) {
8102
8162
  console.error("Value is required.");
8103
- resolve15(prompt(options));
8163
+ resolve16(prompt(options));
8104
8164
  return;
8105
8165
  }
8106
- resolve15(value);
8166
+ resolve16(value);
8107
8167
  });
8108
8168
  });
8109
8169
  }
@@ -8490,8 +8550,8 @@ async function handleCreateMany(modelHandle, flags) {
8490
8550
  console.error("Usage: skedyul instances create-many <model> --file data.json --workplace <subdomain>");
8491
8551
  process.exit(1);
8492
8552
  }
8493
- const fs24 = await import("fs");
8494
- const fileContent = fs24.readFileSync(filePath, "utf-8");
8553
+ const fs25 = await import("fs");
8554
+ const fileContent = fs25.readFileSync(filePath, "utf-8");
8495
8555
  const items = JSON.parse(fileContent);
8496
8556
  if (!Array.isArray(items)) {
8497
8557
  console.error("Error: File must contain a JSON array of items");
@@ -8518,8 +8578,8 @@ async function handleUpsertMany(modelHandle, flags) {
8518
8578
  console.error("Usage: skedyul instances upsert-many <model> --file data.json --match-field <field> --workplace <subdomain>");
8519
8579
  process.exit(1);
8520
8580
  }
8521
- const fs24 = await import("fs");
8522
- const fileContent = fs24.readFileSync(filePath, "utf-8");
8581
+ const fs25 = await import("fs");
8582
+ const fileContent = fs25.readFileSync(filePath, "utf-8");
8523
8583
  const items = JSON.parse(fileContent);
8524
8584
  if (!Array.isArray(items)) {
8525
8585
  console.error("Error: File must contain a JSON array of items");
@@ -8531,8 +8591,8 @@ async function handleUpsertMany(modelHandle, flags) {
8531
8591
 
8532
8592
  // src/cli/commands/build.ts
8533
8593
  var import_child_process = require("child_process");
8534
- var fs18 = __toESM(require("fs"));
8535
- var path18 = __toESM(require("path"));
8594
+ var fs19 = __toESM(require("fs"));
8595
+ var path19 = __toESM(require("path"));
8536
8596
  function printBuildHelp() {
8537
8597
  console.log(`
8538
8598
  SKEDYUL BUILD - Build your integration
@@ -8601,8 +8661,8 @@ async function buildCommand(args2) {
8601
8661
  const cwd = process.cwd();
8602
8662
  let configPath = null;
8603
8663
  for (const name of CONFIG_FILE_NAMES) {
8604
- const testPath = path18.join(cwd, name);
8605
- if (fs18.existsSync(testPath)) {
8664
+ const testPath = path19.join(cwd, name);
8665
+ if (fs19.existsSync(testPath)) {
8606
8666
  configPath = testPath;
8607
8667
  break;
8608
8668
  }
@@ -8612,8 +8672,8 @@ async function buildCommand(args2) {
8612
8672
  console.error("Make sure you are in the root of your integration project.");
8613
8673
  process.exit(1);
8614
8674
  }
8615
- console.log(`Loading config from ${path18.basename(configPath)}...`);
8616
- 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");
8617
8677
  let createdTempConfig = false;
8618
8678
  try {
8619
8679
  const config = await loadConfig(configPath);
@@ -8622,8 +8682,8 @@ async function buildCommand(args2) {
8622
8682
  const baseExternals = ["skedyul", `skedyul/${computeLayer}`, "zod"];
8623
8683
  const userExternals = config.build && "external" in config.build ? config.build.external ?? [] : [];
8624
8684
  const allExternals = [...baseExternals, ...userExternals];
8625
- const userTsupConfig = path18.join(cwd, "tsup.config.ts");
8626
- const hasUserConfig = fs18.existsSync(userTsupConfig);
8685
+ const userTsupConfig = path19.join(cwd, "tsup.config.ts");
8686
+ const hasUserConfig = fs19.existsSync(userTsupConfig);
8627
8687
  console.log(``);
8628
8688
  console.log(`Building ${config.name ?? "integration"}...`);
8629
8689
  console.log(` Compute layer: ${computeLayer}`);
@@ -8643,7 +8703,7 @@ async function buildCommand(args2) {
8643
8703
  }
8644
8704
  } else {
8645
8705
  const tsupConfigContent = generateTsupConfig(format, allExternals);
8646
- fs18.writeFileSync(tempConfigPath, tsupConfigContent, "utf-8");
8706
+ fs19.writeFileSync(tempConfigPath, tsupConfigContent, "utf-8");
8647
8707
  createdTempConfig = true;
8648
8708
  tsupArgs = [
8649
8709
  "tsup",
@@ -8661,14 +8721,14 @@ async function buildCommand(args2) {
8661
8721
  });
8662
8722
  tsup.on("error", (error) => {
8663
8723
  console.error("Failed to start tsup:", error.message);
8664
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8665
- fs18.unlinkSync(tempConfigPath);
8724
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8725
+ fs19.unlinkSync(tempConfigPath);
8666
8726
  }
8667
8727
  process.exit(1);
8668
8728
  });
8669
8729
  tsup.on("close", (code) => {
8670
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8671
- fs18.unlinkSync(tempConfigPath);
8730
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8731
+ fs19.unlinkSync(tempConfigPath);
8672
8732
  }
8673
8733
  if (code === 0) {
8674
8734
  console.log(``);
@@ -8677,8 +8737,8 @@ async function buildCommand(args2) {
8677
8737
  process.exit(code ?? 0);
8678
8738
  });
8679
8739
  } catch (error) {
8680
- if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
8681
- fs18.unlinkSync(tempConfigPath);
8740
+ if (createdTempConfig && fs19.existsSync(tempConfigPath)) {
8741
+ fs19.unlinkSync(tempConfigPath);
8682
8742
  }
8683
8743
  console.error(
8684
8744
  "Error loading config:",
@@ -8691,8 +8751,8 @@ async function buildCommand(args2) {
8691
8751
  // src/cli/commands/smoke-test.ts
8692
8752
  var import_child_process2 = require("child_process");
8693
8753
  var http3 = __toESM(require("http"));
8694
- var fs19 = __toESM(require("fs"));
8695
- var path19 = __toESM(require("path"));
8754
+ var fs20 = __toESM(require("fs"));
8755
+ var path20 = __toESM(require("path"));
8696
8756
  var SMOKE_TEST_PORT = 3456;
8697
8757
  var HEALTH_CHECK_INTERVAL_MS = 500;
8698
8758
  var HEALTH_CHECK_MAX_RETRIES = 30;
@@ -8723,13 +8783,13 @@ WHAT IT DOES
8723
8783
  6. Exits with code 0 (success) or 1 (failure)
8724
8784
  `);
8725
8785
  }
8726
- function makeRequest(port, path24, method, body) {
8727
- return new Promise((resolve15, reject) => {
8786
+ function makeRequest(port, path25, method, body) {
8787
+ return new Promise((resolve16, reject) => {
8728
8788
  const postData = body ? JSON.stringify(body) : void 0;
8729
8789
  const options = {
8730
8790
  hostname: "localhost",
8731
8791
  port,
8732
- path: path24,
8792
+ path: path25,
8733
8793
  method,
8734
8794
  headers: {
8735
8795
  "Content-Type": "application/json",
@@ -8745,9 +8805,9 @@ function makeRequest(port, path24, method, body) {
8745
8805
  res.on("end", () => {
8746
8806
  try {
8747
8807
  const parsed = data ? JSON.parse(data) : {};
8748
- resolve15({ status: res.statusCode ?? 0, body: parsed });
8808
+ resolve16({ status: res.statusCode ?? 0, body: parsed });
8749
8809
  } catch {
8750
- resolve15({ status: res.statusCode ?? 0, body: data });
8810
+ resolve16({ status: res.statusCode ?? 0, body: data });
8751
8811
  }
8752
8812
  });
8753
8813
  });
@@ -8767,7 +8827,7 @@ async function waitForHealth(port) {
8767
8827
  }
8768
8828
  } catch {
8769
8829
  }
8770
- await new Promise((resolve15) => setTimeout(resolve15, HEALTH_CHECK_INTERVAL_MS));
8830
+ await new Promise((resolve16) => setTimeout(resolve16, HEALTH_CHECK_INTERVAL_MS));
8771
8831
  }
8772
8832
  return false;
8773
8833
  }
@@ -8817,8 +8877,8 @@ async function smokeTestCommand(args2) {
8817
8877
  const cwd = process.cwd();
8818
8878
  let configPath = null;
8819
8879
  for (const name of CONFIG_FILE_NAMES) {
8820
- const testPath = path19.join(cwd, name);
8821
- if (fs19.existsSync(testPath)) {
8880
+ const testPath = path20.join(cwd, name);
8881
+ if (fs20.existsSync(testPath)) {
8822
8882
  configPath = testPath;
8823
8883
  break;
8824
8884
  }
@@ -8834,10 +8894,10 @@ async function smokeTestCommand(args2) {
8834
8894
  }
8835
8895
  const serverExt = computeLayer === "serverless" ? "mjs" : "js";
8836
8896
  let serverPath = `dist/server/mcp_server.${serverExt}`;
8837
- if (!fs19.existsSync(serverPath)) {
8897
+ if (!fs20.existsSync(serverPath)) {
8838
8898
  const fallbackExt = serverExt === "mjs" ? "js" : "mjs";
8839
8899
  const fallbackPath = `dist/server/mcp_server.${fallbackExt}`;
8840
- if (fs19.existsSync(fallbackPath)) {
8900
+ if (fs20.existsSync(fallbackPath)) {
8841
8901
  console.warn(`[SmokeTest] Warning: Expected ${serverPath} but found ${fallbackPath}`);
8842
8902
  console.warn(`[SmokeTest] Using ${fallbackPath} instead`);
8843
8903
  serverPath = fallbackPath;
@@ -8898,7 +8958,7 @@ async function smokeTestCommand(args2) {
8898
8958
  server2.on("error", (err) => {
8899
8959
  console.error(`[SmokeTest] Failed to spawn server: ${err.message}`);
8900
8960
  });
8901
- await new Promise((resolve15) => setTimeout(resolve15, 1e3));
8961
+ await new Promise((resolve16) => setTimeout(resolve16, 1e3));
8902
8962
  if (serverExited) {
8903
8963
  console.error("[SmokeTest] FAILED: Server crashed during startup");
8904
8964
  console.error(`[SmokeTest] Exit code: ${serverExitCode}`);
@@ -9047,11 +9107,11 @@ async function promptForApproval2(impacts) {
9047
9107
  console.log("");
9048
9108
  console.log("These changes cannot be undone. Data will be permanently deleted.");
9049
9109
  console.log("");
9050
- return new Promise((resolve15) => {
9110
+ return new Promise((resolve16) => {
9051
9111
  rl.question("Do you want to proceed? (yes/no): ", (answer) => {
9052
9112
  rl.close();
9053
9113
  const normalized = answer.toLowerCase().trim();
9054
- resolve15(normalized === "yes" || normalized === "y");
9114
+ resolve16(normalized === "yes" || normalized === "y");
9055
9115
  });
9056
9116
  });
9057
9117
  }
@@ -9355,8 +9415,8 @@ async function crmCommand(args2) {
9355
9415
  }
9356
9416
 
9357
9417
  // src/cli/commands/agents.ts
9358
- var fs20 = __toESM(require("fs"));
9359
- var path20 = __toESM(require("path"));
9418
+ var fs21 = __toESM(require("fs"));
9419
+ var path21 = __toESM(require("path"));
9360
9420
  var import_yaml = require("yaml");
9361
9421
  init_utils();
9362
9422
 
@@ -10417,11 +10477,11 @@ function isAgentV3(agent) {
10417
10477
  return "handle" in obj && !("stages" in obj) && !("agents" in obj);
10418
10478
  }
10419
10479
  async function loadAgentFile(filePath) {
10420
- const absolutePath = path20.resolve(filePath);
10421
- if (!fs20.existsSync(absolutePath)) {
10480
+ const absolutePath = path21.resolve(filePath);
10481
+ if (!fs21.existsSync(absolutePath)) {
10422
10482
  throw new Error(`Agent file not found: ${absolutePath}`);
10423
10483
  }
10424
- const content = fs20.readFileSync(absolutePath, "utf-8");
10484
+ const content = fs21.readFileSync(absolutePath, "utf-8");
10425
10485
  const isJson = absolutePath.endsWith(".json");
10426
10486
  const isYaml = absolutePath.endsWith(".yml") || absolutePath.endsWith(".yaml");
10427
10487
  let rawAgent;
@@ -10431,7 +10491,7 @@ async function loadAgentFile(filePath) {
10431
10491
  rawAgent = (0, import_yaml.parse)(content);
10432
10492
  } else {
10433
10493
  throw new Error(
10434
- `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`
10435
10495
  );
10436
10496
  }
10437
10497
  const detectedV3 = isAgentV3(rawAgent);
@@ -10441,8 +10501,8 @@ async function loadAgentFile(filePath) {
10441
10501
  return { agent: v3Result.data, content, isV3: true };
10442
10502
  }
10443
10503
  const errorMessages = v3Result.error.issues.map((e) => {
10444
- const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
10445
- return ` - ${path24}: ${e.message}`;
10504
+ const path25 = e.path.length > 0 ? e.path.join(".") : "(root)";
10505
+ return ` - ${path25}: ${e.message}`;
10446
10506
  }).join("\n");
10447
10507
  throw new Error(`Agent v3 validation failed:
10448
10508
  ${errorMessages}`);
@@ -10454,8 +10514,8 @@ ${errorMessages}`);
10454
10514
  const v3Result = validateAgentYAMLV3(rawAgent);
10455
10515
  if (!v3Result.success) {
10456
10516
  const errorMessages2 = v3Result.error.issues.map((e) => {
10457
- const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
10458
- return ` - ${path24}: ${e.message}`;
10517
+ const path25 = e.path.length > 0 ? e.path.join(".") : "(root)";
10518
+ return ` - ${path25}: ${e.message}`;
10459
10519
  }).join("\n");
10460
10520
  throw new Error(`Agent v3 validation failed:
10461
10521
  ${errorMessages2}`);
@@ -11151,14 +11211,14 @@ async function* parseSSEStream(response, debug2 = false) {
11151
11211
  }
11152
11212
 
11153
11213
  // src/cli/utils/mock-context.ts
11154
- var fs21 = __toESM(require("fs"));
11155
- var path21 = __toESM(require("path"));
11214
+ var fs22 = __toESM(require("fs"));
11215
+ var path22 = __toESM(require("path"));
11156
11216
  function loadContext(filePath) {
11157
- const absolutePath = path21.resolve(filePath);
11158
- if (!fs21.existsSync(absolutePath)) {
11217
+ const absolutePath = path22.resolve(filePath);
11218
+ if (!fs22.existsSync(absolutePath)) {
11159
11219
  throw new Error(`Context file not found: ${absolutePath}`);
11160
11220
  }
11161
- const content = fs21.readFileSync(absolutePath, "utf-8");
11221
+ const content = fs22.readFileSync(absolutePath, "utf-8");
11162
11222
  let rawContext;
11163
11223
  try {
11164
11224
  rawContext = JSON.parse(content);
@@ -11695,9 +11755,9 @@ async function chatCommand(args2) {
11695
11755
  output: process.stdout
11696
11756
  });
11697
11757
  const askQuestion = (prompt2) => {
11698
- return new Promise((resolve15) => {
11758
+ return new Promise((resolve16) => {
11699
11759
  rl.question(prompt2, (answer) => {
11700
- resolve15(answer);
11760
+ resolve16(answer);
11701
11761
  });
11702
11762
  });
11703
11763
  };
@@ -12244,8 +12304,8 @@ Error: ${input.name} is required`);
12244
12304
  }
12245
12305
 
12246
12306
  // src/cli/commands/skills.ts
12247
- var fs22 = __toESM(require("fs"));
12248
- var path22 = __toESM(require("path"));
12307
+ var fs23 = __toESM(require("fs"));
12308
+ var path23 = __toESM(require("path"));
12249
12309
  var import_yaml2 = require("yaml");
12250
12310
  init_utils();
12251
12311
  function printHelp21() {
@@ -12317,12 +12377,12 @@ async function getWorkplaceToken6(workplaceSubdomain, serverUrl, cliToken) {
12317
12377
  );
12318
12378
  }
12319
12379
  async function loadSkillFile(filePath) {
12320
- const absolutePath = path22.resolve(filePath);
12321
- if (!fs22.existsSync(absolutePath)) {
12380
+ const absolutePath = path23.resolve(filePath);
12381
+ if (!fs23.existsSync(absolutePath)) {
12322
12382
  throw new Error(`File not found: ${absolutePath}`);
12323
12383
  }
12324
- const content = fs22.readFileSync(absolutePath, "utf-8");
12325
- const ext = path22.extname(absolutePath).toLowerCase();
12384
+ const content = fs23.readFileSync(absolutePath, "utf-8");
12385
+ const ext = path23.extname(absolutePath).toLowerCase();
12326
12386
  if (ext !== ".yml" && ext !== ".yaml") {
12327
12387
  throw new Error("Skill file must be a .skill.yml or .skill.yaml file");
12328
12388
  }
@@ -12767,8 +12827,8 @@ async function skillsCommand(args2) {
12767
12827
  }
12768
12828
 
12769
12829
  // src/cli/commands/workflows.ts
12770
- var fs23 = __toESM(require("fs"));
12771
- var path23 = __toESM(require("path"));
12830
+ var fs24 = __toESM(require("fs"));
12831
+ var path24 = __toESM(require("path"));
12772
12832
  var readline7 = __toESM(require("readline"));
12773
12833
  var import_yaml3 = require("yaml");
12774
12834
  init_utils();
@@ -13033,12 +13093,12 @@ async function getWorkplaceToken7(workplaceSubdomain, serverUrl, cliToken) {
13033
13093
  );
13034
13094
  }
13035
13095
  async function loadWorkflowFile(filePath) {
13036
- const absolutePath = path23.resolve(filePath);
13037
- if (!fs23.existsSync(absolutePath)) {
13096
+ const absolutePath = path24.resolve(filePath);
13097
+ if (!fs24.existsSync(absolutePath)) {
13038
13098
  throw new Error(`File not found: ${absolutePath}`);
13039
13099
  }
13040
- const content = fs23.readFileSync(absolutePath, "utf-8");
13041
- const ext = path23.extname(absolutePath).toLowerCase();
13100
+ const content = fs24.readFileSync(absolutePath, "utf-8");
13101
+ const ext = path24.extname(absolutePath).toLowerCase();
13042
13102
  if (ext !== ".yml" && ext !== ".yaml") {
13043
13103
  throw new Error("Workflow file must be a .yml or .yaml file");
13044
13104
  }
@@ -13078,8 +13138,8 @@ function isTerminalRunStatus(status) {
13078
13138
  return status === "completed" || status === "failed" || status === "cancelled";
13079
13139
  }
13080
13140
  function sleep(ms) {
13081
- return new Promise((resolve15) => {
13082
- setTimeout(resolve15, ms);
13141
+ return new Promise((resolve16) => {
13142
+ setTimeout(resolve16, ms);
13083
13143
  });
13084
13144
  }
13085
13145
  async function handleList5(args2) {
@@ -13397,8 +13457,8 @@ async function handlePull2(args2) {
13397
13457
  console.log(JSON.stringify(result, null, 2));
13398
13458
  return;
13399
13459
  }
13400
- const outputPath = path23.resolve(output || `./${handle}.workflow.yml`);
13401
- fs23.writeFileSync(outputPath, result.yaml, "utf-8");
13460
+ const outputPath = path24.resolve(output || `./${handle}.workflow.yml`);
13461
+ fs24.writeFileSync(outputPath, result.yaml, "utf-8");
13402
13462
  console.log(`Saved v${result.version} to ${outputPath}`);
13403
13463
  }
13404
13464
  async function handlePublish3(args2) {
@@ -13445,9 +13505,9 @@ async function promptForMissingInputs(schema, inputs) {
13445
13505
  input: process.stdin,
13446
13506
  output: process.stdout
13447
13507
  });
13448
- const askQuestion = (prompt2) => new Promise((resolve15) => {
13508
+ const askQuestion = (prompt2) => new Promise((resolve16) => {
13449
13509
  rl.question(prompt2, (answer) => {
13450
- resolve15(answer);
13510
+ resolve16(answer);
13451
13511
  });
13452
13512
  });
13453
13513
  const resolved = { ...inputs };