@kody-ade/kody-engine 0.4.197 → 0.4.198

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/kody.js CHANGED
@@ -1428,7 +1428,7 @@ var init_loadPriorArt = __esm({
1428
1428
  // package.json
1429
1429
  var package_default = {
1430
1430
  name: "@kody-ade/kody-engine",
1431
- version: "0.4.197",
1431
+ version: "0.4.198",
1432
1432
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
1433
1433
  license: "MIT",
1434
1434
  type: "module",
@@ -3936,13 +3936,32 @@ function loadProfile(profilePath) {
3936
3936
  // Phase 5 in-process handoff opt-in. Default false; containers
3937
3937
  // flip to true after end-to-end verification.
3938
3938
  preloadContext: r.preloadContext === true,
3939
- dir: path13.dirname(profilePath)
3939
+ dir: path13.dirname(profilePath),
3940
+ promptTemplates: readPromptTemplates(path13.dirname(profilePath))
3940
3941
  };
3941
3942
  if (lifecycle) {
3942
3943
  applyLifecycle(profile, profilePath);
3943
3944
  }
3944
3945
  return profile;
3945
3946
  }
3947
+ function readPromptTemplates(dir) {
3948
+ const out = {};
3949
+ const read = (p) => {
3950
+ try {
3951
+ out[p] = fs14.readFileSync(p, "utf-8");
3952
+ } catch {
3953
+ }
3954
+ };
3955
+ read(path13.join(dir, "prompt.md"));
3956
+ try {
3957
+ const promptsDir = path13.join(dir, "prompts");
3958
+ for (const ent of fs14.readdirSync(promptsDir)) {
3959
+ if (ent.endsWith(".md")) read(path13.join(promptsDir, ent));
3960
+ }
3961
+ } catch {
3962
+ }
3963
+ return out;
3964
+ }
3946
3965
  function validateScriptReferences(profile, registeredScripts) {
3947
3966
  const missing = [];
3948
3967
  for (const e of [...profile.scripts.preflight, ...profile.scripts.postflight]) {
@@ -6038,6 +6057,12 @@ var composePrompt = async (ctx, profile) => {
6038
6057
  let template = "";
6039
6058
  const attempts = [];
6040
6059
  for (const c of candidates) {
6060
+ const cached2 = profile.promptTemplates?.[c];
6061
+ if (cached2 !== void 0) {
6062
+ template = cached2;
6063
+ templatePath = c;
6064
+ break;
6065
+ }
6041
6066
  try {
6042
6067
  template = fs24.readFileSync(c, "utf-8");
6043
6068
  templatePath = c;
@@ -118,6 +118,15 @@ export interface Profile {
118
118
  preloadContext?: boolean
119
119
  /** Absolute directory the profile was loaded from. Used to resolve prompt.md. */
120
120
  dir: string
121
+ /**
122
+ * Prompt template files captured (by absolute path) at load time, BEFORE any
123
+ * preflight runs. composePrompt prefers these over a fresh disk read so the
124
+ * template survives working-tree churn from runFlow's branch setup — on the CI
125
+ * runner a branch checkout can drop the tracked-but-ignore-negated
126
+ * `.kody/executables/<name>/` dir, and reading prompt.md afterwards fails with
127
+ * ENOENT even though profile.json (read here, earlier) loaded fine.
128
+ */
129
+ promptTemplates?: Record<string, string>
121
130
  }
122
131
 
123
132
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.197",
3
+ "version": "0.4.198",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",