harnessed 3.6.1 → 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.6.1"};
955
+ version: "3.8.0"};
956
956
 
957
957
  // src/manifest/errors.ts
958
958
  function instancePathToKeyPath(instancePath) {
@@ -2103,63 +2103,37 @@ function checkWinBash() {
2103
2103
  }
2104
2104
  return { name: "bash flavor (win)", status: "pass", message: `${firstBash} (Git Bash / native)` };
2105
2105
  }
2106
- async function checkOriginUrl() {
2107
- const { checkOrigin: checkOrigin2 } = await Promise.resolve().then(() => (init_origin_check(), origin_check_exports));
2108
- const r = checkOrigin2(process.cwd(), { allowFork: true });
2109
- return { name: "origin URL", status: r.status, message: r.detail, fix: r.fix };
2110
- }
2111
- async function checkGstackPrefix() {
2112
- const { probeGstackPrefix: probeGstackPrefix2 } = await Promise.resolve().then(() => (init_probe_gstack(), probe_gstack_exports));
2113
- const r = probeGstackPrefix2();
2114
- return { name: "gstack prefix", status: r.status, message: r.detail, fix: r.fix };
2115
- }
2116
- async function checkDeprecations2() {
2117
- return (await Promise.resolve().then(() => (init_check_deprecations(), check_deprecations_exports))).checkDeprecations();
2118
- }
2119
- async function checkTokenBudget2() {
2120
- return (await Promise.resolve().then(() => (init_check_token_budget(), check_token_budget_exports))).checkTokenBudget();
2121
- }
2122
- async function checkAgentTeamsEnv() {
2123
- return (await Promise.resolve().then(() => (init_check_agent_teams_doctor(), check_agent_teams_doctor_exports))).checkAgentTeamsDoctor();
2124
- }
2125
- async function checkPlanningPlugin() {
2126
- return (await Promise.resolve().then(() => (init_check_planning_with_files(), check_planning_with_files_exports))).checkPlanningWithFiles();
2127
- }
2128
- async function checkMattpocockSkillsInstall() {
2129
- return (await Promise.resolve().then(() => (init_check_mattpocock_skills(), check_mattpocock_skills_exports))).checkMattpocockSkills();
2130
- }
2131
- async function checkMcpAvailabilityCheck() {
2132
- return (await Promise.resolve().then(() => (init_check_mcp_availability(), check_mcp_availability_exports))).checkMcpAvailability();
2133
- }
2106
+
2107
+ // src/cli/lib/doctor-registry.ts
2108
+ var CHECKS = [
2109
+ async () => checkNodeVersion(),
2110
+ checkMcpScope,
2111
+ async () => checkJq(),
2112
+ async () => checkWinBash(),
2113
+ async () => {
2114
+ const { checkOrigin: checkOrigin2 } = await Promise.resolve().then(() => (init_origin_check(), origin_check_exports));
2115
+ const r = checkOrigin2(process.cwd(), { allowFork: true });
2116
+ return { name: "origin URL", status: r.status, message: r.detail, fix: r.fix };
2117
+ },
2118
+ async () => {
2119
+ const { probeGstackPrefix: probeGstackPrefix2 } = await Promise.resolve().then(() => (init_probe_gstack(), probe_gstack_exports));
2120
+ const r = probeGstackPrefix2();
2121
+ return { name: "gstack prefix", status: r.status, message: r.detail, fix: r.fix };
2122
+ },
2123
+ async () => (await Promise.resolve().then(() => (init_check_deprecations(), check_deprecations_exports))).checkDeprecations(),
2124
+ async () => (await Promise.resolve().then(() => (init_check_token_budget(), check_token_budget_exports))).checkTokenBudget(),
2125
+ async () => (await Promise.resolve().then(() => (init_check_agent_teams_doctor(), check_agent_teams_doctor_exports))).checkAgentTeamsDoctor(),
2126
+ async () => (await Promise.resolve().then(() => (init_check_planning_with_files(), check_planning_with_files_exports))).checkPlanningWithFiles(),
2127
+ async () => (await Promise.resolve().then(() => (init_check_mattpocock_skills(), check_mattpocock_skills_exports))).checkMattpocockSkills(),
2128
+ async () => (await Promise.resolve().then(() => (init_check_mcp_availability(), check_mcp_availability_exports))).checkMcpAvailability()
2129
+ ];
2130
+
2131
+ // src/cli/doctor.ts
2134
2132
  function registerDoctor(program2) {
2135
2133
  program2.command("doctor").description(
2136
2134
  "Preflight checks (Node / MCP scope / jq / Win bash / origin URL / gstack prefix / deprecations / token budget / Agent Teams / planning-with-files / mattpocock-skills / MCP availability)"
2137
2135
  ).option("--json", "output JSON instead of human-readable").action(async (opts) => {
2138
- const [mcp, origin, gstack, dep, tok, at, ppwf, matt, mcpAvail] = await Promise.all([
2139
- checkMcpScope(),
2140
- checkOriginUrl(),
2141
- checkGstackPrefix(),
2142
- checkDeprecations2(),
2143
- checkTokenBudget2(),
2144
- checkAgentTeamsEnv(),
2145
- checkPlanningPlugin(),
2146
- checkMattpocockSkillsInstall(),
2147
- checkMcpAvailabilityCheck()
2148
- ]);
2149
- const results = [
2150
- checkNodeVersion(),
2151
- mcp,
2152
- checkJq(),
2153
- checkWinBash(),
2154
- origin,
2155
- gstack,
2156
- dep,
2157
- tok,
2158
- at,
2159
- ppwf,
2160
- matt,
2161
- mcpAvail
2162
- ];
2136
+ const results = await Promise.all(CHECKS.map((c) => c()));
2163
2137
  const hasFail = results.some((r) => r.status === "fail");
2164
2138
  const hasWarn = results.some((r) => r.status === "warn");
2165
2139
  if (opts.json) {
@@ -3061,8 +3035,15 @@ var WorkflowPhaseV3 = Type.Object(
3061
3035
  // numeric literal OR jinja '{{ defaults.x.y }}'
3062
3036
  ),
3063
3037
  artifacts_expected: Type.Optional(Type.Array(Type.String())),
3064
- invokes_tools: Type.Optional(Type.Array(InvokeToolClause))
3038
+ invokes_tools: Type.Optional(Type.Array(InvokeToolClause)),
3065
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()))
3066
3047
  },
3067
3048
  { additionalProperties: false }
3068
3049
  );
@@ -3337,18 +3318,24 @@ var AGENT_TEAMS_PREVENTION_RULES = `If you signal needs_teams_escalation=true, A
3337
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.
3338
3319
 
3339
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.`;
3340
- var CRITICAL_SYSTEM_REMINDER = `${ESCALATION_RULES}
3341
-
3342
- ${TRANSPARENT_SKIP_RULES}
3343
-
3344
- ${AGENT_TEAMS_PREVENTION_RULES}`;
3345
- 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) {
3346
3332
  const rp = rolePrompts?.[skillName] ?? (workflowName ? rolePrompts?.[workflowName] : void 0);
3333
+ const criticalReminder = buildCriticalReminder(injectsRules);
3347
3334
  if (!rp) {
3348
3335
  return {
3349
3336
  description: `harnessed workflow phase: ${skillName}`,
3350
3337
  prompt: `You are executing the '${skillName}' workflow phase. Follow the phase intent and emit a structured COMPLETE signal when done.`,
3351
- criticalSystemReminder_EXPERIMENTAL: CRITICAL_SYSTEM_REMINDER,
3338
+ criticalSystemReminder_EXPERIMENTAL: criticalReminder,
3352
3339
  ...modelTierOverride ? { model: modelTierOverride } : {}
3353
3340
  };
3354
3341
  }
@@ -3369,7 +3356,7 @@ ${rp.checklist.map((c, i) => ` ${i + 1}. ${c}`).join("\n")}` : "";
3369
3356
  return {
3370
3357
  description: rp.description,
3371
3358
  prompt,
3372
- criticalSystemReminder_EXPERIMENTAL: CRITICAL_SYSTEM_REMINDER,
3359
+ criticalSystemReminder_EXPERIMENTAL: criticalReminder,
3373
3360
  ...modelTierOverride ? { model: modelTierOverride } : {}
3374
3361
  };
3375
3362
  }
@@ -3399,14 +3386,23 @@ function resolveMaxIterations(phase, gateContext) {
3399
3386
  var _dispatchSkillStub = {
3400
3387
  fn: async (skillName, phase, opts) => {
3401
3388
  const optIn = isRalphLoopOptIn(phase);
3402
- const spawnOnce = async (resumeSessionId, onSessionId) => sdkSpawn(
3403
- buildAgentDef(skillName, opts?.rolePrompts, opts?.workflowName, opts?.modelTierOverride),
3404
- {
3405
- expertName: skillName,
3406
- ...resumeSessionId ? { resumeSessionId } : {},
3407
- ...onSessionId ? { onSessionId } : {}
3408
- }
3409
- );
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
+ };
3410
3406
  let envelopeJson;
3411
3407
  try {
3412
3408
  if (optIn) {
@@ -6191,6 +6187,7 @@ function registerSetup(program2) {
6191
6187
  }
6192
6188
  console.log(t("setup.bundled_summary"));
6193
6189
  console.log(t("setup.bundled_location"));
6190
+ console.log(t("setup.doctor_hint"));
6194
6191
  process.exit(0);
6195
6192
  });
6196
6193
  }