@canonmsg/backend-contracts 1.7.1 → 1.8.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.
- package/dist/agentBehaviorPolicy.d.ts +86 -45
- package/dist/agentBehaviorPolicy.js +53 -0
- package/dist/bridgeLocal.d.ts +1729 -0
- package/dist/bridgeLocal.js +673 -0
- package/dist/cjs/agentBehaviorPolicy.js +54 -1
- package/dist/cjs/bridgeLocal.js +676 -0
- package/dist/cjs/contactRequest.js +30 -0
- package/dist/cjs/controlSignals.js +44 -0
- package/dist/cjs/endpointRegistry.js +264 -0
- package/dist/cjs/hitl.js +0 -0
- package/dist/cjs/inboundFrame.js +92 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/media.js +13 -0
- package/dist/cjs/message.js +64 -0
- package/dist/cjs/restEndpoints.js +237 -0
- package/dist/cjs/runtimeCardFields.js +58 -1
- package/dist/cjs/sendContextual.js +92 -0
- package/dist/cjs/sseEvents.js +298 -0
- package/dist/cjs/turnProtocol.js +41 -1
- package/dist/contactRequest.d.ts +42 -23
- package/dist/contactRequest.js +29 -0
- package/dist/controlSignals.d.ts +55 -0
- package/dist/controlSignals.js +41 -0
- package/dist/endpointRegistry.d.ts +13 -0
- package/dist/endpointRegistry.js +261 -0
- package/dist/hitl.d.ts +303 -0
- package/dist/hitl.js +168 -0
- package/dist/inboundFrame.d.ts +229 -0
- package/dist/inboundFrame.js +89 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/media.d.ts +24 -11
- package/dist/media.js +12 -0
- package/dist/message.d.ts +133 -50
- package/dist/message.js +64 -1
- package/dist/restEndpoints.d.ts +531 -0
- package/dist/restEndpoints.js +234 -0
- package/dist/runtimeCardFields.d.ts +112 -39
- package/dist/runtimeCardFields.js +57 -0
- package/dist/schemas/agent-behavior-settings-record.schema.json +48 -0
- package/dist/schemas/bridge-connection-state-notification.schema.json +19 -0
- package/dist/schemas/bridge-get-attachment-params.schema.json +24 -0
- package/dist/schemas/bridge-get-attachment-result.schema.json +20 -0
- package/dist/schemas/bridge-hello-params.schema.json +42 -0
- package/dist/schemas/bridge-hello-result.schema.json +105 -0
- package/dist/schemas/bridge-hitl-state.schema.json +38 -0
- package/dist/schemas/bridge-ok-result.schema.json +15 -0
- package/dist/schemas/bridge-ready-notification.schema.json +79 -0
- package/dist/schemas/bridge-resync-reason.schema.json +9 -0
- package/dist/schemas/bridge-resync.schema.json +18 -0
- package/dist/schemas/bridge-rpc-error.schema.json +19 -0
- package/dist/schemas/bridge-rpc-id.schema.json +12 -0
- package/dist/schemas/bridge-rpc-notification.schema.json +20 -0
- package/dist/schemas/bridge-rpc-request.schema.json +31 -0
- package/dist/schemas/bridge-rpc-response.schema.json +81 -0
- package/dist/schemas/bridge-status-result.schema.json +76 -0
- package/dist/schemas/bridge-upload-media-params.schema.json +28 -0
- package/dist/schemas/bridge-upstream-state.schema.json +10 -0
- package/dist/schemas/contacts-response.schema.json +52 -0
- package/dist/schemas/control-channel-key.schema.json +10 -0
- package/dist/schemas/control-primitive-event.schema.json +30 -0
- package/dist/schemas/control-primitive-map.schema.json +15 -0
- package/dist/schemas/control-session-event.schema.json +26 -0
- package/dist/schemas/control-session-node.schema.json +11 -0
- package/dist/schemas/control-signal-event.schema.json +35 -0
- package/dist/schemas/control-signal-node.schema.json +22 -0
- package/dist/schemas/control-signal-type.schema.json +10 -0
- package/dist/schemas/conversations-response.schema.json +167 -0
- package/dist/schemas/create-contact-request-request.schema.json +17 -0
- package/dist/schemas/create-contact-request-response.schema.json +51 -0
- package/dist/schemas/create-conversation-request.schema.json +82 -0
- package/dist/schemas/create-conversation-response.schema.json +29 -0
- package/dist/schemas/delete-message-response.schema.json +11 -0
- package/dist/schemas/delivery-intent.schema.json +11 -0
- package/dist/schemas/forward-message-request.schema.json +25 -0
- package/dist/schemas/forward-message-response.schema.json +35 -0
- package/dist/schemas/forwarded-from.schema.json +18 -0
- package/dist/schemas/get-messages-query.schema.json +17 -0
- package/dist/schemas/hitl-approval-category.schema.json +15 -0
- package/dist/schemas/hitl-approval-detail.schema.json +21 -0
- package/dist/schemas/hitl-approval-outcome-record.schema.json +33 -0
- package/dist/schemas/hitl-approval-reply-record.schema.json +57 -0
- package/dist/schemas/hitl-approval-request-record.schema.json +105 -0
- package/dist/schemas/hitl-approval-risk.schema.json +11 -0
- package/dist/schemas/hitl-card-outcome-record.schema.json +48 -0
- package/dist/schemas/hitl-card-reply-record.schema.json +46 -0
- package/dist/schemas/hitl-card-request-record.schema.json +73 -0
- package/dist/schemas/hitl-input-answers.schema.json +23 -0
- package/dist/schemas/hitl-input-kind.schema.json +10 -0
- package/dist/schemas/hitl-input-outcome-record.schema.json +46 -0
- package/dist/schemas/hitl-input-question.schema.json +54 -0
- package/dist/schemas/hitl-input-reply-record.schema.json +44 -0
- package/dist/schemas/hitl-input-request-record.schema.json +134 -0
- package/dist/schemas/hitl-pending.schema.json +31 -0
- package/dist/schemas/hitl-request-accepted.schema.json +18 -0
- package/dist/schemas/hitl-request-kind.schema.json +10 -0
- package/dist/schemas/hitl-resolution-status.schema.json +10 -0
- package/dist/schemas/hitl-resolution.schema.json +38 -0
- package/dist/schemas/hitl-session-rule.schema.json +32 -0
- package/dist/schemas/inbound-disposition.schema.json +13 -0
- package/dist/schemas/inbound-frame-attachment-v1.schema.json +94 -0
- package/dist/schemas/inbound-frame-contact-card-v1.schema.json +59 -0
- package/dist/schemas/inbound-frame-group-context-v1.schema.json +96 -0
- package/dist/schemas/inbound-frame-reply-context-v1.schema.json +261 -0
- package/dist/schemas/inbound-frame-shape-v1.schema.json +12 -0
- package/dist/schemas/inbound-frame-v1.schema.json +506 -0
- package/dist/schemas/mark-read-response.schema.json +11 -0
- package/dist/schemas/media-attachment-kind.schema.json +11 -0
- package/dist/schemas/media-attachment.schema.json +42 -0
- package/dist/schemas/messages-page-response.schema.json +290 -0
- package/dist/schemas/participation-decision-input.schema.json +44 -0
- package/dist/schemas/participation-history-message.schema.json +23 -0
- package/dist/schemas/participation-history-snapshot.schema.json +37 -0
- package/dist/schemas/participation-style.schema.json +13 -0
- package/dist/schemas/react-request.schema.json +22 -0
- package/dist/schemas/react-response.schema.json +35 -0
- package/dist/schemas/resolve-admission-request.schema.json +30 -0
- package/dist/schemas/resolve-admission-response.schema.json +129 -0
- package/dist/schemas/resolved-agent-behavior-policy-record.schema.json +81 -0
- package/dist/schemas/rest-contact.schema.json +40 -0
- package/dist/schemas/rest-conversation-last-message.schema.json +77 -0
- package/dist/schemas/rest-conversation.schema.json +155 -0
- package/dist/schemas/rest-message.schema.json +252 -0
- package/dist/schemas/rest-ok-response.schema.json +11 -0
- package/dist/schemas/rest-session-selection.schema.json +40 -0
- package/dist/schemas/runtime-card-field-choice.schema.json +23 -0
- package/dist/schemas/runtime-card-field-type.schema.json +17 -0
- package/dist/schemas/runtime-card-field.schema.json +180 -0
- package/dist/schemas/runtime-card-line-item-column-type.schema.json +12 -0
- package/dist/schemas/runtime-card-line-item-column.schema.json +74 -0
- package/dist/schemas/send-contextual-deferred-response.schema.json +39 -0
- package/dist/schemas/send-contextual-messaged-response.schema.json +42 -0
- package/dist/schemas/send-contextual-request.schema.json +103 -0
- package/dist/schemas/send-contextual-response.schema.json +105 -0
- package/dist/schemas/send-contextual-self-context.schema.json +19 -0
- package/dist/schemas/send-contextual-state-response.schema.json +24 -0
- package/dist/schemas/send-message-request.schema.json +106 -0
- package/dist/schemas/send-message-response.schema.json +14 -0
- package/dist/schemas/sender-type.schema.json +9 -0
- package/dist/schemas/serialize-message-input.schema.json +29 -0
- package/dist/schemas/serialized-agent-client-type.schema.json +12 -0
- package/dist/schemas/serialized-contact-card.schema.json +65 -0
- package/dist/schemas/serialized-contact-request-status.schema.json +11 -0
- package/dist/schemas/serialized-contact-request.schema.json +157 -0
- package/dist/schemas/serialized-content-type.schema.json +13 -0
- package/dist/schemas/serialized-message.schema.json +249 -0
- package/dist/schemas/serialized-reactions.schema.json +14 -0
- package/dist/schemas/serialized-sender-type.schema.json +9 -0
- package/dist/schemas/set-streaming-request.schema.json +67 -0
- package/dist/schemas/set-typing-request.schema.json +25 -0
- package/dist/schemas/sse-access-policy.schema.json +10 -0
- package/dist/schemas/sse-agent-context-payload.schema.json +57 -0
- package/dist/schemas/sse-connected-payload.schema.json +18 -0
- package/dist/schemas/sse-contact-payload.schema.json +40 -0
- package/dist/schemas/sse-contact-removed-payload.schema.json +14 -0
- package/dist/schemas/sse-contact-request-payload.schema.json +157 -0
- package/dist/schemas/sse-conversation-updated-payload.schema.json +48 -0
- package/dist/schemas/sse-error-payload.schema.json +23 -0
- package/dist/schemas/sse-event-envelope.schema.json +42 -0
- package/dist/schemas/sse-event-family.schema.json +12 -0
- package/dist/schemas/sse-event-type.schema.json +28 -0
- package/dist/schemas/sse-heartbeat-payload.schema.json +14 -0
- package/dist/schemas/sse-membership-change.schema.json +28 -0
- package/dist/schemas/sse-message-created-payload.schema.json +414 -0
- package/dist/schemas/sse-message-deleted-payload.schema.json +18 -0
- package/dist/schemas/sse-message-updated-payload.schema.json +46 -0
- package/dist/schemas/sse-presence-payload.schema.json +21 -0
- package/dist/schemas/sse-provenance.schema.json +64 -0
- package/dist/schemas/sse-replay-expired-payload.schema.json +21 -0
- package/dist/schemas/sse-runtime-control-kind.schema.json +13 -0
- package/dist/schemas/sse-runtime-control-payload.schema.json +44 -0
- package/dist/schemas/sse-runtime-updated-payload.schema.json +78 -0
- package/dist/schemas/sse-self-context.schema.json +45 -0
- package/dist/schemas/sse-turn-dispatch.schema.json +29 -0
- package/dist/schemas/sse-turn-updated-payload.schema.json +33 -0
- package/dist/schemas/sse-typing-payload.schema.json +32 -0
- package/dist/schemas/sse-voice-session-event-payload.schema.json +170 -0
- package/dist/schemas/sse-voice-session.schema.json +157 -0
- package/dist/schemas/trigger-decision.schema.json +27 -0
- package/dist/schemas/turn-lifecycle-state.schema.json +14 -0
- package/dist/schemas/turn-message-semantics.schema.json +10 -0
- package/dist/schemas/turn-metadata.schema.json +56 -0
- package/dist/schemas/turn-state-like.schema.json +39 -0
- package/dist/schemas/update-disposition-request.schema.json +22 -0
- package/dist/schemas/upload-media-request.schema.json +25 -0
- package/dist/schemas/upload-media-response.schema.json +55 -0
- package/dist/sendContextual.d.ts +114 -0
- package/dist/sendContextual.js +89 -0
- package/dist/sseEvents.d.ts +494 -0
- package/dist/sseEvents.js +295 -0
- package/dist/turnProtocol.d.ts +91 -24
- package/dist/turnProtocol.js +40 -0
- package/package.json +8 -5
|
@@ -1,48 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ParticipationStyleSchema: z.ZodEnum<{
|
|
3
|
+
natural: "natural";
|
|
4
|
+
collaborative: "collaborative";
|
|
5
|
+
"mention-first": "mention-first";
|
|
6
|
+
"approval-gated": "approval-gated";
|
|
7
|
+
"handoff-only": "handoff-only";
|
|
8
|
+
observer: "observer";
|
|
9
|
+
}>;
|
|
10
|
+
export type ParticipationStyle = z.infer<typeof ParticipationStyleSchema>;
|
|
11
|
+
export declare const AgentBehaviorSettingsRecordSchema: z.ZodObject<{
|
|
12
|
+
participationStyle: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
natural: "natural";
|
|
14
|
+
collaborative: "collaborative";
|
|
15
|
+
"mention-first": "mention-first";
|
|
16
|
+
"approval-gated": "approval-gated";
|
|
17
|
+
"handoff-only": "handoff-only";
|
|
18
|
+
observer: "observer";
|
|
19
|
+
}>>;
|
|
20
|
+
allowAgentToAgent: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
allowLongRunningCollaboration: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
requireMentionForGroupReplies: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
maxConsecutiveAgentTurns: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type AgentBehaviorSettingsRecord = z.infer<typeof AgentBehaviorSettingsRecordSchema>;
|
|
27
|
+
export declare const ResolvedAgentBehaviorPolicyRecordSchema: z.ZodObject<{
|
|
28
|
+
participation: z.ZodObject<{
|
|
29
|
+
style: z.ZodEnum<{
|
|
30
|
+
natural: "natural";
|
|
31
|
+
collaborative: "collaborative";
|
|
32
|
+
"mention-first": "mention-first";
|
|
33
|
+
"approval-gated": "approval-gated";
|
|
34
|
+
"handoff-only": "handoff-only";
|
|
35
|
+
observer: "observer";
|
|
36
|
+
}>;
|
|
37
|
+
allowAgentToAgent: z.ZodBoolean;
|
|
38
|
+
allowHumanToAgent: z.ZodBoolean;
|
|
39
|
+
allowLongRunningCollaboration: z.ZodBoolean;
|
|
40
|
+
requireMentionForGroupReplies: z.ZodBoolean;
|
|
41
|
+
maxConsecutiveAgentTurns: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
instructions: z.ZodArray<z.ZodString>;
|
|
44
|
+
source: z.ZodObject<{
|
|
45
|
+
hasAgentDefault: z.ZodBoolean;
|
|
46
|
+
hasConversationOverride: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type ResolvedAgentBehaviorPolicyRecord = z.infer<typeof ResolvedAgentBehaviorPolicyRecordSchema>;
|
|
50
|
+
export declare const ParticipationDecisionInputSchema: z.ZodObject<{
|
|
51
|
+
conversationType: z.ZodEnum<{
|
|
52
|
+
unknown: "unknown";
|
|
53
|
+
direct: "direct";
|
|
54
|
+
group: "group";
|
|
55
|
+
}>;
|
|
56
|
+
senderType: z.ZodEnum<{
|
|
57
|
+
human: "human";
|
|
58
|
+
ai_agent: "ai_agent";
|
|
59
|
+
}>;
|
|
60
|
+
isOwner: z.ZodBoolean;
|
|
61
|
+
mentionedAgent: z.ZodBoolean;
|
|
62
|
+
recentHumanCount: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
consecutiveAgentTurns: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
currentAgentStreakStartedByHuman: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type ParticipationDecisionInput = z.infer<typeof ParticipationDecisionInputSchema>;
|
|
67
|
+
export declare const ParticipationHistoryMessageSchema: z.ZodObject<{
|
|
68
|
+
senderId: z.ZodString;
|
|
69
|
+
senderType: z.ZodEnum<{
|
|
70
|
+
human: "human";
|
|
71
|
+
ai_agent: "ai_agent";
|
|
72
|
+
}>;
|
|
73
|
+
metadata: z.ZodOptional<z.ZodUnknown>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type ParticipationHistoryMessage = z.infer<typeof ParticipationHistoryMessageSchema>;
|
|
76
|
+
export declare const ParticipationHistorySnapshotSchema: z.ZodObject<{
|
|
77
|
+
recentSenderTypes: z.ZodArray<z.ZodEnum<{
|
|
78
|
+
human: "human";
|
|
79
|
+
ai_agent: "ai_agent";
|
|
80
|
+
}>>;
|
|
81
|
+
recentHumanCount: z.ZodNumber;
|
|
82
|
+
recentAgentCount: z.ZodNumber;
|
|
83
|
+
consecutiveAgentTurns: z.ZodNumber;
|
|
84
|
+
currentAgentStreakStartedByHuman: z.ZodBoolean;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type ParticipationHistorySnapshot = z.infer<typeof ParticipationHistorySnapshotSchema>;
|
|
46
87
|
export declare const PARTICIPATION_HISTORY_FETCH_LIMIT = 50;
|
|
47
88
|
export declare function parseAgentBehaviorSettings(raw: unknown): AgentBehaviorSettingsRecord;
|
|
48
89
|
export declare function normalizeStoredAgentBehaviorPolicy(raw: Record<string, unknown> | undefined): AgentBehaviorSettingsRecord | null;
|
|
@@ -1,4 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { resolveTurnMessageSemantics } from './turnProtocol.js';
|
|
3
|
+
export const ParticipationStyleSchema = z.enum([
|
|
4
|
+
'natural',
|
|
5
|
+
'collaborative',
|
|
6
|
+
'mention-first',
|
|
7
|
+
'approval-gated',
|
|
8
|
+
'handoff-only',
|
|
9
|
+
'observer',
|
|
10
|
+
]);
|
|
11
|
+
export const AgentBehaviorSettingsRecordSchema = z.object({
|
|
12
|
+
participationStyle: ParticipationStyleSchema.optional(),
|
|
13
|
+
allowAgentToAgent: z.boolean().optional(),
|
|
14
|
+
allowLongRunningCollaboration: z.boolean().optional(),
|
|
15
|
+
requireMentionForGroupReplies: z.boolean().optional(),
|
|
16
|
+
maxConsecutiveAgentTurns: z.number().nullable().optional(),
|
|
17
|
+
instructions: z.string().nullable().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const ResolvedAgentBehaviorPolicyRecordSchema = z.object({
|
|
20
|
+
participation: z.object({
|
|
21
|
+
style: ParticipationStyleSchema,
|
|
22
|
+
allowAgentToAgent: z.boolean(),
|
|
23
|
+
allowHumanToAgent: z.boolean(),
|
|
24
|
+
allowLongRunningCollaboration: z.boolean(),
|
|
25
|
+
requireMentionForGroupReplies: z.boolean(),
|
|
26
|
+
maxConsecutiveAgentTurns: z.number().nullable().optional(),
|
|
27
|
+
}),
|
|
28
|
+
instructions: z.array(z.string()),
|
|
29
|
+
source: z.object({
|
|
30
|
+
hasAgentDefault: z.boolean(),
|
|
31
|
+
hasConversationOverride: z.boolean(),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
export const ParticipationDecisionInputSchema = z.object({
|
|
35
|
+
conversationType: z.enum(['direct', 'group', 'unknown']),
|
|
36
|
+
senderType: z.enum(['human', 'ai_agent']),
|
|
37
|
+
isOwner: z.boolean(),
|
|
38
|
+
mentionedAgent: z.boolean(),
|
|
39
|
+
recentHumanCount: z.number().optional(),
|
|
40
|
+
consecutiveAgentTurns: z.number().optional(),
|
|
41
|
+
currentAgentStreakStartedByHuman: z.boolean().optional(),
|
|
42
|
+
});
|
|
43
|
+
export const ParticipationHistoryMessageSchema = z.object({
|
|
44
|
+
senderId: z.string(),
|
|
45
|
+
senderType: z.enum(['human', 'ai_agent']),
|
|
46
|
+
metadata: z.unknown().optional(),
|
|
47
|
+
});
|
|
48
|
+
export const ParticipationHistorySnapshotSchema = z.object({
|
|
49
|
+
recentSenderTypes: z.array(z.enum(['human', 'ai_agent'])),
|
|
50
|
+
recentHumanCount: z.number(),
|
|
51
|
+
recentAgentCount: z.number(),
|
|
52
|
+
consecutiveAgentTurns: z.number(),
|
|
53
|
+
currentAgentStreakStartedByHuman: z.boolean(),
|
|
54
|
+
});
|
|
2
55
|
export const PARTICIPATION_HISTORY_FETCH_LIMIT = 50;
|
|
3
56
|
const VALID_PARTICIPATION_STYLES = new Set([
|
|
4
57
|
'natural',
|