@ouro.bot/cli 0.1.0-alpha.1711 → 0.1.0-alpha.1713
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 +24 -2
- package/deploy/unraid/sanctuary-replay-gate.mjs +23 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/mind/pending.js +30 -0
- package/dist/repertoire/tools-surface.js +12 -0
- package/dist/senses/bluebubbles/index.js +18 -0
- package/dist/senses/pipeline.js +29 -1
- package/dist/senses/proactive-content-guard.js +31 -1
- package/dist/senses/shared-turn.js +3 -1
- package/dist/senses/teams.js +34 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "Each pull request writes its own change note under changes/; the release job on main gives each landed change its version and adds the notes here (scripts/release-version.cjs). On main this file stops at the last version set by hand; the published package has every release. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.1713",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Ouro no longer sends you unprompted routine notices, or heads-ups about a later approval that asks nothing of you now. It holds them and gives you one short summary the next time you write to it. Requested updates, anything that needs you now (including the later approval request itself), warnings about lost work or an ongoing outage, and corrections still send right away."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"version": "0.1.0-alpha.1712",
|
|
12
|
+
"changes": [
|
|
13
|
+
"Internal: the Butler's release gate now waits for an await's delivery, not just its archive, before it judges the two await cases. The Butler archives an await and then delivers its outcome. On 0.1.0-alpha.1704 the gate read the peer's outbox 57 ms before the delivery landed, and rolled back a release that had delivered. A delivery that never comes still fails the case, 30 s after the archive."
|
|
14
|
+
]
|
|
15
|
+
},
|
|
4
16
|
{
|
|
5
17
|
"version": "0.1.0-alpha.1711",
|
|
6
18
|
"changes": [
|
|
@@ -12,17 +24,27 @@
|
|
|
12
24
|
{
|
|
13
25
|
"version": "0.1.0-alpha.1710",
|
|
14
26
|
"changes": [
|
|
15
|
-
"Update the Ouro UI files to Ouro UI v1.3.637.",
|
|
16
27
|
"Made a flaky sync test steadier (#2056): after a SIGTERM during push, \"no git child\" now waits for the whole process group to be gone, not only its leader, before asserting. No change to the shipped sync code."
|
|
17
28
|
]
|
|
18
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"version": "0.1.0-alpha.1709",
|
|
32
|
+
"changes": [
|
|
33
|
+
"Update the Ouro UI files to Ouro UI v1.3.637."
|
|
34
|
+
]
|
|
35
|
+
},
|
|
19
36
|
{
|
|
20
37
|
"version": "0.1.0-alpha.1708",
|
|
21
38
|
"changes": [
|
|
22
|
-
"Internal: the release script's npm-wait tests that run an hour on a fake clock now have a 60 s timeout, so they no longer fail on a busy CI runner (#2053).",
|
|
23
39
|
"iMessage no longer misses a message that iMessage delivers minutes after it was sent. Catch-up used to look only at messages sent in the last 90 seconds, so a late message that BlueBubbles sent no webhook for waited until the next outage to be found (8.5 minutes on 2026-11-27). Each 30-second catch-up now also reads the rows that reached the Messages database since the last one, by arrival order, so the agent gets such a message within about 30 seconds of it landing, and the log says how late iMessage delivered it. If that turn fails, the next catch-up reaches back to the message again, for up to a day."
|
|
24
40
|
]
|
|
25
41
|
},
|
|
42
|
+
{
|
|
43
|
+
"version": "0.1.0-alpha.1707",
|
|
44
|
+
"changes": [
|
|
45
|
+
"Internal: the release script's npm-wait tests that run an hour on a fake clock now have a 60 s timeout, so they no longer fail on a busy CI runner (#2053)."
|
|
46
|
+
]
|
|
47
|
+
},
|
|
26
48
|
{
|
|
27
49
|
"version": "0.1.0-alpha.1706",
|
|
28
50
|
"changes": [
|
|
@@ -84,6 +84,12 @@ export const GATE_PLANTED_STRINGS = ["english subtitles", "ISOLATION-CANARY", "(
|
|
|
84
84
|
export const DEFAULT_WINDOW_MINUTES = 85
|
|
85
85
|
export const AWAIT_TIMEOUT_MS = 8 * 60 * 1000
|
|
86
86
|
export const AWAIT_POLL_MS = 15 * 1000
|
|
87
|
+
/**
|
|
88
|
+
* How long a polled case keeps reading after its await is archived, for the delivery that follows it. The Butler archives
|
|
89
|
+
* the await, then delivers: alpha.1704's gate read the peer's outbox 57 ms before the delivery landed and failed a release
|
|
90
|
+
* that had delivered. A delivery that never comes still fails, after this grace instead of the whole poll timeout.
|
|
91
|
+
*/
|
|
92
|
+
export const DELIVERY_GRACE_MS = 30 * 1000
|
|
87
93
|
export const MESSAGE_TIMEOUT_MS = 330 * 1000
|
|
88
94
|
// The Butler's A2A server cuts a request at five minutes while the turn itself keeps running. A send that errors after this
|
|
89
95
|
// long was cut, not refused (a refusal answers at once), so the gate waits for the turn to finish before it reads anything back.
|
|
@@ -193,6 +199,13 @@ const check = (name, ok, detail = "") => ({ name, ok: Boolean(ok), ...(detail ?
|
|
|
193
199
|
const sinkFor = (sink, friendId, predicate) => sink.filter((line) => line.friendId === friendId && predicate(line))
|
|
194
200
|
const isDelegatedNotice = (line) => String(line.noticeId).startsWith("delegated:")
|
|
195
201
|
|
|
202
|
+
/** Sink lines present after that were not present before, by notice id and friend. */
|
|
203
|
+
export function newSinkLines(before, after) {
|
|
204
|
+
const key = (line) => `${line.friendId}|${line.noticeId}`
|
|
205
|
+
const known = new Set((before.sink ?? []).map(key))
|
|
206
|
+
return (after.sink ?? []).filter((line) => !known.has(key(line)))
|
|
207
|
+
}
|
|
208
|
+
|
|
196
209
|
/** Outbox entry ids per friend that appeared between two observations. */
|
|
197
210
|
export function newOutboxEntries(before, after) {
|
|
198
211
|
const out = {}
|
|
@@ -587,6 +600,7 @@ export const CASES = [
|
|
|
587
600
|
timeoutMs: AWAIT_TIMEOUT_MS,
|
|
588
601
|
intervalMs: AWAIT_POLL_MS,
|
|
589
602
|
until: ({ after, before, context }) => caseAwaitsSettled(before, after, context),
|
|
603
|
+
delivered: ({ after, before, friends }) => newSinkLines(before, after).some((line) => line.friendId === friends.principal && !isDelegatedNotice(line)),
|
|
590
604
|
},
|
|
591
605
|
readback: ({ before, after, sink, friends, context }) => {
|
|
592
606
|
const { mine: filed, others } = caseAwaits(before, after, context)
|
|
@@ -870,6 +884,7 @@ export const CASES = [
|
|
|
870
884
|
timeoutMs: AWAIT_TIMEOUT_MS,
|
|
871
885
|
intervalMs: AWAIT_POLL_MS,
|
|
872
886
|
until: ({ after, before, context }) => caseAwaitsSettled(before, after, context),
|
|
887
|
+
delivered: ({ after, before, friends }) => (newOutboxEntries(before, after)[friends.principal] ?? []).length > 0,
|
|
873
888
|
},
|
|
874
889
|
readback: ({ before, after, sink, friends, context }) => {
|
|
875
890
|
const { mine: filed, others } = caseAwaits(before, after, context)
|
|
@@ -995,7 +1010,14 @@ export async function runCase(host, testCase, { plant, deadline = Infinity } = {
|
|
|
995
1010
|
let after = await host.observe()
|
|
996
1011
|
if (testCase.poll) {
|
|
997
1012
|
const deadline = host.now() + testCase.poll.timeoutMs
|
|
998
|
-
|
|
1013
|
+
let settledAt = null
|
|
1014
|
+
while (host.now() < deadline) {
|
|
1015
|
+
if (testCase.poll.until({ before, after, context })) {
|
|
1016
|
+
// Settled is not delivered: the delivery lands just after the archive, so wait for it, but only for the grace.
|
|
1017
|
+
if (!testCase.poll.delivered || testCase.poll.delivered({ before, after, context, friends: host.friends })) break
|
|
1018
|
+
settledAt ??= host.now()
|
|
1019
|
+
if (host.now() - settledAt >= DELIVERY_GRACE_MS) break
|
|
1020
|
+
}
|
|
999
1021
|
await host.sleep(testCase.poll.intervalMs)
|
|
1000
1022
|
after = await host.observe()
|
|
1001
1023
|
}
|
|
@@ -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.1713</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/mind/pending.js
CHANGED
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.MAX_PENDING_FAILED_TRIES = exports.PRIVATE_RUNTIME_PENDING = void 0;
|
|
37
37
|
exports.getPendingDir = getPendingDir;
|
|
38
38
|
exports.getDeferredReturnDir = getDeferredReturnDir;
|
|
39
|
+
exports.getHeldNoticeDir = getHeldNoticeDir;
|
|
39
40
|
exports.getPrivateRuntimePendingDir = getPrivateRuntimePendingDir;
|
|
40
41
|
exports.releaseHeldPendingClaimsOnExit = releaseHeldPendingClaimsOnExit;
|
|
41
42
|
exports.hasPendingMessages = hasPendingMessages;
|
|
@@ -44,6 +45,8 @@ exports.queuePendingMessageOnce = queuePendingMessageOnce;
|
|
|
44
45
|
exports.claimPending = claimPending;
|
|
45
46
|
exports.enqueueDeferredReturn = enqueueDeferredReturn;
|
|
46
47
|
exports.drainDeferredReturns = drainDeferredReturns;
|
|
48
|
+
exports.holdNoticeForReturn = holdNoticeForReturn;
|
|
49
|
+
exports.claimHeldNotices = claimHeldNotices;
|
|
47
50
|
exports.withdrawDeferredReturn = withdrawDeferredReturn;
|
|
48
51
|
exports.drainPending = drainPending;
|
|
49
52
|
const fs = __importStar(require("fs"));
|
|
@@ -60,6 +63,9 @@ function getPendingDir(agentName, friendId, channel, key, agentRoot = (0, identi
|
|
|
60
63
|
function getDeferredReturnDir(agentName, friendId) {
|
|
61
64
|
return path.join((0, identity_1.getAgentRoot)(agentName), "state", "pending-returns", friendId);
|
|
62
65
|
}
|
|
66
|
+
function getHeldNoticeDir(agentName, friendId) {
|
|
67
|
+
return path.join((0, identity_1.getAgentRoot)(agentName), "state", "held-notices", friendId);
|
|
68
|
+
}
|
|
63
69
|
/** Canonical private-runtime pending path segments. The path is historical durable state. */
|
|
64
70
|
exports.PRIVATE_RUNTIME_PENDING = { friendId: "self", channel: "inner", key: "dialog" };
|
|
65
71
|
/** Returns the pending dir for this agent's private runtime. */
|
|
@@ -401,6 +407,30 @@ function drainDeferredReturns(agentName, friendId) {
|
|
|
401
407
|
});
|
|
402
408
|
return messages;
|
|
403
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Keeps a routine notice for the friend's next return summary. One file per text, so the same notice held twice
|
|
412
|
+
* is kept once. Throws when it could not be written: the caller must then not treat the notice as held.
|
|
413
|
+
*/
|
|
414
|
+
function holdNoticeForReturn(agentName, friendId, text) {
|
|
415
|
+
const dir = getHeldNoticeDir(agentName, friendId);
|
|
416
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
417
|
+
const filePath = path.join(dir, `${(0, node_crypto_1.createHash)("sha256").update(text).digest("hex").slice(0, 32)}.json`);
|
|
418
|
+
if (!fs.existsSync(filePath)) {
|
|
419
|
+
const message = { from: agentName, friendId, content: (0, session_events_1.capStructuredRecordString)(text), timestamp: Date.now(), disposition: "held_notice" };
|
|
420
|
+
(0, atomic_file_1.writeJsonAtomicSync)(filePath, message);
|
|
421
|
+
}
|
|
422
|
+
(0, runtime_1.emitNervesEvent)({
|
|
423
|
+
event: "mind.held_notice_kept",
|
|
424
|
+
component: "mind",
|
|
425
|
+
message: "routine notice held for the friend's return summary",
|
|
426
|
+
meta: { friendId, dir },
|
|
427
|
+
});
|
|
428
|
+
return filePath;
|
|
429
|
+
}
|
|
430
|
+
/** Takes a friend's held notices for the one turn that summarises them; settle after the summary is delivered, release if not. */
|
|
431
|
+
function claimHeldNotices(agentName, friendId) {
|
|
432
|
+
return claimPending(getHeldNoticeDir(agentName, friendId));
|
|
433
|
+
}
|
|
404
434
|
/**
|
|
405
435
|
* Removes the saved copies of one message from a friend's deferred returns, for when the same turn
|
|
406
436
|
* reached them another way after it was saved. Returns how many it removed.
|
|
@@ -351,6 +351,8 @@ async function routeSurfaceToFriend(agentName, friendId, content, queueItem, hin
|
|
|
351
351
|
return { status: "unconfirmed", detail: unconfirmedDetail("Teams") };
|
|
352
352
|
if (sent?.reason && CONTENT_REFUSALS.has(sent.reason)) {
|
|
353
353
|
const held = (0, proactive_content_guard_1.getProactiveInternalContentBlockReason)(content);
|
|
354
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(held))
|
|
355
|
+
return { status: "queued", detail: "held for their return summary; they get it with other routine notices when they next message" };
|
|
354
356
|
const detail = (0, proactive_content_guard_1.isReturnToSenderReason)(held)
|
|
355
357
|
? (0, proactive_content_guard_1.proactiveContentBlockGuidance)(held)
|
|
356
358
|
: `blocked: Teams refused this text as internal (${sent.reason}); rewrite it as plain words for them`;
|
|
@@ -444,6 +446,16 @@ async function routeSurfaceToFriend(agentName, friendId, content, queueItem, hin
|
|
|
444
446
|
// them, never into a session only agents read (MCP) or one they must reopen (CLI).
|
|
445
447
|
// Text the senses' content guard refuses goes nowhere, whichever chat is newest.
|
|
446
448
|
const contentBlock = (0, proactive_content_guard_1.getProactiveInternalContentBlockReason)(content);
|
|
449
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(contentBlock)) {
|
|
450
|
+
try {
|
|
451
|
+
const { holdNoticeForReturn } = await Promise.resolve().then(() => __importStar(require("../mind/pending")));
|
|
452
|
+
holdNoticeForReturn(agentName, friendId, content);
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
return { status: "failed", detail: (0, tool_error_code_1.withCode)(`the notice could not be kept for their return summary (${error instanceof Error ? error.message : String(error)}); nothing was sent`, "delivery-blocked") };
|
|
456
|
+
}
|
|
457
|
+
return { status: "queued", detail: "held for their return summary; they get it with other routine notices when they next message" };
|
|
458
|
+
}
|
|
447
459
|
if (contentBlock) {
|
|
448
460
|
return { status: "failed", detail: (0, tool_error_code_1.withCode)((0, proactive_content_guard_1.proactiveContentBlockGuidance)(contentBlock), "delivery-blocked") };
|
|
449
461
|
}
|
|
@@ -4433,6 +4433,14 @@ async function sendProactiveBlueBubblesMessageToSession(params, deps = {}) {
|
|
|
4433
4433
|
source: "session_send",
|
|
4434
4434
|
intent: params.intent ?? "generic_outreach",
|
|
4435
4435
|
});
|
|
4436
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(internalContentBlockReason)) {
|
|
4437
|
+
try {
|
|
4438
|
+
(0, pending_1.holdNoticeForReturn)((0, identity_1.getAgentName)(), params.friendId, params.text);
|
|
4439
|
+
}
|
|
4440
|
+
catch {
|
|
4441
|
+
return { delivered: false, reason: "send_error" };
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4436
4444
|
return { delivered: false, reason: "internal_content_blocked" };
|
|
4437
4445
|
}
|
|
4438
4446
|
let image;
|
|
@@ -4598,6 +4606,16 @@ async function drainAndSendPendingBlueBubbles(deps = {}, pendingRoot) {
|
|
|
4598
4606
|
}
|
|
4599
4607
|
const internalBlockReason = (0, proactive_content_guard_1.getProactiveInternalContentBlockReason)(messageText);
|
|
4600
4608
|
if (internalBlockReason) {
|
|
4609
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(internalBlockReason)) {
|
|
4610
|
+
// The pending file is the only copy: it goes only once the notice is kept.
|
|
4611
|
+
try {
|
|
4612
|
+
(0, pending_1.holdNoticeForReturn)((0, identity_1.getAgentName)(), friendId, messageText);
|
|
4613
|
+
}
|
|
4614
|
+
catch {
|
|
4615
|
+
result.failed++;
|
|
4616
|
+
continue;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4601
4619
|
result.skipped++;
|
|
4602
4620
|
try {
|
|
4603
4621
|
fs.unlinkSync(filePath);
|
package/dist/senses/pipeline.js
CHANGED
|
@@ -83,6 +83,17 @@ const friend_link_codes_1 = require("../mind/friend-link-codes");
|
|
|
83
83
|
const reply_gate_1 = require("./reply-gate");
|
|
84
84
|
const VOICE_PENDING_MAX_AGE_MS = 15 * 60 * 1_000;
|
|
85
85
|
const TELEGRAM_GENERIC_OUTREACH_PENDING_MAX_AGE_MS = 15 * 60 * 1_000;
|
|
86
|
+
function renderHeldNoticeSummary(held) {
|
|
87
|
+
const lines = [...held]
|
|
88
|
+
.sort((a, b) => a.timestamp - b.timestamp)
|
|
89
|
+
.map((notice) => `- (${new Date(notice.timestamp).toISOString()}) ${notice.content}`);
|
|
90
|
+
return {
|
|
91
|
+
from: held[0].from,
|
|
92
|
+
friendId: held[0].friendId,
|
|
93
|
+
timestamp: Date.now(),
|
|
94
|
+
content: `Routine notices held while they were away, not sent to them. Give them one short summary of these, folded into your reply to this message; do not send them as separate messages, and do not send this summary on its own:\n${lines.join("\n")}`,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
86
97
|
function pendingExpirationReason(channel, message, now, agentName) {
|
|
87
98
|
/* v8 ignore start -- pending expiry edge permutations are covered by the stale voice queue tests; this helper keeps defensive non-voice fallbacks @preserve */
|
|
88
99
|
if (Number.isFinite(message.expiresAt) && Number(message.expiresAt) <= now)
|
|
@@ -856,6 +867,8 @@ async function handleInboundTurnExclusive(input) {
|
|
|
856
867
|
const liveLatencyMode = input.latencyMode === "live";
|
|
857
868
|
let declinedForHome = false;
|
|
858
869
|
let pendingClaim;
|
|
870
|
+
let heldNoticeClaim;
|
|
871
|
+
let handedOffHeldNotices = false;
|
|
859
872
|
let turnActed = false;
|
|
860
873
|
let turnThrew = false;
|
|
861
874
|
let turnFailedOnMessages = false;
|
|
@@ -942,11 +955,16 @@ async function handleInboundTurnExclusive(input) {
|
|
|
942
955
|
const deferredReturns = input.channel === "inner"
|
|
943
956
|
? []
|
|
944
957
|
: (input.drainDeferredReturns?.(resolvedContext.friend.id) ?? []);
|
|
958
|
+
heldNoticeClaim = input.channel === "inner" ? undefined : input.claimHeldNotices?.(resolvedContext.friend.id);
|
|
959
|
+
const heldNoticeSummary = heldNoticeClaim && heldNoticeClaim.messages.length > 0
|
|
960
|
+
? [renderHeldNoticeSummary(heldNoticeClaim.messages)]
|
|
961
|
+
: [];
|
|
945
962
|
pendingClaim = input.claimPending?.(input.pendingDir);
|
|
946
963
|
const sessionPending = pendingClaim ? pendingClaim.messages : input.drainPending(input.pendingDir);
|
|
947
964
|
// A deferred return was saved for the friend's next message, whenever that comes, so a
|
|
948
965
|
// sense's freshness window for its own pending never drops it.
|
|
949
966
|
const pending = [
|
|
967
|
+
...heldNoticeSummary,
|
|
950
968
|
...deferredReturns,
|
|
951
969
|
...filterDeliverablePendingMessages({
|
|
952
970
|
pendingDir: input.pendingDir,
|
|
@@ -1237,8 +1255,11 @@ async function handleInboundTurnExclusive(input) {
|
|
|
1237
1255
|
turnFailedOnMessages = result.outcome === "errored" && result.errorClassification === "unknown";
|
|
1238
1256
|
const persistTurn = async (...args) => {
|
|
1239
1257
|
await input.postTurn(...args);
|
|
1240
|
-
if (turnFinished)
|
|
1258
|
+
if (turnFinished) {
|
|
1241
1259
|
pendingClaim?.settle();
|
|
1260
|
+
if (!input.confirmHeldNoticeDelivery)
|
|
1261
|
+
heldNoticeClaim?.settle();
|
|
1262
|
+
}
|
|
1242
1263
|
};
|
|
1243
1264
|
if (result.outcome === "suspended") {
|
|
1244
1265
|
if (!result.suspension)
|
|
@@ -1394,6 +1415,8 @@ async function handleInboundTurnExclusive(input) {
|
|
|
1394
1415
|
friendId: resolvedContext.friend.id,
|
|
1395
1416
|
},
|
|
1396
1417
|
});
|
|
1418
|
+
const heldClaimForDelivery = heldNoticeClaim;
|
|
1419
|
+
handedOffHeldNotices = Boolean(input.confirmHeldNoticeDelivery && turnFinished && heldClaimForDelivery && heldClaimForDelivery.messages.length > 0);
|
|
1397
1420
|
return {
|
|
1398
1421
|
resolvedContext,
|
|
1399
1422
|
gateResult,
|
|
@@ -1403,6 +1426,9 @@ async function handleInboundTurnExclusive(input) {
|
|
|
1403
1426
|
sessionPath: session.sessionPath,
|
|
1404
1427
|
messages: sessionMessages,
|
|
1405
1428
|
drainedPending: pending,
|
|
1429
|
+
...(handedOffHeldNotices && heldClaimForDelivery ? {
|
|
1430
|
+
heldNoticeDelivery: { confirm: () => heldClaimForDelivery.settle(), release: () => heldClaimForDelivery.release() },
|
|
1431
|
+
} : {}),
|
|
1406
1432
|
...(input.switchedProvider ? { switchedProvider: input.switchedProvider } : {}),
|
|
1407
1433
|
// Every chat sense answers an errored turn. The inner channel stays silent, and the CLI keeps showing its operator the raw error.
|
|
1408
1434
|
...(result.outcome === "errored" && input.channel !== "inner" && input.channel !== "cli" ? { failoverMessage: erroredTurnReply(result.error?.message) } : {}),
|
|
@@ -1416,6 +1442,8 @@ async function handleInboundTurnExclusive(input) {
|
|
|
1416
1442
|
// Pending messages a turn did not handle go back for the next turn; a throw or an unclassified error counts
|
|
1417
1443
|
// against them. After the first tool start the claim holds nothing, so this is a no-op.
|
|
1418
1444
|
pendingClaim?.release({ failed: turnThrew || turnFailedOnMessages });
|
|
1445
|
+
if (!(handedOffHeldNotices && !turnThrew))
|
|
1446
|
+
heldNoticeClaim?.release();
|
|
1419
1447
|
// Step 6b: Post-turn sync (opt-in). The commit is synchronous, so the
|
|
1420
1448
|
// turn's edits are recorded before the reply goes out; the push runs on
|
|
1421
1449
|
// without being awaited, holding the lock, and records its own failure.
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getProactiveInternalContentBlockReason = getProactiveInternalContentBlockReason;
|
|
37
|
+
exports.isHeldForReturnReason = isHeldForReturnReason;
|
|
37
38
|
exports.isReturnToSenderReason = isReturnToSenderReason;
|
|
38
39
|
exports.proactiveContentBlockGuidance = proactiveContentBlockGuidance;
|
|
39
40
|
exports.returnHeldProactiveMessage = returnHeldProactiveMessage;
|
|
@@ -80,6 +81,28 @@ function getUntestedClaimReason(text) {
|
|
|
80
81
|
return "untested_delivery_claim";
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
84
|
+
// A routine notice asks nothing of the person now and warns of nothing: it waits for their return summary.
|
|
85
|
+
const NO_ACTION_NOW_PATTERN = /\b(?:nothing (?:to do|needed|for you to do)|no action (?:is )?(?:needed|required)|nothing is needed|fyi|just so you know)\b/i;
|
|
86
|
+
const FUTURE_GATE_PATTERN = /\b(?:nothing to do yet|nothing (?:is )?needed (?:from you )?yet|no action (?:is )?(?:needed|required) yet)\b/i;
|
|
87
|
+
const FUTURE_GATE_LATER_PATTERN = /\b(?:when|once|after|later)\b[^.]*\b(?:i'll|i will|will)\b[^.]*\b(?:send|ask|prompt|text|message)\b/i;
|
|
88
|
+
// Anything the person must know or act on now beats routine: a risk, a correction, a request, an update they asked for.
|
|
89
|
+
const MATERIAL_RISK_PATTERN = /\b(?:lost|lose|losing|data loss|outage|still (?:down|broken|failing)|is down|are down|went down|corrupt\w*|deleted|wiped|breach\w*|leak\w*|exposed|forced reboot|crash\w*|unrecoverable|at risk|urgent|failed to)\b/i;
|
|
90
|
+
const CORRECTION_PATTERN = /\b(?:correction|i was wrong|i got that wrong|that was wrong|ignore (?:my )?(?:last|earlier|previous)|disregard|retract\w*|mistake|my earlier (?:message|note))\b/i;
|
|
91
|
+
const PRESENT_ASK_PATTERN = /\b(?:please|can you|could you|would you|do you want|let me know|reply|need you to|need your|waiting (?:on|for) you|approve (?:it )?now|tap now|tap to approve|sign in now)\b/i;
|
|
92
|
+
function getRoutineNoticeReason(text) {
|
|
93
|
+
if (REQUESTED_STATUS_PATTERN.test(text) || MATERIAL_RISK_PATTERN.test(text) || CORRECTION_PATTERN.test(text))
|
|
94
|
+
return null;
|
|
95
|
+
// The announced later request ("I'll send you a tap to approve") is not a present ask; any other sentence's ask is.
|
|
96
|
+
const futureGate = FUTURE_GATE_PATTERN.test(text) && FUTURE_GATE_LATER_PATTERN.test(text);
|
|
97
|
+
const withoutAnnouncedRequest = futureGate ? text.replace(new RegExp(FUTURE_GATE_LATER_PATTERN.source + "[^.]*[.]?", "ig"), " ") : text;
|
|
98
|
+
if (PRESENT_ASK_PATTERN.test(withoutAnnouncedRequest))
|
|
99
|
+
return null;
|
|
100
|
+
if (futureGate)
|
|
101
|
+
return "routine_notice";
|
|
102
|
+
if (NO_ACTION_NOW_PATTERN.test(text) && !/\?/.test(text))
|
|
103
|
+
return "routine_notice";
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
83
106
|
// ── Public API ──────────────────────────────────────────────────
|
|
84
107
|
/**
|
|
85
108
|
* The reason a proactive (off-turn) send must not reach the person, or null.
|
|
@@ -90,7 +113,11 @@ function getProactiveInternalContentBlockReason(text) {
|
|
|
90
113
|
if (pattern.test(text))
|
|
91
114
|
return reason;
|
|
92
115
|
}
|
|
93
|
-
return getUntestedClaimReason(text);
|
|
116
|
+
return getUntestedClaimReason(text) ?? getRoutineNoticeReason(text);
|
|
117
|
+
}
|
|
118
|
+
/** A routine notice is kept for the person's return summary, not sent and not returned to the sender. */
|
|
119
|
+
function isHeldForReturnReason(reason) {
|
|
120
|
+
return reason === "routine_notice";
|
|
94
121
|
}
|
|
95
122
|
/** Reasons the sender is told about, so it can verify the result itself. */
|
|
96
123
|
function isReturnToSenderReason(reason) {
|
|
@@ -101,6 +128,9 @@ function proactiveContentBlockGuidance(reason) {
|
|
|
101
128
|
if (reason === "untested_delivery_claim") {
|
|
102
129
|
return "held back, not sent (untested_delivery_claim): do not report an untested result. Verify it yourself, then send the verified result with its proof, naming exactly what you verified (a mobile-web browser render is not proof for the native app). A status update they asked for may go unverified if it says so (\"as you asked\")";
|
|
103
130
|
}
|
|
131
|
+
if (reason === "routine_notice") {
|
|
132
|
+
return "held, not sent (routine_notice): it asks nothing of them now and warns of nothing, so it is kept for the one summary they get when they next message. If it reports lost work, data loss or an outage, corrects an earlier message, or asks for something now, say so plainly and send it again";
|
|
133
|
+
}
|
|
104
134
|
return `blocked: this reads as internal status${reason ? ` (${reason})` : ""}, so no chat sends it; rewrite it as plain words for them`;
|
|
105
135
|
}
|
|
106
136
|
/**
|
|
@@ -636,7 +636,9 @@ async function runSenseTurnExclusive(options, owner) {
|
|
|
636
636
|
// A surface saved for a person's next message is picked up on their next
|
|
637
637
|
// Telegram or voice turn too; agent channels (MCP, a2a) never take it.
|
|
638
638
|
...((channel === "telegram" || channel === "voice") && !options.disablePersistence
|
|
639
|
-
? {
|
|
639
|
+
? {
|
|
640
|
+
drainDeferredReturns: (deferredFriendId) => (0, pending_1.drainDeferredReturns)(agentName, deferredFriendId),
|
|
641
|
+
}
|
|
640
642
|
: {}),
|
|
641
643
|
runAgentOptions: {
|
|
642
644
|
mcpManager,
|
package/dist/senses/teams.js
CHANGED
|
@@ -1161,6 +1161,8 @@ async function handleTeamsMessage(text, stream, conversationId, teamsContext, se
|
|
|
1161
1161
|
enforceTrustGate: trust_gate_1.enforceTrustGate,
|
|
1162
1162
|
drainPending: pending_1.drainPending,
|
|
1163
1163
|
drainDeferredReturns: (deferredFriendId) => (0, pending_1.drainDeferredReturns)(agentName, deferredFriendId),
|
|
1164
|
+
claimHeldNotices: (heldFriendId) => (0, pending_1.claimHeldNotices)(agentName, heldFriendId),
|
|
1165
|
+
confirmHeldNoticeDelivery: true,
|
|
1164
1166
|
runAgent: async (msgs, cb, channel, sig, opts) => {
|
|
1165
1167
|
consumingTeamsSteering.add(turnKey);
|
|
1166
1168
|
try {
|
|
@@ -1225,8 +1227,20 @@ async function handleTeamsMessage(text, stream, conversationId, teamsContext, se
|
|
|
1225
1227
|
}
|
|
1226
1228
|
return;
|
|
1227
1229
|
}
|
|
1228
|
-
// Flush any remaining accumulated text at end of turn
|
|
1229
|
-
|
|
1230
|
+
// Flush any remaining accumulated text at end of turn. The held notices are settled only once this reached the
|
|
1231
|
+
// person with a reply; a failed or empty delivery puts them back for the next message.
|
|
1232
|
+
let delivered = false;
|
|
1233
|
+
try {
|
|
1234
|
+
await callbacks.flush();
|
|
1235
|
+
const finalReply = result.messages?.findLast((message) => message.role === "assistant");
|
|
1236
|
+
delivered = typeof finalReply?.content === "string" && finalReply.content.trim().length > 0 && result.turnOutcome !== "superseded";
|
|
1237
|
+
}
|
|
1238
|
+
finally {
|
|
1239
|
+
if (delivered)
|
|
1240
|
+
result.heldNoticeDelivery?.confirm();
|
|
1241
|
+
else
|
|
1242
|
+
result.heldNoticeDelivery?.release();
|
|
1243
|
+
}
|
|
1230
1244
|
// After the agent loop, check if any tool returned AUTH_REQUIRED and trigger signin.
|
|
1231
1245
|
// This must happen after the stream is done so the OAuth card renders properly.
|
|
1232
1246
|
if (teamsContext && result.messages) {
|
|
@@ -1962,6 +1976,14 @@ async function sendProactiveTeamsMessageToSession(params, deps) {
|
|
|
1962
1976
|
reason: internalContentBlockReason,
|
|
1963
1977
|
source: "session_send",
|
|
1964
1978
|
});
|
|
1979
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(internalContentBlockReason)) {
|
|
1980
|
+
try {
|
|
1981
|
+
(0, pending_1.holdNoticeForReturn)((0, identity_1.getAgentName)(), params.friendId, params.text);
|
|
1982
|
+
}
|
|
1983
|
+
catch {
|
|
1984
|
+
return { delivered: false, reason: "send_error" };
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1965
1987
|
return { delivered: false, reason: "internal_content_blocked" };
|
|
1966
1988
|
}
|
|
1967
1989
|
let conversationId;
|
|
@@ -2120,6 +2142,16 @@ async function drainAndSendPendingTeams(store, botApi, pendingRoot) {
|
|
|
2120
2142
|
}
|
|
2121
2143
|
const internalBlockReason = (0, proactive_content_guard_1.getProactiveInternalContentBlockReason)(messageText);
|
|
2122
2144
|
if (internalBlockReason) {
|
|
2145
|
+
if ((0, proactive_content_guard_1.isHeldForReturnReason)(internalBlockReason)) {
|
|
2146
|
+
// The pending file is the only copy: it goes only once the notice is kept.
|
|
2147
|
+
try {
|
|
2148
|
+
(0, pending_1.holdNoticeForReturn)((0, identity_1.getAgentName)(), friendId, messageText);
|
|
2149
|
+
}
|
|
2150
|
+
catch {
|
|
2151
|
+
result.failed++;
|
|
2152
|
+
continue;
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2123
2155
|
result.skipped++;
|
|
2124
2156
|
try {
|
|
2125
2157
|
fs.unlinkSync(filePath);
|
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.1713",
|
|
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.1713",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"@ouro.bot/friends"
|
|
12
12
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouro.bot/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.1713",
|
|
4
4
|
"description": "Ouroboros, the agent harness: agents with durable memory that live where you talk (terminal, Teams, iMessage, mail, voice) and use real tools. Start with npx ouro.bot@latest.",
|
|
5
5
|
"homepage": "https://ouroboros.bot/",
|
|
6
6
|
"engines": {
|