@kody-ade/kody-engine 0.4.597 → 0.4.598

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 +31 -25
  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.597",
18
+ version: "0.4.598",
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",
@@ -18327,8 +18327,7 @@ function githubRepositoryParts(repoUrl) {
18327
18327
  if (!parts[0] || !repo) throw new Error("repository URL is incomplete");
18328
18328
  return { owner: parts[0], repo };
18329
18329
  }
18330
- function browserOrigin(ctx) {
18331
- const raw = typeof ctx.data.previewUrl === "string" ? ctx.data.previewUrl : "";
18330
+ function browserOrigin(raw) {
18332
18331
  if (!raw) throw new Error("QA target URL is unavailable");
18333
18332
  const parsed = new URL(raw);
18334
18333
  if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
@@ -18413,6 +18412,17 @@ async function prepareMethod(ctx, profile, method) {
18413
18412
  const { repositoryKey, credentialKey } = fieldsForKodyRepository(method);
18414
18413
  const variables = readKodyVariables(ctx.cwd);
18415
18414
  const repositoryUrl = variables[repositoryKey]?.trim() ?? "";
18415
+ const targetUrl = typeof ctx.data.previewUrl === "string" ? ctx.data.previewUrl : "";
18416
+ return prepareKodyRepositoryBrowserAuth(ctx, profile, {
18417
+ repositoryUrl,
18418
+ repositoryKey,
18419
+ credentialKey,
18420
+ methodName: method.name,
18421
+ targetUrl
18422
+ });
18423
+ }
18424
+ async function prepareKodyRepositoryBrowserAuth(ctx, profile, input) {
18425
+ const { repositoryUrl, credentialKey } = input;
18416
18426
  const credential = await resolveRuntimeSecret(credentialKey, ctx);
18417
18427
  ctx.data.qaAuthSecretSources = {
18418
18428
  ...ctx.data.qaAuthSecretSources ?? {},
@@ -18426,14 +18436,14 @@ async function prepareMethod(ctx, profile, method) {
18426
18436
  if (!repositoryUrl) {
18427
18437
  appendAuthMessage(
18428
18438
  ctx,
18429
- `Auth: ${method.name} is incomplete because no \`${repositoryKey}\` variable was found. Note this authenticated surface as a gap.`
18439
+ `Auth: ${input.methodName} is incomplete because no \`${input.repositoryKey ?? "repository"}\` variable was found. Note this authenticated surface as a gap.`
18430
18440
  );
18431
18441
  return false;
18432
18442
  }
18433
18443
  if (!credential.value) {
18434
18444
  appendAuthMessage(
18435
18445
  ctx,
18436
- `Auth: ${method.name} is incomplete because no \`${credentialKey}\` secret was found. Note this authenticated surface as a gap.`
18446
+ `Auth: ${input.methodName} is incomplete because no \`${credentialKey}\` secret was found. Note this authenticated surface as a gap.`
18437
18447
  );
18438
18448
  return false;
18439
18449
  }
@@ -18452,7 +18462,7 @@ async function prepareMethod(ctx, profile, method) {
18452
18462
  throw new Error("GitHub returned incomplete identity data");
18453
18463
  }
18454
18464
  state = writeKodyStorageState({
18455
- origin: browserOrigin(ctx),
18465
+ origin: browserOrigin(input.targetUrl),
18456
18466
  repoUrl: `https://github.com/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`,
18457
18467
  owner,
18458
18468
  repo,
@@ -18466,7 +18476,7 @@ async function prepareMethod(ctx, profile, method) {
18466
18476
  });
18467
18477
  appendAuthMessage(
18468
18478
  ctx,
18469
- `Auth: ${method.name} is already authenticated by the engine-provided browser session. The credential is not available to you; never request, reveal, or report it.`
18479
+ `Auth: ${input.methodName} is already authenticated by the engine-provided browser session. The credential is not available to you; never request, reveal, or report it.`
18470
18480
  );
18471
18481
  return true;
18472
18482
  } catch (error) {
@@ -18474,7 +18484,7 @@ async function prepareMethod(ctx, profile, method) {
18474
18484
  const reason = error instanceof Error ? error.message : String(error);
18475
18485
  appendAuthMessage(
18476
18486
  ctx,
18477
- `Auth: the engine could not prepare ${method.name} (${reason}). Note this authenticated surface as a gap.`
18487
+ `Auth: the engine could not prepare ${input.methodName} (${reason}). Note this authenticated surface as a gap.`
18478
18488
  );
18479
18489
  return false;
18480
18490
  }
@@ -18693,7 +18703,7 @@ var init_prepareSimpleCapabilityRuntime = __esm({
18693
18703
  "src/scripts/prepareSimpleCapabilityRuntime.ts"() {
18694
18704
  "use strict";
18695
18705
  init_loadQaContext();
18696
- init_runtimeSecrets();
18706
+ init_prepareBrowserAuth();
18697
18707
  PLAYWRIGHT_SERVER = {
18698
18708
  name: "playwright",
18699
18709
  command: "npx",
@@ -18705,6 +18715,18 @@ var init_prepareSimpleCapabilityRuntime = __esm({
18705
18715
  configureBrowser(ctx, profile, requirements);
18706
18716
  if (requirements.qaCredentials) {
18707
18717
  await loadQaContext(ctx, profile);
18718
+ }
18719
+ if (requirements.githubTestToken) {
18720
+ const capabilityInput = ctx.data.capabilityInput && typeof ctx.data.capabilityInput === "object" && !Array.isArray(ctx.data.capabilityInput) ? ctx.data.capabilityInput : {};
18721
+ const targetUrl = typeof capabilityInput.url === "string" ? capabilityInput.url : typeof capabilityInput.targetUrl === "string" ? capabilityInput.targetUrl : "";
18722
+ await prepareKodyRepositoryBrowserAuth(ctx, profile, {
18723
+ repositoryUrl: `https://github.com/${ctx.config.github.owner}/${ctx.config.github.repo}`,
18724
+ credentialKey: "E2E_GITHUB_TOKEN",
18725
+ methodName: "Kody protected QA login",
18726
+ targetUrl
18727
+ });
18728
+ }
18729
+ if (requirements.qaCredentials || requirements.githubTestToken) {
18708
18730
  appendPrompt(
18709
18731
  ctx,
18710
18732
  [
@@ -18716,22 +18738,6 @@ var init_prepareSimpleCapabilityRuntime = __esm({
18716
18738
  ].join("\n")
18717
18739
  );
18718
18740
  }
18719
- if (requirements.githubTestToken) {
18720
- const token = await resolveRuntimeSecret("E2E_GITHUB_TOKEN", ctx);
18721
- appendPrompt(
18722
- ctx,
18723
- token.value ? [
18724
- "## Protected GitHub test login",
18725
- "",
18726
- `A protected GitHub test token is available: \`${token.value}\``,
18727
- "Use it only if the target application asks for a GitHub personal access token; never include the token in screenshots, output, logs, files, or messages."
18728
- ].join("\n") : [
18729
- "## Protected GitHub test login",
18730
- "",
18731
- "E2E_GITHUB_TOKEN is not configured. If this Quality Scenario requires GitHub token authentication, return a blocked result."
18732
- ].join("\n")
18733
- );
18734
- }
18735
18741
  };
18736
18742
  }
18737
18743
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.597",
3
+ "version": "0.4.598",
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",