@kody-ade/kody-engine 0.4.476 → 0.4.478
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/bin/kody.js +78 -41
- package/kody.config.schema.json +20 -0
- package/package.json +1 -1
package/dist/bin/kody.js
CHANGED
|
@@ -15,7 +15,7 @@ var init_package = __esm({
|
|
|
15
15
|
"package.json"() {
|
|
16
16
|
package_default = {
|
|
17
17
|
name: "@kody-ade/kody-engine",
|
|
18
|
-
version: "0.4.
|
|
18
|
+
version: "0.4.478",
|
|
19
19
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
|
|
20
20
|
license: "MIT",
|
|
21
21
|
type: "module",
|
|
@@ -457,6 +457,23 @@ function parseReleaseConfig(raw) {
|
|
|
457
457
|
if (typeof r.allowAdminMerge === "boolean") out.allowAdminMerge = r.allowAdminMerge;
|
|
458
458
|
if (typeof r.releaseBranch === "string") out.releaseBranch = r.releaseBranch;
|
|
459
459
|
if (typeof r.timeoutMs === "number" && r.timeoutMs > 0) out.timeoutMs = Math.floor(r.timeoutMs);
|
|
460
|
+
if (r.validation && typeof r.validation === "object") {
|
|
461
|
+
const validation = r.validation;
|
|
462
|
+
const workflow = typeof validation.workflow === "string" ? validation.workflow.trim() : "";
|
|
463
|
+
if (workflow) {
|
|
464
|
+
const inputs = validation.inputs && typeof validation.inputs === "object" ? Object.fromEntries(
|
|
465
|
+
Object.entries(
|
|
466
|
+
validation.inputs
|
|
467
|
+
).filter(
|
|
468
|
+
(entry) => /^[a-z][a-z0-9_]*$/.test(entry[0]) && (typeof entry[1] === "string" || typeof entry[1] === "number" || typeof entry[1] === "boolean")
|
|
469
|
+
)
|
|
470
|
+
) : void 0;
|
|
471
|
+
out.validation = {
|
|
472
|
+
workflow,
|
|
473
|
+
...inputs && Object.keys(inputs).length > 0 ? { inputs } : {}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
}
|
|
460
477
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
461
478
|
}
|
|
462
479
|
function parseIssueContext(raw) {
|
|
@@ -4224,6 +4241,56 @@ var init_agencyBoundaryEval = __esm({
|
|
|
4224
4241
|
}
|
|
4225
4242
|
});
|
|
4226
4243
|
|
|
4244
|
+
// src/scripts/capabilityExecutionEnvironment.ts
|
|
4245
|
+
function capabilityInputEnvironment(input) {
|
|
4246
|
+
const environment = {
|
|
4247
|
+
KODY_CAPABILITY_INPUT: JSON.stringify(input ?? null)
|
|
4248
|
+
};
|
|
4249
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
4250
|
+
return environment;
|
|
4251
|
+
}
|
|
4252
|
+
for (const [name, value] of Object.entries(input)) {
|
|
4253
|
+
if (value === void 0 || value === null) continue;
|
|
4254
|
+
const key = environmentKey(name);
|
|
4255
|
+
environment[`KODY_ARG_${key}`] = typeof value === "string" ? value : JSON.stringify(value);
|
|
4256
|
+
}
|
|
4257
|
+
return environment;
|
|
4258
|
+
}
|
|
4259
|
+
function capabilityConfigEnvironment(config) {
|
|
4260
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) return {};
|
|
4261
|
+
return Object.fromEntries(
|
|
4262
|
+
flattenConfig(config).map(([key, value]) => [
|
|
4263
|
+
`KODY_CFG_${key}`,
|
|
4264
|
+
value
|
|
4265
|
+
])
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
4268
|
+
function flattenConfig(config, prefix = "") {
|
|
4269
|
+
const entries = [];
|
|
4270
|
+
for (const [name, value] of Object.entries(config)) {
|
|
4271
|
+
if (value === null || value === void 0) continue;
|
|
4272
|
+
const key = prefix ? `${prefix}_${environmentKey(name)}` : environmentKey(name);
|
|
4273
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
4274
|
+
entries.push([key, String(value)]);
|
|
4275
|
+
} else if (Array.isArray(value)) {
|
|
4276
|
+
entries.push([key, JSON.stringify(value)]);
|
|
4277
|
+
} else if (typeof value === "object") {
|
|
4278
|
+
entries.push(
|
|
4279
|
+
...flattenConfig(value, key)
|
|
4280
|
+
);
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
return entries;
|
|
4284
|
+
}
|
|
4285
|
+
function environmentKey(name) {
|
|
4286
|
+
return name.toUpperCase().replace(/[^A-Z0-9]+/g, "_");
|
|
4287
|
+
}
|
|
4288
|
+
var init_capabilityExecutionEnvironment = __esm({
|
|
4289
|
+
"src/scripts/capabilityExecutionEnvironment.ts"() {
|
|
4290
|
+
"use strict";
|
|
4291
|
+
}
|
|
4292
|
+
});
|
|
4293
|
+
|
|
4227
4294
|
// src/agency/capability-contract-validation.ts
|
|
4228
4295
|
import Ajv from "ajv";
|
|
4229
4296
|
function validateCapabilityContractValue(boundary, schema, value) {
|
|
@@ -15516,18 +15583,6 @@ function scalar(value) {
|
|
|
15516
15583
|
if (/^-?\d+$/.test(value)) return Number(value);
|
|
15517
15584
|
return value;
|
|
15518
15585
|
}
|
|
15519
|
-
function capabilityEnvironment(input) {
|
|
15520
|
-
const environment = {
|
|
15521
|
-
KODY_CAPABILITY_INPUT: JSON.stringify(input ?? null)
|
|
15522
|
-
};
|
|
15523
|
-
if (!input || typeof input !== "object" || Array.isArray(input)) return environment;
|
|
15524
|
-
for (const [name, value] of Object.entries(input)) {
|
|
15525
|
-
if (value === void 0 || value === null) continue;
|
|
15526
|
-
const key = name.toUpperCase().replace(/[^A-Z0-9]+/g, "_");
|
|
15527
|
-
environment[`KODY_ARG_${key}`] = typeof value === "string" ? value : JSON.stringify(value);
|
|
15528
|
-
}
|
|
15529
|
-
return environment;
|
|
15530
|
-
}
|
|
15531
15586
|
function listFiles(root) {
|
|
15532
15587
|
if (!fs43.existsSync(root)) return [];
|
|
15533
15588
|
const files = [];
|
|
@@ -15549,6 +15604,7 @@ var init_loadSimpleCapability = __esm({
|
|
|
15549
15604
|
init_capability_contract_validation();
|
|
15550
15605
|
init_capabilityFolders();
|
|
15551
15606
|
init_definition_paths();
|
|
15607
|
+
init_capabilityExecutionEnvironment();
|
|
15552
15608
|
loadSimpleCapability = async (ctx) => {
|
|
15553
15609
|
const slug = typeof ctx.args.capability === "string" ? ctx.args.capability.trim() : "";
|
|
15554
15610
|
if (!/^[a-z][a-z0-9-]*$/.test(slug)) {
|
|
@@ -15577,7 +15633,10 @@ var init_loadSimpleCapability = __esm({
|
|
|
15577
15633
|
if (capability.config.outputSchema) {
|
|
15578
15634
|
ctx.data.capabilityOutputSchema = capability.config.outputSchema;
|
|
15579
15635
|
}
|
|
15580
|
-
ctx.data.capabilityEnvironment =
|
|
15636
|
+
ctx.data.capabilityEnvironment = {
|
|
15637
|
+
...capabilityInputEnvironment(input),
|
|
15638
|
+
...capabilityConfigEnvironment(ctx.config)
|
|
15639
|
+
};
|
|
15581
15640
|
ctx.data.prompt = [
|
|
15582
15641
|
capability.rawBody.trim(),
|
|
15583
15642
|
"",
|
|
@@ -19079,7 +19138,7 @@ var init_runSimpleCapabilityScript = __esm({
|
|
|
19079
19138
|
ctx.output.reason = 'Script-backed Capability requires a regular "tools/run.sh" entrypoint';
|
|
19080
19139
|
return;
|
|
19081
19140
|
}
|
|
19082
|
-
const
|
|
19141
|
+
const capabilityEnvironment = isStringRecord(ctx.data.capabilityEnvironment) ? ctx.data.capabilityEnvironment : {};
|
|
19083
19142
|
const capabilitySecrets = declaredSecrets(ctx.data.capabilitySecretNames, process.env);
|
|
19084
19143
|
const timeoutMs = typeof ctx.data.capabilityScriptTimeoutMs === "number" ? ctx.data.capabilityScriptTimeoutMs : DEFAULT_SCRIPT_TIMEOUT_MS;
|
|
19085
19144
|
const result = spawnSync3("bash", [scriptPath], {
|
|
@@ -19087,7 +19146,7 @@ var init_runSimpleCapabilityScript = __esm({
|
|
|
19087
19146
|
env: {
|
|
19088
19147
|
...buildTickChildEnv(process.env, false),
|
|
19089
19148
|
...capabilitySecrets,
|
|
19090
|
-
...
|
|
19149
|
+
...capabilityEnvironment
|
|
19091
19150
|
},
|
|
19092
19151
|
stdio: ["ignore", "pipe", "pipe"],
|
|
19093
19152
|
encoding: "utf-8",
|
|
@@ -21580,13 +21639,8 @@ async function runShellEntry(entry, ctx, profile) {
|
|
|
21580
21639
|
`kody-shell-output-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
|
|
21581
21640
|
);
|
|
21582
21641
|
const env = { ...process.env, HUSKY: "0", SKIP_HOOKS: "1", KODY_OUTPUT: outputFile };
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
env[`KODY_ARG_${envKey(k)}`] = String(v);
|
|
21586
|
-
}
|
|
21587
|
-
for (const [k, v] of flattenConfig(ctx.config)) {
|
|
21588
|
-
env[`KODY_CFG_${k}`] = v;
|
|
21589
|
-
}
|
|
21642
|
+
Object.assign(env, capabilityInputEnvironment(ctx.args));
|
|
21643
|
+
Object.assign(env, capabilityConfigEnvironment(ctx.config));
|
|
21590
21644
|
const timeoutMs = resolveShellTimeoutMs(entry);
|
|
21591
21645
|
const child = spawn8("bash", [shellPath, ...positional], {
|
|
21592
21646
|
cwd: ctx.cwd,
|
|
@@ -21687,28 +21741,11 @@ async function runShellEntry(entry, ctx, profile) {
|
|
|
21687
21741
|
}
|
|
21688
21742
|
}
|
|
21689
21743
|
}
|
|
21690
|
-
function envKey(name) {
|
|
21691
|
-
return name.toUpperCase().replace(/-/g, "_");
|
|
21692
|
-
}
|
|
21693
|
-
function flattenConfig(obj, prefix = "") {
|
|
21694
|
-
const out = [];
|
|
21695
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
21696
|
-
if (v === null || v === void 0) continue;
|
|
21697
|
-
const key = prefix ? `${prefix}_${envKey(k)}` : envKey(k);
|
|
21698
|
-
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
21699
|
-
out.push([key, String(v)]);
|
|
21700
|
-
} else if (Array.isArray(v)) {
|
|
21701
|
-
out.push([key, JSON.stringify(v)]);
|
|
21702
|
-
} else if (typeof v === "object") {
|
|
21703
|
-
out.push(...flattenConfig(v, key));
|
|
21704
|
-
}
|
|
21705
|
-
}
|
|
21706
|
-
return out;
|
|
21707
|
-
}
|
|
21708
21744
|
var MUTATING_POSTFLIGHTS, SHELL_MARKER_RE, TASK_ARTIFACT_WRITE_TOOLS, MAX_CHAIN_HOPS, DEFAULT_SHELL_TIMEOUT_MS, SIGKILL_GRACE_MS;
|
|
21709
21745
|
var init_executor = __esm({
|
|
21710
21746
|
"src/executor.ts"() {
|
|
21711
21747
|
"use strict";
|
|
21748
|
+
init_capabilityExecutionEnvironment();
|
|
21712
21749
|
init_capability_contract_validation();
|
|
21713
21750
|
init_agent();
|
|
21714
21751
|
init_agents();
|
package/kody.config.schema.json
CHANGED
|
@@ -150,6 +150,26 @@
|
|
|
150
150
|
"draftRelease": { "type": "boolean" },
|
|
151
151
|
"releaseBranch": { "type": "string" },
|
|
152
152
|
"allowAdminMerge": { "type": "boolean" },
|
|
153
|
+
"validation": {
|
|
154
|
+
"type": "object",
|
|
155
|
+
"additionalProperties": false,
|
|
156
|
+
"required": ["workflow"],
|
|
157
|
+
"properties": {
|
|
158
|
+
"workflow": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 1
|
|
161
|
+
},
|
|
162
|
+
"inputs": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"propertyNames": {
|
|
165
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
166
|
+
},
|
|
167
|
+
"additionalProperties": {
|
|
168
|
+
"type": ["string", "number", "boolean"]
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
153
173
|
"timeoutMs": {
|
|
154
174
|
"type": "integer",
|
|
155
175
|
"minimum": 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.478",
|
|
4
4
|
"description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|