@a5c-ai/babysitter-sdk 0.0.183 → 0.0.184-staging.347227ea

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.
Files changed (188) hide show
  1. package/dist/cli/commands/harnessCreateRun.js +1 -1
  2. package/dist/cli/commands/harnessPhase1.d.ts +4 -2
  3. package/dist/cli/commands/harnessPhase1.d.ts.map +1 -1
  4. package/dist/cli/commands/harnessPhase1.js +112 -52
  5. package/dist/cli/commands/harnessPhase2.d.ts +6 -0
  6. package/dist/cli/commands/harnessPhase2.d.ts.map +1 -1
  7. package/dist/cli/commands/harnessPhase2.js +93 -30
  8. package/dist/cli/commands/harnessPrompts.d.ts +3 -3
  9. package/dist/cli/commands/harnessPrompts.d.ts.map +1 -1
  10. package/dist/cli/commands/harnessPrompts.js +48 -42
  11. package/dist/cli/commands/harnessUtils.d.ts +3 -1
  12. package/dist/cli/commands/harnessUtils.d.ts.map +1 -1
  13. package/dist/cli/commands/harnessUtils.js +34 -15
  14. package/dist/cli/commands/hookRun.d.ts.map +1 -1
  15. package/dist/cli/commands/hookRun.js +32 -4
  16. package/dist/cli/commands/instructions.d.ts +19 -0
  17. package/dist/cli/commands/instructions.d.ts.map +1 -0
  18. package/dist/cli/commands/instructions.js +158 -0
  19. package/dist/cli/commands/log.d.ts +22 -0
  20. package/dist/cli/commands/log.d.ts.map +1 -0
  21. package/dist/cli/commands/log.js +99 -0
  22. package/dist/cli/commands/session.d.ts +1 -0
  23. package/dist/cli/commands/session.d.ts.map +1 -1
  24. package/dist/cli/commands/session.js +50 -10
  25. package/dist/cli/commands/templates/process-generation-prompt.md +80 -3
  26. package/dist/cli/main.d.ts.map +1 -1
  27. package/dist/cli/main.js +145 -77
  28. package/dist/harness/claudeCode.d.ts.map +1 -1
  29. package/dist/harness/claudeCode.js +4 -0
  30. package/dist/harness/codex.d.ts.map +1 -1
  31. package/dist/harness/codex.js +4 -0
  32. package/dist/harness/cursor.d.ts +35 -0
  33. package/dist/harness/cursor.d.ts.map +1 -0
  34. package/dist/harness/cursor.js +799 -0
  35. package/dist/harness/discovery.d.ts.map +1 -1
  36. package/dist/harness/discovery.js +14 -2
  37. package/dist/harness/githubCopilot.d.ts +35 -0
  38. package/dist/harness/githubCopilot.d.ts.map +1 -0
  39. package/dist/harness/githubCopilot.js +629 -0
  40. package/dist/harness/index.d.ts +2 -0
  41. package/dist/harness/index.d.ts.map +1 -1
  42. package/dist/harness/index.js +5 -1
  43. package/dist/harness/invoker.d.ts.map +1 -1
  44. package/dist/harness/invoker.js +2 -1
  45. package/dist/harness/pi.d.ts.map +1 -1
  46. package/dist/harness/pi.js +4 -0
  47. package/dist/harness/piWrapper.js +1 -1
  48. package/dist/harness/registry.d.ts.map +1 -1
  49. package/dist/harness/registry.js +4 -0
  50. package/dist/harness/types.d.ts +8 -0
  51. package/dist/harness/types.d.ts.map +1 -1
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +2 -0
  55. package/dist/interaction/askUserQuestion.d.ts +1 -0
  56. package/dist/interaction/askUserQuestion.d.ts.map +1 -1
  57. package/dist/interaction/askUserQuestion.js +103 -93
  58. package/dist/logging/index.d.ts +3 -0
  59. package/dist/logging/index.d.ts.map +1 -0
  60. package/dist/logging/index.js +11 -0
  61. package/dist/logging/runLogger.d.ts +83 -0
  62. package/dist/logging/runLogger.d.ts.map +1 -0
  63. package/dist/logging/runLogger.js +177 -0
  64. package/dist/mcp/tools/runs.d.ts.map +1 -1
  65. package/dist/mcp/tools/runs.js +2 -0
  66. package/dist/prompts/compose.d.ts +28 -0
  67. package/dist/prompts/compose.d.ts.map +1 -0
  68. package/dist/prompts/compose.js +165 -0
  69. package/dist/prompts/context.d.ts +27 -0
  70. package/dist/prompts/context.d.ts.map +1 -0
  71. package/dist/prompts/context.js +198 -0
  72. package/dist/prompts/index.d.ts +11 -0
  73. package/dist/prompts/index.d.ts.map +1 -0
  74. package/dist/prompts/index.js +47 -0
  75. package/dist/prompts/parts/breakpointHandling.d.ts +8 -0
  76. package/dist/prompts/parts/breakpointHandling.d.ts.map +1 -0
  77. package/dist/prompts/parts/breakpointHandling.js +12 -0
  78. package/dist/prompts/parts/completionProof.d.ts +6 -0
  79. package/dist/prompts/parts/completionProof.d.ts.map +1 -0
  80. package/dist/prompts/parts/completionProof.js +10 -0
  81. package/dist/prompts/parts/criticalRules.d.ts +7 -0
  82. package/dist/prompts/parts/criticalRules.d.ts.map +1 -0
  83. package/dist/prompts/parts/criticalRules.js +16 -0
  84. package/dist/prompts/parts/dependencies.d.ts +6 -0
  85. package/dist/prompts/parts/dependencies.d.ts.map +1 -0
  86. package/dist/prompts/parts/dependencies.js +10 -0
  87. package/dist/prompts/parts/effects.d.ts +6 -0
  88. package/dist/prompts/parts/effects.d.ts.map +1 -0
  89. package/dist/prompts/parts/effects.js +10 -0
  90. package/dist/prompts/parts/index.d.ts +26 -0
  91. package/dist/prompts/parts/index.d.ts.map +1 -0
  92. package/dist/prompts/parts/index.js +48 -0
  93. package/dist/prompts/parts/intentFidelityChecks.d.ts +7 -0
  94. package/dist/prompts/parts/intentFidelityChecks.d.ts.map +1 -0
  95. package/dist/prompts/parts/intentFidelityChecks.js +14 -0
  96. package/dist/prompts/parts/interview.d.ts +6 -0
  97. package/dist/prompts/parts/interview.d.ts.map +1 -0
  98. package/dist/prompts/parts/interview.js +18 -0
  99. package/dist/prompts/parts/iteration.d.ts +6 -0
  100. package/dist/prompts/parts/iteration.d.ts.map +1 -0
  101. package/dist/prompts/parts/iteration.js +15 -0
  102. package/dist/prompts/parts/loopControl.d.ts +11 -0
  103. package/dist/prompts/parts/loopControl.d.ts.map +1 -0
  104. package/dist/prompts/parts/loopControl.js +22 -0
  105. package/dist/prompts/parts/nonNegotiables.d.ts +7 -0
  106. package/dist/prompts/parts/nonNegotiables.d.ts.map +1 -0
  107. package/dist/prompts/parts/nonNegotiables.js +14 -0
  108. package/dist/prompts/parts/processCreation.d.ts +6 -0
  109. package/dist/prompts/parts/processCreation.d.ts.map +1 -0
  110. package/dist/prompts/parts/processCreation.js +24 -0
  111. package/dist/prompts/parts/processGuidelines.d.ts +7 -0
  112. package/dist/prompts/parts/processGuidelines.d.ts.map +1 -0
  113. package/dist/prompts/parts/processGuidelines.js +11 -0
  114. package/dist/prompts/parts/quickReference.d.ts +6 -0
  115. package/dist/prompts/parts/quickReference.d.ts.map +1 -0
  116. package/dist/prompts/parts/quickReference.js +17 -0
  117. package/dist/prompts/parts/recovery.d.ts +7 -0
  118. package/dist/prompts/parts/recovery.d.ts.map +1 -0
  119. package/dist/prompts/parts/recovery.js +11 -0
  120. package/dist/prompts/parts/resultsPosting.d.ts +7 -0
  121. package/dist/prompts/parts/resultsPosting.d.ts.map +1 -0
  122. package/dist/prompts/parts/resultsPosting.js +11 -0
  123. package/dist/prompts/parts/runCreation.d.ts +7 -0
  124. package/dist/prompts/parts/runCreation.d.ts.map +1 -0
  125. package/dist/prompts/parts/runCreation.js +53 -0
  126. package/dist/prompts/parts/seeAlso.d.ts +7 -0
  127. package/dist/prompts/parts/seeAlso.d.ts.map +1 -0
  128. package/dist/prompts/parts/seeAlso.js +11 -0
  129. package/dist/prompts/parts/taskExamples.d.ts +7 -0
  130. package/dist/prompts/parts/taskExamples.d.ts.map +1 -0
  131. package/dist/prompts/parts/taskExamples.js +11 -0
  132. package/dist/prompts/parts/taskKinds.d.ts +6 -0
  133. package/dist/prompts/parts/taskKinds.d.ts.map +1 -0
  134. package/dist/prompts/parts/taskKinds.js +17 -0
  135. package/dist/prompts/parts/userProfile.d.ts +7 -0
  136. package/dist/prompts/parts/userProfile.d.ts.map +1 -0
  137. package/dist/prompts/parts/userProfile.js +11 -0
  138. package/dist/prompts/templateRenderer.d.ts +18 -0
  139. package/dist/prompts/templateRenderer.d.ts.map +1 -0
  140. package/dist/prompts/templateRenderer.js +131 -0
  141. package/dist/prompts/templates/breakpoint-handling.md +101 -0
  142. package/dist/prompts/templates/completion-proof.md +13 -0
  143. package/dist/prompts/templates/critical-rules.md +57 -0
  144. package/dist/prompts/templates/dependencies.md +9 -0
  145. package/dist/prompts/templates/effects.md +42 -0
  146. package/dist/prompts/templates/intent-fidelity-checks.md +14 -0
  147. package/dist/prompts/templates/interview.md +65 -0
  148. package/dist/prompts/templates/iteration.md +41 -0
  149. package/dist/prompts/templates/loop-control.md +54 -0
  150. package/dist/prompts/templates/non-negotiables.md +11 -0
  151. package/dist/prompts/templates/process-creation.md +61 -0
  152. package/dist/prompts/templates/process-guidelines.md +88 -0
  153. package/dist/prompts/templates/quick-reference.md +35 -0
  154. package/dist/prompts/templates/recovery.md +20 -0
  155. package/dist/prompts/templates/results-posting.md +69 -0
  156. package/dist/prompts/templates/run-creation.md +36 -0
  157. package/dist/prompts/templates/see-also.md +4 -0
  158. package/dist/prompts/templates/task-examples.md +76 -0
  159. package/dist/prompts/templates/task-kinds.md +60 -0
  160. package/dist/prompts/templates/user-profile.md +48 -0
  161. package/dist/prompts/types.d.ts +105 -0
  162. package/dist/prompts/types.d.ts.map +1 -0
  163. package/dist/prompts/types.js +7 -0
  164. package/dist/runtime/commitEffectResult.js +3 -0
  165. package/dist/runtime/intrinsics/breakpoint.d.ts +2 -2
  166. package/dist/runtime/intrinsics/breakpoint.d.ts.map +1 -1
  167. package/dist/runtime/intrinsics/breakpoint.js +25 -1
  168. package/dist/runtime/intrinsics/parallel.d.ts.map +1 -1
  169. package/dist/runtime/intrinsics/parallel.js +9 -0
  170. package/dist/runtime/intrinsics/task.js +1 -1
  171. package/dist/runtime/processContext.d.ts +14 -0
  172. package/dist/runtime/processContext.d.ts.map +1 -1
  173. package/dist/runtime/processContext.js +91 -5
  174. package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -1
  175. package/dist/runtime/replay/createReplayEngine.js +82 -1
  176. package/dist/runtime/replay/effectIndex.d.ts +3 -1
  177. package/dist/runtime/replay/effectIndex.d.ts.map +1 -1
  178. package/dist/runtime/replay/effectIndex.js +9 -2
  179. package/dist/runtime/types.d.ts +20 -1
  180. package/dist/runtime/types.d.ts.map +1 -1
  181. package/dist/storage/lock.d.ts.map +1 -1
  182. package/dist/storage/lock.js +11 -0
  183. package/dist/tasks/types.d.ts +9 -0
  184. package/dist/tasks/types.d.ts.map +1 -1
  185. package/package.json +2 -2
  186. package/dist/cli/commands/runExecuteTasks.d.ts +0 -42
  187. package/dist/cli/commands/runExecuteTasks.d.ts.map +0 -1
  188. package/dist/cli/commands/runExecuteTasks.js +0 -377
@@ -68,7 +68,7 @@ async function handleHarnessCreateRun(parsed) {
68
68
  const workDir = workspace ?? process.cwd();
69
69
  processPath = await (0, harnessPhase1_1.runProcessDefinitionPhase)({
70
70
  prompt: prompt,
71
- outputPath: (0, harnessPhase1_1.getGeneratedProcessPath)(workDir),
71
+ outputDir: (0, harnessPhase1_1.getProcessOutputDir)(workDir),
72
72
  workspace: workDir,
73
73
  model,
74
74
  interactive,
@@ -6,6 +6,8 @@
6
6
  */
7
7
  import * as readline from "node:readline";
8
8
  import { type ExternalWorkspaceAssessment, type CompressionConfig, type HarnessPromptContext as SessionCreatePromptContext } from "./harnessUtils";
9
+ export declare function getProcessOutputDir(workDir: string): string;
10
+ /** @deprecated Use getProcessOutputDir instead */
9
11
  export declare function getGeneratedProcessPath(workDir: string): string;
10
12
  export declare function execShellEffect(command: string, args: string[], cwd?: string): Promise<{
11
13
  stdout: string;
@@ -18,7 +20,7 @@ export declare function extractJsonObjectFromText(text: string): string | null;
18
20
  export declare function coerceAgentResultValue(taskDef: Record<string, unknown>, output: string): unknown;
19
21
  export declare function buildExternalProcessDefinitionPrompt(args: {
20
22
  prompt: string;
21
- outputPath: string;
23
+ outputDir: string;
22
24
  workspace?: string;
23
25
  promptContext: SessionCreatePromptContext;
24
26
  workspaceAssessment: ExternalWorkspaceAssessment;
@@ -29,7 +31,7 @@ export declare function buildExternalProcessConformancePrompt(args: {
29
31
  }): string;
30
32
  export declare function runProcessDefinitionPhase(args: {
31
33
  prompt: string;
32
- outputPath: string;
34
+ outputDir: string;
33
35
  workspace?: string;
34
36
  model?: string;
35
37
  interactive: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"harnessPhase1.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPhase1.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAa1C,OAAO,EAIL,KAAK,2BAA2B,EAEhC,KAAK,iBAAiB,EAGtB,KAAK,oBAAoB,IAAI,0BAA0B,EAwBxD,MAAM,gBAAgB,CAAC;AAkBxB,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAyHD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAyB/D;AAg5BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAmDzE;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAU/F;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBrE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAwBhG;AAwGD,wBAAgB,oCAAoC,CAAC,IAAI,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,0BAA0B,CAAC;IAC1C,mBAAmB,E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AAmB,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,MAAM,CAAC,CAmjBlB"}
@@ -39,6 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
39
39
  };
40
40
  })();
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.getProcessOutputDir = getProcessOutputDir;
42
43
  exports.getGeneratedProcessPath = getGeneratedProcessPath;
43
44
  exports.execShellEffect = execShellEffect;
44
45
  exports.buildAgentPrompt = buildAgentPrompt;
@@ -70,8 +71,12 @@ const dynamicImportModule = (() => {
70
71
  return new Function("specifier", "return import(specifier);");
71
72
  })();
72
73
  // ── Process File Utilities ───────────────────────────────────────────
74
+ function getProcessOutputDir(workDir) {
75
+ return path.join(workDir, ".a5c", "processes");
76
+ }
77
+ /** @deprecated Use getProcessOutputDir instead */
73
78
  function getGeneratedProcessPath(workDir) {
74
- return path.join(workDir, "generated-process.mjs");
79
+ return getProcessOutputDir(workDir);
75
80
  }
76
81
  function looksLikeProcessDefinitionSource(source) {
77
82
  const normalized = source.trim();
@@ -111,6 +116,7 @@ function extractMentionedProcessPaths(text, workspace) {
111
116
  /([A-Za-z]:[\\/][^\r\n"'`]+?\.m?js)\b/g,
112
117
  /((?:\.{0,2}[\\/]|\/)[^\r\n"'`]+?\.m?js)\b/g,
113
118
  /\b([A-Za-z0-9_.\-\\/]+generated-process\.m?js)\b/g,
119
+ /\b(\.a5c[\\/]processes[\\/][A-Za-z0-9_.-]+\.m?js)\b/g,
114
120
  ];
115
121
  const matches = new Set();
116
122
  for (const pattern of patterns) {
@@ -742,7 +748,7 @@ async function validateProcessExport(filePath) {
742
748
  category: harnessUtils_1.ErrorCategory.Validation,
743
749
  nextSteps: [
744
750
  "Every TaskDef returned from defineTask(...) must include a top-level kind string",
745
- "Use kind: \"agent\" with agent: { ... }, kind: \"shell\" with shell: { command: ... }, or kind: \"node\" with node: { entry, args? } as appropriate",
751
+ "Use kind: \"agent\" with agent: { ... }, kind: \"shell\" with shell: { command: ... }, or another supported effect kind that the agent will execute and post manually",
746
752
  ],
747
753
  });
748
754
  }
@@ -754,7 +760,7 @@ async function validateProcessExport(filePath) {
754
760
  category: harnessUtils_1.ErrorCategory.Validation,
755
761
  nextSteps: [
756
762
  "Match each task's kind to its body shape",
757
- "Agent tasks must use kind: \"agent\", shell tasks must use kind: \"shell\", and node tasks must use kind: \"node\"",
763
+ "Agent tasks must use kind: \"agent\" and shell tasks must use kind: \"shell\". Do not generate node task definitions in authored processes",
758
764
  ],
759
765
  });
760
766
  }
@@ -768,6 +774,16 @@ async function validateProcessExport(filePath) {
768
774
  ],
769
775
  });
770
776
  }
777
+ const nodeTaskIds = getDefineTaskIdsByKind(source, "node");
778
+ if (nodeTaskIds.length > 0) {
779
+ throw new harnessUtils_1.BabysitterRuntimeError("InvalidProcessSourceError", `Process file at ${filePath} defines forbidden node tasks: ${nodeTaskIds.join(", ")}`, {
780
+ category: harnessUtils_1.ErrorCategory.Validation,
781
+ nextSteps: [
782
+ "Replace each node task with an agent or skill task",
783
+ "If the work is a concrete existing CLI command, use a shell task and have the orchestrating agent execute it and post the result",
784
+ ],
785
+ });
786
+ }
771
787
  const invalidCtxTaskTargets = getInvalidCtxTaskTargets(source);
772
788
  if (invalidCtxTaskTargets.length > 0) {
773
789
  throw new harnessUtils_1.BabysitterRuntimeError("InvalidProcessSourceError", `Process file at ${filePath} calls ctx.task(...) with values that are not DefinedTask bindings created via defineTask(...): ${invalidCtxTaskTargets.join(", ")}`, {
@@ -1019,16 +1035,21 @@ function coerceAgentResultValue(taskDef, output) {
1019
1035
  }
1020
1036
  // ── Process Recovery ─────────────────────────────────────────────────
1021
1037
  async function recoverProcessDefinitionFromOutputs(args) {
1022
- const expectedPath = path.resolve(args.outputPath);
1038
+ const resolvedDir = path.resolve(args.outputDir);
1039
+ // Check if any .js/.mjs files already exist in the output directory
1023
1040
  try {
1024
- await waitForProcessFile(expectedPath, 1_000);
1025
- return {
1026
- processPath: expectedPath,
1027
- summary: "Recovered from missing process-definition tool report by using the expected output path.",
1028
- };
1041
+ const entries = await node_fs_1.promises.readdir(resolvedDir);
1042
+ const processFiles = entries.filter((e) => /\.m?js$/.test(e));
1043
+ if (processFiles.length > 0) {
1044
+ const candidatePath = path.join(resolvedDir, processFiles[0]);
1045
+ return {
1046
+ processPath: candidatePath,
1047
+ summary: "Recovered from missing process-definition tool report by scanning the output directory.",
1048
+ };
1049
+ }
1029
1050
  }
1030
1051
  catch {
1031
- // continue to other recovery strategies
1052
+ // directory may not exist yet
1032
1053
  }
1033
1054
  for (const output of args.outputs) {
1034
1055
  for (const candidatePath of extractMentionedProcessPaths(output, args.workspace)) {
@@ -1049,10 +1070,12 @@ async function recoverProcessDefinitionFromOutputs(args) {
1049
1070
  if (!extracted || !looksLikeProcessDefinitionSource(extracted)) {
1050
1071
  continue;
1051
1072
  }
1052
- await node_fs_1.promises.mkdir(path.dirname(expectedPath), { recursive: true });
1053
- await node_fs_1.promises.writeFile(expectedPath, extracted, "utf8");
1073
+ const recoveredName = `recovered-process-${Date.now()}.mjs`;
1074
+ const recoveredPath = path.join(resolvedDir, recoveredName);
1075
+ await node_fs_1.promises.mkdir(resolvedDir, { recursive: true });
1076
+ await node_fs_1.promises.writeFile(recoveredPath, extracted, "utf8");
1054
1077
  return {
1055
- processPath: expectedPath,
1078
+ processPath: recoveredPath,
1056
1079
  summary: "Recovered process-definition output by writing a JavaScript code block returned by the agent.",
1057
1080
  };
1058
1081
  }
@@ -1060,10 +1083,12 @@ async function recoverProcessDefinitionFromOutputs(args) {
1060
1083
  if (!looksLikeProcessDefinitionSource(output)) {
1061
1084
  continue;
1062
1085
  }
1063
- await node_fs_1.promises.mkdir(path.dirname(expectedPath), { recursive: true });
1064
- await node_fs_1.promises.writeFile(expectedPath, output.trim(), "utf8");
1086
+ const recoveredName = `recovered-process-${Date.now()}.mjs`;
1087
+ const recoveredPath = path.join(resolvedDir, recoveredName);
1088
+ await node_fs_1.promises.mkdir(resolvedDir, { recursive: true });
1089
+ await node_fs_1.promises.writeFile(recoveredPath, output.trim(), "utf8");
1065
1090
  return {
1066
- processPath: expectedPath,
1091
+ processPath: recoveredPath,
1067
1092
  summary: "Recovered process-definition output by writing the agent's direct JavaScript response.",
1068
1093
  };
1069
1094
  }
@@ -1082,7 +1107,7 @@ async function recoverReportedProcessDefinition(args) {
1082
1107
  return args.state.report;
1083
1108
  }
1084
1109
  const recovered = await recoverProcessDefinitionFromOutputs({
1085
- outputPath: args.outputPath,
1110
+ outputDir: args.outputDir,
1086
1111
  workspace: args.workspace,
1087
1112
  outputs: args.outputs,
1088
1113
  });
@@ -1125,7 +1150,7 @@ function buildExternalProcessDefinitionPrompt(args) {
1125
1150
  "Task:",
1126
1151
  `- User request: ${args.prompt}`,
1127
1152
  `- Workspace: ${workspace}`,
1128
- `- Output path: ${path.resolve(args.outputPath)}`,
1153
+ `- Process output directory: ${path.resolve(args.outputDir)}`,
1129
1154
  `- Workspace assessment: ${args.workspaceAssessment.kind} (${workspaceSummary})`,
1130
1155
  "",
1131
1156
  "Requirements:",
@@ -1161,7 +1186,7 @@ function buildExternalProcessDefinitionPrompt(args) {
1161
1186
  "- External harnesses do not provide PI sandbox guardrails for their own tool execution. Keep security-sensitive shell work on the internal PI worker by using shell effects without routing them to an external harness.",
1162
1187
  "",
1163
1188
  "Output rules:",
1164
- "- Write the file now to the exact output path.",
1189
+ `- Choose a descriptive kebab-case filename (e.g. "user-auth-tdd.mjs", "data-pipeline-setup.js") and write the file to the process output directory.`,
1165
1190
  "- Return a short summary that confirms what you wrote and the final path.",
1166
1191
  "- Do not rely on AskUserQuestion or babysitter_report_process_definition. Those tools are not available here.",
1167
1192
  "- Do not return pseudocode, placeholders, or a plan without writing the file.",
@@ -1195,7 +1220,7 @@ function buildExternalProcessConformancePrompt(args) {
1195
1220
  "- Put instructions inside `agent.prompt.task`, `agent.prompt.instructions`, and related prompt fields rather than top-level `instructions` fields.",
1196
1221
  "- Agent tasks must use `kind: \"agent\"` with `agent: { name, prompt, outputSchema }`.",
1197
1222
  "- Shell tasks must use `kind: \"shell\"` with `shell: { command: \"...\" }`.",
1198
- "- Node tasks must use `kind: \"node\"` with `node: { entry, args? }`.",
1223
+ "- Do not introduce `kind: \"node\"` task definitions in generated or repaired processes. If logic would have been a node task, convert it to an `agent` or `skill` task instead.",
1199
1224
  "- Any task passed to `ctx.task(...)` must be a DefinedTask created via `defineTask(...)`; do not pass plain object task definitions or ad-hoc task objects.",
1200
1225
  "- The exported `process(inputs, ctx)` function must run tasks with `await ctx.task(definedTask, args)`; do not invent alternate task runners.",
1201
1226
  "- Inside the named `process(inputs, ctx)` export, never reference Node's global process object as `process.*`; use `globalThis.process` or an imported alias like `nodeProcess` instead.",
@@ -1229,9 +1254,9 @@ function buildInternalProcessConformancePrompt(args) {
1229
1254
  "- If the process needs the workspace root, do not assume `ctx.workspaceDir` or `ctx.cwd` exists. Resolve it from the module location using `import.meta.url`, for example with `path.dirname(fileURLToPath(import.meta.url))`.",
1230
1255
  "- Agent tasks must use `kind: \"agent\"` with `agent: { name, prompt, outputSchema }`.",
1231
1256
  "- Shell tasks must use `kind: \"shell\"` with `shell: { command: \"...\" }`.",
1232
- "- Node tasks must use `kind: \"node\"` with `node: { entry, args? }`.",
1257
+ "- Do not introduce `kind: \"node\"` task definitions in generated or repaired processes. If logic would have been a node task, convert it to an `agent` or `skill` task instead.",
1233
1258
  "- The exported `process(inputs, ctx)` function must call tasks with `await ctx.task(definedTask, args)`.",
1234
- "- Use `babysitter_write_process_definition` to rewrite the full file to the exact target path.",
1259
+ "- Use `babysitter_write_process_definition` with the `filename` parameter to rewrite the process file in the output directory.",
1235
1260
  "- After rewriting the file, call `babysitter_report_process_definition` exactly once with the same path.",
1236
1261
  "- Do not answer with plain text only.",
1237
1262
  ].join("\n");
@@ -1265,7 +1290,7 @@ async function _runExternalProcessDefinitionPhase(args) {
1265
1290
  (0, harnessUtils_1.writeVerboseBlock)(args.verbose, args.json, label, value, maxChars);
1266
1291
  };
1267
1292
  (0, harnessUtils_1.emitProgress)({ phase: "1", status: "started", harness: `${args.selectedHarnessName} (headless)` }, args.json, args.verbose);
1268
- writeVerbose(`[phase1 setup] workspace=${path.resolve(args.workspace ?? process.cwd())} model=${args.model ?? "(default)"} outputPath=${path.resolve(args.outputPath)} harness=${args.selectedHarnessName}`);
1293
+ writeVerbose(`[phase1 setup] workspace=${path.resolve(args.workspace ?? process.cwd())} model=${args.model ?? "(default)"} outputDir=${path.resolve(args.outputDir)} harness=${args.selectedHarnessName}`);
1269
1294
  const workspaceAssessment = await assessWorkspaceForExternalAuthoring(args.workspace);
1270
1295
  writeVerboseData("phase1 workspace assessment", workspaceAssessment);
1271
1296
  const invokeProcessAuthor = async (label, prompt, timeout) => {
@@ -1285,13 +1310,13 @@ async function _runExternalProcessDefinitionPhase(args) {
1285
1310
  };
1286
1311
  await invokeProcessAuthor("phase1 initial", buildExternalProcessDefinitionPrompt({
1287
1312
  prompt: args.prompt,
1288
- outputPath: args.outputPath,
1313
+ outputDir: args.outputDir,
1289
1314
  workspace: args.workspace,
1290
1315
  promptContext: args.promptContext,
1291
1316
  workspaceAssessment,
1292
1317
  }), 900_000);
1293
1318
  let report = await recoverProcessDefinitionFromOutputs({
1294
- outputPath: args.outputPath,
1319
+ outputDir: args.outputDir,
1295
1320
  workspace: args.workspace,
1296
1321
  outputs: phaseOutputs,
1297
1322
  });
@@ -1300,12 +1325,13 @@ async function _runExternalProcessDefinitionPhase(args) {
1300
1325
  }
1301
1326
  if (!report) {
1302
1327
  await invokeProcessAuthor("phase1 recovery", [
1303
- `Write the full process file now to ${args.outputPath}.`,
1328
+ `Write the full process file now to the output directory ${args.outputDir}.`,
1329
+ "Choose a descriptive kebab-case filename (e.g. recovered-process.mjs).",
1304
1330
  "Do not describe the plan only; materialize the file in the workspace.",
1305
1331
  "After writing it, return either a concise summary or the full file in a ```javascript fenced block.",
1306
1332
  ].join("\n"), 300_000);
1307
1333
  report = await recoverProcessDefinitionFromOutputs({
1308
- outputPath: args.outputPath,
1334
+ outputDir: args.outputDir,
1309
1335
  workspace: args.workspace,
1310
1336
  outputs: phaseOutputs,
1311
1337
  });
@@ -1315,12 +1341,12 @@ async function _runExternalProcessDefinitionPhase(args) {
1315
1341
  }
1316
1342
  if (!report) {
1317
1343
  await invokeProcessAuthor("phase1 final recovery", [
1318
- `Final recovery step: write the complete JavaScript process file to ${args.outputPath}.`,
1344
+ `Final recovery step: write the complete JavaScript process file to the output directory ${args.outputDir}.`,
1319
1345
  "Return the full file in a ```javascript fenced block after it exists on disk.",
1320
1346
  "Do not omit the file write.",
1321
1347
  ].join("\n"), 300_000);
1322
1348
  report = await recoverProcessDefinitionFromOutputs({
1323
- outputPath: args.outputPath,
1349
+ outputDir: args.outputDir,
1324
1350
  workspace: args.workspace,
1325
1351
  outputs: phaseOutputs,
1326
1352
  });
@@ -1366,27 +1392,29 @@ async function runProcessDefinitionPhase(args) {
1366
1392
  {
1367
1393
  name: "babysitter_write_process_definition",
1368
1394
  label: "Write Process Definition",
1369
- description: "Write the final JavaScript process file to the exact required output path.",
1395
+ description: "Write the final JavaScript process file to the process output directory with a descriptive filename.",
1370
1396
  parameters: typebox_1.Type.Object({
1371
1397
  source: typebox_1.Type.String(),
1372
- processPath: typebox_1.Type.Optional(typebox_1.Type.String()),
1398
+ filename: typebox_1.Type.String(),
1373
1399
  }),
1374
1400
  execute: async (_toolCallId, params) => {
1375
- const resolvedOutputPath = path.resolve(args.outputPath);
1376
- const requestedPath = params.processPath
1377
- ? path.resolve(params.processPath)
1378
- : resolvedOutputPath;
1379
- if (requestedPath !== resolvedOutputPath) {
1380
- throw new harnessUtils_1.BabysitterRuntimeError("ProcessDefinitionPathMismatch", `Process definitions must be written to ${resolvedOutputPath}.`, { category: harnessUtils_1.ErrorCategory.Runtime });
1401
+ const filename = params.filename;
1402
+ if (!/\.m?js$/.test(filename)) {
1403
+ throw new harnessUtils_1.BabysitterRuntimeError("ProcessDefinitionInvalidFilename", `Filename must end in .js or .mjs, got: ${filename}`, { category: harnessUtils_1.ErrorCategory.Validation });
1404
+ }
1405
+ if (/[/\\]/.test(filename) || filename.includes("..")) {
1406
+ throw new harnessUtils_1.BabysitterRuntimeError("ProcessDefinitionInvalidFilename", `Filename must be a simple name without path separators or '..', got: ${filename}`, { category: harnessUtils_1.ErrorCategory.Validation });
1381
1407
  }
1408
+ const resolvedDir = path.resolve(args.outputDir);
1409
+ const resolvedPath = path.join(resolvedDir, filename);
1382
1410
  const normalizedSource = normalizeProcessDefinitionSource(params.source);
1383
1411
  writeVerboseData("phase1 tool babysitter_write_process_definition", {
1384
- processPath: requestedPath,
1412
+ processPath: resolvedPath,
1385
1413
  sourcePreview: (0, harnessUtils_1.truncateForVerboseLog)(normalizedSource, 600),
1386
1414
  });
1387
- await node_fs_1.promises.mkdir(path.dirname(resolvedOutputPath), { recursive: true });
1388
- await node_fs_1.promises.writeFile(resolvedOutputPath, normalizedSource, "utf8");
1389
- return (0, harnessUtils_1.formatToolResult)({ processPath: resolvedOutputPath }, "Process definition written.");
1415
+ await node_fs_1.promises.mkdir(resolvedDir, { recursive: true });
1416
+ await node_fs_1.promises.writeFile(resolvedPath, normalizedSource, "utf8");
1417
+ return (0, harnessUtils_1.formatToolResult)({ processPath: resolvedPath }, "Process definition written.");
1390
1418
  },
1391
1419
  },
1392
1420
  {
@@ -1495,15 +1523,15 @@ async function runProcessDefinitionPhase(args) {
1495
1523
  });
1496
1524
  const mergedCustomTools = [...customTools, ...agenticTools];
1497
1525
  (0, harnessUtils_1.emitProgress)({ phase: "1", status: "started", harness: "pi (agentic)" }, args.json, args.verbose);
1498
- writeVerbose(`[phase1 setup] workspace=${path.resolve(args.workspace ?? process.cwd())} model=${args.model ?? "(default)"} outputPath=${path.resolve(args.outputPath)}`);
1526
+ writeVerbose(`[phase1 setup] workspace=${path.resolve(args.workspace ?? process.cwd())} model=${args.model ?? "(default)"} outputDir=${path.resolve(args.outputDir)}`);
1499
1527
  writeVerboseData("phase1 tools", mergedCustomTools.map((tool) => ({
1500
1528
  name: tool.name,
1501
1529
  label: tool.label,
1502
1530
  })));
1503
1531
  const workspaceAssessment = await assessWorkspaceForExternalAuthoring(args.workspace);
1504
1532
  writeVerboseData("phase1 workspace assessment", workspaceAssessment);
1505
- const processDefinitionSystemPrompt = (0, harnessPrompts_1.buildProcessDefinitionSystemPrompt)(args.outputPath, args.promptContext);
1506
- const initialMetaPrompt = (0, harnessPrompts_1.buildProcessDefinitionUserPrompt)(args.prompt, args.outputPath, {
1533
+ const processDefinitionSystemPrompt = await (0, harnessPrompts_1.buildProcessDefinitionSystemPrompt)(args.outputDir, args.promptContext, args.interactive);
1534
+ const initialMetaPrompt = (0, harnessPrompts_1.buildProcessDefinitionUserPrompt)(args.prompt, args.outputDir, {
1507
1535
  interactive: args.interactive,
1508
1536
  workspaceAssessment: workspaceAssessment.kind,
1509
1537
  workspaceEntries: workspaceAssessment.entries,
@@ -1540,10 +1568,18 @@ async function runProcessDefinitionPhase(args) {
1540
1568
  const result = await (0, harnessUtils_1.promptPiWithRetry)({
1541
1569
  session,
1542
1570
  message: initialMetaPrompt,
1543
- timeout: 300_000,
1571
+ timeout: harnessUtils_1.PI_DEFAULT_PROMPT_TIMEOUT_MS,
1544
1572
  label: "phase1 initial",
1545
1573
  writeVerbose,
1546
1574
  writeVerboseData,
1575
+ }).catch((err) => {
1576
+ const isTimeout = err instanceof harnessUtils_1.BabysitterRuntimeError &&
1577
+ (err.name === "PiTimeoutError" || (err.message ?? "").includes("timed out"));
1578
+ if (isTimeout) {
1579
+ writeVerbose("[phase1] Pi prompt timed out, converting to failure result");
1580
+ return { success: false, output: `Pi prompt timed out: ${err instanceof Error ? err.message : String(err)}` };
1581
+ }
1582
+ throw err;
1547
1583
  });
1548
1584
  phaseOutputs.push(result.output);
1549
1585
  if (unsubscribe)
@@ -1554,7 +1590,7 @@ async function runProcessDefinitionPhase(args) {
1554
1590
  writeVerboseData("phase1 agent failure output", result.output);
1555
1591
  const recovered = await recoverReportedProcessDefinition({
1556
1592
  state,
1557
- outputPath: args.outputPath,
1593
+ outputDir: args.outputDir,
1558
1594
  workspace: args.workspace,
1559
1595
  outputs: phaseOutputs,
1560
1596
  verbose: args.verbose,
@@ -1572,7 +1608,7 @@ async function runProcessDefinitionPhase(args) {
1572
1608
  writeVerboseProcessDefinitionRecovery(args.json);
1573
1609
  const recoveryPrompt = [
1574
1610
  "Recovery step:",
1575
- `- Write the full process file now to ${args.outputPath}`,
1611
+ `- Write the process file now to the output directory ${args.outputDir} using babysitter_write_process_definition with a descriptive filename.`,
1576
1612
  "- Then call babysitter_report_process_definition exactly once.",
1577
1613
  "- Do not just describe the process in plain text.",
1578
1614
  ].join("\n");
@@ -1584,13 +1620,21 @@ async function runProcessDefinitionPhase(args) {
1584
1620
  label: "phase1 recovery",
1585
1621
  writeVerbose,
1586
1622
  writeVerboseData,
1623
+ }).catch((err) => {
1624
+ const isTimeout = err instanceof harnessUtils_1.BabysitterRuntimeError &&
1625
+ (err.name === "PiTimeoutError" || (err.message ?? "").includes("timed out"));
1626
+ if (isTimeout) {
1627
+ writeVerbose("[phase1 recovery] Pi prompt timed out, converting to failure result");
1628
+ return { success: false, output: `Pi prompt timed out: ${err instanceof Error ? err.message : String(err)}` };
1629
+ }
1630
+ throw err;
1587
1631
  });
1588
1632
  phaseOutputs.push(recovery.output);
1589
1633
  if (!recovery.success) {
1590
1634
  writeVerboseData("phase1 recovery failure output", recovery.output);
1591
1635
  const recovered = await recoverReportedProcessDefinition({
1592
1636
  state,
1593
- outputPath: args.outputPath,
1637
+ outputDir: args.outputDir,
1594
1638
  workspace: args.workspace,
1595
1639
  outputs: phaseOutputs,
1596
1640
  verbose: args.verbose,
@@ -1609,7 +1653,7 @@ async function runProcessDefinitionPhase(args) {
1609
1653
  writeVerbose("[phase1 recovery] attempting host-side recovery from agent outputs");
1610
1654
  await recoverReportedProcessDefinition({
1611
1655
  state,
1612
- outputPath: args.outputPath,
1656
+ outputDir: args.outputDir,
1613
1657
  workspace: args.workspace,
1614
1658
  outputs: phaseOutputs,
1615
1659
  verbose: args.verbose,
@@ -1619,7 +1663,7 @@ async function runProcessDefinitionPhase(args) {
1619
1663
  if (!state.report?.processPath) {
1620
1664
  const finalRecoveryPrompt = [
1621
1665
  "Final recovery step:",
1622
- `- Write the complete JavaScript process file to ${args.outputPath}.`,
1666
+ `- Write the process file to the output directory ${args.outputDir} using babysitter_write_process_definition with a descriptive filename.`,
1623
1667
  "- If you already wrote it, do not rewrite unnecessarily.",
1624
1668
  "- Call babysitter_report_process_definition exactly once after the file exists.",
1625
1669
  "- Do not answer with plain text only.",
@@ -1633,13 +1677,21 @@ async function runProcessDefinitionPhase(args) {
1633
1677
  label: "phase1 final recovery",
1634
1678
  writeVerbose,
1635
1679
  writeVerboseData,
1680
+ }).catch((err) => {
1681
+ const isTimeout = err instanceof harnessUtils_1.BabysitterRuntimeError &&
1682
+ (err.name === "PiTimeoutError" || (err.message ?? "").includes("timed out"));
1683
+ if (isTimeout) {
1684
+ writeVerbose("[phase1 final recovery] Pi prompt timed out, converting to failure result");
1685
+ return { success: false, output: `Pi prompt timed out: ${err instanceof Error ? err.message : String(err)}` };
1686
+ }
1687
+ throw err;
1636
1688
  });
1637
1689
  phaseOutputs.push(finalRecovery.output);
1638
1690
  if (!finalRecovery.success) {
1639
1691
  writeVerboseData("phase1 final recovery failure output", finalRecovery.output);
1640
1692
  const recovered = await recoverReportedProcessDefinition({
1641
1693
  state,
1642
- outputPath: args.outputPath,
1694
+ outputDir: args.outputDir,
1643
1695
  workspace: args.workspace,
1644
1696
  outputs: phaseOutputs,
1645
1697
  verbose: args.verbose,
@@ -1655,7 +1707,7 @@ async function runProcessDefinitionPhase(args) {
1655
1707
  }
1656
1708
  await recoverReportedProcessDefinition({
1657
1709
  state,
1658
- outputPath: args.outputPath,
1710
+ outputDir: args.outputDir,
1659
1711
  workspace: args.workspace,
1660
1712
  outputs: phaseOutputs,
1661
1713
  verbose: args.verbose,
@@ -1702,6 +1754,14 @@ async function runProcessDefinitionPhase(args) {
1702
1754
  label: "phase1 conformance repair",
1703
1755
  writeVerbose,
1704
1756
  writeVerboseData,
1757
+ }).catch((err) => {
1758
+ const isTimeout = err instanceof harnessUtils_1.BabysitterRuntimeError &&
1759
+ (err.name === "PiTimeoutError" || (err.message ?? "").includes("timed out"));
1760
+ if (isTimeout) {
1761
+ writeVerbose("[phase1 conformance repair] Pi prompt timed out, converting to failure result");
1762
+ return { success: false, output: `Pi prompt timed out: ${err instanceof Error ? err.message : String(err)}` };
1763
+ }
1764
+ throw err;
1705
1765
  });
1706
1766
  phaseOutputs.push(repair.output);
1707
1767
  if (!repair.success) {
@@ -7,6 +7,12 @@
7
7
  */
8
8
  import * as readline from "node:readline";
9
9
  import { type ResolveEffectResult, type CompressionConfig, type HarnessDiscoveryResult, type HarnessPromptContext as SessionCreatePromptContext, type EffectAction, PiSessionHandle } from "./harnessUtils";
10
+ /**
11
+ * Maximum number of consecutive Pi prompt timeouts before the orchestration
12
+ * run is failed. A single timeout is recoverable — the loop simply continues
13
+ * — but repeated timeouts indicate a persistent infrastructure issue.
14
+ */
15
+ export declare const MAX_CONSECUTIVE_TIMEOUTS = 3;
10
16
  export declare function resolveEffect(action: EffectAction, harnessName: string, options: {
11
17
  workspace?: string;
12
18
  model?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"harnessPhase2.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/harnessPhase2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAkB1C,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAI3B,KAAK,oBAAoB,IAAI,0BAA0B,EACvD,KAAK,YAAY,EA8BjB,eAAe,EAIhB,MAAM,gBAAgB,CAAC;AAaxB,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,SAAS,CAAC,EAA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