@tano.page/protocol 0.11.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 +24 -1
- package/src/entry-drag.ts +20 -15
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';
|
|
@@ -25,6 +25,8 @@ export interface AssistantConnection {
|
|
|
25
25
|
maxOutputTokens: number;
|
|
26
26
|
hasKey: boolean;
|
|
27
27
|
/** Configured by the hosting application. */
|
|
28
|
+
platformProvider?: boolean;
|
|
29
|
+
/** Legacy wire field for released servers. Normalize at the transport boundary. */
|
|
28
30
|
managed?: boolean;
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -149,12 +151,27 @@ export function parseAssistantAnswers(value: unknown, questions: readonly Assist
|
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
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
|
+
|
|
152
167
|
export interface AssistantMessage {
|
|
153
168
|
id: string;
|
|
154
169
|
role: 'user' | 'assistant';
|
|
155
170
|
content: string;
|
|
156
171
|
createdAt: number;
|
|
157
172
|
sources?: AssistantSource[];
|
|
173
|
+
/** Clipboard attachment names and types retained in the conversation. */
|
|
174
|
+
attachments?: AssistantAttachmentInfo[];
|
|
158
175
|
/** Initial source IDs attached to the preceding user message; later tool reads are excluded. */
|
|
159
176
|
attachedSourceIds?: string[];
|
|
160
177
|
proposals?: AssistantProposal[];
|
|
@@ -197,6 +214,8 @@ export interface AssistantToolCall {
|
|
|
197
214
|
export interface AssistantWireMessage {
|
|
198
215
|
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
199
216
|
content: string | null;
|
|
217
|
+
/** Inline media on the current user turn, encoded as base64. */
|
|
218
|
+
attachments?: AssistantMediaAttachment[];
|
|
200
219
|
tool_calls?: AssistantToolCall[];
|
|
201
220
|
tool_call_id?: string;
|
|
202
221
|
/** Transient Responses output, including reasoning needed by the next tool round. */
|
|
@@ -223,6 +242,7 @@ export interface AssistantTransport {
|
|
|
223
242
|
scanCcSwitch?(path?: string): Promise<AssistantImportCandidate[]>;
|
|
224
243
|
importCcSwitch?(ids: string[], path?: string): Promise<void>;
|
|
225
244
|
canConfigure?: boolean;
|
|
245
|
+
supportsMediaAttachments?(connection: AssistantConnection, kind: AssistantMediaKind): boolean;
|
|
226
246
|
connections(): Promise<AssistantConnection[]>;
|
|
227
247
|
quota?(connectionId: string): Promise<AssistantQuotaResult>;
|
|
228
248
|
saveQuota?(connectionId: string, config: AssistantQuotaConfig, key?: string): Promise<void>;
|
|
@@ -269,6 +289,9 @@ export function parseAssistantSession(value: unknown): AssistantSession {
|
|
|
269
289
|
!['completed', 'cancelled', 'failed', 'interrupted'].includes(message.state ?? '') ||
|
|
270
290
|
(message.termination.reason === 'completed') !== (message.state === 'completed'))) ||
|
|
271
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)))) ||
|
|
272
295
|
(message.attachedSourceIds !== undefined && (message.role !== 'assistant' || !Array.isArray(message.attachedSourceIds) ||
|
|
273
296
|
message.attachedSourceIds.length > 20 || new Set(message.attachedSourceIds).size !== message.attachedSourceIds.length ||
|
|
274
297
|
message.attachedSourceIds.some(id => !text(id, 80) || !message.sources?.some(source => source?.id === id)))) ||
|
package/src/entry-drag.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import type { ReferenceTarget } from './objects';
|
|
2
|
-
|
|
3
|
-
export const entryReferenceDragType = 'application/x-tano-entry-references';
|
|
4
|
-
|
|
5
|
-
/** Resolve drag identities against live targets, never trust dragged labels or paths. */
|
|
6
|
-
export function droppedEntryReferences(data: string, targets: readonly ReferenceTarget[]): ReferenceTarget[] {
|
|
7
|
-
try {
|
|
8
|
-
const payload = JSON.parse(data);
|
|
9
|
-
if (typeof payload.workspace !== 'string' || !Array.isArray(payload.ids)) return [];
|
|
10
|
-
const ids = new Set(payload.ids.filter((id: unknown) => typeof id === 'string'));
|
|
11
|
-
return targets.filter(target => target.workspace === payload.workspace && ids.has(target.id));
|
|
12
|
-
} catch {
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import type { ReferenceTarget } from './objects';
|
|
2
|
+
|
|
3
|
+
export const entryReferenceDragType = 'application/x-tano-entry-references';
|
|
4
|
+
|
|
5
|
+
/** Resolve drag identities against live targets, never trust dragged labels or paths. */
|
|
6
|
+
export function droppedEntryReferences(data: string, targets: readonly ReferenceTarget[]): ReferenceTarget[] {
|
|
7
|
+
try {
|
|
8
|
+
const payload = JSON.parse(data);
|
|
9
|
+
if (typeof payload.workspace !== 'string' || !Array.isArray(payload.ids)) return [];
|
|
10
|
+
const ids = new Set(payload.ids.filter((id: unknown) => typeof id === 'string'));
|
|
11
|
+
return targets.filter(target => target.workspace === payload.workspace && ids.has(target.id));
|
|
12
|
+
} catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Acknowledges a completed insertion to the active drag source. */
|
|
18
|
+
export function confirmEntryReferenceDrop(event: DragEvent) {
|
|
19
|
+
event.target?.dispatchEvent(new CustomEvent('tano-entry-reference-inserted', { bubbles: true }));
|
|
20
|
+
}
|