@rallycry/conveyor-agent 10.0.3 → 10.0.4

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.
@@ -4890,6 +4890,95 @@ function truncatePlanForPrompt(plan) {
4890
4890
  return `${head}${PLAN_TRUNCATION_MARKER}${tail}`;
4891
4891
  }
4892
4892
 
4893
+ // src/execution/pm-relaunch-instructions.ts
4894
+ function resolvePmRelaunchIntent(context, isAuto, agentMode) {
4895
+ switch (agentMode) {
4896
+ case "building":
4897
+ return "build" /* Build */;
4898
+ case "review":
4899
+ return "review" /* Review */;
4900
+ default:
4901
+ break;
4902
+ }
4903
+ if (!isAuto) return "wait_for_team" /* WaitForTeam */;
4904
+ return context.plan?.trim() ? "auto_with_plan" /* AutoWithPlan */ : "auto_planning" /* AutoPlanning */;
4905
+ }
4906
+ function buildRelaunchMessageSummary(context, lastAgentIdx) {
4907
+ const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
4908
+ if (newMessages.length === 0) {
4909
+ return [`You have been relaunched. No new messages since your last session.`];
4910
+ }
4911
+ return [
4912
+ `You have been relaunched. Here are new messages since your last session:`,
4913
+ ...newMessages.map((m) => `[${m.userName ?? "user"}]: ${m.content}`)
4914
+ ];
4915
+ }
4916
+ function buildPmBuildRelaunchParts(context, isAuto) {
4917
+ const parts = [
4918
+ `
4919
+ Your plan has been approved. Begin implementing it now.`,
4920
+ `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
4921
+ `Start by reading the relevant source files mentioned in the plan, then write code.`,
4922
+ `When finished, use the mcp__conveyor__create_pull_request tool to open a PR. Do NOT use gh CLI.`
4923
+ ];
4924
+ if (isAuto) {
4925
+ parts.push(
4926
+ `
4927
+ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
4928
+ `Your FIRST action must be reading source files from the plan, then immediately writing code.`,
4929
+ `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing.`,
4930
+ `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
4931
+ );
4932
+ }
4933
+ return parts;
4934
+ }
4935
+ function buildPmReviewRelaunchParts() {
4936
+ return [
4937
+ `
4938
+ Resume reviewing and coordinating this task.`,
4939
+ `Call list_subtasks to check current child-task state and progress.`,
4940
+ `Review children in ReviewPR status first, then approve and merge passing PRs.`,
4941
+ `Fire next child builds with start_child_cloud_build when ready.`,
4942
+ `Do not implement code directly or create a new PR from the PM review session.`
4943
+ ];
4944
+ }
4945
+ function buildPmAutoWithPlanRelaunchParts() {
4946
+ return [
4947
+ `
4948
+ You are in auto mode. A plan already exists for this task.`,
4949
+ `Verify that story points, title, and tags are set via get_current_plan, then call ExitPlanMode immediately to transition to building.`,
4950
+ `Do NOT wait for team input \u2014 proceed autonomously.`
4951
+ ];
4952
+ }
4953
+ function buildPmAutoPlanningRelaunchParts() {
4954
+ return [
4955
+ `
4956
+ You are in auto mode. Continue planning autonomously.`,
4957
+ `When the plan and all required properties are set, call ExitPlanMode to transition to building.`,
4958
+ `Do NOT wait for team input \u2014 proceed autonomously.`
4959
+ ];
4960
+ }
4961
+ function buildPmWaitForTeamRelaunchParts() {
4962
+ return [
4963
+ `
4964
+ You are the project manager for this task.`,
4965
+ `Review the context above and wait for the team to provide instructions before taking action.`
4966
+ ];
4967
+ }
4968
+ function buildPmRelaunchParts(context, lastAgentIdx, isAuto, agentMode) {
4969
+ const parts = buildRelaunchMessageSummary(context, lastAgentIdx);
4970
+ const intent = resolvePmRelaunchIntent(context, isAuto, agentMode);
4971
+ const intentPartsByIntent = {
4972
+ ["build" /* Build */]: () => buildPmBuildRelaunchParts(context, isAuto),
4973
+ ["review" /* Review */]: buildPmReviewRelaunchParts,
4974
+ ["auto_with_plan" /* AutoWithPlan */]: buildPmAutoWithPlanRelaunchParts,
4975
+ ["auto_planning" /* AutoPlanning */]: buildPmAutoPlanningRelaunchParts,
4976
+ ["wait_for_team" /* WaitForTeam */]: buildPmWaitForTeamRelaunchParts
4977
+ };
4978
+ parts.push(...intentPartsByIntent[intent]());
4979
+ return parts;
4980
+ }
4981
+
4893
4982
  // src/execution/mode-prompt.ts
4894
4983
  var SP_DESC_MAX_CHARS = 80;
4895
4984
  function truncateDescription(desc, maxChars) {
@@ -5360,59 +5449,6 @@ function detectRelaunchScenario(context, trustChatHistory = false) {
5360
5449
  const hasNewUserMessages = messagesAfterAgent.some((m) => m.role === "user");
5361
5450
  return hasNewUserMessages ? "feedback_relaunch" : "idle_relaunch";
5362
5451
  }
5363
- function buildPmRelaunchParts(context, lastAgentIdx, isAuto, agentMode) {
5364
- const parts = [];
5365
- const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
5366
- if (newMessages.length > 0) {
5367
- parts.push(
5368
- `You have been relaunched. Here are new messages since your last session:`,
5369
- ...newMessages.map((m) => `[${m.userName ?? "user"}]: ${m.content}`)
5370
- );
5371
- } else {
5372
- parts.push(`You have been relaunched. No new messages since your last session.`);
5373
- }
5374
- if (agentMode === "building" || agentMode === "review") {
5375
- parts.push(
5376
- `
5377
- Your plan has been approved. Begin implementing it now.`,
5378
- `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
5379
- `Start by reading the relevant source files mentioned in the plan, then write code.`,
5380
- `When finished, use the mcp__conveyor__create_pull_request tool to open a PR. Do NOT use gh CLI.`
5381
- );
5382
- if (isAuto) {
5383
- parts.push(
5384
- `
5385
- CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
5386
- `Your FIRST action must be reading source files from the plan, then immediately writing code.`,
5387
- `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing.`,
5388
- `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
5389
- );
5390
- }
5391
- } else if (isAuto) {
5392
- if (context.plan?.trim()) {
5393
- parts.push(
5394
- `
5395
- You are in auto mode. A plan already exists for this task.`,
5396
- `Verify that story points, title, and tags are set via get_current_plan, then call ExitPlanMode immediately to transition to building.`,
5397
- `Do NOT wait for team input \u2014 proceed autonomously.`
5398
- );
5399
- } else {
5400
- parts.push(
5401
- `
5402
- You are in auto mode. Continue planning autonomously.`,
5403
- `When the plan and all required properties are set, call ExitPlanMode to transition to building.`,
5404
- `Do NOT wait for team input \u2014 proceed autonomously.`
5405
- );
5406
- }
5407
- } else {
5408
- parts.push(
5409
- `
5410
- You are the project manager for this task.`,
5411
- `Review the context above and wait for the team to provide instructions before taking action.`
5412
- );
5413
- }
5414
- return parts;
5415
- }
5416
5452
  function buildRelaunchWithSession(mode, context, agentMode, isAuto) {
5417
5453
  const scenario = detectRelaunchScenario(context);
5418
5454
  const hasPriorTurn = !!context.lastSeenMessageId || !!context.claudeSessionId;
@@ -5527,7 +5563,10 @@ ${truncatePlanForPrompt(context.plan)}`);
5527
5563
  }
5528
5564
  return parts;
5529
5565
  }
5530
- function buildFreshInstructions(isPm, isAutoMode, context, agentMode) {
5566
+ function buildFreshInstructions(isPm, isCodeReview, isAutoMode, context, agentMode) {
5567
+ if (isCodeReview) {
5568
+ return buildFreshCodeReviewInstructions(context);
5569
+ }
5531
5570
  if (isPm && agentMode === "building") {
5532
5571
  return [
5533
5572
  `Your plan has been approved. Begin implementing it now.`,
@@ -5595,6 +5634,21 @@ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or g
5595
5634
  }
5596
5635
  return parts;
5597
5636
  }
5637
+ function buildFreshCodeReviewInstructions(context) {
5638
+ const parts = [
5639
+ `Perform the automated code review for this PR.`,
5640
+ `Work on the git branch "${context.githubBranch}". Stay on this branch for the entire review. Do not checkout or create other branches.`,
5641
+ `Start by running \`git diff ${context.baseBranch ?? "dev"}..HEAD\` to inspect the submitted changes, then read the task plan and surrounding code as needed.`,
5642
+ `Review for correctness, security, performance, error handling, test coverage, and consistency with existing patterns.`,
5643
+ `If small fixes are needed, make them directly, commit, push, and re-review the result.`,
5644
+ `Use approve_code_review when the PR passes review.`,
5645
+ `Use request_code_changes when substantive issues remain that you cannot fix directly.`
5646
+ ];
5647
+ if (context.githubPRUrl) {
5648
+ parts.push(`The PR under review is ${context.githubPRUrl}. Do not create a new PR.`);
5649
+ }
5650
+ return parts;
5651
+ }
5598
5652
  function buildFeedbackInstructions(context, isPm, agentMode, isAuto) {
5599
5653
  const lastAgentIdx = findLastAgentMessageIndex2(context.chatHistory);
5600
5654
  const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
@@ -5700,8 +5754,11 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
5700
5754
  const parts = [`
5701
5755
  ## Instructions`];
5702
5756
  const isPm = mode === "pm";
5757
+ const isCodeReview = mode === "code-review" || !isPm && agentMode === "review";
5703
5758
  if (scenario === "fresh") {
5704
- parts.push(...buildFreshInstructions(isPm, agentMode === "auto", context, agentMode));
5759
+ parts.push(
5760
+ ...buildFreshInstructions(isPm, isCodeReview, agentMode === "auto", context, agentMode)
5761
+ );
5705
5762
  return parts;
5706
5763
  }
5707
5764
  if (scenario === "idle_relaunch") {
@@ -9859,4 +9916,4 @@ export {
9859
9916
  runStartCommand,
9860
9917
  unshallowRepo
9861
9918
  };
9862
- //# sourceMappingURL=chunk-QKRPJ7DB.js.map
9919
+ //# sourceMappingURL=chunk-OOUQ2C4Z.js.map