@rallycry/conveyor-agent 6.4.1 → 6.4.2

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.
@@ -2512,26 +2512,49 @@ function detectRelaunchScenario(context, trustChatHistory = false) {
2512
2512
  const hasNewUserMessages = messagesAfterAgent.some((m) => m.role === "user");
2513
2513
  return hasNewUserMessages ? "feedback_relaunch" : "idle_relaunch";
2514
2514
  }
2515
- function buildRelaunchWithSession(mode, context, agentMode, isAuto) {
2516
- const scenario = detectRelaunchScenario(context);
2517
- if (!context.claudeSessionId || scenario === "fresh") return null;
2515
+ function buildPmRelaunchParts(context, lastAgentIdx, isAuto) {
2518
2516
  const parts = [];
2519
- const lastAgentIdx = findLastAgentMessageIndex2(context.chatHistory);
2520
- if (mode === "pm") {
2521
- const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
2522
- if (newMessages.length > 0) {
2517
+ const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
2518
+ if (newMessages.length > 0) {
2519
+ parts.push(
2520
+ `You have been relaunched. Here are new messages since your last session:`,
2521
+ ...newMessages.map((m) => `[${m.userName ?? "user"}]: ${m.content}`)
2522
+ );
2523
+ } else {
2524
+ parts.push(`You have been relaunched. No new messages since your last session.`);
2525
+ }
2526
+ if (isAuto) {
2527
+ if (context.plan?.trim()) {
2523
2528
  parts.push(
2524
- `You have been relaunched. Here are new messages since your last session:`,
2525
- ...newMessages.map((m) => `[${m.userName ?? "user"}]: ${m.content}`)
2529
+ `
2530
+ You are in auto mode. A plan already exists for this task.`,
2531
+ `Verify that story points, title, and tags are set via get_task_plan, then call ExitPlanMode immediately to transition to building.`,
2532
+ `Do NOT wait for team input \u2014 proceed autonomously.`
2526
2533
  );
2527
2534
  } else {
2528
- parts.push(`You have been relaunched. No new messages since your last session.`);
2535
+ parts.push(
2536
+ `
2537
+ You are in auto mode. Continue planning autonomously.`,
2538
+ `When the plan and all required properties are set, call ExitPlanMode to transition to building.`,
2539
+ `Do NOT wait for team input \u2014 proceed autonomously.`
2540
+ );
2529
2541
  }
2542
+ } else {
2530
2543
  parts.push(
2531
2544
  `
2532
2545
  You are the project manager for this task.`,
2533
2546
  `Review the context above and wait for the team to provide instructions before taking action.`
2534
2547
  );
2548
+ }
2549
+ return parts;
2550
+ }
2551
+ function buildRelaunchWithSession(mode, context, agentMode, isAuto) {
2552
+ const scenario = detectRelaunchScenario(context);
2553
+ if (!context.claudeSessionId || scenario === "fresh") return null;
2554
+ const parts = [];
2555
+ const lastAgentIdx = findLastAgentMessageIndex2(context.chatHistory);
2556
+ if (mode === "pm") {
2557
+ parts.push(...buildPmRelaunchParts(context, lastAgentIdx, isAuto));
2535
2558
  } else if (scenario === "feedback_relaunch") {
2536
2559
  const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
2537
2560
  parts.push(
@@ -2700,6 +2723,13 @@ CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or g
2700
2723
  ];
2701
2724
  }
2702
2725
  if (isAutoMode && isPm) {
2726
+ if (context.plan?.trim()) {
2727
+ return [
2728
+ `You are operating autonomously. A plan already exists for this task.`,
2729
+ `Verify that story points, title, and tags are set, then call ExitPlanMode immediately to transition to building.`,
2730
+ `Do NOT re-plan or wait for team input \u2014 proceed autonomously.`
2731
+ ];
2732
+ }
2703
2733
  return [
2704
2734
  `You are operating autonomously. Begin planning immediately.`,
2705
2735
  `1. Explore the codebase to understand the architecture and relevant files`,
@@ -2778,6 +2808,50 @@ Address the requested changes directly. Do NOT re-investigate the codebase from
2778
2808
  }
2779
2809
  return parts;
2780
2810
  }
2811
+ function buildIdleRelaunchInstructions(context, isPm, agentMode, isAuto) {
2812
+ if (isPm && agentMode === "auto" && context.status === "Planning") {
2813
+ if (context.plan?.trim()) {
2814
+ return [
2815
+ `You were relaunched in auto mode. A plan already exists for this task.`,
2816
+ `Verify that story points, title, and tags are set, then call ExitPlanMode immediately to transition to building.`,
2817
+ `Do NOT wait for instructions or go idle \u2014 you are in auto mode.`
2818
+ ];
2819
+ }
2820
+ return [
2821
+ `You were relaunched in auto mode. Continue planning autonomously.`,
2822
+ `When the plan and all required properties are set, call ExitPlanMode to transition to building.`,
2823
+ `Do NOT wait for instructions or go idle \u2014 you are in auto mode.`
2824
+ ];
2825
+ }
2826
+ if (isPm && !(agentMode === "building" || agentMode === "review" || agentMode === "auto")) {
2827
+ return [
2828
+ `You were relaunched but no new instructions have been given since your last run.`,
2829
+ `You are the project manager for this task.`,
2830
+ `Wait for the team to provide instructions before taking action.`
2831
+ ];
2832
+ }
2833
+ const isAutoMode = agentMode === "auto" || agentMode === "building" && isAuto;
2834
+ const parts = [
2835
+ `You were relaunched but no new instructions have been given since your last run.`,
2836
+ `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
2837
+ `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`
2838
+ ];
2839
+ if (isAutoMode) {
2840
+ parts.push(
2841
+ `If work is incomplete, continue implementing the plan. When finished, use mcp__conveyor__create_pull_request to open a PR.`,
2842
+ `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
2843
+ );
2844
+ } else {
2845
+ parts.push(
2846
+ `Reply with a brief status update summarizing where things stand (visible in chat).`,
2847
+ `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
2848
+ );
2849
+ }
2850
+ if (context.githubPRUrl) {
2851
+ parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
2852
+ }
2853
+ return parts;
2854
+ }
2781
2855
  function buildInstructions(mode, context, scenario, agentMode, isAuto) {
2782
2856
  const parts = [`
2783
2857
  ## Instructions`];
@@ -2791,44 +2865,7 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
2791
2865
  return parts;
2792
2866
  }
2793
2867
  if (scenario === "idle_relaunch") {
2794
- if (isPm && (agentMode === "building" || agentMode === "review" || agentMode === "auto")) {
2795
- parts.push(
2796
- `You were relaunched but no new instructions have been given since your last run.`,
2797
- `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
2798
- `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`,
2799
- `Reply with a brief status update summarizing where things stand (visible in chat).`,
2800
- `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
2801
- );
2802
- if (context.githubPRUrl) {
2803
- parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
2804
- }
2805
- } else if (isPm) {
2806
- parts.push(
2807
- `You were relaunched but no new instructions have been given since your last run.`,
2808
- `You are the project manager for this task.`,
2809
- `Wait for the team to provide instructions before taking action.`
2810
- );
2811
- } else {
2812
- parts.push(
2813
- `You were relaunched but no new instructions have been given since your last run.`,
2814
- `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
2815
- `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`
2816
- );
2817
- if (agentMode === "auto" || agentMode === "building" && isAuto) {
2818
- parts.push(
2819
- `If work is incomplete, continue implementing the plan. When finished, use mcp__conveyor__create_pull_request to open a PR.`,
2820
- `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
2821
- );
2822
- } else {
2823
- parts.push(
2824
- `Reply with a brief status update summarizing where things stand (visible in chat).`,
2825
- `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
2826
- );
2827
- }
2828
- if (context.githubPRUrl) {
2829
- parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
2830
- }
2831
- }
2868
+ parts.push(...buildIdleRelaunchInstructions(context, isPm, agentMode, isAuto));
2832
2869
  return parts;
2833
2870
  }
2834
2871
  parts.push(...buildFeedbackInstructions(context, isPm));
@@ -6198,19 +6235,45 @@ var AgentRunner = class {
6198
6235
  }
6199
6236
  this.taskContext._runnerSessionId = randomUUID2();
6200
6237
  if (this.taskContext.agentMode) this.agentMode = this.taskContext.agentMode;
6201
- const pastPlanning = this.taskContext.status !== "Planning" && this.taskContext.status !== "Unidentified";
6202
- if (this.agentMode === "auto" && pastPlanning) {
6203
- this.hasExitedPlanMode = true;
6204
- this.agentMode = "building";
6205
- const builderModel = this.taskContext.builderModel ?? this.taskContext.model;
6206
- if (builderModel) this.taskContext.model = builderModel;
6207
- }
6238
+ await this.tryAutoModeBypass();
6208
6239
  this.logEffectiveSettings();
6209
6240
  if (process.env.CODESPACES === "true" || process.env.CLAUDESPACE_NAME) {
6210
6241
  unshallowRepo(this.config.workspaceDir);
6211
6242
  }
6212
6243
  return true;
6213
6244
  }
6245
+ /**
6246
+ * For auto-mode tasks, bypass planning if the task is already past Planning
6247
+ * or if it's still in Planning but has all required properties set (e.g. from
6248
+ * a prior PM discovery session).
6249
+ */
6250
+ async tryAutoModeBypass() {
6251
+ if (this.agentMode !== "auto" || !this.taskContext) return;
6252
+ const pastPlanning = this.taskContext.status !== "Planning" && this.taskContext.status !== "Unidentified";
6253
+ if (pastPlanning) {
6254
+ this.transitionToBuilding();
6255
+ return;
6256
+ }
6257
+ if (this.taskContext.status !== "Planning") return;
6258
+ try {
6259
+ const props = await this.connection.getTaskProperties();
6260
+ const hasRequiredProps = !!props.plan?.trim() && !!props.storyPointId && !!props.title && props.title !== "Untitled";
6261
+ if (hasRequiredProps) {
6262
+ await this.connection.triggerIdentification();
6263
+ this.transitionToBuilding();
6264
+ this.connection.emitModeChanged(this.agentMode);
6265
+ this.connection.emitModeTransition({ fromMode: "auto", toMode: this.agentMode });
6266
+ }
6267
+ } catch {
6268
+ }
6269
+ }
6270
+ transitionToBuilding() {
6271
+ if (!this.taskContext) return;
6272
+ this.hasExitedPlanMode = true;
6273
+ this.agentMode = this.taskContext.isParentTask ? "review" : "building";
6274
+ const builderModel = this.taskContext.builderModel ?? this.taskContext.model;
6275
+ if (builderModel) this.taskContext.model = builderModel;
6276
+ }
6214
6277
  tryPostContextWorktree() {
6215
6278
  if (process.env.CODESPACES !== "true" && process.env.CONVEYOR_USE_WORKTREE !== "false" && !this.worktreeActive && this.taskContext?.useWorktree) {
6216
6279
  this.activateWorktree("[conveyor] Using worktree (from task config):");
@@ -8133,4 +8196,4 @@ export {
8133
8196
  ProjectRunner,
8134
8197
  FileCache
8135
8198
  };
8136
- //# sourceMappingURL=chunk-VDLO4YL6.js.map
8199
+ //# sourceMappingURL=chunk-XHJ2Z4AD.js.map