u-foo 3.0.0 → 3.0.2
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/package.json +1 -1
- package/src/agents/prompts/native/tasks.js +4 -1
- package/src/app/chat/commandExecutor.js +111 -1
- package/src/app/chat/commands.js +2 -1
- package/src/app/chat/daemonMessageRouter.js +1 -1
- package/src/app/chat/inputSubmitHandler.js +3 -2
- package/src/code/agent.js +17 -3
- package/src/code/commands.js +3 -3
- package/src/code/context/executionSegment.js +5 -0
- package/src/code/context/planMode.js +8 -1
- package/src/code/context/promptLayers.js +10 -9
- package/src/code/dispatch.js +4 -0
- package/src/code/index.js +2 -0
- package/src/code/modelCommand.js +199 -23
- package/src/code/nativeRunner.js +299 -225
- package/src/code/protocol/controlPlane.js +93 -0
- package/src/code/protocol/faultHarness.js +90 -0
- package/src/code/protocol/index.js +20 -0
- package/src/code/protocol/loopEvents.js +102 -0
- package/src/code/protocol/materialize.js +107 -0
- package/src/code/protocol/messageFixtures.js +116 -0
- package/src/code/protocol/ownership.js +147 -0
- package/src/code/protocol/protocolValidator.js +165 -0
- package/src/code/protocol/suspension.js +173 -0
- package/src/code/protocol/toolCallLedger.js +222 -0
- package/src/code/protocol/transitions.js +97 -0
- package/src/code/providers/anthropicMessagesTransport.js +93 -0
- package/src/code/providers/index.js +8 -0
- package/src/code/providers/modelsCatalog.js +304 -0
- package/src/code/providers/openaiChatTransport.js +98 -0
- package/src/code/providers/transportContract.js +46 -0
- package/src/code/repl.js +45 -29
- package/src/code/runtime/taskControl.js +177 -53
- package/src/code/runtime/taskFocus.js +30 -10
- package/src/code/runtime/taskLoop.js +25 -3
- package/src/code/runtime/taskRun.js +172 -2
- package/src/code/runtime/workspaceLease.js +41 -0
- package/src/code/sessionStore.js +1 -0
- package/src/code/taskRoute.js +73 -0
- package/src/code/thinkingLevels.js +132 -0
- package/src/code/tools/taskRun.js +118 -0
- package/src/config.js +10 -1
- package/src/ui/format/index.js +48 -3
- package/src/ui/ink/ChatApp.js +137 -25
- package/src/ui/ink/UcodeApp.js +38 -30
- package/src/ui/ink/chatLogModel.js +238 -32
- package/src/ui/ink/chatReducer.js +18 -6
package/package.json
CHANGED
|
@@ -11,7 +11,10 @@ function getDoingTasksSection() {
|
|
|
11
11
|
- Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs).
|
|
12
12
|
- Don't create helpers, utilities, or abstractions for one-time operations. Three similar lines of code is better than a premature abstraction.
|
|
13
13
|
- Follow workspace conventions and project instructions (AGENTS.md) when present.
|
|
14
|
-
- Prefer concrete code edits and verifiable outcomes over explanations
|
|
14
|
+
- Prefer concrete code edits and verifiable outcomes over explanations.
|
|
15
|
+
- For simple, single-goal work, execute directly with read/write/edit/bash.
|
|
16
|
+
- For complex work — multiple goals, several subsystems, long multi-step delivery, or clear parallel tracks — automatically decompose before diving in: split into concrete sub-objectives, then start one or more TaskRuns via task_run (standalone; no Plan Mode required). Use plan_graph only when durable dependencies, checkpoints, or a shared executable plan are needed.
|
|
17
|
+
- When decomposing, each TaskRun objective should be independently verifiable; prefer a few sharp tasks over one vague mega-task.`;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
module.exports = { getDoingTasksSection };
|
|
@@ -166,6 +166,7 @@ function createCommandExecutor(options = {}) {
|
|
|
166
166
|
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
167
167
|
schedule = (fn, ms) => setTimeout(fn, ms),
|
|
168
168
|
clearLog = null,
|
|
169
|
+
fetchModelsImpl = null,
|
|
169
170
|
} = options;
|
|
170
171
|
|
|
171
172
|
if (!projectRoot) {
|
|
@@ -1623,7 +1624,35 @@ function createCommandExecutor(options = {}) {
|
|
|
1623
1624
|
logMessage("system", ` • url: ${url || "(unset)"}`);
|
|
1624
1625
|
logMessage("system", ` • key: ${maskSecret(key)}`);
|
|
1625
1626
|
logMessage("system", ` • transport: ${transport} (auto)`);
|
|
1627
|
+
try {
|
|
1628
|
+
const { currentThinkingLevel } = require("../../code/modelCommand");
|
|
1629
|
+
logMessage("system", ` • thinking: ${currentThinkingLevel({})}`);
|
|
1630
|
+
} catch {
|
|
1631
|
+
// ignore
|
|
1632
|
+
}
|
|
1626
1633
|
logMessage("system", " • tip: url supports generic gateway base, transport is auto-detected");
|
|
1634
|
+
try {
|
|
1635
|
+
const { listUcodeModels } = require("../../code/modelCommand");
|
|
1636
|
+
const listed = await listUcodeModels({
|
|
1637
|
+
provider,
|
|
1638
|
+
model,
|
|
1639
|
+
}, {
|
|
1640
|
+
workspaceRoot: getActiveProjectRoot() || projectRoot,
|
|
1641
|
+
fetchImpl: fetchModelsImpl || undefined,
|
|
1642
|
+
});
|
|
1643
|
+
if (listed.ok && listed.models.length > 0) {
|
|
1644
|
+
const sample = listed.models.slice(0, 10);
|
|
1645
|
+
logMessage("system", ` • models route: ${listed.models.length} available`);
|
|
1646
|
+
logMessage("system", ` • models: ${sample.join(", ")}${listed.models.length > 10 ? "…" : ""}`);
|
|
1647
|
+
if (model && !listed.models.includes(model)) {
|
|
1648
|
+
logMessage("system", ` • warning: configured model "${model}" is not in the provider catalog`);
|
|
1649
|
+
}
|
|
1650
|
+
} else if (listed.error) {
|
|
1651
|
+
logMessage("system", ` • models route: ${listed.error}`);
|
|
1652
|
+
}
|
|
1653
|
+
} catch (err) {
|
|
1654
|
+
logMessage("system", ` • models route: ${err && err.message ? err.message : "unavailable"}`);
|
|
1655
|
+
}
|
|
1627
1656
|
return;
|
|
1628
1657
|
}
|
|
1629
1658
|
|
|
@@ -1645,6 +1674,52 @@ function createCommandExecutor(options = {}) {
|
|
|
1645
1674
|
logMessage("error", "{white-fg}✗{/white-fg} Usage: /settings ucode set provider=<openai|anthropic> model=<id> url=<baseUrl> key=<apiKey>");
|
|
1646
1675
|
return;
|
|
1647
1676
|
}
|
|
1677
|
+
|
|
1678
|
+
// Preview the config that would apply after this set, then confirm the
|
|
1679
|
+
// model id against the provider /models route when a model is present.
|
|
1680
|
+
const preview = {
|
|
1681
|
+
...(loadUcodeConfig() || {}),
|
|
1682
|
+
...updates,
|
|
1683
|
+
};
|
|
1684
|
+
const modelToConfirm = String(preview.ucodeModel || "").trim();
|
|
1685
|
+
if (modelToConfirm) {
|
|
1686
|
+
try {
|
|
1687
|
+
const { confirmModelSupported } = require("../../code/providers/modelsCatalog");
|
|
1688
|
+
const { resolveRuntimeConfig } = require("../../code/nativeRunner");
|
|
1689
|
+
const runtime = resolveRuntimeConfig({
|
|
1690
|
+
workspaceRoot: getActiveProjectRoot() || projectRoot,
|
|
1691
|
+
provider: preview.ucodeProvider || "",
|
|
1692
|
+
model: modelToConfirm,
|
|
1693
|
+
});
|
|
1694
|
+
// Prefer the previewed url/key over env-only resolution so a single
|
|
1695
|
+
// set line that changes url+model validates against the new gateway.
|
|
1696
|
+
const confirmation = await confirmModelSupported({
|
|
1697
|
+
provider: runtime.provider,
|
|
1698
|
+
transport: inferUcodeTransport(preview.ucodeProvider, preview.ucodeBaseUrl || runtime.baseUrl),
|
|
1699
|
+
baseUrl: String(preview.ucodeBaseUrl || runtime.baseUrl || "").trim(),
|
|
1700
|
+
apiKey: String(preview.ucodeApiKey || runtime.apiKey || "").trim(),
|
|
1701
|
+
model: modelToConfirm,
|
|
1702
|
+
strict: false,
|
|
1703
|
+
fetchImpl: fetchModelsImpl || undefined,
|
|
1704
|
+
});
|
|
1705
|
+
if (!confirmation.allowed) {
|
|
1706
|
+
logMessage("error", `{white-fg}✗{/white-fg} ${escapeBlessed(confirmation.error || "model not supported")}`);
|
|
1707
|
+
if (confirmation.models && confirmation.models.length > 0) {
|
|
1708
|
+
const sample = confirmation.models.slice(0, 10).join(", ");
|
|
1709
|
+
logMessage("system", ` • available: ${escapeBlessed(sample)}${confirmation.models.length > 10 ? "…" : ""}`);
|
|
1710
|
+
}
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (confirmation.warning) {
|
|
1714
|
+
logMessage("system", `{gray-fg}note:{/gray-fg} ${escapeBlessed(confirmation.warning)}`);
|
|
1715
|
+
} else if (confirmation.ok) {
|
|
1716
|
+
logMessage("system", `{gray-fg}models route:{/gray-fg} confirmed ${escapeBlessed(modelToConfirm)}`);
|
|
1717
|
+
}
|
|
1718
|
+
} catch (err) {
|
|
1719
|
+
logMessage("system", `{gray-fg}note:{/gray-fg} models route check skipped (${escapeBlessed(err && err.message ? err.message : "unavailable")})`);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1648
1723
|
saveUcodeConfig(updates);
|
|
1649
1724
|
logMessage("system", "{white-fg}✓{/white-fg} ucode config updated (global)");
|
|
1650
1725
|
if (Object.prototype.hasOwnProperty.call(updates, "ucodeProvider")) {
|
|
@@ -1664,6 +1739,41 @@ function createCommandExecutor(options = {}) {
|
|
|
1664
1739
|
return;
|
|
1665
1740
|
}
|
|
1666
1741
|
|
|
1742
|
+
if (action === "models") {
|
|
1743
|
+
try {
|
|
1744
|
+
const { listUcodeModels } = require("../../code/modelCommand");
|
|
1745
|
+
const config = loadUcodeConfig() || {};
|
|
1746
|
+
const listed = await listUcodeModels({
|
|
1747
|
+
provider: config.ucodeProvider || "",
|
|
1748
|
+
model: config.ucodeModel || "",
|
|
1749
|
+
}, {
|
|
1750
|
+
workspaceRoot: getActiveProjectRoot() || projectRoot,
|
|
1751
|
+
skipCache: true,
|
|
1752
|
+
fetchImpl: fetchModelsImpl || undefined,
|
|
1753
|
+
});
|
|
1754
|
+
if (!listed.ok) {
|
|
1755
|
+
logMessage("error", `{white-fg}✗{/white-fg} ${escapeBlessed(listed.error || "models route failed")}`);
|
|
1756
|
+
if (listed.url) logMessage("system", ` • url: ${escapeBlessed(listed.url)}`);
|
|
1757
|
+
return;
|
|
1758
|
+
}
|
|
1759
|
+
logMessage("system", `{cyan-fg}ucode models:{/cyan-fg} ${listed.models.length} from ${escapeBlessed(listed.url)}`);
|
|
1760
|
+
if (listed.models.length === 0) {
|
|
1761
|
+
logMessage("system", " • (empty catalog)");
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
listed.models.slice(0, 40).forEach((id) => {
|
|
1765
|
+
const current = String(config.ucodeModel || "").trim() === id ? " {gray-fg}(current){/gray-fg}" : "";
|
|
1766
|
+
logMessage("system", ` • ${escapeBlessed(id)}${current}`);
|
|
1767
|
+
});
|
|
1768
|
+
if (listed.models.length > 40) {
|
|
1769
|
+
logMessage("system", ` • … ${listed.models.length - 40} more`);
|
|
1770
|
+
}
|
|
1771
|
+
} catch (err) {
|
|
1772
|
+
logMessage("error", `{white-fg}✗{/white-fg} ${escapeBlessed(err && err.message ? err.message : "models route failed")}`);
|
|
1773
|
+
}
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1667
1777
|
if (action === "clear") {
|
|
1668
1778
|
const fieldsRaw = args.slice(1).map((item) => String(item || "").trim().toLowerCase()).filter(Boolean);
|
|
1669
1779
|
const fields = fieldsRaw.length === 0 ? ["all"] : fieldsRaw;
|
|
@@ -1682,7 +1792,7 @@ function createCommandExecutor(options = {}) {
|
|
|
1682
1792
|
return;
|
|
1683
1793
|
}
|
|
1684
1794
|
|
|
1685
|
-
logMessage("error", "{white-fg}✗{/white-fg} Unknown settings ucode action. Use: show, set, clear");
|
|
1795
|
+
logMessage("error", "{white-fg}✗{/white-fg} Unknown settings ucode action. Use: show, set, models, clear");
|
|
1686
1796
|
}
|
|
1687
1797
|
|
|
1688
1798
|
async function executeCommand(text) {
|
package/src/app/chat/commands.js
CHANGED
|
@@ -135,7 +135,8 @@ const COMMAND_TREE = {
|
|
|
135
135
|
children: {
|
|
136
136
|
show: { desc: "Show ucode provider/model/url/key", order: 1 },
|
|
137
137
|
set: { desc: "Set ucode provider/model/url/key", order: 2 },
|
|
138
|
-
|
|
138
|
+
models: { desc: "List models from the provider /models route", order: 3 },
|
|
139
|
+
clear: { desc: "Clear ucode provider/model/url/key", order: 4 },
|
|
139
140
|
},
|
|
140
141
|
},
|
|
141
142
|
},
|
|
@@ -416,7 +416,7 @@ function createDaemonMessageRouter(options = {}) {
|
|
|
416
416
|
const publisher = report.agent_id || data.publisher || "ufoo-agent";
|
|
417
417
|
const displayName = resolveAgentDisplayName(publisher);
|
|
418
418
|
const detail = report.summary || report.message || data.message || report.task_id || "report";
|
|
419
|
-
logMessage("
|
|
419
|
+
logMessage("report", `${speakerPrefix(displayName)}${escapeBlessed(detail)}`, data);
|
|
420
420
|
requestStatus();
|
|
421
421
|
renderScreen();
|
|
422
422
|
return true;
|
|
@@ -33,8 +33,9 @@ function createInputSubmitHandler(options = {}) {
|
|
|
33
33
|
|
|
34
34
|
function userEcho(text, targetLabel = "") {
|
|
35
35
|
const body = escapeBlessed(text);
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// Match ucode › prompt echo so history reload and live log share a prefix.
|
|
37
|
+
if (!targetLabel) return `› ${body}`;
|
|
38
|
+
return `› {magenta-fg}@${escapeBlessed(targetLabel)}{/magenta-fg} ${body}`;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
async function tryActivateTargetAgent(agentId) {
|
package/src/code/agent.js
CHANGED
|
@@ -520,9 +520,22 @@ async function runNaturalLanguageTask(task = "", state = {}, options = {}) {
|
|
|
520
520
|
: null;
|
|
521
521
|
const pushToolLog = createToolLogCollector(logs, onToolLog);
|
|
522
522
|
|
|
523
|
-
//
|
|
524
|
-
const
|
|
525
|
-
const
|
|
523
|
+
// Structural / explicit upgrade to decomposed runner (not keyword "fix").
|
|
524
|
+
const { shouldUpgradeToDecomposition } = require("./taskRoute");
|
|
525
|
+
const routeDecision = shouldUpgradeToDecomposition(taskText, {
|
|
526
|
+
disableDecomposition: options.disableDecomposition,
|
|
527
|
+
forceDecomposition: options.forceDecomposition,
|
|
528
|
+
forceDirect: options.forceDirect,
|
|
529
|
+
failureCount: options.failureCount,
|
|
530
|
+
modelRequestedUpgrade: options.modelRequestedUpgrade,
|
|
531
|
+
hasPlanGraph: Boolean(
|
|
532
|
+
state.executionState
|
|
533
|
+
&& state.executionState.planGraph
|
|
534
|
+
&& state.executionState.planGraph.graphId
|
|
535
|
+
),
|
|
536
|
+
});
|
|
537
|
+
const useDecomposition = Boolean(routeDecision.upgrade);
|
|
538
|
+
state.lastRouteDecision = routeDecision;
|
|
526
539
|
const analysisTask = isProjectAnalysisTask(taskText);
|
|
527
540
|
const workspaceRoot = String(state.workspaceRoot || process.cwd());
|
|
528
541
|
ensureContextSessionState(state);
|
|
@@ -1124,6 +1137,7 @@ module.exports = {
|
|
|
1124
1137
|
runSingleCommand,
|
|
1125
1138
|
runNaturalLanguageTask,
|
|
1126
1139
|
resumeAfterUserInteraction,
|
|
1140
|
+
submitUserInteractionAnswer: (...args) => require("./protocol/suspension").submitUserInteractionAnswer(...args),
|
|
1127
1141
|
formatNlResult,
|
|
1128
1142
|
normalizeToolLogEvent,
|
|
1129
1143
|
isProjectAnalysisTask,
|
package/src/code/commands.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const UCODE_COMMAND_REGISTRY = [
|
|
8
8
|
{ cmd: "/help", desc: "Show available commands", order: 10 },
|
|
9
9
|
{ cmd: "/status", desc: "Show session / usage status", order: 20 },
|
|
10
|
-
{ cmd: "/model", desc: "Show or switch
|
|
10
|
+
{ cmd: "/model", desc: "Show or switch model (+ thinking intensity)", order: 25 },
|
|
11
11
|
{ cmd: "/plan", desc: "Show plan progress or set plan mode", order: 27 },
|
|
12
12
|
{ cmd: "/ubus", desc: "Check pending bus messages", order: 30 },
|
|
13
13
|
{ cmd: "/resume", desc: "Resume a saved session", order: 40 },
|
|
@@ -20,7 +20,7 @@ const UCODE_COMMAND_TREE = {
|
|
|
20
20
|
"/help": { desc: "Show available commands" },
|
|
21
21
|
"/status": { desc: "Show session / usage status" },
|
|
22
22
|
"/model": {
|
|
23
|
-
desc: "Show or switch
|
|
23
|
+
desc: "Show or switch model, then pick thinking intensity",
|
|
24
24
|
hasArguments: true,
|
|
25
25
|
optionalArguments: true,
|
|
26
26
|
},
|
|
@@ -59,7 +59,7 @@ function listUcodeCommandsForHelp() {
|
|
|
59
59
|
" /exit|/quit",
|
|
60
60
|
" /ubus",
|
|
61
61
|
" /status",
|
|
62
|
-
" /model [model-id]",
|
|
62
|
+
" /model [model-id] [off|low|medium|high|max]",
|
|
63
63
|
" /plan [on|off|show|hide|focus|debug|clear]",
|
|
64
64
|
" /skills [list]",
|
|
65
65
|
" /skills show <name>",
|
|
@@ -8,11 +8,16 @@ const {
|
|
|
8
8
|
} = require("./planGraph");
|
|
9
9
|
|
|
10
10
|
function emptyExecutionState() {
|
|
11
|
+
// Durable execution control plane. Field ownership: see
|
|
12
|
+
// src/code/protocol/ownership.js (STATE_OWNERSHIP / DURABLE_FIELDS).
|
|
11
13
|
return {
|
|
12
14
|
currentSegmentId: "",
|
|
13
15
|
mode: "single_action",
|
|
14
16
|
planMode: false,
|
|
15
17
|
planModeSource: "",
|
|
18
|
+
// R5 orthognal fields (dual-written with planMode during migration)
|
|
19
|
+
planningPolicy: "direct_allowed",
|
|
20
|
+
executionOwner: { kind: "none", id: "" },
|
|
16
21
|
steps: {},
|
|
17
22
|
modifiedFiles: [],
|
|
18
23
|
lastExitCodes: [],
|
|
@@ -63,6 +63,11 @@ function setPlanMode(executionState = null, enabled = true, {
|
|
|
63
63
|
const next = Boolean(enabled);
|
|
64
64
|
const wasOn = state.planMode === true;
|
|
65
65
|
state.planMode = next;
|
|
66
|
+
// R5 dual-write: Plan Mode UI maps to planningPolicy only.
|
|
67
|
+
state.planningPolicy = next ? "graph_required" : "direct_allowed";
|
|
68
|
+
if (!state.executionOwner || typeof state.executionOwner !== "object") {
|
|
69
|
+
state.executionOwner = { kind: "none", id: "" };
|
|
70
|
+
}
|
|
66
71
|
if (next) {
|
|
67
72
|
if (!wasOn) state.planModeEnteredAt = new Date().toISOString();
|
|
68
73
|
state.planModeReason = String(reason || state.planModeReason || "").trim();
|
|
@@ -101,7 +106,9 @@ function planHasNodes(executionState = null) {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
function planModeBlocksDirectTool(tool = "", executionState = null) {
|
|
104
|
-
|
|
109
|
+
const { getPlanningPolicy } = require("../protocol/controlPlane");
|
|
110
|
+
const policy = getPlanningPolicy(executionState);
|
|
111
|
+
if (policy !== "graph_required") return false;
|
|
105
112
|
const name = String(tool || "").trim().toLowerCase();
|
|
106
113
|
return name === "write" || name === "edit" || name === "bash";
|
|
107
114
|
}
|
|
@@ -31,7 +31,7 @@ const {
|
|
|
31
31
|
} = require("../skills");
|
|
32
32
|
const { hashContent } = require("./artifacts");
|
|
33
33
|
|
|
34
|
-
const PROMPT_VERSION = "native-
|
|
34
|
+
const PROMPT_VERSION = "native-v6";
|
|
35
35
|
|
|
36
36
|
function buildImmutablePrefix() {
|
|
37
37
|
return [
|
|
@@ -44,19 +44,20 @@ function buildImmutablePrefix() {
|
|
|
44
44
|
getOutputEfficiencySection(),
|
|
45
45
|
[
|
|
46
46
|
"Tool calling grammar:",
|
|
47
|
-
"- Use read, write, edit, bash, and artifact_read for direct work, even when it takes several tool calls.
|
|
48
|
-
"-
|
|
47
|
+
"- Use read, write, edit, bash, and artifact_read for direct, single-goal work, even when it takes several tool calls.",
|
|
48
|
+
"- TaskRuns are orthogonal to Plan Mode. A TaskRun does not require Plan Mode or a plan_graph. Use task_run operation=start with an objective for a standalone single-point TaskRun; it starts asynchronously and returns immediately.",
|
|
49
|
+
"- On complex or multi-goal requests, automatically decompose into concrete sub-objectives and start TaskRun(s) via task_run. Prefer task_run for independent or loosely coupled tracks; use plan_graph only when you need durable dependencies, checkpoints, or a shared executable plan.",
|
|
50
|
+
"- Use plan_graph for durable graph structure: create, patch, inspect, cancel_graph, and control. Graph-bound TaskRuns use plan_graph control.start_task on execution.kind=task_loop nodes.",
|
|
51
|
+
"- Plan Mode is a runtime posture for the Agent Loop, not an agent tool. While Plan Mode is ON, direct write, edit, and bash calls from the Agent Loop are blocked; read and artifact_read remain available. TaskRuns still run independently of Plan Mode.",
|
|
49
52
|
"- In the Agent Loop, plan_graph operation=create automatically enables Plan Mode. The user may also use /plan on or /plan off.",
|
|
50
|
-
"- Turning Plan Mode off does not cancel an existing graph or running TaskRuns.
|
|
53
|
+
"- Turning Plan Mode off does not cancel an existing graph or running TaskRuns. Cancel with task_run (standalone) or plan_graph operation=cancel_graph / control.cancel_task (graph-bound).",
|
|
51
54
|
"- When the user enables Plan Mode and no active graph exists, create a plan_graph before performing side effects.",
|
|
52
|
-
"- Use plan_graph for durable graph structure and TaskRun lifecycle: create, patch, inspect, cancel_graph, and control.",
|
|
53
55
|
"- After an accepted plan_graph create or patch, Runtime automatically advances ready tool nodes. Never invent or request an execute_graph tool.",
|
|
54
|
-
"- Do not call plan_graph together with read, write, edit, bash, or artifact_read in the same assistant turn.",
|
|
56
|
+
"- Do not call plan_graph or task_run together with read, write, edit, bash, or artifact_read in the same assistant turn.",
|
|
55
57
|
"- When an active graph is waiting on a task, advance that node through plan_graph instead of bypassing it with direct workspace tools: use patch.expand_node for execution.kind=expand, control.complete_task (nodeId) for execution.kind=inline_llm, or control.start_task for execution.kind=task_loop.",
|
|
56
|
-
"- control.complete_task with nodeId completes a waiting_llm inline_llm task for the current Graph owner. control.complete_task with taskRunId is reserved for the owning TaskLoop. Do not directly complete expand or aggregate tasks.",
|
|
57
|
-
"- While Plan Mode is ON, workspace mutations must be represented as plan_graph tool nodes or performed inside a running task_loop.",
|
|
58
|
+
"- control.complete_task with nodeId completes a waiting_llm inline_llm task for the current Graph owner. control.complete_task with taskRunId (or task_run complete) is reserved for the owning TaskLoop. Do not directly complete expand or aggregate tasks.",
|
|
59
|
+
"- While Plan Mode is ON, workspace mutations must be represented as plan_graph tool nodes or performed inside a running TaskRun/task_loop.",
|
|
58
60
|
"- Treat a User reminder as the latest user instruction. Reconcile it before continuing from tool results. If it is compatible with the active plan, resume the waiting plan node; otherwise patch, cancel, or replan first.",
|
|
59
|
-
"- Use execution.kind=task_loop for work that should continue asynchronously without occupying the Agent Loop. plan_graph operation=control action=start_task starts the TaskRun and returns immediately.",
|
|
60
61
|
"- TaskLoops do not consume User reminders. The Agent Loop is woken by runtime task_started, task_succeeded, task_failed, and task_cancelled events.",
|
|
61
62
|
"- Runtime enforces TaskRun concurrency limits and workspace write leases. Direct Agent write, edit, or bash calls may be rejected while writing TaskRuns are active.",
|
|
62
63
|
"- Tool results may contain an artifactId. Use artifact_read to hydrate raw stored output or a slice of it; use read for workspace file paths.",
|
package/src/code/dispatch.js
CHANGED
|
@@ -6,6 +6,7 @@ const { runEditTool } = require("./tools/edit");
|
|
|
6
6
|
const { runBashTool } = require("./tools/bash");
|
|
7
7
|
const { runArtifactReadTool } = require("./tools/artifactRead");
|
|
8
8
|
const { runPlanGraphTool } = require("./tools/planGraph");
|
|
9
|
+
const { runTaskRunTool } = require("./tools/taskRun");
|
|
9
10
|
const { runAskUserTool } = require("./tools/askUser");
|
|
10
11
|
|
|
11
12
|
const TOOL_NAMES = [
|
|
@@ -15,6 +16,7 @@ const TOOL_NAMES = [
|
|
|
15
16
|
"bash",
|
|
16
17
|
"artifact_read",
|
|
17
18
|
"plan_graph",
|
|
19
|
+
"task_run",
|
|
18
20
|
"ask_user",
|
|
19
21
|
];
|
|
20
22
|
|
|
@@ -26,6 +28,7 @@ function normalizeToolName(value = "") {
|
|
|
26
28
|
if (text === "bash") return "bash";
|
|
27
29
|
if (text === "artifact_read" || text === "artifact-read" || text === "artifactread") return "artifact_read";
|
|
28
30
|
if (text === "plan_graph" || text === "plan-graph" || text === "plangraph") return "plan_graph";
|
|
31
|
+
if (text === "task_run" || text === "task-run" || text === "taskrun") return "task_run";
|
|
29
32
|
if (text === "ask_user" || text === "ask-user" || text === "askuser") return "ask_user";
|
|
30
33
|
return "";
|
|
31
34
|
}
|
|
@@ -45,6 +48,7 @@ function runToolCall(input = {}, options = {}) {
|
|
|
45
48
|
if (tool === "edit") return runEditTool(args, options);
|
|
46
49
|
if (tool === "artifact_read") return runArtifactReadTool(args, options);
|
|
47
50
|
if (tool === "plan_graph") return runPlanGraphTool(args, options);
|
|
51
|
+
if (tool === "task_run") return runTaskRunTool(args, options);
|
|
48
52
|
if (tool === "ask_user") return runAskUserTool(args, options);
|
|
49
53
|
return runBashTool(args, options);
|
|
50
54
|
}
|
package/src/code/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const {
|
|
|
19
19
|
runSingleCommand,
|
|
20
20
|
runNaturalLanguageTask,
|
|
21
21
|
resumeAfterUserInteraction,
|
|
22
|
+
submitUserInteractionAnswer,
|
|
22
23
|
formatNlResult,
|
|
23
24
|
resolvePlannerProvider,
|
|
24
25
|
parseAgentArgs,
|
|
@@ -62,6 +63,7 @@ module.exports = {
|
|
|
62
63
|
runSingleCommand,
|
|
63
64
|
runNaturalLanguageTask,
|
|
64
65
|
resumeAfterUserInteraction,
|
|
66
|
+
submitUserInteractionAnswer,
|
|
65
67
|
formatNlResult,
|
|
66
68
|
resolvePlannerProvider,
|
|
67
69
|
parseAgentArgs,
|