@kikimoradev/kcloud 1.5.6 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +25 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2401,7 +2401,11 @@ z.object({
|
|
|
2401
2401
|
truncated: z.boolean()
|
|
2402
2402
|
}).meta({ id: "GitHubRepositoryList" });
|
|
2403
2403
|
z.object({ credentialId: idSchema });
|
|
2404
|
-
const toolKindSchema = z.enum([
|
|
2404
|
+
const toolKindSchema = z.enum([
|
|
2405
|
+
"http_api",
|
|
2406
|
+
"mcp_server",
|
|
2407
|
+
"environment"
|
|
2408
|
+
]);
|
|
2405
2409
|
const httpAuthKindSchema = z.enum([
|
|
2406
2410
|
"none",
|
|
2407
2411
|
"bearer",
|
|
@@ -2492,9 +2496,12 @@ const mcpValueSchema = z.object({
|
|
|
2492
2496
|
name: z.string().min(1).max(64),
|
|
2493
2497
|
value: z.string().max(maxMcpValueLength).refine(withoutNul, { message: "expected a value without a NUL character" }).nullable()
|
|
2494
2498
|
});
|
|
2495
|
-
const
|
|
2499
|
+
const environmentValueSchema = mcpValueSchema.extend({ name: z.string().regex(mcpEnvironmentNamePattern).refine((name) => !isReservedEnvironmentName(name), { message: "expected a name outside the prefixes the platform and the image own" }) });
|
|
2500
|
+
const mcpEnvironmentValueSchema = environmentValueSchema.meta({ id: "McpEnvironmentValue" });
|
|
2501
|
+
const environmentVariableSchema = environmentValueSchema.meta({ id: "EnvironmentVariable" });
|
|
2496
2502
|
const mcpHeaderValueSchema = mcpValueSchema.extend({ name: z.string().regex(httpHeaderNamePattern) }).meta({ id: "McpHeaderValue" });
|
|
2497
2503
|
const distinctNames = (values) => new Set(values.map((value) => value.name)).size === values.length;
|
|
2504
|
+
const environmentValuesSchema = (value) => z.array(value).max(32).refine(distinctNames, { message: "expected every variable name to appear once" });
|
|
2498
2505
|
const distinctHeaderNames = (values) => new Set(values.map((value) => value.name.toLowerCase())).size === values.length;
|
|
2499
2506
|
const httpApiConfigSchema = z.strictObject({
|
|
2500
2507
|
kind: z.literal("http_api"),
|
|
@@ -2507,7 +2514,7 @@ const mcpStdioConfigSchema = z.strictObject({
|
|
|
2507
2514
|
transport: z.literal("stdio"),
|
|
2508
2515
|
command: z.string().trim().min(1).max(200).refine(runnableCommand, { message: "expected a command that is not an option and holds no line break" }),
|
|
2509
2516
|
args: z.array(z.string().max(500)).max(32),
|
|
2510
|
-
env:
|
|
2517
|
+
env: environmentValuesSchema(mcpEnvironmentValueSchema)
|
|
2511
2518
|
}).meta({ id: "McpStdioConfig" });
|
|
2512
2519
|
const mcpHttpConfigSchema = z.strictObject({
|
|
2513
2520
|
kind: z.literal("mcp_server"),
|
|
@@ -2516,11 +2523,21 @@ const mcpHttpConfigSchema = z.strictObject({
|
|
|
2516
2523
|
headers: z.array(mcpHeaderValueSchema).max(16).refine(distinctHeaderNames, { message: "expected every header name to appear once, whatever its case" })
|
|
2517
2524
|
}).meta({ id: "McpHttpConfig" });
|
|
2518
2525
|
const mcpServerConfigSchema = z.discriminatedUnion("transport", [mcpStdioConfigSchema, mcpHttpConfigSchema]);
|
|
2519
|
-
const
|
|
2526
|
+
const environmentConfigSchema = z.strictObject({
|
|
2527
|
+
kind: z.literal("environment"),
|
|
2528
|
+
variables: environmentValuesSchema(environmentVariableSchema).min(1)
|
|
2529
|
+
}).meta({ id: "EnvironmentConfig" });
|
|
2530
|
+
const toolConfigSchema = z.discriminatedUnion("kind", [
|
|
2531
|
+
httpApiConfigSchema,
|
|
2532
|
+
mcpServerConfigSchema,
|
|
2533
|
+
environmentConfigSchema
|
|
2534
|
+
]).meta({ id: "ToolConfig" });
|
|
2520
2535
|
const secretsOf = (values) => values.filter((value) => value.value === null);
|
|
2536
|
+
const environmentSecretKeysOf = (values) => secretsOf(values).map((entry) => `env:${entry.name}`);
|
|
2521
2537
|
const requiredSecretKeysOf = (config) => {
|
|
2522
2538
|
if (config.kind === "http_api") return config.auth.kind === "none" ? [] : ["key"];
|
|
2523
|
-
|
|
2539
|
+
if (config.kind === "environment") return environmentSecretKeysOf(config.variables);
|
|
2540
|
+
return config.transport === "stdio" ? environmentSecretKeysOf(config.env) : secretsOf(config.headers).map((header) => `header:${header.name}`);
|
|
2524
2541
|
};
|
|
2525
2542
|
const toolSecretStateSchema = z.object({
|
|
2526
2543
|
key: z.string(),
|
|
@@ -8649,7 +8666,7 @@ const copiedTool = async (api, projectId, toolId, targetProjectId) => dataOf("co
|
|
|
8649
8666
|
}), toolHints);
|
|
8650
8667
|
const createToolsCommand = (adaptersOf) => defineGroup({
|
|
8651
8668
|
name: "tools",
|
|
8652
|
-
summary: "The HTTP APIs
|
|
8669
|
+
summary: "The HTTP APIs, MCP servers and environment variables a project offers its agents.",
|
|
8653
8670
|
usage: "tools <command>",
|
|
8654
8671
|
subcommands: [
|
|
8655
8672
|
defineCommand({
|
|
@@ -8828,7 +8845,7 @@ const projectToolTools = [
|
|
|
8828
8845
|
defineTool({
|
|
8829
8846
|
name: "tools_list",
|
|
8830
8847
|
title: "List tools",
|
|
8831
|
-
description: "List the HTTP APIs
|
|
8848
|
+
description: "List the HTTP APIs, MCP servers and sets of environment variables a project can give its agents, or show one of them with tool.",
|
|
8832
8849
|
operations: ["listTools"],
|
|
8833
8850
|
safety: "read",
|
|
8834
8851
|
input: z.object({
|
|
@@ -8843,7 +8860,7 @@ const projectToolTools = [
|
|
|
8843
8860
|
defineTool({
|
|
8844
8861
|
name: "tool_create",
|
|
8845
8862
|
title: "Create a tool",
|
|
8846
|
-
description: `Create an HTTP API
|
|
8863
|
+
description: `Create an HTTP API, an MCP server or a set of environment variables as a tool of a project. ${withoutSecrets}`,
|
|
8847
8864
|
operations: ["createTool"],
|
|
8848
8865
|
safety: "write",
|
|
8849
8866
|
input: z.object({
|