heyio 0.33.0 → 0.33.1
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/copilot/agents.js +42 -19
- package/package.json +1 -1
package/dist/copilot/agents.js
CHANGED
|
@@ -747,27 +747,50 @@ function buildAgentTools(squadSlug, isLead = false) {
|
|
|
747
747
|
updateAgentStatus(squadSlug, teammateAgent.character_name, "working");
|
|
748
748
|
try {
|
|
749
749
|
const session = await getOrCreateAgentSession(squadSlug, teammateAgent, task);
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
// long-running shell work between assistant messages.)
|
|
755
|
-
const sendResult = await sendWithIdleTimeout(session, envelopedTask, {
|
|
756
|
-
idleMs: 10 * 60_000,
|
|
757
|
-
hardCapMs: 30 * 60_000,
|
|
758
|
-
onIdleTimeout: ({ lastEventType }) => {
|
|
759
|
-
console.error(`[io] Teammate ${teammateAgent.character_name} idle (last event: ${lastEventType ?? "none"}) — aborting.`);
|
|
760
|
-
},
|
|
750
|
+
recordTaskEvent(childTaskId, {
|
|
751
|
+
ts: Date.now(),
|
|
752
|
+
type: "task.start",
|
|
753
|
+
data: { taskId: childTaskId, agentKey: childAgentKey, description: task },
|
|
761
754
|
});
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
755
|
+
let unsubChild;
|
|
756
|
+
try {
|
|
757
|
+
unsubChild = session.on((event) => {
|
|
758
|
+
if (!STREAM_EVENT_TYPES.has(event.type))
|
|
759
|
+
return;
|
|
760
|
+
recordTaskEvent(childTaskId, {
|
|
761
|
+
ts: Date.now(),
|
|
762
|
+
type: event.type,
|
|
763
|
+
data: event.data ?? null,
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
const envelopedTask = buildTaskPromptEnvelope(squadSlug, task);
|
|
767
|
+
// Idle-reset timeout: 10min between progress events, 30min
|
|
768
|
+
// hard cap. (Issue #53 — replaces #51's 30min wall-clock cap
|
|
769
|
+
// that still killed agents mid-tool-call when they had
|
|
770
|
+
// long-running shell work between assistant messages.)
|
|
771
|
+
const sendResult = await sendWithIdleTimeout(session, envelopedTask, {
|
|
772
|
+
idleMs: 10 * 60_000,
|
|
773
|
+
hardCapMs: 30 * 60_000,
|
|
774
|
+
onIdleTimeout: ({ lastEventType }) => {
|
|
775
|
+
console.error(`[io] Teammate ${teammateAgent.character_name} idle (last event: ${lastEventType ?? "none"}) — aborting.`);
|
|
776
|
+
},
|
|
777
|
+
});
|
|
778
|
+
const result = sendResult.content || "(teammate returned no output)";
|
|
779
|
+
updateAgentStatus(squadSlug, teammateAgent.character_name, "idle");
|
|
780
|
+
if (sendResult.timedOut) {
|
|
781
|
+
const stamped = `[teammate timed out — ${sendResult.timeoutReason === "idle" ? "idle reset" : "hard cap"}; last event: ${sendResult.lastEventType ?? "none"}]\n\n${result}`;
|
|
782
|
+
failTask(childTaskId, stamped);
|
|
783
|
+
return stamped;
|
|
784
|
+
}
|
|
785
|
+
completeTask(childTaskId, result);
|
|
786
|
+
return result;
|
|
787
|
+
}
|
|
788
|
+
finally {
|
|
789
|
+
try {
|
|
790
|
+
unsubChild?.();
|
|
791
|
+
}
|
|
792
|
+
catch { /* best-effort cleanup */ }
|
|
768
793
|
}
|
|
769
|
-
completeTask(childTaskId, result);
|
|
770
|
-
return result;
|
|
771
794
|
}
|
|
772
795
|
catch (err) {
|
|
773
796
|
updateAgentStatus(squadSlug, teammateAgent.character_name, "error");
|