@rallycry/conveyor-agent 7.2.3 → 7.2.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.
@@ -1142,9 +1142,10 @@ function isBinaryPath(filePath) {
1142
1142
  const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
1143
1143
  return BINARY_EXTENSIONS.has(ext);
1144
1144
  }
1145
- function getContextBudgetChars(_model, betas) {
1145
+ function getContextBudgetChars(_model, betas, runnerMode) {
1146
1146
  const contextWindow = betas?.some((b) => b.includes("context-1m")) ? 1e6 : 2e5;
1147
- return contextWindow * 0.25 * 4;
1147
+ const budgetPct = runnerMode === "task" ? 0.15 : 0.25;
1148
+ return contextWindow * budgetPct * 4;
1148
1149
  }
1149
1150
  async function readFileContent(filePath, maxChars) {
1150
1151
  try {
@@ -1237,7 +1238,7 @@ ${formatEntry(entry)}`);
1237
1238
  }
1238
1239
  return parts.join("\n");
1239
1240
  }
1240
- async function resolveTagContext(projectTags, taskTagIds, model, betas) {
1241
+ async function resolveTagContext(projectTags, taskTagIds, model, betas, runnerMode) {
1241
1242
  if (!projectTags?.length || !taskTagIds.length) {
1242
1243
  return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
1243
1244
  }
@@ -1260,7 +1261,7 @@ async function resolveTagContext(projectTags, taskTagIds, model, betas) {
1260
1261
  if (allEntries.length === 0) {
1261
1262
  return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
1262
1263
  }
1263
- const budgetChars = getContextBudgetChars(model, betas);
1264
+ const budgetChars = getContextBudgetChars(model, betas, runnerMode);
1264
1265
  const budget = { remaining: budgetChars };
1265
1266
  let injected = 0;
1266
1267
  let skipped = 0;
@@ -1285,7 +1286,26 @@ async function resolveTagContext(projectTags, taskTagIds, model, betas) {
1285
1286
  }
1286
1287
 
1287
1288
  // src/execution/mode-prompt.ts
1288
- function buildPropertyInstructions(context) {
1289
+ var SP_DESC_MAX_CHARS = 80;
1290
+ function truncateDescription(desc, maxChars) {
1291
+ if (desc.length <= maxChars) return desc;
1292
+ return desc.slice(0, maxChars) + "\u2026";
1293
+ }
1294
+ function formatTagWithContextPaths(tag) {
1295
+ const desc = tag.description ? ` \u2014 ${tag.description}` : "";
1296
+ const lines = [`- ID: "${tag.id}", Name: "${tag.name}"${desc}`];
1297
+ for (const link of tag.contextPaths ?? []) {
1298
+ const label = link.label ? ` (${link.label})` : "";
1299
+ lines.push(` \u2192 ${link.type}: ${link.path}${label}`);
1300
+ }
1301
+ return lines;
1302
+ }
1303
+ function formatTagNameOnly(tag) {
1304
+ const desc = tag.description ? ` \u2014 ${tag.description}` : "";
1305
+ return `- Name: "${tag.name}"${desc}`;
1306
+ }
1307
+ function buildPropertyInstructions(context, runnerMode) {
1308
+ const isTask = runnerMode === "task";
1289
1309
  const parts = [];
1290
1310
  parts.push(
1291
1311
  ``,
@@ -1298,29 +1318,29 @@ function buildPropertyInstructions(context) {
1298
1318
  `Don't wait for the user to ask \u2014 fill these in naturally as the plan takes shape.`,
1299
1319
  `If the user adjusts the plan significantly, update the properties to match.`
1300
1320
  );
1301
- if (context.storyPoints && context.storyPoints.length > 0) {
1321
+ if (!isTask && context.storyPoints && context.storyPoints.length > 0) {
1302
1322
  parts.push(``, `Available story point tiers:`);
1303
1323
  for (const sp of context.storyPoints) {
1304
- const desc = sp.description ? ` \u2014 ${sp.description}` : "";
1324
+ const desc = sp.description ? ` \u2014 ${truncateDescription(sp.description, SP_DESC_MAX_CHARS)}` : "";
1305
1325
  parts.push(`- Value ${sp.value}: "${sp.name}"${desc}`);
1306
1326
  }
1307
1327
  }
1308
1328
  if (context.projectTags && context.projectTags.length > 0) {
1309
- parts.push(``, `Available project tags:`);
1310
- for (const tag of context.projectTags) {
1311
- const desc = tag.description ? ` \u2014 ${tag.description}` : "";
1312
- parts.push(`- ID: "${tag.id}", Name: "${tag.name}"${desc}`);
1313
- if (tag.contextPaths?.length) {
1314
- for (const link of tag.contextPaths) {
1315
- const label = link.label ? ` (${link.label})` : "";
1316
- parts.push(` \u2192 ${link.type}: ${link.path}${label}`);
1317
- }
1318
- }
1329
+ const assignedIds = new Set(context.taskTagIds ?? []);
1330
+ const assigned = context.projectTags.filter((t) => assignedIds.has(t.id));
1331
+ const unassigned = context.projectTags.filter((t) => !assignedIds.has(t.id));
1332
+ if (assigned.length > 0) {
1333
+ parts.push(``, `Assigned tags:`);
1334
+ for (const tag of assigned) parts.push(...formatTagWithContextPaths(tag));
1335
+ }
1336
+ if (!isTask && unassigned.length > 0) {
1337
+ parts.push(``, `Available project tags:`);
1338
+ for (const tag of unassigned) parts.push(formatTagNameOnly(tag));
1319
1339
  }
1320
1340
  }
1321
1341
  return parts;
1322
1342
  }
1323
- function buildDiscoveryPrompt(context) {
1343
+ function buildDiscoveryPrompt(context, runnerMode) {
1324
1344
  const parts = [
1325
1345
  `
1326
1346
  ## Mode: Discovery`,
@@ -1379,10 +1399,10 @@ function buildDiscoveryPrompt(context) {
1379
1399
  `- It does NOT start building \u2014 the team controls when to switch to Build mode`,
1380
1400
  `- Do NOT call ExitPlanMode until you have thoroughly explored the codebase and saved a detailed plan`
1381
1401
  ];
1382
- if (context) parts.push(...buildPropertyInstructions(context));
1402
+ if (context) parts.push(...buildPropertyInstructions(context, runnerMode));
1383
1403
  return parts.join("\n");
1384
1404
  }
1385
- function buildAutoPrompt(context) {
1405
+ function buildAutoPrompt(context, runnerMode) {
1386
1406
  const parts = [
1387
1407
  `
1388
1408
  ## Mode: Auto`,
@@ -1425,13 +1445,13 @@ function buildAutoPrompt(context) {
1425
1445
  `- Only escalate when genuinely blocked (ambiguous requirements, missing access, conflicting instructions)`,
1426
1446
  `- Be thorough in discovery: read relevant files, understand the codebase architecture, then plan`
1427
1447
  ];
1428
- if (context) parts.push(...buildPropertyInstructions(context));
1448
+ if (context) parts.push(...buildPropertyInstructions(context, runnerMode));
1429
1449
  return parts.join("\n");
1430
1450
  }
1431
- function buildModePrompt(agentMode, context) {
1451
+ function buildModePrompt(agentMode, context, runnerMode) {
1432
1452
  switch (agentMode) {
1433
1453
  case "discovery":
1434
- return buildDiscoveryPrompt(context);
1454
+ return buildDiscoveryPrompt(context, runnerMode);
1435
1455
  case "building": {
1436
1456
  const parts = [
1437
1457
  `
@@ -1465,7 +1485,7 @@ function buildModePrompt(agentMode, context) {
1465
1485
  case "review":
1466
1486
  return buildReviewPrompt(context);
1467
1487
  case "auto":
1468
- return buildAutoPrompt(context);
1488
+ return buildAutoPrompt(context, runnerMode);
1469
1489
  default:
1470
1490
  return null;
1471
1491
  }
@@ -1587,14 +1607,6 @@ You are the Project Manager for this set of tasks.`,
1587
1607
  `Use the subtask tools (create_subtask, update_subtask, list_subtasks) to manage work breakdown.`
1588
1608
  );
1589
1609
  }
1590
- if (context.storyPoints && context.storyPoints.length > 0) {
1591
- parts.push(`
1592
- Story Point Tiers:`);
1593
- for (const sp of context.storyPoints) {
1594
- const desc = sp.description ? ` \u2014 ${sp.description}` : "";
1595
- parts.push(`- Value ${sp.value}: "${sp.name}"${desc}`);
1596
- }
1597
- }
1598
1610
  if (context.projectAgents && context.projectAgents.length > 0) {
1599
1611
  parts.push(`
1600
1612
  Project Agents:`);
@@ -1602,14 +1614,6 @@ Project Agents:`);
1602
1614
  parts.push(formatProjectAgentLine(pa));
1603
1615
  }
1604
1616
  }
1605
- if (context.projectObjectives && context.projectObjectives.length > 0) {
1606
- parts.push(`
1607
- Project Objectives:`);
1608
- for (const obj of context.projectObjectives) {
1609
- const dates = `${obj.startDate.split("T")[0]} to ${obj.endDate.split("T")[0]}`;
1610
- parts.push(`- **${obj.name}** (${dates})${obj.description ? ": " + obj.description : ""}`);
1611
- }
1612
- }
1613
1617
  return parts;
1614
1618
  }
1615
1619
  function buildActivePreamble(context, workspaceDir) {
@@ -1736,7 +1740,7 @@ Your responses are sent directly to the task chat \u2014 the team sees everythin
1736
1740
  if (options?.hasDebugTools) {
1737
1741
  parts.push(buildDebugModeSection(options.hypothesisTracker));
1738
1742
  }
1739
- const modePrompt = buildModePrompt(agentMode, context);
1743
+ const modePrompt = buildModePrompt(agentMode, context, mode);
1740
1744
  if (modePrompt) {
1741
1745
  parts.push(modePrompt);
1742
1746
  }
@@ -1744,7 +1748,8 @@ Your responses are sent directly to the task chat \u2014 the team sees everythin
1744
1748
  }
1745
1749
 
1746
1750
  // src/execution/prompt-builder.ts
1747
- var CHAT_HISTORY_LIMIT = 40;
1751
+ var PM_CHAT_HISTORY_LIMIT = 40;
1752
+ var TASK_CHAT_HISTORY_LIMIT = 20;
1748
1753
  function formatFileSize(bytes) {
1749
1754
  if (bytes === void 0) return "";
1750
1755
  if (bytes < 1024) return `${bytes}B`;
@@ -1889,8 +1894,8 @@ function formatTaskFile(file) {
1889
1894
  }
1890
1895
  return [];
1891
1896
  }
1892
- function formatChatHistory(chatHistory) {
1893
- const relevant = chatHistory.slice(-CHAT_HISTORY_LIMIT);
1897
+ function formatChatHistory(chatHistory, limit) {
1898
+ const relevant = chatHistory.slice(-(limit ?? PM_CHAT_HISTORY_LIMIT));
1894
1899
  const parts = [`
1895
1900
  ## Recent Chat Context`];
1896
1901
  for (const msg of relevant) {
@@ -1904,13 +1909,14 @@ function formatChatHistory(chatHistory) {
1904
1909
  }
1905
1910
  return parts;
1906
1911
  }
1907
- async function resolveTaskTagContext(context) {
1912
+ async function resolveTaskTagContext(context, runnerMode) {
1908
1913
  if (!context.projectTags?.length || !context.taskTagIds?.length) return null;
1909
1914
  const { injectedSection } = await resolveTagContext(
1910
1915
  context.projectTags,
1911
1916
  context.taskTagIds,
1912
1917
  context.model,
1913
- context.agentSettings?.betas
1918
+ context.agentSettings?.betas,
1919
+ runnerMode
1914
1920
  );
1915
1921
  return injectedSection || null;
1916
1922
  }
@@ -1966,7 +1972,7 @@ function formatIncidents(incidents) {
1966
1972
  }
1967
1973
  return parts;
1968
1974
  }
1969
- async function buildTaskBody(context) {
1975
+ async function buildTaskBody(context, runnerMode) {
1970
1976
  const parts = [];
1971
1977
  parts.push(`# Task: ${context.title}`);
1972
1978
  if (context.projectName) {
@@ -1995,19 +2001,22 @@ ${context.plan}`);
1995
2001
  if (context.repoRefs && context.repoRefs.length > 0) {
1996
2002
  parts.push(...formatRepoRefs(context.repoRefs));
1997
2003
  }
1998
- const tagSection = await resolveTaskTagContext(context);
2004
+ const tagSection = await resolveTaskTagContext(context, runnerMode);
1999
2005
  if (tagSection) parts.push(tagSection);
2000
- if (context.projectObjectives && context.projectObjectives.length > 0) {
2001
- parts.push(...formatProjectObjectives(context.projectObjectives));
2002
- }
2003
- if (context.recentRelatedTasks && context.recentRelatedTasks.length > 0) {
2004
- parts.push(...formatRecentRelatedTasks(context.recentRelatedTasks));
2006
+ if (runnerMode !== "task") {
2007
+ if (context.projectObjectives && context.projectObjectives.length > 0) {
2008
+ parts.push(...formatProjectObjectives(context.projectObjectives));
2009
+ }
2010
+ if (context.recentRelatedTasks && context.recentRelatedTasks.length > 0) {
2011
+ parts.push(...formatRecentRelatedTasks(context.recentRelatedTasks));
2012
+ }
2005
2013
  }
2006
2014
  if (context.incidents && context.incidents.length > 0) {
2007
2015
  parts.push(...formatIncidents(context.incidents));
2008
2016
  }
2009
2017
  if (context.chatHistory.length > 0) {
2010
- parts.push(...formatChatHistory(context.chatHistory));
2018
+ const chatLimit = runnerMode === "task" ? TASK_CHAT_HISTORY_LIMIT : PM_CHAT_HISTORY_LIMIT;
2019
+ parts.push(...formatChatHistory(context.chatHistory, chatLimit));
2011
2020
  }
2012
2021
  return parts;
2013
2022
  }
@@ -2184,7 +2193,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
2184
2193
  if (isPm && agentMode === "building" && isAuto && !context.claudeSessionId && !context.githubPRUrl && scenario === "idle_relaunch") {
2185
2194
  scenario = "fresh";
2186
2195
  }
2187
- const body = await buildTaskBody(context);
2196
+ const body = await buildTaskBody(context, mode);
2188
2197
  const instructions = isPackRunner ? buildPackRunnerInstructions(context, scenario) : buildInstructions(mode, context, scenario, agentMode, isAuto);
2189
2198
  return [...body, ...instructions].join("\n");
2190
2199
  }
@@ -5803,6 +5812,10 @@ var SessionRunner = class _SessionRunner {
5803
5812
  }
5804
5813
  this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
5805
5814
  this.mode.resolveInitialMode(this.taskContext);
5815
+ if (this.fullContext?.isAuto && this.taskContext.status === "Open" && this.mode.isBuildCapable) {
5816
+ void this.connection.triggerIdentification().catch(() => {
5817
+ });
5818
+ }
5806
5819
  this.queryBridge = this.createQueryBridge();
5807
5820
  this.logInitialization();
5808
5821
  const staleMessageCount = this.pendingMessages.length;
@@ -5995,7 +6008,7 @@ var SessionRunner = class _SessionRunner {
5995
6008
  softStop() {
5996
6009
  this.interrupted = true;
5997
6010
  this.queryBridge?.stop();
5998
- if (this.inputResolver) {
6011
+ if (this.inputResolver && this.pendingMessages.length === 0) {
5999
6012
  const resolver = this.inputResolver;
6000
6013
  this.inputResolver = null;
6001
6014
  resolver(null);
@@ -6147,9 +6160,10 @@ var SessionRunner = class _SessionRunner {
6147
6160
  if (this.fullContext && action.newMode === "review") {
6148
6161
  this.fullContext.claudeSessionId = null;
6149
6162
  }
6150
- if (this.fullContext && action.newMode === "building") {
6163
+ if (this.fullContext && (action.newMode === "building" || action.newMode === "auto" && this.mode.hasExitedPlanMode)) {
6151
6164
  void this.refreshBranchForBuilding();
6152
6165
  }
6166
+ this.completedThisTurn = false;
6153
6167
  this.connection.emitModeChanged(action.newMode);
6154
6168
  this.softStop();
6155
6169
  }
@@ -7281,7 +7295,7 @@ var ProjectRunner = class {
7281
7295
  async handleAuditTasks(request) {
7282
7296
  this.connection.emitStatus("busy");
7283
7297
  try {
7284
- const { handleTaskAudit } = await import("./task-audit-handler-UL4HXCE4.js");
7298
+ const { handleTaskAudit } = await import("./task-audit-handler-LH35J3TX.js");
7285
7299
  await handleTaskAudit(request, this.connection, this.projectDir);
7286
7300
  } catch (error) {
7287
7301
  const msg = error instanceof Error ? error.message : String(error);
@@ -7726,4 +7740,4 @@ export {
7726
7740
  loadForwardPorts,
7727
7741
  loadConveyorConfig
7728
7742
  };
7729
- //# sourceMappingURL=chunk-N66QQFXY.js.map
7743
+ //# sourceMappingURL=chunk-AS3FYEBJ.js.map