@kairos-sdk/core 0.5.0 → 0.5.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/README.md +10 -1
- package/dist/{chunk-HBGZTUUZ.js → chunk-GVZKMS53.js} +5 -7
- package/dist/chunk-GVZKMS53.js.map +1 -0
- package/dist/{chunk-5GAY7CSJ.js → chunk-MYAGTDQ2.js} +2 -2
- package/dist/{chunk-EVOAYH2K.js → chunk-V2IZBZGB.js} +2 -2
- package/dist/{chunk-KIFT5LA7.js → chunk-VPPWTMRJ.js} +2 -2
- package/dist/chunk-VPPWTMRJ.js.map +1 -0
- package/dist/cli.cjs +55 -37
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +27 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +32 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -4
- package/dist/mcp-server.cjs +92 -21
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/mcp-server.js +90 -19
- package/dist/mcp-server.js.map +1 -1
- package/dist/standalone.cjs +1 -1
- package/dist/standalone.cjs.map +1 -1
- package/dist/standalone.js +2 -2
- package/package.json +12 -5
- package/dist/chunk-HBGZTUUZ.js.map +0 -1
- package/dist/chunk-KIFT5LA7.js.map +0 -1
- /package/dist/{chunk-5GAY7CSJ.js.map → chunk-MYAGTDQ2.js.map} +0 -0
- /package/dist/{chunk-EVOAYH2K.js.map → chunk-V2IZBZGB.js.map} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -502,6 +502,36 @@ var N8nProvider = class {
|
|
|
502
502
|
}
|
|
503
503
|
};
|
|
504
504
|
|
|
505
|
+
// src/errors/generation-error.ts
|
|
506
|
+
var GenerationError = class extends KairosError {
|
|
507
|
+
constructor(message, cause) {
|
|
508
|
+
super(message, cause);
|
|
509
|
+
this.name = "GenerationError";
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// src/errors/response-parse-error.ts
|
|
514
|
+
var ResponseParseError = class extends KairosError {
|
|
515
|
+
constructor(message, cause) {
|
|
516
|
+
super(message, cause);
|
|
517
|
+
this.name = "ResponseParseError";
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// src/errors/validation-error.ts
|
|
522
|
+
var ValidationError = class extends KairosError {
|
|
523
|
+
constructor(message, issues, attemptMetadata, warnedRules) {
|
|
524
|
+
super(message);
|
|
525
|
+
this.issues = issues;
|
|
526
|
+
this.attemptMetadata = attemptMetadata;
|
|
527
|
+
this.warnedRules = warnedRules;
|
|
528
|
+
this.name = "ValidationError";
|
|
529
|
+
}
|
|
530
|
+
issues;
|
|
531
|
+
attemptMetadata;
|
|
532
|
+
warnedRules;
|
|
533
|
+
};
|
|
534
|
+
|
|
505
535
|
// src/validation/registry.ts
|
|
506
536
|
var DEFAULT_REGISTRY = [
|
|
507
537
|
// Trigger nodes
|
|
@@ -1276,36 +1306,6 @@ var N8nValidator = class {
|
|
|
1276
1306
|
}
|
|
1277
1307
|
};
|
|
1278
1308
|
|
|
1279
|
-
// src/errors/generation-error.ts
|
|
1280
|
-
var GenerationError = class extends KairosError {
|
|
1281
|
-
constructor(message, cause) {
|
|
1282
|
-
super(message, cause);
|
|
1283
|
-
this.name = "GenerationError";
|
|
1284
|
-
}
|
|
1285
|
-
};
|
|
1286
|
-
|
|
1287
|
-
// src/errors/response-parse-error.ts
|
|
1288
|
-
var ResponseParseError = class extends KairosError {
|
|
1289
|
-
constructor(message, cause) {
|
|
1290
|
-
super(message, cause);
|
|
1291
|
-
this.name = "ResponseParseError";
|
|
1292
|
-
}
|
|
1293
|
-
};
|
|
1294
|
-
|
|
1295
|
-
// src/errors/validation-error.ts
|
|
1296
|
-
var ValidationError = class extends KairosError {
|
|
1297
|
-
constructor(message, issues, attemptMetadata, warnedRules) {
|
|
1298
|
-
super(message);
|
|
1299
|
-
this.issues = issues;
|
|
1300
|
-
this.attemptMetadata = attemptMetadata;
|
|
1301
|
-
this.warnedRules = warnedRules;
|
|
1302
|
-
this.name = "ValidationError";
|
|
1303
|
-
}
|
|
1304
|
-
issues;
|
|
1305
|
-
attemptMetadata;
|
|
1306
|
-
warnedRules;
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
1309
|
// src/generation/prompt-builder.ts
|
|
1310
1310
|
var import_node_fs = require("fs");
|
|
1311
1311
|
var import_node_path = require("path");
|
|
@@ -2310,7 +2310,7 @@ var PatternAnalyzer = class _PatternAnalyzer {
|
|
|
2310
2310
|
this._cachedEvents = events;
|
|
2311
2311
|
const starts = events.filter((e) => e.eventType === "build_start");
|
|
2312
2312
|
const attempts = events.filter((e) => e.eventType === "generation_attempt");
|
|
2313
|
-
const
|
|
2313
|
+
const _passed = attempts.filter(
|
|
2314
2314
|
(a) => a.data.validationPassed === true
|
|
2315
2315
|
);
|
|
2316
2316
|
const failed = attempts.filter(
|
|
@@ -2804,7 +2804,6 @@ var DEFAULT_MODEL = process.env["KAIROS_MODEL"] ?? "claude-sonnet-4-6";
|
|
|
2804
2804
|
var Kairos = class {
|
|
2805
2805
|
provider;
|
|
2806
2806
|
designer;
|
|
2807
|
-
validator;
|
|
2808
2807
|
library;
|
|
2809
2808
|
logger;
|
|
2810
2809
|
telemetry;
|
|
@@ -2830,7 +2829,6 @@ var Kairos = class {
|
|
|
2830
2829
|
const anthropic = new import_sdk.default({ apiKey: options.anthropicApiKey });
|
|
2831
2830
|
const patternsPath = typeof options.telemetry === "string" ? (0, import_node_path6.join)(options.telemetry, "..", "patterns.json") : (0, import_node_path6.join)((0, import_node_os5.homedir)(), ".kairos", "patterns.json");
|
|
2832
2831
|
this.designer = new WorkflowDesigner(anthropic, this.model, logger, patternsPath);
|
|
2833
|
-
this.validator = new N8nValidator();
|
|
2834
2832
|
this.library = options.library ?? new NullLibrary();
|
|
2835
2833
|
this.logger = logger;
|
|
2836
2834
|
if (options.telemetry === true) {
|
|
@@ -2927,7 +2925,6 @@ var Kairos = class {
|
|
|
2927
2925
|
}
|
|
2928
2926
|
await this.emitAttemptTelemetry(description, designResult, workflowType, runId);
|
|
2929
2927
|
const workflow = options?.name ? { ...designResult.workflow, name: options.name } : designResult.workflow;
|
|
2930
|
-
this.saveToLibrary(workflow, description, designResult, matches);
|
|
2931
2928
|
if (options?.dryRun) {
|
|
2932
2929
|
const totalTokensInput2 = designResult.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0);
|
|
2933
2930
|
const totalTokensOutput2 = designResult.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0);
|
|
@@ -2963,6 +2960,7 @@ var Kairos = class {
|
|
|
2963
2960
|
if (options?.activate) {
|
|
2964
2961
|
await provider.activate(deployed.workflowId);
|
|
2965
2962
|
}
|
|
2963
|
+
this.saveToLibrary(workflow, description, designResult, matches, deployed.workflowId);
|
|
2966
2964
|
let smokeTestResult;
|
|
2967
2965
|
if (options?.smokeTest) {
|
|
2968
2966
|
smokeTestResult = await provider.smokeTest(deployed.workflowId, workflow).catch((err) => {
|
|
@@ -4124,6 +4122,7 @@ Build options:
|
|
|
4124
4122
|
--dry-run Generate and validate without deploying
|
|
4125
4123
|
--name <name> Override the generated workflow name
|
|
4126
4124
|
--activate Activate the workflow after deployment
|
|
4125
|
+
--smoke-test After deploy, trigger the workflow and verify it runs without error
|
|
4127
4126
|
|
|
4128
4127
|
Patterns options:
|
|
4129
4128
|
--days <days> Analysis window (default: 30)
|
|
@@ -4217,7 +4216,7 @@ function createDryRunClient() {
|
|
|
4217
4216
|
async function handleBuild(positional, flags) {
|
|
4218
4217
|
const description = positional.join(" ");
|
|
4219
4218
|
if (!description) {
|
|
4220
|
-
console.error("Usage: kairos build <description> [--dry-run] [--name <name>] [--activate]");
|
|
4219
|
+
console.error("Usage: kairos build <description> [--dry-run] [--name <name>] [--activate] [--smoke-test]");
|
|
4221
4220
|
process.exit(1);
|
|
4222
4221
|
}
|
|
4223
4222
|
const isDryRun = flags["dry-run"] === true;
|
|
@@ -4227,7 +4226,8 @@ async function handleBuild(positional, flags) {
|
|
|
4227
4226
|
const result = await kairos.build(description, {
|
|
4228
4227
|
dryRun: isDryRun,
|
|
4229
4228
|
...typeof flags["name"] === "string" ? { name: flags["name"] } : {},
|
|
4230
|
-
activate: flags["activate"] === true
|
|
4229
|
+
activate: flags["activate"] === true || flags["smoke-test"] === true,
|
|
4230
|
+
smokeTest: flags["smoke-test"] === true
|
|
4231
4231
|
});
|
|
4232
4232
|
await kairos.drain();
|
|
4233
4233
|
const elapsed = ((Date.now() - start) / 1e3).toFixed(1);
|
|
@@ -4240,7 +4240,8 @@ async function handleBuild(positional, flags) {
|
|
|
4240
4240
|
activationRequired: result.activationRequired,
|
|
4241
4241
|
dryRun: result.dryRun,
|
|
4242
4242
|
credentialsNeeded: result.credentialsNeeded,
|
|
4243
|
-
...result.dryRun ? { workflow: result.workflow } : {}
|
|
4243
|
+
...result.dryRun ? { workflow: result.workflow } : {},
|
|
4244
|
+
...result.smokeTest ? { smokeTest: result.smokeTest } : {}
|
|
4244
4245
|
}, null, 2));
|
|
4245
4246
|
}
|
|
4246
4247
|
async function handleReplace(positional) {
|
|
@@ -4531,11 +4532,28 @@ async function handleInit() {
|
|
|
4531
4532
|
}
|
|
4532
4533
|
const kairosDir = join8(homedir7(), ".kairos");
|
|
4533
4534
|
await mkdir4(join8(kairosDir, "telemetry"), { recursive: true });
|
|
4535
|
+
const kairosPath = process.execPath ? `${process.execPath.replace(/node$/, "kairos-mcp")}` : "kairos-mcp";
|
|
4534
4536
|
console.error("");
|
|
4535
4537
|
console.error(" Setup complete! Try:");
|
|
4536
4538
|
console.error("");
|
|
4537
4539
|
console.error(' kairos build "Send a Slack message when a webhook fires" --dry-run');
|
|
4538
4540
|
console.error("");
|
|
4541
|
+
console.error(" \u2500\u2500\u2500 Claude Desktop MCP config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
4542
|
+
console.error(" Add this to ~/Library/Application Support/Claude/claude_desktop_config.json:");
|
|
4543
|
+
console.error("");
|
|
4544
|
+
console.error(" {");
|
|
4545
|
+
console.error(' "mcpServers": {');
|
|
4546
|
+
console.error(' "kairos": {');
|
|
4547
|
+
console.error(` "command": "${kairosPath}",`);
|
|
4548
|
+
console.error(' "env": {');
|
|
4549
|
+
console.error(` "ANTHROPIC_API_KEY": "${process.env["ANTHROPIC_API_KEY"] ? "<set>" : "your-key-here"}",`);
|
|
4550
|
+
console.error(` "N8N_BASE_URL": "${process.env["N8N_BASE_URL"] ?? "https://your-n8n-instance"}",`);
|
|
4551
|
+
console.error(` "N8N_API_KEY": "${process.env["N8N_API_KEY"] ? "<set>" : "your-n8n-api-key"}"`);
|
|
4552
|
+
console.error(" }");
|
|
4553
|
+
console.error(" }");
|
|
4554
|
+
console.error(" }");
|
|
4555
|
+
console.error(" }");
|
|
4556
|
+
console.error("");
|
|
4539
4557
|
}
|
|
4540
4558
|
async function main() {
|
|
4541
4559
|
const { command, positional, flags } = parseArgs(process.argv);
|