@commonlyai/cli 0.1.256 → 0.1.257
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/commands/agent.js +29 -1
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -1494,6 +1494,33 @@ export const runMemoryImport = async ({
|
|
|
1494
1494
|
const FINAL_TEXT_IS_POSTED = 'Your final text is posted to the pod unless it is exactly NO_REPLY. '
|
|
1495
1495
|
+ 'If you did nothing, or already posted through a tool, end with NO_REPLY alone, with no summary.';
|
|
1496
1496
|
|
|
1497
|
+
// Prod walk, 2026-11-05: a person @mentioned a Claude Code seat with a
|
|
1498
|
+
// top-level message, and the seat answered through commonly_post_message with
|
|
1499
|
+
// threadRootId set to that message, so the answer sat in a collapsed thread
|
|
1500
|
+
// under it. The kernel's mention cue teaches threadRootId as a verb but never
|
|
1501
|
+
// says which messages it is for, so each top-level mention says where its
|
|
1502
|
+
// answer goes, beside the message it answers.
|
|
1503
|
+
//
|
|
1504
|
+
// `chat.mention` alone is not "top-level": the kernel sends a chat-thread
|
|
1505
|
+
// mention as chat.mention with `payload.threadRootId`, a 1:1 DM as chat.mention
|
|
1506
|
+
// with `source: 'dm'`, and some wakes (open-work reminders) as chat.mention
|
|
1507
|
+
// with no message at all. Only a message with no thread, outside a DM, gets it.
|
|
1508
|
+
// The line still allows the overflow rule (post the point, continue under your
|
|
1509
|
+
// own root): only threading under the person's message is ruled out.
|
|
1510
|
+
const ANSWER_IN_CHANNEL = '[This message is top-level in the channel, not in a thread: post your answer top-level. '
|
|
1511
|
+
+ 'Never set threadRootId to this message\'s id; a long answer may continue under your own top-level post.]';
|
|
1512
|
+
|
|
1513
|
+
export const answersInChannel = (entry) => {
|
|
1514
|
+
const payload = entry?.event?.payload || {};
|
|
1515
|
+
// A duplicate delivery was already answered here; it stays in the prompt as
|
|
1516
|
+
// context, and must not be told to post (CodeRabbit on #3499).
|
|
1517
|
+
return entry?.event?.type === 'chat.mention' && !entry.readOnly
|
|
1518
|
+
&& entry.result?.reason !== 'duplicate-delivery'
|
|
1519
|
+
&& Boolean(payload.messageId)
|
|
1520
|
+
&& (payload.threadRootId === undefined || payload.threadRootId === null || payload.threadRootId === '')
|
|
1521
|
+
&& payload.source !== 'dm' && !payload.dmKind;
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1497
1524
|
const extractPrompt = (event) => {
|
|
1498
1525
|
const p = event.payload || {};
|
|
1499
1526
|
if (PROMPT_EVENT_TYPES.has(event.type)) {
|
|
@@ -2855,13 +2882,14 @@ export const performRun = ({
|
|
|
2855
2882
|
+ '[This item is read-only context: a peer won its binding claim. Do not act on it.]\n'
|
|
2856
2883
|
: (entry.peerFrame ? `${entry.peerFrame}\n` : '');
|
|
2857
2884
|
const body = entry.prompt || '[No usable prompt was delivered for this item.]';
|
|
2885
|
+
const channelLine = answersInChannel(entry) ? `\n${ANSWER_IN_CHANNEL}` : '';
|
|
2858
2886
|
const deliveryId = entry.event.payload?.deliveryId;
|
|
2859
2887
|
const checkpoint = typeof deliveryId === 'string' && deliveryId
|
|
2860
2888
|
? `\n[After completed tool-side work or intentional NO_REPLY for only this item, call commonly_checkpoint_event(${JSON.stringify({
|
|
2861
2889
|
eventId: String(entry.event._id), deliveryId,
|
|
2862
2890
|
})}). Checkpoint metadata is private runtime data; never post it in chat.]`
|
|
2863
2891
|
: '';
|
|
2864
|
-
return `${prefix}\n${claimContext}${body}${checkpoint}`;
|
|
2892
|
+
return `${prefix}\n${claimContext}${body}${channelLine}${checkpoint}`;
|
|
2865
2893
|
});
|
|
2866
2894
|
const rollup = wakeEntries.find((entry) => entry.event.payload?.digestRollup)?.event.payload?.digestRollup;
|
|
2867
2895
|
const digestFrame = formatDigestFrame(digestEntries.map((entry) => entry.event), rollup);
|