@commonlyai/cli 0.1.285 → 0.1.286
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 +6 -9
- package/src/lib/enforcement.js +14 -16
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -873,7 +873,7 @@ const HELD_RETRY_MAX_FAILURES = 3;
|
|
|
873
873
|
const PAST_CAP_MAX_CARRIES = 5;
|
|
874
874
|
|
|
875
875
|
// Who gets a slot when a batch is past the cap. 'unknown' counts as a person:
|
|
876
|
-
//
|
|
876
|
+
// only a row the snapshot and the kernel's stamp both can't place reads so, and
|
|
877
877
|
// a wrong guess costs an ambient item one turn. Within a rank the older row
|
|
878
878
|
// wins, and carried rows lead the page, so new arrivals can't overtake them.
|
|
879
879
|
const capRank = (entry) => {
|
|
@@ -1760,7 +1760,7 @@ export const answersInChannel = (entry) => {
|
|
|
1760
1760
|
// line offered silence on every turn. A turn that answers a person drops that
|
|
1761
1761
|
// exit: NO_REPLY stays only as the way to end after a reply posted through a
|
|
1762
1762
|
// tool, so the wrapper doesn't post a second one. It needs the sender known to
|
|
1763
|
-
// be human, so an agent's @ and a message
|
|
1763
|
+
// be human, so an agent's @ and a message nobody can place keep the old line. A
|
|
1764
1764
|
// seat whose peer holds the claim keeps it too: the peer is answering them. So
|
|
1765
1765
|
// do two chat.mention wakes where nobody typed the seat's name: an adjacent
|
|
1766
1766
|
// reply and a new member's welcome, whose kernel frames offer NO_REPLY.
|
|
@@ -3817,14 +3817,11 @@ export const performRun = ({
|
|
|
3817
3817
|
);
|
|
3818
3818
|
if (!admission.allowed) {
|
|
3819
3819
|
// An agent row refuses the page, and that shouldn't cost a row nobody
|
|
3820
|
-
// can place:
|
|
3821
|
-
//
|
|
3822
|
-
//
|
|
3823
|
-
// stamped as an agent's is placed, so it stays refused, or it would walk
|
|
3824
|
-
// past this brake. A legacy row has no stamp, and still carries.
|
|
3820
|
+
// can place: one past the snapshot with no stamp reads `unknown`. It is
|
|
3821
|
+
// carried, past-cap bound included, and alone in its next page it can't
|
|
3822
|
+
// be refused, because only 'agent' ever is.
|
|
3825
3823
|
for (const entry of wakingEntries) {
|
|
3826
|
-
if (entry.trigger === 'unknown' && entry.event.payload?.messageId
|
|
3827
|
-
&& entry.event.payload?.senderIsHuman !== false) entry.pastCap = true;
|
|
3824
|
+
if (entry.trigger === 'unknown' && entry.event.payload?.messageId) entry.pastCap = true;
|
|
3828
3825
|
else entry.result = batchAdmissionResult(entry.event, admission);
|
|
3829
3826
|
}
|
|
3830
3827
|
carryPastCap();
|
package/src/lib/enforcement.js
CHANGED
|
@@ -49,23 +49,21 @@ export const frameDecisionForkRule = (prompt) => `${DECISION_FORK_FRAME}\n\n${pr
|
|
|
49
49
|
/**
|
|
50
50
|
* Who authored the message that woke us — 'agent', 'human', or 'unknown'?
|
|
51
51
|
*
|
|
52
|
-
*
|
|
52
|
+
* Three signals, in order:
|
|
53
53
|
* 1. payload.dmKind — the kernel stamps DM wakes 'agent-agent'/'user-agent'.
|
|
54
54
|
* 2. The trigger message's isBot flag, looked up by payload.messageId in the
|
|
55
55
|
* pre-spawn snapshot the run loop already fetches for echo suppression.
|
|
56
|
+
* 3. payload.senderIsHuman, for what no snapshot can name. A page holds more
|
|
57
|
+
* wakes than the snapshot holds messages, so without this a full page of
|
|
58
|
+
* agent wakes reads as all unknown and walks past the cascade cap. A post
|
|
59
|
+
* comment isn't a pod message at all (F225).
|
|
56
60
|
*
|
|
57
61
|
* 'unknown' is the fail-open verdict: it neither counts toward the cascade
|
|
58
|
-
* cap nor resets it.
|
|
59
|
-
*
|
|
60
|
-
* that has already scrolled out of the window is not cascade tempo.
|
|
62
|
+
* cap nor resets it. It's what's left when the kernel couldn't say either: an
|
|
63
|
+
* older server, or a sender it couldn't read.
|
|
61
64
|
*/
|
|
62
65
|
export const classifyTrigger = (event, recentMessages) => {
|
|
63
66
|
const p = event?.payload || {};
|
|
64
|
-
// A post comment is not a pod message, so a snapshot can never name its
|
|
65
|
-
// author (F225). The kernel stamps it; an older server leaves it 'unknown'.
|
|
66
|
-
if (event?.type === 'thread.mention' && typeof p.senderIsHuman === 'boolean') {
|
|
67
|
-
return p.senderIsHuman ? 'human' : 'agent';
|
|
68
|
-
}
|
|
69
67
|
// The third pricing branch (#1044, fable 55845). Kernel-found work is not
|
|
70
68
|
// agent churn and must not price as it: counted as 'agent' it eats cascade
|
|
71
69
|
// budget exactly when the board is busiest; counted as 'human' it CLEARS the
|
|
@@ -76,12 +74,12 @@ export const classifyTrigger = (event, recentMessages) => {
|
|
|
76
74
|
if (p.triggerAuthor === 'kernel') return 'kernel';
|
|
77
75
|
if (p.dmKind === 'agent-agent') return 'agent';
|
|
78
76
|
if (p.dmKind === 'user-agent') return 'human';
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
);
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
77
|
+
const trigger = p.messageId && Array.isArray(recentMessages)
|
|
78
|
+
? recentMessages.find((m) => String(m._id || m.id) === String(p.messageId))
|
|
79
|
+
: undefined;
|
|
80
|
+
if (typeof trigger?.isBot === 'boolean') return trigger.isBot ? 'agent' : 'human';
|
|
81
|
+
if (typeof p.senderIsHuman === 'boolean') return p.senderIsHuman ? 'human' : 'agent';
|
|
82
|
+
return 'unknown';
|
|
85
83
|
};
|
|
86
84
|
|
|
87
85
|
// Direct-address event types: the seat was NAMED (explicit @, implicit human
|
|
@@ -94,7 +92,7 @@ export const ADDRESSED_EVENT_TYPES = new Set(['chat.mention', 'thread.mention',
|
|
|
94
92
|
/**
|
|
95
93
|
* A person @-mentioned this seat in a pod (ADR-018 D9.2): the one wake that
|
|
96
94
|
* carries unread message bodies. `trigger` is classifyTrigger's verdict, so an
|
|
97
|
-
* agent's mention, a kernel wake and an author
|
|
95
|
+
* agent's mention, a kernel wake and an author nobody can name are all
|
|
98
96
|
* out. A DM wake is not a mention, whichever type it rides, and neither is a
|
|
99
97
|
* broadcast. Nor are three `chat.mention` wakes where nobody typed the seat's
|
|
100
98
|
* name: a welcome, an adjacent reply and a reply to the seat's own message.
|