harnessed 4.1.0 → 4.1.1

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/cli.mjs CHANGED
@@ -1271,7 +1271,7 @@ var init_auto_install = __esm({
1271
1271
 
1272
1272
  // package.json
1273
1273
  var package_default = {
1274
- version: "4.1.0"};
1274
+ version: "4.1.1"};
1275
1275
 
1276
1276
  // src/manifest/errors.ts
1277
1277
  function instancePathToKeyPath(instancePath) {
@@ -6017,6 +6017,38 @@ ${lines.join("\n")}
6017
6017
  return "";
6018
6018
  }
6019
6019
  }
6020
+ async function buildDisciplinesSection(sub, packageRoot) {
6021
+ try {
6022
+ const workflowsDir = resolve(packageRoot, "workflows");
6023
+ const subYaml = await resolveWorkflowYaml(sub, workflowsDir);
6024
+ if (!subYaml) return "";
6025
+ const wfRaw = await readFile(subYaml, "utf8");
6026
+ const wf = parse(wfRaw);
6027
+ const applied = Array.isArray(wf?.disciplines_applied) ? wf.disciplines_applied : [];
6028
+ const names = applied.filter((d) => d !== "language");
6029
+ if (names.length === 0) return "";
6030
+ const blocks = [];
6031
+ for (const name of names) {
6032
+ try {
6033
+ const dRaw = await readFile(resolve(workflowsDir, "disciplines", `${name}.yaml`), "utf8");
6034
+ const dDoc = parse(dRaw);
6035
+ const rules = Array.isArray(dDoc?.rules) ? dDoc.rules : [];
6036
+ const descs = rules.map((r) => typeof r.description === "string" ? r.description.trim() : "").filter((s) => s.length > 0).map((s) => ` - ${s.replace(/\s+/g, " ")}`);
6037
+ if (descs.length > 0) blocks.push(`- **${name}**:
6038
+ ${descs.join("\n")}`);
6039
+ } catch {
6040
+ }
6041
+ }
6042
+ if (blocks.length === 0) return "";
6043
+ return `
6044
+ ## Disciplines (always-on \u2014 L0 substrate)
6045
+ Follow these behavioral disciplines while doing the work:
6046
+ ${blocks.join("\n")}
6047
+ `;
6048
+ } catch {
6049
+ return "";
6050
+ }
6051
+ }
6020
6052
  function buildLanguageSection() {
6021
6053
  const code = process.env.HARNESSED_USER_LANG;
6022
6054
  if (!code) return "";
@@ -6072,8 +6104,9 @@ ${raw.task}
6072
6104
 
6073
6105
  ` : "";
6074
6106
  const toolsSection = await buildToolsSection(sub, packageRoot);
6107
+ const disciplinesSection = await buildDisciplinesSection(sub, packageRoot);
6075
6108
  const fullPrompt = `${taskSection}${body}
6076
- ${toolsSection}${PROTOCOLS}${buildLanguageSection()}`;
6109
+ ${toolsSection}${disciplinesSection}${PROTOCOLS}${buildLanguageSection()}`;
6077
6110
  if (raw.json) {
6078
6111
  const maxIterations = await resolveMaxIterations2(sub, packageRoot);
6079
6112
  const rp = rolePrompts[sub];