@rallycry/conveyor-agent 7.1.9 → 7.2.0

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.
@@ -598,12 +598,14 @@ var ModeController = class {
598
598
  // src/runner/lifecycle.ts
599
599
  var DEFAULT_LIFECYCLE_CONFIG = {
600
600
  idleTimeoutMs: 30 * 60 * 1e3,
601
- heartbeatIntervalMs: 3e4
601
+ heartbeatIntervalMs: 3e4,
602
+ tokenRefreshIntervalMs: 45 * 60 * 1e3
602
603
  };
603
604
  var Lifecycle = class {
604
605
  config;
605
606
  callbacks;
606
607
  heartbeatTimer = null;
608
+ tokenRefreshTimer = null;
607
609
  idleTimer = null;
608
610
  idleCheckInterval = null;
609
611
  constructor(config, callbacks) {
@@ -623,6 +625,19 @@ var Lifecycle = class {
623
625
  this.heartbeatTimer = null;
624
626
  }
625
627
  }
628
+ // ── Token refresh ─────────────────────────────────────────────────
629
+ startTokenRefresh() {
630
+ this.stopTokenRefresh();
631
+ this.tokenRefreshTimer = setInterval(() => {
632
+ this.callbacks.onTokenRefresh();
633
+ }, this.config.tokenRefreshIntervalMs);
634
+ }
635
+ stopTokenRefresh() {
636
+ if (this.tokenRefreshTimer) {
637
+ clearInterval(this.tokenRefreshTimer);
638
+ this.tokenRefreshTimer = null;
639
+ }
640
+ }
626
641
  // ── Idle timer ─────────────────────────────────────────────────────
627
642
  startIdleTimer() {
628
643
  this.clearIdleTimers();
@@ -636,6 +651,7 @@ var Lifecycle = class {
636
651
  // ── Cleanup ────────────────────────────────────────────────────────
637
652
  destroy() {
638
653
  this.stopHeartbeat();
654
+ this.stopTokenRefresh();
639
655
  this.clearIdleTimers();
640
656
  }
641
657
  // ── Private ────────────────────────────────────────────────────────
@@ -3025,16 +3041,18 @@ function buildDiscoveryTools(connection) {
3025
3041
  title: z3.string().optional().describe("The new task title"),
3026
3042
  storyPointValue: z3.number().optional().describe(SP_DESCRIPTION2),
3027
3043
  tagIds: z3.array(z3.string()).optional().describe("Array of tag IDs to assign"),
3028
- githubPRUrl: z3.string().url().optional().describe("GitHub pull request URL to link to this task")
3044
+ githubPRUrl: z3.string().url().optional().describe("GitHub pull request URL to link to this task"),
3045
+ githubBranch: z3.string().optional().describe("Set the GitHub branch name for this task (e.g. 'conveyor/my-feature-abc123')")
3029
3046
  },
3030
- async ({ title, storyPointValue, tagIds, githubPRUrl }) => {
3047
+ async ({ title, storyPointValue, tagIds, githubPRUrl, githubBranch }) => {
3031
3048
  try {
3032
3049
  await connection.call("updateTaskProperties", {
3033
3050
  sessionId: connection.sessionId,
3034
3051
  title,
3035
3052
  storyPointValue,
3036
3053
  tagIds,
3037
- githubPRUrl
3054
+ githubPRUrl,
3055
+ githubBranch
3038
3056
  });
3039
3057
  const updatedFields = [];
3040
3058
  if (title !== void 0) updatedFields.push(`title to "${title}"`);
@@ -3042,6 +3060,7 @@ function buildDiscoveryTools(connection) {
3042
3060
  updatedFields.push(`story points to ${storyPointValue}`);
3043
3061
  if (tagIds !== void 0) updatedFields.push(`tags (${tagIds.length} tag(s))`);
3044
3062
  if (githubPRUrl !== void 0) updatedFields.push(`PR link to "${githubPRUrl}"`);
3063
+ if (githubBranch !== void 0) updatedFields.push(`branch to "${githubBranch}"`);
3045
3064
  return textResult(`Task properties updated: ${updatedFields.join(", ")}`);
3046
3065
  } catch (error) {
3047
3066
  return textResult(
@@ -5664,7 +5683,8 @@ var SessionRunner = class _SessionRunner {
5664
5683
  this.inputResolver = null;
5665
5684
  resolver(null);
5666
5685
  }
5667
- }
5686
+ },
5687
+ onTokenRefresh: () => void this.refreshGithubToken()
5668
5688
  });
5669
5689
  }
5670
5690
  get state() {
@@ -5689,6 +5709,7 @@ var SessionRunner = class _SessionRunner {
5689
5709
  this.connection.sendEvent({ type: "connected", sessionId: this.sessionId });
5690
5710
  this.wireConnectionCallbacks();
5691
5711
  this.lifecycle.startHeartbeat();
5712
+ this.lifecycle.startTokenRefresh();
5692
5713
  const { pendingMessages: serverMessages } = await this.connection.call("connectAgent", {
5693
5714
  sessionId: this.sessionId
5694
5715
  });
@@ -6067,6 +6088,22 @@ var SessionRunner = class _SessionRunner {
6067
6088
  }
6068
6089
  });
6069
6090
  }
6091
+ /** Proactively refresh the GitHub token before the 1-hour expiry. */
6092
+ async refreshGithubToken() {
6093
+ try {
6094
+ const res = await this.connection.call("refreshGithubToken", {
6095
+ sessionId: this.connection.sessionId
6096
+ });
6097
+ updateRemoteToken(this.config.workspaceDir, res.token);
6098
+ process.env.GITHUB_TOKEN = res.token;
6099
+ process.env.GH_TOKEN = res.token;
6100
+ process.stderr.write("[conveyor-agent] Proactively refreshed GitHub token\n");
6101
+ } catch (err) {
6102
+ const msg = err instanceof Error ? err.message : String(err);
6103
+ process.stderr.write(`[conveyor-agent] Warning: proactive token refresh failed: ${msg}
6104
+ `);
6105
+ }
6106
+ }
6070
6107
  /** Re-fetch task context to pick up a newly created branch and check it out. */
6071
6108
  async refreshBranchForBuilding() {
6072
6109
  try {
@@ -7145,7 +7182,7 @@ var ProjectRunner = class {
7145
7182
  async handleAuditTags(request) {
7146
7183
  this.connection.emitStatus("busy");
7147
7184
  try {
7148
- const { handleTagAudit } = await import("./tag-audit-handler-WPGSBNXO.js");
7185
+ const { handleTagAudit } = await import("./tag-audit-handler-ZJYIOGCJ.js");
7149
7186
  await handleTagAudit(request, this.connection, this.projectDir);
7150
7187
  } catch (error) {
7151
7188
  const msg = error instanceof Error ? error.message : String(error);
@@ -7168,7 +7205,7 @@ var ProjectRunner = class {
7168
7205
  async handleAuditTasks(request) {
7169
7206
  this.connection.emitStatus("busy");
7170
7207
  try {
7171
- const { handleTaskAudit } = await import("./task-audit-handler-AOYSFO5B.js");
7208
+ const { handleTaskAudit } = await import("./task-audit-handler-UL4HXCE4.js");
7172
7209
  await handleTaskAudit(request, this.connection, this.projectDir);
7173
7210
  } catch (error) {
7174
7211
  const msg = error instanceof Error ? error.message : String(error);
@@ -7201,6 +7238,11 @@ var ProjectRunner = class {
7201
7238
  } catch {
7202
7239
  }
7203
7240
  }
7241
+ await this.connection.call("reportTaskAuditBatchComplete", {
7242
+ projectId: this.connection.projectId,
7243
+ requestId: request.requestId
7244
+ }).catch(() => {
7245
+ });
7204
7246
  } finally {
7205
7247
  this.connection.emitStatus("idle");
7206
7248
  }
@@ -7608,4 +7650,4 @@ export {
7608
7650
  loadForwardPorts,
7609
7651
  loadConveyorConfig
7610
7652
  };
7611
- //# sourceMappingURL=chunk-5CGROG7V.js.map
7653
+ //# sourceMappingURL=chunk-LEZ6E6OZ.js.map