@rallycry/conveyor-agent 4.7.1 → 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-EBCQISOA.js → chunk-OYP5REKO.js} +110 -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-EBCQISOA.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,17 +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;
|
|
681
|
-
|
|
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;
|
|
682
703
|
const cw = data.contextWindow ?? 0;
|
|
683
704
|
if (cw > contextWindow) contextWindow = cw;
|
|
684
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
|
+
}
|
|
685
711
|
if (contextWindow > 0) {
|
|
686
712
|
host.connection.sendEvent({
|
|
687
713
|
type: "context_update",
|
|
688
714
|
contextTokens: queryInputTokens,
|
|
689
|
-
contextWindow
|
|
715
|
+
contextWindow,
|
|
716
|
+
inputTokens: totalInputTokens,
|
|
717
|
+
cacheReadInputTokens: totalCacheRead,
|
|
718
|
+
cacheCreationInputTokens: totalCacheCreation
|
|
690
719
|
});
|
|
691
720
|
}
|
|
692
721
|
}
|
|
@@ -1393,7 +1422,11 @@ function buildFreshInstructions(isPm, isAutoMode, context, agentMode) {
|
|
|
1393
1422
|
`Your plan has been approved. Begin implementing it now.`,
|
|
1394
1423
|
`Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
|
|
1395
1424
|
`Start by reading the relevant source files mentioned in the plan, then write code.`,
|
|
1396
|
-
`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
|
+
] : []
|
|
1397
1430
|
];
|
|
1398
1431
|
}
|
|
1399
1432
|
if (isAutoMode && isPm) {
|
|
@@ -1731,6 +1764,47 @@ function buildGetTaskFileTool(connection) {
|
|
|
1731
1764
|
{ annotations: { readOnlyHint: true } }
|
|
1732
1765
|
);
|
|
1733
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
|
+
}
|
|
1734
1808
|
function buildCommonTools(connection, config) {
|
|
1735
1809
|
return [
|
|
1736
1810
|
buildReadTaskChatTool(connection),
|
|
@@ -1740,7 +1814,9 @@ function buildCommonTools(connection, config) {
|
|
|
1740
1814
|
buildGetTaskTool(connection),
|
|
1741
1815
|
buildGetTaskCliTool(connection),
|
|
1742
1816
|
buildListTaskFilesTool(connection),
|
|
1743
|
-
buildGetTaskFileTool(connection)
|
|
1817
|
+
buildGetTaskFileTool(connection),
|
|
1818
|
+
buildSearchIncidentsTool(connection),
|
|
1819
|
+
buildGetTaskIncidentsTool(connection)
|
|
1744
1820
|
];
|
|
1745
1821
|
}
|
|
1746
1822
|
|
|
@@ -2935,6 +3011,7 @@ var AgentRunner = class {
|
|
|
2935
3011
|
sessionIds = /* @__PURE__ */ new Map();
|
|
2936
3012
|
lastQueryModeRestart = false;
|
|
2937
3013
|
startCommandStarted = false;
|
|
3014
|
+
nudgedForPR = false;
|
|
2938
3015
|
idleTimer = null;
|
|
2939
3016
|
idleCheckInterval = null;
|
|
2940
3017
|
deferredStartConfig = null;
|
|
@@ -3077,6 +3154,26 @@ var AgentRunner = class {
|
|
|
3077
3154
|
} catch {
|
|
3078
3155
|
}
|
|
3079
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
|
+
}
|
|
3080
3177
|
async executeInitialMode() {
|
|
3081
3178
|
if (!this.taskContext) return;
|
|
3082
3179
|
const mode = this.effectiveAgentMode;
|
|
@@ -3084,7 +3181,10 @@ var AgentRunner = class {
|
|
|
3084
3181
|
if (shouldRun) {
|
|
3085
3182
|
await this.setState("running");
|
|
3086
3183
|
await this.runQuerySafe(this.taskContext);
|
|
3087
|
-
if (!this.stopped
|
|
3184
|
+
if (!this.stopped && this._state !== "error") {
|
|
3185
|
+
const nudged = await this.maybeSendPRNudge();
|
|
3186
|
+
if (!nudged) await this.setState("idle");
|
|
3187
|
+
}
|
|
3088
3188
|
} else {
|
|
3089
3189
|
await this.setState("idle");
|
|
3090
3190
|
}
|
|
@@ -3123,7 +3223,10 @@ var AgentRunner = class {
|
|
|
3123
3223
|
}
|
|
3124
3224
|
);
|
|
3125
3225
|
this.taskContext = await this.connection.fetchTaskContext().catch(() => null) ?? this.taskContext;
|
|
3126
|
-
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
|
+
}
|
|
3127
3230
|
continue;
|
|
3128
3231
|
}
|
|
3129
3232
|
if (this._state === "idle") {
|
|
@@ -3777,4 +3880,4 @@ export {
|
|
|
3777
3880
|
ProjectRunner,
|
|
3778
3881
|
FileCache
|
|
3779
3882
|
};
|
|
3780
|
-
//# sourceMappingURL=chunk-
|
|
3883
|
+
//# sourceMappingURL=chunk-OYP5REKO.js.map
|