@ouro.bot/cli 0.1.0-alpha.1370 → 0.1.0-alpha.1371
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 +8 -1
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/mind/outbound-record.js +12 -4
- package/dist/repertoire/tools-surface.js +6 -1
- package/dist/senses/bluebubbles/client.js +11 -5
- package/dist/senses/bluebubbles/index.js +21 -10
- package/dist/senses/bluebubbles/semantic-receipts.js +16 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
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.1371",
|
|
6
|
+
"changes": [
|
|
7
|
+
"iMessage: a message whose reply never went out (the process died or the turn ended early) is now answered on recovery instead of being marked handled, and recovery finds messages saved by older builds."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.1370",
|
|
6
12
|
"changes": [
|
|
@@ -10,7 +16,8 @@
|
|
|
10
16
|
{
|
|
11
17
|
"version": "0.1.0-alpha.1369",
|
|
12
18
|
"changes": [
|
|
13
|
-
"iMessage no longer stops replying in a chat after runtime sync re-reads a message that already has an outcome; that message used to hold every later reply in the chat forever."
|
|
19
|
+
"iMessage no longer stops replying in a chat after runtime sync re-reads a message that already has an outcome; that message used to hold every later reply in the chat forever.",
|
|
20
|
+
"Update the Ouro UI files to Ouro UI core v1.12.0 and Ouro UI v1.3.454."
|
|
14
21
|
]
|
|
15
22
|
},
|
|
16
23
|
{
|
|
@@ -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.1371</Repository>
|
|
5
5
|
<Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
|
|
6
6
|
<Network>host</Network>
|
|
7
7
|
<Shell>sh</Shell>
|
|
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.OUTBOUND_ORIGIN_LABELS = void 0;
|
|
37
|
+
exports.recordedOutboundText = recordedOutboundText;
|
|
38
|
+
exports.isRecordedOutboundText = isRecordedOutboundText;
|
|
37
39
|
exports.drainOutboundRecords = drainOutboundRecords;
|
|
38
40
|
exports.recordOutboundInSession = recordOutboundInSession;
|
|
39
41
|
const crypto_1 = require("crypto");
|
|
@@ -55,8 +57,14 @@ function deferredDir(agentRoot, friendId, channel, key) {
|
|
|
55
57
|
function deferredFileName(deliveryId) {
|
|
56
58
|
return `${(0, crypto_1.createHash)("sha256").update(deliveryId).digest("hex").slice(0, 32)}.json`;
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
const RECORDED_OUTBOUND_PREFIX = "[you sent this via ";
|
|
61
|
+
/** The assistant text a delivered proactive send leaves in the friend's session. */
|
|
62
|
+
function recordedOutboundText(record) {
|
|
63
|
+
return `${RECORDED_OUTBOUND_PREFIX}${record.originLabel}] ${record.content}`;
|
|
64
|
+
}
|
|
65
|
+
/** True for a session message written by recordedOutboundText, not by a turn answering the friend. */
|
|
66
|
+
function isRecordedOutboundText(text) {
|
|
67
|
+
return text.startsWith(RECORDED_OUTBOUND_PREFIX);
|
|
60
68
|
}
|
|
61
69
|
function recordError(message, meta) {
|
|
62
70
|
(0, runtime_1.emitNervesEvent)({ level: "warn", component: "mind", event: "mind.outbound_record_error", message, meta });
|
|
@@ -120,7 +128,7 @@ function drainUnderLease(agentRoot, friendId, channel, key, lease) {
|
|
|
120
128
|
if (!record) {
|
|
121
129
|
recordError("skipped an unreadable deferred outbound record", { friendId, channel, file: name });
|
|
122
130
|
}
|
|
123
|
-
else if ((0, context_1.appendSyntheticAssistantMessage)(lease.sessionPath,
|
|
131
|
+
else if ((0, context_1.appendSyntheticAssistantMessage)(lease.sessionPath, recordedOutboundText(record), lease, { outbound: { origin: record.origin, deliveryId: record.deliveryId }, createIfMissing: true, sentAt: record.recordedAt })) {
|
|
124
132
|
count += 1;
|
|
125
133
|
}
|
|
126
134
|
else {
|
|
@@ -141,7 +149,7 @@ function recordOutboundInSession(input) {
|
|
|
141
149
|
try {
|
|
142
150
|
return (0, session_transaction_1.withImmediateSessionTurnLease)(sessionPath, (lease) => {
|
|
143
151
|
drainOutboundRecords(agentRoot, friendId, channel, key, lease);
|
|
144
|
-
const appended = (0, context_1.appendSyntheticAssistantMessage)(sessionPath,
|
|
152
|
+
const appended = (0, context_1.appendSyntheticAssistantMessage)(sessionPath, recordedOutboundText(input), lease, { outbound: { origin, deliveryId }, createIfMissing: true });
|
|
145
153
|
if (appended)
|
|
146
154
|
return "recorded";
|
|
147
155
|
recordError("could not append an outbound record to its session", { friendId, channel, deliveryId });
|
|
@@ -163,7 +163,12 @@ async function routeSurfaceToFriend(agentName, friendId, content, queueItem, hin
|
|
|
163
163
|
content,
|
|
164
164
|
timestamp: Date.now(),
|
|
165
165
|
});
|
|
166
|
-
return
|
|
166
|
+
// A BlueBubbles return deliberately waits for the friend's next iMessage
|
|
167
|
+
// instead of live-sending one. Say so, so the agent never reads "queued"
|
|
168
|
+
// as "sent", and name the tool that texts them now when that is the intent.
|
|
169
|
+
return target.channel === "bluebubbles"
|
|
170
|
+
? { status: "queued", detail: `${detail}; it waits for their next iMessage. To text them now, use send_message with channel="bluebubbles"` }
|
|
171
|
+
: { status: "queued", detail };
|
|
167
172
|
};
|
|
168
173
|
const deliverTelegramOrQueue = async (target, detail) => {
|
|
169
174
|
const telegramKey = (0, config_1.canonicalizeTelegramSessionKey)(target.key);
|
|
@@ -645,12 +645,18 @@ function createBlueBubblesClient(config = (0, config_1.getBlueBubblesConfig)(),
|
|
|
645
645
|
},
|
|
646
646
|
});
|
|
647
647
|
await assertHostAccount();
|
|
648
|
-
const
|
|
648
|
+
const fetchRepair = (messageGuid) => fetch(buildRepairUrl(config.serverUrl, messageGuid, config.password), {
|
|
649
|
+
method: "GET",
|
|
650
|
+
signal: AbortSignal.timeout(channelConfig.requestTimeoutMs),
|
|
651
|
+
});
|
|
649
652
|
try {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
653
|
+
let response = await fetchRepair(event.messageGuid);
|
|
654
|
+
// BlueBubbles GUIDs are upper case and looked up exactly. Captures from
|
|
655
|
+
// older builds stored them lower-cased, so retry once with the provider spelling.
|
|
656
|
+
const providerGuid = event.messageGuid.toUpperCase();
|
|
657
|
+
if (response.status === 404 && providerGuid !== event.messageGuid) {
|
|
658
|
+
response = await fetchRepair(providerGuid);
|
|
659
|
+
}
|
|
654
660
|
if (!response.ok) {
|
|
655
661
|
const errorText = await response.text().catch(() => "");
|
|
656
662
|
const repaired = applyRepairNotice(event, `BlueBubbles repair failed: ${errorText || `HTTP ${response.status}`}`);
|
|
@@ -611,15 +611,26 @@ function buildInboundContent(event) {
|
|
|
611
611
|
...event.inputPartsForAgent,
|
|
612
612
|
];
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function sessionUserMessageIndex(event, existingMessages) {
|
|
615
615
|
const fragment = event.textForAgent.trim();
|
|
616
616
|
if (!fragment)
|
|
617
|
-
return
|
|
618
|
-
return existingMessages.
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
617
|
+
return -1;
|
|
618
|
+
return existingMessages.findLastIndex((message) => (message.role === "user" && extractMessageText(message.content).includes(fragment)));
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* A turn saves the friend's message before the model runs, so the text alone
|
|
622
|
+
* does not prove the message was answered. Only a later assistant reply does;
|
|
623
|
+
* a proactive send recorded in the session afterwards does not count.
|
|
624
|
+
*/
|
|
625
|
+
function sessionAlreadyAnsweredMessage(event, existingMessages) {
|
|
626
|
+
const index = sessionUserMessageIndex(event, existingMessages);
|
|
627
|
+
return index >= 0 && existingMessages.slice(index + 1).some((message) => (message.role === "assistant" && !(0, outbound_record_1.isRecordedOutboundText)(extractMessageText(message.content))));
|
|
628
|
+
}
|
|
629
|
+
/** Drop the unanswered copy a dead turn left at the tail, so the replay adds the message once. */
|
|
630
|
+
function withoutUnansweredTail(event, messages) {
|
|
631
|
+
return sessionUserMessageIndex(event, messages) === messages.length - 1
|
|
632
|
+
? messages.slice(0, -1)
|
|
633
|
+
: messages;
|
|
623
634
|
}
|
|
624
635
|
function getBlueBubblesContinuityIngressTexts(event) {
|
|
625
636
|
const text = event.textForAgent.trim();
|
|
@@ -1566,13 +1577,13 @@ async function handleBlueBubblesNormalizedEvent(event, resolvedDeps, source, opt
|
|
|
1566
1577
|
// Pre-load session inside the canonical turn lock so same-chat
|
|
1567
1578
|
// deliveries cannot race on stale trunk state.
|
|
1568
1579
|
const existing = resolvedDeps.loadSession(sessPath);
|
|
1580
|
+
const replaying = options.semanticRecovery || source !== "webhook";
|
|
1569
1581
|
const sessionMessages = existing?.messages && existing.messages.length > 0
|
|
1570
|
-
? structuredClone(existing.messages)
|
|
1582
|
+
? structuredClone(replaying ? withoutUnansweredTail(event, existing.messages) : existing.messages)
|
|
1571
1583
|
: [{ role: "system", content: (0, prompt_1.flattenSystemPrompt)(await resolvedDeps.buildSystem("bluebubbles", {}, context)) }];
|
|
1572
1584
|
// Record EARLY for audit and crash recovery. This is capture truth, not
|
|
1573
1585
|
// a claim that the agent turn completed successfully.
|
|
1574
|
-
const inboundSource = (
|
|
1575
|
-
&& sessionLikelyContainsMessage(event, existing?.messages ?? sessionMessages)
|
|
1586
|
+
const inboundSource = replaying && sessionAlreadyAnsweredMessage(event, existing?.messages ?? sessionMessages)
|
|
1576
1587
|
? "recovery-bootstrap"
|
|
1577
1588
|
: source;
|
|
1578
1589
|
(0, inbound_log_1.recordBlueBubblesInbound)(agentName, event, inboundSource);
|
|
@@ -437,9 +437,12 @@ function buildBlueBubblesSemanticCapture(input) {
|
|
|
437
437
|
if (observationClock === false)
|
|
438
438
|
return null;
|
|
439
439
|
const kind = input.event.kind === "message" ? "message" : input.event.mutationType;
|
|
440
|
-
|
|
440
|
+
// BlueBubbles looks messages up by exact GUID. The identity key folds case so
|
|
441
|
+
// spellings deduplicate, but the capture keeps the provider's spelling so
|
|
442
|
+
// recovery can fetch the message again.
|
|
443
|
+
const eventGuid = providerGuid(input.event.messageGuid);
|
|
441
444
|
const targetGuid = input.event.kind === "mutation"
|
|
442
|
-
?
|
|
445
|
+
? providerGuid(input.event.targetMessageGuid)
|
|
443
446
|
?? (input.event.mutationType === "unsend" ? eventGuid : null)
|
|
444
447
|
: null;
|
|
445
448
|
const reaction = input.event.kind === "mutation" ? input.event.reaction : undefined;
|
|
@@ -975,13 +978,13 @@ function blueBubblesSemanticCaptureHash(capture) {
|
|
|
975
978
|
event: {
|
|
976
979
|
provider: capture.event.provider,
|
|
977
980
|
kind: capture.event.kind,
|
|
978
|
-
eventGuid: capture.event.eventGuid,
|
|
981
|
+
eventGuid: caseFoldedGuid(capture.event.eventGuid),
|
|
979
982
|
fromMe: capture.event.fromMe,
|
|
980
983
|
actor: capture.event.actor,
|
|
981
984
|
participants: capture.event.participants,
|
|
982
985
|
text: capture.event.text,
|
|
983
986
|
textSha256: capture.event.textSha256,
|
|
984
|
-
targetGuid: capture.event.targetGuid,
|
|
987
|
+
targetGuid: caseFoldedGuid(capture.event.targetGuid),
|
|
985
988
|
targetAuthorship: capture.event.targetAuthorship,
|
|
986
989
|
canonicalAction: capture.event.canonicalAction,
|
|
987
990
|
canonicalValue: capture.event.canonicalValue,
|
|
@@ -1899,6 +1902,15 @@ function requiredIdentifier(value) {
|
|
|
1899
1902
|
const normalized = normalizeIngressIdentifier(value);
|
|
1900
1903
|
return normalized || null;
|
|
1901
1904
|
}
|
|
1905
|
+
function providerGuid(value) {
|
|
1906
|
+
if (typeof value !== "string")
|
|
1907
|
+
return requiredIdentifier(value);
|
|
1908
|
+
return value.trim() || null;
|
|
1909
|
+
}
|
|
1910
|
+
/** Captures from older builds stored lower-case GUIDs; compare them case-insensitively. */
|
|
1911
|
+
function caseFoldedGuid(value) {
|
|
1912
|
+
return value === null ? null : value.toLowerCase();
|
|
1913
|
+
}
|
|
1902
1914
|
function normalizeProviderNamespace(value) {
|
|
1903
1915
|
const normalized = requiredIdentifier(value);
|
|
1904
1916
|
return normalized && UUID_V4_PATTERN.test(normalized) ? normalized : null;
|
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.1371",
|
|
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.1371",
|
|
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.1371",
|
|
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": {
|