@tano.page/protocol 0.12.0 → 0.13.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/package.json +3 -3
- package/src/assistant.ts +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tano.page/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "git+https://github.com/Dramwig/Tano.git"
|
|
25
25
|
},
|
|
26
26
|
"tanoCore": {
|
|
27
|
-
"sourceCommit": "
|
|
28
|
-
"version": "0.
|
|
27
|
+
"sourceCommit": "f69fa05174c73c5d50f0b366e4f91dea5ea3595c",
|
|
28
|
+
"version": "0.13.0",
|
|
29
29
|
"importName": "@tano/protocol"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/assistant.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const ASSISTANT_PROTOCOL_VERSION =
|
|
1
|
+
export const ASSISTANT_PROTOCOL_VERSION = 15;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export type AssistantReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
|
|
@@ -151,12 +151,27 @@ export function parseAssistantAnswers(value: unknown, questions: readonly Assist
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
export type AssistantMediaKind = 'image' | 'pdf' | 'file';
|
|
155
|
+
|
|
156
|
+
export interface AssistantAttachmentInfo {
|
|
157
|
+
name: string;
|
|
158
|
+
kind: 'text' | AssistantMediaKind;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface AssistantMediaAttachment {
|
|
162
|
+
name: string;
|
|
163
|
+
mime: string;
|
|
164
|
+
data: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
154
167
|
export interface AssistantMessage {
|
|
155
168
|
id: string;
|
|
156
169
|
role: 'user' | 'assistant';
|
|
157
170
|
content: string;
|
|
158
171
|
createdAt: number;
|
|
159
172
|
sources?: AssistantSource[];
|
|
173
|
+
/** Clipboard attachment names and types retained in the conversation. */
|
|
174
|
+
attachments?: AssistantAttachmentInfo[];
|
|
160
175
|
/** Initial source IDs attached to the preceding user message; later tool reads are excluded. */
|
|
161
176
|
attachedSourceIds?: string[];
|
|
162
177
|
proposals?: AssistantProposal[];
|
|
@@ -199,6 +214,8 @@ export interface AssistantToolCall {
|
|
|
199
214
|
export interface AssistantWireMessage {
|
|
200
215
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
201
216
|
content: string | null;
|
|
217
|
+
/** Inline media on the current user turn, encoded as base64. */
|
|
218
|
+
attachments?: AssistantMediaAttachment[];
|
|
202
219
|
tool_calls?: AssistantToolCall[];
|
|
203
220
|
tool_call_id?: string;
|
|
204
221
|
/** Transient Responses output, including reasoning needed by the next tool round. */
|
|
@@ -225,6 +242,7 @@ export interface AssistantTransport {
|
|
|
225
242
|
scanCcSwitch?(path?: string): Promise<AssistantImportCandidate[]>;
|
|
226
243
|
importCcSwitch?(ids: string[], path?: string): Promise<void>;
|
|
227
244
|
canConfigure?: boolean;
|
|
245
|
+
supportsMediaAttachments?(connection: AssistantConnection, kind: AssistantMediaKind): boolean;
|
|
228
246
|
connections(): Promise<AssistantConnection[]>;
|
|
229
247
|
quota?(connectionId: string): Promise<AssistantQuotaResult>;
|
|
230
248
|
saveQuota?(connectionId: string, config: AssistantQuotaConfig, key?: string): Promise<void>;
|
|
@@ -271,6 +289,9 @@ export function parseAssistantSession(value: unknown): AssistantSession {
|
|
|
271
289
|
!['completed', 'cancelled', 'failed', 'interrupted'].includes(message.state ?? '') ||
|
|
272
290
|
(message.termination.reason === 'completed') !== (message.state === 'completed'))) ||
|
|
273
291
|
(message.sources && (!Array.isArray(message.sources) || message.sources.length > 30)) ||
|
|
292
|
+
(message.attachments !== undefined && (message.role !== 'user' || !Array.isArray(message.attachments) ||
|
|
293
|
+
message.attachments.length > 10 || message.attachments.some(item => !item || !text(item.name, 255) ||
|
|
294
|
+
!item.name.trim() || !['text', 'image', 'pdf', 'file'].includes(item.kind)))) ||
|
|
274
295
|
(message.attachedSourceIds !== undefined && (message.role !== 'assistant' || !Array.isArray(message.attachedSourceIds) ||
|
|
275
296
|
message.attachedSourceIds.length > 20 || new Set(message.attachedSourceIds).size !== message.attachedSourceIds.length ||
|
|
276
297
|
message.attachedSourceIds.some(id => !text(id, 80) || !message.sources?.some(source => source?.id === id)))) ||
|