@commonlyai/cli 0.1.346 → 0.1.347
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 +36 -5
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -90,6 +90,7 @@ import {
|
|
|
90
90
|
ADAPTERS_WITH_PUBLIC_ONLY_GRANT,
|
|
91
91
|
ADAPTERS_WITH_DEFAULT_SANDBOX,
|
|
92
92
|
ADAPTERS_WITH_SANDBOX_ENFORCEMENT,
|
|
93
|
+
COMMONLY_MCP_SERVER_NAME,
|
|
93
94
|
defaultMcpServers,
|
|
94
95
|
seatBaseline,
|
|
95
96
|
withDefaultMcpServer,
|
|
@@ -1823,6 +1824,19 @@ const FINAL_TEXT_IS_POSTED = 'Your final text is posted to the pod unless it is
|
|
|
1823
1824
|
+ 'If you did nothing, or already posted through a tool, end with NO_REPLY alone, with no summary. '
|
|
1824
1825
|
+ FAILURE_IN_PLAIN_WORDS;
|
|
1825
1826
|
|
|
1827
|
+
// F192: the one place the wrapper does drop final text by kind. On a heartbeat
|
|
1828
|
+
// nobody asked anything, and a seat with the commonly MCP posts for itself, so
|
|
1829
|
+
// its final text is narration of the checklist; two of three narration cases in
|
|
1830
|
+
// a 7-day count were such seats, with no sentinel to catch. TASK-293's rule still
|
|
1831
|
+
// holds: the turn is told, in its own closing line, that its final text goes
|
|
1832
|
+
// nowhere and the tool is how it speaks. runTurn and the prompt read the same
|
|
1833
|
+
// predicate, so the line and the drop can't disagree.
|
|
1834
|
+
const seatPostsForItself = (environment) => (environment?.mcp || [])
|
|
1835
|
+
.some((server) => server?.name === COMMONLY_MCP_SERVER_NAME);
|
|
1836
|
+
const HEARTBEAT_TEXT_IS_NOT_POSTED = 'This turn is only a heartbeat: nobody asked you anything, and your final text is not posted. '
|
|
1837
|
+
+ 'If something needs saying, post it with commonly_post_message, then end with NO_REPLY. '
|
|
1838
|
+
+ 'Otherwise end with NO_REPLY alone, with no summary.';
|
|
1839
|
+
|
|
1826
1840
|
// Who owes an open question an answer depends on who else is here. Walked 11-06:
|
|
1827
1841
|
// "can anyone…" drew an "I can't" from a seat nobody addressed. With another
|
|
1828
1842
|
// agent here, that seat should step aside, and a person's message it declines
|
|
@@ -3296,7 +3310,14 @@ export const performRun = ({
|
|
|
3296
3310
|
&& /^(HEARTBEAT_OK|HEARTBEAT_NOOP)$/i.test(replyText);
|
|
3297
3311
|
const declinedInText = event.type !== 'agent.ask' && !someoneIsWaiting(event)
|
|
3298
3312
|
&& CLOSES_ON_BARE_SENTINEL.test(replyText);
|
|
3299
|
-
|
|
3313
|
+
// F192: a heartbeat turn on a seat that has the commonly MCP. Its prompt
|
|
3314
|
+
// said the final text is not posted (HEARTBEAT_TEXT_IS_NOT_POSTED), so that
|
|
3315
|
+
// text is narration ("Checked the board, nothing new"), not a message. A
|
|
3316
|
+
// bare CLI with no posting tool still speaks through its output.
|
|
3317
|
+
const heartbeatNarration = Boolean(replyText) && seatPostsForItself(placement.environment) && !someoneIsWaiting(event)
|
|
3318
|
+
&& (event.type === 'heartbeat' || event.payload?.onlyHeartbeat === true);
|
|
3319
|
+
const silentReply = !replyText || replyText === 'NO_REPLY' || heartbeatControlReply || declinedInText
|
|
3320
|
+
|| heartbeatNarration;
|
|
3300
3321
|
// A refused model route is not a silent turn. pi reports the refusal on its
|
|
3301
3322
|
// own JSON stream and exits 0 with no text, so before this the seat log read
|
|
3302
3323
|
// `no wrapper-post (empty output)` and the cause — a 429 budget message — was
|
|
@@ -3342,7 +3363,9 @@ export const performRun = ({
|
|
|
3342
3363
|
}
|
|
3343
3364
|
} else if (silentReply) {
|
|
3344
3365
|
const reason = heartbeatControlReply ? replyText
|
|
3345
|
-
: declinedInText ? 'NO_REPLY'
|
|
3366
|
+
: declinedInText ? 'NO_REPLY'
|
|
3367
|
+
: heartbeatNarration ? 'heartbeat narration; this seat posts with commonly_post_message'
|
|
3368
|
+
: (replyText || 'empty output');
|
|
3346
3369
|
// A turn that posted via tool and THEN ended with the sentinel is not the
|
|
3347
3370
|
// same event as a turn that produced nothing — but this branch reported
|
|
3348
3371
|
// both as `no wrapper-post (NO_REPLY)`, because it is evaluated before
|
|
@@ -3578,6 +3601,9 @@ export const performRun = ({
|
|
|
3578
3601
|
const contextShown = new Set(context.slice(0, Math.max(0, BODY_LIMIT - wakeEntries.length + context.length)));
|
|
3579
3602
|
const shownEntries = wakeEntries.filter((entry) => !entry.result || contextShown.has(entry));
|
|
3580
3603
|
const heldBack = entries.filter((entry) => entry.pastCap).length;
|
|
3604
|
+
// The same set the batch's onlyHeartbeat reads, so the closing line matches the drop.
|
|
3605
|
+
const inTurn = entries.filter((entry) => !entry.pastCap);
|
|
3606
|
+
const heartbeatOnly = inTurn.length > 0 && inTurn.every((entry) => entry.event.type === 'heartbeat');
|
|
3581
3607
|
const answersPerson = shownEntries.some(answersAPerson);
|
|
3582
3608
|
const bodies = shownEntries.map((entry, index) => {
|
|
3583
3609
|
const messageId = entry.event.payload?.messageId;
|
|
@@ -3644,9 +3670,11 @@ export const performRun = ({
|
|
|
3644
3670
|
? 'Do not narrate the inbox. Answer every item marked as a person addressing you directly. '
|
|
3645
3671
|
+ 'For anything else here, post only an action or a materially useful response. '
|
|
3646
3672
|
+ FINAL_TEXT_ANSWERS_A_PERSON
|
|
3647
|
-
:
|
|
3648
|
-
|
|
3649
|
-
|
|
3673
|
+
: heartbeatOnly && seatPostsForItself(seatEnvironment)
|
|
3674
|
+
? `Do not narrate the inbox. ${HEARTBEAT_TEXT_IS_NOT_POSTED}`
|
|
3675
|
+
: 'Do not narrate the inbox. Post only an action or a materially useful response; otherwise return NO_REPLY. '
|
|
3676
|
+
+ FINAL_TEXT_IS_POSTED
|
|
3677
|
+
+ roomQuestionLine(pod, shownEntries)),
|
|
3650
3678
|
].join('\n\n');
|
|
3651
3679
|
};
|
|
3652
3680
|
|
|
@@ -4223,6 +4251,8 @@ export const performRun = ({
|
|
|
4223
4251
|
...actionEntries[0].event.payload,
|
|
4224
4252
|
batchEventIds: entries.filter((entry) => !entry.pastCap).map((entry) => String(entry.event._id)),
|
|
4225
4253
|
hasHeartbeat: entries.some((entry) => !entry.pastCap && entry.event.type === 'heartbeat'),
|
|
4254
|
+
onlyHeartbeat: entries.filter((entry) => !entry.pastCap)
|
|
4255
|
+
.every((entry) => entry.event.type === 'heartbeat'),
|
|
4226
4256
|
someoneWaiting: entries.some((entry) => !entry.pastCap && someoneIsWaiting(entry.event)),
|
|
4227
4257
|
},
|
|
4228
4258
|
};
|
|
@@ -4240,6 +4270,7 @@ export const performRun = ({
|
|
|
4240
4270
|
...entry.event.payload,
|
|
4241
4271
|
batchEventIds: [String(entry.event._id)],
|
|
4242
4272
|
hasHeartbeat: entry.event.type === 'heartbeat',
|
|
4273
|
+
onlyHeartbeat: entry.event.type === 'heartbeat',
|
|
4243
4274
|
someoneWaiting: someoneIsWaiting(entry.event),
|
|
4244
4275
|
},
|
|
4245
4276
|
},
|