skedyul 1.2.51 → 1.3.1
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 +173 -143
- package/dist/config/app-config.d.ts +6 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/queue-config.d.ts +33 -0
- package/dist/dedicated/server.js +45 -16
- package/dist/esm/index.mjs +717 -50
- package/dist/index.d.ts +2 -0
- package/dist/index.js +731 -50
- package/dist/ratelimit/backends/index.d.ts +10 -0
- package/dist/ratelimit/backends/memory.d.ts +14 -0
- package/dist/ratelimit/backends/platform.d.ts +9 -0
- package/dist/ratelimit/config-loader.d.ts +10 -0
- package/dist/ratelimit/context.d.ts +7 -0
- package/dist/ratelimit/errors.d.ts +27 -0
- package/dist/ratelimit/index.d.ts +9 -0
- package/dist/ratelimit/queued-fetch.d.ts +11 -0
- package/dist/ratelimit/resolve-queue-key.d.ts +14 -0
- package/dist/ratelimit/should-retry.d.ts +5 -0
- package/dist/ratelimit/types.d.ts +43 -0
- package/dist/scheduling/index.js +14 -10
- package/dist/scheduling/index.mjs +14 -10
- package/dist/server.js +45 -16
- package/dist/serverless/server.mjs +45 -16
- package/package.json +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -2644,8 +2644,8 @@ async function toolsCommand(args2) {
|
|
|
2644
2644
|
}
|
|
2645
2645
|
|
|
2646
2646
|
// src/cli/commands/serve.ts
|
|
2647
|
-
var
|
|
2648
|
-
var
|
|
2647
|
+
var fs9 = __toESM(require("fs"));
|
|
2648
|
+
var path9 = __toESM(require("path"));
|
|
2649
2649
|
init_utils();
|
|
2650
2650
|
|
|
2651
2651
|
// src/server/index.ts
|
|
@@ -2696,6 +2696,16 @@ var CoreApiService = class {
|
|
|
2696
2696
|
};
|
|
2697
2697
|
var coreApiService = new CoreApiService();
|
|
2698
2698
|
|
|
2699
|
+
// src/ratelimit/config-loader.ts
|
|
2700
|
+
var fs7 = __toESM(require("fs"));
|
|
2701
|
+
var path7 = __toESM(require("path"));
|
|
2702
|
+
var cachedRuntimeQueues = null;
|
|
2703
|
+
var registeredServerConfig = null;
|
|
2704
|
+
function registerQueueConfig(config) {
|
|
2705
|
+
registeredServerConfig = config;
|
|
2706
|
+
cachedRuntimeQueues = config.queues ?? null;
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2699
2709
|
// src/server/utils/schema.ts
|
|
2700
2710
|
var z4 = __toESM(require("zod"));
|
|
2701
2711
|
function normalizeBilling(billing) {
|
|
@@ -2862,6 +2872,14 @@ function buildToolCallErrorOutput(result) {
|
|
|
2862
2872
|
};
|
|
2863
2873
|
}
|
|
2864
2874
|
|
|
2875
|
+
// src/ratelimit/context.ts
|
|
2876
|
+
var import_async_hooks2 = require("async_hooks");
|
|
2877
|
+
var executionContextStorage = new import_async_hooks2.AsyncLocalStorage();
|
|
2878
|
+
var activeOperationStorage = new import_async_hooks2.AsyncLocalStorage();
|
|
2879
|
+
function runWithRateLimitExecutionContext(ctx, fn) {
|
|
2880
|
+
return executionContextStorage.run(ctx, fn);
|
|
2881
|
+
}
|
|
2882
|
+
|
|
2865
2883
|
// src/errors.ts
|
|
2866
2884
|
var InstallError = class extends Error {
|
|
2867
2885
|
// Optional: which field caused the error
|
|
@@ -2881,8 +2899,8 @@ var AppAuthInvalidError = class extends Error {
|
|
|
2881
2899
|
};
|
|
2882
2900
|
|
|
2883
2901
|
// src/server/context-logger.ts
|
|
2884
|
-
var
|
|
2885
|
-
var logContextStorage = new
|
|
2902
|
+
var import_async_hooks3 = require("async_hooks");
|
|
2903
|
+
var logContextStorage = new import_async_hooks3.AsyncLocalStorage();
|
|
2886
2904
|
function runWithLogContext(context, fn) {
|
|
2887
2905
|
return logContextStorage.run(context, fn);
|
|
2888
2906
|
}
|
|
@@ -3075,9 +3093,17 @@ function createCallToolHandler(registry, state, onMaxRequests) {
|
|
|
3075
3093
|
baseUrl: toolEnv.SKEDYUL_API_URL ?? "",
|
|
3076
3094
|
apiToken: toolEnv.SKEDYUL_API_TOKEN ?? ""
|
|
3077
3095
|
};
|
|
3096
|
+
const rateLimitContext = {
|
|
3097
|
+
app,
|
|
3098
|
+
appInstallationId: trigger === "provision" ? void 0 : rawContext.appInstallationId,
|
|
3099
|
+
invocation,
|
|
3100
|
+
isProvisionContext: trigger === "provision"
|
|
3101
|
+
};
|
|
3078
3102
|
const functionResult = await runWithConfig(requestConfig, async () => {
|
|
3079
|
-
return await
|
|
3080
|
-
return await
|
|
3103
|
+
return await runWithRateLimitExecutionContext(rateLimitContext, async () => {
|
|
3104
|
+
return await runWithLogContext({ invocation }, async () => {
|
|
3105
|
+
return await fn(inputs, executionContext);
|
|
3106
|
+
});
|
|
3081
3107
|
});
|
|
3082
3108
|
});
|
|
3083
3109
|
const billing = normalizeBilling(functionResult.billing);
|
|
@@ -3121,6 +3147,7 @@ function createCallToolHandler(registry, state, onMaxRequests) {
|
|
|
3121
3147
|
};
|
|
3122
3148
|
}
|
|
3123
3149
|
const errorMessage = error instanceof Error ? error.message : String(error ?? "");
|
|
3150
|
+
const errorCode = error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : "TOOL_EXECUTION_ERROR";
|
|
3124
3151
|
return {
|
|
3125
3152
|
output: null,
|
|
3126
3153
|
billing: { credits: 0 },
|
|
@@ -3130,7 +3157,7 @@ function createCallToolHandler(registry, state, onMaxRequests) {
|
|
|
3130
3157
|
toolName
|
|
3131
3158
|
},
|
|
3132
3159
|
error: {
|
|
3133
|
-
code:
|
|
3160
|
+
code: errorCode,
|
|
3134
3161
|
message: errorMessage
|
|
3135
3162
|
}
|
|
3136
3163
|
};
|
|
@@ -3214,7 +3241,7 @@ function printStartupLog(config, tools, port) {
|
|
|
3214
3241
|
|
|
3215
3242
|
// src/server/route-handlers/adapters.ts
|
|
3216
3243
|
function fromLambdaEvent(event2) {
|
|
3217
|
-
const
|
|
3244
|
+
const path24 = event2.path || event2.rawPath || "/";
|
|
3218
3245
|
const method = event2.httpMethod || event2.requestContext?.http?.method || "POST";
|
|
3219
3246
|
const forwardedProto = event2.headers?.["x-forwarded-proto"] ?? event2.headers?.["X-Forwarded-Proto"];
|
|
3220
3247
|
const protocol = forwardedProto ?? "https";
|
|
@@ -3222,9 +3249,9 @@ function fromLambdaEvent(event2) {
|
|
|
3222
3249
|
const queryString = event2.queryStringParameters ? "?" + new URLSearchParams(
|
|
3223
3250
|
event2.queryStringParameters
|
|
3224
3251
|
).toString() : "";
|
|
3225
|
-
const url = `${protocol}://${host}${
|
|
3252
|
+
const url = `${protocol}://${host}${path24}${queryString}`;
|
|
3226
3253
|
return {
|
|
3227
|
-
path:
|
|
3254
|
+
path: path24,
|
|
3228
3255
|
method,
|
|
3229
3256
|
headers: event2.headers,
|
|
3230
3257
|
query: event2.queryStringParameters ?? {},
|
|
@@ -3306,8 +3333,8 @@ function parseBodyByContentType(req) {
|
|
|
3306
3333
|
}
|
|
3307
3334
|
|
|
3308
3335
|
// src/server/route-handlers/handlers.ts
|
|
3309
|
-
var
|
|
3310
|
-
var
|
|
3336
|
+
var fs8 = __toESM(require("fs"));
|
|
3337
|
+
var path8 = __toESM(require("path"));
|
|
3311
3338
|
|
|
3312
3339
|
// src/server/core-api-handler.ts
|
|
3313
3340
|
async function handleCoreMethod(method, params) {
|
|
@@ -3475,7 +3502,8 @@ function serializeConfig(config) {
|
|
|
3475
3502
|
type: w.type ?? "WEBHOOK"
|
|
3476
3503
|
})) : [],
|
|
3477
3504
|
provision: isProvisionConfig(config.provision) ? config.provision : void 0,
|
|
3478
|
-
agents: config.agents
|
|
3505
|
+
agents: config.agents,
|
|
3506
|
+
queues: config.queues
|
|
3479
3507
|
};
|
|
3480
3508
|
}
|
|
3481
3509
|
function isProvisionConfig(value) {
|
|
@@ -3771,7 +3799,7 @@ async function handleOAuthCallback(parsedBody, hooks) {
|
|
|
3771
3799
|
}
|
|
3772
3800
|
|
|
3773
3801
|
// src/server/handlers/webhook-handler.ts
|
|
3774
|
-
function parseWebhookRequest(parsedBody, method, url,
|
|
3802
|
+
function parseWebhookRequest(parsedBody, method, url, path24, headers, query, rawBody, appIdHeader, appVersionIdHeader) {
|
|
3775
3803
|
const isEnvelope = typeof parsedBody === "object" && parsedBody !== null && "env" in parsedBody && "request" in parsedBody && "context" in parsedBody;
|
|
3776
3804
|
if (isEnvelope) {
|
|
3777
3805
|
const envelope = parsedBody;
|
|
@@ -3825,7 +3853,7 @@ function parseWebhookRequest(parsedBody, method, url, path23, headers, query, ra
|
|
|
3825
3853
|
const webhookRequest = {
|
|
3826
3854
|
method,
|
|
3827
3855
|
url,
|
|
3828
|
-
path:
|
|
3856
|
+
path: path24,
|
|
3829
3857
|
headers,
|
|
3830
3858
|
query,
|
|
3831
3859
|
body: parsedBody,
|
|
@@ -3883,7 +3911,7 @@ function isMethodAllowed(webhookRegistry, handle, method) {
|
|
|
3883
3911
|
|
|
3884
3912
|
// src/server/route-handlers/handlers.ts
|
|
3885
3913
|
function getConfigFilePath() {
|
|
3886
|
-
return process.env.LAMBDA_TASK_ROOT ?
|
|
3914
|
+
return process.env.LAMBDA_TASK_ROOT ? path8.join(process.env.LAMBDA_TASK_ROOT, ".skedyul", "config.json") : ".skedyul/config.json";
|
|
3887
3915
|
}
|
|
3888
3916
|
function findToolInRegistry(registry, toolName) {
|
|
3889
3917
|
for (const [key, t] of Object.entries(registry)) {
|
|
@@ -3922,8 +3950,8 @@ function handleHealthRoute(ctx) {
|
|
|
3922
3950
|
function handleConfigRoute(ctx) {
|
|
3923
3951
|
const configFilePath = getConfigFilePath();
|
|
3924
3952
|
try {
|
|
3925
|
-
if (
|
|
3926
|
-
const fileConfig = JSON.parse(
|
|
3953
|
+
if (fs8.existsSync(configFilePath)) {
|
|
3954
|
+
const fileConfig = JSON.parse(fs8.readFileSync(configFilePath, "utf-8"));
|
|
3927
3955
|
return { status: 200, body: fileConfig };
|
|
3928
3956
|
}
|
|
3929
3957
|
} catch (err) {
|
|
@@ -4608,6 +4636,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer) {
|
|
|
4608
4636
|
installContextLogger();
|
|
4609
4637
|
function createSkedyulServer(config) {
|
|
4610
4638
|
mergeRuntimeEnv();
|
|
4639
|
+
registerQueueConfig(config);
|
|
4611
4640
|
const registry = config.tools;
|
|
4612
4641
|
const webhookRegistry = config.webhooks;
|
|
4613
4642
|
if (config.coreApi?.service) {
|
|
@@ -5097,16 +5126,16 @@ function writeServeState(port, workplace) {
|
|
|
5097
5126
|
workplace,
|
|
5098
5127
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5099
5128
|
};
|
|
5100
|
-
const statePath =
|
|
5101
|
-
|
|
5129
|
+
const statePath = path9.join(process.cwd(), SERVE_STATE_FILE);
|
|
5130
|
+
fs9.writeFileSync(statePath, JSON.stringify(state, null, 2));
|
|
5102
5131
|
} catch {
|
|
5103
5132
|
}
|
|
5104
5133
|
}
|
|
5105
5134
|
function removeServeState() {
|
|
5106
5135
|
try {
|
|
5107
|
-
const statePath =
|
|
5108
|
-
if (
|
|
5109
|
-
|
|
5136
|
+
const statePath = path9.join(process.cwd(), SERVE_STATE_FILE);
|
|
5137
|
+
if (fs9.existsSync(statePath)) {
|
|
5138
|
+
fs9.unlinkSync(statePath);
|
|
5110
5139
|
}
|
|
5111
5140
|
} catch {
|
|
5112
5141
|
}
|
|
@@ -5774,13 +5803,13 @@ Press Ctrl+C to stop`);
|
|
|
5774
5803
|
}
|
|
5775
5804
|
|
|
5776
5805
|
// src/cli/commands/validate.ts
|
|
5777
|
-
var
|
|
5778
|
-
var
|
|
5806
|
+
var fs13 = __toESM(require("fs"));
|
|
5807
|
+
var path13 = __toESM(require("path"));
|
|
5779
5808
|
init_utils();
|
|
5780
5809
|
|
|
5781
5810
|
// src/config/loader.ts
|
|
5782
|
-
var
|
|
5783
|
-
var
|
|
5811
|
+
var fs10 = __toESM(require("fs"));
|
|
5812
|
+
var path10 = __toESM(require("path"));
|
|
5784
5813
|
var os2 = __toESM(require("os"));
|
|
5785
5814
|
var CONFIG_FILE_NAMES = [
|
|
5786
5815
|
"skedyul.config.ts",
|
|
@@ -5789,13 +5818,13 @@ var CONFIG_FILE_NAMES = [
|
|
|
5789
5818
|
"skedyul.config.cjs"
|
|
5790
5819
|
];
|
|
5791
5820
|
async function transpileTypeScript(filePath) {
|
|
5792
|
-
const content =
|
|
5793
|
-
const configDir =
|
|
5821
|
+
const content = fs10.readFileSync(filePath, "utf-8");
|
|
5822
|
+
const configDir = path10.dirname(path10.resolve(filePath));
|
|
5794
5823
|
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*$/, "}");
|
|
5795
5824
|
transpiled = transpiled.replace(
|
|
5796
5825
|
/import\s+(\w+)\s+from\s+['"](\.[^'"]+)['"]\s*(?:with\s*\{[^}]*\})?/g,
|
|
5797
5826
|
(match, varName, relativePath) => {
|
|
5798
|
-
const absolutePath =
|
|
5827
|
+
const absolutePath = path10.resolve(configDir, relativePath);
|
|
5799
5828
|
return `const ${varName} = require('${absolutePath.replace(/\\/g, "/")}')`;
|
|
5800
5829
|
}
|
|
5801
5830
|
);
|
|
@@ -5803,8 +5832,8 @@ async function transpileTypeScript(filePath) {
|
|
|
5803
5832
|
return transpiled;
|
|
5804
5833
|
}
|
|
5805
5834
|
async function loadConfig(configPath) {
|
|
5806
|
-
const absolutePath =
|
|
5807
|
-
if (!
|
|
5835
|
+
const absolutePath = path10.resolve(configPath);
|
|
5836
|
+
if (!fs10.existsSync(absolutePath)) {
|
|
5808
5837
|
throw new Error(`Config file not found: ${absolutePath}`);
|
|
5809
5838
|
}
|
|
5810
5839
|
const isTypeScript = absolutePath.endsWith(".ts");
|
|
@@ -5813,8 +5842,8 @@ async function loadConfig(configPath) {
|
|
|
5813
5842
|
if (isTypeScript) {
|
|
5814
5843
|
const transpiled = await transpileTypeScript(absolutePath);
|
|
5815
5844
|
const tempDir = os2.tmpdir();
|
|
5816
|
-
const tempFile =
|
|
5817
|
-
|
|
5845
|
+
const tempFile = path10.join(tempDir, `skedyul-config-${Date.now()}.cjs`);
|
|
5846
|
+
fs10.writeFileSync(tempFile, transpiled);
|
|
5818
5847
|
moduleToLoad = tempFile;
|
|
5819
5848
|
try {
|
|
5820
5849
|
const module3 = require(moduleToLoad);
|
|
@@ -5828,7 +5857,7 @@ async function loadConfig(configPath) {
|
|
|
5828
5857
|
return config2;
|
|
5829
5858
|
} finally {
|
|
5830
5859
|
try {
|
|
5831
|
-
|
|
5860
|
+
fs10.unlinkSync(tempFile);
|
|
5832
5861
|
} catch {
|
|
5833
5862
|
}
|
|
5834
5863
|
}
|
|
@@ -5863,8 +5892,8 @@ function validateConfig(config) {
|
|
|
5863
5892
|
}
|
|
5864
5893
|
|
|
5865
5894
|
// src/config/schema-loader.ts
|
|
5866
|
-
var
|
|
5867
|
-
var
|
|
5895
|
+
var fs11 = __toESM(require("fs"));
|
|
5896
|
+
var path11 = __toESM(require("path"));
|
|
5868
5897
|
var os3 = __toESM(require("os"));
|
|
5869
5898
|
|
|
5870
5899
|
// src/schemas/crm-schema.ts
|
|
@@ -6017,39 +6046,39 @@ function validateCRMSchema(data) {
|
|
|
6017
6046
|
|
|
6018
6047
|
// src/config/schema-loader.ts
|
|
6019
6048
|
async function transpileSchemaTypeScript(filePath) {
|
|
6020
|
-
const content =
|
|
6049
|
+
const content = fs11.readFileSync(filePath, "utf-8");
|
|
6021
6050
|
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*$/, "}");
|
|
6022
6051
|
return transpiled;
|
|
6023
6052
|
}
|
|
6024
6053
|
async function loadSchema(schemaPath, options = {}) {
|
|
6025
6054
|
const { validate = true } = options;
|
|
6026
|
-
const absolutePath =
|
|
6027
|
-
if (!
|
|
6055
|
+
const absolutePath = path11.resolve(schemaPath);
|
|
6056
|
+
if (!fs11.existsSync(absolutePath)) {
|
|
6028
6057
|
throw new Error(`Schema file not found: ${absolutePath}`);
|
|
6029
6058
|
}
|
|
6030
6059
|
const isTypeScript = absolutePath.endsWith(".ts");
|
|
6031
6060
|
const isJson = absolutePath.endsWith(".json");
|
|
6032
6061
|
if (!isTypeScript && !isJson) {
|
|
6033
6062
|
throw new Error(
|
|
6034
|
-
`Unsupported schema file format: ${
|
|
6063
|
+
`Unsupported schema file format: ${path11.extname(absolutePath)}. Use .schema.ts or .schema.json`
|
|
6035
6064
|
);
|
|
6036
6065
|
}
|
|
6037
6066
|
let rawSchema;
|
|
6038
6067
|
try {
|
|
6039
6068
|
if (isJson) {
|
|
6040
|
-
const content =
|
|
6069
|
+
const content = fs11.readFileSync(absolutePath, "utf-8");
|
|
6041
6070
|
rawSchema = JSON.parse(content);
|
|
6042
6071
|
} else {
|
|
6043
6072
|
const transpiled = await transpileSchemaTypeScript(absolutePath);
|
|
6044
6073
|
const tempDir = os3.tmpdir();
|
|
6045
|
-
const tempFile =
|
|
6046
|
-
|
|
6074
|
+
const tempFile = path11.join(tempDir, `skedyul-schema-${Date.now()}.cjs`);
|
|
6075
|
+
fs11.writeFileSync(tempFile, transpiled);
|
|
6047
6076
|
try {
|
|
6048
6077
|
const module2 = require(tempFile);
|
|
6049
6078
|
rawSchema = module2.default || module2;
|
|
6050
6079
|
} finally {
|
|
6051
6080
|
try {
|
|
6052
|
-
|
|
6081
|
+
fs11.unlinkSync(tempFile);
|
|
6053
6082
|
} catch {
|
|
6054
6083
|
}
|
|
6055
6084
|
}
|
|
@@ -6094,10 +6123,10 @@ export default defineSchema(${jsonContent})
|
|
|
6094
6123
|
`;
|
|
6095
6124
|
}
|
|
6096
6125
|
async function saveSchema(schema, outputPath, options = {}) {
|
|
6097
|
-
const absolutePath =
|
|
6126
|
+
const absolutePath = path11.resolve(outputPath);
|
|
6098
6127
|
const isTypeScript = absolutePath.endsWith(".ts");
|
|
6099
6128
|
const content = isTypeScript ? serializeSchemaToTypeScript(schema) : serializeSchemaToJson(schema, options);
|
|
6100
|
-
|
|
6129
|
+
fs11.writeFileSync(absolutePath, content, "utf-8");
|
|
6101
6130
|
}
|
|
6102
6131
|
var FIELD_TYPE_MAP = {
|
|
6103
6132
|
string: "STRING",
|
|
@@ -6244,8 +6273,8 @@ function transformToBackendSchema(schema) {
|
|
|
6244
6273
|
}
|
|
6245
6274
|
|
|
6246
6275
|
// src/config/resolver.ts
|
|
6247
|
-
var
|
|
6248
|
-
var
|
|
6276
|
+
var fs12 = __toESM(require("fs"));
|
|
6277
|
+
var path12 = __toESM(require("path"));
|
|
6249
6278
|
async function loadConfigModule(absolutePath) {
|
|
6250
6279
|
if (absolutePath.endsWith(".ts")) {
|
|
6251
6280
|
const altPaths = [
|
|
@@ -6254,7 +6283,7 @@ async function loadConfigModule(absolutePath) {
|
|
|
6254
6283
|
absolutePath.replace(".ts", ".js")
|
|
6255
6284
|
];
|
|
6256
6285
|
for (const altPath of altPaths) {
|
|
6257
|
-
if (
|
|
6286
|
+
if (fs12.existsSync(altPath)) {
|
|
6258
6287
|
return await import(altPath);
|
|
6259
6288
|
}
|
|
6260
6289
|
}
|
|
@@ -6271,7 +6300,7 @@ async function loadConfigModule(absolutePath) {
|
|
|
6271
6300
|
return await import(absolutePath);
|
|
6272
6301
|
}
|
|
6273
6302
|
async function loadAndResolveConfig(configPath) {
|
|
6274
|
-
const absolutePath =
|
|
6303
|
+
const absolutePath = path12.resolve(configPath);
|
|
6275
6304
|
const module2 = await loadConfigModule(absolutePath);
|
|
6276
6305
|
const config = module2.default;
|
|
6277
6306
|
if (!config || typeof config !== "object") {
|
|
@@ -6334,7 +6363,8 @@ function serializeResolvedConfig(config) {
|
|
|
6334
6363
|
type: w.type ?? "WEBHOOK"
|
|
6335
6364
|
})) : [],
|
|
6336
6365
|
provision: config.provision,
|
|
6337
|
-
agents: config.agents
|
|
6366
|
+
agents: config.agents,
|
|
6367
|
+
queues: config.queues
|
|
6338
6368
|
};
|
|
6339
6369
|
}
|
|
6340
6370
|
|
|
@@ -6375,8 +6405,8 @@ Examples:
|
|
|
6375
6405
|
}
|
|
6376
6406
|
function findConfigFile2(startDir) {
|
|
6377
6407
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
6378
|
-
const filePath =
|
|
6379
|
-
if (
|
|
6408
|
+
const filePath = path13.join(startDir, fileName);
|
|
6409
|
+
if (fs13.existsSync(filePath)) {
|
|
6380
6410
|
return filePath;
|
|
6381
6411
|
}
|
|
6382
6412
|
}
|
|
@@ -6410,9 +6440,9 @@ async function validateCommand(args2) {
|
|
|
6410
6440
|
}
|
|
6411
6441
|
configPath = foundConfig;
|
|
6412
6442
|
} else {
|
|
6413
|
-
configPath =
|
|
6443
|
+
configPath = path13.resolve(process.cwd(), configPath);
|
|
6414
6444
|
}
|
|
6415
|
-
if (!
|
|
6445
|
+
if (!fs13.existsSync(configPath)) {
|
|
6416
6446
|
const result2 = {
|
|
6417
6447
|
valid: false,
|
|
6418
6448
|
configPath,
|
|
@@ -6457,8 +6487,8 @@ async function validateCommand(args2) {
|
|
|
6457
6487
|
if (provision?.workflows) {
|
|
6458
6488
|
for (const workflow of provision.workflows) {
|
|
6459
6489
|
if (workflow.path) {
|
|
6460
|
-
const absoluteWorkflowPath =
|
|
6461
|
-
if (!
|
|
6490
|
+
const absoluteWorkflowPath = path13.resolve(path13.dirname(configPath), workflow.path);
|
|
6491
|
+
if (!fs13.existsSync(absoluteWorkflowPath)) {
|
|
6462
6492
|
warnings.push(`Workflow file not found: ${workflow.path}`);
|
|
6463
6493
|
}
|
|
6464
6494
|
}
|
|
@@ -6553,8 +6583,8 @@ async function validateCommand(args2) {
|
|
|
6553
6583
|
}
|
|
6554
6584
|
|
|
6555
6585
|
// src/cli/commands/diff.ts
|
|
6556
|
-
var
|
|
6557
|
-
var
|
|
6586
|
+
var fs14 = __toESM(require("fs"));
|
|
6587
|
+
var path14 = __toESM(require("path"));
|
|
6558
6588
|
init_utils();
|
|
6559
6589
|
function printHelp6() {
|
|
6560
6590
|
console.log(`
|
|
@@ -6587,8 +6617,8 @@ Examples:
|
|
|
6587
6617
|
}
|
|
6588
6618
|
function findConfigFile3(startDir) {
|
|
6589
6619
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
6590
|
-
const filePath =
|
|
6591
|
-
if (
|
|
6620
|
+
const filePath = path14.join(startDir, fileName);
|
|
6621
|
+
if (fs14.existsSync(filePath)) {
|
|
6592
6622
|
return filePath;
|
|
6593
6623
|
}
|
|
6594
6624
|
}
|
|
@@ -6644,9 +6674,9 @@ async function diffCommand(args2) {
|
|
|
6644
6674
|
}
|
|
6645
6675
|
configPath = foundConfig;
|
|
6646
6676
|
} else {
|
|
6647
|
-
configPath =
|
|
6677
|
+
configPath = path14.resolve(process.cwd(), configPath);
|
|
6648
6678
|
}
|
|
6649
|
-
if (!
|
|
6679
|
+
if (!fs14.existsSync(configPath)) {
|
|
6650
6680
|
if (jsonOutput) {
|
|
6651
6681
|
console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
|
|
6652
6682
|
} else {
|
|
@@ -6688,7 +6718,7 @@ async function diffCommand(args2) {
|
|
|
6688
6718
|
const registryPath = flags.registry || flags.r;
|
|
6689
6719
|
if (registryPath) {
|
|
6690
6720
|
try {
|
|
6691
|
-
const registry = await loadRegistry(
|
|
6721
|
+
const registry = await loadRegistry(path14.resolve(process.cwd(), registryPath));
|
|
6692
6722
|
const toolNames = Object.values(registry).map((t) => t.name);
|
|
6693
6723
|
toolsDiff = {
|
|
6694
6724
|
added: toolNames,
|
|
@@ -6761,8 +6791,8 @@ async function diffCommand(args2) {
|
|
|
6761
6791
|
}
|
|
6762
6792
|
|
|
6763
6793
|
// src/cli/commands/deploy.ts
|
|
6764
|
-
var
|
|
6765
|
-
var
|
|
6794
|
+
var fs15 = __toESM(require("fs"));
|
|
6795
|
+
var path15 = __toESM(require("path"));
|
|
6766
6796
|
var readline3 = __toESM(require("readline"));
|
|
6767
6797
|
init_utils();
|
|
6768
6798
|
function printHelp7() {
|
|
@@ -6798,8 +6828,8 @@ Examples:
|
|
|
6798
6828
|
}
|
|
6799
6829
|
function findConfigFile4(startDir) {
|
|
6800
6830
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
6801
|
-
const filePath =
|
|
6802
|
-
if (
|
|
6831
|
+
const filePath = path15.join(startDir, fileName);
|
|
6832
|
+
if (fs15.existsSync(filePath)) {
|
|
6803
6833
|
return filePath;
|
|
6804
6834
|
}
|
|
6805
6835
|
}
|
|
@@ -6913,9 +6943,9 @@ async function deployCommand(args2) {
|
|
|
6913
6943
|
}
|
|
6914
6944
|
configPath = foundConfig;
|
|
6915
6945
|
} else {
|
|
6916
|
-
configPath =
|
|
6946
|
+
configPath = path15.resolve(process.cwd(), configPath);
|
|
6917
6947
|
}
|
|
6918
|
-
if (!
|
|
6948
|
+
if (!fs15.existsSync(configPath)) {
|
|
6919
6949
|
if (jsonOutput) {
|
|
6920
6950
|
console.log(JSON.stringify({ error: `Config file not found: ${configPath}` }));
|
|
6921
6951
|
} else {
|
|
@@ -7232,8 +7262,8 @@ async function logoutCommand(args2) {
|
|
|
7232
7262
|
}
|
|
7233
7263
|
|
|
7234
7264
|
// src/cli/commands/auth/status.ts
|
|
7235
|
-
var
|
|
7236
|
-
var
|
|
7265
|
+
var fs16 = __toESM(require("fs"));
|
|
7266
|
+
var path16 = __toESM(require("path"));
|
|
7237
7267
|
init_utils();
|
|
7238
7268
|
function printHelp10() {
|
|
7239
7269
|
console.log(`
|
|
@@ -7307,17 +7337,17 @@ async function statusCommand(args2) {
|
|
|
7307
7337
|
console.log("");
|
|
7308
7338
|
console.log(" * = active profile");
|
|
7309
7339
|
}
|
|
7310
|
-
const linksDir =
|
|
7340
|
+
const linksDir = path16.join(process.cwd(), ".skedyul", "links");
|
|
7311
7341
|
console.log("");
|
|
7312
7342
|
console.log("LINKED WORKPLACES (this project)");
|
|
7313
7343
|
console.log("\u2500".repeat(60));
|
|
7314
|
-
if (
|
|
7315
|
-
const linkFiles =
|
|
7344
|
+
if (fs16.existsSync(linksDir)) {
|
|
7345
|
+
const linkFiles = fs16.readdirSync(linksDir).filter((f) => f.endsWith(".json"));
|
|
7316
7346
|
if (linkFiles.length > 0) {
|
|
7317
7347
|
for (const file2 of linkFiles) {
|
|
7318
7348
|
const subdomain = file2.replace(".json", "");
|
|
7319
7349
|
try {
|
|
7320
|
-
const content =
|
|
7350
|
+
const content = fs16.readFileSync(path16.join(linksDir, file2), "utf-8");
|
|
7321
7351
|
const link = JSON.parse(content);
|
|
7322
7352
|
console.log(` - ${subdomain} (${link.appHandle})`);
|
|
7323
7353
|
} catch {
|
|
@@ -7674,8 +7704,8 @@ EXAMPLES
|
|
|
7674
7704
|
}
|
|
7675
7705
|
|
|
7676
7706
|
// src/cli/commands/config-export.ts
|
|
7677
|
-
var
|
|
7678
|
-
var
|
|
7707
|
+
var fs17 = __toESM(require("fs"));
|
|
7708
|
+
var path17 = __toESM(require("path"));
|
|
7679
7709
|
function printHelp13() {
|
|
7680
7710
|
console.log(`
|
|
7681
7711
|
SKEDYUL CONFIG:EXPORT - Export resolved config to JSON
|
|
@@ -7721,8 +7751,8 @@ async function configExportCommand(args2) {
|
|
|
7721
7751
|
const cwd = process.cwd();
|
|
7722
7752
|
let configPath = null;
|
|
7723
7753
|
for (const name of CONFIG_FILE_NAMES) {
|
|
7724
|
-
const testPath =
|
|
7725
|
-
if (
|
|
7754
|
+
const testPath = path17.join(cwd, name);
|
|
7755
|
+
if (fs17.existsSync(testPath)) {
|
|
7726
7756
|
configPath = testPath;
|
|
7727
7757
|
break;
|
|
7728
7758
|
}
|
|
@@ -7732,16 +7762,16 @@ async function configExportCommand(args2) {
|
|
|
7732
7762
|
console.error("Make sure you are in the root of your integration project.");
|
|
7733
7763
|
process.exit(1);
|
|
7734
7764
|
}
|
|
7735
|
-
console.log(`Loading config from ${
|
|
7765
|
+
console.log(`Loading config from ${path17.basename(configPath)}...`);
|
|
7736
7766
|
try {
|
|
7737
7767
|
const resolvedConfig = await loadAndResolveConfig(configPath);
|
|
7738
7768
|
const serialized = serializeResolvedConfig(resolvedConfig);
|
|
7739
|
-
const outputDir =
|
|
7740
|
-
if (!
|
|
7741
|
-
|
|
7769
|
+
const outputDir = path17.dirname(path17.resolve(cwd, outputPath));
|
|
7770
|
+
if (!fs17.existsSync(outputDir)) {
|
|
7771
|
+
fs17.mkdirSync(outputDir, { recursive: true });
|
|
7742
7772
|
}
|
|
7743
|
-
const fullOutputPath =
|
|
7744
|
-
|
|
7773
|
+
const fullOutputPath = path17.resolve(cwd, outputPath);
|
|
7774
|
+
fs17.writeFileSync(fullOutputPath, JSON.stringify(serialized, null, 2), "utf-8");
|
|
7745
7775
|
console.log(``);
|
|
7746
7776
|
console.log(`Config exported successfully!`);
|
|
7747
7777
|
console.log(` Output: ${outputPath}`);
|
|
@@ -8383,8 +8413,8 @@ async function handleCreateMany(modelHandle, flags) {
|
|
|
8383
8413
|
console.error("Usage: skedyul instances create-many <model> --file data.json --workplace <subdomain>");
|
|
8384
8414
|
process.exit(1);
|
|
8385
8415
|
}
|
|
8386
|
-
const
|
|
8387
|
-
const fileContent =
|
|
8416
|
+
const fs24 = await import("fs");
|
|
8417
|
+
const fileContent = fs24.readFileSync(filePath, "utf-8");
|
|
8388
8418
|
const items = JSON.parse(fileContent);
|
|
8389
8419
|
if (!Array.isArray(items)) {
|
|
8390
8420
|
console.error("Error: File must contain a JSON array of items");
|
|
@@ -8411,8 +8441,8 @@ async function handleUpsertMany(modelHandle, flags) {
|
|
|
8411
8441
|
console.error("Usage: skedyul instances upsert-many <model> --file data.json --match-field <field> --workplace <subdomain>");
|
|
8412
8442
|
process.exit(1);
|
|
8413
8443
|
}
|
|
8414
|
-
const
|
|
8415
|
-
const fileContent =
|
|
8444
|
+
const fs24 = await import("fs");
|
|
8445
|
+
const fileContent = fs24.readFileSync(filePath, "utf-8");
|
|
8416
8446
|
const items = JSON.parse(fileContent);
|
|
8417
8447
|
if (!Array.isArray(items)) {
|
|
8418
8448
|
console.error("Error: File must contain a JSON array of items");
|
|
@@ -8424,8 +8454,8 @@ async function handleUpsertMany(modelHandle, flags) {
|
|
|
8424
8454
|
|
|
8425
8455
|
// src/cli/commands/build.ts
|
|
8426
8456
|
var import_child_process = require("child_process");
|
|
8427
|
-
var
|
|
8428
|
-
var
|
|
8457
|
+
var fs18 = __toESM(require("fs"));
|
|
8458
|
+
var path18 = __toESM(require("path"));
|
|
8429
8459
|
function printBuildHelp() {
|
|
8430
8460
|
console.log(`
|
|
8431
8461
|
SKEDYUL BUILD - Build your integration
|
|
@@ -8494,8 +8524,8 @@ async function buildCommand(args2) {
|
|
|
8494
8524
|
const cwd = process.cwd();
|
|
8495
8525
|
let configPath = null;
|
|
8496
8526
|
for (const name of CONFIG_FILE_NAMES) {
|
|
8497
|
-
const testPath =
|
|
8498
|
-
if (
|
|
8527
|
+
const testPath = path18.join(cwd, name);
|
|
8528
|
+
if (fs18.existsSync(testPath)) {
|
|
8499
8529
|
configPath = testPath;
|
|
8500
8530
|
break;
|
|
8501
8531
|
}
|
|
@@ -8505,8 +8535,8 @@ async function buildCommand(args2) {
|
|
|
8505
8535
|
console.error("Make sure you are in the root of your integration project.");
|
|
8506
8536
|
process.exit(1);
|
|
8507
8537
|
}
|
|
8508
|
-
console.log(`Loading config from ${
|
|
8509
|
-
const tempConfigPath =
|
|
8538
|
+
console.log(`Loading config from ${path18.basename(configPath)}...`);
|
|
8539
|
+
const tempConfigPath = path18.join(cwd, ".skedyul-tsup.config.mjs");
|
|
8510
8540
|
let createdTempConfig = false;
|
|
8511
8541
|
try {
|
|
8512
8542
|
const config = await loadConfig(configPath);
|
|
@@ -8515,8 +8545,8 @@ async function buildCommand(args2) {
|
|
|
8515
8545
|
const baseExternals = ["skedyul", `skedyul/${computeLayer}`, "zod"];
|
|
8516
8546
|
const userExternals = config.build && "external" in config.build ? config.build.external ?? [] : [];
|
|
8517
8547
|
const allExternals = [...baseExternals, ...userExternals];
|
|
8518
|
-
const userTsupConfig =
|
|
8519
|
-
const hasUserConfig =
|
|
8548
|
+
const userTsupConfig = path18.join(cwd, "tsup.config.ts");
|
|
8549
|
+
const hasUserConfig = fs18.existsSync(userTsupConfig);
|
|
8520
8550
|
console.log(``);
|
|
8521
8551
|
console.log(`Building ${config.name ?? "integration"}...`);
|
|
8522
8552
|
console.log(` Compute layer: ${computeLayer}`);
|
|
@@ -8536,7 +8566,7 @@ async function buildCommand(args2) {
|
|
|
8536
8566
|
}
|
|
8537
8567
|
} else {
|
|
8538
8568
|
const tsupConfigContent = generateTsupConfig(format, allExternals);
|
|
8539
|
-
|
|
8569
|
+
fs18.writeFileSync(tempConfigPath, tsupConfigContent, "utf-8");
|
|
8540
8570
|
createdTempConfig = true;
|
|
8541
8571
|
tsupArgs = [
|
|
8542
8572
|
"tsup",
|
|
@@ -8554,14 +8584,14 @@ async function buildCommand(args2) {
|
|
|
8554
8584
|
});
|
|
8555
8585
|
tsup.on("error", (error) => {
|
|
8556
8586
|
console.error("Failed to start tsup:", error.message);
|
|
8557
|
-
if (createdTempConfig &&
|
|
8558
|
-
|
|
8587
|
+
if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
|
|
8588
|
+
fs18.unlinkSync(tempConfigPath);
|
|
8559
8589
|
}
|
|
8560
8590
|
process.exit(1);
|
|
8561
8591
|
});
|
|
8562
8592
|
tsup.on("close", (code) => {
|
|
8563
|
-
if (createdTempConfig &&
|
|
8564
|
-
|
|
8593
|
+
if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
|
|
8594
|
+
fs18.unlinkSync(tempConfigPath);
|
|
8565
8595
|
}
|
|
8566
8596
|
if (code === 0) {
|
|
8567
8597
|
console.log(``);
|
|
@@ -8570,8 +8600,8 @@ async function buildCommand(args2) {
|
|
|
8570
8600
|
process.exit(code ?? 0);
|
|
8571
8601
|
});
|
|
8572
8602
|
} catch (error) {
|
|
8573
|
-
if (createdTempConfig &&
|
|
8574
|
-
|
|
8603
|
+
if (createdTempConfig && fs18.existsSync(tempConfigPath)) {
|
|
8604
|
+
fs18.unlinkSync(tempConfigPath);
|
|
8575
8605
|
}
|
|
8576
8606
|
console.error(
|
|
8577
8607
|
"Error loading config:",
|
|
@@ -8584,8 +8614,8 @@ async function buildCommand(args2) {
|
|
|
8584
8614
|
// src/cli/commands/smoke-test.ts
|
|
8585
8615
|
var import_child_process2 = require("child_process");
|
|
8586
8616
|
var http3 = __toESM(require("http"));
|
|
8587
|
-
var
|
|
8588
|
-
var
|
|
8617
|
+
var fs19 = __toESM(require("fs"));
|
|
8618
|
+
var path19 = __toESM(require("path"));
|
|
8589
8619
|
var SMOKE_TEST_PORT = 3456;
|
|
8590
8620
|
var HEALTH_CHECK_INTERVAL_MS = 500;
|
|
8591
8621
|
var HEALTH_CHECK_MAX_RETRIES = 30;
|
|
@@ -8616,13 +8646,13 @@ WHAT IT DOES
|
|
|
8616
8646
|
6. Exits with code 0 (success) or 1 (failure)
|
|
8617
8647
|
`);
|
|
8618
8648
|
}
|
|
8619
|
-
function makeRequest(port,
|
|
8649
|
+
function makeRequest(port, path24, method, body) {
|
|
8620
8650
|
return new Promise((resolve15, reject) => {
|
|
8621
8651
|
const postData = body ? JSON.stringify(body) : void 0;
|
|
8622
8652
|
const options = {
|
|
8623
8653
|
hostname: "localhost",
|
|
8624
8654
|
port,
|
|
8625
|
-
path:
|
|
8655
|
+
path: path24,
|
|
8626
8656
|
method,
|
|
8627
8657
|
headers: {
|
|
8628
8658
|
"Content-Type": "application/json",
|
|
@@ -8710,8 +8740,8 @@ async function smokeTestCommand(args2) {
|
|
|
8710
8740
|
const cwd = process.cwd();
|
|
8711
8741
|
let configPath = null;
|
|
8712
8742
|
for (const name of CONFIG_FILE_NAMES) {
|
|
8713
|
-
const testPath =
|
|
8714
|
-
if (
|
|
8743
|
+
const testPath = path19.join(cwd, name);
|
|
8744
|
+
if (fs19.existsSync(testPath)) {
|
|
8715
8745
|
configPath = testPath;
|
|
8716
8746
|
break;
|
|
8717
8747
|
}
|
|
@@ -8727,10 +8757,10 @@ async function smokeTestCommand(args2) {
|
|
|
8727
8757
|
}
|
|
8728
8758
|
const serverExt = computeLayer === "serverless" ? "mjs" : "js";
|
|
8729
8759
|
let serverPath = `dist/server/mcp_server.${serverExt}`;
|
|
8730
|
-
if (!
|
|
8760
|
+
if (!fs19.existsSync(serverPath)) {
|
|
8731
8761
|
const fallbackExt = serverExt === "mjs" ? "js" : "mjs";
|
|
8732
8762
|
const fallbackPath = `dist/server/mcp_server.${fallbackExt}`;
|
|
8733
|
-
if (
|
|
8763
|
+
if (fs19.existsSync(fallbackPath)) {
|
|
8734
8764
|
console.warn(`[SmokeTest] Warning: Expected ${serverPath} but found ${fallbackPath}`);
|
|
8735
8765
|
console.warn(`[SmokeTest] Using ${fallbackPath} instead`);
|
|
8736
8766
|
serverPath = fallbackPath;
|
|
@@ -9248,8 +9278,8 @@ async function crmCommand(args2) {
|
|
|
9248
9278
|
}
|
|
9249
9279
|
|
|
9250
9280
|
// src/cli/commands/agents.ts
|
|
9251
|
-
var
|
|
9252
|
-
var
|
|
9281
|
+
var fs20 = __toESM(require("fs"));
|
|
9282
|
+
var path20 = __toESM(require("path"));
|
|
9253
9283
|
var import_yaml = require("yaml");
|
|
9254
9284
|
init_utils();
|
|
9255
9285
|
|
|
@@ -10308,11 +10338,11 @@ function isAgentV3(agent) {
|
|
|
10308
10338
|
return "handle" in obj && !("stages" in obj) && !("agents" in obj);
|
|
10309
10339
|
}
|
|
10310
10340
|
async function loadAgentFile(filePath) {
|
|
10311
|
-
const absolutePath =
|
|
10312
|
-
if (!
|
|
10341
|
+
const absolutePath = path20.resolve(filePath);
|
|
10342
|
+
if (!fs20.existsSync(absolutePath)) {
|
|
10313
10343
|
throw new Error(`Agent file not found: ${absolutePath}`);
|
|
10314
10344
|
}
|
|
10315
|
-
const content =
|
|
10345
|
+
const content = fs20.readFileSync(absolutePath, "utf-8");
|
|
10316
10346
|
const isJson = absolutePath.endsWith(".json");
|
|
10317
10347
|
const isYaml = absolutePath.endsWith(".yml") || absolutePath.endsWith(".yaml");
|
|
10318
10348
|
let rawAgent;
|
|
@@ -10322,7 +10352,7 @@ async function loadAgentFile(filePath) {
|
|
|
10322
10352
|
rawAgent = (0, import_yaml.parse)(content);
|
|
10323
10353
|
} else {
|
|
10324
10354
|
throw new Error(
|
|
10325
|
-
`Unsupported agent file format: ${
|
|
10355
|
+
`Unsupported agent file format: ${path20.extname(absolutePath)}. Use .agent.yml or .agent.json`
|
|
10326
10356
|
);
|
|
10327
10357
|
}
|
|
10328
10358
|
const detectedV3 = isAgentV3(rawAgent);
|
|
@@ -10332,8 +10362,8 @@ async function loadAgentFile(filePath) {
|
|
|
10332
10362
|
return { agent: v3Result.data, content, isV3: true };
|
|
10333
10363
|
}
|
|
10334
10364
|
const errorMessages = v3Result.error.issues.map((e) => {
|
|
10335
|
-
const
|
|
10336
|
-
return ` - ${
|
|
10365
|
+
const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
|
|
10366
|
+
return ` - ${path24}: ${e.message}`;
|
|
10337
10367
|
}).join("\n");
|
|
10338
10368
|
throw new Error(`Agent v3 validation failed:
|
|
10339
10369
|
${errorMessages}`);
|
|
@@ -10345,8 +10375,8 @@ ${errorMessages}`);
|
|
|
10345
10375
|
const v3Result = validateAgentYAMLV3(rawAgent);
|
|
10346
10376
|
if (!v3Result.success) {
|
|
10347
10377
|
const errorMessages2 = v3Result.error.issues.map((e) => {
|
|
10348
|
-
const
|
|
10349
|
-
return ` - ${
|
|
10378
|
+
const path24 = e.path.length > 0 ? e.path.join(".") : "(root)";
|
|
10379
|
+
return ` - ${path24}: ${e.message}`;
|
|
10350
10380
|
}).join("\n");
|
|
10351
10381
|
throw new Error(`Agent v3 validation failed:
|
|
10352
10382
|
${errorMessages2}`);
|
|
@@ -11042,14 +11072,14 @@ async function* parseSSEStream(response, debug2 = false) {
|
|
|
11042
11072
|
}
|
|
11043
11073
|
|
|
11044
11074
|
// src/cli/utils/mock-context.ts
|
|
11045
|
-
var
|
|
11046
|
-
var
|
|
11075
|
+
var fs21 = __toESM(require("fs"));
|
|
11076
|
+
var path21 = __toESM(require("path"));
|
|
11047
11077
|
function loadContext(filePath) {
|
|
11048
|
-
const absolutePath =
|
|
11049
|
-
if (!
|
|
11078
|
+
const absolutePath = path21.resolve(filePath);
|
|
11079
|
+
if (!fs21.existsSync(absolutePath)) {
|
|
11050
11080
|
throw new Error(`Context file not found: ${absolutePath}`);
|
|
11051
11081
|
}
|
|
11052
|
-
const content =
|
|
11082
|
+
const content = fs21.readFileSync(absolutePath, "utf-8");
|
|
11053
11083
|
let rawContext;
|
|
11054
11084
|
try {
|
|
11055
11085
|
rawContext = JSON.parse(content);
|
|
@@ -12135,8 +12165,8 @@ Error: ${input.name} is required`);
|
|
|
12135
12165
|
}
|
|
12136
12166
|
|
|
12137
12167
|
// src/cli/commands/skills.ts
|
|
12138
|
-
var
|
|
12139
|
-
var
|
|
12168
|
+
var fs22 = __toESM(require("fs"));
|
|
12169
|
+
var path22 = __toESM(require("path"));
|
|
12140
12170
|
var import_yaml2 = require("yaml");
|
|
12141
12171
|
init_utils();
|
|
12142
12172
|
function printHelp21() {
|
|
@@ -12208,12 +12238,12 @@ async function getWorkplaceToken6(workplaceSubdomain, serverUrl, cliToken) {
|
|
|
12208
12238
|
);
|
|
12209
12239
|
}
|
|
12210
12240
|
async function loadSkillFile(filePath) {
|
|
12211
|
-
const absolutePath =
|
|
12212
|
-
if (!
|
|
12241
|
+
const absolutePath = path22.resolve(filePath);
|
|
12242
|
+
if (!fs22.existsSync(absolutePath)) {
|
|
12213
12243
|
throw new Error(`File not found: ${absolutePath}`);
|
|
12214
12244
|
}
|
|
12215
|
-
const content =
|
|
12216
|
-
const ext =
|
|
12245
|
+
const content = fs22.readFileSync(absolutePath, "utf-8");
|
|
12246
|
+
const ext = path22.extname(absolutePath).toLowerCase();
|
|
12217
12247
|
if (ext !== ".yml" && ext !== ".yaml") {
|
|
12218
12248
|
throw new Error("Skill file must be a .skill.yml or .skill.yaml file");
|
|
12219
12249
|
}
|
|
@@ -12658,8 +12688,8 @@ async function skillsCommand(args2) {
|
|
|
12658
12688
|
}
|
|
12659
12689
|
|
|
12660
12690
|
// src/cli/commands/workflows.ts
|
|
12661
|
-
var
|
|
12662
|
-
var
|
|
12691
|
+
var fs23 = __toESM(require("fs"));
|
|
12692
|
+
var path23 = __toESM(require("path"));
|
|
12663
12693
|
var readline7 = __toESM(require("readline"));
|
|
12664
12694
|
var import_yaml3 = require("yaml");
|
|
12665
12695
|
init_utils();
|
|
@@ -12924,12 +12954,12 @@ async function getWorkplaceToken7(workplaceSubdomain, serverUrl, cliToken) {
|
|
|
12924
12954
|
);
|
|
12925
12955
|
}
|
|
12926
12956
|
async function loadWorkflowFile(filePath) {
|
|
12927
|
-
const absolutePath =
|
|
12928
|
-
if (!
|
|
12957
|
+
const absolutePath = path23.resolve(filePath);
|
|
12958
|
+
if (!fs23.existsSync(absolutePath)) {
|
|
12929
12959
|
throw new Error(`File not found: ${absolutePath}`);
|
|
12930
12960
|
}
|
|
12931
|
-
const content =
|
|
12932
|
-
const ext =
|
|
12961
|
+
const content = fs23.readFileSync(absolutePath, "utf-8");
|
|
12962
|
+
const ext = path23.extname(absolutePath).toLowerCase();
|
|
12933
12963
|
if (ext !== ".yml" && ext !== ".yaml") {
|
|
12934
12964
|
throw new Error("Workflow file must be a .yml or .yaml file");
|
|
12935
12965
|
}
|
|
@@ -13288,8 +13318,8 @@ async function handlePull2(args2) {
|
|
|
13288
13318
|
console.log(JSON.stringify(result, null, 2));
|
|
13289
13319
|
return;
|
|
13290
13320
|
}
|
|
13291
|
-
const outputPath =
|
|
13292
|
-
|
|
13321
|
+
const outputPath = path23.resolve(output || `./${handle}.workflow.yml`);
|
|
13322
|
+
fs23.writeFileSync(outputPath, result.yaml, "utf-8");
|
|
13293
13323
|
console.log(`Saved v${result.version} to ${outputPath}`);
|
|
13294
13324
|
}
|
|
13295
13325
|
async function handlePublish3(args2) {
|