u-foo 3.0.29 → 3.0.31
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/README.md +13 -8
- package/bin/ufoo.js +7 -2
- package/bin/ugrok.js +68 -0
- package/dist/tui/darwin-arm64/ufoo-tui +0 -0
- package/dist/tui/darwin-x64/ufoo-tui +0 -0
- package/dist/tui/linux-arm64/ufoo-tui +0 -0
- package/dist/tui/linux-x64/ufoo-tui +0 -0
- package/package.json +2 -1
- package/src/agents/activity/activityDetector.js +95 -0
- package/src/agents/controller/ufooAgent.js +3 -3
- package/src/agents/launch/launcher.js +17 -11
- package/src/agents/launch/ptyRunner.js +34 -12
- package/src/agents/launch/readyDetector.js +27 -0
- package/src/agents/prompts/defaultBootstrap.js +126 -1
- package/src/agents/providers/directAuthStatus.js +79 -0
- package/src/agents/providers/upstreamTransport.js +234 -85
- package/src/app/chat/commandExecutor.js +18 -10
- package/src/app/chat/commands.js +4 -2
- package/src/app/cli/run.js +7 -5
- package/src/code/UcodeController.js +201 -40
- package/src/code/agent.js +9 -2
- package/src/code/commands.js +13 -0
- package/src/code/dispatch.js +9 -1
- package/src/code/index.js +9 -2
- package/src/code/nativeRunner.js +398 -16
- package/src/code/providers/index.js +1 -0
- package/src/code/providers/modelsCatalog.js +21 -6
- package/src/code/providers/openaiResponsesTransport.js +119 -0
- package/src/code/providers/responsesProtocol.js +499 -0
- package/src/code/providers/transportContract.js +5 -1
- package/src/code/repl.js +95 -2
- package/src/code/tools/bash.js +159 -6
- package/src/code/ucodeSlashDispatch.js +13 -0
- package/src/config.js +6 -0
- package/src/coordination/bus/inject.js +2 -2
- package/src/coordination/bus/utils.js +4 -1
- package/src/orchestration/controller/gateRouter.js +2 -2
- package/src/orchestration/controller/launchRouting.js +2 -1
- package/src/orchestration/groups/validateTemplate.js +1 -1
- package/src/orchestration/solo/commands.js +1 -0
- package/src/runtime/daemon/index.js +12 -4
- package/src/runtime/daemon/nicknameScope.js +4 -1
- package/src/runtime/daemon/ops.js +8 -2
- package/src/ui/rustUcodeHost.js +86 -10
package/src/ui/rustUcodeHost.js
CHANGED
|
@@ -266,7 +266,12 @@ async function runUcodeRust(props = {}) {
|
|
|
266
266
|
let backgroundSeq = 0;
|
|
267
267
|
let requestExit = false;
|
|
268
268
|
const MARKDOWN_LOG_KINDS = new Set(["assistant", "error"]);
|
|
269
|
-
const controller = createUcodeController({
|
|
269
|
+
const controller = createUcodeController({
|
|
270
|
+
projectRoot: workspaceRoot,
|
|
271
|
+
ports: {
|
|
272
|
+
onQueueChange: (snapshot) => publish("task.queue", snapshot),
|
|
273
|
+
},
|
|
274
|
+
});
|
|
270
275
|
|
|
271
276
|
function publish(name, payload) {
|
|
272
277
|
if (!hostRef) return;
|
|
@@ -351,6 +356,20 @@ async function runUcodeRust(props = {}) {
|
|
|
351
356
|
});
|
|
352
357
|
}
|
|
353
358
|
|
|
359
|
+
function formatQueueSnapshot(snapshot = controller.getQueueSnapshot()) {
|
|
360
|
+
const active = snapshot && snapshot.active;
|
|
361
|
+
const queued = Array.isArray(snapshot && snapshot.queued) ? snapshot.queued : [];
|
|
362
|
+
const activeText = active
|
|
363
|
+
? `active #${active.id} ${active.label || active.kind || "task"}`
|
|
364
|
+
: "active none";
|
|
365
|
+
const lines = [`Queue: ${activeText} · pending ${queued.length}`];
|
|
366
|
+
for (const task of queued.slice(0, 8)) {
|
|
367
|
+
lines.push(` ${task.position}. #${task.id} ${task.label || task.kind || "task"}`);
|
|
368
|
+
}
|
|
369
|
+
if (queued.length > 8) lines.push(` … ${queued.length - 8} more`);
|
|
370
|
+
return lines.join("\n");
|
|
371
|
+
}
|
|
372
|
+
|
|
354
373
|
function publishPlan(activityMessage = "") {
|
|
355
374
|
const payload = buildPlanSetPayload(props.state && props.state.executionState, {
|
|
356
375
|
activityMessage,
|
|
@@ -549,6 +568,7 @@ async function runUcodeRust(props = {}) {
|
|
|
549
568
|
agents: agentsSnap.agents,
|
|
550
569
|
attachment_count: pendingAttachments.length,
|
|
551
570
|
usage: String((meter && meter.label) || ""),
|
|
571
|
+
task_queue: controller.getQueueSnapshot(),
|
|
552
572
|
};
|
|
553
573
|
}
|
|
554
574
|
|
|
@@ -577,7 +597,7 @@ async function runUcodeRust(props = {}) {
|
|
|
577
597
|
}
|
|
578
598
|
}
|
|
579
599
|
|
|
580
|
-
async function resumeInteraction(answerText) {
|
|
600
|
+
async function resumeInteraction(answerText, meta = {}) {
|
|
581
601
|
return controller.runExclusive(async (abort) => {
|
|
582
602
|
const submit = typeof props.submitUserInteractionAnswer === "function"
|
|
583
603
|
? props.submitUserInteractionAnswer
|
|
@@ -621,8 +641,10 @@ async function runUcodeRust(props = {}) {
|
|
|
621
641
|
publishPlan();
|
|
622
642
|
publishUsageFromResult(result);
|
|
623
643
|
if (publishPendingInteraction()) {
|
|
644
|
+
controller.pauseQueue("waiting for reply");
|
|
624
645
|
return { ok: true, waiting: true };
|
|
625
646
|
}
|
|
647
|
+
controller.resumeQueue();
|
|
626
648
|
return { ok: true, waiting: false };
|
|
627
649
|
} catch (err) {
|
|
628
650
|
tools.flush();
|
|
@@ -635,10 +657,15 @@ async function runUcodeRust(props = {}) {
|
|
|
635
657
|
appendLog(`Error: ${err && err.message ? err.message : err}`, "error");
|
|
636
658
|
return { ok: false };
|
|
637
659
|
}
|
|
660
|
+
}, {
|
|
661
|
+
kind: "interaction",
|
|
662
|
+
label: "reply",
|
|
663
|
+
priority: meta.priority === true,
|
|
638
664
|
});
|
|
639
665
|
}
|
|
640
666
|
|
|
641
|
-
async function runNaturalLanguage(text) {
|
|
667
|
+
async function runNaturalLanguage(text, meta = {}) {
|
|
668
|
+
const label = String(meta.label || text || "prompt").trim().replace(/\s+/g, " ");
|
|
642
669
|
return controller.runExclusive(async (abort) => {
|
|
643
670
|
if (typeof props.runNaturalLanguageTask !== "function") {
|
|
644
671
|
appendLog("runNaturalLanguageTask unavailable", "error");
|
|
@@ -692,8 +719,10 @@ async function runUcodeRust(props = {}) {
|
|
|
692
719
|
publishPlan();
|
|
693
720
|
publishUsageFromResult(nlResult);
|
|
694
721
|
if (publishPendingInteraction()) {
|
|
722
|
+
controller.pauseQueue("waiting for reply");
|
|
695
723
|
return { ok: true, waiting: true };
|
|
696
724
|
}
|
|
725
|
+
controller.resumeQueue();
|
|
697
726
|
return { ok: true, waiting: false, result: nlResult };
|
|
698
727
|
} catch (err) {
|
|
699
728
|
tools.flush();
|
|
@@ -706,6 +735,9 @@ async function runUcodeRust(props = {}) {
|
|
|
706
735
|
appendLog(`Error: ${err && err.message ? err.message : err}`, "error");
|
|
707
736
|
return { ok: false };
|
|
708
737
|
}
|
|
738
|
+
}, {
|
|
739
|
+
kind: String(meta.kind || "prompt").trim() || "prompt",
|
|
740
|
+
label: label.length > 80 ? `${label.slice(0, 77)}…` : label,
|
|
709
741
|
});
|
|
710
742
|
}
|
|
711
743
|
|
|
@@ -760,7 +792,7 @@ async function runUcodeRust(props = {}) {
|
|
|
760
792
|
publish("status.set", { text: "ready", busy: false });
|
|
761
793
|
}
|
|
762
794
|
}
|
|
763
|
-
});
|
|
795
|
+
}, { kind: "bus", label: "bus messages" });
|
|
764
796
|
}
|
|
765
797
|
|
|
766
798
|
function scheduleAutoBus() {
|
|
@@ -803,11 +835,11 @@ async function runUcodeRust(props = {}) {
|
|
|
803
835
|
|
|
804
836
|
if (name === "app.exit") {
|
|
805
837
|
closing = true;
|
|
806
|
-
controller.
|
|
838
|
+
controller.stop();
|
|
807
839
|
return { ok: true };
|
|
808
840
|
}
|
|
809
841
|
if (name === "task.cancel") {
|
|
810
|
-
controller.cancelTask();
|
|
842
|
+
controller.cancelTask("user");
|
|
811
843
|
publish("status.set", { text: "cancelling…", busy: true });
|
|
812
844
|
appendLog("• Cancellation requested. Stopping the current task...", "system");
|
|
813
845
|
return { ok: true };
|
|
@@ -861,12 +893,15 @@ async function runUcodeRust(props = {}) {
|
|
|
861
893
|
if (payload.cancelled) {
|
|
862
894
|
appendLog("interaction cancelled", "system");
|
|
863
895
|
publish("interaction.clear", {});
|
|
896
|
+
controller.resumeQueue();
|
|
864
897
|
publish("status.set", { text: "ready", busy: false });
|
|
865
898
|
return { ok: true, cancelled: true };
|
|
866
899
|
}
|
|
867
900
|
publish("interaction.clear", {});
|
|
868
901
|
publish("status.set", { text: "applying reply…", busy: true });
|
|
869
|
-
const
|
|
902
|
+
const resume = resumeInteraction(String(payload.text || ""), { priority: true });
|
|
903
|
+
controller.resumeQueue();
|
|
904
|
+
const result = await resume;
|
|
870
905
|
if (!result.waiting) {
|
|
871
906
|
publish("status.set", { text: "ready", busy: false });
|
|
872
907
|
}
|
|
@@ -877,14 +912,15 @@ async function runUcodeRust(props = {}) {
|
|
|
877
912
|
const { modelText, logText, attachments } = composeSubmitText(rawText);
|
|
878
913
|
if (!modelText && attachments.length === 0) return { ok: true, empty: true };
|
|
879
914
|
clearAttachments();
|
|
880
|
-
tools.beginScope();
|
|
881
915
|
|
|
882
916
|
try {
|
|
883
917
|
const { hasPendingUserInteraction } = require("../code/context/userInteraction");
|
|
884
918
|
if (props.state && hasPendingUserInteraction(props.state.executionState)) {
|
|
885
919
|
appendLog(`› ${logText || rawText}`, "user");
|
|
886
920
|
publishStatus("applying reply…", true);
|
|
887
|
-
const
|
|
921
|
+
const resume = resumeInteraction(modelText || rawText, { priority: true });
|
|
922
|
+
controller.resumeQueue();
|
|
923
|
+
const result = await resume;
|
|
888
924
|
if (!result.waiting) publishStatus("ready", false);
|
|
889
925
|
return { ok: true, routed: "interaction" };
|
|
890
926
|
}
|
|
@@ -910,6 +946,7 @@ async function runUcodeRust(props = {}) {
|
|
|
910
946
|
parsed = null;
|
|
911
947
|
}
|
|
912
948
|
if (parsed) {
|
|
949
|
+
if (parsed.kind === "tool") tools.beginScope();
|
|
913
950
|
const dispatched = await dispatchUcodeSlashCommand(parsed, {
|
|
914
951
|
state: props.state,
|
|
915
952
|
workspaceRoot,
|
|
@@ -1004,6 +1041,42 @@ async function runUcodeRust(props = {}) {
|
|
|
1004
1041
|
});
|
|
1005
1042
|
},
|
|
1006
1043
|
onNaturalLanguage: async (task) => runNaturalLanguage(task),
|
|
1044
|
+
onQueueCommand: (action) => {
|
|
1045
|
+
const normalized = String(action || "status").trim().toLowerCase();
|
|
1046
|
+
if (normalized === "status") {
|
|
1047
|
+
return { ok: true, output: formatQueueSnapshot() };
|
|
1048
|
+
}
|
|
1049
|
+
if (normalized === "cancel") {
|
|
1050
|
+
const snapshot = controller.getQueueSnapshot();
|
|
1051
|
+
if (!snapshot.active) {
|
|
1052
|
+
return { ok: true, output: "Queue: no active task." };
|
|
1053
|
+
}
|
|
1054
|
+
controller.cancelTask("queue cancel");
|
|
1055
|
+
publishStatus("cancelling…", true);
|
|
1056
|
+
return { ok: true, output: `Cancellation requested for #${snapshot.active.id}.` };
|
|
1057
|
+
}
|
|
1058
|
+
if (normalized === "clear") {
|
|
1059
|
+
const count = controller.clearQueue();
|
|
1060
|
+
if (!controller.isBusy()) publishStatus("ready", false);
|
|
1061
|
+
return { ok: true, output: count
|
|
1062
|
+
? `Cleared ${count} pending task${count === 1 ? "" : "s"}.`
|
|
1063
|
+
: "Queue: no pending tasks." };
|
|
1064
|
+
}
|
|
1065
|
+
if (normalized === "stop") {
|
|
1066
|
+
const snapshot = controller.getQueueSnapshot();
|
|
1067
|
+
const cancelled = controller.cancelTask("queue stop");
|
|
1068
|
+
const cleared = controller.clearQueue();
|
|
1069
|
+
if (cancelled) publishStatus("cancelling…", true);
|
|
1070
|
+
else if (!controller.isBusy()) publishStatus("ready", false);
|
|
1071
|
+
return {
|
|
1072
|
+
ok: true,
|
|
1073
|
+
output: `Queue stopped: ${cancelled ? "active cancellation requested" : "no active task"}; cleared ${cleared} pending.`,
|
|
1074
|
+
active: snapshot.active,
|
|
1075
|
+
cleared,
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
return { ok: false, output: "usage: /queue [status|clear|cancel|stop]" };
|
|
1079
|
+
},
|
|
1007
1080
|
runUbus: typeof props.runUbusCommand === "function"
|
|
1008
1081
|
? (state, opts) => props.runUbusCommand(state, opts)
|
|
1009
1082
|
: null,
|
|
@@ -1027,7 +1100,10 @@ async function runUcodeRust(props = {}) {
|
|
|
1027
1100
|
} finally {
|
|
1028
1101
|
try {
|
|
1029
1102
|
const { hasPendingUserInteraction } = require("../code/context/userInteraction");
|
|
1030
|
-
if (
|
|
1103
|
+
if (
|
|
1104
|
+
!(props.state && hasPendingUserInteraction(props.state.executionState))
|
|
1105
|
+
&& !controller.isBusy()
|
|
1106
|
+
) {
|
|
1031
1107
|
publishStatus("ready", false);
|
|
1032
1108
|
}
|
|
1033
1109
|
} catch {
|