-
Notifications
You must be signed in to change notification settings - Fork 561
Expand file tree
/
Copy pathchatSend.ts
More file actions
173 lines (170 loc) · 6.16 KB
/
Copy pathchatSend.ts
File metadata and controls
173 lines (170 loc) · 6.16 KB
1
2
3
4
5
6
7
8
9
10
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// @generated by scripts/contracts/generate_gateway_contracts.py; do not edit.
// source-sha256: eeba035e6c29d2269ca3d9fa332b1805b2417de7497148a5bbff4525f36a34ed
// generator-sha256: a4d9386a5dc58a59682c72a551d23aac995b95619a0d504abec20ef047671e00
/**
* v4 ReqFrame.params remains Any; malformed non-object values are forwarded so the existing handler preserves its validation/error behavior.
*
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendLegacyNonObjectParams".
*/
export type ChatSendLegacyNonObjectParams = unknown[] | string | number | boolean;
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendResponseFrame".
*/
export type ChatSendResponseFrame = ChatSendOkResponseFrame | ChatSendErrorResponseFrame;
/**
* Language-neutral Contract for the v4 chat.send command. The schema documents the stable ingress fields while retaining open additive fields and legacy aliases. Generated wire types are adapter-only.
*/
export interface OpenSquillaChatSendContract {
request?: ChatSendRequestFrame;
response?: ChatSendResponseFrame;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendRequestFrame".
*/
export interface ChatSendRequestFrame {
type: "req";
id: string;
method: "chat.send";
params?: ChatSendParams | ChatSendLegacyNonObjectParams | null;
}
/**
* Stable chat ingress fields. The Gateway continues to accept snake/camel aliases and additive implementation-specific fields.
*
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendParams".
*/
export interface ChatSendParams {
message: string;
sessionKey?: string;
session_key?: string;
key?: string;
clientRequestId?: string | null;
client_request_id?: string | null;
clientMessageId?: string | null;
client_message_id?: string | null;
promptAnnotationIds?: string[] | null;
prompt_annotation_ids?: string[] | null;
documentContext?: {
[k: string]: unknown;
} | null;
document_context?: {
[k: string]: unknown;
} | null;
_source?: ChatSendSource | null;
intent?: string | null;
workspaceId?: string | null;
workspace_id?: string | null;
collaborationMode?: string | null;
collaboration_mode?: string | null;
initialRoutingMode?: string | null;
initial_routing_mode?: string | null;
forkBeforeMessageId?: string | null;
fork_before_message_id?: string | null;
displayText?: string | null;
display_text?: string | null;
attachments?: ChatSendAttachment[] | null;
[k: string]: unknown;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendSource".
*/
export interface ChatSendSource {
elevated?: string | null;
runMode?: string | null;
run_mode?: string | null;
noMemoryCapture?: boolean | null;
no_memory_capture?: boolean | null;
[k: string]: unknown;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendAttachment".
*/
export interface ChatSendAttachment {
type?: string;
mime?: string;
mime_type?: string;
name?: string;
filename?: string;
data?: string | null;
file_uuid?: string | null;
size?: number | null;
[k: string]: unknown;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendOkResponseFrame".
*/
export interface ChatSendOkResponseFrame {
type: "res";
id: string;
ok: true;
payload: ChatSendResult;
error?: null;
}
/**
* The acceptance response is intentionally open: deployments may add task, replay, terminal, or attachment fields without changing the v4 tree.
*
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendResult".
*/
export interface ChatSendResult {
ok?: boolean | null;
status?: string | null;
sessionKey?: string | null;
session_key?: string | null;
key?: string | null;
message_id?: string | null;
user_message_id?: string | null;
client_message_id?: string | null;
clientMessageId?: string | null;
task_id?: string | null;
taskId?: string | null;
replayed?: boolean | null;
instant_accept?: boolean | null;
task_status?: string | null;
taskStatus?: string | null;
terminal_reason?: string | null;
terminalReason?: string | null;
terminal_message?: string | null;
terminalMessage?: string | null;
reason?: string | null;
acceptedPromptAnnotationIds?: string[] | null;
accepted_prompt_annotation_ids?: string[] | null;
[k: string]: unknown;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "ChatSendErrorResponseFrame".
*/
export interface ChatSendErrorResponseFrame {
type: "res";
id: string;
ok: false;
payload?: null;
error: RpcError;
}
/**
* This interface was referenced by `OpenSquillaChatSendContract`'s JSON-Schema
* via the `definition` "RpcError".
*/
export interface RpcError {
code: string;
message: string;
details?: unknown;
retryable?: boolean | null;
retry_after_ms?: number | null;
accepted?: boolean | null;
[k: string]: unknown;
}
export const CHAT_SEND_CONTRACT_KIND = "command" as const
export const CHAT_SEND_METHOD = "chat.send" as const
export const CHAT_SEND_SCOPE = "operator.write" as const
export const CHAT_SEND_IDEMPOTENCY = "idempotent" as const
export const CHAT_SEND_TIMEOUT = {"policy":"caller"} as const
export const CHAT_SEND_CAPABILITY = {"kind":"method-availability","name":"chat.send"} as const
export const CHAT_SEND_ERRORS = [{"code":"INVALID_PARAMS"},{"code":"INVALID_REQUEST"},{"code":"UNAUTHORIZED"},{"code":"UNAVAILABLE","retryable":true},{"code":"STORAGE_BUSY","details":true,"retryAfterMs":true,"retryable":true},{"code":"QUEUE_FULL","retryable":true},{"code":"QUEUE_FULL_DIRTY","details":true,"retryable":false},{"code":"SESSION_CHANGED","retryable":true},{"code":"IDEMPOTENCY_CONFLICT","retryable":false},{"code":"META_CONTROL_CONFLICT","retryable":false},{"code":"COLLECT_RACE","retryable":true},{"code":"SESSION_CONFLICT","retryable":true},{"code":"INTERNAL_ERROR"}] as const