@kody-ade/kody-engine 0.4.477 → 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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +61 -41
  2. 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.477",
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",
@@ -4241,6 +4241,56 @@ var init_agencyBoundaryEval = __esm({
4241
4241
  }
4242
4242
  });
4243
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
+
4244
4294
  // src/agency/capability-contract-validation.ts
4245
4295
  import Ajv from "ajv";
4246
4296
  function validateCapabilityContractValue(boundary, schema, value) {
@@ -15533,18 +15583,6 @@ function scalar(value) {
15533
15583
  if (/^-?\d+$/.test(value)) return Number(value);
15534
15584
  return value;
15535
15585
  }
15536
- function capabilityEnvironment(input) {
15537
- const environment = {
15538
- KODY_CAPABILITY_INPUT: JSON.stringify(input ?? null)
15539
- };
15540
- if (!input || typeof input !== "object" || Array.isArray(input)) return environment;
15541
- for (const [name, value] of Object.entries(input)) {
15542
- if (value === void 0 || value === null) continue;
15543
- const key = name.toUpperCase().replace(/[^A-Z0-9]+/g, "_");
15544
- environment[`KODY_ARG_${key}`] = typeof value === "string" ? value : JSON.stringify(value);
15545
- }
15546
- return environment;
15547
- }
15548
15586
  function listFiles(root) {
15549
15587
  if (!fs43.existsSync(root)) return [];
15550
15588
  const files = [];
@@ -15566,6 +15604,7 @@ var init_loadSimpleCapability = __esm({
15566
15604
  init_capability_contract_validation();
15567
15605
  init_capabilityFolders();
15568
15606
  init_definition_paths();
15607
+ init_capabilityExecutionEnvironment();
15569
15608
  loadSimpleCapability = async (ctx) => {
15570
15609
  const slug = typeof ctx.args.capability === "string" ? ctx.args.capability.trim() : "";
15571
15610
  if (!/^[a-z][a-z0-9-]*$/.test(slug)) {
@@ -15594,7 +15633,10 @@ var init_loadSimpleCapability = __esm({
15594
15633
  if (capability.config.outputSchema) {
15595
15634
  ctx.data.capabilityOutputSchema = capability.config.outputSchema;
15596
15635
  }
15597
- ctx.data.capabilityEnvironment = capabilityEnvironment(input);
15636
+ ctx.data.capabilityEnvironment = {
15637
+ ...capabilityInputEnvironment(input),
15638
+ ...capabilityConfigEnvironment(ctx.config)
15639
+ };
15598
15640
  ctx.data.prompt = [
15599
15641
  capability.rawBody.trim(),
15600
15642
  "",
@@ -19096,7 +19138,7 @@ var init_runSimpleCapabilityScript = __esm({
19096
19138
  ctx.output.reason = 'Script-backed Capability requires a regular "tools/run.sh" entrypoint';
19097
19139
  return;
19098
19140
  }
19099
- const capabilityEnvironment2 = isStringRecord(ctx.data.capabilityEnvironment) ? ctx.data.capabilityEnvironment : {};
19141
+ const capabilityEnvironment = isStringRecord(ctx.data.capabilityEnvironment) ? ctx.data.capabilityEnvironment : {};
19100
19142
  const capabilitySecrets = declaredSecrets(ctx.data.capabilitySecretNames, process.env);
19101
19143
  const timeoutMs = typeof ctx.data.capabilityScriptTimeoutMs === "number" ? ctx.data.capabilityScriptTimeoutMs : DEFAULT_SCRIPT_TIMEOUT_MS;
19102
19144
  const result = spawnSync3("bash", [scriptPath], {
@@ -19104,7 +19146,7 @@ var init_runSimpleCapabilityScript = __esm({
19104
19146
  env: {
19105
19147
  ...buildTickChildEnv(process.env, false),
19106
19148
  ...capabilitySecrets,
19107
- ...capabilityEnvironment2
19149
+ ...capabilityEnvironment
19108
19150
  },
19109
19151
  stdio: ["ignore", "pipe", "pipe"],
19110
19152
  encoding: "utf-8",
@@ -21597,13 +21639,8 @@ async function runShellEntry(entry, ctx, profile) {
21597
21639
  `kody-shell-output-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
21598
21640
  );
21599
21641
  const env = { ...process.env, HUSKY: "0", SKIP_HOOKS: "1", KODY_OUTPUT: outputFile };
21600
- for (const [k, v] of Object.entries(ctx.args)) {
21601
- if (v === void 0 || v === null) continue;
21602
- env[`KODY_ARG_${envKey(k)}`] = String(v);
21603
- }
21604
- for (const [k, v] of flattenConfig(ctx.config)) {
21605
- env[`KODY_CFG_${k}`] = v;
21606
- }
21642
+ Object.assign(env, capabilityInputEnvironment(ctx.args));
21643
+ Object.assign(env, capabilityConfigEnvironment(ctx.config));
21607
21644
  const timeoutMs = resolveShellTimeoutMs(entry);
21608
21645
  const child = spawn8("bash", [shellPath, ...positional], {
21609
21646
  cwd: ctx.cwd,
@@ -21704,28 +21741,11 @@ async function runShellEntry(entry, ctx, profile) {
21704
21741
  }
21705
21742
  }
21706
21743
  }
21707
- function envKey(name) {
21708
- return name.toUpperCase().replace(/-/g, "_");
21709
- }
21710
- function flattenConfig(obj, prefix = "") {
21711
- const out = [];
21712
- for (const [k, v] of Object.entries(obj)) {
21713
- if (v === null || v === void 0) continue;
21714
- const key = prefix ? `${prefix}_${envKey(k)}` : envKey(k);
21715
- if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
21716
- out.push([key, String(v)]);
21717
- } else if (Array.isArray(v)) {
21718
- out.push([key, JSON.stringify(v)]);
21719
- } else if (typeof v === "object") {
21720
- out.push(...flattenConfig(v, key));
21721
- }
21722
- }
21723
- return out;
21724
- }
21725
21744
  var MUTATING_POSTFLIGHTS, SHELL_MARKER_RE, TASK_ARTIFACT_WRITE_TOOLS, MAX_CHAIN_HOPS, DEFAULT_SHELL_TIMEOUT_MS, SIGKILL_GRACE_MS;
21726
21745
  var init_executor = __esm({
21727
21746
  "src/executor.ts"() {
21728
21747
  "use strict";
21748
+ init_capabilityExecutionEnvironment();
21729
21749
  init_capability_contract_validation();
21730
21750
  init_agent();
21731
21751
  init_agents();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.477",
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",