@rallycry/conveyor-agent 4.6.0 → 4.7.1

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.
@@ -498,6 +498,9 @@ import { existsSync } from "fs";
498
498
  import { join } from "path";
499
499
  var WORKTREE_DIR = ".worktrees";
500
500
  function ensureWorktree(projectDir, taskId, branch) {
501
+ if (projectDir.includes(`/${WORKTREE_DIR}/`)) {
502
+ return projectDir;
503
+ }
501
504
  const worktreePath = join(projectDir, WORKTREE_DIR, taskId);
502
505
  if (existsSync(worktreePath)) {
503
506
  if (branch) {
@@ -674,7 +677,8 @@ function handleSuccessResult(event, host, context, startTime) {
674
677
  let queryInputTokens = 0;
675
678
  let contextWindow = 0;
676
679
  for (const data of Object.values(modelUsage)) {
677
- queryInputTokens += data.inputTokens ?? 0;
680
+ const d = data;
681
+ queryInputTokens += (d.inputTokens ?? 0) + (d.cacheReadInputTokens ?? 0) + (d.cacheCreationInputTokens ?? 0);
678
682
  const cw = data.contextWindow ?? 0;
679
683
  if (cw > contextWindow) contextWindow = cw;
680
684
  }
@@ -2075,11 +2079,11 @@ function getModeTools(agentMode, connection, config, context) {
2075
2079
  return config.mode === "pm" ? buildPmTools(connection, context?.storyPoints, { includePackTools: false }) : buildTaskTools(connection);
2076
2080
  }
2077
2081
  }
2078
- function createConveyorMcpServer(connection, config, context) {
2082
+ function createConveyorMcpServer(connection, config, context, agentMode) {
2079
2083
  const commonTools = buildCommonTools(connection, config);
2080
- const agentMode = context?.agentMode ?? void 0;
2081
- const modeTools = getModeTools(agentMode, connection, config, context);
2082
- const discoveryTools = agentMode === "discovery" || agentMode === "auto" ? buildDiscoveryTools(connection, context) : [];
2084
+ const effectiveMode = agentMode ?? context?.agentMode ?? void 0;
2085
+ const modeTools = getModeTools(effectiveMode, connection, config, context);
2086
+ const discoveryTools = effectiveMode === "discovery" || effectiveMode === "auto" ? buildDiscoveryTools(connection, context) : [];
2083
2087
  return createSdkMcpServer({
2084
2088
  name: "conveyor",
2085
2089
  tools: [...commonTools, ...modeTools, ...discoveryTools]
@@ -2322,7 +2326,7 @@ function buildQueryOptions(host, context) {
2322
2326
  allowDangerouslySkipPermissions: !needsCanUseTool,
2323
2327
  canUseTool: buildCanUseTool(host),
2324
2328
  tools: { type: "preset", preset: "claude_code" },
2325
- mcpServers: { conveyor: createConveyorMcpServer(host.connection, host.config, context) },
2329
+ mcpServers: { conveyor: createConveyorMcpServer(host.connection, host.config, context, mode) },
2326
2330
  hooks: buildHooks(host),
2327
2331
  maxTurns: settings.maxTurns,
2328
2332
  effort: settings.effort,
@@ -3043,7 +3047,7 @@ var AgentRunner = class {
3043
3047
  return true;
3044
3048
  }
3045
3049
  tryPostContextWorktree() {
3046
- if (process.env.CODESPACES !== "true" && !this.worktreeActive && this.taskContext?.useWorktree) {
3050
+ if (process.env.CODESPACES !== "true" && process.env.CONVEYOR_USE_WORKTREE !== "false" && !this.worktreeActive && this.taskContext?.useWorktree) {
3047
3051
  this.activateWorktree("[conveyor] Using worktree (from task config):");
3048
3052
  }
3049
3053
  }
@@ -3773,4 +3777,4 @@ export {
3773
3777
  ProjectRunner,
3774
3778
  FileCache
3775
3779
  };
3776
- //# sourceMappingURL=chunk-XG5DMOJX.js.map
3780
+ //# sourceMappingURL=chunk-EBCQISOA.js.map