@kody-ade/kody-engine 0.4.336 → 0.4.338

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 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.336",
18
+ version: "0.4.338",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -11403,7 +11403,7 @@ function formatCapabilityReference(data, profileName) {
11403
11403
  lines.push(`- Capability: \`${capabilitySlug}\`${capabilityTitle ? ` \u2014 *${capabilityTitle}*` : ""}`);
11404
11404
  }
11405
11405
  if (executableSlug) {
11406
- lines.push(`- Executable: \`${executableSlug}\``);
11406
+ lines.push(`- Implementation: \`${executableSlug}\``);
11407
11407
  }
11408
11408
  const agentLine = agentSlug ? `\`${agentSlug}\`${agentTitle && agentTitle !== agentSlug ? ` \u2014 *${agentTitle}*` : ""}` : "";
11409
11409
  if (agentLine) {
@@ -15390,10 +15390,10 @@ function parseAgentFactoryBundle(raw) {
15390
15390
  modelCreatorContractsUsed: value.modelCreatorContractsUsed
15391
15391
  };
15392
15392
  }
15393
- function buildAgentFactoryBranchName(issueNumber, title, now = Date.now()) {
15393
+ function buildStatePrBranchName(sourceLabel, issueNumber, title, now = Date.now()) {
15394
15394
  const slug2 = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48).replace(/-+$/g, "");
15395
15395
  const suffix = slug2 ? `-${slug2}` : "";
15396
- return `agent-factory/issue-${issueNumber}-${now.toString(36)}${suffix}`;
15396
+ return `${sourceLabel}/issue-${issueNumber}-${now.toString(36)}${suffix}`;
15397
15397
  }
15398
15398
  function normalizeBundleFiles(ctx, bundle) {
15399
15399
  const seen = /* @__PURE__ */ new Set();
@@ -15449,6 +15449,13 @@ function requireString2(value, label) {
15449
15449
  }
15450
15450
  return value;
15451
15451
  }
15452
+ function creatorSourceLabel(ctx, profileName) {
15453
+ const capability = typeof ctx.data.jobCapability === "string" ? ctx.data.jobCapability.trim() : "";
15454
+ const implementation = typeof ctx.data.jobImplementation === "string" ? ctx.data.jobImplementation.trim() : "";
15455
+ const executable = typeof ctx.data.jobExecutable === "string" ? ctx.data.jobExecutable.trim() : "";
15456
+ const profile = typeof profileName === "string" ? profileName.trim() : "";
15457
+ return capability || implementation || executable || profile || "agent-factory";
15458
+ }
15452
15459
  function ghJson(args, cwd, input) {
15453
15460
  const raw = gh(args, input === void 0 ? { cwd } : { cwd, input: JSON.stringify(input) });
15454
15461
  if (!raw) return {};
@@ -15460,10 +15467,10 @@ function ghJson(args, cwd, input) {
15460
15467
  );
15461
15468
  }
15462
15469
  }
15463
- function renderPullRequestBody(ctx, bundle, files) {
15470
+ function renderPullRequestBody(ctx, bundle, files, sourceLabel) {
15464
15471
  const issueNumber = readIssueNumber(ctx);
15465
15472
  return [
15466
- "Agent factory generated a Kody agency model bundle for review.",
15473
+ `${sourceLabel} generated Kody agency model changes for review.`,
15467
15474
  "",
15468
15475
  `Source issue: ${ctx.config.github.owner}/${ctx.config.github.repo}#${issueNumber}`,
15469
15476
  "",
@@ -15478,9 +15485,9 @@ function renderPullRequestBody(ctx, bundle, files) {
15478
15485
  "Generated definitions are inactive until this state-repo PR is reviewed and merged."
15479
15486
  ].join("\n");
15480
15487
  }
15481
- function renderIssueComment(owner, repo, prUrl, bundle) {
15488
+ function renderIssueComment(owner, repo, prUrl, bundle, sourceLabel) {
15482
15489
  return [
15483
- `agent-factory opened a state-repo review PR: ${prUrl}`,
15490
+ `${sourceLabel} opened a state-repo review PR: ${prUrl}`,
15484
15491
  "",
15485
15492
  `State repo: ${owner}/${repo}`,
15486
15493
  "",
@@ -15494,7 +15501,7 @@ var init_openAgentFactoryStatePr = __esm({
15494
15501
  "use strict";
15495
15502
  init_issue();
15496
15503
  init_stateRepo();
15497
- openAgentFactoryStatePr = async (ctx, _profile, agentResult) => {
15504
+ openAgentFactoryStatePr = async (ctx, profile, agentResult) => {
15498
15505
  if (agentResult?.outcome !== "completed") {
15499
15506
  throw new Error(`openAgentFactoryStatePr: agent did not complete: ${agentResult?.error ?? "unknown failure"}`);
15500
15507
  }
@@ -15505,11 +15512,12 @@ var init_openAgentFactoryStatePr = __esm({
15505
15512
  throw new Error("openAgentFactoryStatePr: config.state.repo and config.state.path are required");
15506
15513
  }
15507
15514
  const issueNumber = readIssueNumber(ctx);
15515
+ const sourceLabel = creatorSourceLabel(ctx, profile.name);
15508
15516
  const bundle = parseAgentFactoryBundle(String(ctx.data.prSummary ?? ""));
15509
15517
  const normalizedFiles = normalizeBundleFiles(ctx, bundle);
15510
15518
  const stateRepo = parseStateRepo(ctx.config);
15511
15519
  const baseBranch = "main";
15512
- const branch = buildAgentFactoryBranchName(issueNumber, bundle.title);
15520
+ const branch = buildStatePrBranchName(sourceLabel, issueNumber, bundle.title);
15513
15521
  const baseRef = ghJson(
15514
15522
  ["api", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/ref/heads/${baseBranch}`],
15515
15523
  ctx.cwd
@@ -15548,7 +15556,7 @@ var init_openAgentFactoryStatePr = __esm({
15548
15556
  ["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/git/commits`, "--input", "-"],
15549
15557
  ctx.cwd,
15550
15558
  {
15551
- message: `agent-factory: ${bundle.title}`,
15559
+ message: `${sourceLabel}: ${bundle.title}`,
15552
15560
  tree: treeSha,
15553
15561
  parents: [baseSha]
15554
15562
  }
@@ -15573,16 +15581,16 @@ var init_openAgentFactoryStatePr = __esm({
15573
15581
  ["api", "--method", "POST", `/repos/${stateRepo.owner}/${stateRepo.repo}/pulls`, "--input", "-"],
15574
15582
  ctx.cwd,
15575
15583
  {
15576
- title: `agent-factory: ${bundle.title}`,
15584
+ title: `${sourceLabel}: ${bundle.title}`,
15577
15585
  head: branch,
15578
15586
  base: baseBranch,
15579
- body: renderPullRequestBody(ctx, bundle, normalizedFiles)
15587
+ body: renderPullRequestBody(ctx, bundle, normalizedFiles, sourceLabel)
15580
15588
  }
15581
15589
  );
15582
15590
  const prUrl = requireString2(pr.html_url, "created pull request url");
15583
15591
  gh(["issue", "comment", String(issueNumber), "--body-file", "-"], {
15584
15592
  cwd: ctx.cwd,
15585
- input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle)
15593
+ input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle, sourceLabel)
15586
15594
  });
15587
15595
  ctx.data.agentFactoryStatePr = {
15588
15596
  repo: `${stateRepo.owner}/${stateRepo.repo}`,
@@ -19145,7 +19153,7 @@ var init_writeAgentRunSummary = __esm({
19145
19153
  writeAgentRunSummary = async (ctx, profile) => {
19146
19154
  const summaryPath = process.env.GITHUB_STEP_SUMMARY;
19147
19155
  if (!summaryPath) return;
19148
- const executable = profile.name;
19156
+ const implementation = profile.name;
19149
19157
  const issue = ctx.args.issue;
19150
19158
  const pr = ctx.args.pr;
19151
19159
  const target = issue ? `issue #${issue}` : pr ? `PR #${pr}` : "(unknown)";
@@ -19154,9 +19162,9 @@ var init_writeAgentRunSummary = __esm({
19154
19162
  const reason = ctx.output.reason;
19155
19163
  const status = exitCode === 0 ? "\u2705 success" : exitCode === 3 ? "\u23ED\uFE0F no-op" : "\u26A0\uFE0F failed";
19156
19164
  const lines = [];
19157
- lines.push(`## kody ${executable} \u2014 ${status}`);
19165
+ lines.push(`## kody ${implementation} \u2014 ${status}`);
19158
19166
  lines.push("");
19159
- lines.push(`- **Executable:** \`${executable}\``);
19167
+ lines.push(`- **Implementation:** \`${implementation}\``);
19160
19168
  lines.push(`- **Target:** ${target}`);
19161
19169
  if (prUrl) lines.push(`- **PR:** ${prUrl}`);
19162
19170
  lines.push(`- **Exit code:** ${exitCode}`);
@@ -65,6 +65,19 @@ Required files:
65
65
 
66
66
  In `profile.json`, include `"slug": "<slug>"`. The `"name"` field may be a display name, but if `slug` is absent then `name` must equal the slug.
67
67
 
68
+ The profile is part of the Capability contract. It must use the same slug as `model.slug` and must declare the current capability kind field:
69
+
70
+ ```json
71
+ {
72
+ "slug": "<same slug as model.slug>",
73
+ "name": "Display Name",
74
+ "capabilityKind": "observe|act|verify"
75
+ }
76
+ ```
77
+
78
+ Do not put `kind: "observe"`, `kind: "act"`, or `kind: "verify"` in the profile. `kind` is not the capability kind field.
79
+ Every generated file path must use exactly the same slug as `model.slug`.
80
+
68
81
  Add colocated prompt/scripts only if the capability needs a new implementation. Reuse existing capabilities, implementation profiles, skills, or scripts when they fit.
69
82
 
70
83
  # Final Output Contract
@@ -95,7 +108,7 @@ PR_SUMMARY:
95
108
  "files": [
96
109
  {
97
110
  "path": "capabilities/example/profile.json",
98
- "content": "{\n \"name\": \"example\"\n}\n"
111
+ "content": "{\n \"slug\": \"example\",\n \"name\": \"Example\",\n \"capabilityKind\": \"observe\"\n}\n"
99
112
  },
100
113
  {
101
114
  "path": "capabilities/example/capability.md",
@@ -52,6 +52,27 @@ Prefer placing workflow steps on the public capability that owns the composed ac
52
52
 
53
53
  Put the workflow contract in `capabilities/<slug>/profile.json`. Prefer a `workflow` object with `steps`; top-level `steps` are only for existing profiles that already use that shape.
54
54
 
55
+ The workflow profile is stored as a capability profile because workflows are composed capability runs. The generated file path must use exactly the same slug as `model.slug`.
56
+
57
+ Minimum profile shape:
58
+
59
+ ```json
60
+ {
61
+ "slug": "<same slug as model.slug>",
62
+ "name": "Display Name",
63
+ "workflow": {
64
+ "steps": [
65
+ {
66
+ "capability": "capability-slug",
67
+ "reason": "why this step exists"
68
+ }
69
+ ]
70
+ }
71
+ }
72
+ ```
73
+
74
+ Do not place workflow files under `workflows/`. Do not use a different profile slug than `model.slug`.
75
+
55
76
  # Final Output Contract
56
77
 
57
78
  If the request is too ambiguous to produce one review-ready Workflow model, output one line:
@@ -80,7 +101,7 @@ PR_SUMMARY:
80
101
  "files": [
81
102
  {
82
103
  "path": "capabilities/example/profile.json",
83
- "content": "{\n \"workflow\": { \"steps\": [] }\n}\n"
104
+ "content": "{\n \"slug\": \"example\",\n \"name\": \"Example Workflow\",\n \"workflow\": { \"steps\": [{ \"capability\": \"example-capability\", \"reason\": \"run the composed capability\" }] }\n}\n"
84
105
  }
85
106
  ]
86
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.336",
3
+ "version": "0.4.338",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",