@groupchatai/claude-runner 0.4.10 → 0.4.11
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/index.js +37 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -79,6 +79,39 @@ var GroupChatAgentClient = class {
|
|
|
79
79
|
return this.request("POST", `/runs/${runId}/comment`, { body });
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
+
function buildResumedPrompt(detail, agentUserId) {
|
|
83
|
+
const comments = detail.activity.filter(
|
|
84
|
+
(a) => a.type === "comment" && a.body && a.body.trim().length > 0
|
|
85
|
+
);
|
|
86
|
+
let lastAgentCommentIdx = -1;
|
|
87
|
+
for (let i = comments.length - 1; i >= 0; i--) {
|
|
88
|
+
if (comments[i].userId === agentUserId) {
|
|
89
|
+
lastAgentCommentIdx = i;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const newComments = comments.slice(lastAgentCommentIdx + 1).filter((c) => c.userId !== agentUserId);
|
|
94
|
+
const parts = [];
|
|
95
|
+
if (newComments.length > 0) {
|
|
96
|
+
parts.push("New comments since your last response:");
|
|
97
|
+
for (const c of newComments) {
|
|
98
|
+
const author = c.userName ?? "Someone";
|
|
99
|
+
parts.push(`
|
|
100
|
+
**${author}**:
|
|
101
|
+
${c.body}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (detail.lastFollowUpMessage && detail.lastFollowUpMessage !== "Continue working on this task.") {
|
|
105
|
+
parts.push(`
|
|
106
|
+
Follow-up request: ${detail.lastFollowUpMessage}`);
|
|
107
|
+
}
|
|
108
|
+
if (parts.length === 0) {
|
|
109
|
+
parts.push(
|
|
110
|
+
"The user has asked you to continue working on this task. Check the conversation history and address any outstanding requests."
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
return parts.join("\n");
|
|
114
|
+
}
|
|
82
115
|
function buildClaudePrompt(detail, repoResolved) {
|
|
83
116
|
const parts = [];
|
|
84
117
|
parts.push(`# Task: ${detail.task.title}`);
|
|
@@ -621,6 +654,7 @@ function runShellCommand(cmd, args, cwd) {
|
|
|
621
654
|
});
|
|
622
655
|
}
|
|
623
656
|
var sessionCache = /* @__PURE__ */ new Map();
|
|
657
|
+
var currentAgentUserId = "";
|
|
624
658
|
var activeProcesses = /* @__PURE__ */ new Map();
|
|
625
659
|
var stoppedRunIds = /* @__PURE__ */ new Set();
|
|
626
660
|
function stopActiveProcess(runId) {
|
|
@@ -1003,10 +1037,8 @@ async function processRun(client, run, config, worktreeDir, detail, runBaseDir,
|
|
|
1003
1037
|
const cachedSessionId = sessionCache.get(run.taskId) ?? detail.lastSessionId;
|
|
1004
1038
|
const isFollowUp = cachedSessionId !== void 0;
|
|
1005
1039
|
let effectivePrompt;
|
|
1006
|
-
if (isFollowUp &&
|
|
1007
|
-
effectivePrompt = detail
|
|
1008
|
-
} else if (isFollowUp) {
|
|
1009
|
-
effectivePrompt = prompt;
|
|
1040
|
+
if (isFollowUp && cachedSessionId) {
|
|
1041
|
+
effectivePrompt = buildResumedPrompt(detail, currentAgentUserId);
|
|
1010
1042
|
} else {
|
|
1011
1043
|
effectivePrompt = prompt;
|
|
1012
1044
|
}
|
|
@@ -1670,6 +1702,7 @@ async function main() {
|
|
|
1670
1702
|
console.error("Failed to authenticate:", errMsg(err));
|
|
1671
1703
|
process.exit(1);
|
|
1672
1704
|
}
|
|
1705
|
+
currentAgentUserId = me.agentUserId;
|
|
1673
1706
|
console.log(`
|
|
1674
1707
|
\u{1F916} Agent Runner \u2014 ${me.name}`);
|
|
1675
1708
|
console.log(` Owner: ${me.ownerName}`);
|