@kody-ade/kody-engine 0.4.369 → 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.
- package/dist/bin/kody.js +156 -240
- package/package.json +1 -1
- package/dist/capabilities/agent-creator/capability.md +0 -13
- package/dist/capabilities/agent-creator/profile.json +0 -7
- package/dist/capabilities/agent-factory/capability.md +0 -10
- package/dist/capabilities/agent-factory/profile.json +0 -6
- package/dist/capabilities/capability-creator/capability.md +0 -13
- package/dist/capabilities/capability-creator/profile.json +0 -7
- package/dist/capabilities/goal-creator/capability.md +0 -13
- package/dist/capabilities/goal-creator/profile.json +0 -7
- package/dist/capabilities/loop-creator/capability.md +0 -13
- package/dist/capabilities/loop-creator/profile.json +0 -7
- package/dist/capabilities/workflow-creator/capability.md +0 -13
- package/dist/capabilities/workflow-creator/profile.json +0 -7
- package/dist/implementations/agent-creator/profile.json +0 -65
- package/dist/implementations/agent-creator/prompt.md +0 -86
- package/dist/implementations/agent-factory/profile.json +0 -65
- package/dist/implementations/agent-factory/prompt.md +0 -142
- package/dist/implementations/capability-creator/profile.json +0 -65
- package/dist/implementations/capability-creator/prompt.md +0 -120
- package/dist/implementations/goal-creator/profile.json +0 -65
- package/dist/implementations/goal-creator/prompt.md +0 -91
- package/dist/implementations/loop-creator/profile.json +0 -65
- package/dist/implementations/loop-creator/prompt.md +0 -86
- package/dist/implementations/workflow-creator/profile.json +0 -65
- 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.
|
|
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",
|
|
@@ -14038,12 +14038,13 @@ var init_loadCapabilityState = __esm({
|
|
|
14038
14038
|
ctx.data.capabilityToolsList = declaredTools.map((name) => `- \`${name}\``).join("\n");
|
|
14039
14039
|
ctx.data.capabilityOperatorMention = mentions;
|
|
14040
14040
|
const mcpToolNames = declaredTools.map((name) => `mcp__kody-capability__${name}`);
|
|
14041
|
+
const submitStateTool = "mcp__kody-submit__submit_state";
|
|
14042
|
+
profile.claudeCode.enableSubmitTool = true;
|
|
14041
14043
|
if (mode === "append") {
|
|
14042
|
-
profile.claudeCode.tools = [.../* @__PURE__ */ new Set([...profile.claudeCode.tools ?? [], ...mcpToolNames])];
|
|
14044
|
+
profile.claudeCode.tools = [.../* @__PURE__ */ new Set([...profile.claudeCode.tools ?? [], ...mcpToolNames, submitStateTool])];
|
|
14043
14045
|
return;
|
|
14044
14046
|
}
|
|
14045
|
-
profile.claudeCode.tools = [...mcpToolNames,
|
|
14046
|
-
profile.claudeCode.enableSubmitTool = true;
|
|
14047
|
+
profile.claudeCode.tools = [...mcpToolNames, submitStateTool];
|
|
14047
14048
|
}
|
|
14048
14049
|
};
|
|
14049
14050
|
}
|
|
@@ -15358,29 +15359,29 @@ var init_notifyTerminal = __esm({
|
|
|
15358
15359
|
}
|
|
15359
15360
|
});
|
|
15360
15361
|
|
|
15361
|
-
// src/scripts/
|
|
15362
|
-
function
|
|
15362
|
+
// src/scripts/openAgencyModelReviewPr.ts
|
|
15363
|
+
function parseAgencyModelProposal(raw) {
|
|
15363
15364
|
const jsonText = stripJsonFence(raw);
|
|
15364
15365
|
let parsed;
|
|
15365
15366
|
try {
|
|
15366
15367
|
parsed = JSON.parse(jsonText);
|
|
15367
15368
|
} catch (err) {
|
|
15368
15369
|
throw new Error(
|
|
15369
|
-
`
|
|
15370
|
+
`openAgencyModelReviewPr: PR_SUMMARY must be valid JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
15370
15371
|
);
|
|
15371
15372
|
}
|
|
15372
15373
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
15373
|
-
throw new Error("
|
|
15374
|
+
throw new Error("openAgencyModelReviewPr: PR_SUMMARY must be a JSON object");
|
|
15374
15375
|
}
|
|
15375
15376
|
const value = parsed;
|
|
15376
15377
|
const title = readRequiredJsonString(value.title, "title");
|
|
15377
15378
|
const summary = readRequiredJsonString(value.summary, "summary");
|
|
15378
15379
|
if (!Array.isArray(value.files) || value.files.length === 0) {
|
|
15379
|
-
throw new Error("
|
|
15380
|
+
throw new Error("openAgencyModelReviewPr: files must be a non-empty array");
|
|
15380
15381
|
}
|
|
15381
15382
|
const files = value.files.map((item, index) => {
|
|
15382
15383
|
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
15383
|
-
throw new Error(`
|
|
15384
|
+
throw new Error(`openAgencyModelReviewPr: files[${index}] must be an object`);
|
|
15384
15385
|
}
|
|
15385
15386
|
const file = item;
|
|
15386
15387
|
return {
|
|
@@ -15392,9 +15393,7 @@ function parseAgentFactoryBundle(raw) {
|
|
|
15392
15393
|
title,
|
|
15393
15394
|
summary,
|
|
15394
15395
|
files,
|
|
15395
|
-
model: value.model
|
|
15396
|
-
models: value.models,
|
|
15397
|
-
modelCreatorContractsUsed: value.modelCreatorContractsUsed
|
|
15396
|
+
model: value.model
|
|
15398
15397
|
};
|
|
15399
15398
|
}
|
|
15400
15399
|
function buildStatePrBranchName(sourceLabel, issueNumber, title, now = Date.now()) {
|
|
@@ -15406,20 +15405,20 @@ function normalizeBundleFiles(ctx, bundle) {
|
|
|
15406
15405
|
const seen = /* @__PURE__ */ new Set();
|
|
15407
15406
|
return bundle.files.map((file, index) => {
|
|
15408
15407
|
if (file.path.startsWith("/") || file.path.includes("\\")) {
|
|
15409
|
-
throw new Error(`
|
|
15408
|
+
throw new Error(`openAgencyModelReviewPr: files[${index}].path must be a relative POSIX path`);
|
|
15410
15409
|
}
|
|
15411
15410
|
const normalizedPath = normalizeStatePath(file.path, `files[${index}].path`);
|
|
15412
15411
|
const relativePath = normalizedPath.replace(/^\.kody\/?/, "");
|
|
15413
15412
|
if (!relativePath) {
|
|
15414
|
-
throw new Error(`
|
|
15413
|
+
throw new Error(`openAgencyModelReviewPr: files[${index}].path must point to a state repo file`);
|
|
15415
15414
|
}
|
|
15416
15415
|
if (relativePath === "implementations" || relativePath.startsWith("implementations/")) {
|
|
15417
15416
|
throw new Error(
|
|
15418
|
-
`
|
|
15417
|
+
`openAgencyModelReviewPr: files[${index}].path uses obsolete implementations storage; use capabilities/<slug>/ instead`
|
|
15419
15418
|
);
|
|
15420
15419
|
}
|
|
15421
15420
|
if (seen.has(relativePath)) {
|
|
15422
|
-
throw new Error(`
|
|
15421
|
+
throw new Error(`openAgencyModelReviewPr: duplicate generated file path: ${relativePath}`);
|
|
15423
15422
|
}
|
|
15424
15423
|
seen.add(relativePath);
|
|
15425
15424
|
return {
|
|
@@ -15437,22 +15436,22 @@ function stripJsonFence(raw) {
|
|
|
15437
15436
|
function readIssueNumber(ctx) {
|
|
15438
15437
|
const issueNumber = ctx.args.issue;
|
|
15439
15438
|
if (typeof issueNumber !== "number" || !Number.isInteger(issueNumber) || issueNumber <= 0) {
|
|
15440
|
-
throw new Error("
|
|
15439
|
+
throw new Error("openAgencyModelReviewPr: ctx.args.issue must be a positive integer");
|
|
15441
15440
|
}
|
|
15442
15441
|
return issueNumber;
|
|
15443
15442
|
}
|
|
15444
15443
|
function readRequiredJsonString(value, field) {
|
|
15445
15444
|
const text = readJsonString(value, field).trim();
|
|
15446
|
-
if (!text) throw new Error(`
|
|
15445
|
+
if (!text) throw new Error(`openAgencyModelReviewPr: ${field} must be a non-empty string`);
|
|
15447
15446
|
return text;
|
|
15448
15447
|
}
|
|
15449
15448
|
function readJsonString(value, field) {
|
|
15450
|
-
if (typeof value !== "string") throw new Error(`
|
|
15449
|
+
if (typeof value !== "string") throw new Error(`openAgencyModelReviewPr: ${field} must be a string`);
|
|
15451
15450
|
return value;
|
|
15452
15451
|
}
|
|
15453
15452
|
function requireString2(value, label) {
|
|
15454
15453
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
15455
|
-
throw new Error(`
|
|
15454
|
+
throw new Error(`openAgencyModelReviewPr: missing ${label}`);
|
|
15456
15455
|
}
|
|
15457
15456
|
return value;
|
|
15458
15457
|
}
|
|
@@ -15460,7 +15459,7 @@ function creatorSourceLabel(ctx, profileName) {
|
|
|
15460
15459
|
const capability = typeof ctx.data.jobCapability === "string" ? ctx.data.jobCapability.trim() : "";
|
|
15461
15460
|
const implementation = typeof ctx.data.selectedImplementation === "string" ? ctx.data.selectedImplementation.trim() : "";
|
|
15462
15461
|
const profile = typeof profileName === "string" ? profileName.trim() : "";
|
|
15463
|
-
return capability || implementation || profile || "
|
|
15462
|
+
return capability || implementation || profile || "model-creator";
|
|
15464
15463
|
}
|
|
15465
15464
|
function ghJson(args, cwd, input) {
|
|
15466
15465
|
const raw = gh(args, input === void 0 ? { cwd } : { cwd, input: JSON.stringify(input) });
|
|
@@ -15469,7 +15468,7 @@ function ghJson(args, cwd, input) {
|
|
|
15469
15468
|
return JSON.parse(raw);
|
|
15470
15469
|
} catch (err) {
|
|
15471
15470
|
throw new Error(
|
|
15472
|
-
`
|
|
15471
|
+
`openAgencyModelReviewPr: gh api returned invalid JSON: ${err instanceof Error ? err.message : String(err)}`
|
|
15473
15472
|
);
|
|
15474
15473
|
}
|
|
15475
15474
|
}
|
|
@@ -15501,25 +15500,25 @@ function renderIssueComment(owner, repo, prUrl, bundle, sourceLabel) {
|
|
|
15501
15500
|
bundle.summary
|
|
15502
15501
|
].join("\n");
|
|
15503
15502
|
}
|
|
15504
|
-
var
|
|
15505
|
-
var
|
|
15506
|
-
"src/scripts/
|
|
15503
|
+
var openAgencyModelReviewPr;
|
|
15504
|
+
var init_openAgencyModelReviewPr = __esm({
|
|
15505
|
+
"src/scripts/openAgencyModelReviewPr.ts"() {
|
|
15507
15506
|
"use strict";
|
|
15508
15507
|
init_issue();
|
|
15509
15508
|
init_stateRepo();
|
|
15510
|
-
|
|
15509
|
+
openAgencyModelReviewPr = async (ctx, profile, agentResult) => {
|
|
15511
15510
|
if (agentResult?.outcome !== "completed") {
|
|
15512
|
-
throw new Error(`
|
|
15511
|
+
throw new Error(`openAgencyModelReviewPr: agent did not complete: ${agentResult?.error ?? "unknown failure"}`);
|
|
15513
15512
|
}
|
|
15514
15513
|
if (ctx.data.agentDone !== true) {
|
|
15515
|
-
throw new Error("
|
|
15514
|
+
throw new Error("openAgencyModelReviewPr: agent did not produce a successful final result");
|
|
15516
15515
|
}
|
|
15517
15516
|
if (!ctx.config.state?.repo || !ctx.config.state?.path) {
|
|
15518
|
-
throw new Error("
|
|
15517
|
+
throw new Error("openAgencyModelReviewPr: config.state.repo and config.state.path are required");
|
|
15519
15518
|
}
|
|
15520
15519
|
const issueNumber = readIssueNumber(ctx);
|
|
15521
15520
|
const sourceLabel = creatorSourceLabel(ctx, profile.name);
|
|
15522
|
-
const bundle =
|
|
15521
|
+
const bundle = parseAgencyModelProposal(String(ctx.data.prSummary ?? ""));
|
|
15523
15522
|
const normalizedFiles = normalizeBundleFiles(ctx, bundle);
|
|
15524
15523
|
const stateRepo = parseStateRepo(ctx.config);
|
|
15525
15524
|
const baseBranch = "main";
|
|
@@ -15598,7 +15597,7 @@ var init_openAgentFactoryStatePr = __esm({
|
|
|
15598
15597
|
cwd: ctx.cwd,
|
|
15599
15598
|
input: renderIssueComment(stateRepo.owner, stateRepo.repo, prUrl, bundle, sourceLabel)
|
|
15600
15599
|
});
|
|
15601
|
-
ctx.data.
|
|
15600
|
+
ctx.data.agencyModelReviewPr = {
|
|
15602
15601
|
repo: `${stateRepo.owner}/${stateRepo.repo}`,
|
|
15603
15602
|
branch,
|
|
15604
15603
|
base: baseBranch,
|
|
@@ -15902,106 +15901,6 @@ var init_parseJobStateFromAgentResult = __esm({
|
|
|
15902
15901
|
}
|
|
15903
15902
|
});
|
|
15904
15903
|
|
|
15905
|
-
// src/scripts/publishReport.ts
|
|
15906
|
-
function buildRuntimeReportMarkdown(input) {
|
|
15907
|
-
return [
|
|
15908
|
-
"---",
|
|
15909
|
-
`generatedAt: ${yamlString(input.generatedAt)}`,
|
|
15910
|
-
`reportType: ${input.reportType}`,
|
|
15911
|
-
`reportTypeVersion: ${input.reportTypeVersion}`,
|
|
15912
|
-
"producer:",
|
|
15913
|
-
` model: ${input.owner}`,
|
|
15914
|
-
` capability: ${input.capability}`,
|
|
15915
|
-
...input.reviewStatus ? [`reviewStatus: ${input.reviewStatus}`] : [],
|
|
15916
|
-
...input.reviewArea ? [`reviewArea: ${input.reviewArea}`] : [],
|
|
15917
|
-
"---",
|
|
15918
|
-
`# ${input.title}`,
|
|
15919
|
-
"",
|
|
15920
|
-
input.summary,
|
|
15921
|
-
"",
|
|
15922
|
-
"## Report data",
|
|
15923
|
-
"```json",
|
|
15924
|
-
JSON.stringify(input.data, null, 2),
|
|
15925
|
-
"```",
|
|
15926
|
-
""
|
|
15927
|
-
].join("\n");
|
|
15928
|
-
}
|
|
15929
|
-
function parsePublication(value) {
|
|
15930
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
15931
|
-
const raw = value;
|
|
15932
|
-
if (typeof raw.type !== "string" || !SAFE_SLUG.test(raw.type)) return null;
|
|
15933
|
-
if (typeof raw.owner !== "string" || !SAFE_SLUG.test(raw.owner)) return null;
|
|
15934
|
-
return raw;
|
|
15935
|
-
}
|
|
15936
|
-
function latestResult(raw, agentResult) {
|
|
15937
|
-
const results = [];
|
|
15938
|
-
if (Array.isArray(raw)) {
|
|
15939
|
-
for (const item of raw) {
|
|
15940
|
-
const parsed = parseCapabilityResult(item);
|
|
15941
|
-
if (parsed) results.push(parsed);
|
|
15942
|
-
}
|
|
15943
|
-
}
|
|
15944
|
-
if (agentResult?.finalText) results.push(...parseCapabilityResultsFromText(agentResult.finalText));
|
|
15945
|
-
return results.at(-1) ?? null;
|
|
15946
|
-
}
|
|
15947
|
-
function recordField6(value) {
|
|
15948
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
15949
|
-
}
|
|
15950
|
-
function resolveDotted(root, path51) {
|
|
15951
|
-
if (!path51) return void 0;
|
|
15952
|
-
return path51.split(".").reduce((value, key) => recordField6(value)?.[key], root);
|
|
15953
|
-
}
|
|
15954
|
-
function stringValue4(value) {
|
|
15955
|
-
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
15956
|
-
}
|
|
15957
|
-
function humanize(value) {
|
|
15958
|
-
return value.split(/[-_]+/).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join(" ");
|
|
15959
|
-
}
|
|
15960
|
-
function yamlString(value) {
|
|
15961
|
-
return JSON.stringify(value);
|
|
15962
|
-
}
|
|
15963
|
-
var SAFE_SLUG, publishReport;
|
|
15964
|
-
var init_publishReport = __esm({
|
|
15965
|
-
"src/scripts/publishReport.ts"() {
|
|
15966
|
-
"use strict";
|
|
15967
|
-
init_capabilityResult();
|
|
15968
|
-
init_stateRepo();
|
|
15969
|
-
SAFE_SLUG = /^[a-z0-9][a-z0-9_-]{0,79}$/;
|
|
15970
|
-
publishReport = async (ctx, _profile, agentResult) => {
|
|
15971
|
-
const publication = parsePublication(ctx.data.reportPublication);
|
|
15972
|
-
if (!publication) return;
|
|
15973
|
-
const result = latestResult(ctx.data.capabilityResults, agentResult);
|
|
15974
|
-
const stateData = recordField6(recordField6(ctx.data.nextJobState)?.data) ?? {};
|
|
15975
|
-
const data = { ...stateData, ...result?.facts ?? {} };
|
|
15976
|
-
if (publication.publishWhenFact && resolveDotted(data, publication.publishWhenFact) === void 0) return;
|
|
15977
|
-
const slug = publication.slug ?? stringValue4(resolveDotted(data, publication.slugFact));
|
|
15978
|
-
if (!slug || !SAFE_SLUG.test(slug)) return;
|
|
15979
|
-
const title = publication.title ?? stringValue4(resolveDotted(data, publication.titleFact)) ?? humanize(slug);
|
|
15980
|
-
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
15981
|
-
const markdown = buildRuntimeReportMarkdown({
|
|
15982
|
-
generatedAt,
|
|
15983
|
-
reportType: publication.type,
|
|
15984
|
-
reportTypeVersion: publication.version ?? 1,
|
|
15985
|
-
owner: publication.owner,
|
|
15986
|
-
capability: stringValue4(ctx.data.jobCapability) ?? stringValue4(ctx.data.capabilitySlug) ?? "unknown",
|
|
15987
|
-
title,
|
|
15988
|
-
summary: result?.summary ?? title,
|
|
15989
|
-
data,
|
|
15990
|
-
...publication.reviewStatus ? { reviewStatus: publication.reviewStatus } : {},
|
|
15991
|
-
...publication.reviewArea ? { reviewArea: publication.reviewArea } : {}
|
|
15992
|
-
});
|
|
15993
|
-
const runId = generatedAt.replace(/\.\d{3}Z$/, "Z").replace(/:/g, "-");
|
|
15994
|
-
writeStateText(
|
|
15995
|
-
ctx.config,
|
|
15996
|
-
ctx.cwd,
|
|
15997
|
-
`reports/${slug}/runs/${runId}.md`,
|
|
15998
|
-
markdown,
|
|
15999
|
-
`chore(reports): add ${slug} run`
|
|
16000
|
-
);
|
|
16001
|
-
};
|
|
16002
|
-
}
|
|
16003
|
-
});
|
|
16004
|
-
|
|
16005
15904
|
// src/scripts/parseReproOutput.ts
|
|
16006
15905
|
function extractTestPath(text) {
|
|
16007
15906
|
const m = text.match(/^[\s>*_#`~-]*TEST_PATH[\s>*_#`~-]*\s*:\s*(.+?)\s*$/im);
|
|
@@ -16613,6 +16512,106 @@ var init_promoteQaGoal = __esm({
|
|
|
16613
16512
|
}
|
|
16614
16513
|
});
|
|
16615
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
|
+
|
|
16616
16615
|
// src/scripts/recordClassification.ts
|
|
16617
16616
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
16618
16617
|
function parseClassification(prSummary) {
|
|
@@ -18361,29 +18360,18 @@ var init_syncFlow = __esm({
|
|
|
18361
18360
|
}
|
|
18362
18361
|
});
|
|
18363
18362
|
|
|
18364
|
-
// src/scripts/
|
|
18365
|
-
function validateModelBundle(bundle,
|
|
18363
|
+
// src/scripts/validateAgencyModelProposal.ts
|
|
18364
|
+
function validateModelBundle(bundle, expectedKind) {
|
|
18366
18365
|
const failures = [];
|
|
18367
|
-
|
|
18368
|
-
if (producer === FACTORY_PRODUCER) {
|
|
18369
|
-
const contracts = stringArray4(bundle.modelCreatorContractsUsed);
|
|
18370
|
-
for (const contract of CREATOR_CONTRACTS) {
|
|
18371
|
-
if (!contracts.includes(contract)) failures.push(`modelCreatorContractsUsed missing ${contract}`);
|
|
18372
|
-
}
|
|
18373
|
-
if (!Array.isArray(bundle.models) || bundle.models.length === 0) {
|
|
18374
|
-
failures.push("agent-factory bundle must include non-empty models array");
|
|
18375
|
-
return failures;
|
|
18376
|
-
}
|
|
18377
|
-
for (const [index, model] of bundle.models.entries()) {
|
|
18378
|
-
validateOneModel(model, bundle.files, `models[${index}]`, false, failures);
|
|
18379
|
-
}
|
|
18380
|
-
validateFactoryAssembly(bundle.models, failures);
|
|
18381
|
-
return failures;
|
|
18382
|
-
}
|
|
18383
|
-
validateOneModel(bundle.model, bundle.files, "model", true, failures, expectedKind, producer);
|
|
18366
|
+
validateOneModel(bundle.model, bundle.files, "model", true, failures, expectedKind);
|
|
18384
18367
|
return failures;
|
|
18385
18368
|
}
|
|
18386
|
-
function
|
|
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) {
|
|
18387
18375
|
if (!rawModel || typeof rawModel !== "object" || Array.isArray(rawModel)) {
|
|
18388
18376
|
failures.push(`${label} must be an object`);
|
|
18389
18377
|
return;
|
|
@@ -18391,8 +18379,7 @@ function validateOneModel(rawModel, files, label, strictSingleModel, failures, e
|
|
|
18391
18379
|
const model = rawModel;
|
|
18392
18380
|
const kind = stringField6(model.kind);
|
|
18393
18381
|
if (!isModelKind(kind)) failures.push(`${label}.kind must be agent, capability, goal, agentLoop, or workflow`);
|
|
18394
|
-
if (expectedKind && kind !== expectedKind
|
|
18395
|
-
failures.push(`${producer} must output model.kind ${expectedKind}`);
|
|
18382
|
+
if (expectedKind && kind !== expectedKind) failures.push(`proposal must output model.kind ${expectedKind}`);
|
|
18396
18383
|
const slug = stringField6(model.slug);
|
|
18397
18384
|
if (!isSlug(slug)) failures.push(`${label}.slug must be a lowercase slug`);
|
|
18398
18385
|
if (isModelKind(kind)) {
|
|
@@ -18456,57 +18443,6 @@ function validateFilesForKind(kind, slug, files, strictSingleModel, failures) {
|
|
|
18456
18443
|
}
|
|
18457
18444
|
}
|
|
18458
18445
|
}
|
|
18459
|
-
function validateFactoryAssembly(models, failures) {
|
|
18460
|
-
const available = /* @__PURE__ */ new Map();
|
|
18461
|
-
for (const model of models) {
|
|
18462
|
-
if (!model || typeof model !== "object" || Array.isArray(model)) continue;
|
|
18463
|
-
const input = model;
|
|
18464
|
-
const kind = stringField6(input.kind);
|
|
18465
|
-
const slug = stringField6(input.slug);
|
|
18466
|
-
if (isModelKind(kind) && isSlug(slug)) available.set(`${kind}:${slug}`, kind);
|
|
18467
|
-
}
|
|
18468
|
-
for (const model of models) {
|
|
18469
|
-
if (!model || typeof model !== "object" || Array.isArray(model)) continue;
|
|
18470
|
-
const input = model;
|
|
18471
|
-
const kind = stringField6(input.kind);
|
|
18472
|
-
if (kind === "goal") {
|
|
18473
|
-
for (const capability of capabilityRefs(input)) {
|
|
18474
|
-
if (!available.has(`capability:${capability}`)) {
|
|
18475
|
-
failures.push(`goal ${stringField6(input.slug)} references missing capability ${capability}`);
|
|
18476
|
-
}
|
|
18477
|
-
}
|
|
18478
|
-
}
|
|
18479
|
-
if (kind === "workflow") {
|
|
18480
|
-
for (const capability of stringArray4(input.steps)) {
|
|
18481
|
-
if (!available.has(`capability:${capability}`)) {
|
|
18482
|
-
failures.push(`workflow ${stringField6(input.slug)} references missing capability ${capability}`);
|
|
18483
|
-
}
|
|
18484
|
-
}
|
|
18485
|
-
for (const step of arrayObjects(input.steps)) {
|
|
18486
|
-
const capability = stringField6(step.capability);
|
|
18487
|
-
if (capability && !available.has(`capability:${capability}`)) {
|
|
18488
|
-
failures.push(`workflow ${stringField6(input.slug)} references missing capability ${capability}`);
|
|
18489
|
-
}
|
|
18490
|
-
}
|
|
18491
|
-
}
|
|
18492
|
-
if (kind === "agentLoop") {
|
|
18493
|
-
const target = wakeTarget(input);
|
|
18494
|
-
if (target) {
|
|
18495
|
-
if (!available.has(`${target.kind}:${target.slug}`)) {
|
|
18496
|
-
failures.push(`agentLoop ${stringField6(input.slug)} references missing ${target.kind} ${target.slug}`);
|
|
18497
|
-
}
|
|
18498
|
-
} else {
|
|
18499
|
-
const targetSlug = stringField6(input.target);
|
|
18500
|
-
const targetExists = ["goal", "workflow", "capability"].some(
|
|
18501
|
-
(kindName) => available.has(`${kindName}:${targetSlug}`)
|
|
18502
|
-
);
|
|
18503
|
-
if (targetSlug && !targetExists) {
|
|
18504
|
-
failures.push(`agentLoop ${stringField6(input.slug)} references missing target ${targetSlug}`);
|
|
18505
|
-
}
|
|
18506
|
-
}
|
|
18507
|
-
}
|
|
18508
|
-
}
|
|
18509
|
-
}
|
|
18510
18446
|
function validateModelShape(kind, model, files, slug, failures) {
|
|
18511
18447
|
if (kind === "agent") {
|
|
18512
18448
|
const agentFile = textFile(files, `agents/${slug}.md`);
|
|
@@ -18629,12 +18565,6 @@ function stringArray4(value) {
|
|
|
18629
18565
|
if (!Array.isArray(value)) return [];
|
|
18630
18566
|
return value.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean);
|
|
18631
18567
|
}
|
|
18632
|
-
function arrayObjects(value) {
|
|
18633
|
-
if (!Array.isArray(value)) return [];
|
|
18634
|
-
return value.filter(
|
|
18635
|
-
(item) => Boolean(item) && typeof item === "object" && !Array.isArray(item)
|
|
18636
|
-
);
|
|
18637
|
-
}
|
|
18638
18568
|
function requireStringArrayIncludes(value, expected, label, failures) {
|
|
18639
18569
|
if (!stringArray4(value).includes(expected)) failures.push(`${label} must include ${expected}`);
|
|
18640
18570
|
}
|
|
@@ -18644,19 +18574,11 @@ function isSlug(value) {
|
|
|
18644
18574
|
function isModelKind(value) {
|
|
18645
18575
|
return value === "agent" || value === "capability" || value === "goal" || value === "agentLoop" || value === "workflow";
|
|
18646
18576
|
}
|
|
18647
|
-
var
|
|
18648
|
-
var
|
|
18649
|
-
"src/scripts/
|
|
18577
|
+
var REQUIRED_DOCS, validateAgencyModelProposal;
|
|
18578
|
+
var init_validateAgencyModelProposal = __esm({
|
|
18579
|
+
"src/scripts/validateAgencyModelProposal.ts"() {
|
|
18650
18580
|
"use strict";
|
|
18651
|
-
|
|
18652
|
-
CREATOR_CONTRACTS = [
|
|
18653
|
-
"agent-creator",
|
|
18654
|
-
"goal-creator",
|
|
18655
|
-
"loop-creator",
|
|
18656
|
-
"workflow-creator",
|
|
18657
|
-
"capability-creator"
|
|
18658
|
-
];
|
|
18659
|
-
FACTORY_PRODUCER = "agent-factory";
|
|
18581
|
+
init_openAgencyModelReviewPr();
|
|
18660
18582
|
REQUIRED_DOCS = {
|
|
18661
18583
|
agent: ["docs/agents.md"],
|
|
18662
18584
|
capability: ["docs/capabilities.md", "docs/capability-kind-map.md", "docs/capability-implementations.md"],
|
|
@@ -18664,20 +18586,14 @@ var init_validateAgentFactoryBundle = __esm({
|
|
|
18664
18586
|
agentLoop: ["docs/jobs-model.md", "docs/engine-company.md", "docs/ledgers.md"],
|
|
18665
18587
|
workflow: ["docs/jobs-model.md", "docs/capabilities.md"]
|
|
18666
18588
|
};
|
|
18667
|
-
|
|
18668
|
-
"agent-creator": "agent",
|
|
18669
|
-
"capability-creator": "capability",
|
|
18670
|
-
"goal-creator": "goal",
|
|
18671
|
-
"loop-creator": "agentLoop",
|
|
18672
|
-
"workflow-creator": "workflow"
|
|
18673
|
-
};
|
|
18674
|
-
validateAgentFactoryBundle = async (ctx, profile) => {
|
|
18589
|
+
validateAgencyModelProposal = async (ctx, _profile, _agentResult, args) => {
|
|
18675
18590
|
if (ctx.data.agentDone !== true) return;
|
|
18676
18591
|
const raw = String(ctx.data.prSummary ?? "");
|
|
18677
|
-
const bundle =
|
|
18678
|
-
const
|
|
18592
|
+
const bundle = parseAgencyModelProposal(raw);
|
|
18593
|
+
const expectedKind = readExpectedModelKind(args);
|
|
18594
|
+
const failures = validateModelBundle(bundle, expectedKind);
|
|
18679
18595
|
if (failures.length > 0) {
|
|
18680
|
-
throw new Error(`
|
|
18596
|
+
throw new Error(`validateAgencyModelProposal: ${failures.join("; ")}`);
|
|
18681
18597
|
}
|
|
18682
18598
|
};
|
|
18683
18599
|
}
|
|
@@ -19416,12 +19332,11 @@ var init_scripts = __esm({
|
|
|
19416
19332
|
init_mergeReleasePr();
|
|
19417
19333
|
init_mirrorStateToPr();
|
|
19418
19334
|
init_notifyTerminal();
|
|
19419
|
-
|
|
19335
|
+
init_openAgencyModelReviewPr();
|
|
19420
19336
|
init_openQaIssue();
|
|
19421
19337
|
init_parseAgentResult();
|
|
19422
19338
|
init_parseIssueStateFromAgentResult();
|
|
19423
19339
|
init_parseJobStateFromAgentResult();
|
|
19424
|
-
init_publishReport();
|
|
19425
19340
|
init_parseReproOutput();
|
|
19426
19341
|
init_persistArtifacts();
|
|
19427
19342
|
init_persistFlowState();
|
|
@@ -19432,6 +19347,7 @@ var init_scripts = __esm({
|
|
|
19432
19347
|
init_postResearchComment();
|
|
19433
19348
|
init_postReviewResult();
|
|
19434
19349
|
init_promoteQaGoal();
|
|
19350
|
+
init_publishReport();
|
|
19435
19351
|
init_recordClassification();
|
|
19436
19352
|
init_recordOutcome();
|
|
19437
19353
|
init_requireFeedbackActions();
|
|
@@ -19454,7 +19370,7 @@ var init_scripts = __esm({
|
|
|
19454
19370
|
init_stageMergeConflicts();
|
|
19455
19371
|
init_startFlow();
|
|
19456
19372
|
init_syncFlow();
|
|
19457
|
-
|
|
19373
|
+
init_validateAgencyModelProposal();
|
|
19458
19374
|
init_verify2();
|
|
19459
19375
|
init_verifyReproFails();
|
|
19460
19376
|
init_verifyWithRetry();
|
|
@@ -19519,7 +19435,7 @@ var init_scripts = __esm({
|
|
|
19519
19435
|
parseIssueStateFromAgentResult,
|
|
19520
19436
|
parseJobStateFromAgentResult,
|
|
19521
19437
|
parseReproOutput,
|
|
19522
|
-
|
|
19438
|
+
validateAgencyModelProposal,
|
|
19523
19439
|
writeIssueStateComment,
|
|
19524
19440
|
writeJobStateFile,
|
|
19525
19441
|
appendCompanyActivity,
|
|
@@ -19554,7 +19470,7 @@ var init_scripts = __esm({
|
|
|
19554
19470
|
recordClassification,
|
|
19555
19471
|
dispatchClassified,
|
|
19556
19472
|
notifyTerminal,
|
|
19557
|
-
|
|
19473
|
+
openAgencyModelReviewPr,
|
|
19558
19474
|
openQaIssue,
|
|
19559
19475
|
createQaGoal,
|
|
19560
19476
|
failOnceTaskJob,
|
|
@@ -20684,7 +20600,7 @@ var init_executor = __esm({
|
|
|
20684
20600
|
"ensurePr",
|
|
20685
20601
|
"applyCapabilityReports",
|
|
20686
20602
|
"publishReport",
|
|
20687
|
-
"
|
|
20603
|
+
"openAgencyModelReviewPr"
|
|
20688
20604
|
]);
|
|
20689
20605
|
MAX_CHAIN_HOPS = 60;
|
|
20690
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.
|
|
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,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.
|