@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
package/dist/sendContextual.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const SendContextualSelfContextSchema: z.ZodObject<{
|
|
3
|
-
type: z.ZodLiteral<"cross_session">;
|
|
4
|
-
context: z.ZodString;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export type SendContextualSelfContext = z.infer<typeof SendContextualSelfContextSchema>;
|
|
7
|
-
/**
|
|
8
|
-
* Request body. Exactly ONE of targetConversationId (existing conversation) or
|
|
9
|
-
* targetUserId (open/reuse a direct conversation, contact-request fallback)
|
|
10
|
-
* must be present — the refinement enforces the handler's rule.
|
|
11
|
-
*/
|
|
12
|
-
export declare const SendContextualRequestSchema: z.ZodObject<{
|
|
13
|
-
sourceConversationId: z.ZodString;
|
|
14
|
-
targetConversationId: z.ZodOptional<z.ZodString>;
|
|
15
|
-
targetUserId: z.ZodOptional<z.ZodString>;
|
|
16
|
-
text: z.ZodOptional<z.ZodString>;
|
|
17
|
-
selfContext: z.ZodObject<{
|
|
18
|
-
type: z.ZodLiteral<"cross_session">;
|
|
19
|
-
context: z.ZodString;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
sessionConfig: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
22
|
-
sessionSelection: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
23
|
-
mode: z.ZodEnum<{
|
|
24
|
-
new: "new";
|
|
25
|
-
continue_latest: "continue_latest";
|
|
26
|
-
continue_or_create: "continue_or_create";
|
|
27
|
-
}>;
|
|
28
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
29
|
-
mode: z.ZodLiteral<"specific">;
|
|
30
|
-
conversationId: z.ZodString;
|
|
31
|
-
}, z.core.$strip>]>>;
|
|
32
|
-
requestMessage: z.ZodOptional<z.ZodString>;
|
|
33
|
-
messageOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
-
}, z.core.$strip>;
|
|
35
|
-
export type SendContextualRequest = z.infer<typeof SendContextualRequestSchema>;
|
|
36
|
-
/** HTTP 201 — message persisted (or idempotent replay) with self-context linked. */
|
|
37
|
-
export declare const SendContextualMessagedResponseSchema: z.ZodObject<{
|
|
38
|
-
status: z.ZodLiteral<"messaged">;
|
|
39
|
-
messageId: z.ZodString;
|
|
40
|
-
conversationId: z.ZodString;
|
|
41
|
-
selfContextId: z.ZodString;
|
|
42
|
-
created: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
-
reused: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
-
sessionSelection: z.ZodOptional<z.ZodEnum<{
|
|
45
|
-
new: "new";
|
|
46
|
-
continue_latest: "continue_latest";
|
|
47
|
-
continue_or_create: "continue_or_create";
|
|
48
|
-
specific: "specific";
|
|
49
|
-
}>>;
|
|
50
|
-
}, z.core.$strip>;
|
|
51
|
-
export type SendContextualMessagedResponse = z.infer<typeof SendContextualMessagedResponseSchema>;
|
|
52
|
-
/**
|
|
53
|
-
* HTTP 202 — admission requires approval: a contact request was created
|
|
54
|
-
* (`requested`) or already pending (`pending`); the message is deferred as a
|
|
55
|
-
* contextual intent when a request id exists.
|
|
56
|
-
*/
|
|
57
|
-
export declare const SendContextualDeferredResponseSchema: z.ZodObject<{
|
|
58
|
-
status: z.ZodEnum<{
|
|
59
|
-
pending: "pending";
|
|
60
|
-
requested: "requested";
|
|
61
|
-
}>;
|
|
62
|
-
requestId: z.ZodNullable<z.ZodString>;
|
|
63
|
-
deferredIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
-
}, z.core.$strip>;
|
|
65
|
-
export type SendContextualDeferredResponse = z.infer<typeof SendContextualDeferredResponseSchema>;
|
|
66
|
-
/**
|
|
67
|
-
* Terminal / retryable states:
|
|
68
|
-
* - setup_required (HTTP 202) — agent session setup must complete first.
|
|
69
|
-
* - blocked (HTTP 200) — admission denied (block or policy).
|
|
70
|
-
* - unavailable (HTTP 200) — target cannot be reached right now.
|
|
71
|
-
* - no_session (HTTP 404) — session selection matched nothing.
|
|
72
|
-
*/
|
|
73
|
-
export declare const SendContextualStateResponseSchema: z.ZodObject<{
|
|
74
|
-
status: z.ZodEnum<{
|
|
75
|
-
blocked: "blocked";
|
|
76
|
-
setup_required: "setup_required";
|
|
77
|
-
unavailable: "unavailable";
|
|
78
|
-
no_session: "no_session";
|
|
79
|
-
}>;
|
|
80
|
-
reason: z.ZodString;
|
|
81
|
-
}, z.core.$strip>;
|
|
82
|
-
export type SendContextualStateResponse = z.infer<typeof SendContextualStateResponseSchema>;
|
|
83
|
-
export declare const SendContextualResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
84
|
-
status: z.ZodLiteral<"messaged">;
|
|
85
|
-
messageId: z.ZodString;
|
|
86
|
-
conversationId: z.ZodString;
|
|
87
|
-
selfContextId: z.ZodString;
|
|
88
|
-
created: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
-
reused: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
-
sessionSelection: z.ZodOptional<z.ZodEnum<{
|
|
91
|
-
new: "new";
|
|
92
|
-
continue_latest: "continue_latest";
|
|
93
|
-
continue_or_create: "continue_or_create";
|
|
94
|
-
specific: "specific";
|
|
95
|
-
}>>;
|
|
96
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
-
status: z.ZodEnum<{
|
|
98
|
-
pending: "pending";
|
|
99
|
-
requested: "requested";
|
|
100
|
-
}>;
|
|
101
|
-
requestId: z.ZodNullable<z.ZodString>;
|
|
102
|
-
deferredIntentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
-
status: z.ZodEnum<{
|
|
105
|
-
blocked: "blocked";
|
|
106
|
-
setup_required: "setup_required";
|
|
107
|
-
unavailable: "unavailable";
|
|
108
|
-
no_session: "no_session";
|
|
109
|
-
}>;
|
|
110
|
-
reason: z.ZodString;
|
|
111
|
-
}, z.core.$strip>]>;
|
|
112
|
-
export type SendContextualResponse = z.infer<typeof SendContextualResponseSchema>;
|
|
113
|
-
/** HTTP status the handler pairs with each response status. */
|
|
114
|
-
export declare const SEND_CONTEXTUAL_HTTP_STATUS: Record<SendContextualResponse['status'], number>;
|
package/dist/sendContextual.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// Wire contract v1 — POST /messages/send-contextual as a FIRST-CLASS contract
|
|
2
|
-
// (bridge-execution-plan Phase 3; owner decision 2026-07-03: the re-spec rides
|
|
3
|
-
// contract v1, the transport stays as-is and the Bridge proxies it unchanged
|
|
4
|
-
// in Phase 4).
|
|
5
|
-
//
|
|
6
|
-
// Grounded in functions/src/api/sendContextualMessage.ts (the handler's actual
|
|
7
|
-
// parse + emissions) and @canonmsg/core's SendContextualMessageOptions/Result.
|
|
8
|
-
// This mirrors CURRENT behavior — a re-spec, not a redesign.
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
import { RestSessionSelectionSchema } from './restEndpoints.js';
|
|
11
|
-
export const SendContextualSelfContextSchema = z.object({
|
|
12
|
-
type: z.literal('cross_session'),
|
|
13
|
-
/** Private agent self-context; server caps at 1000 chars. */
|
|
14
|
-
context: z.string(),
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* Request body. Exactly ONE of targetConversationId (existing conversation) or
|
|
18
|
-
* targetUserId (open/reuse a direct conversation, contact-request fallback)
|
|
19
|
-
* must be present — the refinement enforces the handler's rule.
|
|
20
|
-
*/
|
|
21
|
-
export const SendContextualRequestSchema = z.object({
|
|
22
|
-
sourceConversationId: z.string(),
|
|
23
|
-
/** Target arm 1: send into an existing conversation. */
|
|
24
|
-
targetConversationId: z.string().optional(),
|
|
25
|
-
/** Target arm 2: resolve/create a direct conversation with this user. */
|
|
26
|
-
targetUserId: z.string().optional(),
|
|
27
|
-
text: z.string().optional(),
|
|
28
|
-
selfContext: SendContextualSelfContextSchema,
|
|
29
|
-
/** Initial agent session config (agent targets) — opaque pass-through. */
|
|
30
|
-
sessionConfig: z.record(z.string(), z.unknown()).nullable().optional(),
|
|
31
|
-
sessionSelection: RestSessionSelectionSchema.optional(),
|
|
32
|
-
/** Contact-request message when admission requires approval. */
|
|
33
|
-
requestMessage: z.string().optional(),
|
|
34
|
-
/**
|
|
35
|
-
* SendMessageOptions passthrough (attachments, replyTo, metadata, …).
|
|
36
|
-
* May NOT carry selfContextId/selfContext — the handler rejects overrides
|
|
37
|
-
* of the self-context linkage fields.
|
|
38
|
-
*/
|
|
39
|
-
messageOptions: z.record(z.string(), z.unknown()).optional(),
|
|
40
|
-
}).refine((body) => (body.targetConversationId ? 1 : 0) + (body.targetUserId ? 1 : 0) === 1, { message: 'Provide exactly one targetConversationId or targetUserId' }).refine((body) => !body.messageOptions
|
|
41
|
-
|| (!('selfContextId' in body.messageOptions) && !('selfContext' in body.messageOptions)), { message: 'messageOptions may not override self-context linkage fields' });
|
|
42
|
-
// ── Response arms (exactly what the handler emits today) ───────────────
|
|
43
|
-
/** HTTP 201 — message persisted (or idempotent replay) with self-context linked. */
|
|
44
|
-
export const SendContextualMessagedResponseSchema = z.object({
|
|
45
|
-
status: z.literal('messaged'),
|
|
46
|
-
messageId: z.string(),
|
|
47
|
-
conversationId: z.string(),
|
|
48
|
-
selfContextId: z.string(),
|
|
49
|
-
/** Present when the target conversation was opened by this call. */
|
|
50
|
-
created: z.boolean().optional(),
|
|
51
|
-
reused: z.boolean().optional(),
|
|
52
|
-
sessionSelection: z.enum(['new', 'continue_latest', 'continue_or_create', 'specific']).optional(),
|
|
53
|
-
});
|
|
54
|
-
/**
|
|
55
|
-
* HTTP 202 — admission requires approval: a contact request was created
|
|
56
|
-
* (`requested`) or already pending (`pending`); the message is deferred as a
|
|
57
|
-
* contextual intent when a request id exists.
|
|
58
|
-
*/
|
|
59
|
-
export const SendContextualDeferredResponseSchema = z.object({
|
|
60
|
-
status: z.enum(['requested', 'pending']),
|
|
61
|
-
requestId: z.string().nullable(),
|
|
62
|
-
deferredIntentId: z.string().nullable().optional(),
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Terminal / retryable states:
|
|
66
|
-
* - setup_required (HTTP 202) — agent session setup must complete first.
|
|
67
|
-
* - blocked (HTTP 200) — admission denied (block or policy).
|
|
68
|
-
* - unavailable (HTTP 200) — target cannot be reached right now.
|
|
69
|
-
* - no_session (HTTP 404) — session selection matched nothing.
|
|
70
|
-
*/
|
|
71
|
-
export const SendContextualStateResponseSchema = z.object({
|
|
72
|
-
status: z.enum(['setup_required', 'blocked', 'unavailable', 'no_session']),
|
|
73
|
-
reason: z.string(),
|
|
74
|
-
});
|
|
75
|
-
export const SendContextualResponseSchema = z.union([
|
|
76
|
-
SendContextualMessagedResponseSchema,
|
|
77
|
-
SendContextualDeferredResponseSchema,
|
|
78
|
-
SendContextualStateResponseSchema,
|
|
79
|
-
]);
|
|
80
|
-
/** HTTP status the handler pairs with each response status. */
|
|
81
|
-
export const SEND_CONTEXTUAL_HTTP_STATUS = {
|
|
82
|
-
messaged: 201,
|
|
83
|
-
requested: 202,
|
|
84
|
-
pending: 202,
|
|
85
|
-
setup_required: 202,
|
|
86
|
-
blocked: 200,
|
|
87
|
-
unavailable: 200,
|
|
88
|
-
no_session: 404,
|
|
89
|
-
};
|
package/dist/sseEvents.d.ts
DELETED
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const SseAccessPolicySchema: z.ZodEnum<{
|
|
3
|
-
open: "open";
|
|
4
|
-
"approval-required": "approval-required";
|
|
5
|
-
"owner-only": "owner-only";
|
|
6
|
-
}>;
|
|
7
|
-
export type SseAccessPolicy = z.infer<typeof SseAccessPolicySchema>;
|
|
8
|
-
export declare const SseConnectedPayloadSchema: z.ZodObject<{
|
|
9
|
-
connectionId: z.ZodString;
|
|
10
|
-
agentId: z.ZodString;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
export type SseConnectedPayload = z.infer<typeof SseConnectedPayloadSchema>;
|
|
13
|
-
/** Trusted, server-injected identity & access info (stream.ts `agent.context`). */
|
|
14
|
-
export declare const SseAgentContextPayloadSchema: z.ZodObject<{
|
|
15
|
-
agentId: z.ZodString;
|
|
16
|
-
canonContactId: z.ZodOptional<z.ZodString>;
|
|
17
|
-
clientType: z.ZodOptional<z.ZodString>;
|
|
18
|
-
ownerId: z.ZodString;
|
|
19
|
-
ownerName: z.ZodString;
|
|
20
|
-
defaultBehavior: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
|
-
inboundPolicy: z.ZodEnum<{
|
|
22
|
-
open: "open";
|
|
23
|
-
"approval-required": "approval-required";
|
|
24
|
-
"owner-only": "owner-only";
|
|
25
|
-
}>;
|
|
26
|
-
groupJoinPolicy: z.ZodEnum<{
|
|
27
|
-
open: "open";
|
|
28
|
-
"approval-required": "approval-required";
|
|
29
|
-
"owner-only": "owner-only";
|
|
30
|
-
}>;
|
|
31
|
-
discoverable: z.ZodBoolean;
|
|
32
|
-
}, z.core.$loose>;
|
|
33
|
-
export type SseAgentContextPayload = z.infer<typeof SseAgentContextPayloadSchema>;
|
|
34
|
-
export declare const SseHeartbeatPayloadSchema: z.ZodObject<{
|
|
35
|
-
timestamp: z.ZodString;
|
|
36
|
-
}, z.core.$strip>;
|
|
37
|
-
export type SseHeartbeatPayload = z.infer<typeof SseHeartbeatPayloadSchema>;
|
|
38
|
-
export declare const SseReplayExpiredPayloadSchema: z.ZodObject<{
|
|
39
|
-
lastAvailableId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
-
message: z.ZodOptional<z.ZodString>;
|
|
41
|
-
}, z.core.$loose>;
|
|
42
|
-
export type SseReplayExpiredPayload = z.infer<typeof SseReplayExpiredPayloadSchema>;
|
|
43
|
-
export declare const SseErrorPayloadSchema: z.ZodObject<{
|
|
44
|
-
code: z.ZodOptional<z.ZodString>;
|
|
45
|
-
message: z.ZodOptional<z.ZodString>;
|
|
46
|
-
retryAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
47
|
-
activeConnections: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
maxConnections: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
}, z.core.$loose>;
|
|
50
|
-
export type SseErrorPayload = z.infer<typeof SseErrorPayloadSchema>;
|
|
51
|
-
export declare const SseSelfContextSchema: z.ZodObject<{
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
type: z.ZodLiteral<"cross_session">;
|
|
54
|
-
context: z.ZodString;
|
|
55
|
-
createdAt: z.ZodNullable<z.ZodString>;
|
|
56
|
-
updatedAt: z.ZodNullable<z.ZodString>;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
export type SseSelfContext = z.infer<typeof SseSelfContextSchema>;
|
|
59
|
-
export declare const SseTurnDispatchSchema: z.ZodObject<{
|
|
60
|
-
kind: z.ZodEnum<{
|
|
61
|
-
run_turn: "run_turn";
|
|
62
|
-
observe_only: "observe_only";
|
|
63
|
-
}>;
|
|
64
|
-
reason: z.ZodString;
|
|
65
|
-
addressed: z.ZodBoolean;
|
|
66
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$loose>;
|
|
68
|
-
export type SseTurnDispatch = z.infer<typeof SseTurnDispatchSchema>;
|
|
69
|
-
export declare const SseProvenanceSchema: z.ZodObject<{
|
|
70
|
-
conversation: z.ZodObject<{
|
|
71
|
-
id: z.ZodString;
|
|
72
|
-
type: z.ZodEnum<{
|
|
73
|
-
unknown: "unknown";
|
|
74
|
-
direct: "direct";
|
|
75
|
-
group: "group";
|
|
76
|
-
}>;
|
|
77
|
-
}, z.core.$loose>;
|
|
78
|
-
sender: z.ZodObject<{
|
|
79
|
-
id: z.ZodString;
|
|
80
|
-
name: z.ZodOptional<z.ZodString>;
|
|
81
|
-
type: z.ZodEnum<{
|
|
82
|
-
human: "human";
|
|
83
|
-
ai_agent: "ai_agent";
|
|
84
|
-
}>;
|
|
85
|
-
isOwner: z.ZodBoolean;
|
|
86
|
-
}, z.core.$loose>;
|
|
87
|
-
mentionedAgent: z.ZodBoolean;
|
|
88
|
-
}, z.core.$loose>;
|
|
89
|
-
export type SseProvenance = z.infer<typeof SseProvenanceSchema>;
|
|
90
|
-
/**
|
|
91
|
-
* `message.created` — the inbound message envelope. `message` is exactly the
|
|
92
|
-
* SerializedMessage the shared serializer emits (the E2EE S1 slot).
|
|
93
|
-
*/
|
|
94
|
-
export declare const SseMessageCreatedPayloadSchema: z.ZodObject<{
|
|
95
|
-
conversationId: z.ZodString;
|
|
96
|
-
behavior: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
97
|
-
activeSelfContextId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
-
selfContexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
99
|
-
id: z.ZodString;
|
|
100
|
-
type: z.ZodLiteral<"cross_session">;
|
|
101
|
-
context: z.ZodString;
|
|
102
|
-
createdAt: z.ZodNullable<z.ZodString>;
|
|
103
|
-
updatedAt: z.ZodNullable<z.ZodString>;
|
|
104
|
-
}, z.core.$strip>>>;
|
|
105
|
-
provenance: z.ZodOptional<z.ZodObject<{
|
|
106
|
-
conversation: z.ZodObject<{
|
|
107
|
-
id: z.ZodString;
|
|
108
|
-
type: z.ZodEnum<{
|
|
109
|
-
unknown: "unknown";
|
|
110
|
-
direct: "direct";
|
|
111
|
-
group: "group";
|
|
112
|
-
}>;
|
|
113
|
-
}, z.core.$loose>;
|
|
114
|
-
sender: z.ZodObject<{
|
|
115
|
-
id: z.ZodString;
|
|
116
|
-
name: z.ZodOptional<z.ZodString>;
|
|
117
|
-
type: z.ZodEnum<{
|
|
118
|
-
human: "human";
|
|
119
|
-
ai_agent: "ai_agent";
|
|
120
|
-
}>;
|
|
121
|
-
isOwner: z.ZodBoolean;
|
|
122
|
-
}, z.core.$loose>;
|
|
123
|
-
mentionedAgent: z.ZodBoolean;
|
|
124
|
-
}, z.core.$loose>>;
|
|
125
|
-
turnDispatch: z.ZodOptional<z.ZodObject<{
|
|
126
|
-
kind: z.ZodEnum<{
|
|
127
|
-
run_turn: "run_turn";
|
|
128
|
-
observe_only: "observe_only";
|
|
129
|
-
}>;
|
|
130
|
-
reason: z.ZodString;
|
|
131
|
-
addressed: z.ZodBoolean;
|
|
132
|
-
policyVersion: z.ZodOptional<z.ZodString>;
|
|
133
|
-
}, z.core.$loose>>;
|
|
134
|
-
message: z.ZodObject<{
|
|
135
|
-
id: z.ZodString;
|
|
136
|
-
senderId: z.ZodString;
|
|
137
|
-
senderName: z.ZodOptional<z.ZodString>;
|
|
138
|
-
senderType: z.ZodEnum<{
|
|
139
|
-
human: "human";
|
|
140
|
-
ai_agent: "ai_agent";
|
|
141
|
-
}>;
|
|
142
|
-
isOwner: z.ZodBoolean;
|
|
143
|
-
contentType: z.ZodEnum<{
|
|
144
|
-
file: "file";
|
|
145
|
-
image: "image";
|
|
146
|
-
audio: "audio";
|
|
147
|
-
video: "video";
|
|
148
|
-
text: "text";
|
|
149
|
-
contact_card: "contact_card";
|
|
150
|
-
}>;
|
|
151
|
-
text: z.ZodNullable<z.ZodString>;
|
|
152
|
-
attachments: z.ZodArray<z.ZodObject<{
|
|
153
|
-
kind: z.ZodEnum<{
|
|
154
|
-
file: "file";
|
|
155
|
-
image: "image";
|
|
156
|
-
audio: "audio";
|
|
157
|
-
video: "video";
|
|
158
|
-
}>;
|
|
159
|
-
url: z.ZodString;
|
|
160
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
161
|
-
fileName: z.ZodOptional<z.ZodString>;
|
|
162
|
-
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
163
|
-
width: z.ZodOptional<z.ZodNumber>;
|
|
164
|
-
height: z.ZodOptional<z.ZodNumber>;
|
|
165
|
-
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
166
|
-
}, z.core.$strip>>;
|
|
167
|
-
mentions: z.ZodArray<z.ZodString>;
|
|
168
|
-
replyTo: z.ZodNullable<z.ZodString>;
|
|
169
|
-
replyToPosition: z.ZodNullable<z.ZodNumber>;
|
|
170
|
-
forwarded: z.ZodOptional<z.ZodBoolean>;
|
|
171
|
-
forwardedFrom: z.ZodOptional<z.ZodObject<{
|
|
172
|
-
sourceConversationId: z.ZodString;
|
|
173
|
-
messageId: z.ZodString;
|
|
174
|
-
}, z.core.$strip>>;
|
|
175
|
-
status: z.ZodEnum<{
|
|
176
|
-
sent: "sent";
|
|
177
|
-
read: "read";
|
|
178
|
-
}>;
|
|
179
|
-
createdAt: z.ZodString;
|
|
180
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
181
|
-
contactCard: z.ZodOptional<z.ZodObject<{
|
|
182
|
-
userId: z.ZodString;
|
|
183
|
-
canonContactId: z.ZodOptional<z.ZodString>;
|
|
184
|
-
displayName: z.ZodString;
|
|
185
|
-
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
186
|
-
userType: z.ZodEnum<{
|
|
187
|
-
human: "human";
|
|
188
|
-
ai_agent: "ai_agent";
|
|
189
|
-
}>;
|
|
190
|
-
clientType: z.ZodOptional<z.ZodEnum<{
|
|
191
|
-
"claude-code": "claude-code";
|
|
192
|
-
openclaw: "openclaw";
|
|
193
|
-
codex: "codex";
|
|
194
|
-
hermes: "hermes";
|
|
195
|
-
generic: "generic";
|
|
196
|
-
}>>;
|
|
197
|
-
about: z.ZodOptional<z.ZodString>;
|
|
198
|
-
isActive: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
-
ownerId: z.ZodOptional<z.ZodString>;
|
|
200
|
-
ownerName: z.ZodOptional<z.ZodString>;
|
|
201
|
-
lifecycleState: z.ZodOptional<z.ZodString>;
|
|
202
|
-
}, z.core.$strip>>;
|
|
203
|
-
runtimeCard: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
204
|
-
reactions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
205
|
-
}, z.core.$strip>;
|
|
206
|
-
}, z.core.$loose>;
|
|
207
|
-
export type SseMessageCreatedPayload = z.infer<typeof SseMessageCreatedPayloadSchema>;
|
|
208
|
-
export declare const SseMessageUpdatedPayloadSchema: z.ZodObject<{
|
|
209
|
-
conversationId: z.ZodString;
|
|
210
|
-
messageId: z.ZodString;
|
|
211
|
-
actorId: z.ZodOptional<z.ZodString>;
|
|
212
|
-
updatedAt: z.ZodOptional<z.ZodString>;
|
|
213
|
-
changes: z.ZodObject<{
|
|
214
|
-
reactions: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
215
|
-
}, z.core.$loose>;
|
|
216
|
-
}, z.core.$strip>;
|
|
217
|
-
export type SseMessageUpdatedPayload = z.infer<typeof SseMessageUpdatedPayloadSchema>;
|
|
218
|
-
export declare const SseMessageDeletedPayloadSchema: z.ZodObject<{
|
|
219
|
-
conversationId: z.ZodString;
|
|
220
|
-
messageId: z.ZodString;
|
|
221
|
-
}, z.core.$strip>;
|
|
222
|
-
export type SseMessageDeletedPayload = z.infer<typeof SseMessageDeletedPayloadSchema>;
|
|
223
|
-
export declare const SseMembershipChangeSchema: z.ZodObject<{
|
|
224
|
-
addedMemberIds: z.ZodArray<z.ZodString>;
|
|
225
|
-
removedMemberIds: z.ZodArray<z.ZodString>;
|
|
226
|
-
memberCount: z.ZodNumber;
|
|
227
|
-
}, z.core.$strip>;
|
|
228
|
-
export type SseMembershipChange = z.infer<typeof SseMembershipChangeSchema>;
|
|
229
|
-
export declare const SseConversationUpdatedPayloadSchema: z.ZodObject<{
|
|
230
|
-
conversationId: z.ZodString;
|
|
231
|
-
changes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
232
|
-
membershipChange: z.ZodOptional<z.ZodObject<{
|
|
233
|
-
addedMemberIds: z.ZodArray<z.ZodString>;
|
|
234
|
-
removedMemberIds: z.ZodArray<z.ZodString>;
|
|
235
|
-
memberCount: z.ZodNumber;
|
|
236
|
-
}, z.core.$strip>>;
|
|
237
|
-
}, z.core.$strip>;
|
|
238
|
-
export type SseConversationUpdatedPayload = z.infer<typeof SseConversationUpdatedPayloadSchema>;
|
|
239
|
-
/** `contact.request` / `contact.approved` carry the serialized contact request. */
|
|
240
|
-
export declare const SseContactRequestPayloadSchema: z.ZodObject<{
|
|
241
|
-
id: z.ZodString;
|
|
242
|
-
requesterId: z.ZodString;
|
|
243
|
-
requesterName: z.ZodString;
|
|
244
|
-
requesterAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
245
|
-
targetId: z.ZodString;
|
|
246
|
-
targetName: z.ZodString;
|
|
247
|
-
targetAvatarUrl: z.ZodNullable<z.ZodString>;
|
|
248
|
-
targetUserType: z.ZodEnum<{
|
|
249
|
-
human: "human";
|
|
250
|
-
ai_agent: "ai_agent";
|
|
251
|
-
}>;
|
|
252
|
-
targetOwnerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
253
|
-
approverId: z.ZodString;
|
|
254
|
-
message: z.ZodNullable<z.ZodString>;
|
|
255
|
-
status: z.ZodEnum<{
|
|
256
|
-
rejected: "rejected";
|
|
257
|
-
pending: "pending";
|
|
258
|
-
approved: "approved";
|
|
259
|
-
expired: "expired";
|
|
260
|
-
}>;
|
|
261
|
-
kind: z.ZodEnum<{
|
|
262
|
-
dm: "dm";
|
|
263
|
-
group_invite: "group_invite";
|
|
264
|
-
}>;
|
|
265
|
-
groupContext: z.ZodOptional<z.ZodObject<{
|
|
266
|
-
conversationId: z.ZodString;
|
|
267
|
-
groupName: z.ZodNullable<z.ZodString>;
|
|
268
|
-
}, z.core.$strip>>;
|
|
269
|
-
createdAt: z.ZodNullable<z.ZodString>;
|
|
270
|
-
resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
271
|
-
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
272
|
-
}, z.core.$strip>;
|
|
273
|
-
export type SseContactRequestPayload = z.infer<typeof SseContactRequestPayloadSchema>;
|
|
274
|
-
/**
|
|
275
|
-
* `contact.added` / `contact.updated`. `source` is a pass-through string —
|
|
276
|
-
* canonical values today: direct_add, phone_book, contact_request, link, qr,
|
|
277
|
-
* group, open_inbound_message, unknown.
|
|
278
|
-
*/
|
|
279
|
-
export declare const SseContactPayloadSchema: z.ZodObject<{
|
|
280
|
-
id: z.ZodString;
|
|
281
|
-
source: z.ZodString;
|
|
282
|
-
addedAt: z.ZodNullable<z.ZodString>;
|
|
283
|
-
displayNameOverride: z.ZodNullable<z.ZodString>;
|
|
284
|
-
}, z.core.$strip>;
|
|
285
|
-
export type SseContactPayload = z.infer<typeof SseContactPayloadSchema>;
|
|
286
|
-
export declare const SseContactRemovedPayloadSchema: z.ZodObject<{
|
|
287
|
-
id: z.ZodString;
|
|
288
|
-
}, z.core.$strip>;
|
|
289
|
-
export type SseContactRemovedPayload = z.infer<typeof SseContactRemovedPayloadSchema>;
|
|
290
|
-
export declare const SseTypingPayloadSchema: z.ZodObject<{
|
|
291
|
-
conversationId: z.ZodString;
|
|
292
|
-
userId: z.ZodString;
|
|
293
|
-
isTyping: z.ZodBoolean;
|
|
294
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
295
|
-
thinking: "thinking";
|
|
296
|
-
typing: "typing";
|
|
297
|
-
}>>;
|
|
298
|
-
timestamp: z.ZodOptional<z.ZodNumber>;
|
|
299
|
-
}, z.core.$strip>;
|
|
300
|
-
export type SseTypingPayload = z.infer<typeof SseTypingPayloadSchema>;
|
|
301
|
-
export declare const SsePresencePayloadSchema: z.ZodObject<{
|
|
302
|
-
userId: z.ZodString;
|
|
303
|
-
online: z.ZodBoolean;
|
|
304
|
-
lastSeen: z.ZodOptional<z.ZodString>;
|
|
305
|
-
}, z.core.$strip>;
|
|
306
|
-
export type SsePresencePayload = z.infer<typeof SsePresencePayloadSchema>;
|
|
307
|
-
export declare const SseRuntimeControlKindSchema: z.ZodEnum<{
|
|
308
|
-
session: "session";
|
|
309
|
-
signal: "signal";
|
|
310
|
-
primitive: "primitive";
|
|
311
|
-
runtimeCard: "runtimeCard";
|
|
312
|
-
runtimeInput: "runtimeInput";
|
|
313
|
-
runtimeApproval: "runtimeApproval";
|
|
314
|
-
}>;
|
|
315
|
-
export type SseRuntimeControlKind = z.infer<typeof SseRuntimeControlKindSchema>;
|
|
316
|
-
export declare const SseRuntimeControlPayloadSchema: z.ZodObject<{
|
|
317
|
-
conversationId: z.ZodString;
|
|
318
|
-
agentId: z.ZodString;
|
|
319
|
-
kind: z.ZodEnum<{
|
|
320
|
-
session: "session";
|
|
321
|
-
signal: "signal";
|
|
322
|
-
primitive: "primitive";
|
|
323
|
-
runtimeCard: "runtimeCard";
|
|
324
|
-
runtimeInput: "runtimeInput";
|
|
325
|
-
runtimeApproval: "runtimeApproval";
|
|
326
|
-
}>;
|
|
327
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
328
|
-
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
329
|
-
value: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
330
|
-
}, z.core.$strip>;
|
|
331
|
-
export type SseRuntimeControlPayload = z.infer<typeof SseRuntimeControlPayloadSchema>;
|
|
332
|
-
export declare const SseVoiceSessionSchema: z.ZodObject<{
|
|
333
|
-
id: z.ZodString;
|
|
334
|
-
conversationId: z.ZodString;
|
|
335
|
-
roomName: z.ZodString;
|
|
336
|
-
mode: z.ZodEnum<{
|
|
337
|
-
human: "human";
|
|
338
|
-
runtime_voice: "runtime_voice";
|
|
339
|
-
}>;
|
|
340
|
-
status: z.ZodEnum<{
|
|
341
|
-
error: "error";
|
|
342
|
-
active: "active";
|
|
343
|
-
ended: "ended";
|
|
344
|
-
}>;
|
|
345
|
-
createdBy: z.ZodString;
|
|
346
|
-
participantIds: z.ZodArray<z.ZodString>;
|
|
347
|
-
participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
348
|
-
userId: z.ZodString;
|
|
349
|
-
userType: z.ZodEnum<{
|
|
350
|
-
human: "human";
|
|
351
|
-
ai_agent: "ai_agent";
|
|
352
|
-
system: "system";
|
|
353
|
-
}>;
|
|
354
|
-
displayName: z.ZodNullable<z.ZodString>;
|
|
355
|
-
joinedAt: z.ZodNullable<z.ZodString>;
|
|
356
|
-
leftAt: z.ZodNullable<z.ZodString>;
|
|
357
|
-
}, z.core.$loose>>>;
|
|
358
|
-
targetAgentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
359
|
-
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
360
|
-
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
361
|
-
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
362
|
-
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
363
|
-
}, z.core.$loose>;
|
|
364
|
-
export type SseVoiceSession = z.infer<typeof SseVoiceSessionSchema>;
|
|
365
|
-
export declare const SseVoiceSessionEventPayloadSchema: z.ZodObject<{
|
|
366
|
-
conversationId: z.ZodString;
|
|
367
|
-
session: z.ZodObject<{
|
|
368
|
-
id: z.ZodString;
|
|
369
|
-
conversationId: z.ZodString;
|
|
370
|
-
roomName: z.ZodString;
|
|
371
|
-
mode: z.ZodEnum<{
|
|
372
|
-
human: "human";
|
|
373
|
-
runtime_voice: "runtime_voice";
|
|
374
|
-
}>;
|
|
375
|
-
status: z.ZodEnum<{
|
|
376
|
-
error: "error";
|
|
377
|
-
active: "active";
|
|
378
|
-
ended: "ended";
|
|
379
|
-
}>;
|
|
380
|
-
createdBy: z.ZodString;
|
|
381
|
-
participantIds: z.ZodArray<z.ZodString>;
|
|
382
|
-
participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
383
|
-
userId: z.ZodString;
|
|
384
|
-
userType: z.ZodEnum<{
|
|
385
|
-
human: "human";
|
|
386
|
-
ai_agent: "ai_agent";
|
|
387
|
-
system: "system";
|
|
388
|
-
}>;
|
|
389
|
-
displayName: z.ZodNullable<z.ZodString>;
|
|
390
|
-
joinedAt: z.ZodNullable<z.ZodString>;
|
|
391
|
-
leftAt: z.ZodNullable<z.ZodString>;
|
|
392
|
-
}, z.core.$loose>>>;
|
|
393
|
-
targetAgentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
394
|
-
createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
395
|
-
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
396
|
-
endedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
397
|
-
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
398
|
-
}, z.core.$loose>;
|
|
399
|
-
}, z.core.$strip>;
|
|
400
|
-
export type SseVoiceSessionEventPayload = z.infer<typeof SseVoiceSessionEventPayloadSchema>;
|
|
401
|
-
/**
|
|
402
|
-
* Every SSE `event:` name stream-service emits today (stream.ts + listeners.ts;
|
|
403
|
-
* mirrored by CanonStream's dispatch switch in core). NOTE: `contact.updated`
|
|
404
|
-
* is emitted by stream-service but not yet consumed by CanonStream.
|
|
405
|
-
*/
|
|
406
|
-
export declare const SSE_EVENT_TYPES: readonly ["connected", "agent.context", "heartbeat", "message.created", "message.updated", "message.deleted", "conversation.updated", "contact.request", "contact.approved", "contact.added", "contact.updated", "contact.removed", "typing", "presence", "runtime.control", "voice.session.started", "voice.session.ended", "replay.expired", "error"];
|
|
407
|
-
export declare const SseEventTypeSchema: z.ZodEnum<{
|
|
408
|
-
typing: "typing";
|
|
409
|
-
error: "error";
|
|
410
|
-
connected: "connected";
|
|
411
|
-
"agent.context": "agent.context";
|
|
412
|
-
heartbeat: "heartbeat";
|
|
413
|
-
"message.created": "message.created";
|
|
414
|
-
"message.updated": "message.updated";
|
|
415
|
-
"message.deleted": "message.deleted";
|
|
416
|
-
"conversation.updated": "conversation.updated";
|
|
417
|
-
"contact.request": "contact.request";
|
|
418
|
-
"contact.approved": "contact.approved";
|
|
419
|
-
"contact.added": "contact.added";
|
|
420
|
-
"contact.updated": "contact.updated";
|
|
421
|
-
"contact.removed": "contact.removed";
|
|
422
|
-
presence: "presence";
|
|
423
|
-
"runtime.control": "runtime.control";
|
|
424
|
-
"voice.session.started": "voice.session.started";
|
|
425
|
-
"voice.session.ended": "voice.session.ended";
|
|
426
|
-
"replay.expired": "replay.expired";
|
|
427
|
-
}>;
|
|
428
|
-
export type SseEventType = z.infer<typeof SseEventTypeSchema>;
|
|
429
|
-
/** Payload schema for every event type — the machine-readable event registry. */
|
|
430
|
-
export declare const SSE_EVENT_PAYLOAD_SCHEMAS: Record<SseEventType, z.ZodType>;
|
|
431
|
-
/**
|
|
432
|
-
* Subscription families (`?events=` filter). Lifecycle events (`connected`,
|
|
433
|
-
* `agent.context`, `heartbeat`, `replay.expired`, `error`) are always sent.
|
|
434
|
-
*/
|
|
435
|
-
export declare const SSE_EVENT_FAMILIES: readonly ["messages", "contacts", "typing_presence", "runtime_turn", "voice"];
|
|
436
|
-
export declare const SseEventFamilySchema: z.ZodEnum<{
|
|
437
|
-
messages: "messages";
|
|
438
|
-
contacts: "contacts";
|
|
439
|
-
typing_presence: "typing_presence";
|
|
440
|
-
runtime_turn: "runtime_turn";
|
|
441
|
-
voice: "voice";
|
|
442
|
-
}>;
|
|
443
|
-
export type SseEventFamily = z.infer<typeof SseEventFamilySchema>;
|
|
444
|
-
export declare const SSE_EVENT_FAMILY_BY_TYPE: Record<SseEventType, SseEventFamily | 'lifecycle'>;
|
|
445
|
-
/**
|
|
446
|
-
* A parsed SSE frame: `id:` (replay cursor), `event:`, and the JSON-decoded
|
|
447
|
-
* `data:` payload. Validate `data` with SSE_EVENT_PAYLOAD_SCHEMAS[event].
|
|
448
|
-
*/
|
|
449
|
-
export declare const SseEventEnvelopeSchema: z.ZodObject<{
|
|
450
|
-
id: z.ZodOptional<z.ZodString>;
|
|
451
|
-
event: z.ZodEnum<{
|
|
452
|
-
typing: "typing";
|
|
453
|
-
error: "error";
|
|
454
|
-
connected: "connected";
|
|
455
|
-
"agent.context": "agent.context";
|
|
456
|
-
heartbeat: "heartbeat";
|
|
457
|
-
"message.created": "message.created";
|
|
458
|
-
"message.updated": "message.updated";
|
|
459
|
-
"message.deleted": "message.deleted";
|
|
460
|
-
"conversation.updated": "conversation.updated";
|
|
461
|
-
"contact.request": "contact.request";
|
|
462
|
-
"contact.approved": "contact.approved";
|
|
463
|
-
"contact.added": "contact.added";
|
|
464
|
-
"contact.updated": "contact.updated";
|
|
465
|
-
"contact.removed": "contact.removed";
|
|
466
|
-
presence: "presence";
|
|
467
|
-
"runtime.control": "runtime.control";
|
|
468
|
-
"voice.session.started": "voice.session.started";
|
|
469
|
-
"voice.session.ended": "voice.session.ended";
|
|
470
|
-
"replay.expired": "replay.expired";
|
|
471
|
-
}>;
|
|
472
|
-
data: z.ZodUnknown;
|
|
473
|
-
}, z.core.$strip>;
|
|
474
|
-
export type SseEventEnvelope = z.infer<typeof SseEventEnvelopeSchema>;
|