@canonmsg/backend-contracts 0.2.2 → 0.2.3

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.
@@ -34,6 +34,7 @@ function normalizeAgentClientType(value) {
34
34
  if (value === 'claude-code'
35
35
  || value === 'openclaw'
36
36
  || value === 'codex'
37
+ || value === 'hermes'
37
38
  || value === 'generic') {
38
39
  return value;
39
40
  }
@@ -9,6 +9,16 @@ exports.normalizeRuntimeTurnState = normalizeRuntimeTurnState;
9
9
  function isRecord(value) {
10
10
  return typeof value === 'object' && value !== null && !Array.isArray(value);
11
11
  }
12
+ function isHiddenRuntimeCardMetadata(metadata) {
13
+ if (!isRecord(metadata) || typeof metadata.type !== 'string')
14
+ return false;
15
+ return metadata.type === 'approval_reply'
16
+ || metadata.type === 'approval_outcome'
17
+ || metadata.type === 'question_reply'
18
+ || metadata.type === 'plan_approval_reply'
19
+ || metadata.type === 'runtime_input_reply'
20
+ || metadata.type === 'runtime_input_outcome';
21
+ }
12
22
  function normalizeTurnMetadata(metadata) {
13
23
  if (!isRecord(metadata))
14
24
  return null;
@@ -48,6 +58,9 @@ function resolveTurnMessageSemantics(input) {
48
58
  return isTurnOpen(input.senderTurnState) ? 'progress' : 'turn_complete';
49
59
  }
50
60
  function shouldPromoteConversationMessage(input) {
61
+ if (isHiddenRuntimeCardMetadata(input.metadata)) {
62
+ return false;
63
+ }
51
64
  return resolveTurnMessageSemantics(input) !== 'progress';
52
65
  }
53
66
  function shouldTriggerAgentTurn(input) {
package/dist/message.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MediaAttachment } from './media.js';
2
2
  export type SerializedSenderType = 'human' | 'ai_agent';
3
- export type SerializedAgentClientType = 'claude-code' | 'openclaw' | 'codex' | 'generic';
3
+ export type SerializedAgentClientType = 'claude-code' | 'openclaw' | 'codex' | 'hermes' | 'generic';
4
4
  export type SerializedContentType = 'text' | 'image' | 'audio' | 'file' | 'contact_card';
5
5
  export interface ForwardedFrom {
6
6
  sourceConversationId: string;
package/dist/message.js CHANGED
@@ -31,6 +31,7 @@ function normalizeAgentClientType(value) {
31
31
  if (value === 'claude-code'
32
32
  || value === 'openclaw'
33
33
  || value === 'codex'
34
+ || value === 'hermes'
34
35
  || value === 'generic') {
35
36
  return value;
36
37
  }
@@ -1,6 +1,16 @@
1
1
  function isRecord(value) {
2
2
  return typeof value === 'object' && value !== null && !Array.isArray(value);
3
3
  }
4
+ function isHiddenRuntimeCardMetadata(metadata) {
5
+ if (!isRecord(metadata) || typeof metadata.type !== 'string')
6
+ return false;
7
+ return metadata.type === 'approval_reply'
8
+ || metadata.type === 'approval_outcome'
9
+ || metadata.type === 'question_reply'
10
+ || metadata.type === 'plan_approval_reply'
11
+ || metadata.type === 'runtime_input_reply'
12
+ || metadata.type === 'runtime_input_outcome';
13
+ }
4
14
  export function normalizeTurnMetadata(metadata) {
5
15
  if (!isRecord(metadata))
6
16
  return null;
@@ -40,6 +50,9 @@ export function resolveTurnMessageSemantics(input) {
40
50
  return isTurnOpen(input.senderTurnState) ? 'progress' : 'turn_complete';
41
51
  }
42
52
  export function shouldPromoteConversationMessage(input) {
53
+ if (isHiddenRuntimeCardMetadata(input.metadata)) {
54
+ return false;
55
+ }
43
56
  return resolveTurnMessageSemantics(input) !== 'progress';
44
57
  }
45
58
  export function shouldTriggerAgentTurn(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonmsg/backend-contracts",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Canon backend contract helpers shared by Functions and stream-service",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.js",