skedyul 1.2.32 → 1.2.33

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
@@ -3226,7 +3226,7 @@ async function handleOAuthCallback(parsedBody, hooks) {
3226
3226
  }
3227
3227
 
3228
3228
  // src/server/handlers/webhook-handler.ts
3229
- function parseWebhookRequest(parsedBody, method, url, path16, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
3229
+ function parseWebhookRequest(parsedBody, method, url, path17, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
3230
3230
  const isEnvelope = typeof parsedBody === "object" && parsedBody !== null && "env" in parsedBody && "request" in parsedBody && "context" in parsedBody;
3231
3231
  if (isEnvelope) {
3232
3232
  const envelope = parsedBody;
@@ -3280,7 +3280,7 @@ function parseWebhookRequest(parsedBody, method, url, path16, headers, query, ra
3280
3280
  const webhookRequest = {
3281
3281
  method,
3282
3282
  url,
3283
- path: path16,
3283
+ path: path17,
3284
3284
  headers,
3285
3285
  query,
3286
3286
  body: parsedBody,
@@ -3359,15 +3359,20 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
3359
3359
  }
3360
3360
  if (pathname === "/config" && req.method === "GET") {
3361
3361
  try {
3362
+ console.log(`[/config] Checking for config file at: ${CONFIG_FILE_PATH}`);
3362
3363
  if (fs7.existsSync(CONFIG_FILE_PATH)) {
3363
3364
  const fileConfig = JSON.parse(fs7.readFileSync(CONFIG_FILE_PATH, "utf-8"));
3365
+ console.log(`[/config] Loaded config from file: tools=${fileConfig.tools?.length ?? 0}, webhooks=${fileConfig.webhooks?.length ?? 0}`);
3364
3366
  sendJSON(res, 200, fileConfig);
3365
3367
  return;
3366
3368
  }
3369
+ console.log("[/config] Config file not found, falling back to runtime serialization");
3367
3370
  } catch (err) {
3368
3371
  console.warn("[/config] Failed to read config file, falling back to runtime serialization:", err);
3369
3372
  }
3370
- sendJSON(res, 200, serializeConfig(config));
3373
+ const serialized = serializeConfig(config);
3374
+ console.log(`[/config] Runtime serialization: tools=${serialized.tools?.length ?? 0}, webhooks=${serialized.webhooks?.length ?? 0}`);
3375
+ sendJSON(res, 200, serialized);
3371
3376
  return;
3372
3377
  }
3373
3378
  if (pathname.startsWith("/webhooks/") && webhookRegistry) {
@@ -3680,7 +3685,8 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
3680
3685
 
3681
3686
  // src/server/serverless.ts
3682
3687
  var fs8 = __toESM(require("fs"));
3683
- var CONFIG_FILE_PATH2 = ".skedyul/config.json";
3688
+ var path7 = __toESM(require("path"));
3689
+ var CONFIG_FILE_PATH2 = process.env.LAMBDA_TASK_ROOT ? path7.join(process.env.LAMBDA_TASK_ROOT, ".skedyul", "config.json") : ".skedyul/config.json";
3684
3690
  function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3685
3691
  const headers = getDefaultHeaders(config.cors);
3686
3692
  const registry = config.tools;
@@ -3693,13 +3699,13 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3693
3699
  hasLoggedStartup = true;
3694
3700
  }
3695
3701
  try {
3696
- const path16 = event.path || event.rawPath || "/";
3702
+ const path17 = event.path || event.rawPath || "/";
3697
3703
  const method = event.httpMethod || event.requestContext?.http?.method || "POST";
3698
3704
  if (method === "OPTIONS") {
3699
3705
  return createResponse(200, { message: "OK" }, headers);
3700
3706
  }
3701
- if (path16.startsWith("/webhooks/") && webhookRegistry) {
3702
- const handle = path16.slice("/webhooks/".length);
3707
+ if (path17.startsWith("/webhooks/") && webhookRegistry) {
3708
+ const handle = path17.slice("/webhooks/".length);
3703
3709
  if (!webhookRegistry[handle]) {
3704
3710
  return createResponse(404, { error: `Webhook handler '${handle}' not found` }, headers);
3705
3711
  }
@@ -3722,12 +3728,12 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3722
3728
  const protocol = forwardedProto ?? "https";
3723
3729
  const host = event.headers?.host ?? event.headers?.Host ?? "localhost";
3724
3730
  const queryString = event.queryStringParameters ? "?" + new URLSearchParams(event.queryStringParameters).toString() : "";
3725
- const webhookUrl = `${protocol}://${host}${path16}${queryString}`;
3731
+ const webhookUrl = `${protocol}://${host}${path17}${queryString}`;
3726
3732
  const parseResult = parseWebhookRequest(
3727
3733
  parsedBody,
3728
3734
  method,
3729
3735
  webhookUrl,
3730
- path16,
3736
+ path17,
3731
3737
  event.headers,
3732
3738
  event.queryStringParameters ?? {},
3733
3739
  rawBody,
@@ -3748,7 +3754,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3748
3754
  body: result.body !== void 0 ? typeof result.body === "string" ? result.body : JSON.stringify(result.body) : ""
3749
3755
  };
3750
3756
  }
3751
- if (path16 === "/core" && method === "POST") {
3757
+ if (path17 === "/core" && method === "POST") {
3752
3758
  let coreBody;
3753
3759
  try {
3754
3760
  coreBody = event.body ? JSON.parse(event.body) : {};
@@ -3780,7 +3786,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3780
3786
  const result = await handleCoreMethod(coreMethod, coreBody.params);
3781
3787
  return createResponse(result.status, result.payload, headers);
3782
3788
  }
3783
- if (path16 === "/core/webhook" && method === "POST") {
3789
+ if (path17 === "/core/webhook" && method === "POST") {
3784
3790
  const rawWebhookBody = event.body ?? "";
3785
3791
  let webhookBody;
3786
3792
  try {
@@ -3795,14 +3801,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3795
3801
  const forwardedProto = event.headers?.["x-forwarded-proto"] ?? event.headers?.["X-Forwarded-Proto"];
3796
3802
  const protocol = forwardedProto ?? "https";
3797
3803
  const host = event.headers?.host ?? event.headers?.Host ?? "localhost";
3798
- const webhookUrl = `${protocol}://${host}${path16}`;
3804
+ const webhookUrl = `${protocol}://${host}${path17}`;
3799
3805
  const coreWebhookRequest = {
3800
3806
  method,
3801
3807
  headers: event.headers ?? {},
3802
3808
  body: webhookBody,
3803
3809
  query: event.queryStringParameters ?? {},
3804
3810
  url: webhookUrl,
3805
- path: path16,
3811
+ path: path17,
3806
3812
  rawBody: rawWebhookBody ? Buffer.from(rawWebhookBody, "utf-8") : void 0
3807
3813
  };
3808
3814
  const webhookResponse = await coreApiService.dispatchWebhook(
@@ -3814,7 +3820,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3814
3820
  headers
3815
3821
  );
3816
3822
  }
3817
- if (path16 === "/estimate" && method === "POST") {
3823
+ if (path17 === "/estimate" && method === "POST") {
3818
3824
  let estimateBody;
3819
3825
  try {
3820
3826
  estimateBody = event.body ? JSON.parse(event.body) : {};
@@ -3880,7 +3886,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3880
3886
  );
3881
3887
  }
3882
3888
  }
3883
- if (path16 === "/install" && method === "POST") {
3889
+ if (path17 === "/install" && method === "POST") {
3884
3890
  let installBody;
3885
3891
  try {
3886
3892
  installBody = event.body ? JSON.parse(event.body) : {};
@@ -3894,7 +3900,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3894
3900
  const result = await handleInstall(installBody, config.hooks);
3895
3901
  return createResponse(result.status, result.body, headers);
3896
3902
  }
3897
- if (path16 === "/uninstall" && method === "POST") {
3903
+ if (path17 === "/uninstall" && method === "POST") {
3898
3904
  let uninstallBody;
3899
3905
  try {
3900
3906
  uninstallBody = event.body ? JSON.parse(event.body) : {};
@@ -3908,7 +3914,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3908
3914
  const result = await handleUninstall(uninstallBody, config.hooks);
3909
3915
  return createResponse(result.status, result.body, headers);
3910
3916
  }
3911
- if (path16 === "/provision" && method === "POST") {
3917
+ if (path17 === "/provision" && method === "POST") {
3912
3918
  let provisionBody;
3913
3919
  try {
3914
3920
  provisionBody = event.body ? JSON.parse(event.body) : {};
@@ -3922,7 +3928,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3922
3928
  const result = await handleProvision(provisionBody, config.hooks);
3923
3929
  return createResponse(result.status, result.body, headers);
3924
3930
  }
3925
- if (path16 === "/oauth_callback" && method === "POST") {
3931
+ if (path17 === "/oauth_callback" && method === "POST") {
3926
3932
  let parsedBody;
3927
3933
  try {
3928
3934
  parsedBody = event.body ? JSON.parse(event.body) : {};
@@ -3937,21 +3943,26 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
3937
3943
  const result = await handleOAuthCallback(parsedBody, config.hooks);
3938
3944
  return createResponse(result.status, result.body, headers);
3939
3945
  }
3940
- if (path16 === "/health" && method === "GET") {
3946
+ if (path17 === "/health" && method === "GET") {
3941
3947
  return createResponse(200, state.getHealthStatus(), headers);
3942
3948
  }
3943
- if (path16 === "/config" && method === "GET") {
3949
+ if (path17 === "/config" && method === "GET") {
3944
3950
  try {
3951
+ console.log(`[/config] Checking for config file at: ${CONFIG_FILE_PATH2}`);
3945
3952
  if (fs8.existsSync(CONFIG_FILE_PATH2)) {
3946
3953
  const fileConfig = JSON.parse(fs8.readFileSync(CONFIG_FILE_PATH2, "utf-8"));
3954
+ console.log(`[/config] Loaded config from file: tools=${fileConfig.tools?.length ?? 0}, webhooks=${fileConfig.webhooks?.length ?? 0}`);
3947
3955
  return createResponse(200, fileConfig, headers);
3948
3956
  }
3957
+ console.log("[/config] Config file not found, falling back to runtime serialization");
3949
3958
  } catch (err) {
3950
3959
  console.warn("[/config] Failed to read config file, falling back to runtime serialization:", err);
3951
3960
  }
3952
- return createResponse(200, serializeConfig(config), headers);
3961
+ const serialized = serializeConfig(config);
3962
+ console.log(`[/config] Runtime serialization: tools=${serialized.tools?.length ?? 0}, webhooks=${serialized.webhooks?.length ?? 0}`);
3963
+ return createResponse(200, serialized, headers);
3953
3964
  }
3954
- if (path16 === "/mcp" && method === "POST") {
3965
+ if (path17 === "/mcp" && method === "POST") {
3955
3966
  let body;
3956
3967
  try {
3957
3968
  body = event.body ? JSON.parse(event.body) : {};
@@ -4984,12 +4995,12 @@ Press Ctrl+C to stop`);
4984
4995
 
4985
4996
  // src/cli/commands/validate.ts
4986
4997
  var fs10 = __toESM(require("fs"));
4987
- var path9 = __toESM(require("path"));
4998
+ var path10 = __toESM(require("path"));
4988
4999
  init_utils();
4989
5000
 
4990
5001
  // src/config/loader.ts
4991
5002
  var fs9 = __toESM(require("fs"));
4992
- var path7 = __toESM(require("path"));
5003
+ var path8 = __toESM(require("path"));
4993
5004
  var os2 = __toESM(require("os"));
4994
5005
  var CONFIG_FILE_NAMES = [
4995
5006
  "skedyul.config.ts",
@@ -4999,12 +5010,12 @@ var CONFIG_FILE_NAMES = [
4999
5010
  ];
5000
5011
  async function transpileTypeScript(filePath) {
5001
5012
  const content = fs9.readFileSync(filePath, "utf-8");
5002
- const configDir = path7.dirname(path7.resolve(filePath));
5013
+ const configDir = path8.dirname(path8.resolve(filePath));
5003
5014
  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*$/, "}");
5004
5015
  transpiled = transpiled.replace(
5005
5016
  /import\s+(\w+)\s+from\s+['"](\.[^'"]+)['"]\s*(?:with\s*\{[^}]*\})?/g,
5006
5017
  (match, varName, relativePath) => {
5007
- const absolutePath = path7.resolve(configDir, relativePath);
5018
+ const absolutePath = path8.resolve(configDir, relativePath);
5008
5019
  return `const ${varName} = require('${absolutePath.replace(/\\/g, "/")}')`;
5009
5020
  }
5010
5021
  );
@@ -5012,7 +5023,7 @@ async function transpileTypeScript(filePath) {
5012
5023
  return transpiled;
5013
5024
  }
5014
5025
  async function loadConfig(configPath) {
5015
- const absolutePath = path7.resolve(configPath);
5026
+ const absolutePath = path8.resolve(configPath);
5016
5027
  if (!fs9.existsSync(absolutePath)) {
5017
5028
  throw new Error(`Config file not found: ${absolutePath}`);
5018
5029
  }
@@ -5022,7 +5033,7 @@ async function loadConfig(configPath) {
5022
5033
  if (isTypeScript) {
5023
5034
  const transpiled = await transpileTypeScript(absolutePath);
5024
5035
  const tempDir = os2.tmpdir();
5025
- const tempFile = path7.join(tempDir, `skedyul-config-${Date.now()}.cjs`);
5036
+ const tempFile = path8.join(tempDir, `skedyul-config-${Date.now()}.cjs`);
5026
5037
  fs9.writeFileSync(tempFile, transpiled);
5027
5038
  moduleToLoad = tempFile;
5028
5039
  try {
@@ -5069,9 +5080,9 @@ function validateConfig(config) {
5069
5080
  }
5070
5081
 
5071
5082
  // src/config/resolver.ts
5072
- var path8 = __toESM(require("path"));
5083
+ var path9 = __toESM(require("path"));
5073
5084
  async function loadAndResolveConfig(configPath) {
5074
- const absolutePath = path8.resolve(configPath);
5085
+ const absolutePath = path9.resolve(configPath);
5075
5086
  const module2 = await import(absolutePath);
5076
5087
  const config = module2.default;
5077
5088
  if (!config || typeof config !== "object") {
@@ -5174,7 +5185,7 @@ Examples:
5174
5185
  }
5175
5186
  function findConfigFile2(startDir) {
5176
5187
  for (const fileName of CONFIG_FILE_NAMES) {
5177
- const filePath = path9.join(startDir, fileName);
5188
+ const filePath = path10.join(startDir, fileName);
5178
5189
  if (fs10.existsSync(filePath)) {
5179
5190
  return filePath;
5180
5191
  }
@@ -5209,7 +5220,7 @@ async function validateCommand(args2) {
5209
5220
  }
5210
5221
  configPath = foundConfig;
5211
5222
  } else {
5212
- configPath = path9.resolve(process.cwd(), configPath);
5223
+ configPath = path10.resolve(process.cwd(), configPath);
5213
5224
  }
5214
5225
  if (!fs10.existsSync(configPath)) {
5215
5226
  const result2 = {
@@ -5256,7 +5267,7 @@ async function validateCommand(args2) {
5256
5267
  if (provision?.workflows) {
5257
5268
  for (const workflow of provision.workflows) {
5258
5269
  if (workflow.path) {
5259
- const absoluteWorkflowPath = path9.resolve(path9.dirname(configPath), workflow.path);
5270
+ const absoluteWorkflowPath = path10.resolve(path10.dirname(configPath), workflow.path);
5260
5271
  if (!fs10.existsSync(absoluteWorkflowPath)) {
5261
5272
  warnings.push(`Workflow file not found: ${workflow.path}`);
5262
5273
  }
@@ -5353,7 +5364,7 @@ async function validateCommand(args2) {
5353
5364
 
5354
5365
  // src/cli/commands/diff.ts
5355
5366
  var fs11 = __toESM(require("fs"));
5356
- var path10 = __toESM(require("path"));
5367
+ var path11 = __toESM(require("path"));
5357
5368
  init_utils();
5358
5369
  function printHelp6() {
5359
5370
  console.log(`
@@ -5386,7 +5397,7 @@ Examples:
5386
5397
  }
5387
5398
  function findConfigFile3(startDir) {
5388
5399
  for (const fileName of CONFIG_FILE_NAMES) {
5389
- const filePath = path10.join(startDir, fileName);
5400
+ const filePath = path11.join(startDir, fileName);
5390
5401
  if (fs11.existsSync(filePath)) {
5391
5402
  return filePath;
5392
5403
  }
@@ -5443,7 +5454,7 @@ async function diffCommand(args2) {
5443
5454
  }
5444
5455
  configPath = foundConfig;
5445
5456
  } else {
5446
- configPath = path10.resolve(process.cwd(), configPath);
5457
+ configPath = path11.resolve(process.cwd(), configPath);
5447
5458
  }
5448
5459
  if (!fs11.existsSync(configPath)) {
5449
5460
  if (jsonOutput) {
@@ -5487,7 +5498,7 @@ async function diffCommand(args2) {
5487
5498
  const registryPath = flags.registry || flags.r;
5488
5499
  if (registryPath) {
5489
5500
  try {
5490
- const registry = await loadRegistry(path10.resolve(process.cwd(), registryPath));
5501
+ const registry = await loadRegistry(path11.resolve(process.cwd(), registryPath));
5491
5502
  const toolNames = Object.values(registry).map((t) => t.name);
5492
5503
  toolsDiff = {
5493
5504
  added: toolNames,
@@ -5561,7 +5572,7 @@ async function diffCommand(args2) {
5561
5572
 
5562
5573
  // src/cli/commands/deploy.ts
5563
5574
  var fs12 = __toESM(require("fs"));
5564
- var path11 = __toESM(require("path"));
5575
+ var path12 = __toESM(require("path"));
5565
5576
  var readline2 = __toESM(require("readline"));
5566
5577
  init_utils();
5567
5578
  function printHelp7() {
@@ -5597,7 +5608,7 @@ Examples:
5597
5608
  }
5598
5609
  function findConfigFile4(startDir) {
5599
5610
  for (const fileName of CONFIG_FILE_NAMES) {
5600
- const filePath = path11.join(startDir, fileName);
5611
+ const filePath = path12.join(startDir, fileName);
5601
5612
  if (fs12.existsSync(filePath)) {
5602
5613
  return filePath;
5603
5614
  }
@@ -5712,7 +5723,7 @@ async function deployCommand(args2) {
5712
5723
  }
5713
5724
  configPath = foundConfig;
5714
5725
  } else {
5715
- configPath = path11.resolve(process.cwd(), configPath);
5726
+ configPath = path12.resolve(process.cwd(), configPath);
5716
5727
  }
5717
5728
  if (!fs12.existsSync(configPath)) {
5718
5729
  if (jsonOutput) {
@@ -6032,7 +6043,7 @@ async function logoutCommand(args2) {
6032
6043
 
6033
6044
  // src/cli/commands/auth/status.ts
6034
6045
  var fs13 = __toESM(require("fs"));
6035
- var path12 = __toESM(require("path"));
6046
+ var path13 = __toESM(require("path"));
6036
6047
  init_utils();
6037
6048
  function printHelp10() {
6038
6049
  console.log(`
@@ -6106,7 +6117,7 @@ async function statusCommand(args2) {
6106
6117
  console.log("");
6107
6118
  console.log(" * = active profile");
6108
6119
  }
6109
- const linksDir = path12.join(process.cwd(), ".skedyul", "links");
6120
+ const linksDir = path13.join(process.cwd(), ".skedyul", "links");
6110
6121
  console.log("");
6111
6122
  console.log("LINKED WORKPLACES (this project)");
6112
6123
  console.log("\u2500".repeat(60));
@@ -6116,7 +6127,7 @@ async function statusCommand(args2) {
6116
6127
  for (const file2 of linkFiles) {
6117
6128
  const subdomain = file2.replace(".json", "");
6118
6129
  try {
6119
- const content = fs13.readFileSync(path12.join(linksDir, file2), "utf-8");
6130
+ const content = fs13.readFileSync(path13.join(linksDir, file2), "utf-8");
6120
6131
  const link = JSON.parse(content);
6121
6132
  console.log(` - ${subdomain} (${link.appHandle})`);
6122
6133
  } catch {
@@ -6474,7 +6485,7 @@ EXAMPLES
6474
6485
 
6475
6486
  // src/cli/commands/config-export.ts
6476
6487
  var fs14 = __toESM(require("fs"));
6477
- var path13 = __toESM(require("path"));
6488
+ var path14 = __toESM(require("path"));
6478
6489
  function printHelp13() {
6479
6490
  console.log(`
6480
6491
  SKEDYUL CONFIG:EXPORT - Export resolved config to JSON
@@ -6520,7 +6531,7 @@ async function configExportCommand(args2) {
6520
6531
  const cwd = process.cwd();
6521
6532
  let configPath = null;
6522
6533
  for (const name of CONFIG_FILE_NAMES) {
6523
- const testPath = path13.join(cwd, name);
6534
+ const testPath = path14.join(cwd, name);
6524
6535
  if (fs14.existsSync(testPath)) {
6525
6536
  configPath = testPath;
6526
6537
  break;
@@ -6531,15 +6542,15 @@ async function configExportCommand(args2) {
6531
6542
  console.error("Make sure you are in the root of your integration project.");
6532
6543
  process.exit(1);
6533
6544
  }
6534
- console.log(`Loading config from ${path13.basename(configPath)}...`);
6545
+ console.log(`Loading config from ${path14.basename(configPath)}...`);
6535
6546
  try {
6536
6547
  const resolvedConfig = await loadAndResolveConfig(configPath);
6537
6548
  const serialized = serializeResolvedConfig(resolvedConfig);
6538
- const outputDir = path13.dirname(path13.resolve(cwd, outputPath));
6549
+ const outputDir = path14.dirname(path14.resolve(cwd, outputPath));
6539
6550
  if (!fs14.existsSync(outputDir)) {
6540
6551
  fs14.mkdirSync(outputDir, { recursive: true });
6541
6552
  }
6542
- const fullOutputPath = path13.resolve(cwd, outputPath);
6553
+ const fullOutputPath = path14.resolve(cwd, outputPath);
6543
6554
  fs14.writeFileSync(fullOutputPath, JSON.stringify(serialized, null, 2), "utf-8");
6544
6555
  console.log(``);
6545
6556
  console.log(`Config exported successfully!`);
@@ -7165,7 +7176,7 @@ async function handleUpsertMany(modelHandle, flags) {
7165
7176
  // src/cli/commands/build.ts
7166
7177
  var import_child_process = require("child_process");
7167
7178
  var fs15 = __toESM(require("fs"));
7168
- var path14 = __toESM(require("path"));
7179
+ var path15 = __toESM(require("path"));
7169
7180
  function printBuildHelp() {
7170
7181
  console.log(`
7171
7182
  SKEDYUL BUILD - Build your integration
@@ -7234,7 +7245,7 @@ async function buildCommand(args2) {
7234
7245
  const cwd = process.cwd();
7235
7246
  let configPath = null;
7236
7247
  for (const name of CONFIG_FILE_NAMES) {
7237
- const testPath = path14.join(cwd, name);
7248
+ const testPath = path15.join(cwd, name);
7238
7249
  if (fs15.existsSync(testPath)) {
7239
7250
  configPath = testPath;
7240
7251
  break;
@@ -7245,8 +7256,8 @@ async function buildCommand(args2) {
7245
7256
  console.error("Make sure you are in the root of your integration project.");
7246
7257
  process.exit(1);
7247
7258
  }
7248
- console.log(`Loading config from ${path14.basename(configPath)}...`);
7249
- const tempConfigPath = path14.join(cwd, ".skedyul-tsup.config.mjs");
7259
+ console.log(`Loading config from ${path15.basename(configPath)}...`);
7260
+ const tempConfigPath = path15.join(cwd, ".skedyul-tsup.config.mjs");
7250
7261
  let createdTempConfig = false;
7251
7262
  try {
7252
7263
  const config = await loadConfig(configPath);
@@ -7255,7 +7266,7 @@ async function buildCommand(args2) {
7255
7266
  const baseExternals = ["skedyul", `skedyul/${computeLayer}`, "zod"];
7256
7267
  const userExternals = config.build && "external" in config.build ? config.build.external ?? [] : [];
7257
7268
  const allExternals = [...baseExternals, ...userExternals];
7258
- const userTsupConfig = path14.join(cwd, "tsup.config.ts");
7269
+ const userTsupConfig = path15.join(cwd, "tsup.config.ts");
7259
7270
  const hasUserConfig = fs15.existsSync(userTsupConfig);
7260
7271
  console.log(``);
7261
7272
  console.log(`Building ${config.name ?? "integration"}...`);
@@ -7325,7 +7336,7 @@ async function buildCommand(args2) {
7325
7336
  var import_child_process2 = require("child_process");
7326
7337
  var http3 = __toESM(require("http"));
7327
7338
  var fs16 = __toESM(require("fs"));
7328
- var path15 = __toESM(require("path"));
7339
+ var path16 = __toESM(require("path"));
7329
7340
  var SMOKE_TEST_PORT = 3456;
7330
7341
  var HEALTH_CHECK_INTERVAL_MS = 500;
7331
7342
  var HEALTH_CHECK_MAX_RETRIES = 30;
@@ -7356,13 +7367,13 @@ WHAT IT DOES
7356
7367
  6. Exits with code 0 (success) or 1 (failure)
7357
7368
  `);
7358
7369
  }
7359
- function makeRequest(port, path16, method, body) {
7370
+ function makeRequest(port, path17, method, body) {
7360
7371
  return new Promise((resolve10, reject) => {
7361
7372
  const postData = body ? JSON.stringify(body) : void 0;
7362
7373
  const options = {
7363
7374
  hostname: "localhost",
7364
7375
  port,
7365
- path: path16,
7376
+ path: path17,
7366
7377
  method,
7367
7378
  headers: {
7368
7379
  "Content-Type": "application/json",
@@ -7450,7 +7461,7 @@ async function smokeTestCommand(args2) {
7450
7461
  const cwd = process.cwd();
7451
7462
  let configPath = null;
7452
7463
  for (const name of CONFIG_FILE_NAMES) {
7453
- const testPath = path15.join(cwd, name);
7464
+ const testPath = path16.join(cwd, name);
7454
7465
  if (fs16.existsSync(testPath)) {
7455
7466
  configPath = testPath;
7456
7467
  break;
@@ -1018,7 +1018,7 @@ async function handleOAuthCallback(parsedBody, hooks) {
1018
1018
  }
1019
1019
 
1020
1020
  // src/server/handlers/webhook-handler.ts
1021
- function parseWebhookRequest(parsedBody, method, url, path, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
1021
+ function parseWebhookRequest(parsedBody, method, url, path2, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
1022
1022
  const isEnvelope = typeof parsedBody === "object" && parsedBody !== null && "env" in parsedBody && "request" in parsedBody && "context" in parsedBody;
1023
1023
  if (isEnvelope) {
1024
1024
  const envelope = parsedBody;
@@ -1072,7 +1072,7 @@ function parseWebhookRequest(parsedBody, method, url, path, headers, query, rawB
1072
1072
  const webhookRequest = {
1073
1073
  method,
1074
1074
  url,
1075
- path,
1075
+ path: path2,
1076
1076
  headers,
1077
1077
  query,
1078
1078
  body: parsedBody,
@@ -1151,15 +1151,20 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
1151
1151
  }
1152
1152
  if (pathname === "/config" && req.method === "GET") {
1153
1153
  try {
1154
+ console.log(`[/config] Checking for config file at: ${CONFIG_FILE_PATH}`);
1154
1155
  if (fs.existsSync(CONFIG_FILE_PATH)) {
1155
1156
  const fileConfig = JSON.parse(fs.readFileSync(CONFIG_FILE_PATH, "utf-8"));
1157
+ console.log(`[/config] Loaded config from file: tools=${fileConfig.tools?.length ?? 0}, webhooks=${fileConfig.webhooks?.length ?? 0}`);
1156
1158
  sendJSON(res, 200, fileConfig);
1157
1159
  return;
1158
1160
  }
1161
+ console.log("[/config] Config file not found, falling back to runtime serialization");
1159
1162
  } catch (err) {
1160
1163
  console.warn("[/config] Failed to read config file, falling back to runtime serialization:", err);
1161
1164
  }
1162
- sendJSON(res, 200, serializeConfig(config));
1165
+ const serialized = serializeConfig(config);
1166
+ console.log(`[/config] Runtime serialization: tools=${serialized.tools?.length ?? 0}, webhooks=${serialized.webhooks?.length ?? 0}`);
1167
+ sendJSON(res, 200, serialized);
1163
1168
  return;
1164
1169
  }
1165
1170
  if (pathname.startsWith("/webhooks/") && webhookRegistry) {
@@ -1472,7 +1477,8 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
1472
1477
 
1473
1478
  // src/server/serverless.ts
1474
1479
  var fs2 = __toESM(require("fs"));
1475
- var CONFIG_FILE_PATH2 = ".skedyul/config.json";
1480
+ var path = __toESM(require("path"));
1481
+ var CONFIG_FILE_PATH2 = process.env.LAMBDA_TASK_ROOT ? path.join(process.env.LAMBDA_TASK_ROOT, ".skedyul", "config.json") : ".skedyul/config.json";
1476
1482
  function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1477
1483
  const headers = getDefaultHeaders(config.cors);
1478
1484
  const registry = config.tools;
@@ -1485,13 +1491,13 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1485
1491
  hasLoggedStartup = true;
1486
1492
  }
1487
1493
  try {
1488
- const path = event.path || event.rawPath || "/";
1494
+ const path2 = event.path || event.rawPath || "/";
1489
1495
  const method = event.httpMethod || event.requestContext?.http?.method || "POST";
1490
1496
  if (method === "OPTIONS") {
1491
1497
  return createResponse(200, { message: "OK" }, headers);
1492
1498
  }
1493
- if (path.startsWith("/webhooks/") && webhookRegistry) {
1494
- const handle = path.slice("/webhooks/".length);
1499
+ if (path2.startsWith("/webhooks/") && webhookRegistry) {
1500
+ const handle = path2.slice("/webhooks/".length);
1495
1501
  if (!webhookRegistry[handle]) {
1496
1502
  return createResponse(404, { error: `Webhook handler '${handle}' not found` }, headers);
1497
1503
  }
@@ -1514,12 +1520,12 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1514
1520
  const protocol = forwardedProto ?? "https";
1515
1521
  const host = event.headers?.host ?? event.headers?.Host ?? "localhost";
1516
1522
  const queryString = event.queryStringParameters ? "?" + new URLSearchParams(event.queryStringParameters).toString() : "";
1517
- const webhookUrl = `${protocol}://${host}${path}${queryString}`;
1523
+ const webhookUrl = `${protocol}://${host}${path2}${queryString}`;
1518
1524
  const parseResult = parseWebhookRequest(
1519
1525
  parsedBody,
1520
1526
  method,
1521
1527
  webhookUrl,
1522
- path,
1528
+ path2,
1523
1529
  event.headers,
1524
1530
  event.queryStringParameters ?? {},
1525
1531
  rawBody,
@@ -1540,7 +1546,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1540
1546
  body: result.body !== void 0 ? typeof result.body === "string" ? result.body : JSON.stringify(result.body) : ""
1541
1547
  };
1542
1548
  }
1543
- if (path === "/core" && method === "POST") {
1549
+ if (path2 === "/core" && method === "POST") {
1544
1550
  let coreBody;
1545
1551
  try {
1546
1552
  coreBody = event.body ? JSON.parse(event.body) : {};
@@ -1572,7 +1578,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1572
1578
  const result = await handleCoreMethod(coreMethod, coreBody.params);
1573
1579
  return createResponse(result.status, result.payload, headers);
1574
1580
  }
1575
- if (path === "/core/webhook" && method === "POST") {
1581
+ if (path2 === "/core/webhook" && method === "POST") {
1576
1582
  const rawWebhookBody = event.body ?? "";
1577
1583
  let webhookBody;
1578
1584
  try {
@@ -1587,14 +1593,14 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1587
1593
  const forwardedProto = event.headers?.["x-forwarded-proto"] ?? event.headers?.["X-Forwarded-Proto"];
1588
1594
  const protocol = forwardedProto ?? "https";
1589
1595
  const host = event.headers?.host ?? event.headers?.Host ?? "localhost";
1590
- const webhookUrl = `${protocol}://${host}${path}`;
1596
+ const webhookUrl = `${protocol}://${host}${path2}`;
1591
1597
  const coreWebhookRequest = {
1592
1598
  method,
1593
1599
  headers: event.headers ?? {},
1594
1600
  body: webhookBody,
1595
1601
  query: event.queryStringParameters ?? {},
1596
1602
  url: webhookUrl,
1597
- path,
1603
+ path: path2,
1598
1604
  rawBody: rawWebhookBody ? Buffer.from(rawWebhookBody, "utf-8") : void 0
1599
1605
  };
1600
1606
  const webhookResponse = await coreApiService.dispatchWebhook(
@@ -1606,7 +1612,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1606
1612
  headers
1607
1613
  );
1608
1614
  }
1609
- if (path === "/estimate" && method === "POST") {
1615
+ if (path2 === "/estimate" && method === "POST") {
1610
1616
  let estimateBody;
1611
1617
  try {
1612
1618
  estimateBody = event.body ? JSON.parse(event.body) : {};
@@ -1672,7 +1678,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1672
1678
  );
1673
1679
  }
1674
1680
  }
1675
- if (path === "/install" && method === "POST") {
1681
+ if (path2 === "/install" && method === "POST") {
1676
1682
  let installBody;
1677
1683
  try {
1678
1684
  installBody = event.body ? JSON.parse(event.body) : {};
@@ -1686,7 +1692,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1686
1692
  const result = await handleInstall(installBody, config.hooks);
1687
1693
  return createResponse(result.status, result.body, headers);
1688
1694
  }
1689
- if (path === "/uninstall" && method === "POST") {
1695
+ if (path2 === "/uninstall" && method === "POST") {
1690
1696
  let uninstallBody;
1691
1697
  try {
1692
1698
  uninstallBody = event.body ? JSON.parse(event.body) : {};
@@ -1700,7 +1706,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1700
1706
  const result = await handleUninstall(uninstallBody, config.hooks);
1701
1707
  return createResponse(result.status, result.body, headers);
1702
1708
  }
1703
- if (path === "/provision" && method === "POST") {
1709
+ if (path2 === "/provision" && method === "POST") {
1704
1710
  let provisionBody;
1705
1711
  try {
1706
1712
  provisionBody = event.body ? JSON.parse(event.body) : {};
@@ -1714,7 +1720,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1714
1720
  const result = await handleProvision(provisionBody, config.hooks);
1715
1721
  return createResponse(result.status, result.body, headers);
1716
1722
  }
1717
- if (path === "/oauth_callback" && method === "POST") {
1723
+ if (path2 === "/oauth_callback" && method === "POST") {
1718
1724
  let parsedBody;
1719
1725
  try {
1720
1726
  parsedBody = event.body ? JSON.parse(event.body) : {};
@@ -1729,21 +1735,26 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
1729
1735
  const result = await handleOAuthCallback(parsedBody, config.hooks);
1730
1736
  return createResponse(result.status, result.body, headers);
1731
1737
  }
1732
- if (path === "/health" && method === "GET") {
1738
+ if (path2 === "/health" && method === "GET") {
1733
1739
  return createResponse(200, state.getHealthStatus(), headers);
1734
1740
  }
1735
- if (path === "/config" && method === "GET") {
1741
+ if (path2 === "/config" && method === "GET") {
1736
1742
  try {
1743
+ console.log(`[/config] Checking for config file at: ${CONFIG_FILE_PATH2}`);
1737
1744
  if (fs2.existsSync(CONFIG_FILE_PATH2)) {
1738
1745
  const fileConfig = JSON.parse(fs2.readFileSync(CONFIG_FILE_PATH2, "utf-8"));
1746
+ console.log(`[/config] Loaded config from file: tools=${fileConfig.tools?.length ?? 0}, webhooks=${fileConfig.webhooks?.length ?? 0}`);
1739
1747
  return createResponse(200, fileConfig, headers);
1740
1748
  }
1749
+ console.log("[/config] Config file not found, falling back to runtime serialization");
1741
1750
  } catch (err) {
1742
1751
  console.warn("[/config] Failed to read config file, falling back to runtime serialization:", err);
1743
1752
  }
1744
- return createResponse(200, serializeConfig(config), headers);
1753
+ const serialized = serializeConfig(config);
1754
+ console.log(`[/config] Runtime serialization: tools=${serialized.tools?.length ?? 0}, webhooks=${serialized.webhooks?.length ?? 0}`);
1755
+ return createResponse(200, serialized, headers);
1745
1756
  }
1746
- if (path === "/mcp" && method === "POST") {
1757
+ if (path2 === "/mcp" && method === "POST") {
1747
1758
  let body;
1748
1759
  try {
1749
1760
  body = event.body ? JSON.parse(event.body) : {};