@kody-ade/kody-engine 0.4.450 → 0.4.451
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 +51 -51
- 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.451",
|
|
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",
|
|
@@ -1104,7 +1104,7 @@ function cmsHeaders(opts) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
};
|
|
1106
1106
|
}
|
|
1107
|
-
async function callDashboardCms(opts,
|
|
1107
|
+
async function callDashboardCms(opts, path53, init = {}) {
|
|
1108
1108
|
const baseUrl = dashboardBaseUrl(opts);
|
|
1109
1109
|
if (!baseUrl) {
|
|
1110
1110
|
return {
|
|
@@ -1116,7 +1116,7 @@ async function callDashboardCms(opts, path54, init = {}) {
|
|
|
1116
1116
|
const headerResult = cmsHeaders(opts);
|
|
1117
1117
|
if (!headerResult.ok) return headerResult;
|
|
1118
1118
|
try {
|
|
1119
|
-
const res = await fetch(`${baseUrl}${
|
|
1119
|
+
const res = await fetch(`${baseUrl}${path53}`, {
|
|
1120
1120
|
...init,
|
|
1121
1121
|
headers: {
|
|
1122
1122
|
...headerResult.headers,
|
|
@@ -1188,8 +1188,8 @@ function documentArg(value) {
|
|
|
1188
1188
|
function normalizeCmsDocumentIdInput(input) {
|
|
1189
1189
|
const trimmed = stripWrappingQuotes(input.trim());
|
|
1190
1190
|
const withoutQuery = trimmed.split(/[?#]/, 1)[0] ?? trimmed;
|
|
1191
|
-
const
|
|
1192
|
-
return
|
|
1191
|
+
const path53 = parseDocumentPath(withoutQuery);
|
|
1192
|
+
return path53 ?? parseDocumentIdSegment(withoutQuery) ?? withoutQuery;
|
|
1193
1193
|
}
|
|
1194
1194
|
function stripWrappingQuotes(value) {
|
|
1195
1195
|
let current = value;
|
|
@@ -1200,9 +1200,9 @@ function stripWrappingQuotes(value) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
function parseDocumentPath(value) {
|
|
1203
|
-
const
|
|
1204
|
-
if (!
|
|
1205
|
-
const parts =
|
|
1203
|
+
const path53 = value.startsWith("http://") || value.startsWith("https://") ? urlPathname(value) : value;
|
|
1204
|
+
if (!path53?.includes("/content/entries/")) return null;
|
|
1205
|
+
const parts = path53.split("/").filter(Boolean).map(decodePathPart);
|
|
1206
1206
|
const entriesIndex = parts.findIndex((part, index) => part === "content" && parts[index + 1] === "entries");
|
|
1207
1207
|
const idPart = parts[entriesIndex + 3];
|
|
1208
1208
|
if (!idPart || idPart === "new") return null;
|
|
@@ -8097,9 +8097,9 @@ import * as fs27 from "fs";
|
|
|
8097
8097
|
function stageGoalRunLogEvent(data, goalId, event, at = nowIso()) {
|
|
8098
8098
|
const logs = goalRunLogs(data);
|
|
8099
8099
|
const existing = logs[goalId];
|
|
8100
|
-
const
|
|
8100
|
+
const path53 = existing?.path ?? goalRunLogPath(goalId, data);
|
|
8101
8101
|
logs[goalId] = {
|
|
8102
|
-
path:
|
|
8102
|
+
path: path53,
|
|
8103
8103
|
events: [...existing?.events ?? [], buildGoalRunLogEvent(data, goalId, event, at)]
|
|
8104
8104
|
};
|
|
8105
8105
|
}
|
|
@@ -9050,11 +9050,11 @@ function validateWorkflow(value, options = {}) {
|
|
|
9050
9050
|
function formatWorkflowValidationIssues(issues) {
|
|
9051
9051
|
return issues.map((entry) => `${entry.path}: ${entry.message}`);
|
|
9052
9052
|
}
|
|
9053
|
-
function validateDataMatch(value,
|
|
9053
|
+
function validateDataMatch(value, path53, issues, capabilityOutputs) {
|
|
9054
9054
|
if (value === void 0) return;
|
|
9055
9055
|
const match = asRecord2(value);
|
|
9056
9056
|
if (!match || Object.keys(match).length === 0) {
|
|
9057
|
-
issue(issues, "invalid_condition",
|
|
9057
|
+
issue(issues, "invalid_condition", path53, "workflow condition must contain at least one match");
|
|
9058
9058
|
return;
|
|
9059
9059
|
}
|
|
9060
9060
|
for (const [field, expected] of Object.entries(match)) {
|
|
@@ -9062,7 +9062,7 @@ function validateDataMatch(value, path54, issues, capabilityOutputs) {
|
|
|
9062
9062
|
issue(
|
|
9063
9063
|
issues,
|
|
9064
9064
|
"invalid_data_path",
|
|
9065
|
-
`${
|
|
9065
|
+
`${path53}.${field}`,
|
|
9066
9066
|
`workflow condition must read from facts, evidence, artifacts, result, workflow, or lastOutcome`
|
|
9067
9067
|
);
|
|
9068
9068
|
}
|
|
@@ -9070,12 +9070,12 @@ function validateDataMatch(value, path54, issues, capabilityOutputs) {
|
|
|
9070
9070
|
issue(
|
|
9071
9071
|
issues,
|
|
9072
9072
|
"undeclared_result_path",
|
|
9073
|
-
`${
|
|
9073
|
+
`${path53}.${field}`,
|
|
9074
9074
|
`workflow condition reads ${field}, but the source capability does not declare it`
|
|
9075
9075
|
);
|
|
9076
9076
|
}
|
|
9077
9077
|
if (!isComparable(expected)) {
|
|
9078
|
-
issue(issues, "invalid_condition_value", `${
|
|
9078
|
+
issue(issues, "invalid_condition_value", `${path53}.${field}`, "workflow condition value must be a JSON scalar");
|
|
9079
9079
|
}
|
|
9080
9080
|
}
|
|
9081
9081
|
}
|
|
@@ -9099,8 +9099,8 @@ function isJsonValue(value) {
|
|
|
9099
9099
|
if (!value || typeof value !== "object") return false;
|
|
9100
9100
|
return Object.values(value).every(isJsonValue);
|
|
9101
9101
|
}
|
|
9102
|
-
function issue(issues, code,
|
|
9103
|
-
issues.push({ code, path:
|
|
9102
|
+
function issue(issues, code, path53, message) {
|
|
9103
|
+
issues.push({ code, path: path53, message });
|
|
9104
9104
|
}
|
|
9105
9105
|
var SAFE_NAME, SAFE_STEP_ID, SAFE_DATA_PATH, SUPPORTED_STEP_FIELDS, SUPPORTED_TRANSITION_FIELDS;
|
|
9106
9106
|
var init_workflowValidation = __esm({
|
|
@@ -9365,15 +9365,15 @@ var init_backendStateBackend = __esm({
|
|
|
9365
9365
|
this.jobsDir = opts.jobsDir.replace(/\/+$/, "");
|
|
9366
9366
|
}
|
|
9367
9367
|
async load(slug) {
|
|
9368
|
-
const
|
|
9368
|
+
const path53 = stateFilePath(this.jobsDir, slug);
|
|
9369
9369
|
const loaded = await createStateBackendFromEnv().get(this.tenantId, `capabilities/${slug}`, "job-state");
|
|
9370
9370
|
if (!loaded) {
|
|
9371
|
-
return { path:
|
|
9371
|
+
return { path: path53, handle: null, state: initialStateEnvelope("seed"), created: true };
|
|
9372
9372
|
}
|
|
9373
9373
|
if (!isStateEnvelope(loaded.doc)) {
|
|
9374
9374
|
throw new Error(`BackendStateBackend: capabilities/${slug} is not a StateEnvelope`);
|
|
9375
9375
|
}
|
|
9376
|
-
return { path:
|
|
9376
|
+
return { path: path53, handle: loaded.updatedAt, state: loaded.doc, created: false };
|
|
9377
9377
|
}
|
|
9378
9378
|
async save(loaded, next) {
|
|
9379
9379
|
if (!loaded.created && isStateUnchanged(loaded.state, next)) return false;
|
|
@@ -15542,13 +15542,13 @@ var init_loadSimpleCapability = __esm({
|
|
|
15542
15542
|
function isCompanyIntentId(value) {
|
|
15543
15543
|
return SLUG_RE2.test(value);
|
|
15544
15544
|
}
|
|
15545
|
-
function normalizeCompanyIntent(
|
|
15545
|
+
function normalizeCompanyIntent(path53, raw) {
|
|
15546
15546
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
15547
|
-
throw new Error(`${
|
|
15547
|
+
throw new Error(`${path53}: intent must be JSON object`);
|
|
15548
15548
|
}
|
|
15549
15549
|
const input = raw;
|
|
15550
15550
|
const id = stringField4(input.id);
|
|
15551
|
-
if (!id || !isCompanyIntentId(id)) throw new Error(`${
|
|
15551
|
+
if (!id || !isCompanyIntentId(id)) throw new Error(`${path53}: invalid intent id`);
|
|
15552
15552
|
const createdAt = stringField4(input.createdAt) || nowIso();
|
|
15553
15553
|
const updatedAt = stringField4(input.updatedAt) || createdAt;
|
|
15554
15554
|
const description = stringField4(input.description);
|
|
@@ -16695,19 +16695,19 @@ function parseAgencyModelProposal(raw) {
|
|
|
16695
16695
|
function normalizeBundleFiles(bundle) {
|
|
16696
16696
|
const seen = /* @__PURE__ */ new Set();
|
|
16697
16697
|
return bundle.files.map((file, index) => {
|
|
16698
|
-
const
|
|
16699
|
-
const parts =
|
|
16700
|
-
if (!
|
|
16698
|
+
const path53 = file.path.replace(/^\/+/, "");
|
|
16699
|
+
const parts = path53.split("/");
|
|
16700
|
+
if (!path53 || file.path.startsWith("/") || file.path.includes("\\") || parts.some((part) => !part || part === "." || part === "..")) {
|
|
16701
16701
|
throw new Error(`openAgencyModelReviewPr: files[${index}].path is unsafe`);
|
|
16702
16702
|
}
|
|
16703
16703
|
if (!/^(agents\/[^/]+\.md|capabilities\/[^/]+\/.+|goals\/(?:templates\/)?[^/]+\/.+|workflows\/[^/]+\.json)$/.test(
|
|
16704
|
-
|
|
16704
|
+
path53
|
|
16705
16705
|
)) {
|
|
16706
16706
|
throw new Error(`openAgencyModelReviewPr: files[${index}].path is not a supported definition path`);
|
|
16707
16707
|
}
|
|
16708
|
-
if (seen.has(
|
|
16709
|
-
seen.add(
|
|
16710
|
-
return { path:
|
|
16708
|
+
if (seen.has(path53)) throw new Error(`openAgencyModelReviewPr: duplicate generated file path: ${path53}`);
|
|
16709
|
+
seen.add(path53);
|
|
16710
|
+
return { path: path53, content: file.content.replace(/\r\n?/g, "\n") };
|
|
16711
16711
|
});
|
|
16712
16712
|
}
|
|
16713
16713
|
function buildProposalId(issueNumber, bundle, sourceLabel) {
|
|
@@ -17994,9 +17994,9 @@ function latestResult(raw, agentResult) {
|
|
|
17994
17994
|
function recordField4(value) {
|
|
17995
17995
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
17996
17996
|
}
|
|
17997
|
-
function resolveDotted(root,
|
|
17998
|
-
if (!
|
|
17999
|
-
return
|
|
17997
|
+
function resolveDotted(root, path53) {
|
|
17998
|
+
if (!path53) return void 0;
|
|
17999
|
+
return path53.split(".").reduce((value, key) => recordField4(value)?.[key], root);
|
|
18000
18000
|
}
|
|
18001
18001
|
function stringValue5(value) {
|
|
18002
18002
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
@@ -22264,7 +22264,6 @@ __export(job_exports, {
|
|
|
22264
22264
|
stableJobKey: () => stableJobKey,
|
|
22265
22265
|
validateJob: () => validateJob
|
|
22266
22266
|
});
|
|
22267
|
-
import * as path49 from "path";
|
|
22268
22267
|
function newJobId(flavor) {
|
|
22269
22268
|
localJobSeq += 1;
|
|
22270
22269
|
const runId = process.env.GITHUB_RUN_ID;
|
|
@@ -22784,11 +22783,11 @@ function selectWorkflowTransition(step, data, counts) {
|
|
|
22784
22783
|
}
|
|
22785
22784
|
function workflowResultConditionPaths(transitions) {
|
|
22786
22785
|
return transitions.flatMap(
|
|
22787
|
-
(transition) => Object.keys(transition.when ?? {}).filter((
|
|
22786
|
+
(transition) => Object.keys(transition.when ?? {}).filter((path53) => path53.startsWith("result."))
|
|
22788
22787
|
);
|
|
22789
22788
|
}
|
|
22790
22789
|
function conditionMatches(condition, context) {
|
|
22791
|
-
return Object.entries(condition).every(([
|
|
22790
|
+
return Object.entries(condition).every(([path53, expected]) => valueMatches(resolveDottedPath2(context, path53), expected));
|
|
22792
22791
|
}
|
|
22793
22792
|
function withWorkflowBoundaryEval(capability, result) {
|
|
22794
22793
|
const capabilityKind = capability.config.capabilityKind;
|
|
@@ -22972,7 +22971,7 @@ function loadCapabilityContext(slug, cwd) {
|
|
|
22972
22971
|
return resolveCapabilityFolder(slug, hydratedCapabilitiesRoot(cwd));
|
|
22973
22972
|
}
|
|
22974
22973
|
function hydratedCapabilitiesRoot(cwd) {
|
|
22975
|
-
return
|
|
22974
|
+
return capabilitiesRoot(cwd);
|
|
22976
22975
|
}
|
|
22977
22976
|
function loadWorkflowContext(slug, base) {
|
|
22978
22977
|
if (!slug || !isWorkflowDefinitionId(slug)) return null;
|
|
@@ -23010,6 +23009,7 @@ var init_job = __esm({
|
|
|
23010
23009
|
"use strict";
|
|
23011
23010
|
init_agencyBoundaryEval();
|
|
23012
23011
|
init_capabilityFolders();
|
|
23012
|
+
init_definition_paths();
|
|
23013
23013
|
init_executor();
|
|
23014
23014
|
init_registry();
|
|
23015
23015
|
init_runIndex();
|
|
@@ -23138,7 +23138,7 @@ function translateOpenAISseToBrain(opts) {
|
|
|
23138
23138
|
|
|
23139
23139
|
// src/servers/brain-serve.ts
|
|
23140
23140
|
import { createServer as createServer2 } from "http";
|
|
23141
|
-
import * as
|
|
23141
|
+
import * as path51 from "path";
|
|
23142
23142
|
|
|
23143
23143
|
// src/chat/loop.ts
|
|
23144
23144
|
init_agent();
|
|
@@ -24313,7 +24313,7 @@ async function hydrateDefinitionsFromEnv(cwd = process.cwd(), env = process.env)
|
|
|
24313
24313
|
// src/kody-cli.ts
|
|
24314
24314
|
import { execFileSync as execFileSync24 } from "child_process";
|
|
24315
24315
|
import * as fs51 from "fs";
|
|
24316
|
-
import * as
|
|
24316
|
+
import * as path49 from "path";
|
|
24317
24317
|
|
|
24318
24318
|
// src/app-auth.ts
|
|
24319
24319
|
import { createSign } from "crypto";
|
|
@@ -25127,9 +25127,9 @@ async function resolveAuthToken(env = process.env) {
|
|
|
25127
25127
|
return void 0;
|
|
25128
25128
|
}
|
|
25129
25129
|
function detectPackageManager2(cwd) {
|
|
25130
|
-
if (fs51.existsSync(
|
|
25131
|
-
if (fs51.existsSync(
|
|
25132
|
-
if (fs51.existsSync(
|
|
25130
|
+
if (fs51.existsSync(path49.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
25131
|
+
if (fs51.existsSync(path49.join(cwd, "yarn.lock"))) return "yarn";
|
|
25132
|
+
if (fs51.existsSync(path49.join(cwd, "bun.lockb"))) return "bun";
|
|
25133
25133
|
return "npm";
|
|
25134
25134
|
}
|
|
25135
25135
|
function shouldChainScheduledWatch(match) {
|
|
@@ -25252,7 +25252,7 @@ async function runCi(argv) {
|
|
|
25252
25252
|
return 0;
|
|
25253
25253
|
}
|
|
25254
25254
|
const args = parseCiArgs(argv);
|
|
25255
|
-
const cwd = args.cwd ?
|
|
25255
|
+
const cwd = args.cwd ? path49.resolve(args.cwd) : process.cwd();
|
|
25256
25256
|
try {
|
|
25257
25257
|
const n = unpackAllSecrets();
|
|
25258
25258
|
if (n > 0) process.stdout.write(`\u2192 kody: unpacked ${n} secret(s) from ALL_SECRETS
|
|
@@ -25724,7 +25724,7 @@ init_repoWorkspace();
|
|
|
25724
25724
|
// src/scripts/brainTurnLog.ts
|
|
25725
25725
|
init_runtimePaths();
|
|
25726
25726
|
import * as fs52 from "fs";
|
|
25727
|
-
import * as
|
|
25727
|
+
import * as path50 from "path";
|
|
25728
25728
|
import posixPath4 from "path/posix";
|
|
25729
25729
|
var live = /* @__PURE__ */ new Map();
|
|
25730
25730
|
function brainEventsFilePath(dir, chatId) {
|
|
@@ -25771,7 +25771,7 @@ function beginTurn(dir, chatId) {
|
|
|
25771
25771
|
};
|
|
25772
25772
|
live.set(chatId, state);
|
|
25773
25773
|
const p = brainEventsFilePath(dir, chatId);
|
|
25774
|
-
fs52.mkdirSync(
|
|
25774
|
+
fs52.mkdirSync(path50.dirname(p), { recursive: true });
|
|
25775
25775
|
return (event) => {
|
|
25776
25776
|
state.seq += 1;
|
|
25777
25777
|
const rec = { seq: state.seq, turn, ts: Date.now(), event };
|
|
@@ -26208,7 +26208,7 @@ function buildServer(opts) {
|
|
|
26208
26208
|
const runTurn = opts.runTurn ?? runChatTurn;
|
|
26209
26209
|
const createStore = opts.createStore ?? createSessionStore;
|
|
26210
26210
|
const cloneRepo = opts.cloneRepo ?? defaultCloneRepo;
|
|
26211
|
-
const reposRoot = opts.reposRoot ??
|
|
26211
|
+
const reposRoot = opts.reposRoot ?? path51.join(path51.dirname(path51.resolve(opts.cwd)), "repos");
|
|
26212
26212
|
return createServer2(async (req, res) => {
|
|
26213
26213
|
if (!req.method || !req.url) {
|
|
26214
26214
|
sendJson(res, 400, { error: "bad request" });
|
|
@@ -26812,7 +26812,7 @@ async function loadConfigSafe() {
|
|
|
26812
26812
|
}
|
|
26813
26813
|
|
|
26814
26814
|
// src/chat-cli.ts
|
|
26815
|
-
import * as
|
|
26815
|
+
import * as path52 from "path";
|
|
26816
26816
|
|
|
26817
26817
|
// src/chat/inbox.ts
|
|
26818
26818
|
import { execFileSync as execFileSync25 } from "child_process";
|
|
@@ -27093,7 +27093,7 @@ async function runChat(argv) {
|
|
|
27093
27093
|
${CHAT_HELP}`);
|
|
27094
27094
|
return 64;
|
|
27095
27095
|
}
|
|
27096
|
-
const cwd = args.cwd ?
|
|
27096
|
+
const cwd = args.cwd ? path52.resolve(args.cwd) : process.cwd();
|
|
27097
27097
|
const sessionId = args.sessionId;
|
|
27098
27098
|
const runRequest = readRunRequestFromEnv();
|
|
27099
27099
|
if (runRequest && "request" in runRequest) {
|
|
@@ -27283,8 +27283,8 @@ var FlyClient = class {
|
|
|
27283
27283
|
get fetch() {
|
|
27284
27284
|
return this.opts.fetchImpl ?? fetch;
|
|
27285
27285
|
}
|
|
27286
|
-
async call(
|
|
27287
|
-
const res = await this.fetch(`${FLY_API_BASE}${
|
|
27286
|
+
async call(path53, init = {}) {
|
|
27287
|
+
const res = await this.fetch(`${FLY_API_BASE}${path53}`, {
|
|
27288
27288
|
method: init.method ?? "GET",
|
|
27289
27289
|
headers: {
|
|
27290
27290
|
Authorization: `Bearer ${this.opts.token}`,
|
|
@@ -27295,7 +27295,7 @@ var FlyClient = class {
|
|
|
27295
27295
|
if (res.status === 404 && init.allow404) return null;
|
|
27296
27296
|
if (!res.ok) {
|
|
27297
27297
|
const text2 = await res.text().catch(() => "");
|
|
27298
|
-
throw new Error(`Fly API ${res.status} on ${
|
|
27298
|
+
throw new Error(`Fly API ${res.status} on ${path53}: ${text2.slice(0, 200) || res.statusText}`);
|
|
27299
27299
|
}
|
|
27300
27300
|
if (res.status === 204) return null;
|
|
27301
27301
|
const raw = await res.text();
|
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.451",
|
|
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",
|