@kody-ade/kody-engine 0.4.368 → 0.4.369
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 +143 -2
- package/dist/implementations/types.ts +15 -0
- 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.
|
|
18
|
+
version: "0.4.369",
|
|
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",
|
|
@@ -1989,6 +1989,7 @@ function parseWorkflowStep(value) {
|
|
|
1989
1989
|
const target = stringField(raw.target);
|
|
1990
1990
|
const targetFact = stringField(raw.targetFact ?? raw.target_fact);
|
|
1991
1991
|
const cliArgs = raw.cliArgs;
|
|
1992
|
+
const report = parseReportPublication(raw.report);
|
|
1992
1993
|
return {
|
|
1993
1994
|
capability,
|
|
1994
1995
|
...action && isSafeSlug(action) ? { action } : {},
|
|
@@ -2001,7 +2002,35 @@ function parseWorkflowStep(value) {
|
|
|
2001
2002
|
...cliArgs && typeof cliArgs === "object" && !Array.isArray(cliArgs) ? { cliArgs } : {},
|
|
2002
2003
|
...isPlainObject(raw.runWhen) ? { runWhen: raw.runWhen } : {},
|
|
2003
2004
|
...stringList(raw.continueOn ?? raw.continue_on).length > 0 ? { continueOn: stringList(raw.continueOn ?? raw.continue_on) } : {},
|
|
2004
|
-
...raw.saveReport === true ? { saveReport: true } : {}
|
|
2005
|
+
...raw.saveReport === true ? { saveReport: true } : {},
|
|
2006
|
+
...report ? { report } : {}
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
function parseReportPublication(value) {
|
|
2010
|
+
if (!isPlainObject(value)) return void 0;
|
|
2011
|
+
const type = stringField(value.type);
|
|
2012
|
+
const owner = stringField(value.owner);
|
|
2013
|
+
if (!type || !/^[a-z0-9][a-z0-9_-]{0,79}$/.test(type) || !owner || !isSafeSlug(owner)) return void 0;
|
|
2014
|
+
const version = typeof value.version === "number" && Number.isInteger(value.version) && value.version > 0 ? value.version : void 0;
|
|
2015
|
+
const slug = stringField(value.slug);
|
|
2016
|
+
const slugFact = stringField(value.slugFact);
|
|
2017
|
+
const title = stringField(value.title);
|
|
2018
|
+
const titleFact = stringField(value.titleFact);
|
|
2019
|
+
const publishWhenFact = stringField(value.publishWhenFact);
|
|
2020
|
+
const reviewStatus = stringField(value.reviewStatus);
|
|
2021
|
+
const reviewArea = stringField(value.reviewArea);
|
|
2022
|
+
if (!slug && !slugFact) return void 0;
|
|
2023
|
+
return {
|
|
2024
|
+
type,
|
|
2025
|
+
...version ? { version } : {},
|
|
2026
|
+
owner,
|
|
2027
|
+
...slug ? { slug } : {},
|
|
2028
|
+
...slugFact ? { slugFact } : {},
|
|
2029
|
+
...title ? { title } : {},
|
|
2030
|
+
...titleFact ? { titleFact } : {},
|
|
2031
|
+
...publishWhenFact ? { publishWhenFact } : {},
|
|
2032
|
+
...reviewStatus ? { reviewStatus } : {},
|
|
2033
|
+
...reviewArea ? { reviewArea } : {}
|
|
2005
2034
|
};
|
|
2006
2035
|
}
|
|
2007
2036
|
function isPlainObject(value) {
|
|
@@ -15873,6 +15902,106 @@ var init_parseJobStateFromAgentResult = __esm({
|
|
|
15873
15902
|
}
|
|
15874
15903
|
});
|
|
15875
15904
|
|
|
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
|
+
|
|
15876
16005
|
// src/scripts/parseReproOutput.ts
|
|
15877
16006
|
function extractTestPath(text) {
|
|
15878
16007
|
const m = text.match(/^[\s>*_#`~-]*TEST_PATH[\s>*_#`~-]*\s*:\s*(.+?)\s*$/im);
|
|
@@ -19292,6 +19421,7 @@ var init_scripts = __esm({
|
|
|
19292
19421
|
init_parseAgentResult();
|
|
19293
19422
|
init_parseIssueStateFromAgentResult();
|
|
19294
19423
|
init_parseJobStateFromAgentResult();
|
|
19424
|
+
init_publishReport();
|
|
19295
19425
|
init_parseReproOutput();
|
|
19296
19426
|
init_persistArtifacts();
|
|
19297
19427
|
init_persistFlowState();
|
|
@@ -19420,6 +19550,7 @@ var init_scripts = __esm({
|
|
|
19420
19550
|
advanceFlow,
|
|
19421
19551
|
persistFlowState,
|
|
19422
19552
|
applyCapabilityReports,
|
|
19553
|
+
publishReport,
|
|
19423
19554
|
recordClassification,
|
|
19424
19555
|
dispatchClassified,
|
|
19425
19556
|
notifyTerminal,
|
|
@@ -20552,6 +20683,7 @@ var init_executor = __esm({
|
|
|
20552
20683
|
"commitAndPush",
|
|
20553
20684
|
"ensurePr",
|
|
20554
20685
|
"applyCapabilityReports",
|
|
20686
|
+
"publishReport",
|
|
20555
20687
|
"openAgentFactoryStatePr"
|
|
20556
20688
|
]);
|
|
20557
20689
|
MAX_CHAIN_HOPS = 60;
|
|
@@ -20608,9 +20740,16 @@ function validateJob(input) {
|
|
|
20608
20740
|
flavor: j.flavor,
|
|
20609
20741
|
force: j.force === true,
|
|
20610
20742
|
saveReport: j.saveReport === true,
|
|
20743
|
+
report: parseReportPublication2(j.report),
|
|
20611
20744
|
resultTarget: parseCapabilityResultTarget(j.resultTarget)
|
|
20612
20745
|
};
|
|
20613
20746
|
}
|
|
20747
|
+
function parseReportPublication2(raw) {
|
|
20748
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
20749
|
+
const report = raw;
|
|
20750
|
+
if (typeof report.type !== "string" || typeof report.owner !== "string") return void 0;
|
|
20751
|
+
return raw;
|
|
20752
|
+
}
|
|
20614
20753
|
function parseCapabilityResultTarget(raw) {
|
|
20615
20754
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
20616
20755
|
const target = raw;
|
|
@@ -20686,6 +20825,7 @@ async function runCapabilityImplementationStep(valid, profileName, capabilityIde
|
|
|
20686
20825
|
preloadedData.selectedImplementation = profileName;
|
|
20687
20826
|
if (valid.schedule !== void 0 && valid.schedule.length > 0) preloadedData.jobSchedule = valid.schedule;
|
|
20688
20827
|
if (valid.saveReport === true) preloadedData.jobSaveReport = true;
|
|
20828
|
+
if (valid.report) preloadedData.reportPublication = valid.report;
|
|
20689
20829
|
if (valid.force === true) preloadedData.jobForce = true;
|
|
20690
20830
|
if (valid.evidence) preloadedData.capabilityEvidence = { evidence: valid.evidence };
|
|
20691
20831
|
if (valid.resultTarget) preloadedData.capabilityResultTarget = valid.resultTarget;
|
|
@@ -20841,6 +20981,7 @@ function workflowStepToJob(step, parent, chainData) {
|
|
|
20841
20981
|
flavor: parent.flavor,
|
|
20842
20982
|
force: parent.force,
|
|
20843
20983
|
saveReport: step.saveReport === true || parent.saveReport === true,
|
|
20984
|
+
...step.report ? { report: step.report } : {},
|
|
20844
20985
|
...parent.resultTarget ? { resultTarget: parent.resultTarget } : {}
|
|
20845
20986
|
};
|
|
20846
20987
|
}
|
|
@@ -500,6 +500,19 @@ export type AnyScript = PreflightScript | PostflightScript
|
|
|
500
500
|
|
|
501
501
|
export type JobFlavor = "instant" | "scheduled"
|
|
502
502
|
|
|
503
|
+
export interface ReportPublicationConfig {
|
|
504
|
+
type: string
|
|
505
|
+
version?: number
|
|
506
|
+
owner: string
|
|
507
|
+
slug?: string
|
|
508
|
+
slugFact?: string
|
|
509
|
+
title?: string
|
|
510
|
+
titleFact?: string
|
|
511
|
+
publishWhenFact?: string
|
|
512
|
+
reviewStatus?: string
|
|
513
|
+
reviewArea?: string
|
|
514
|
+
}
|
|
515
|
+
|
|
503
516
|
export interface Job {
|
|
504
517
|
/** Public action the user/operator invoked. Mirrors the capability action. */
|
|
505
518
|
action?: string
|
|
@@ -530,6 +543,8 @@ export interface Job {
|
|
|
530
543
|
force?: boolean
|
|
531
544
|
/** Ask the owning goal/loop to write a report run after its persisted decision. */
|
|
532
545
|
saveReport?: boolean
|
|
546
|
+
/** Workflow-owned request for the runtime to publish typed capability output. */
|
|
547
|
+
report?: ReportPublicationConfig
|
|
533
548
|
/** Internal parent context used by postflights to attach neutral capability output. */
|
|
534
549
|
resultTarget?: CapabilityResultTarget
|
|
535
550
|
}
|
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.369",
|
|
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",
|