@yemi33/minions 0.1.1803 → 0.1.1804
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/CHANGELOG.md +5 -0
- package/engine/copilot-models.json +1 -1
- package/engine/llm.js +0 -29
- package/engine/runtimes/copilot.js +12 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine/llm.js
CHANGED
|
@@ -22,7 +22,6 @@ const { resolveRuntime } = require('./runtimes');
|
|
|
22
22
|
|
|
23
23
|
const MINIONS_DIR = shared.MINIONS_DIR;
|
|
24
24
|
const ENGINE_DIR = path.join(MINIONS_DIR, 'engine');
|
|
25
|
-
const COPILOT_TASK_COMPLETE_GRACE_MS = 15000;
|
|
26
25
|
const MISSING_RUNTIME_EXIT_CODE = 78;
|
|
27
26
|
// When the spawned process emits 'exit' but 'close' is delayed (a detached
|
|
28
27
|
// grandchild inherited stdio), wait this long for trailing stdout data to
|
|
@@ -627,17 +626,6 @@ function callLLM(promptText, sysPromptText, opts = {}) {
|
|
|
627
626
|
maxBudget, bare, fallbackModel,
|
|
628
627
|
...runtimeFeatureOpts,
|
|
629
628
|
});
|
|
630
|
-
let taskCompleteTimer = null;
|
|
631
|
-
const scheduleTaskCompleteClose = () => {
|
|
632
|
-
if (taskCompleteTimer) return;
|
|
633
|
-
taskCompleteTimer = setTimeout(() => { try { shared.killImmediate(proc); } catch {} }, COPILOT_TASK_COMPLETE_GRACE_MS);
|
|
634
|
-
};
|
|
635
|
-
const clearTaskCompleteTimer = () => {
|
|
636
|
-
if (taskCompleteTimer) {
|
|
637
|
-
clearTimeout(taskCompleteTimer);
|
|
638
|
-
taskCompleteTimer = null;
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
629
|
let resolved = false;
|
|
642
630
|
let exitFallbackTimer = null;
|
|
643
631
|
let exitCode = null;
|
|
@@ -650,7 +638,6 @@ function callLLM(promptText, sysPromptText, opts = {}) {
|
|
|
650
638
|
maxRawBytes: ENGINE_DEFAULTS.maxLlmRawBytes,
|
|
651
639
|
maxStderrBytes: ENGINE_DEFAULTS.maxLlmStderrBytes,
|
|
652
640
|
maxLineBufferBytes: ENGINE_DEFAULTS.maxLlmLineBufferBytes,
|
|
653
|
-
onTaskComplete: scheduleTaskCompleteClose,
|
|
654
641
|
// Terminal text from the runtime adapter signals the LLM has logically
|
|
655
642
|
// completed — kick the drain timer so we don't block on a delayed
|
|
656
643
|
// 'exit'/'close' when an inherited pipe keeps the parent's FDs open.
|
|
@@ -668,7 +655,6 @@ function callLLM(promptText, sysPromptText, opts = {}) {
|
|
|
668
655
|
if (resolved) return;
|
|
669
656
|
resolved = true;
|
|
670
657
|
clearTimeout(timer);
|
|
671
|
-
clearTaskCompleteTimer();
|
|
672
658
|
if (exitFallbackTimer) { clearTimeout(exitFallbackTimer); exitFallbackTimer = null; }
|
|
673
659
|
for (const f of cleanupFiles) safeUnlink(f);
|
|
674
660
|
const parsed = acc.finalize();
|
|
@@ -706,7 +692,6 @@ function callLLM(promptText, sysPromptText, opts = {}) {
|
|
|
706
692
|
if (resolved) return;
|
|
707
693
|
resolved = true;
|
|
708
694
|
clearTimeout(timer);
|
|
709
|
-
clearTaskCompleteTimer();
|
|
710
695
|
if (exitFallbackTimer) { clearTimeout(exitFallbackTimer); exitFallbackTimer = null; }
|
|
711
696
|
for (const f of cleanupFiles) safeUnlink(f);
|
|
712
697
|
shared.log('error', `LLM spawn error (${label}): ${err.message}`);
|
|
@@ -753,17 +738,6 @@ function callLLMStreaming(promptText, sysPromptText, opts = {}) {
|
|
|
753
738
|
maxBudget, bare, fallbackModel,
|
|
754
739
|
...runtimeFeatureOpts,
|
|
755
740
|
});
|
|
756
|
-
let taskCompleteTimer = null;
|
|
757
|
-
const scheduleTaskCompleteClose = () => {
|
|
758
|
-
if (taskCompleteTimer) return;
|
|
759
|
-
taskCompleteTimer = setTimeout(() => { try { shared.killImmediate(proc); } catch {} }, COPILOT_TASK_COMPLETE_GRACE_MS);
|
|
760
|
-
};
|
|
761
|
-
const clearTaskCompleteTimer = () => {
|
|
762
|
-
if (taskCompleteTimer) {
|
|
763
|
-
clearTimeout(taskCompleteTimer);
|
|
764
|
-
taskCompleteTimer = null;
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
741
|
let resolved = false;
|
|
768
742
|
let exitFallbackTimer = null;
|
|
769
743
|
let exitCode = null;
|
|
@@ -778,7 +752,6 @@ function callLLMStreaming(promptText, sysPromptText, opts = {}) {
|
|
|
778
752
|
maxLineBufferBytes: ENGINE_DEFAULTS.maxLlmLineBufferBytes,
|
|
779
753
|
onChunk,
|
|
780
754
|
onToolUse,
|
|
781
|
-
onTaskComplete: scheduleTaskCompleteClose,
|
|
782
755
|
// Terminal text from the runtime adapter signals the LLM has logically
|
|
783
756
|
// completed — kick the drain timer so we don't block on a delayed
|
|
784
757
|
// 'exit'/'close' when an inherited pipe keeps the parent's FDs open.
|
|
@@ -797,7 +770,6 @@ function callLLMStreaming(promptText, sysPromptText, opts = {}) {
|
|
|
797
770
|
if (resolved) return;
|
|
798
771
|
resolved = true;
|
|
799
772
|
clearTimeout(timer);
|
|
800
|
-
clearTaskCompleteTimer();
|
|
801
773
|
if (exitFallbackTimer) { clearTimeout(exitFallbackTimer); exitFallbackTimer = null; }
|
|
802
774
|
for (const f of cleanupFiles) safeUnlink(f);
|
|
803
775
|
const parsed = acc.finalize();
|
|
@@ -832,7 +804,6 @@ function callLLMStreaming(promptText, sysPromptText, opts = {}) {
|
|
|
832
804
|
if (resolved) return;
|
|
833
805
|
resolved = true;
|
|
834
806
|
clearTimeout(timer);
|
|
835
|
-
clearTaskCompleteTimer();
|
|
836
807
|
if (exitFallbackTimer) { clearTimeout(exitFallbackTimer); exitFallbackTimer = null; }
|
|
837
808
|
for (const f of cleanupFiles) safeUnlink(f);
|
|
838
809
|
shared.log('error', `LLM-stream spawn error (${label}): ${err.message}`);
|
|
@@ -550,7 +550,7 @@ function parseOutput(raw, { maxTextLength = 0 } = {}) {
|
|
|
550
550
|
const type = obj.type;
|
|
551
551
|
if (type === 'assistant.message_delta') {
|
|
552
552
|
const delta = obj.data?.deltaContent;
|
|
553
|
-
if (typeof delta === 'string'
|
|
553
|
+
if (typeof delta === 'string') pendingDeltaContent += delta;
|
|
554
554
|
} else if (type === 'assistant.message') {
|
|
555
555
|
const content = obj.data?.content;
|
|
556
556
|
const toolRequests = obj.data?.toolRequests;
|
|
@@ -818,12 +818,13 @@ function createStreamConsumer(ctx) {
|
|
|
818
818
|
// assistant messages or trailing deltas.
|
|
819
819
|
let copilotMessageBuffer = '';
|
|
820
820
|
let terminalText = '';
|
|
821
|
+
let taskCompleteSummary = '';
|
|
821
822
|
|
|
822
|
-
function _captureTaskComplete(summary, success = true) {
|
|
823
|
+
function _captureTaskComplete(summary, success = true, { clearBuffer = false } = {}) {
|
|
823
824
|
if (typeof summary !== 'string' || !summary) return;
|
|
824
|
-
|
|
825
|
-
if (
|
|
826
|
-
|
|
825
|
+
taskCompleteSummary = summary;
|
|
826
|
+
if (clearBuffer) copilotMessageBuffer = '';
|
|
827
|
+
if (!terminalText && !copilotMessageBuffer) {
|
|
827
828
|
ctx.pushText(summary);
|
|
828
829
|
}
|
|
829
830
|
ctx.notifyTaskComplete(summary, success !== false);
|
|
@@ -837,7 +838,8 @@ function createStreamConsumer(ctx) {
|
|
|
837
838
|
// The result event is the first Copilot event that contains the resumable
|
|
838
839
|
// sessionId. Do not mark the earlier assistant.message as terminal or
|
|
839
840
|
// Minions can resolve before session persistence data is available.
|
|
840
|
-
|
|
841
|
+
const finalText = terminalText || copilotMessageBuffer || taskCompleteSummary;
|
|
842
|
+
if (finalText) ctx.setText(finalText);
|
|
841
843
|
}
|
|
842
844
|
|
|
843
845
|
if (obj.type === 'session.task_complete') {
|
|
@@ -877,7 +879,7 @@ function createStreamConsumer(ctx) {
|
|
|
877
879
|
for (const tr of data.toolRequests) {
|
|
878
880
|
if (!tr || !tr.name) continue;
|
|
879
881
|
if (tr.name === 'task_complete') {
|
|
880
|
-
_captureTaskComplete(tr.arguments?.summary || tr.intentionSummary);
|
|
882
|
+
_captureTaskComplete(tr.arguments?.summary || tr.intentionSummary, true, { clearBuffer: true });
|
|
881
883
|
continue;
|
|
882
884
|
}
|
|
883
885
|
ctx.pushToolUse(tr.name, tr.arguments || {});
|
|
@@ -888,7 +890,7 @@ function createStreamConsumer(ctx) {
|
|
|
888
890
|
|
|
889
891
|
if (obj.type === 'tool.execution_start' && obj.data?.toolName) {
|
|
890
892
|
if (obj.data.toolName === 'task_complete') {
|
|
891
|
-
_captureTaskComplete(obj.data.arguments?.summary);
|
|
893
|
+
_captureTaskComplete(obj.data.arguments?.summary, true, { clearBuffer: true });
|
|
892
894
|
return;
|
|
893
895
|
}
|
|
894
896
|
const name = obj.data.toolName;
|
|
@@ -903,6 +905,8 @@ function createStreamConsumer(ctx) {
|
|
|
903
905
|
|
|
904
906
|
function reset() {
|
|
905
907
|
copilotMessageBuffer = '';
|
|
908
|
+
terminalText = '';
|
|
909
|
+
taskCompleteSummary = '';
|
|
906
910
|
}
|
|
907
911
|
|
|
908
912
|
return { consume, reset };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1804",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|