digital-brain 1.1.18 → 1.1.20
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/docs/AUTOMATIONS.md
CHANGED
|
@@ -167,7 +167,7 @@ Guardrails:
|
|
|
167
167
|
- processes unread chats on startup unless `--no-process-unread` is passed
|
|
168
168
|
- skips groups unless `--include-groups` is passed
|
|
169
169
|
- uses a per-chat cooldown, default 20 minutes
|
|
170
|
-
-
|
|
170
|
+
- no reply cap by default, so conversations can continue naturally; pass `--max-replies-per-chat <n>` to add one
|
|
171
171
|
- logs metadata by default, not full sent text
|
|
172
172
|
- enforces the AI disclosure rule after repeated AI-assisted sends, but does not repeat it after that chat has already received a disclosure
|
|
173
173
|
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ const includeBusinesses = Boolean(args["include-businesses"]);
|
|
|
39
39
|
const sendEnabled = Boolean(args.yes) || config.outboundMode === "auto-send";
|
|
40
40
|
const processUnreadOnStart = !Boolean(args["no-process-unread"]);
|
|
41
41
|
const cooldownMinutes = numberArg("cooldown-minutes", 20);
|
|
42
|
-
const maxRepliesPerChat = numberArg("max-replies-per-chat",
|
|
42
|
+
const maxRepliesPerChat = numberArg("max-replies-per-chat", 0);
|
|
43
43
|
const maxContextChars = numberArg("max-context-chars", 12000);
|
|
44
44
|
const outboundLogMode = args["log-mode"] || config.outboundLogMode || "metadata";
|
|
45
45
|
const state = loadState();
|
|
@@ -88,6 +88,7 @@ client.on("ready", async () => {
|
|
|
88
88
|
if (provider === "codex") console.log(`Codex command: ${codexCommand}`);
|
|
89
89
|
if (provider === "codex-app") console.log(`Codex App bridge: ${codexAppBridgeDir}`);
|
|
90
90
|
if (!includeBusinesses) console.log("Likely business, notification, OTP, and service chats are skipped by default.");
|
|
91
|
+
console.log(maxRepliesPerChat > 0 ? `Reply cap: ${maxRepliesPerChat} per chat per run.` : "Reply cap: unlimited.");
|
|
91
92
|
try {
|
|
92
93
|
if (processUnreadOnStart) {
|
|
93
94
|
await processUnreadChats();
|
|
@@ -129,7 +130,7 @@ async function processUnreadChats() {
|
|
|
129
130
|
console.log(`Skipping unread chat during cooldown: ${name}`);
|
|
130
131
|
continue;
|
|
131
132
|
}
|
|
132
|
-
if (
|
|
133
|
+
if (isAtReplyCap(name)) {
|
|
133
134
|
console.log(`Skipping unread chat at reply cap: ${name}`);
|
|
134
135
|
continue;
|
|
135
136
|
}
|
|
@@ -245,7 +246,7 @@ async function handleMessage(message, knownChat = null) {
|
|
|
245
246
|
console.log(`Skipping chat during cooldown: ${name}`);
|
|
246
247
|
return;
|
|
247
248
|
}
|
|
248
|
-
if (
|
|
249
|
+
if (isAtReplyCap(name)) {
|
|
249
250
|
console.log(`Skipping chat at reply cap: ${name}`);
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
@@ -686,6 +687,10 @@ function replyCount(name) {
|
|
|
686
687
|
return state.sentCountByChat[name] || 0;
|
|
687
688
|
}
|
|
688
689
|
|
|
690
|
+
function isAtReplyCap(name) {
|
|
691
|
+
return maxRepliesPerChat > 0 && replyCount(name) >= maxRepliesPerChat;
|
|
692
|
+
}
|
|
693
|
+
|
|
689
694
|
function markProcessed(message, name, options = { sent: true }) {
|
|
690
695
|
state.processedMessageIds.push(message.id?._serialized);
|
|
691
696
|
state.processedMessageIds = state.processedMessageIds.filter(Boolean).slice(-1000);
|