@tritard/waterbrother 0.16.36 → 0.16.38
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/package.json +1 -1
- package/src/cli.js +14 -0
- package/src/gateway.js +6 -2
- package/src/self-awareness.js +11 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -7440,6 +7440,20 @@ Be concrete about surfaces — name actual pages/flows. Choose the best stack fo
|
|
|
7440
7440
|
}
|
|
7441
7441
|
console.log(cyan(`telegram request from ${remoteActor}`));
|
|
7442
7442
|
console.log(`${cyan("telegram>")} ${sanitizeTerminalText(remoteRequest.text || "")}`);
|
|
7443
|
+
const remoteManifest = await buildSelfAwarenessManifest({
|
|
7444
|
+
cwd: context.cwd,
|
|
7445
|
+
runtime: context.runtime,
|
|
7446
|
+
currentSession
|
|
7447
|
+
});
|
|
7448
|
+
const remoteLocalConceptAnswer = resolveLocalConceptQuestion(remoteRequest.text || "", remoteManifest);
|
|
7449
|
+
if (remoteLocalConceptAnswer) {
|
|
7450
|
+
await deliverTelegramBridgeReply(remoteRequest, {
|
|
7451
|
+
sessionId: remoteSessionId,
|
|
7452
|
+
content: remoteLocalConceptAnswer
|
|
7453
|
+
});
|
|
7454
|
+
console.log(green(`telegram reply sent -> ${remoteActor}`));
|
|
7455
|
+
continue;
|
|
7456
|
+
}
|
|
7443
7457
|
await runTextTurnInteractive({
|
|
7444
7458
|
agent,
|
|
7445
7459
|
currentSession,
|
package/src/gateway.js
CHANGED
|
@@ -1665,6 +1665,8 @@ class TelegramGateway {
|
|
|
1665
1665
|
const promptText = this.stripBotMention(text);
|
|
1666
1666
|
const groupIntent = this.isGroupChat(message) ? classifyTelegramGroupIntent(promptText) : { kind: "execution", reason: "private chat" };
|
|
1667
1667
|
const sharedBinding = await this.bindSharedRoomForMessage(message, sessionId);
|
|
1668
|
+
const manifest = await buildSelfAwarenessManifest({ cwd: sharedBinding.session.cwd || this.cwd, runtime: this.runtime, currentSession: sharedBinding.session });
|
|
1669
|
+
const localConceptAnswer = resolveLocalConceptQuestion(promptText, manifest);
|
|
1668
1670
|
if (
|
|
1669
1671
|
this.isGroupChat(message)
|
|
1670
1672
|
&& sharedBinding.project?.enabled
|
|
@@ -1683,8 +1685,6 @@ class TelegramGateway {
|
|
|
1683
1685
|
}
|
|
1684
1686
|
}
|
|
1685
1687
|
if (this.isGroupChat(message) && groupIntent.kind !== "execution") {
|
|
1686
|
-
const manifest = await buildSelfAwarenessManifest({ cwd: sharedBinding.session.cwd || this.cwd, runtime: this.runtime, currentSession: sharedBinding.session });
|
|
1687
|
-
const localConceptAnswer = resolveLocalConceptQuestion(promptText, manifest);
|
|
1688
1688
|
if (localConceptAnswer) {
|
|
1689
1689
|
await this.sendMessage(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id, { parseMode: "HTML" });
|
|
1690
1690
|
return;
|
|
@@ -1696,6 +1696,10 @@ class TelegramGateway {
|
|
|
1696
1696
|
await this.sendMessage(message.chat.id, escapeTelegramHtml(planHint), message.message_id, { parseMode: "HTML" });
|
|
1697
1697
|
return;
|
|
1698
1698
|
}
|
|
1699
|
+
if (localConceptAnswer) {
|
|
1700
|
+
await this.sendMessage(message.chat.id, renderTelegramChunks(localConceptAnswer).join("\n\n"), message.message_id, { parseMode: "HTML" });
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1699
1703
|
|
|
1700
1704
|
const stopTyping = await this.startTypingLoop(message.chat.id);
|
|
1701
1705
|
let previewMessage = null;
|
package/src/self-awareness.js
CHANGED
|
@@ -257,6 +257,7 @@ export function resolveLocalConceptQuestion(text = "", manifest = {}) {
|
|
|
257
257
|
|
|
258
258
|
const mentionsRoundtable = /\bround[\s-]?table\b/.test(lower);
|
|
259
259
|
const asksWhatIs = /^(what('| i)?s|what is|tell me about|explain)\b/.test(lower) || /\bwhat is\b/.test(lower);
|
|
260
|
+
const asksHowToUseRoundtable = mentionsRoundtable && /\b(how do i|how to|add to|join|use|set up|enable|create)\b/.test(lower);
|
|
260
261
|
const sourcesFor = (...keys) => keys.map((key) => manifest.sourceHints?.[key]).filter(Boolean);
|
|
261
262
|
if (mentionsRoundtable && asksWhatIs) {
|
|
262
263
|
const sources = sourcesFor("roundtableDocs", "sharedState", "roundtable");
|
|
@@ -267,6 +268,16 @@ export function resolveLocalConceptQuestion(text = "", manifest = {}) {
|
|
|
267
268
|
].join("\n");
|
|
268
269
|
}
|
|
269
270
|
|
|
271
|
+
if (asksHowToUseRoundtable) {
|
|
272
|
+
const sources = sourcesFor("roundtableDocs", "sharedState", "roundtable");
|
|
273
|
+
return [
|
|
274
|
+
"To add to Roundtable, first enable shared-project mode in the repo with `waterbrother project share`.",
|
|
275
|
+
"Then use `waterbrother room invite <member-id> [owner|editor|observer]` to create member invites, `waterbrother room tasks` / `waterbrother room task add <text>` to work the shared backlog, and `waterbrother room mode <chat|plan|execute>` plus `waterbrother room claim` when you want one operator to execute.",
|
|
276
|
+
"In Telegram, the equivalent shared-room commands are `/room`, `/invite`, `/tasks`, `/task add`, `/mode`, `/claim`, and `/accept-invite`.",
|
|
277
|
+
`sources: ${sources.join(", ")}`
|
|
278
|
+
].join("\n");
|
|
279
|
+
}
|
|
280
|
+
|
|
270
281
|
if ((/\bshared project\b/.test(lower) || /\bshared room\b/.test(lower) || /\broom mode\b/.test(lower)) && asksWhatIs) {
|
|
271
282
|
const sources = sourcesFor("sharedState", "roundtableDocs", "roundtable");
|
|
272
283
|
return [
|