@iblai/data-layer 1.18.0 → 1.18.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/data-layer",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "ibl.ai data layer",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
@@ -67,6 +67,12 @@ export interface TranscriptsMessagesDetailsResponse {
67
67
  mentor: string;
68
68
  mentor_unique_id: string;
69
69
  model: string;
70
+ /**
71
+ * Provider key of `model` (e.g. `openai`), as the per-turn
72
+ * `metadata.llm_provider` names it. Not sent by the backend yet; when it
73
+ * is, the transcript badge resolves its logo from it directly.
74
+ */
75
+ llm_provider?: string | null;
70
76
  username: string;
71
77
  name: string;
72
78
  /** Preferred over `name`/`username` in the UI; older deployments omit it. */
@@ -83,14 +89,53 @@ export interface TranscriptsMessagesDetailsResponse {
83
89
  session: string;
84
90
  user: number;
85
91
  };
86
- messages: Array<{
87
- human: string;
88
- ai: string;
89
- /** Attachments uploaded with the human turn; a file-only turn has `human: ""`. */
90
- human_files?: TranscriptFile[] | null;
91
- /** Files produced by the assistant turn (same shape as `human_files`). */
92
- ai_files?: TranscriptFile[] | null;
93
- }>;
92
+ messages: TranscriptMessage[];
93
+ }
94
+ /** One human/AI exchange of a transcript, with its attachments and extended context. */
95
+ export interface TranscriptMessage extends TranscriptTurnExtendedContext {
96
+ human: string;
97
+ ai: string;
98
+ /** Attachments uploaded with the human turn; a file-only turn has `human: ""`. */
99
+ human_files?: TranscriptFile[] | null;
100
+ /** Files produced by the assistant turn (same shape as `human_files`). */
101
+ ai_files?: TranscriptFile[] | null;
102
+ }
103
+ /** A document the agent retrieved while producing an AI turn (a RAG source). */
104
+ export interface TranscriptRetrievedDocument {
105
+ source?: string | null;
106
+ title?: string | null;
107
+ snippet?: string | null;
108
+ score?: number | null;
109
+ confidence_level?: string | number | null;
110
+ [key: string]: unknown;
111
+ }
112
+ /** A tool the agent called while producing an AI turn. `input`/`output` are free-form. */
113
+ export interface TranscriptToolCall {
114
+ name?: string | null;
115
+ input?: unknown;
116
+ output?: unknown;
117
+ [key: string]: unknown;
118
+ }
119
+ /** Backend metadata recorded for an AI turn. Known keys are typed; anything else passes through. */
120
+ export interface TranscriptTurnMetadata {
121
+ client?: Record<string, unknown> | null;
122
+ llm_model?: string | null;
123
+ llm_provider?: string | null;
124
+ llm_temperature?: number | null;
125
+ [key: string]: unknown;
126
+ }
127
+ /**
128
+ * Extended per-turn context — retrieved documents, tool calls, metadata and the
129
+ * request context — that the backend attaches to each AI turn on the admin
130
+ * surfaces only (`analytics/messages/details/` and the admin `chat-history/`
131
+ * list). The learner-facing `my-chat-history` endpoints never carry these.
132
+ * Every field may be `null` or empty for turns with no retrieval/tool activity.
133
+ */
134
+ export interface TranscriptTurnExtendedContext {
135
+ documents?: TranscriptRetrievedDocument[] | null;
136
+ tool_calls?: TranscriptToolCall[] | null;
137
+ metadata?: TranscriptTurnMetadata | null;
138
+ request_context?: Record<string, unknown> | null;
94
139
  }
95
140
  /** A file attached to a transcript message; `url` is a presigned, time-limited link. */
96
141
  export interface TranscriptFile {
@@ -117,6 +162,12 @@ export interface TranscriptsMessagesResponse {
117
162
  mentor: string;
118
163
  mentor_unique_id: string;
119
164
  model: string;
165
+ /**
166
+ * Provider key of `model` (e.g. `openai`). Not sent by the backend yet;
167
+ * when it is, the list card's model badge shows the provider logo from it
168
+ * instead of inferring the provider from the model name.
169
+ */
170
+ llm_provider?: string | null;
120
171
  cost: number;
121
172
  username: string;
122
173
  name: string;
@@ -133,6 +184,14 @@ export interface TranscriptsMessagesResponse {
133
184
  platform: number;
134
185
  session: string;
135
186
  user: number;
187
+ /**
188
+ * Rollups of the extended per-turn context, so rows can be badged without
189
+ * opening the conversation. The generated API client types them as strings;
190
+ * older backends omit them. Zero / false when there is no extended history.
191
+ */
192
+ documents_count?: number | string | null;
193
+ tool_calls_count?: number | string | null;
194
+ used_documents?: boolean | string | null;
136
195
  }>;
137
196
  pagination: {
138
197
  page: number;
@@ -1,3 +1,4 @@
1
+ import type { TranscriptFile } from '../analytics/types';
1
2
  export type UserChatHistoryTopic = {
2
3
  id?: number;
3
4
  name: string;
@@ -17,6 +18,10 @@ export type UserChatHistoryMessage = {
17
18
  ai: string;
18
19
  human_message_inserted_at?: string;
19
20
  ai_message_inserted_at?: string;
21
+ /** Files the user attached to the turn (presigned `url`); a file-only turn has `human: ""`. */
22
+ human_files?: TranscriptFile[] | null;
23
+ /** Files the assistant produced on the turn. */
24
+ ai_files?: TranscriptFile[] | null;
20
25
  };
21
26
  export type UserChatHistorySession = {
22
27
  id: string;