@rallycry/conveyor-agent 4.7.0 → 4.8.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-F4RQRSK6.js → chunk-OYP5REKO.js} +111 -7
- package/dist/chunk-OYP5REKO.js.map +1 -0
- package/dist/cli.js +22 -16
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-F4RQRSK6.js.map +0 -1
|
@@ -93,6 +93,12 @@ function getTaskProperties(socket) {
|
|
|
93
93
|
function triggerIdentification(socket) {
|
|
94
94
|
return emitRpc(requireSocket(socket), "agentRunner:triggerIdentification", {});
|
|
95
95
|
}
|
|
96
|
+
function searchIncidents(socket, status, source) {
|
|
97
|
+
return emitRpc(requireSocket(socket), "agentRunner:searchIncidents", { status, source });
|
|
98
|
+
}
|
|
99
|
+
function getTaskIncidents(socket, taskId) {
|
|
100
|
+
return emitRpc(requireSocket(socket), "agentRunner:getTaskIncidents", { taskId });
|
|
101
|
+
}
|
|
96
102
|
|
|
97
103
|
// src/connection/task-connection.ts
|
|
98
104
|
var ConveyorConnection = class _ConveyorConnection {
|
|
@@ -335,6 +341,12 @@ var ConveyorConnection = class _ConveyorConnection {
|
|
|
335
341
|
if (!this.socket) return;
|
|
336
342
|
this.socket.emit("agentRunner:modeTransition", payload);
|
|
337
343
|
}
|
|
344
|
+
searchIncidents(status, source) {
|
|
345
|
+
return searchIncidents(this.socket, status, source);
|
|
346
|
+
}
|
|
347
|
+
getTaskIncidents(taskId) {
|
|
348
|
+
return getTaskIncidents(this.socket, taskId);
|
|
349
|
+
}
|
|
338
350
|
disconnect() {
|
|
339
351
|
this.flushEvents();
|
|
340
352
|
this.socket?.disconnect();
|
|
@@ -676,16 +688,34 @@ function handleSuccessResult(event, host, context, startTime) {
|
|
|
676
688
|
if (modelUsage && typeof modelUsage === "object") {
|
|
677
689
|
let queryInputTokens = 0;
|
|
678
690
|
let contextWindow = 0;
|
|
691
|
+
let totalInputTokens = 0;
|
|
692
|
+
let totalCacheRead = 0;
|
|
693
|
+
let totalCacheCreation = 0;
|
|
679
694
|
for (const data of Object.values(modelUsage)) {
|
|
680
|
-
|
|
695
|
+
const d = data;
|
|
696
|
+
const input = d.inputTokens ?? 0;
|
|
697
|
+
const cacheRead = d.cacheReadInputTokens ?? 0;
|
|
698
|
+
const cacheCreation = d.cacheCreationInputTokens ?? 0;
|
|
699
|
+
totalInputTokens += input;
|
|
700
|
+
totalCacheRead += cacheRead;
|
|
701
|
+
totalCacheCreation += cacheCreation;
|
|
702
|
+
queryInputTokens += input + cacheRead + cacheCreation;
|
|
681
703
|
const cw = data.contextWindow ?? 0;
|
|
682
704
|
if (cw > contextWindow) contextWindow = cw;
|
|
683
705
|
}
|
|
706
|
+
const settings = context.agentSettings ?? host.config.agentSettings ?? {};
|
|
707
|
+
const has1mBeta = settings.betas?.includes("context-1m-2025-08-07");
|
|
708
|
+
if (has1mBeta && contextWindow > 0 && contextWindow <= 2e5) {
|
|
709
|
+
contextWindow = 1e6;
|
|
710
|
+
}
|
|
684
711
|
if (contextWindow > 0) {
|
|
685
712
|
host.connection.sendEvent({
|
|
686
713
|
type: "context_update",
|
|
687
714
|
contextTokens: queryInputTokens,
|
|
688
|
-
contextWindow
|
|
715
|
+
contextWindow,
|
|
716
|
+
inputTokens: totalInputTokens,
|
|
717
|
+
cacheReadInputTokens: totalCacheRead,
|
|
718
|
+
cacheCreationInputTokens: totalCacheCreation
|
|
689
719
|
});
|
|
690
720
|
}
|
|
691
721
|
}
|
|
@@ -1392,7 +1422,11 @@ function buildFreshInstructions(isPm, isAutoMode, context, agentMode) {
|
|
|
1392
1422
|
`Your plan has been approved. Begin implementing it now.`,
|
|
1393
1423
|
`Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
|
|
1394
1424
|
`Start by reading the relevant source files mentioned in the plan, then write code.`,
|
|
1395
|
-
`When finished, commit and push your changes, then use the create_pull_request tool to open a PR. Do NOT use gh CLI
|
|
1425
|
+
`When finished, commit and push your changes, then use the create_pull_request tool to open a PR. Do NOT use gh CLI.`,
|
|
1426
|
+
...isAutoMode ? [
|
|
1427
|
+
`
|
|
1428
|
+
IMPORTANT: You are in Auto mode. You MUST create a pull request using create_pull_request before finishing. Do NOT declare the task complete or go idle without opening a PR. If you are blocked from creating a PR, explain what is blocking you.`
|
|
1429
|
+
] : []
|
|
1396
1430
|
];
|
|
1397
1431
|
}
|
|
1398
1432
|
if (isAutoMode && isPm) {
|
|
@@ -1730,6 +1764,47 @@ function buildGetTaskFileTool(connection) {
|
|
|
1730
1764
|
{ annotations: { readOnlyHint: true } }
|
|
1731
1765
|
);
|
|
1732
1766
|
}
|
|
1767
|
+
function buildSearchIncidentsTool(connection) {
|
|
1768
|
+
return tool(
|
|
1769
|
+
"search_incidents",
|
|
1770
|
+
"Search incidents in the current project. Optionally filter by status (Open, Acknowledged, Investigating, Resolved, Closed) or source.",
|
|
1771
|
+
{
|
|
1772
|
+
status: z.string().optional().describe("Filter by incident status"),
|
|
1773
|
+
source: z.string().optional().describe("Filter by source (e.g., 'conveyor', 'agent', 'build')")
|
|
1774
|
+
},
|
|
1775
|
+
async ({ status, source }) => {
|
|
1776
|
+
try {
|
|
1777
|
+
const incidents = await connection.searchIncidents(status, source);
|
|
1778
|
+
return textResult(JSON.stringify(incidents, null, 2));
|
|
1779
|
+
} catch (error) {
|
|
1780
|
+
return textResult(
|
|
1781
|
+
`Failed to search incidents: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1782
|
+
);
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
{ annotations: { readOnlyHint: true } }
|
|
1786
|
+
);
|
|
1787
|
+
}
|
|
1788
|
+
function buildGetTaskIncidentsTool(connection) {
|
|
1789
|
+
return tool(
|
|
1790
|
+
"get_task_incidents",
|
|
1791
|
+
"Get all incidents linked to the current task (or a specified task). Returns full incident details including title, description, severity, status, and source.",
|
|
1792
|
+
{
|
|
1793
|
+
task_id: z.string().optional().describe("Task ID (defaults to current task)")
|
|
1794
|
+
},
|
|
1795
|
+
async ({ task_id }) => {
|
|
1796
|
+
try {
|
|
1797
|
+
const incidents = await connection.getTaskIncidents(task_id);
|
|
1798
|
+
return textResult(JSON.stringify(incidents, null, 2));
|
|
1799
|
+
} catch (error) {
|
|
1800
|
+
return textResult(
|
|
1801
|
+
`Failed to get task incidents: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1802
|
+
);
|
|
1803
|
+
}
|
|
1804
|
+
},
|
|
1805
|
+
{ annotations: { readOnlyHint: true } }
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1733
1808
|
function buildCommonTools(connection, config) {
|
|
1734
1809
|
return [
|
|
1735
1810
|
buildReadTaskChatTool(connection),
|
|
@@ -1739,7 +1814,9 @@ function buildCommonTools(connection, config) {
|
|
|
1739
1814
|
buildGetTaskTool(connection),
|
|
1740
1815
|
buildGetTaskCliTool(connection),
|
|
1741
1816
|
buildListTaskFilesTool(connection),
|
|
1742
|
-
buildGetTaskFileTool(connection)
|
|
1817
|
+
buildGetTaskFileTool(connection),
|
|
1818
|
+
buildSearchIncidentsTool(connection),
|
|
1819
|
+
buildGetTaskIncidentsTool(connection)
|
|
1743
1820
|
];
|
|
1744
1821
|
}
|
|
1745
1822
|
|
|
@@ -2934,6 +3011,7 @@ var AgentRunner = class {
|
|
|
2934
3011
|
sessionIds = /* @__PURE__ */ new Map();
|
|
2935
3012
|
lastQueryModeRestart = false;
|
|
2936
3013
|
startCommandStarted = false;
|
|
3014
|
+
nudgedForPR = false;
|
|
2937
3015
|
idleTimer = null;
|
|
2938
3016
|
idleCheckInterval = null;
|
|
2939
3017
|
deferredStartConfig = null;
|
|
@@ -3076,6 +3154,26 @@ var AgentRunner = class {
|
|
|
3076
3154
|
} catch {
|
|
3077
3155
|
}
|
|
3078
3156
|
}
|
|
3157
|
+
async maybeSendPRNudge() {
|
|
3158
|
+
if (!this.config.isAuto || this.nudgedForPR || this.stopped) return false;
|
|
3159
|
+
const fresh = await this.connection.fetchTaskContext().catch(() => null);
|
|
3160
|
+
if (fresh) this.taskContext = fresh;
|
|
3161
|
+
const status = this.taskContext?.status;
|
|
3162
|
+
const hasPR = !!this.taskContext?.githubPRUrl;
|
|
3163
|
+
if (status === "InProgress" && !hasPR) {
|
|
3164
|
+
this.nudgedForPR = true;
|
|
3165
|
+
this.connection.postChatMessage(
|
|
3166
|
+
"Auto-nudge: Task is still In Progress with no PR. Prompting agent to continue..."
|
|
3167
|
+
);
|
|
3168
|
+
await this.setState("running");
|
|
3169
|
+
await this.runQuerySafe(
|
|
3170
|
+
this.taskContext,
|
|
3171
|
+
"You are in Auto mode and your task is still In Progress with no pull request. You MUST create a pull request before finishing. Use the create_pull_request tool now to open a PR for your changes. If you are blocked, explain what is preventing you from creating a PR."
|
|
3172
|
+
);
|
|
3173
|
+
return true;
|
|
3174
|
+
}
|
|
3175
|
+
return false;
|
|
3176
|
+
}
|
|
3079
3177
|
async executeInitialMode() {
|
|
3080
3178
|
if (!this.taskContext) return;
|
|
3081
3179
|
const mode = this.effectiveAgentMode;
|
|
@@ -3083,7 +3181,10 @@ var AgentRunner = class {
|
|
|
3083
3181
|
if (shouldRun) {
|
|
3084
3182
|
await this.setState("running");
|
|
3085
3183
|
await this.runQuerySafe(this.taskContext);
|
|
3086
|
-
if (!this.stopped
|
|
3184
|
+
if (!this.stopped && this._state !== "error") {
|
|
3185
|
+
const nudged = await this.maybeSendPRNudge();
|
|
3186
|
+
if (!nudged) await this.setState("idle");
|
|
3187
|
+
}
|
|
3087
3188
|
} else {
|
|
3088
3189
|
await this.setState("idle");
|
|
3089
3190
|
}
|
|
@@ -3122,7 +3223,10 @@ var AgentRunner = class {
|
|
|
3122
3223
|
}
|
|
3123
3224
|
);
|
|
3124
3225
|
this.taskContext = await this.connection.fetchTaskContext().catch(() => null) ?? this.taskContext;
|
|
3125
|
-
if (!this.stopped && this._state !== "error")
|
|
3226
|
+
if (!this.stopped && this._state !== "error") {
|
|
3227
|
+
const nudged = await this.maybeSendPRNudge();
|
|
3228
|
+
if (!nudged) await this.setState("idle");
|
|
3229
|
+
}
|
|
3126
3230
|
continue;
|
|
3127
3231
|
}
|
|
3128
3232
|
if (this._state === "idle") {
|
|
@@ -3776,4 +3880,4 @@ export {
|
|
|
3776
3880
|
ProjectRunner,
|
|
3777
3881
|
FileCache
|
|
3778
3882
|
};
|
|
3779
|
-
//# sourceMappingURL=chunk-
|
|
3883
|
+
//# sourceMappingURL=chunk-OYP5REKO.js.map
|