@rallycry/conveyor-agent 5.9.3 → 5.9.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.
@@ -995,6 +995,8 @@ async function processResultCase(event, host, context, startTime, state) {
995
995
  }
996
996
  async function processEvents(events, context, host) {
997
997
  const startTime = Date.now();
998
+ let lastStatusEmit = Date.now();
999
+ const STATUS_REEMIT_INTERVAL_MS = 5e3;
998
1000
  const state = {
999
1001
  sessionIdStored: false,
1000
1002
  isTyping: false,
@@ -1007,6 +1009,11 @@ async function processEvents(events, context, host) {
1007
1009
  };
1008
1010
  for await (const event of events) {
1009
1011
  if (host.isStopped()) break;
1012
+ const now = Date.now();
1013
+ if (now - lastStatusEmit >= STATUS_REEMIT_INTERVAL_MS) {
1014
+ host.connection.emitStatus("running");
1015
+ lastStatusEmit = now;
1016
+ }
1010
1017
  if (host.pendingModeRestart) {
1011
1018
  stopTypingIfNeeded(host, state.isTyping);
1012
1019
  return { retriable: false, modeRestart: true };
@@ -1197,7 +1204,8 @@ function buildPropertyInstructions(context) {
1197
1204
  if (context.projectTags && context.projectTags.length > 0) {
1198
1205
  parts.push(``, `Available project tags:`);
1199
1206
  for (const tag of context.projectTags) {
1200
- parts.push(`- ID: "${tag.id}", Name: "${tag.name}"`);
1207
+ const desc = tag.description ? ` \u2014 ${tag.description}` : "";
1208
+ parts.push(`- ID: "${tag.id}", Name: "${tag.name}"${desc}`);
1201
1209
  }
1202
1210
  }
1203
1211
  return parts;
@@ -1444,7 +1452,6 @@ Your responses are sent directly to the task chat \u2014 the team sees everythin
1444
1452
  }
1445
1453
 
1446
1454
  // src/execution/prompt-builder.ts
1447
- var ACTIVE_STATUSES = /* @__PURE__ */ new Set(["InProgress", "ReviewPR", "ReviewDev", "ReviewLive"]);
1448
1455
  function formatFileSize(bytes) {
1449
1456
  if (bytes === void 0) return "";
1450
1457
  if (bytes < 1024) return `${bytes}B`;
@@ -1457,16 +1464,16 @@ function findLastAgentMessageIndex2(history) {
1457
1464
  }
1458
1465
  return -1;
1459
1466
  }
1460
- function detectRelaunchScenario(context) {
1467
+ function detectRelaunchScenario(context, trustChatHistory = false) {
1461
1468
  const lastAgentIdx = findLastAgentMessageIndex2(context.chatHistory);
1462
1469
  if (lastAgentIdx === -1) return "fresh";
1463
- const hasPriorWork = !!context.githubPRUrl || !!context.claudeSessionId || ACTIVE_STATUSES.has(context.status ?? "");
1470
+ const hasPriorWork = !!context.githubPRUrl || !!context.claudeSessionId || trustChatHistory;
1464
1471
  if (!hasPriorWork) return "fresh";
1465
1472
  const messagesAfterAgent = context.chatHistory.slice(lastAgentIdx + 1);
1466
1473
  const hasNewUserMessages = messagesAfterAgent.some((m) => m.role === "user");
1467
1474
  return hasNewUserMessages ? "feedback_relaunch" : "idle_relaunch";
1468
1475
  }
1469
- function buildRelaunchWithSession(mode, context) {
1476
+ function buildRelaunchWithSession(mode, context, agentMode) {
1470
1477
  const scenario = detectRelaunchScenario(context);
1471
1478
  if (!context.claudeSessionId || scenario === "fresh") return null;
1472
1479
  const parts = [];
@@ -1512,9 +1519,18 @@ Address the requested changes. Do NOT re-investigate the codebase from scratch o
1512
1519
  `You were relaunched but no new instructions have been given since your last run.`,
1513
1520
  `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
1514
1521
  `Run \`git log --oneline -10\` to review what you already committed.`,
1515
- `Review the current state of the codebase and verify everything is working correctly.`,
1516
- `Reply with a brief status update (visible in chat), then wait for further instructions.`
1522
+ `Review the current state of the codebase and verify everything is working correctly.`
1517
1523
  );
1524
+ if (agentMode === "auto" || agentMode === "building") {
1525
+ parts.push(
1526
+ `If work is incomplete, continue implementing the plan. When finished, commit, push, and use mcp__conveyor__create_pull_request to open a PR.`,
1527
+ `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
1528
+ );
1529
+ } else {
1530
+ parts.push(
1531
+ `Reply with a brief status update (visible in chat), then wait for further instructions.`
1532
+ );
1533
+ }
1518
1534
  if (context.githubPRUrl) {
1519
1535
  parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
1520
1536
  }
@@ -1729,10 +1745,19 @@ function buildInstructions(mode, context, scenario, agentMode) {
1729
1745
  parts.push(
1730
1746
  `You were relaunched but no new instructions have been given since your last run.`,
1731
1747
  `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
1732
- `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`,
1733
- `Reply with a brief status update summarizing where things stand (visible in chat).`,
1734
- `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
1748
+ `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`
1735
1749
  );
1750
+ if (agentMode === "auto" || agentMode === "building") {
1751
+ parts.push(
1752
+ `If work is incomplete, continue implementing the plan. When finished, commit, push, and use mcp__conveyor__create_pull_request to open a PR.`,
1753
+ `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
1754
+ );
1755
+ } else {
1756
+ parts.push(
1757
+ `Reply with a brief status update summarizing where things stand (visible in chat).`,
1758
+ `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
1759
+ );
1760
+ }
1736
1761
  if (context.githubPRUrl) {
1737
1762
  parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
1738
1763
  }
@@ -1745,10 +1770,11 @@ function buildInstructions(mode, context, scenario, agentMode) {
1745
1770
  function buildInitialPrompt(mode, context, isAuto, agentMode) {
1746
1771
  const isPackRunner = mode === "pm" && !!isAuto && !!context.isParentTask;
1747
1772
  if (!isPackRunner) {
1748
- const sessionRelaunch = buildRelaunchWithSession(mode, context);
1773
+ const sessionRelaunch = buildRelaunchWithSession(mode, context, agentMode);
1749
1774
  if (sessionRelaunch) return sessionRelaunch;
1750
1775
  }
1751
- const scenario = detectRelaunchScenario(context);
1776
+ const isPm = mode === "pm";
1777
+ const scenario = detectRelaunchScenario(context, isPm);
1752
1778
  const body = buildTaskBody(context);
1753
1779
  const instructions = isPackRunner ? buildPackRunnerInstructions(context, scenario) : buildInstructions(mode, context, scenario, agentMode);
1754
1780
  return [...body, ...instructions].join("\n");
@@ -3028,6 +3054,16 @@ ${message}`);
3028
3054
  }
3029
3055
  async function runSetupSafe(runnerConfig, connection, callbacks, setupLog, _effectiveAgentMode, setState) {
3030
3056
  await setState("setup");
3057
+ if (process.env.CONVEYOR_FROM_PROJECT_RUNNER === "true") {
3058
+ const config2 = await loadConveyorConfig(runnerConfig.workspaceDir);
3059
+ const setupEvent = {
3060
+ type: "setup_complete",
3061
+ previewPort: config2?.previewPort ?? void 0
3062
+ };
3063
+ connection.sendEvent(setupEvent);
3064
+ await callbacks.onEvent(setupEvent);
3065
+ return { ok: true, conveyorConfig: config2 };
3066
+ }
3031
3067
  const ports = await loadForwardPorts(runnerConfig.workspaceDir);
3032
3068
  if (ports.length > 0 && process.env.CODESPACE_NAME) {
3033
3069
  const visibility = ports.map((p) => `${p}:public`).join(" ");
@@ -3848,7 +3884,8 @@ function spawnChildAgent(assignment, workDir) {
3848
3884
  CONVEYOR_USE_WORKTREE: "false",
3849
3885
  CONVEYOR_AGENT_MODE: isAuto ? "auto" : "",
3850
3886
  CONVEYOR_IS_AUTO: isAuto ? "true" : "false",
3851
- CONVEYOR_USE_SANDBOX: useSandbox === true ? "true" : "false"
3887
+ CONVEYOR_USE_SANDBOX: useSandbox === true ? "true" : "false",
3888
+ CONVEYOR_FROM_PROJECT_RUNNER: "true"
3852
3889
  },
3853
3890
  cwd: workDir,
3854
3891
  stdio: ["pipe", "pipe", "pipe", "ipc"]
@@ -4119,4 +4156,4 @@ export {
4119
4156
  ProjectRunner,
4120
4157
  FileCache
4121
4158
  };
4122
- //# sourceMappingURL=chunk-MTIMRYLD.js.map
4159
+ //# sourceMappingURL=chunk-N3TSLBSH.js.map