@kody-ade/kody-engine 0.4.495 → 0.4.496

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 +25 -11
  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.495",
18
+ version: "0.4.496",
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",
@@ -2448,12 +2448,12 @@ async function readRuntimeSecretFromKody(name, env = process.env) {
2448
2448
  const body = await response.json();
2449
2449
  return typeof body.value === "string" ? body.value : null;
2450
2450
  }
2451
- async function writeRuntimeSecretToKody(name, value, env = process.env) {
2451
+ async function writeRuntimeSecretsToKody(secrets, env = process.env) {
2452
2452
  const token = await githubOidcToken(env);
2453
2453
  const response = await fetch(`${resolveKodyApiUrl(env)}/api/kody/engine/secret`, {
2454
2454
  method: "PUT",
2455
2455
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
2456
- body: JSON.stringify({ name, value }),
2456
+ body: JSON.stringify({ secrets }),
2457
2457
  signal: AbortSignal.timeout(3e4)
2458
2458
  });
2459
2459
  if (!response.ok) throw new Error(`Kody secret upsert failed (${response.status})`);
@@ -4325,11 +4325,13 @@ function validateCapabilityContractValue(boundary, schema, value) {
4325
4325
  throw new CapabilityContractValidationError(boundary, validate.errors ?? []);
4326
4326
  }
4327
4327
  }
4328
- function capabilityContractInput(inputs, args, capabilityId) {
4328
+ function capabilityContractInput(inputs, args, capabilityId, contractProperties = []) {
4329
4329
  const isGenericRunnerInput = inputs.some((input) => input.name === "input") && Object.hasOwn(args, "input");
4330
4330
  if (!isGenericRunnerInput) {
4331
- const isParameterlessGenericRunner = (inputs.some((input) => input.name === "capability") || args.capability === capabilityId) && Object.hasOwn(args, "capability");
4332
- return isParameterlessGenericRunner ? {} : args;
4331
+ const isParameterlessGenericRunner = (inputs.some((input) => input.name === "capability") || args.capability === capabilityId || !contractProperties.includes("capability")) && Object.hasOwn(args, "capability");
4332
+ if (!isParameterlessGenericRunner) return args;
4333
+ const { capability: _routingCapability, ...businessArgs } = args;
4334
+ return businessArgs;
4333
4335
  }
4334
4336
  const value = args.input;
4335
4337
  if (typeof value !== "string") return value;
@@ -15460,9 +15462,7 @@ async function resolveRuntimeSecret(name, ctx, opts = {}) {
15460
15462
  try {
15461
15463
  const value = await readRuntimeSecretFromKody(name, env);
15462
15464
  if (value) return { value, source: "vault" };
15463
- const fallback = envSecret(name, env);
15464
- if (fallback.value) await writeRuntimeSecretToKody(name, fallback.value, env);
15465
- return fallback;
15465
+ return envSecret(name, env);
15466
15466
  } catch (err) {
15467
15467
  const fallback = envSecret(name, env);
15468
15468
  return {
@@ -15500,11 +15500,22 @@ async function resolveRuntimeSecrets(names, ctx, opts = {}) {
15500
15500
  for (const name of declared) {
15501
15501
  resolved.push({ name, result: await resolveRuntimeSecret(name, ctx, opts) });
15502
15502
  }
15503
+ const warnings = resolved.flatMap(({ result }) => result.warning ? [result.warning] : []);
15504
+ const fallbackSecrets = Object.fromEntries(
15505
+ resolved.flatMap(({ name, result }) => result.source === "env" && result.value ? [[name, result.value]] : [])
15506
+ );
15507
+ if (hasGitHubActionsIdentity(opts.env ?? process.env) && Object.keys(fallbackSecrets).length > 0) {
15508
+ try {
15509
+ await writeRuntimeSecretsToKody(fallbackSecrets, opts.env ?? process.env);
15510
+ } catch (err) {
15511
+ warnings.push(`Kody secret migration failed: ${err instanceof Error ? err.message : String(err)}`);
15512
+ }
15513
+ }
15503
15514
  return {
15504
15515
  environment: Object.fromEntries(
15505
15516
  resolved.flatMap(({ name, result }) => result.value ? [[name, result.value]] : [])
15506
15517
  ),
15507
- warnings: resolved.flatMap(({ result }) => result.warning ? [result.warning] : [])
15518
+ warnings
15508
15519
  };
15509
15520
  }
15510
15521
  var init_runtimeSecrets = __esm({
@@ -20991,7 +21002,10 @@ async function runImplementation(profileName, input) {
20991
21002
  capabilityContractInput(
20992
21003
  profile.inputs,
20993
21004
  args,
20994
- profile.canonicalContract.capabilityId
21005
+ profile.canonicalContract.capabilityId,
21006
+ Object.keys(
21007
+ profile.canonicalContract.inputSchema.properties ?? {}
21008
+ )
20995
21009
  )
20996
21010
  );
20997
21011
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.495",
3
+ "version": "0.4.496",
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",