@canonmsg/backend-contracts 1.9.0 → 2.0.0
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 +45 -86
- package/dist/agentBehaviorPolicy.js +0 -53
- package/dist/cjs/agentBehaviorPolicy.js +1 -54
- package/dist/cjs/contactRequest.js +0 -30
- package/dist/cjs/index.js +0 -8
- package/dist/cjs/media.js +0 -13
- package/dist/cjs/message.js +0 -64
- package/dist/cjs/runtimeCardFields.js +1 -58
- package/dist/cjs/turnProtocol.js +1 -41
- package/dist/contactRequest.d.ts +23 -42
- package/dist/contactRequest.js +0 -29
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/media.d.ts +11 -24
- package/dist/media.js +0 -12
- package/dist/message.d.ts +50 -133
- package/dist/message.js +1 -64
- package/dist/runtimeCardFields.d.ts +39 -112
- package/dist/runtimeCardFields.js +0 -57
- package/dist/turnProtocol.d.ts +24 -91
- package/dist/turnProtocol.js +0 -40
- package/package.json +5 -8
- package/dist/bridgeLocal.d.ts +0 -1871
- package/dist/bridgeLocal.js +0 -744
- package/dist/cjs/bridgeLocal.js +0 -747
- package/dist/cjs/controlSignals.js +0 -44
- package/dist/cjs/endpointRegistry.js +0 -264
- package/dist/cjs/hitl.js +0 -171
- package/dist/cjs/inboundFrame.js +0 -92
- package/dist/cjs/restEndpoints.js +0 -237
- package/dist/cjs/sendContextual.js +0 -92
- package/dist/cjs/sseEvents.js +0 -281
- package/dist/controlSignals.d.ts +0 -55
- package/dist/controlSignals.js +0 -41
- package/dist/endpointRegistry.d.ts +0 -13
- package/dist/endpointRegistry.js +0 -261
- package/dist/hitl.d.ts +0 -303
- package/dist/hitl.js +0 -168
- package/dist/inboundFrame.d.ts +0 -229
- package/dist/inboundFrame.js +0 -89
- package/dist/restEndpoints.d.ts +0 -531
- package/dist/restEndpoints.js +0 -234
- package/dist/schemas/agent-behavior-settings-record.schema.json +0 -48
- package/dist/schemas/bridge-connection-state-notification.schema.json +0 -19
- package/dist/schemas/bridge-get-attachment-params.schema.json +0 -24
- package/dist/schemas/bridge-get-attachment-result.schema.json +0 -20
- package/dist/schemas/bridge-hello-params.schema.json +0 -42
- package/dist/schemas/bridge-hello-result.schema.json +0 -105
- package/dist/schemas/bridge-hitl-state.schema.json +0 -38
- package/dist/schemas/bridge-ok-result.schema.json +0 -15
- package/dist/schemas/bridge-publish-streaming-event-params.schema.json +0 -138
- package/dist/schemas/bridge-ready-notification.schema.json +0 -79
- package/dist/schemas/bridge-resync-reason.schema.json +0 -9
- package/dist/schemas/bridge-resync.schema.json +0 -18
- package/dist/schemas/bridge-rpc-error.schema.json +0 -19
- package/dist/schemas/bridge-rpc-id.schema.json +0 -12
- package/dist/schemas/bridge-rpc-notification.schema.json +0 -20
- package/dist/schemas/bridge-rpc-request.schema.json +0 -31
- package/dist/schemas/bridge-rpc-response.schema.json +0 -81
- package/dist/schemas/bridge-status-result.schema.json +0 -76
- package/dist/schemas/bridge-stream-clear-event.schema.json +0 -15
- package/dist/schemas/bridge-stream-event.schema.json +0 -112
- package/dist/schemas/bridge-stream-final-event.schema.json +0 -19
- package/dist/schemas/bridge-stream-text-event.schema.json +0 -31
- package/dist/schemas/bridge-stream-thinking-event.schema.json +0 -15
- package/dist/schemas/bridge-stream-tool-event.schema.json +0 -36
- package/dist/schemas/bridge-upload-media-params.schema.json +0 -28
- package/dist/schemas/bridge-upstream-state.schema.json +0 -10
- package/dist/schemas/contacts-response.schema.json +0 -52
- package/dist/schemas/control-channel-key.schema.json +0 -10
- package/dist/schemas/control-primitive-event.schema.json +0 -30
- package/dist/schemas/control-primitive-map.schema.json +0 -15
- package/dist/schemas/control-session-event.schema.json +0 -26
- package/dist/schemas/control-session-node.schema.json +0 -11
- package/dist/schemas/control-signal-event.schema.json +0 -35
- package/dist/schemas/control-signal-node.schema.json +0 -22
- package/dist/schemas/control-signal-type.schema.json +0 -10
- package/dist/schemas/conversations-response.schema.json +0 -167
- package/dist/schemas/create-contact-request-request.schema.json +0 -17
- package/dist/schemas/create-contact-request-response.schema.json +0 -51
- package/dist/schemas/create-conversation-request.schema.json +0 -82
- package/dist/schemas/create-conversation-response.schema.json +0 -29
- package/dist/schemas/delete-message-response.schema.json +0 -11
- package/dist/schemas/delivery-intent.schema.json +0 -11
- package/dist/schemas/forward-message-request.schema.json +0 -25
- package/dist/schemas/forward-message-response.schema.json +0 -35
- package/dist/schemas/forwarded-from.schema.json +0 -18
- package/dist/schemas/get-messages-query.schema.json +0 -17
- package/dist/schemas/hitl-approval-category.schema.json +0 -15
- package/dist/schemas/hitl-approval-detail.schema.json +0 -21
- package/dist/schemas/hitl-approval-outcome-record.schema.json +0 -33
- package/dist/schemas/hitl-approval-reply-record.schema.json +0 -57
- package/dist/schemas/hitl-approval-request-record.schema.json +0 -105
- package/dist/schemas/hitl-approval-risk.schema.json +0 -11
- package/dist/schemas/hitl-card-outcome-record.schema.json +0 -48
- package/dist/schemas/hitl-card-reply-record.schema.json +0 -46
- package/dist/schemas/hitl-card-request-record.schema.json +0 -73
- package/dist/schemas/hitl-input-answers.schema.json +0 -23
- package/dist/schemas/hitl-input-kind.schema.json +0 -10
- package/dist/schemas/hitl-input-outcome-record.schema.json +0 -46
- package/dist/schemas/hitl-input-question.schema.json +0 -54
- package/dist/schemas/hitl-input-reply-record.schema.json +0 -44
- package/dist/schemas/hitl-input-request-record.schema.json +0 -134
- package/dist/schemas/hitl-pending.schema.json +0 -31
- package/dist/schemas/hitl-request-accepted.schema.json +0 -18
- package/dist/schemas/hitl-request-kind.schema.json +0 -10
- package/dist/schemas/hitl-resolution-status.schema.json +0 -10
- package/dist/schemas/hitl-resolution.schema.json +0 -38
- package/dist/schemas/hitl-session-rule.schema.json +0 -32
- package/dist/schemas/inbound-disposition.schema.json +0 -13
- package/dist/schemas/inbound-frame-attachment-v1.schema.json +0 -94
- package/dist/schemas/inbound-frame-contact-card-v1.schema.json +0 -59
- package/dist/schemas/inbound-frame-group-context-v1.schema.json +0 -96
- package/dist/schemas/inbound-frame-reply-context-v1.schema.json +0 -261
- package/dist/schemas/inbound-frame-shape-v1.schema.json +0 -12
- package/dist/schemas/inbound-frame-v1.schema.json +0 -506
- package/dist/schemas/mark-read-response.schema.json +0 -11
- package/dist/schemas/media-attachment-kind.schema.json +0 -11
- package/dist/schemas/media-attachment.schema.json +0 -42
- package/dist/schemas/messages-page-response.schema.json +0 -290
- package/dist/schemas/participation-decision-input.schema.json +0 -44
- package/dist/schemas/participation-history-message.schema.json +0 -23
- package/dist/schemas/participation-history-snapshot.schema.json +0 -37
- package/dist/schemas/participation-style.schema.json +0 -13
- package/dist/schemas/react-request.schema.json +0 -22
- package/dist/schemas/react-response.schema.json +0 -35
- package/dist/schemas/resolve-admission-request.schema.json +0 -30
- package/dist/schemas/resolve-admission-response.schema.json +0 -129
- package/dist/schemas/resolved-agent-behavior-policy-record.schema.json +0 -81
- package/dist/schemas/rest-contact.schema.json +0 -40
- package/dist/schemas/rest-conversation-last-message.schema.json +0 -77
- package/dist/schemas/rest-conversation.schema.json +0 -155
- package/dist/schemas/rest-message.schema.json +0 -252
- package/dist/schemas/rest-ok-response.schema.json +0 -11
- package/dist/schemas/rest-session-selection.schema.json +0 -40
- package/dist/schemas/runtime-card-field-choice.schema.json +0 -23
- package/dist/schemas/runtime-card-field-type.schema.json +0 -17
- package/dist/schemas/runtime-card-field.schema.json +0 -180
- package/dist/schemas/runtime-card-line-item-column-type.schema.json +0 -12
- package/dist/schemas/runtime-card-line-item-column.schema.json +0 -74
- package/dist/schemas/send-contextual-deferred-response.schema.json +0 -39
- package/dist/schemas/send-contextual-messaged-response.schema.json +0 -42
- package/dist/schemas/send-contextual-request.schema.json +0 -103
- package/dist/schemas/send-contextual-response.schema.json +0 -105
- package/dist/schemas/send-contextual-self-context.schema.json +0 -19
- package/dist/schemas/send-contextual-state-response.schema.json +0 -24
- package/dist/schemas/send-message-request.schema.json +0 -106
- package/dist/schemas/send-message-response.schema.json +0 -14
- package/dist/schemas/sender-type.schema.json +0 -9
- package/dist/schemas/serialize-message-input.schema.json +0 -29
- package/dist/schemas/serialized-agent-client-type.schema.json +0 -12
- package/dist/schemas/serialized-contact-card.schema.json +0 -65
- package/dist/schemas/serialized-contact-request-status.schema.json +0 -11
- package/dist/schemas/serialized-contact-request.schema.json +0 -157
- package/dist/schemas/serialized-content-type.schema.json +0 -13
- package/dist/schemas/serialized-message.schema.json +0 -249
- package/dist/schemas/serialized-reactions.schema.json +0 -14
- package/dist/schemas/serialized-sender-type.schema.json +0 -9
- package/dist/schemas/set-streaming-request.schema.json +0 -67
- package/dist/schemas/set-typing-request.schema.json +0 -25
- package/dist/schemas/sse-access-policy.schema.json +0 -10
- package/dist/schemas/sse-agent-context-payload.schema.json +0 -57
- package/dist/schemas/sse-connected-payload.schema.json +0 -18
- package/dist/schemas/sse-contact-payload.schema.json +0 -40
- package/dist/schemas/sse-contact-removed-payload.schema.json +0 -14
- package/dist/schemas/sse-contact-request-payload.schema.json +0 -157
- package/dist/schemas/sse-conversation-updated-payload.schema.json +0 -48
- package/dist/schemas/sse-error-payload.schema.json +0 -23
- package/dist/schemas/sse-event-envelope.schema.json +0 -40
- package/dist/schemas/sse-event-family.schema.json +0 -12
- package/dist/schemas/sse-event-type.schema.json +0 -26
- package/dist/schemas/sse-heartbeat-payload.schema.json +0 -14
- package/dist/schemas/sse-membership-change.schema.json +0 -28
- package/dist/schemas/sse-message-created-payload.schema.json +0 -414
- package/dist/schemas/sse-message-deleted-payload.schema.json +0 -18
- package/dist/schemas/sse-message-updated-payload.schema.json +0 -46
- package/dist/schemas/sse-presence-payload.schema.json +0 -21
- package/dist/schemas/sse-provenance.schema.json +0 -64
- package/dist/schemas/sse-replay-expired-payload.schema.json +0 -21
- package/dist/schemas/sse-runtime-control-kind.schema.json +0 -13
- package/dist/schemas/sse-runtime-control-payload.schema.json +0 -44
- package/dist/schemas/sse-self-context.schema.json +0 -45
- package/dist/schemas/sse-turn-dispatch.schema.json +0 -29
- package/dist/schemas/sse-typing-payload.schema.json +0 -32
- package/dist/schemas/sse-voice-session-event-payload.schema.json +0 -170
- package/dist/schemas/sse-voice-session.schema.json +0 -157
- package/dist/schemas/trigger-decision.schema.json +0 -27
- package/dist/schemas/turn-lifecycle-state.schema.json +0 -14
- package/dist/schemas/turn-message-semantics.schema.json +0 -10
- package/dist/schemas/turn-metadata.schema.json +0 -56
- package/dist/schemas/turn-state-like.schema.json +0 -39
- package/dist/schemas/update-disposition-request.schema.json +0 -22
- package/dist/schemas/upload-media-request.schema.json +0 -25
- package/dist/schemas/upload-media-response.schema.json +0 -55
- package/dist/sendContextual.d.ts +0 -114
- package/dist/sendContextual.js +0 -89
- package/dist/sseEvents.d.ts +0 -474
- package/dist/sseEvents.js +0 -278
|
@@ -1,89 +1,48 @@
|
|
|
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
|
-
|
|
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>;
|
|
1
|
+
export type ParticipationStyle = 'natural' | 'collaborative' | 'mention-first' | 'approval-gated' | 'handoff-only' | 'observer';
|
|
2
|
+
export interface AgentBehaviorSettingsRecord {
|
|
3
|
+
participationStyle?: ParticipationStyle;
|
|
4
|
+
allowAgentToAgent?: boolean;
|
|
5
|
+
allowLongRunningCollaboration?: boolean;
|
|
6
|
+
requireMentionForGroupReplies?: boolean;
|
|
7
|
+
maxConsecutiveAgentTurns?: number | null;
|
|
8
|
+
instructions?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedAgentBehaviorPolicyRecord {
|
|
11
|
+
participation: {
|
|
12
|
+
style: ParticipationStyle;
|
|
13
|
+
allowAgentToAgent: boolean;
|
|
14
|
+
allowHumanToAgent: boolean;
|
|
15
|
+
allowLongRunningCollaboration: boolean;
|
|
16
|
+
requireMentionForGroupReplies: boolean;
|
|
17
|
+
maxConsecutiveAgentTurns?: number | null;
|
|
18
|
+
};
|
|
19
|
+
instructions: string[];
|
|
20
|
+
source: {
|
|
21
|
+
hasAgentDefault: boolean;
|
|
22
|
+
hasConversationOverride: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface ParticipationDecisionInput {
|
|
26
|
+
conversationType: 'direct' | 'group' | 'unknown';
|
|
27
|
+
senderType: 'human' | 'ai_agent';
|
|
28
|
+
isOwner: boolean;
|
|
29
|
+
mentionedAgent: boolean;
|
|
30
|
+
recentHumanCount?: number;
|
|
31
|
+
consecutiveAgentTurns?: number;
|
|
32
|
+
currentAgentStreakStartedByHuman?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ParticipationHistoryMessage {
|
|
35
|
+
senderId: string;
|
|
36
|
+
senderType: 'human' | 'ai_agent';
|
|
37
|
+
metadata?: unknown;
|
|
38
|
+
}
|
|
39
|
+
export interface ParticipationHistorySnapshot {
|
|
40
|
+
recentSenderTypes: Array<'human' | 'ai_agent'>;
|
|
41
|
+
recentHumanCount: number;
|
|
42
|
+
recentAgentCount: number;
|
|
43
|
+
consecutiveAgentTurns: number;
|
|
44
|
+
currentAgentStreakStartedByHuman: boolean;
|
|
45
|
+
}
|
|
87
46
|
export declare const PARTICIPATION_HISTORY_FETCH_LIMIT = 50;
|
|
88
47
|
export declare function parseAgentBehaviorSettings(raw: unknown): AgentBehaviorSettingsRecord;
|
|
89
48
|
export declare function normalizeStoredAgentBehaviorPolicy(raw: Record<string, unknown> | undefined): AgentBehaviorSettingsRecord | null;
|
|
@@ -1,57 +1,4 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
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
|
-
});
|
|
55
2
|
export const PARTICIPATION_HISTORY_FETCH_LIMIT = 50;
|
|
56
3
|
const VALID_PARTICIPATION_STYLES = new Set([
|
|
57
4
|
'natural',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PARTICIPATION_HISTORY_FETCH_LIMIT =
|
|
3
|
+
exports.PARTICIPATION_HISTORY_FETCH_LIMIT = void 0;
|
|
4
4
|
exports.parseAgentBehaviorSettings = parseAgentBehaviorSettings;
|
|
5
5
|
exports.normalizeStoredAgentBehaviorPolicy = normalizeStoredAgentBehaviorPolicy;
|
|
6
6
|
exports.normalizeAgentBehaviorInstructions = normalizeAgentBehaviorInstructions;
|
|
@@ -8,60 +8,7 @@ exports.resolveAgentBehaviorPolicy = resolveAgentBehaviorPolicy;
|
|
|
8
8
|
exports.buildParticipationHistorySnapshot = buildParticipationHistorySnapshot;
|
|
9
9
|
exports.appendParticipationHistoryMessage = appendParticipationHistoryMessage;
|
|
10
10
|
exports.evaluateParticipationPolicy = evaluateParticipationPolicy;
|
|
11
|
-
const zod_1 = require("zod");
|
|
12
11
|
const turnProtocol_js_1 = require("./turnProtocol.js");
|
|
13
|
-
exports.ParticipationStyleSchema = zod_1.z.enum([
|
|
14
|
-
'natural',
|
|
15
|
-
'collaborative',
|
|
16
|
-
'mention-first',
|
|
17
|
-
'approval-gated',
|
|
18
|
-
'handoff-only',
|
|
19
|
-
'observer',
|
|
20
|
-
]);
|
|
21
|
-
exports.AgentBehaviorSettingsRecordSchema = zod_1.z.object({
|
|
22
|
-
participationStyle: exports.ParticipationStyleSchema.optional(),
|
|
23
|
-
allowAgentToAgent: zod_1.z.boolean().optional(),
|
|
24
|
-
allowLongRunningCollaboration: zod_1.z.boolean().optional(),
|
|
25
|
-
requireMentionForGroupReplies: zod_1.z.boolean().optional(),
|
|
26
|
-
maxConsecutiveAgentTurns: zod_1.z.number().nullable().optional(),
|
|
27
|
-
instructions: zod_1.z.string().nullable().optional(),
|
|
28
|
-
});
|
|
29
|
-
exports.ResolvedAgentBehaviorPolicyRecordSchema = zod_1.z.object({
|
|
30
|
-
participation: zod_1.z.object({
|
|
31
|
-
style: exports.ParticipationStyleSchema,
|
|
32
|
-
allowAgentToAgent: zod_1.z.boolean(),
|
|
33
|
-
allowHumanToAgent: zod_1.z.boolean(),
|
|
34
|
-
allowLongRunningCollaboration: zod_1.z.boolean(),
|
|
35
|
-
requireMentionForGroupReplies: zod_1.z.boolean(),
|
|
36
|
-
maxConsecutiveAgentTurns: zod_1.z.number().nullable().optional(),
|
|
37
|
-
}),
|
|
38
|
-
instructions: zod_1.z.array(zod_1.z.string()),
|
|
39
|
-
source: zod_1.z.object({
|
|
40
|
-
hasAgentDefault: zod_1.z.boolean(),
|
|
41
|
-
hasConversationOverride: zod_1.z.boolean(),
|
|
42
|
-
}),
|
|
43
|
-
});
|
|
44
|
-
exports.ParticipationDecisionInputSchema = zod_1.z.object({
|
|
45
|
-
conversationType: zod_1.z.enum(['direct', 'group', 'unknown']),
|
|
46
|
-
senderType: zod_1.z.enum(['human', 'ai_agent']),
|
|
47
|
-
isOwner: zod_1.z.boolean(),
|
|
48
|
-
mentionedAgent: zod_1.z.boolean(),
|
|
49
|
-
recentHumanCount: zod_1.z.number().optional(),
|
|
50
|
-
consecutiveAgentTurns: zod_1.z.number().optional(),
|
|
51
|
-
currentAgentStreakStartedByHuman: zod_1.z.boolean().optional(),
|
|
52
|
-
});
|
|
53
|
-
exports.ParticipationHistoryMessageSchema = zod_1.z.object({
|
|
54
|
-
senderId: zod_1.z.string(),
|
|
55
|
-
senderType: zod_1.z.enum(['human', 'ai_agent']),
|
|
56
|
-
metadata: zod_1.z.unknown().optional(),
|
|
57
|
-
});
|
|
58
|
-
exports.ParticipationHistorySnapshotSchema = zod_1.z.object({
|
|
59
|
-
recentSenderTypes: zod_1.z.array(zod_1.z.enum(['human', 'ai_agent'])),
|
|
60
|
-
recentHumanCount: zod_1.z.number(),
|
|
61
|
-
recentAgentCount: zod_1.z.number(),
|
|
62
|
-
consecutiveAgentTurns: zod_1.z.number(),
|
|
63
|
-
currentAgentStreakStartedByHuman: zod_1.z.boolean(),
|
|
64
|
-
});
|
|
65
12
|
exports.PARTICIPATION_HISTORY_FETCH_LIMIT = 50;
|
|
66
13
|
const VALID_PARTICIPATION_STYLES = new Set([
|
|
67
14
|
'natural',
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializedContactRequestSchema = exports.SerializedContactRequestStatusSchema = void 0;
|
|
4
3
|
exports.serializeContactRequest = serializeContactRequest;
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.SerializedContactRequestStatusSchema = zod_1.z.enum([
|
|
7
|
-
'pending',
|
|
8
|
-
'approved',
|
|
9
|
-
'rejected',
|
|
10
|
-
'expired',
|
|
11
|
-
]);
|
|
12
|
-
exports.SerializedContactRequestSchema = zod_1.z.object({
|
|
13
|
-
id: zod_1.z.string(),
|
|
14
|
-
requesterId: zod_1.z.string(),
|
|
15
|
-
requesterName: zod_1.z.string(),
|
|
16
|
-
requesterAvatarUrl: zod_1.z.string().nullable(),
|
|
17
|
-
targetId: zod_1.z.string(),
|
|
18
|
-
targetName: zod_1.z.string(),
|
|
19
|
-
targetAvatarUrl: zod_1.z.string().nullable(),
|
|
20
|
-
targetUserType: zod_1.z.enum(['human', 'ai_agent']),
|
|
21
|
-
targetOwnerId: zod_1.z.string().nullable().optional(),
|
|
22
|
-
approverId: zod_1.z.string(),
|
|
23
|
-
message: zod_1.z.string().nullable(),
|
|
24
|
-
status: exports.SerializedContactRequestStatusSchema,
|
|
25
|
-
kind: zod_1.z.enum(['dm', 'group_invite']),
|
|
26
|
-
groupContext: zod_1.z.object({
|
|
27
|
-
conversationId: zod_1.z.string(),
|
|
28
|
-
groupName: zod_1.z.string().nullable(),
|
|
29
|
-
}).optional(),
|
|
30
|
-
createdAt: zod_1.z.string().nullable(),
|
|
31
|
-
resolvedAt: zod_1.z.string().nullable().optional(),
|
|
32
|
-
expiresAt: zod_1.z.string().nullable().optional(),
|
|
33
|
-
});
|
|
34
4
|
function isRecord(value) {
|
|
35
5
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
36
6
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,11 +21,3 @@ __exportStar(require("./runtimeCardStorage.js"), exports);
|
|
|
21
21
|
__exportStar(require("./turnProtocol.js"), exports);
|
|
22
22
|
__exportStar(require("./agentBehaviorPolicy.js"), exports);
|
|
23
23
|
__exportStar(require("./contactRequest.js"), exports);
|
|
24
|
-
__exportStar(require("./sseEvents.js"), exports);
|
|
25
|
-
__exportStar(require("./controlSignals.js"), exports);
|
|
26
|
-
__exportStar(require("./hitl.js"), exports);
|
|
27
|
-
__exportStar(require("./inboundFrame.js"), exports);
|
|
28
|
-
__exportStar(require("./restEndpoints.js"), exports);
|
|
29
|
-
__exportStar(require("./sendContextual.js"), exports);
|
|
30
|
-
__exportStar(require("./bridgeLocal.js"), exports);
|
|
31
|
-
__exportStar(require("./endpointRegistry.js"), exports);
|
package/dist/cjs/media.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaAttachmentSchema = exports.MediaAttachmentKindSchema = void 0;
|
|
4
3
|
exports.inferMediaAttachmentKind = inferMediaAttachmentKind;
|
|
5
4
|
exports.getStoredFileExtension = getStoredFileExtension;
|
|
6
5
|
exports.normalizeStoredAttachments = normalizeStoredAttachments;
|
|
7
6
|
exports.getMessageAttachments = getMessageAttachments;
|
|
8
7
|
exports.getPrimaryAttachment = getPrimaryAttachment;
|
|
9
8
|
exports.describeAttachment = describeAttachment;
|
|
10
|
-
const zod_1 = require("zod");
|
|
11
|
-
exports.MediaAttachmentKindSchema = zod_1.z.enum(['image', 'audio', 'video', 'file']);
|
|
12
|
-
exports.MediaAttachmentSchema = zod_1.z.object({
|
|
13
|
-
kind: exports.MediaAttachmentKindSchema,
|
|
14
|
-
url: zod_1.z.string(),
|
|
15
|
-
mimeType: zod_1.z.string().optional(),
|
|
16
|
-
fileName: zod_1.z.string().optional(),
|
|
17
|
-
sizeBytes: zod_1.z.number().optional(),
|
|
18
|
-
width: zod_1.z.number().optional(),
|
|
19
|
-
height: zod_1.z.number().optional(),
|
|
20
|
-
durationMs: zod_1.z.number().optional(),
|
|
21
|
-
});
|
|
22
9
|
function inferMediaAttachmentKind(mimeType) {
|
|
23
10
|
if (mimeType.startsWith('image/'))
|
|
24
11
|
return 'image';
|
package/dist/cjs/message.js
CHANGED
|
@@ -1,72 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializeMessageInputSchema = exports.SerializedMessageSchema = exports.SerializedContactCardSchema = exports.SerializedReactionsSchema = exports.ForwardedFromSchema = exports.SerializedContentTypeSchema = exports.SerializedAgentClientTypeSchema = exports.SerializedSenderTypeSchema = void 0;
|
|
4
3
|
exports.serializeStoredMessage = serializeStoredMessage;
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
4
|
const media_js_1 = require("./media.js");
|
|
7
5
|
const runtimeCardStorage_js_1 = require("./runtimeCardStorage.js");
|
|
8
|
-
exports.SerializedSenderTypeSchema = zod_1.z.enum(['human', 'ai_agent']);
|
|
9
|
-
exports.SerializedAgentClientTypeSchema = zod_1.z.enum([
|
|
10
|
-
'claude-code',
|
|
11
|
-
'openclaw',
|
|
12
|
-
'codex',
|
|
13
|
-
'hermes',
|
|
14
|
-
'generic',
|
|
15
|
-
]);
|
|
16
|
-
exports.SerializedContentTypeSchema = zod_1.z.enum([
|
|
17
|
-
'text',
|
|
18
|
-
'image',
|
|
19
|
-
'audio',
|
|
20
|
-
'video',
|
|
21
|
-
'file',
|
|
22
|
-
'contact_card',
|
|
23
|
-
]);
|
|
24
|
-
exports.ForwardedFromSchema = zod_1.z.object({
|
|
25
|
-
sourceConversationId: zod_1.z.string(),
|
|
26
|
-
messageId: zod_1.z.string(),
|
|
27
|
-
});
|
|
28
|
-
exports.SerializedReactionsSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string()));
|
|
29
|
-
exports.SerializedContactCardSchema = zod_1.z.object({
|
|
30
|
-
userId: zod_1.z.string(),
|
|
31
|
-
canonContactId: zod_1.z.string().optional(),
|
|
32
|
-
displayName: zod_1.z.string(),
|
|
33
|
-
avatarUrl: zod_1.z.string().nullable(),
|
|
34
|
-
userType: exports.SerializedSenderTypeSchema,
|
|
35
|
-
clientType: exports.SerializedAgentClientTypeSchema.optional(),
|
|
36
|
-
about: zod_1.z.string().optional(),
|
|
37
|
-
isActive: zod_1.z.boolean().optional(),
|
|
38
|
-
ownerId: zod_1.z.string().optional(),
|
|
39
|
-
ownerName: zod_1.z.string().optional(),
|
|
40
|
-
lifecycleState: zod_1.z.string().optional(),
|
|
41
|
-
});
|
|
42
|
-
exports.SerializedMessageSchema = zod_1.z.object({
|
|
43
|
-
id: zod_1.z.string(),
|
|
44
|
-
senderId: zod_1.z.string(),
|
|
45
|
-
senderName: zod_1.z.string().optional(),
|
|
46
|
-
senderType: exports.SerializedSenderTypeSchema,
|
|
47
|
-
isOwner: zod_1.z.boolean(),
|
|
48
|
-
contentType: exports.SerializedContentTypeSchema,
|
|
49
|
-
text: zod_1.z.string().nullable(),
|
|
50
|
-
attachments: zod_1.z.array(media_js_1.MediaAttachmentSchema),
|
|
51
|
-
mentions: zod_1.z.array(zod_1.z.string()),
|
|
52
|
-
replyTo: zod_1.z.string().nullable(),
|
|
53
|
-
replyToPosition: zod_1.z.number().nullable(),
|
|
54
|
-
forwarded: zod_1.z.boolean().optional(),
|
|
55
|
-
forwardedFrom: exports.ForwardedFromSchema.optional(),
|
|
56
|
-
status: zod_1.z.enum(['sent', 'read']),
|
|
57
|
-
createdAt: zod_1.z.string(),
|
|
58
|
-
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
59
|
-
contactCard: exports.SerializedContactCardSchema.optional(),
|
|
60
|
-
/** Durable canon.card.v1 runtime card content, passed through opaquely. */
|
|
61
|
-
runtimeCard: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
62
|
-
reactions: exports.SerializedReactionsSchema.optional(),
|
|
63
|
-
});
|
|
64
|
-
exports.SerializeMessageInputSchema = zod_1.z.object({
|
|
65
|
-
id: zod_1.z.string(),
|
|
66
|
-
data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
|
|
67
|
-
senderName: zod_1.z.string().optional(),
|
|
68
|
-
isOwner: zod_1.z.boolean(),
|
|
69
|
-
});
|
|
70
6
|
function isRecord(value) {
|
|
71
7
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
72
8
|
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RUNTIME_CARD_LIMITS = void 0;
|
|
4
4
|
exports.validateRuntimeCardFieldValues = validateRuntimeCardFieldValues;
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
exports.RuntimeCardFieldTypeSchema = zod_1.z.enum([
|
|
7
|
-
'text',
|
|
8
|
-
'textarea',
|
|
9
|
-
'select',
|
|
10
|
-
'multiSelect',
|
|
11
|
-
'boolean',
|
|
12
|
-
'date',
|
|
13
|
-
'number',
|
|
14
|
-
'currency',
|
|
15
|
-
'searchSelect',
|
|
16
|
-
'lineItems',
|
|
17
|
-
]);
|
|
18
5
|
/**
|
|
19
6
|
* Caps shared across runtime-card normalizers, response validation, and
|
|
20
7
|
* authoring tools. Keep these backend-safe so Functions can import them.
|
|
@@ -25,50 +12,6 @@ exports.RUNTIME_CARD_LIMITS = {
|
|
|
25
12
|
lineItemColumns: 8,
|
|
26
13
|
searchSelectChoices: 100,
|
|
27
14
|
};
|
|
28
|
-
exports.RuntimeCardFieldChoiceSchema = zod_1.z.object({
|
|
29
|
-
label: zod_1.z.string(),
|
|
30
|
-
value: zod_1.z.string().optional(),
|
|
31
|
-
description: zod_1.z.string().optional(),
|
|
32
|
-
preview: zod_1.z.string().optional(),
|
|
33
|
-
});
|
|
34
|
-
exports.RuntimeCardLineItemColumnTypeSchema = zod_1.z.enum([
|
|
35
|
-
'text',
|
|
36
|
-
'number',
|
|
37
|
-
'currency',
|
|
38
|
-
'date',
|
|
39
|
-
'select',
|
|
40
|
-
]);
|
|
41
|
-
exports.RuntimeCardLineItemColumnSchema = zod_1.z.object({
|
|
42
|
-
id: zod_1.z.string(),
|
|
43
|
-
label: zod_1.z.string(),
|
|
44
|
-
type: exports.RuntimeCardLineItemColumnTypeSchema,
|
|
45
|
-
required: zod_1.z.boolean().optional(),
|
|
46
|
-
choices: zod_1.z.array(exports.RuntimeCardFieldChoiceSchema).optional(),
|
|
47
|
-
min: zod_1.z.number().optional(),
|
|
48
|
-
max: zod_1.z.number().optional(),
|
|
49
|
-
step: zod_1.z.number().optional(),
|
|
50
|
-
precision: zod_1.z.number().optional(),
|
|
51
|
-
currencyCode: zod_1.z.string().optional(),
|
|
52
|
-
allowOther: zod_1.z.boolean().optional(),
|
|
53
|
-
});
|
|
54
|
-
exports.RuntimeCardFieldSchema = zod_1.z.object({
|
|
55
|
-
id: zod_1.z.string(),
|
|
56
|
-
label: zod_1.z.string(),
|
|
57
|
-
type: exports.RuntimeCardFieldTypeSchema,
|
|
58
|
-
required: zod_1.z.boolean().optional(),
|
|
59
|
-
placeholder: zod_1.z.string().optional(),
|
|
60
|
-
choices: zod_1.z.array(exports.RuntimeCardFieldChoiceSchema).optional(),
|
|
61
|
-
allowOther: zod_1.z.boolean().optional(),
|
|
62
|
-
sensitive: zod_1.z.boolean().optional(),
|
|
63
|
-
min: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).optional(),
|
|
64
|
-
max: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]).optional(),
|
|
65
|
-
step: zod_1.z.number().optional(),
|
|
66
|
-
precision: zod_1.z.number().optional(),
|
|
67
|
-
currencyCode: zod_1.z.string().optional(),
|
|
68
|
-
columns: zod_1.z.array(exports.RuntimeCardLineItemColumnSchema).optional(),
|
|
69
|
-
minRows: zod_1.z.number().optional(),
|
|
70
|
-
maxRows: zod_1.z.number().optional(),
|
|
71
|
-
});
|
|
72
15
|
const ISO_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
73
16
|
function isRecord(value) {
|
|
74
17
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
package/dist/cjs/turnProtocol.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WAITING_INPUT_STALE_THRESHOLD_MS = exports.ACTIVE_TURN_STALE_THRESHOLD_MS =
|
|
3
|
+
exports.WAITING_INPUT_STALE_THRESHOLD_MS = exports.ACTIVE_TURN_STALE_THRESHOLD_MS = void 0;
|
|
4
4
|
exports.normalizeTurnMetadata = normalizeTurnMetadata;
|
|
5
5
|
exports.isTurnOpen = isTurnOpen;
|
|
6
6
|
exports.getTurnStateStaleThresholdMs = getTurnStateStaleThresholdMs;
|
|
@@ -9,46 +9,6 @@ exports.resolveTurnMessageSemantics = resolveTurnMessageSemantics;
|
|
|
9
9
|
exports.shouldPromoteConversationMessage = shouldPromoteConversationMessage;
|
|
10
10
|
exports.shouldTriggerAgentTurn = shouldTriggerAgentTurn;
|
|
11
11
|
exports.normalizeRuntimeTurnState = normalizeRuntimeTurnState;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
exports.SenderTypeSchema = zod_1.z.enum(['human', 'ai_agent']);
|
|
14
|
-
exports.TurnLifecycleStateSchema = zod_1.z.enum([
|
|
15
|
-
'idle',
|
|
16
|
-
'thinking',
|
|
17
|
-
'streaming',
|
|
18
|
-
'tool',
|
|
19
|
-
'waiting_input',
|
|
20
|
-
'completed',
|
|
21
|
-
'interrupted',
|
|
22
|
-
]);
|
|
23
|
-
exports.TurnMessageSemanticsSchema = zod_1.z.enum(['progress', 'turn_complete', 'control']);
|
|
24
|
-
exports.DeliveryIntentSchema = zod_1.z.enum(['queue', 'interrupt', 'interleave', 'stop']);
|
|
25
|
-
exports.InboundDispositionSchema = zod_1.z.enum([
|
|
26
|
-
'queued',
|
|
27
|
-
'accepted_now',
|
|
28
|
-
'interleaved',
|
|
29
|
-
'trigger_suppressed',
|
|
30
|
-
'rejected',
|
|
31
|
-
'cancelled',
|
|
32
|
-
]);
|
|
33
|
-
exports.TurnMetadataSchema = zod_1.z.object({
|
|
34
|
-
turnId: zod_1.z.string().nullable().optional(),
|
|
35
|
-
turnSemantics: exports.TurnMessageSemanticsSchema.optional(),
|
|
36
|
-
deliveryIntent: exports.DeliveryIntentSchema.optional(),
|
|
37
|
-
replyBehavior: zod_1.z.enum(['allow_auto_reply', 'suppress_auto_reply']).optional(),
|
|
38
|
-
inboundDisposition: exports.InboundDispositionSchema.optional(),
|
|
39
|
-
requestedTurnMode: zod_1.z.string().optional(),
|
|
40
|
-
});
|
|
41
|
-
exports.TriggerDecisionSchema = zod_1.z.object({
|
|
42
|
-
allow: zod_1.z.boolean(),
|
|
43
|
-
semantics: exports.TurnMessageSemanticsSchema,
|
|
44
|
-
reason: zod_1.z.string(),
|
|
45
|
-
});
|
|
46
|
-
exports.TurnStateLikeSchema = zod_1.z.object({
|
|
47
|
-
state: exports.TurnLifecycleStateSchema,
|
|
48
|
-
openedAt: zod_1.z.number().optional(),
|
|
49
|
-
updatedAt: zod_1.z.number().optional(),
|
|
50
|
-
turnUpdatedAt: zod_1.z.number().nullable().optional(),
|
|
51
|
-
});
|
|
52
12
|
exports.ACTIVE_TURN_STALE_THRESHOLD_MS = 30 * 60 * 1000;
|
|
53
13
|
exports.WAITING_INPUT_STALE_THRESHOLD_MS = 12 * 60 * 60 * 1000;
|
|
54
14
|
const TURN_SEMANTICS = [
|
package/dist/contactRequest.d.ts
CHANGED
|
@@ -1,43 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
status: z.ZodEnum<{
|
|
25
|
-
rejected: "rejected";
|
|
26
|
-
pending: "pending";
|
|
27
|
-
approved: "approved";
|
|
28
|
-
expired: "expired";
|
|
29
|
-
}>;
|
|
30
|
-
kind: z.ZodEnum<{
|
|
31
|
-
dm: "dm";
|
|
32
|
-
group_invite: "group_invite";
|
|
33
|
-
}>;
|
|
34
|
-
groupContext: z.ZodOptional<z.ZodObject<{
|
|
35
|
-
conversationId: z.ZodString;
|
|
36
|
-
groupName: z.ZodNullable<z.ZodString>;
|
|
37
|
-
}, z.core.$strip>>;
|
|
38
|
-
createdAt: z.ZodNullable<z.ZodString>;
|
|
39
|
-
resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
-
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
-
}, z.core.$strip>;
|
|
42
|
-
export type SerializedContactRequest = z.infer<typeof SerializedContactRequestSchema>;
|
|
1
|
+
export type SerializedContactRequestStatus = 'pending' | 'approved' | 'rejected' | 'expired';
|
|
2
|
+
export interface SerializedContactRequest {
|
|
3
|
+
id: string;
|
|
4
|
+
requesterId: string;
|
|
5
|
+
requesterName: string;
|
|
6
|
+
requesterAvatarUrl: string | null;
|
|
7
|
+
targetId: string;
|
|
8
|
+
targetName: string;
|
|
9
|
+
targetAvatarUrl: string | null;
|
|
10
|
+
targetUserType: 'human' | 'ai_agent';
|
|
11
|
+
targetOwnerId?: string | null;
|
|
12
|
+
approverId: string;
|
|
13
|
+
message: string | null;
|
|
14
|
+
status: SerializedContactRequestStatus;
|
|
15
|
+
kind: 'dm' | 'group_invite';
|
|
16
|
+
groupContext?: {
|
|
17
|
+
conversationId: string;
|
|
18
|
+
groupName: string | null;
|
|
19
|
+
};
|
|
20
|
+
createdAt: string | null;
|
|
21
|
+
resolvedAt?: string | null;
|
|
22
|
+
expiresAt?: string | null;
|
|
23
|
+
}
|
|
43
24
|
export declare function serializeContactRequest(requestId: string, data: Record<string, unknown>): SerializedContactRequest | null;
|
package/dist/contactRequest.js
CHANGED
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const SerializedContactRequestStatusSchema = z.enum([
|
|
3
|
-
'pending',
|
|
4
|
-
'approved',
|
|
5
|
-
'rejected',
|
|
6
|
-
'expired',
|
|
7
|
-
]);
|
|
8
|
-
export const SerializedContactRequestSchema = z.object({
|
|
9
|
-
id: z.string(),
|
|
10
|
-
requesterId: z.string(),
|
|
11
|
-
requesterName: z.string(),
|
|
12
|
-
requesterAvatarUrl: z.string().nullable(),
|
|
13
|
-
targetId: z.string(),
|
|
14
|
-
targetName: z.string(),
|
|
15
|
-
targetAvatarUrl: z.string().nullable(),
|
|
16
|
-
targetUserType: z.enum(['human', 'ai_agent']),
|
|
17
|
-
targetOwnerId: z.string().nullable().optional(),
|
|
18
|
-
approverId: z.string(),
|
|
19
|
-
message: z.string().nullable(),
|
|
20
|
-
status: SerializedContactRequestStatusSchema,
|
|
21
|
-
kind: z.enum(['dm', 'group_invite']),
|
|
22
|
-
groupContext: z.object({
|
|
23
|
-
conversationId: z.string(),
|
|
24
|
-
groupName: z.string().nullable(),
|
|
25
|
-
}).optional(),
|
|
26
|
-
createdAt: z.string().nullable(),
|
|
27
|
-
resolvedAt: z.string().nullable().optional(),
|
|
28
|
-
expiresAt: z.string().nullable().optional(),
|
|
29
|
-
});
|
|
30
1
|
function isRecord(value) {
|
|
31
2
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
32
3
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,3 @@ export * from './runtimeCardStorage.js';
|
|
|
5
5
|
export * from './turnProtocol.js';
|
|
6
6
|
export * from './agentBehaviorPolicy.js';
|
|
7
7
|
export * from './contactRequest.js';
|
|
8
|
-
export * from './sseEvents.js';
|
|
9
|
-
export * from './controlSignals.js';
|
|
10
|
-
export * from './hitl.js';
|
|
11
|
-
export * from './inboundFrame.js';
|
|
12
|
-
export * from './restEndpoints.js';
|
|
13
|
-
export * from './sendContextual.js';
|
|
14
|
-
export * from './bridgeLocal.js';
|
|
15
|
-
export * from './endpointRegistry.js';
|