@kody-ade/kody-engine 0.4.370 → 0.4.371

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 (26) hide show
  1. package/dist/bin/kody.js +152 -237
  2. package/package.json +1 -1
  3. package/dist/capabilities/agent-creator/capability.md +0 -13
  4. package/dist/capabilities/agent-creator/profile.json +0 -7
  5. package/dist/capabilities/agent-factory/capability.md +0 -10
  6. package/dist/capabilities/agent-factory/profile.json +0 -6
  7. package/dist/capabilities/capability-creator/capability.md +0 -13
  8. package/dist/capabilities/capability-creator/profile.json +0 -7
  9. package/dist/capabilities/goal-creator/capability.md +0 -13
  10. package/dist/capabilities/goal-creator/profile.json +0 -7
  11. package/dist/capabilities/loop-creator/capability.md +0 -13
  12. package/dist/capabilities/loop-creator/profile.json +0 -7
  13. package/dist/capabilities/workflow-creator/capability.md +0 -13
  14. package/dist/capabilities/workflow-creator/profile.json +0 -7
  15. package/dist/implementations/agent-creator/profile.json +0 -65
  16. package/dist/implementations/agent-creator/prompt.md +0 -86
  17. package/dist/implementations/agent-factory/profile.json +0 -65
  18. package/dist/implementations/agent-factory/prompt.md +0 -142
  19. package/dist/implementations/capability-creator/profile.json +0 -65
  20. package/dist/implementations/capability-creator/prompt.md +0 -120
  21. package/dist/implementations/goal-creator/profile.json +0 -65
  22. package/dist/implementations/goal-creator/prompt.md +0 -91
  23. package/dist/implementations/loop-creator/profile.json +0 -65
  24. package/dist/implementations/loop-creator/prompt.md +0 -86
  25. package/dist/implementations/workflow-creator/profile.json +0 -65
  26. package/dist/implementations/workflow-creator/prompt.md +0 -109
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.370",
18
+ version: "0.4.371",
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",
@@ -15359,29 +15359,29 @@ var init_notifyTerminal = __esm({
15359
15359
  }
15360
15360
  });
15361
15361
 
15362
- // src/scripts/openAgentFactoryStatePr.ts
15363
- function parseAgentFactoryBundle(raw) {
15362
+ // src/scripts/openAgencyModelReviewPr.ts
15363
+ function parseAgencyModelProposal(raw) {
15364
15364
  const jsonText = stripJsonFence(raw);
15365
15365
  let parsed;
15366
15366
  try {
15367
15367
  parsed = JSON.parse(jsonText);
15368
15368
  } catch (err) {
15369
15369
  throw new Error(
15370
- `openAgentFactoryStatePr: PR_SUMMARY must be valid JSON: ${err instanceof Error ? err.message : String(err)}`
15370
+ `openAgencyModelReviewPr: PR_SUMMARY must be valid JSON: ${err instanceof Error ? err.message : String(err)}`
15371
15371
  );
15372
15372
  }
15373
15373
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
15374
- throw new Error("openAgentFactoryStatePr: PR_SUMMARY must be a JSON object");
15374
+ throw new Error("openAgencyModelReviewPr: PR_SUMMARY must be a JSON object");
15375
15375
  }
15376
15376
  const value = parsed;
15377
15377
  const title = readRequiredJsonString(value.title, "title");
15378
15378
  const summary = readRequiredJsonString(value.summary, "summary");
15379
15379
  if (!Array.isArray(value.files) || value.files.length === 0) {
15380
- throw new Error("openAgentFactoryStatePr: files must be a non-empty array");
15380
+ throw new Error("openAgencyModelReviewPr: files must be a non-empty array");
15381
15381
  }
15382
15382
  const files = value.files.map((item, index) => {
15383
15383
  if (!item || typeof item !== "object" || Array.isArray(item)) {
15384
- throw new Error(`openAgentFactoryStatePr: files[${index}] must be an object`);
15384
+ throw new Error(`openAgencyModelReviewPr: files[${index}] must be an object`);
15385
15385
  }
15386
15386
  const file = item;
15387
15387
  return {
@@ -15393,9 +15393,7 @@ function parseAgentFactoryBundle(raw) {
15393
15393
  title,
15394
15394
  summary,
15395
15395
  files,
15396
- model: value.model,
15397
- models: value.models,
15398
- modelCreatorContractsUsed: value.modelCreatorContractsUsed
15396
+ model: value.model
15399
15397
  };
15400
15398
  }
15401
15399
  function buildStatePrBranchName(sourceLabel, issueNumber, title, now = Date.now()) {
@@ -15407,20 +15405,20 @@ function normalizeBundleFiles(ctx, bundle) {
15407
15405
  const seen = /* @__PURE__ */ new Set();
15408
15406
  return bundle.files.map((file, index) => {
15409
15407
  if (file.path.startsWith("/") || file.path.includes("\\")) {
15410
- throw new Error(`openAgentFactoryStatePr: files[${index}].path must be a relative POSIX path`);
15408
+ throw new Error(`openAgencyModelReviewPr: files[${index}].path must be a relative POSIX path`);
15411
15409
  }
15412
15410
  const normalizedPath = normalizeStatePath(file.path, `files[${index}].path`);
15413
15411
  const relativePath = normalizedPath.replace(/^\.kody\/?/, "");
15414
15412
  if (!relativePath) {
15415
- throw new Error(`openAgentFactoryStatePr: files[${index}].path must point to a state repo file`);
15413
+ throw new Error(`openAgencyModelReviewPr: files[${index}].path must point to a state repo file`);
15416
15414
  }
15417
15415
  if (relativePath === "implementations" || relativePath.startsWith("implementations/")) {
15418
15416
  throw new Error(
15419
- `openAgentFactoryStatePr: files[${index}].path uses obsolete implementations storage; use capabilities/<slug>/ instead`
15417
+ `openAgencyModelReviewPr: files[${index}].path uses obsolete implementations storage; use capabilities/<slug>/ instead`
15420
15418
  );
15421
15419
  }
15422
15420
  if (seen.has(relativePath)) {
15423
- throw new Error(`openAgentFactoryStatePr: duplicate generated file path: ${relativePath}`);
15421
+ throw new Error(`openAgencyModelReviewPr: duplicate generated file path: ${relativePath}`);
15424
15422
  }
15425
15423
  seen.add(relativePath);
15426
15424
  return {
@@ -15438,22 +15436,22 @@ function stripJsonFence(raw) {
15438
15436
  function readIssueNumber(ctx) {
15439
15437
  const issueNumber = ctx.args.issue;
15440
15438
  if (typeof issueNumber !== "number" || !Number.isInteger(issueNumber) || issueNumber <= 0) {
15441
- throw new Error("openAgentFactoryStatePr: ctx.args.issue must be a positive integer");
15439
+ throw new Error("openAgencyModelReviewPr: ctx.args.issue must be a positive integer");
15442
15440
  }
15443
15441
  return issueNumber;
15444
15442
  }
15445
15443
  function readRequiredJsonString(value, field) {
15446
15444
  const text = readJsonString(value, field).trim();
15447
- if (!text) throw new Error(`openAgentFactoryStatePr: ${field} must be a non-empty string`);
15445
+ if (!text) throw new Error(`openAgencyModelReviewPr: ${field} must be a non-empty string`);
15448
15446
  return text;
15449
15447
  }
15450
15448
  function readJsonString(value, field) {
15451
- if (typeof value !== "string") throw new Error(`openAgentFactoryStatePr: ${field} must be a string`);
15449
+ if (typeof value !== "string") throw new Error(`openAgencyModelReviewPr: ${field} must be a string`);
15452
15450
  return value;
15453
15451
  }
15454
15452
  function requireString2(value, label) {
15455
15453
  if (typeof value !== "string" || value.trim().length === 0) {
15456
- throw new Error(`openAgentFactoryStatePr: missing ${label}`);
15454
+ throw new Error(`openAgencyModelReviewPr: missing ${label}`);
15457
15455
  }
15458
15456
  return value;
15459
15457
  }
@@ -15461,7 +15459,7 @@ function creatorSourceLabel(ctx, profileName) {
15461
15459
  const capability = typeof ctx.data.jobCapability === "string" ? ctx.data.jobCapability.trim() : "";
15462
15460
  const implementation = typeof ctx.data.selectedImplementation === "string" ? ctx.data.selectedImplementation.trim() : "";
15463
15461
  const profile = typeof profileName === "string" ? profileName.trim() : "";
15464
- return capability || implementation || profile || "agent-factory";
15462
+ return capability || implementation || profile || "model-creator";
15465
15463
  }
15466
15464
  function ghJson(args, cwd, input) {
15467
15465
  const raw = gh(args, input === void 0 ? { cwd } : { cwd, input: JSON.stringify(input) });
@@ -15470,7 +15468,7 @@ function ghJson(args, cwd, input) {
15470
15468
  return JSON.parse(raw);
15471
15469
  } catch (err) {
15472
15470
  throw new Error(
15473
- `openAgentFactoryStatePr: gh api returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`
15471
+ `openAgencyModelReviewPr: gh api returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`
15474
15472
  );
15475
15473
  }
15476
15474
  }
@@ -15502,25 +15500,25 @@ function renderIssueComment(owner, repo, prUrl, bundle, sourceLabel) {
15502
15500
  bundle.summary
15503
15501
  ].join("\n");
15504
15502
  }
15505
- var openAgentFactoryStatePr;
15506
- var init_openAgentFactoryStatePr = __esm({
15507
- "src/scripts/openAgentFactoryStatePr.ts"() {
15503
+ var openAgencyModelReviewPr;
15504
+ var init_openAgencyModelReviewPr = __esm({
15505
+ "src/scripts/openAgencyModelReviewPr.ts"() {
15508
15506
  "use strict";
15509
15507
  init_issue();
15510
15508
  init_stateRepo();
15511
- openAgentFactoryStatePr = async (ctx, profile, agentResult) => {
15509
+ openAgencyModelReviewPr = async (ctx, profile, agentResult) => {
15512
15510
  if (agentResult?.outcome !== "completed") {
15513
- throw new Error(`openAgentFactoryStatePr: agent did not complete: ${agentResult?.error ?? "unknown failure"}`);
15511
+ throw new Error(`openAgencyModelReviewPr: agent did not complete: ${agentResult?.error ?? "unknown failure"}`);
15514
15512
  }
15515
15513
  if (ctx.data.agentDone !== true) {
15516
- throw new Error("openAgentFactoryStatePr: agent did not produce a successful final result");
15514
+ throw new Error("openAgencyModelReviewPr: agent did not produce a successful final result");
15517
15515
  }
15518
15516
  if (!ctx.config.state?.repo || !ctx.config.state?.path) {
15519
- throw new Error("openAgentFactoryStatePr: config.state.repo and config.state.path are required");
15517
+ throw new Error("openAgencyModelReviewPr: config.state.repo and config.state.path are required");
15520
15518
  }
15521
15519
  const issueNumber = readIssueNumber(ctx);
15522
15520
  const sourceLabel = creatorSourceLabel(ctx, profile.name);
15523
- const bundle = parseAgentFactoryBundle(String(ctx.data.prSummary ?? ""));
15521
+ const bundle = parseAgencyModelProposal(String(ctx.data.prSummary ?? ""));
15524
15522
  const normalizedFiles = normalizeBundleFiles(ctx, bundle);
15525
15523
  const stateRepo = parseStateRepo(ctx.config);
15526
15524
  const baseBranch = "main";
@@ -15599,7 +15597,7 @@ var init_openAgentFactoryStatePr = __esm({
15599
15597
  cwd: ctx.cwd,
15600
15598
  input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle, sourceLabel)
15601
15599
  });
15602
- ctx.data.agentFactoryStatePr = {
15600
+ ctx.data.agencyModelReviewPr = {
15603
15601
  repo: `${stateRepo.owner}/${stateRepo.repo}`,
15604
15602
  branch,
15605
15603
  base: baseBranch,
@@ -15903,106 +15901,6 @@ var init_parseJobStateFromAgentResult = __esm({
15903
15901
  }
15904
15902
  });
15905
15903
 
15906
- // src/scripts/publishReport.ts
15907
- function buildRuntimeReportMarkdown(input) {
15908
- return [
15909
- "---",
15910
- `generatedAt: ${yamlString(input.generatedAt)}`,
15911
- `reportType: ${input.reportType}`,
15912
- `reportTypeVersion: ${input.reportTypeVersion}`,
15913
- "producer:",
15914
- ` model: ${input.owner}`,
15915
- ` capability: ${input.capability}`,
15916
- ...input.reviewStatus ? [`reviewStatus: ${input.reviewStatus}`] : [],
15917
- ...input.reviewArea ? [`reviewArea: ${input.reviewArea}`] : [],
15918
- "---",
15919
- `# ${input.title}`,
15920
- "",
15921
- input.summary,
15922
- "",
15923
- "## Report data",
15924
- "```json",
15925
- JSON.stringify(input.data, null, 2),
15926
- "```",
15927
- ""
15928
- ].join("\n");
15929
- }
15930
- function parsePublication(value) {
15931
- if (!value || typeof value !== "object" || Array.isArray(value)) return null;
15932
- const raw = value;
15933
- if (typeof raw.type !== "string" || !SAFE_SLUG.test(raw.type)) return null;
15934
- if (typeof raw.owner !== "string" || !SAFE_SLUG.test(raw.owner)) return null;
15935
- return raw;
15936
- }
15937
- function latestResult(raw, agentResult) {
15938
- const results = [];
15939
- if (Array.isArray(raw)) {
15940
- for (const item of raw) {
15941
- const parsed = parseCapabilityResult(item);
15942
- if (parsed) results.push(parsed);
15943
- }
15944
- }
15945
- if (agentResult?.finalText) results.push(...parseCapabilityResultsFromText(agentResult.finalText));
15946
- return results.at(-1) ?? null;
15947
- }
15948
- function recordField6(value) {
15949
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
15950
- }
15951
- function resolveDotted(root, path51) {
15952
- if (!path51) return void 0;
15953
- return path51.split(".").reduce((value, key) => recordField6(value)?.[key], root);
15954
- }
15955
- function stringValue4(value) {
15956
- return typeof value === "string" && value.trim() ? value.trim() : null;
15957
- }
15958
- function humanize(value) {
15959
- return value.split(/[-_]+/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join(" ");
15960
- }
15961
- function yamlString(value) {
15962
- return JSON.stringify(value);
15963
- }
15964
- var SAFE_SLUG, publishReport;
15965
- var init_publishReport = __esm({
15966
- "src/scripts/publishReport.ts"() {
15967
- "use strict";
15968
- init_capabilityResult();
15969
- init_stateRepo();
15970
- SAFE_SLUG = /^[a-z0-9][a-z0-9_-]{0,79}$/;
15971
- publishReport = async (ctx, _profile, agentResult) => {
15972
- const publication = parsePublication(ctx.data.reportPublication);
15973
- if (!publication) return;
15974
- const result = latestResult(ctx.data.capabilityResults, agentResult);
15975
- const stateData = recordField6(recordField6(ctx.data.nextJobState)?.data) ?? {};
15976
- const data = { ...stateData, ...result?.facts ?? {} };
15977
- if (publication.publishWhenFact && resolveDotted(data, publication.publishWhenFact) === void 0) return;
15978
- const slug = publication.slug ?? stringValue4(resolveDotted(data, publication.slugFact));
15979
- if (!slug || !SAFE_SLUG.test(slug)) return;
15980
- const title = publication.title ?? stringValue4(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
15981
- const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
15982
- const markdown = buildRuntimeReportMarkdown({
15983
- generatedAt,
15984
- reportType: publication.type,
15985
- reportTypeVersion: publication.version ?? 1,
15986
- owner: publication.owner,
15987
- capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown",
15988
- title,
15989
- summary: result?.summary ?? title,
15990
- data,
15991
- ...publication.reviewStatus ? { reviewStatus: publication.reviewStatus } : {},
15992
- ...publication.reviewArea ? { reviewArea: publication.reviewArea } : {}
15993
- });
15994
- const runId = generatedAt.replace(/\.\d{3}Z$/, "Z").replace(/:/g, "-");
15995
- writeStateText(
15996
- ctx.config,
15997
- ctx.cwd,
15998
- `reports/${slug}/runs/${runId}.md`,
15999
- markdown,
16000
- `chore(reports): add ${slug} run`
16001
- );
16002
- };
16003
- }
16004
- });
16005
-
16006
15904
  // src/scripts/parseReproOutput.ts
16007
15905
  function extractTestPath(text) {
16008
15906
  const m = text.match(/^[\s>*_#`~-]*TEST_PATH[\s>*_#`~-]*\s*:\s*(.+?)\s*$/im);
@@ -16614,6 +16512,106 @@ var init_promoteQaGoal = __esm({
16614
16512
  }
16615
16513
  });
16616
16514
 
16515
+ // src/scripts/publishReport.ts
16516
+ function buildRuntimeReportMarkdown(input) {
16517
+ return [
16518
+ "---",
16519
+ `generatedAt: ${yamlString(input.generatedAt)}`,
16520
+ `reportType: ${input.reportType}`,
16521
+ `reportTypeVersion: ${input.reportTypeVersion}`,
16522
+ "producer:",
16523
+ ` model: ${input.owner}`,
16524
+ ` capability: ${input.capability}`,
16525
+ ...input.reviewStatus ? [`reviewStatus: ${input.reviewStatus}`] : [],
16526
+ ...input.reviewArea ? [`reviewArea: ${input.reviewArea}`] : [],
16527
+ "---",
16528
+ `# ${input.title}`,
16529
+ "",
16530
+ input.summary,
16531
+ "",
16532
+ "## Report data",
16533
+ "```json",
16534
+ JSON.stringify(input.data, null, 2),
16535
+ "```",
16536
+ ""
16537
+ ].join("\n");
16538
+ }
16539
+ function parsePublication(value) {
16540
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
16541
+ const raw = value;
16542
+ if (typeof raw.type !== "string" || !SAFE_SLUG.test(raw.type)) return null;
16543
+ if (typeof raw.owner !== "string" || !SAFE_SLUG.test(raw.owner)) return null;
16544
+ return raw;
16545
+ }
16546
+ function latestResult(raw, agentResult) {
16547
+ const results = [];
16548
+ if (Array.isArray(raw)) {
16549
+ for (const item of raw) {
16550
+ const parsed = parseCapabilityResult(item);
16551
+ if (parsed) results.push(parsed);
16552
+ }
16553
+ }
16554
+ if (agentResult?.finalText) results.push(...parseCapabilityResultsFromText(agentResult.finalText));
16555
+ return results.at(-1) ?? null;
16556
+ }
16557
+ function recordField6(value) {
16558
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
16559
+ }
16560
+ function resolveDotted(root, path51) {
16561
+ if (!path51) return void 0;
16562
+ return path51.split(".").reduce((value, key) => recordField6(value)?.[key], root);
16563
+ }
16564
+ function stringValue4(value) {
16565
+ return typeof value === "string" && value.trim() ? value.trim() : null;
16566
+ }
16567
+ function humanize(value) {
16568
+ return value.split(/[-_]+/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join(" ");
16569
+ }
16570
+ function yamlString(value) {
16571
+ return JSON.stringify(value);
16572
+ }
16573
+ var SAFE_SLUG, publishReport;
16574
+ var init_publishReport = __esm({
16575
+ "src/scripts/publishReport.ts"() {
16576
+ "use strict";
16577
+ init_capabilityResult();
16578
+ init_stateRepo();
16579
+ SAFE_SLUG = /^[a-z0-9][a-z0-9_-]{0,79}$/;
16580
+ publishReport = async (ctx, _profile, agentResult) => {
16581
+ const publication = parsePublication(ctx.data.reportPublication);
16582
+ if (!publication) return;
16583
+ const result = latestResult(ctx.data.capabilityResults, agentResult);
16584
+ const stateData = recordField6(recordField6(ctx.data.nextJobState)?.data) ?? {};
16585
+ const data = { ...stateData, ...result?.facts ?? {} };
16586
+ if (publication.publishWhenFact && resolveDotted(data, publication.publishWhenFact) === void 0) return;
16587
+ const slug = publication.slug ?? stringValue4(resolveDotted(data, publication.slugFact));
16588
+ if (!slug || !SAFE_SLUG.test(slug)) return;
16589
+ const title = publication.title ?? stringValue4(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
16590
+ const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
16591
+ const markdown = buildRuntimeReportMarkdown({
16592
+ generatedAt,
16593
+ reportType: publication.type,
16594
+ reportTypeVersion: publication.version ?? 1,
16595
+ owner: publication.owner,
16596
+ capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown",
16597
+ title,
16598
+ summary: result?.summary ?? title,
16599
+ data,
16600
+ ...publication.reviewStatus ? { reviewStatus: publication.reviewStatus } : {},
16601
+ ...publication.reviewArea ? { reviewArea: publication.reviewArea } : {}
16602
+ });
16603
+ const runId = generatedAt.replace(/\.\d{3}Z$/, "Z").replace(/:/g, "-");
16604
+ writeStateText(
16605
+ ctx.config,
16606
+ ctx.cwd,
16607
+ `reports/${slug}/runs/${runId}.md`,
16608
+ markdown,
16609
+ `chore(reports): add ${slug} run`
16610
+ );
16611
+ };
16612
+ }
16613
+ });
16614
+
16617
16615
  // src/scripts/recordClassification.ts
16618
16616
  import { execFileSync as execFileSync17 } from "child_process";
16619
16617
  function parseClassification(prSummary) {
@@ -18362,29 +18360,18 @@ var init_syncFlow = __esm({
18362
18360
  }
18363
18361
  });
18364
18362
 
18365
- // src/scripts/validateAgentFactoryBundle.ts
18366
- function validateModelBundle(bundle, producer) {
18363
+ // src/scripts/validateAgencyModelProposal.ts
18364
+ function validateModelBundle(bundle, expectedKind) {
18367
18365
  const failures = [];
18368
- const expectedKind = CREATOR_KIND[producer];
18369
- if (producer === FACTORY_PRODUCER) {
18370
- const contracts = stringArray4(bundle.modelCreatorContractsUsed);
18371
- for (const contract of CREATOR_CONTRACTS) {
18372
- if (!contracts.includes(contract)) failures.push(`modelCreatorContractsUsed missing ${contract}`);
18373
- }
18374
- if (!Array.isArray(bundle.models) || bundle.models.length === 0) {
18375
- failures.push("agent-factory bundle must include non-empty models array");
18376
- return failures;
18377
- }
18378
- for (const [index, model] of bundle.models.entries()) {
18379
- validateOneModel(model, bundle.files, `models[${index}]`, false, failures);
18380
- }
18381
- validateFactoryAssembly(bundle.models, failures);
18382
- return failures;
18383
- }
18384
- validateOneModel(bundle.model, bundle.files, "model", true, failures, expectedKind, producer);
18366
+ validateOneModel(bundle.model, bundle.files, "model", true, failures, expectedKind);
18385
18367
  return failures;
18386
18368
  }
18387
- function validateOneModel(rawModel, files, label, strictSingleModel, failures, expectedKind, producer) {
18369
+ function readExpectedModelKind(args) {
18370
+ const value = args?.modelKind;
18371
+ if (typeof value === "string" && isModelKind(value)) return value;
18372
+ throw new Error("validateAgencyModelProposal: with.modelKind must be agent, capability, goal, agentLoop, or workflow");
18373
+ }
18374
+ function validateOneModel(rawModel, files, label, strictSingleModel, failures, expectedKind) {
18388
18375
  if (!rawModel || typeof rawModel !== "object" || Array.isArray(rawModel)) {
18389
18376
  failures.push(`${label} must be an object`);
18390
18377
  return;
@@ -18392,8 +18379,7 @@ function validateOneModel(rawModel, files, label, strictSingleModel, failures, e
18392
18379
  const model = rawModel;
18393
18380
  const kind = stringField6(model.kind);
18394
18381
  if (!isModelKind(kind)) failures.push(`${label}.kind must be agent, capability, goal, agentLoop, or workflow`);
18395
- if (expectedKind && kind !== expectedKind && producer)
18396
- failures.push(`${producer} must output model.kind ${expectedKind}`);
18382
+ if (expectedKind && kind !== expectedKind) failures.push(`proposal must output model.kind ${expectedKind}`);
18397
18383
  const slug = stringField6(model.slug);
18398
18384
  if (!isSlug(slug)) failures.push(`${label}.slug must be a lowercase slug`);
18399
18385
  if (isModelKind(kind)) {
@@ -18457,57 +18443,6 @@ function validateFilesForKind(kind, slug, files, strictSingleModel, failures) {
18457
18443
  }
18458
18444
  }
18459
18445
  }
18460
- function validateFactoryAssembly(models, failures) {
18461
- const available = /* @__PURE__ */ new Map();
18462
- for (const model of models) {
18463
- if (!model || typeof model !== "object" || Array.isArray(model)) continue;
18464
- const input = model;
18465
- const kind = stringField6(input.kind);
18466
- const slug = stringField6(input.slug);
18467
- if (isModelKind(kind) && isSlug(slug)) available.set(`${kind}:${slug}`, kind);
18468
- }
18469
- for (const model of models) {
18470
- if (!model || typeof model !== "object" || Array.isArray(model)) continue;
18471
- const input = model;
18472
- const kind = stringField6(input.kind);
18473
- if (kind === "goal") {
18474
- for (const capability of capabilityRefs(input)) {
18475
- if (!available.has(`capability:${capability}`)) {
18476
- failures.push(`goal ${stringField6(input.slug)} references missing capability ${capability}`);
18477
- }
18478
- }
18479
- }
18480
- if (kind === "workflow") {
18481
- for (const capability of stringArray4(input.steps)) {
18482
- if (!available.has(`capability:${capability}`)) {
18483
- failures.push(`workflow ${stringField6(input.slug)} references missing capability ${capability}`);
18484
- }
18485
- }
18486
- for (const step of arrayObjects(input.steps)) {
18487
- const capability = stringField6(step.capability);
18488
- if (capability && !available.has(`capability:${capability}`)) {
18489
- failures.push(`workflow ${stringField6(input.slug)} references missing capability ${capability}`);
18490
- }
18491
- }
18492
- }
18493
- if (kind === "agentLoop") {
18494
- const target = wakeTarget(input);
18495
- if (target) {
18496
- if (!available.has(`${target.kind}:${target.slug}`)) {
18497
- failures.push(`agentLoop ${stringField6(input.slug)} references missing ${target.kind} ${target.slug}`);
18498
- }
18499
- } else {
18500
- const targetSlug = stringField6(input.target);
18501
- const targetExists = ["goal", "workflow", "capability"].some(
18502
- (kindName) => available.has(`${kindName}:${targetSlug}`)
18503
- );
18504
- if (targetSlug && !targetExists) {
18505
- failures.push(`agentLoop ${stringField6(input.slug)} references missing target ${targetSlug}`);
18506
- }
18507
- }
18508
- }
18509
- }
18510
- }
18511
18446
  function validateModelShape(kind, model, files, slug, failures) {
18512
18447
  if (kind === "agent") {
18513
18448
  const agentFile = textFile(files, `agents/${slug}.md`);
@@ -18630,12 +18565,6 @@ function stringArray4(value) {
18630
18565
  if (!Array.isArray(value)) return [];
18631
18566
  return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
18632
18567
  }
18633
- function arrayObjects(value) {
18634
- if (!Array.isArray(value)) return [];
18635
- return value.filter(
18636
- (item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)
18637
- );
18638
- }
18639
18568
  function requireStringArrayIncludes(value, expected, label, failures) {
18640
18569
  if (!stringArray4(value).includes(expected)) failures.push(`${label} must include ${expected}`);
18641
18570
  }
@@ -18645,19 +18574,11 @@ function isSlug(value) {
18645
18574
  function isModelKind(value) {
18646
18575
  return value === "agent" || value === "capability" || value === "goal" || value === "agentLoop" || value === "workflow";
18647
18576
  }
18648
- var CREATOR_CONTRACTS, FACTORY_PRODUCER, REQUIRED_DOCS, CREATOR_KIND, validateAgentFactoryBundle;
18649
- var init_validateAgentFactoryBundle = __esm({
18650
- "src/scripts/validateAgentFactoryBundle.ts"() {
18577
+ var REQUIRED_DOCS, validateAgencyModelProposal;
18578
+ var init_validateAgencyModelProposal = __esm({
18579
+ "src/scripts/validateAgencyModelProposal.ts"() {
18651
18580
  "use strict";
18652
- init_openAgentFactoryStatePr();
18653
- CREATOR_CONTRACTS = [
18654
- "agent-creator",
18655
- "goal-creator",
18656
- "loop-creator",
18657
- "workflow-creator",
18658
- "capability-creator"
18659
- ];
18660
- FACTORY_PRODUCER = "agent-factory";
18581
+ init_openAgencyModelReviewPr();
18661
18582
  REQUIRED_DOCS = {
18662
18583
  agent: ["docs/agents.md"],
18663
18584
  capability: ["docs/capabilities.md", "docs/capability-kind-map.md", "docs/capability-implementations.md"],
@@ -18665,20 +18586,14 @@ var init_validateAgentFactoryBundle = __esm({
18665
18586
  agentLoop: ["docs/jobs-model.md", "docs/engine-company.md", "docs/ledgers.md"],
18666
18587
  workflow: ["docs/jobs-model.md", "docs/capabilities.md"]
18667
18588
  };
18668
- CREATOR_KIND = {
18669
- "agent-creator": "agent",
18670
- "capability-creator": "capability",
18671
- "goal-creator": "goal",
18672
- "loop-creator": "agentLoop",
18673
- "workflow-creator": "workflow"
18674
- };
18675
- validateAgentFactoryBundle = async (ctx, profile) => {
18589
+ validateAgencyModelProposal = async (ctx, _profile, _agentResult, args) => {
18676
18590
  if (ctx.data.agentDone !== true) return;
18677
18591
  const raw = String(ctx.data.prSummary ?? "");
18678
- const bundle = parseAgentFactoryBundle(raw);
18679
- const failures = validateModelBundle(bundle, profile.name);
18592
+ const bundle = parseAgencyModelProposal(raw);
18593
+ const expectedKind = readExpectedModelKind(args);
18594
+ const failures = validateModelBundle(bundle, expectedKind);
18680
18595
  if (failures.length > 0) {
18681
- throw new Error(`validateAgentFactoryBundle: ${failures.join("; ")}`);
18596
+ throw new Error(`validateAgencyModelProposal: ${failures.join("; ")}`);
18682
18597
  }
18683
18598
  };
18684
18599
  }
@@ -19417,12 +19332,11 @@ var init_scripts = __esm({
19417
19332
  init_mergeReleasePr();
19418
19333
  init_mirrorStateToPr();
19419
19334
  init_notifyTerminal();
19420
- init_openAgentFactoryStatePr();
19335
+ init_openAgencyModelReviewPr();
19421
19336
  init_openQaIssue();
19422
19337
  init_parseAgentResult();
19423
19338
  init_parseIssueStateFromAgentResult();
19424
19339
  init_parseJobStateFromAgentResult();
19425
- init_publishReport();
19426
19340
  init_parseReproOutput();
19427
19341
  init_persistArtifacts();
19428
19342
  init_persistFlowState();
@@ -19433,6 +19347,7 @@ var init_scripts = __esm({
19433
19347
  init_postResearchComment();
19434
19348
  init_postReviewResult();
19435
19349
  init_promoteQaGoal();
19350
+ init_publishReport();
19436
19351
  init_recordClassification();
19437
19352
  init_recordOutcome();
19438
19353
  init_requireFeedbackActions();
@@ -19455,7 +19370,7 @@ var init_scripts = __esm({
19455
19370
  init_stageMergeConflicts();
19456
19371
  init_startFlow();
19457
19372
  init_syncFlow();
19458
- init_validateAgentFactoryBundle();
19373
+ init_validateAgencyModelProposal();
19459
19374
  init_verify2();
19460
19375
  init_verifyReproFails();
19461
19376
  init_verifyWithRetry();
@@ -19520,7 +19435,7 @@ var init_scripts = __esm({
19520
19435
  parseIssueStateFromAgentResult,
19521
19436
  parseJobStateFromAgentResult,
19522
19437
  parseReproOutput,
19523
- validateAgentFactoryBundle,
19438
+ validateAgencyModelProposal,
19524
19439
  writeIssueStateComment,
19525
19440
  writeJobStateFile,
19526
19441
  appendCompanyActivity,
@@ -19555,7 +19470,7 @@ var init_scripts = __esm({
19555
19470
  recordClassification,
19556
19471
  dispatchClassified,
19557
19472
  notifyTerminal,
19558
- openAgentFactoryStatePr,
19473
+ openAgencyModelReviewPr,
19559
19474
  openQaIssue,
19560
19475
  createQaGoal,
19561
19476
  failOnceTaskJob,
@@ -20685,7 +20600,7 @@ var init_executor = __esm({
20685
20600
  "ensurePr",
20686
20601
  "applyCapabilityReports",
20687
20602
  "publishReport",
20688
- "openAgentFactoryStatePr"
20603
+ "openAgencyModelReviewPr"
20689
20604
  ]);
20690
20605
  MAX_CHAIN_HOPS = 60;
20691
20606
  DEFAULT_SHELL_TIMEOUT_MS = 3e5;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.370",
3
+ "version": "0.4.371",
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",
@@ -1,13 +0,0 @@
1
- # Agent Creator
2
-
3
- ## Purpose
4
-
5
- Create one Kody Agent model from a focused request.
6
-
7
- ## Contract
8
-
9
- The input is a request for one agent identity. The creator must use `docs/agents.md`, return one review-ready agent file, and keep tasks, schedules, tools, outputs, workflows, goals, and loops out of the agent.
10
-
11
- ## Boundary
12
-
13
- This capability creates the who. It does not create what, when, or how.
@@ -1,7 +0,0 @@
1
- {
2
- "name": "agent-creator",
3
- "action": "agent-creator",
4
- "implementation": "agent-creator",
5
- "capabilityKind": "act",
6
- "describe": "Create one Kody agent identity model from a focused request."
7
- }
@@ -1,10 +0,0 @@
1
- # Agent Factory
2
-
3
- ## Purpose
4
-
5
- Create or assemble Kody agency model definitions from an operator request.
6
-
7
- ## Instructions
8
-
9
- Use the `agent-factory` implementation for the execution details.
10
- The capability owns the public action name and review boundary; the implementation owns model reasoning and state-repo PR creation.
@@ -1,6 +0,0 @@
1
- {
2
- "name": "agent-factory",
3
- "action": "agent-factory",
4
- "implementation": "agent-factory",
5
- "describe": "Create or assemble Kody agency model definitions from an operator request."
6
- }
@@ -1,13 +0,0 @@
1
- # Capability Creator
2
-
3
- ## Purpose
4
-
5
- Create one complete Kody Capability model from a focused ability contract.
6
-
7
- ## Contract
8
-
9
- The input is the ability to provide, its kind, interface, and constraints. The creator must use `docs/capabilities.md`, `docs/capability-kind-map.md`, and `docs/capability-implementations.md`; create one `observe`, `act`, or `verify` capability; and return review-ready files under `capabilities/<slug>/`.
10
-
11
- ## Boundary
12
-
13
- This capability creates the reusable how. It does not decide who runs it, which workflow calls it, which goal consumes it, or which loop wakes it.