@kody-ade/kody-engine 0.4.493 → 0.4.494

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 +23 -10
  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.493",
18
+ version: "0.4.494",
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,10 +4325,10 @@ function validateCapabilityContractValue(boundary, schema, value) {
4325
4325
  throw new CapabilityContractValidationError(boundary, validate.errors ?? []);
4326
4326
  }
4327
4327
  }
4328
- function capabilityContractInput(inputs, args) {
4328
+ function capabilityContractInput(inputs, args, capabilityId) {
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") && Object.hasOwn(args, "capability");
4331
+ const isParameterlessGenericRunner = (inputs.some((input) => input.name === "capability") || args.capability === capabilityId) && Object.hasOwn(args, "capability");
4332
4332
  return isParameterlessGenericRunner ? {} : args;
4333
4333
  }
4334
4334
  const value = args.input;
@@ -15460,9 +15460,7 @@ async function resolveRuntimeSecret(name, ctx, opts = {}) {
15460
15460
  try {
15461
15461
  const value = await readRuntimeSecretFromKody(name, env);
15462
15462
  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;
15463
+ return envSecret(name, env);
15466
15464
  } catch (err) {
15467
15465
  const fallback = envSecret(name, env);
15468
15466
  return {
@@ -15500,11 +15498,22 @@ async function resolveRuntimeSecrets(names, ctx, opts = {}) {
15500
15498
  for (const name of declared) {
15501
15499
  resolved.push({ name, result: await resolveRuntimeSecret(name, ctx, opts) });
15502
15500
  }
15501
+ const warnings = resolved.flatMap(({ result }) => result.warning ? [result.warning] : []);
15502
+ const fallbackSecrets = Object.fromEntries(
15503
+ resolved.flatMap(({ name, result }) => result.source === "env" && result.value ? [[name, result.value]] : [])
15504
+ );
15505
+ if (hasGitHubActionsIdentity(opts.env ?? process.env) && Object.keys(fallbackSecrets).length > 0) {
15506
+ try {
15507
+ await writeRuntimeSecretsToKody(fallbackSecrets, opts.env ?? process.env);
15508
+ } catch (err) {
15509
+ warnings.push(`Kody secret migration failed: ${err instanceof Error ? err.message : String(err)}`);
15510
+ }
15511
+ }
15503
15512
  return {
15504
15513
  environment: Object.fromEntries(
15505
15514
  resolved.flatMap(({ name, result }) => result.value ? [[name, result.value]] : [])
15506
15515
  ),
15507
- warnings: resolved.flatMap(({ result }) => result.warning ? [result.warning] : [])
15516
+ warnings
15508
15517
  };
15509
15518
  }
15510
15519
  var init_runtimeSecrets = __esm({
@@ -20988,7 +20997,11 @@ async function runImplementation(profileName, input) {
20988
20997
  validateCapabilityContractValue(
20989
20998
  "input",
20990
20999
  profile.canonicalContract.inputSchema,
20991
- capabilityContractInput(profile.inputs, args)
21000
+ capabilityContractInput(
21001
+ profile.inputs,
21002
+ args,
21003
+ profile.canonicalContract.capabilityId
21004
+ )
20992
21005
  );
20993
21006
  }
20994
21007
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.493",
3
+ "version": "0.4.494",
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",