@rallycry/conveyor-agent 7.1.8 → 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.
- package/dist/{chunk-WUBCS4RB.js → chunk-LEZ6E6OZ.js} +91 -8
- package/dist/chunk-LEZ6E6OZ.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +1 -1
- package/dist/{tag-audit-handler-WPGSBNXO.js → tag-audit-handler-ZJYIOGCJ.js} +2 -2
- package/dist/tag-audit-handler-ZJYIOGCJ.js.map +1 -0
- package/dist/{task-audit-handler-AOYSFO5B.js → task-audit-handler-UL4HXCE4.js} +52 -6
- package/dist/task-audit-handler-UL4HXCE4.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-WUBCS4RB.js.map +0 -1
- package/dist/tag-audit-handler-WPGSBNXO.js.map +0 -1
- package/dist/task-audit-handler-AOYSFO5B.js.map +0 -1
|
@@ -555,6 +555,15 @@ var ModeController = class {
|
|
|
555
555
|
this._hasExitedPlanMode = true;
|
|
556
556
|
return { type: "restart_query", newMode: "building" };
|
|
557
557
|
}
|
|
558
|
+
if (this._runnerMode === "task" && newMode === "auto") {
|
|
559
|
+
this._mode = newMode;
|
|
560
|
+
this._hasExitedPlanMode = true;
|
|
561
|
+
return { type: "restart_query", newMode: "auto" };
|
|
562
|
+
}
|
|
563
|
+
if (this._mode === "auto" && this._hasExitedPlanMode && newMode === "building") {
|
|
564
|
+
this._mode = newMode;
|
|
565
|
+
return { type: "noop" };
|
|
566
|
+
}
|
|
558
567
|
if (this._runnerMode !== "pm") return { type: "noop" };
|
|
559
568
|
this._mode = newMode;
|
|
560
569
|
this.updateExitedPlanModeFlag(newMode);
|
|
@@ -589,12 +598,14 @@ var ModeController = class {
|
|
|
589
598
|
// src/runner/lifecycle.ts
|
|
590
599
|
var DEFAULT_LIFECYCLE_CONFIG = {
|
|
591
600
|
idleTimeoutMs: 30 * 60 * 1e3,
|
|
592
|
-
heartbeatIntervalMs: 3e4
|
|
601
|
+
heartbeatIntervalMs: 3e4,
|
|
602
|
+
tokenRefreshIntervalMs: 45 * 60 * 1e3
|
|
593
603
|
};
|
|
594
604
|
var Lifecycle = class {
|
|
595
605
|
config;
|
|
596
606
|
callbacks;
|
|
597
607
|
heartbeatTimer = null;
|
|
608
|
+
tokenRefreshTimer = null;
|
|
598
609
|
idleTimer = null;
|
|
599
610
|
idleCheckInterval = null;
|
|
600
611
|
constructor(config, callbacks) {
|
|
@@ -614,6 +625,19 @@ var Lifecycle = class {
|
|
|
614
625
|
this.heartbeatTimer = null;
|
|
615
626
|
}
|
|
616
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
|
+
}
|
|
617
641
|
// ── Idle timer ─────────────────────────────────────────────────────
|
|
618
642
|
startIdleTimer() {
|
|
619
643
|
this.clearIdleTimers();
|
|
@@ -627,6 +651,7 @@ var Lifecycle = class {
|
|
|
627
651
|
// ── Cleanup ────────────────────────────────────────────────────────
|
|
628
652
|
destroy() {
|
|
629
653
|
this.stopHeartbeat();
|
|
654
|
+
this.stopTokenRefresh();
|
|
630
655
|
this.clearIdleTimers();
|
|
631
656
|
}
|
|
632
657
|
// ── Private ────────────────────────────────────────────────────────
|
|
@@ -1881,6 +1906,31 @@ function formatRepoRefs(repoRefs) {
|
|
|
1881
1906
|
}
|
|
1882
1907
|
return parts;
|
|
1883
1908
|
}
|
|
1909
|
+
function formatProjectObjectives(objectives) {
|
|
1910
|
+
const parts = [];
|
|
1911
|
+
parts.push(`
|
|
1912
|
+
## Project Objectives`);
|
|
1913
|
+
for (const obj of objectives) {
|
|
1914
|
+
const dates = `${obj.startDate.split("T")[0]} to ${obj.endDate.split("T")[0]}`;
|
|
1915
|
+
parts.push(`- **${obj.name}** (${dates})${obj.description ? ": " + obj.description : ""}`);
|
|
1916
|
+
}
|
|
1917
|
+
return parts;
|
|
1918
|
+
}
|
|
1919
|
+
function formatRecentRelatedTasks(tasks) {
|
|
1920
|
+
const parts = [];
|
|
1921
|
+
parts.push(`
|
|
1922
|
+
## Recently Completed Related Tasks`);
|
|
1923
|
+
parts.push(
|
|
1924
|
+
`These tasks in the same domain were recently completed. Use them for context on recent changes and patterns.
|
|
1925
|
+
`
|
|
1926
|
+
);
|
|
1927
|
+
for (const task of tasks) {
|
|
1928
|
+
const tags = task.tagNames.length > 0 ? ` [${task.tagNames.join(", ")}]` : "";
|
|
1929
|
+
const pr = task.githubPRUrl ? ` \u2014 PR: ${task.githubPRUrl}` : "";
|
|
1930
|
+
parts.push(`- **${task.title}**${tags}${pr}`);
|
|
1931
|
+
}
|
|
1932
|
+
return parts;
|
|
1933
|
+
}
|
|
1884
1934
|
function formatIncidents(incidents) {
|
|
1885
1935
|
const parts = [];
|
|
1886
1936
|
parts.push(`
|
|
@@ -1929,6 +1979,12 @@ ${context.plan}`);
|
|
|
1929
1979
|
}
|
|
1930
1980
|
const tagSection = await resolveTaskTagContext(context);
|
|
1931
1981
|
if (tagSection) parts.push(tagSection);
|
|
1982
|
+
if (context.projectObjectives && context.projectObjectives.length > 0) {
|
|
1983
|
+
parts.push(...formatProjectObjectives(context.projectObjectives));
|
|
1984
|
+
}
|
|
1985
|
+
if (context.recentRelatedTasks && context.recentRelatedTasks.length > 0) {
|
|
1986
|
+
parts.push(...formatRecentRelatedTasks(context.recentRelatedTasks));
|
|
1987
|
+
}
|
|
1932
1988
|
if (context.incidents && context.incidents.length > 0) {
|
|
1933
1989
|
parts.push(...formatIncidents(context.incidents));
|
|
1934
1990
|
}
|
|
@@ -2985,16 +3041,18 @@ function buildDiscoveryTools(connection) {
|
|
|
2985
3041
|
title: z3.string().optional().describe("The new task title"),
|
|
2986
3042
|
storyPointValue: z3.number().optional().describe(SP_DESCRIPTION2),
|
|
2987
3043
|
tagIds: z3.array(z3.string()).optional().describe("Array of tag IDs to assign"),
|
|
2988
|
-
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')")
|
|
2989
3046
|
},
|
|
2990
|
-
async ({ title, storyPointValue, tagIds, githubPRUrl }) => {
|
|
3047
|
+
async ({ title, storyPointValue, tagIds, githubPRUrl, githubBranch }) => {
|
|
2991
3048
|
try {
|
|
2992
3049
|
await connection.call("updateTaskProperties", {
|
|
2993
3050
|
sessionId: connection.sessionId,
|
|
2994
3051
|
title,
|
|
2995
3052
|
storyPointValue,
|
|
2996
3053
|
tagIds,
|
|
2997
|
-
githubPRUrl
|
|
3054
|
+
githubPRUrl,
|
|
3055
|
+
githubBranch
|
|
2998
3056
|
});
|
|
2999
3057
|
const updatedFields = [];
|
|
3000
3058
|
if (title !== void 0) updatedFields.push(`title to "${title}"`);
|
|
@@ -3002,6 +3060,7 @@ function buildDiscoveryTools(connection) {
|
|
|
3002
3060
|
updatedFields.push(`story points to ${storyPointValue}`);
|
|
3003
3061
|
if (tagIds !== void 0) updatedFields.push(`tags (${tagIds.length} tag(s))`);
|
|
3004
3062
|
if (githubPRUrl !== void 0) updatedFields.push(`PR link to "${githubPRUrl}"`);
|
|
3063
|
+
if (githubBranch !== void 0) updatedFields.push(`branch to "${githubBranch}"`);
|
|
3005
3064
|
return textResult(`Task properties updated: ${updatedFields.join(", ")}`);
|
|
3006
3065
|
} catch (error) {
|
|
3007
3066
|
return textResult(
|
|
@@ -5624,7 +5683,8 @@ var SessionRunner = class _SessionRunner {
|
|
|
5624
5683
|
this.inputResolver = null;
|
|
5625
5684
|
resolver(null);
|
|
5626
5685
|
}
|
|
5627
|
-
}
|
|
5686
|
+
},
|
|
5687
|
+
onTokenRefresh: () => void this.refreshGithubToken()
|
|
5628
5688
|
});
|
|
5629
5689
|
}
|
|
5630
5690
|
get state() {
|
|
@@ -5649,6 +5709,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
5649
5709
|
this.connection.sendEvent({ type: "connected", sessionId: this.sessionId });
|
|
5650
5710
|
this.wireConnectionCallbacks();
|
|
5651
5711
|
this.lifecycle.startHeartbeat();
|
|
5712
|
+
this.lifecycle.startTokenRefresh();
|
|
5652
5713
|
const { pendingMessages: serverMessages } = await this.connection.call("connectAgent", {
|
|
5653
5714
|
sessionId: this.sessionId
|
|
5654
5715
|
});
|
|
@@ -5953,6 +6014,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
5953
6014
|
taskTagIds: ctx.taskTagIds ?? void 0,
|
|
5954
6015
|
projectObjectives: ctx.projectObjectives ?? void 0,
|
|
5955
6016
|
incidents: ctx.incidents ?? void 0,
|
|
6017
|
+
recentRelatedTasks: ctx.recentRelatedTasks ?? void 0,
|
|
5956
6018
|
agentSettings: ctx.agentSettings ?? null,
|
|
5957
6019
|
agentMode: ctx.agentMode ?? void 0,
|
|
5958
6020
|
isAuto: ctx.isAuto
|
|
@@ -6026,6 +6088,22 @@ var SessionRunner = class _SessionRunner {
|
|
|
6026
6088
|
}
|
|
6027
6089
|
});
|
|
6028
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
|
+
}
|
|
6029
6107
|
/** Re-fetch task context to pick up a newly created branch and check it out. */
|
|
6030
6108
|
async refreshBranchForBuilding() {
|
|
6031
6109
|
try {
|
|
@@ -7104,7 +7182,7 @@ var ProjectRunner = class {
|
|
|
7104
7182
|
async handleAuditTags(request) {
|
|
7105
7183
|
this.connection.emitStatus("busy");
|
|
7106
7184
|
try {
|
|
7107
|
-
const { handleTagAudit } = await import("./tag-audit-handler-
|
|
7185
|
+
const { handleTagAudit } = await import("./tag-audit-handler-ZJYIOGCJ.js");
|
|
7108
7186
|
await handleTagAudit(request, this.connection, this.projectDir);
|
|
7109
7187
|
} catch (error) {
|
|
7110
7188
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -7127,7 +7205,7 @@ var ProjectRunner = class {
|
|
|
7127
7205
|
async handleAuditTasks(request) {
|
|
7128
7206
|
this.connection.emitStatus("busy");
|
|
7129
7207
|
try {
|
|
7130
|
-
const { handleTaskAudit } = await import("./task-audit-handler-
|
|
7208
|
+
const { handleTaskAudit } = await import("./task-audit-handler-UL4HXCE4.js");
|
|
7131
7209
|
await handleTaskAudit(request, this.connection, this.projectDir);
|
|
7132
7210
|
} catch (error) {
|
|
7133
7211
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -7160,6 +7238,11 @@ var ProjectRunner = class {
|
|
|
7160
7238
|
} catch {
|
|
7161
7239
|
}
|
|
7162
7240
|
}
|
|
7241
|
+
await this.connection.call("reportTaskAuditBatchComplete", {
|
|
7242
|
+
projectId: this.connection.projectId,
|
|
7243
|
+
requestId: request.requestId
|
|
7244
|
+
}).catch(() => {
|
|
7245
|
+
});
|
|
7163
7246
|
} finally {
|
|
7164
7247
|
this.connection.emitStatus("idle");
|
|
7165
7248
|
}
|
|
@@ -7567,4 +7650,4 @@ export {
|
|
|
7567
7650
|
loadForwardPorts,
|
|
7568
7651
|
loadConveyorConfig
|
|
7569
7652
|
};
|
|
7570
|
-
//# sourceMappingURL=chunk-
|
|
7653
|
+
//# sourceMappingURL=chunk-LEZ6E6OZ.js.map
|