@canonmsg/backend-contracts 1.3.0 → 1.3.1
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.
|
@@ -206,9 +206,6 @@ export function appendParticipationHistoryMessage(snapshot, message, limit = PAR
|
|
|
206
206
|
export function evaluateParticipationPolicy(policy, input) {
|
|
207
207
|
const consecutiveAgentTurns = Math.max(input.consecutiveAgentTurns ?? (input.senderType === 'ai_agent' ? 1 : 0), input.senderType === 'ai_agent' ? 1 : 0);
|
|
208
208
|
const currentAgentStreakStartedByHuman = input.currentAgentStreakStartedByHuman === true;
|
|
209
|
-
if (input.isOwner) {
|
|
210
|
-
return { allow: true, reason: 'owner messages always pass through' };
|
|
211
|
-
}
|
|
212
209
|
if (input.conversationType === 'group'
|
|
213
210
|
&& policy.participation.requireMentionForGroupReplies
|
|
214
211
|
&& !input.mentionedAgent) {
|
|
@@ -217,6 +214,9 @@ export function evaluateParticipationPolicy(policy, input) {
|
|
|
217
214
|
reason: 'group replies require a direct mention',
|
|
218
215
|
};
|
|
219
216
|
}
|
|
217
|
+
if (input.isOwner) {
|
|
218
|
+
return { allow: true, reason: 'owner messages pass through outside mention-required group turns' };
|
|
219
|
+
}
|
|
220
220
|
if (input.senderType !== 'ai_agent') {
|
|
221
221
|
return { allow: true, reason: 'latest sender is human' };
|
|
222
222
|
}
|
|
@@ -216,9 +216,6 @@ function appendParticipationHistoryMessage(snapshot, message, limit = exports.PA
|
|
|
216
216
|
function evaluateParticipationPolicy(policy, input) {
|
|
217
217
|
const consecutiveAgentTurns = Math.max(input.consecutiveAgentTurns ?? (input.senderType === 'ai_agent' ? 1 : 0), input.senderType === 'ai_agent' ? 1 : 0);
|
|
218
218
|
const currentAgentStreakStartedByHuman = input.currentAgentStreakStartedByHuman === true;
|
|
219
|
-
if (input.isOwner) {
|
|
220
|
-
return { allow: true, reason: 'owner messages always pass through' };
|
|
221
|
-
}
|
|
222
219
|
if (input.conversationType === 'group'
|
|
223
220
|
&& policy.participation.requireMentionForGroupReplies
|
|
224
221
|
&& !input.mentionedAgent) {
|
|
@@ -227,6 +224,9 @@ function evaluateParticipationPolicy(policy, input) {
|
|
|
227
224
|
reason: 'group replies require a direct mention',
|
|
228
225
|
};
|
|
229
226
|
}
|
|
227
|
+
if (input.isOwner) {
|
|
228
|
+
return { allow: true, reason: 'owner messages pass through outside mention-required group turns' };
|
|
229
|
+
}
|
|
230
230
|
if (input.senderType !== 'ai_agent') {
|
|
231
231
|
return { allow: true, reason: 'latest sender is human' };
|
|
232
232
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonmsg/backend-contracts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Canon backend contract helpers shared by Functions and stream-service",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^22.0.0",
|
|
44
44
|
"typescript": "~5.7.0",
|
|
45
|
-
"vitest": "^
|
|
45
|
+
"vitest": "^4.1.8"
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT"
|
|
48
48
|
}
|