@commonlyai/cli 0.1.286 → 0.1.287
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 +15 -4
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -766,6 +766,12 @@ const someoneIsWaiting = (event) => ADDRESSED_EVENT_TYPES.has(event.type)
|
|
|
766
766
|
|| event.payload?.repliesToYourMessage === true
|
|
767
767
|
|| event.payload?.someoneWaiting === true;
|
|
768
768
|
|
|
769
|
+
// The last line of a reply is nothing but the sentinel. An unaddressed person's
|
|
770
|
+
// `message.posted` counts as nobody waiting, on purpose: text closing on the
|
|
771
|
+
// sentinel there is far likelier reasoning about an ambient message than an
|
|
772
|
+
// answer, and the seat's prompt already sends ambient messages to NO_REPLY.
|
|
773
|
+
const CLOSES_ON_BARE_SENTINEL = /(?:^|\n)[ \t]*NO_REPLY[ \t]*$/;
|
|
774
|
+
|
|
769
775
|
// The first message in `messages` that this seat posted and `earlierIds` doesn't
|
|
770
776
|
// hold. The server stamps each message with `self` when it knows who is asking.
|
|
771
777
|
// Trust that over any local guess: the wrapper cannot derive its own bot username
|
|
@@ -2997,8 +3003,10 @@ export const performRun = ({
|
|
|
2997
3003
|
// output would double-post. Two independent signals suppress the echo:
|
|
2998
3004
|
// 1. Detection — a new message appeared in the pod during the spawn (the
|
|
2999
3005
|
// agent posted via the tool). Automatic; no agent cooperation needed.
|
|
3000
|
-
// 2. NO_REPLY — the agent explicitly asks us to stay silent
|
|
3001
|
-
//
|
|
3006
|
+
// 2. NO_REPLY — the agent explicitly asks us to stay silent: the ENTIRE
|
|
3007
|
+
// reply, or (F192) its last line on a turn nobody is waiting on, where
|
|
3008
|
+
// the text above it is reasoning the server would otherwise post.
|
|
3009
|
+
// Other mixed content still posts verbatim.
|
|
3002
3010
|
// Otherwise (a bare CLI with no posting tools, or an agent that chose to
|
|
3003
3011
|
// reply via its output) the wrapper delivers the text as before.
|
|
3004
3012
|
const replyText = (result.text || '').trim();
|
|
@@ -3013,7 +3021,9 @@ export const performRun = ({
|
|
|
3013
3021
|
}
|
|
3014
3022
|
const heartbeatControlReply = (event.type === 'heartbeat' || event.payload?.hasHeartbeat === true)
|
|
3015
3023
|
&& /^(HEARTBEAT_OK|HEARTBEAT_NOOP)$/i.test(replyText);
|
|
3016
|
-
const
|
|
3024
|
+
const declinedInText = event.type !== 'agent.ask' && !someoneIsWaiting(event)
|
|
3025
|
+
&& CLOSES_ON_BARE_SENTINEL.test(replyText);
|
|
3026
|
+
const silentReply = !replyText || replyText === 'NO_REPLY' || heartbeatControlReply || declinedInText;
|
|
3017
3027
|
// A refused model route is not a silent turn. pi reports the refusal on its
|
|
3018
3028
|
// own JSON stream and exits 0 with no text, so before this the seat log read
|
|
3019
3029
|
// `no wrapper-post (empty output)` and the cause — a 429 budget message — was
|
|
@@ -3058,7 +3068,8 @@ export const performRun = ({
|
|
|
3058
3068
|
}
|
|
3059
3069
|
}
|
|
3060
3070
|
} else if (silentReply) {
|
|
3061
|
-
const reason = heartbeatControlReply ? replyText
|
|
3071
|
+
const reason = heartbeatControlReply ? replyText
|
|
3072
|
+
: declinedInText ? 'NO_REPLY' : (replyText || 'empty output');
|
|
3062
3073
|
// A turn that posted via tool and THEN ended with the sentinel is not the
|
|
3063
3074
|
// same event as a turn that produced nothing — but this branch reported
|
|
3064
3075
|
// both as `no wrapper-post (NO_REPLY)`, because it is evaluated before
|