harnessed 3.7.0 → 3.8.0

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
@@ -952,7 +952,7 @@ var init_resume = __esm({
952
952
 
953
953
  // package.json
954
954
  var package_default = {
955
- version: "3.7.0"};
955
+ version: "3.8.0"};
956
956
 
957
957
  // src/manifest/errors.ts
958
958
  function instancePathToKeyPath(instancePath) {
@@ -3035,8 +3035,15 @@ var WorkflowPhaseV3 = Type.Object(
3035
3035
  // numeric literal OR jinja '{{ defaults.x.y }}'
3036
3036
  ),
3037
3037
  artifacts_expected: Type.Optional(Type.Array(Type.String())),
3038
- invokes_tools: Type.Optional(Type.Array(InvokeToolClause))
3038
+ invokes_tools: Type.Optional(Type.Array(InvokeToolClause)),
3039
3039
  // NEW v3 D-05 phase-level conditional fire
3040
+ // v3.8.0 P1 — Conditional RULES inject. Empty/absent → DEFAULT_INJECTS_RULES
3041
+ // (escalation + transparent-skip, ~470 tokens). Declare full list
3042
+ // ['escalation', 'transparent-skip', 'agent-teams-prevention'] on phases
3043
+ // that genuinely involve Agent Teams escalation (task-deliver / task-test /
3044
+ // verify-multispec). Unknown rule names silently filtered at runtime
3045
+ // (forward-compat for future RULES additions).
3046
+ injects_rules: Type.Optional(Type.Array(Type.String()))
3040
3047
  },
3041
3048
  { additionalProperties: false }
3042
3049
  );
@@ -3311,18 +3318,24 @@ var AGENT_TEAMS_PREVENTION_RULES = `If you signal needs_teams_escalation=true, A
3311
3318
  3. **Token cost estimation**: Before creating a team, estimate \`team_cost \u2248 N_teammates \xD7 N_rounds \xD7 avg_tokens_per_round + N_teammates \xD7 initial_brief_tokens\`. Compare to subagent fan-out cost (\`\u2248 N_subagents \xD7 (initial_brief + summary_tokens)\`). Only open a team when \`team_cost < 2 \xD7 subagent_cost\` \u2014 otherwise prefer fan-out.
3312
3319
 
3313
3320
  4. **Brief must be self-contained**: Each teammate launches WITHOUT main-session context. The Agent() prompt must include enough background, file paths, success criteria, and counter-positions so the teammate can work independently. Generic prompts produce shallow output.`;
3314
- var CRITICAL_SYSTEM_REMINDER = `${ESCALATION_RULES}
3315
-
3316
- ${TRANSPARENT_SKIP_RULES}
3317
-
3318
- ${AGENT_TEAMS_PREVENTION_RULES}`;
3319
- function buildAgentDef(skillName, rolePrompts, workflowName, modelTierOverride) {
3321
+ var RULES_MAP = {
3322
+ escalation: ESCALATION_RULES,
3323
+ "transparent-skip": TRANSPARENT_SKIP_RULES,
3324
+ "agent-teams-prevention": AGENT_TEAMS_PREVENTION_RULES
3325
+ };
3326
+ var DEFAULT_INJECTS_RULES = ["escalation", "transparent-skip"];
3327
+ function buildCriticalReminder(injectsRules) {
3328
+ const rules = injectsRules ?? DEFAULT_INJECTS_RULES;
3329
+ return rules.map((name) => RULES_MAP[name]).filter((rule) => rule !== void 0).join("\n\n");
3330
+ }
3331
+ function buildAgentDef(skillName, rolePrompts, workflowName, modelTierOverride, injectsRules) {
3320
3332
  const rp = rolePrompts?.[skillName] ?? (workflowName ? rolePrompts?.[workflowName] : void 0);
3333
+ const criticalReminder = buildCriticalReminder(injectsRules);
3321
3334
  if (!rp) {
3322
3335
  return {
3323
3336
  description: `harnessed workflow phase: ${skillName}`,
3324
3337
  prompt: `You are executing the '${skillName}' workflow phase. Follow the phase intent and emit a structured COMPLETE signal when done.`,
3325
- criticalSystemReminder_EXPERIMENTAL: CRITICAL_SYSTEM_REMINDER,
3338
+ criticalSystemReminder_EXPERIMENTAL: criticalReminder,
3326
3339
  ...modelTierOverride ? { model: modelTierOverride } : {}
3327
3340
  };
3328
3341
  }
@@ -3343,7 +3356,7 @@ ${rp.checklist.map((c, i) => ` ${i + 1}. ${c}`).join("\n")}` : "";
3343
3356
  return {
3344
3357
  description: rp.description,
3345
3358
  prompt,
3346
- criticalSystemReminder_EXPERIMENTAL: CRITICAL_SYSTEM_REMINDER,
3359
+ criticalSystemReminder_EXPERIMENTAL: criticalReminder,
3347
3360
  ...modelTierOverride ? { model: modelTierOverride } : {}
3348
3361
  };
3349
3362
  }
@@ -3373,14 +3386,23 @@ function resolveMaxIterations(phase, gateContext) {
3373
3386
  var _dispatchSkillStub = {
3374
3387
  fn: async (skillName, phase, opts) => {
3375
3388
  const optIn = isRalphLoopOptIn(phase);
3376
- const spawnOnce = async (resumeSessionId, onSessionId) => sdkSpawn(
3377
- buildAgentDef(skillName, opts?.rolePrompts, opts?.workflowName, opts?.modelTierOverride),
3378
- {
3379
- expertName: skillName,
3380
- ...resumeSessionId ? { resumeSessionId } : {},
3381
- ...onSessionId ? { onSessionId } : {}
3382
- }
3383
- );
3389
+ const spawnOnce = async (resumeSessionId, onSessionId) => {
3390
+ const injectsRules = phase && typeof phase === "object" && "injects_rules" in phase && Array.isArray(phase.injects_rules) ? phase.injects_rules : void 0;
3391
+ return sdkSpawn(
3392
+ buildAgentDef(
3393
+ skillName,
3394
+ opts?.rolePrompts,
3395
+ opts?.workflowName,
3396
+ opts?.modelTierOverride,
3397
+ injectsRules
3398
+ ),
3399
+ {
3400
+ expertName: skillName,
3401
+ ...resumeSessionId ? { resumeSessionId } : {},
3402
+ ...onSessionId ? { onSessionId } : {}
3403
+ }
3404
+ );
3405
+ };
3384
3406
  let envelopeJson;
3385
3407
  try {
3386
3408
  if (optIn) {
@@ -6165,6 +6187,7 @@ function registerSetup(program2) {
6165
6187
  }
6166
6188
  console.log(t("setup.bundled_summary"));
6167
6189
  console.log(t("setup.bundled_location"));
6190
+ console.log(t("setup.doctor_hint"));
6168
6191
  process.exit(0);
6169
6192
  });
6170
6193
  }