@ouro.bot/cli 0.1.0-alpha.1134 → 0.1.0-alpha.1136
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.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1136",
|
|
6
|
+
"changes": [
|
|
7
|
+
"The Butler can restart a container that has been up for about an hour: Docker's \"Up About an hour\" status no longer reads as unknown, which had made the Butler refuse restarts Ari approved.",
|
|
8
|
+
"Containers that were created but never started (deliberately switched off) no longer show as degraded, so they stop raising standing health incidents."
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"version": "0.1.0-alpha.1135",
|
|
13
|
+
"changes": [
|
|
14
|
+
"When my provider refuses a request, I hear why and answer you myself instead of you getting a switch-provider message to deal with."
|
|
15
|
+
]
|
|
16
|
+
},
|
|
4
17
|
{
|
|
5
18
|
"version": "0.1.0-alpha.1134",
|
|
6
19
|
"changes": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0"?>
|
|
2
2
|
<Container version="2">
|
|
3
3
|
<Name>ouro-butler</Name>
|
|
4
|
-
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.
|
|
4
|
+
<Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1136</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
package/dist/heart/core.js
CHANGED
|
@@ -18,6 +18,8 @@ exports.settleContentMismatchError = settleContentMismatchError;
|
|
|
18
18
|
exports.getSettleRetryError = getSettleRetryError;
|
|
19
19
|
exports.stripLastToolCalls = stripLastToolCalls;
|
|
20
20
|
exports.repairOrphanedToolCalls = repairOrphanedToolCalls;
|
|
21
|
+
exports.isRejectedRequest = isRejectedRequest;
|
|
22
|
+
exports.dropReplayedReasoning = dropReplayedReasoning;
|
|
21
23
|
exports.runAgent = runAgent;
|
|
22
24
|
const config_1 = require("./config");
|
|
23
25
|
const identity_1 = require("./identity");
|
|
@@ -966,6 +968,24 @@ function isContextOverflow(err) {
|
|
|
966
968
|
return true;
|
|
967
969
|
return false;
|
|
968
970
|
}
|
|
971
|
+
// The provider refused the request itself (a 400 that is not a context overflow): something in what the runtime sent, not
|
|
972
|
+
// an outage. The agent gets one corrected retry instead of the turn failing (a replayed reasoning signature, a gap in tool results).
|
|
973
|
+
function isRejectedRequest(err) {
|
|
974
|
+
return err instanceof Error && err.status === 400 && !isContextOverflow(err);
|
|
975
|
+
}
|
|
976
|
+
// Reasoning blocks replayed from earlier turns are the agent's private scratch, and a provider may refuse their signatures.
|
|
977
|
+
// The current turn's own blocks stay: the provider needs them to continue tool use within the turn.
|
|
978
|
+
function dropReplayedReasoning(messages, keepFrom) {
|
|
979
|
+
return messages.map((message, index) => {
|
|
980
|
+
if (index >= keepFrom || message.role !== "assistant")
|
|
981
|
+
return message;
|
|
982
|
+
const record = message;
|
|
983
|
+
if (!("_thinking_blocks" in record) && !("_reasoning_items" in record))
|
|
984
|
+
return message;
|
|
985
|
+
const { _thinking_blocks: _thinking, _reasoning_items: _reasoning, ...rest } = record;
|
|
986
|
+
return rest;
|
|
987
|
+
});
|
|
988
|
+
}
|
|
969
989
|
const RETRY_LABELS = {
|
|
970
990
|
"auth-failure": "auth error",
|
|
971
991
|
"usage-limit": "usage limit",
|
|
@@ -1170,6 +1190,8 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1170
1190
|
let done = false;
|
|
1171
1191
|
let lastUsage;
|
|
1172
1192
|
let overflowRetried = false;
|
|
1193
|
+
let rejectedRequestRetried = false;
|
|
1194
|
+
let replayedReasoningDropped = false;
|
|
1173
1195
|
let outcome = "settled";
|
|
1174
1196
|
let completion;
|
|
1175
1197
|
let suspension;
|
|
@@ -1508,7 +1530,10 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1508
1530
|
// Whatever path built this request, every tool call reaches the provider with a result: a gap the runtime left must
|
|
1509
1531
|
// never 400 the turn and leave the agent unable to answer.
|
|
1510
1532
|
repairOrphanedToolCalls(attemptMessages);
|
|
1511
|
-
|
|
1533
|
+
const currentTurnStart = () => currentUserMessage ? Math.max(0, attemptMessages.indexOf(currentUserMessage)) : 0;
|
|
1534
|
+
if (replayedReasoningDropped)
|
|
1535
|
+
attemptMessages = dropReplayedReasoning(attemptMessages, currentTurnStart());
|
|
1536
|
+
if (rejectedAttempt.length > 0 || canonicalBudget.status !== "within_budget" || replayedReasoningDropped)
|
|
1512
1537
|
providerRuntime.resetTurnState(attemptMessages);
|
|
1513
1538
|
const turnCallbackBufferRef = { current: null };
|
|
1514
1539
|
const callProviderTurn = async () => {
|
|
@@ -1568,6 +1593,22 @@ async function runAgent(messages, callbacks, channel, signal, options) {
|
|
|
1568
1593
|
callbacks.onError(new Error("context trimmed, retrying..."), "transient");
|
|
1569
1594
|
return callProviderTurn();
|
|
1570
1595
|
}
|
|
1596
|
+
if (isRejectedRequest(error) && !rejectedRequestRetried) {
|
|
1597
|
+
// Never leave the agent unable to answer: correct what the runtime sent, tell the agent why, and let it carry on.
|
|
1598
|
+
rejectedRequestRetried = true;
|
|
1599
|
+
replayedReasoningDropped = true;
|
|
1600
|
+
const detail = error.message;
|
|
1601
|
+
attemptMessages = dropReplayedReasoning(attemptMessages, currentTurnStart());
|
|
1602
|
+
repairOrphanedToolCalls(attemptMessages);
|
|
1603
|
+
attemptMessages = [...attemptMessages, {
|
|
1604
|
+
role: "user",
|
|
1605
|
+
content: `[runtime] The provider refused my last request (${detail}). The runtime dropped reasoning replayed from earlier turns and closed any tool call left without a result. I carry on with the turn from here.`,
|
|
1606
|
+
}];
|
|
1607
|
+
providerRuntime.resetTurnState(attemptMessages);
|
|
1608
|
+
(0, runtime_1.emitNervesEvent)({ level: "warn", component: "engine", event: "engine.rejected_request_recovered", message: "provider refused the request; retrying once with corrected history", meta: { provider: providerRuntime.id, model: providerRuntime.model, detail: String(detail).slice(0, 300) } });
|
|
1609
|
+
callbacks.onError(new Error("provider refused the request, correcting and retrying..."), "transient");
|
|
1610
|
+
return callProviderTurn();
|
|
1611
|
+
}
|
|
1571
1612
|
throw error;
|
|
1572
1613
|
}
|
|
1573
1614
|
};
|
|
@@ -56,7 +56,7 @@ function display(value, maxBytes) {
|
|
|
56
56
|
prefix = prefix.slice(0, -1);
|
|
57
57
|
return { value: `${prefix}...`, truncated: true };
|
|
58
58
|
}
|
|
59
|
-
const DURATION = "(?:Less than a second|About a (?:minute|
|
|
59
|
+
const DURATION = "(?:Less than a second|About a (?:minute|day|week|month|year)|About an hour|(?:[1-9][0-9]*) (?:seconds?|minutes?|hours?|days?|weeks?|months?|years?))";
|
|
60
60
|
const RUNNING = new RegExp(`^Up ${DURATION}(?: \\((?:healthy|unhealthy|health: starting)\\))?$`, "u");
|
|
61
61
|
const EXITED = new RegExp(`^Exited \\((0|[1-9][0-9]*)\\) ${DURATION} ago$`, "u");
|
|
62
62
|
const RESTARTING = new RegExp(`^Restarting \\((0|[1-9][0-9]*)\\) ${DURATION} ago$`, "u");
|
|
@@ -75,6 +75,9 @@ function normalizeDockerStatus(structuredState, status) {
|
|
|
75
75
|
const code = exitCode(exited);
|
|
76
76
|
return code === null ? { state: "unknown", exitCode: null, degraded: true } : { state: "exited", exitCode: code, degraded: false };
|
|
77
77
|
}
|
|
78
|
+
// A container that was created but never started (Docker shows "Created") is stopped on purpose, not degraded.
|
|
79
|
+
if ((state === "CREATED" || state === "EXITED") && status === "Created")
|
|
80
|
+
return { state: "created", exitCode: null, degraded: false };
|
|
78
81
|
const restarting = status.match(RESTARTING);
|
|
79
82
|
if ((state === "RUNNING" || state === "EXITED") && restarting) {
|
|
80
83
|
const code = exitCode(restarting);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1136",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@ouro.bot/cli",
|
|
9
|
-
"version": "0.1.0-alpha.
|
|
9
|
+
"version": "0.1.0-alpha.1136",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@ouro.bot/friends": "0.1.0-alpha.18",
|