@ouro.bot/cli 0.1.0-alpha.956 → 0.1.0-alpha.958
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 -0
- package/deploy/unraid/README.txt +2 -2
- package/deploy/unraid/sanctuary-replay-gate.mjs +206 -32
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.ouro/mcp/media-mcp.mjs +22 -8
- package/deploy/unraid/sanctuary.xml +1 -1
- package/dist/heart/core.js +33 -12
- package/dist/heart/external-events/router.js +20 -12
- package/dist/repertoire/house-sweep.js +10 -8
- package/dist/repertoire/tools-continuity.js +16 -10
- package/dist/senses/private-runtime-worker.js +53 -1
- package/dist/senses/sanctuary-health-acceptance-probe.js +1 -1
- package/dist/senses/sanctuary-health.js +31 -5
- package/dist/senses/telegram-handoff.js +75 -1
- package/dist/senses/telegram.js +35 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/senses/telegram.js
CHANGED
|
@@ -1137,13 +1137,22 @@ function createTelegramSenseApp(options) {
|
|
|
1137
1137
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
|
|
1138
1138
|
return (0, telegram_handoff_1.ownerChatHandedOff)((0, session_events_1.loadSessionEnvelopeFile)(sessionPath)?.events ?? [], Date.now());
|
|
1139
1139
|
};
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1140
|
+
const proactiveLedgerPath = path.join(agentRoot, "state", "telegram", "proactive-sends.json");
|
|
1141
|
+
const countProactiveSend = () => { if (options.proactivePacing)
|
|
1142
|
+
(0, telegram_handoff_1.recordProactiveSend)(proactiveLedgerPath, new Date(), options.proactivePacing); };
|
|
1143
|
+
const releasedHeldKeysPath = path.join(agentRoot, "state", "telegram", "released-held-keys.json");
|
|
1144
|
+
const holdNoticeDuringHandoff = (text, key, critical = (0, telegram_handoff_1.isCriticalNoticeKey)(key)) => {
|
|
1145
|
+
const handedOff = ownerChatIsHandedOff();
|
|
1146
|
+
const pacingReason = !handedOff && options.proactivePacing && !critical ? (0, telegram_handoff_1.proactiveHoldReason)(proactiveLedgerPath, new Date(), options.proactivePacing) : null;
|
|
1147
|
+
if (!handedOff && !pacingReason)
|
|
1142
1148
|
return false;
|
|
1143
1149
|
const held = (0, telegram_handoff_1.readHeldNotices)(heldNoticesPath);
|
|
1144
1150
|
if (!held.some((notice) => notice.key === key))
|
|
1145
1151
|
(0, telegram_handoff_1.writeHeldNotices)(heldNoticesPath, [...held, { key, text }]);
|
|
1146
|
-
|
|
1152
|
+
if (handedOff)
|
|
1153
|
+
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_notice_held_for_handoff", message: "held a house notice while the owner's chat is handed to someone else", meta: { agentName: options.agentName } });
|
|
1154
|
+
else
|
|
1155
|
+
(0, runtime_1.emitNervesEvent)({ component: "senses", event: "senses.telegram_notice_held_for_pacing", message: "held a house notice for quiet hours or the daily message cap", meta: { agentName: options.agentName, reason: pacingReason } });
|
|
1147
1156
|
return true;
|
|
1148
1157
|
};
|
|
1149
1158
|
let heldNoticeRelease = Promise.resolve();
|
|
@@ -1156,6 +1165,21 @@ function createTelegramSenseApp(options) {
|
|
|
1156
1165
|
if (ownerChatIsHandedOff())
|
|
1157
1166
|
return;
|
|
1158
1167
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
|
|
1168
|
+
if (options.proactivePacing) {
|
|
1169
|
+
// Held notices go out as one message, and only when an unprompted message is allowed now (quiet hours and the daily cap).
|
|
1170
|
+
if ((0, telegram_handoff_1.proactiveHoldReason)(proactiveLedgerPath, new Date(), options.proactivePacing))
|
|
1171
|
+
return;
|
|
1172
|
+
/* v8 ignore next -- the caller already saw held notices; only a concurrent release can empty the file before this re-read @preserve */
|
|
1173
|
+
if (held.length === 0)
|
|
1174
|
+
return;
|
|
1175
|
+
const folded = (0, telegram_handoff_1.foldHeldNotices)(held);
|
|
1176
|
+
if (held.length > 1)
|
|
1177
|
+
(0, telegram_handoff_1.recordReleasedHeldKeys)(releasedHeldKeysPath, held.map((notice) => notice.key));
|
|
1178
|
+
(0, telegram_handoff_1.writeHeldNotices)(heldNoticesPath, (0, telegram_handoff_1.readHeldNotices)(heldNoticesPath).filter((entry) => !held.some((notice) => notice.key === entry.key)));
|
|
1179
|
+
await recordAcceptedEffects(sessionPath, [await deliverButlerEffect(folded.text, folded.key, signal)]);
|
|
1180
|
+
countProactiveSend();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1159
1183
|
for (const notice of held) {
|
|
1160
1184
|
(0, telegram_handoff_1.writeHeldNotices)(heldNoticesPath, (0, telegram_handoff_1.readHeldNotices)(heldNoticesPath).filter((entry) => entry.key !== notice.key));
|
|
1161
1185
|
await recordAcceptedEffects(sessionPath, [await deliverButlerEffect(notice.text, notice.key, signal)]);
|
|
@@ -1949,6 +1973,7 @@ function createTelegramSenseApp(options) {
|
|
|
1949
1973
|
return;
|
|
1950
1974
|
await releaseHeldNotices(signal);
|
|
1951
1975
|
const effect = await deliverButlerEffect(proactiveText, key, signal);
|
|
1976
|
+
countProactiveSend();
|
|
1952
1977
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
|
|
1953
1978
|
await recordAcceptedEffects(sessionPath, [effect]);
|
|
1954
1979
|
});
|
|
@@ -1967,7 +1992,9 @@ function createTelegramSenseApp(options) {
|
|
|
1967
1992
|
const text = requiredText(input.text, "external event decision");
|
|
1968
1993
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
|
|
1969
1994
|
const held = (0, telegram_handoff_1.readHeldNotices)(heldNoticesPath);
|
|
1995
|
+
const releasedKeys = (0, telegram_handoff_1.readReleasedHeldKeys)(releasedHeldKeysPath);
|
|
1970
1996
|
const ownerMessageExists = (candidate) => held.some((notice) => notice.key === candidate)
|
|
1997
|
+
|| releasedKeys.includes(candidate)
|
|
1971
1998
|
|| getEffectJournal().readByIdempotencyKey(candidate) !== null;
|
|
1972
1999
|
if (ownerMessageExists(key)) {
|
|
1973
2000
|
// A retry after the message went out (or was held): finish the original send, never send a reworded second one.
|
|
@@ -1991,10 +2018,11 @@ function createTelegramSenseApp(options) {
|
|
|
1991
2018
|
});
|
|
1992
2019
|
return { status: "covered", effectKey: coveredBy };
|
|
1993
2020
|
}
|
|
1994
|
-
if (holdNoticeDuringHandoff(text, key))
|
|
2021
|
+
if (holdNoticeDuringHandoff(text, key, [key, ...relatedKeys].some(telegram_handoff_1.isCriticalNoticeKey)))
|
|
1995
2022
|
return { status: "sent", effectKey: key };
|
|
1996
2023
|
await releaseHeldNotices(input.signal);
|
|
1997
2024
|
const effect = await deliverButlerEffect(text, key, input.signal);
|
|
2025
|
+
countProactiveSend();
|
|
1998
2026
|
await recordAcceptedEffects(sessionPath, [effect]);
|
|
1999
2027
|
return { status: "sent", effectKey: key };
|
|
2000
2028
|
});
|
|
@@ -2012,6 +2040,7 @@ function createTelegramSenseApp(options) {
|
|
|
2012
2040
|
return;
|
|
2013
2041
|
await releaseHeldNotices(input.signal);
|
|
2014
2042
|
const effect = await deliverButlerEffect(text, `owner-notice:${noticeId}`, input.signal);
|
|
2043
|
+
countProactiveSend();
|
|
2015
2044
|
const sessionPath = (0, shared_turn_1.getSenseSessionPath)(options.agentName, configuredOwnerFriendId, "telegram", configuredOwnerSessionKey, agentRoot);
|
|
2016
2045
|
await recordAcceptedEffects(sessionPath, [effect]);
|
|
2017
2046
|
});
|
|
@@ -2323,6 +2352,8 @@ async function startTelegramSenseApp(agentName, waitForAuthority = false) {
|
|
|
2323
2352
|
agentName,
|
|
2324
2353
|
credentials,
|
|
2325
2354
|
authorityTransport,
|
|
2355
|
+
// The owner is in Los Angeles; a container without TZ would otherwise run quiet hours on UTC.
|
|
2356
|
+
proactivePacing: { timeZone: process.env.TZ || "America/Los_Angeles" },
|
|
2326
2357
|
...(await createProductionTelegramRelationshipComposition(agentName, credentials, undefined, authorityTransport)),
|
|
2327
2358
|
...(agentName === "sanctuary" ? { privilegedFailsafe: {
|
|
2328
2359
|
eventRoot: (0, router_1.getExternalEventRoot)(),
|
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.958",
|
|
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.958",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
12
12
|
"@azure/identity": "^4.13.0",
|