@alquimia-ai/tools 2.4.0 → 2.5.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/README.md +6 -0
- package/dist/actions/index.d.mts +2 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.js +1 -1
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/actions/index.mjs.map +1 -1
- package/dist/{actions-CZU_GRy5.d.mts → actions-BjDPJdyA.d.mts} +1 -1
- package/dist/{actions-B0hfoYRd.d.ts → actions-CP1d4Ye1.d.ts} +1 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/genui/index.d.mts +3 -3
- package/dist/genui/index.d.ts +3 -3
- package/dist/genui/index.js +9 -1
- package/dist/genui/index.js.map +1 -1
- package/dist/genui/index.mjs +9 -1
- package/dist/genui/index.mjs.map +1 -1
- package/dist/hooks/index.d.mts +10 -10
- package/dist/hooks/index.d.ts +10 -10
- package/dist/hooks/index.js +28 -8
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +28 -8
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/next/index.js +19 -5
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +19 -5
- package/dist/next/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +4 -4
- package/dist/providers/index.d.ts +4 -4
- package/dist/providers/index.js +111 -110
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +111 -110
- package/dist/providers/index.mjs.map +1 -1
- package/dist/{providers-BJTXCtI3.d.ts → providers-DiR9cgyo.d.mts} +8 -8
- package/dist/{providers-0Gi78uNQ.d.mts → providers-b5_yMyMo.d.ts} +8 -8
- package/dist/proxy.d.mts +4 -4
- package/dist/proxy.d.ts +4 -4
- package/dist/proxy.js +19 -5
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs +19 -5
- package/dist/proxy.mjs.map +1 -1
- package/dist/sdk/index.d.mts +4 -3
- package/dist/sdk/index.d.ts +4 -3
- package/dist/sdk/index.js +8 -2
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +8 -2
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/services/index.d.mts +3 -3
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/type-DqX3-9QS.d.mts +312 -0
- package/dist/type-xksRnBUW.d.ts +312 -0
- package/dist/types/index.d.mts +78 -304
- package/dist/types/index.d.ts +78 -304
- package/dist/types/index.js.map +1 -1
- package/dist/types-C-6fgK1_.d.mts +111 -0
- package/dist/types-C-6fgK1_.d.ts +111 -0
- package/dist/{types-DnfWUE9V.d.mts → types-CMVbyEv8.d.mts} +3 -2
- package/dist/{types-DnfWUE9V.d.ts → types-CMVbyEv8.d.ts} +3 -2
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/worklog/index.d.mts +5 -2
- package/dist/worklog/index.d.ts +5 -2
- package/dist/worklog/index.js +3 -1
- package/dist/worklog/index.js.map +1 -1
- package/dist/worklog/index.mjs +3 -1
- package/dist/worklog/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/types-Dvu9y4WM.d.mts +0 -53
- package/dist/types-Dvu9y4WM.d.ts +0 -53
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { AlquimiaSDK } from '../sdk/index.mjs';
|
|
3
3
|
import { AlquimiaAdapter } from '../adapters/index.mjs';
|
|
4
|
-
import { W as WhisperProvider, S as StableDiffusionProvider, C as CharacterizationProvider, R as RatingsProvider, L as LoggerProvider } from '../providers-
|
|
5
|
-
import { GenuiSurfaceItem, AlquimiaMessage, ToolEvent, AIMessageChunk, RatingData } from '../
|
|
4
|
+
import { W as WhisperProvider, S as StableDiffusionProvider, C as CharacterizationProvider, R as RatingsProvider, L as LoggerProvider } from '../providers-DiR9cgyo.mjs';
|
|
5
|
+
import { G as GenuiSurfaceItem, e as AlquimiaMessage, u as ToolEvent, a as AIMessageChunk, R as RatingData } from '../type-DqX3-9QS.mjs';
|
|
6
|
+
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.mjs';
|
|
7
|
+
import { a as WorklogState } from '../types-C-6fgK1_.mjs';
|
|
6
8
|
import { createMessageId } from '../utils/index.mjs';
|
|
7
|
-
import { W as WorklogState } from '../types-Dvu9y4WM.mjs';
|
|
8
|
-
import { T as ToolExecutionResponse } from '../types-DnfWUE9V.mjs';
|
|
9
9
|
import { C as CatalogManifest } from '../registry-Bcu_ZYL1.mjs';
|
|
10
|
-
import { U as UIAction } from '../actions-
|
|
10
|
+
import { U as UIAction } from '../actions-BjDPJdyA.mjs';
|
|
11
11
|
import '@elastic/apm-rum';
|
|
12
12
|
import 'ai';
|
|
13
13
|
import 'zod';
|
|
@@ -74,7 +74,7 @@ declare function useAlquimia(config: UseAlquimiaConfig): {
|
|
|
74
74
|
messages: AlquimiaMessage[];
|
|
75
75
|
populateMessages: (messages: AlquimiaMessage[]) => void;
|
|
76
76
|
processMessageChunk: (messageId: string, chunk: string, error_code?: string, error_detail?: string, taskid?: string, additionalInfo?: string, loading?: boolean, tooler?: ToolEvent[], thinkings?: any[]) => void;
|
|
77
|
-
sendMessage: (message: string, callBack: (
|
|
77
|
+
sendMessage: (message: string, callBack: (_chunk: AIMessageChunk) => void, traceParentId?: string, sessionId?: string) => Promise<void>;
|
|
78
78
|
sessionId: string | null;
|
|
79
79
|
setActiveTool: react.Dispatch<any>;
|
|
80
80
|
setSessionId: react.Dispatch<react.SetStateAction<string | null>>;
|
|
@@ -93,11 +93,11 @@ declare function useAlquimia(config: UseAlquimiaConfig): {
|
|
|
93
93
|
interface UseRatingsParams {
|
|
94
94
|
assistantId: string;
|
|
95
95
|
topicId: string;
|
|
96
|
-
sendRating: (
|
|
97
|
-
onError?: (
|
|
96
|
+
sendRating: (_ratingData: RatingData) => Promise<any>;
|
|
97
|
+
onError?: (_componentName: string, _error: Error) => void;
|
|
98
98
|
}
|
|
99
|
-
declare function useRatings({ assistantId, sendRating, topicId }: UseRatingsParams): {
|
|
100
|
-
handleRate: (key: string, value: any | string, onHandleRateSuccess: (
|
|
99
|
+
declare function useRatings({ assistantId, sendRating, topicId, onError }: UseRatingsParams): {
|
|
100
|
+
handleRate: (key: string, value: any | string, onHandleRateSuccess: (_success: boolean, _err?: string) => void) => Promise<void>;
|
|
101
101
|
ratingStars: number;
|
|
102
102
|
ratingThumbs: "" | "thumbsUp" | "thumbsDown";
|
|
103
103
|
ratingComment: string;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { AlquimiaSDK } from '../sdk/index.js';
|
|
3
3
|
import { AlquimiaAdapter } from '../adapters/index.js';
|
|
4
|
-
import { W as WhisperProvider, S as StableDiffusionProvider, C as CharacterizationProvider, R as RatingsProvider, L as LoggerProvider } from '../providers-
|
|
5
|
-
import { GenuiSurfaceItem, AlquimiaMessage, ToolEvent, AIMessageChunk, RatingData } from '../
|
|
4
|
+
import { W as WhisperProvider, S as StableDiffusionProvider, C as CharacterizationProvider, R as RatingsProvider, L as LoggerProvider } from '../providers-b5_yMyMo.js';
|
|
5
|
+
import { G as GenuiSurfaceItem, e as AlquimiaMessage, u as ToolEvent, a as AIMessageChunk, R as RatingData } from '../type-xksRnBUW.js';
|
|
6
|
+
import { T as ToolExecutionResponse } from '../types-CMVbyEv8.js';
|
|
7
|
+
import { a as WorklogState } from '../types-C-6fgK1_.js';
|
|
6
8
|
import { createMessageId } from '../utils/index.js';
|
|
7
|
-
import { W as WorklogState } from '../types-Dvu9y4WM.js';
|
|
8
|
-
import { T as ToolExecutionResponse } from '../types-DnfWUE9V.js';
|
|
9
9
|
import { C as CatalogManifest } from '../registry-Bcu_ZYL1.js';
|
|
10
|
-
import { U as UIAction } from '../actions-
|
|
10
|
+
import { U as UIAction } from '../actions-CP1d4Ye1.js';
|
|
11
11
|
import '@elastic/apm-rum';
|
|
12
12
|
import 'ai';
|
|
13
13
|
import 'zod';
|
|
@@ -74,7 +74,7 @@ declare function useAlquimia(config: UseAlquimiaConfig): {
|
|
|
74
74
|
messages: AlquimiaMessage[];
|
|
75
75
|
populateMessages: (messages: AlquimiaMessage[]) => void;
|
|
76
76
|
processMessageChunk: (messageId: string, chunk: string, error_code?: string, error_detail?: string, taskid?: string, additionalInfo?: string, loading?: boolean, tooler?: ToolEvent[], thinkings?: any[]) => void;
|
|
77
|
-
sendMessage: (message: string, callBack: (
|
|
77
|
+
sendMessage: (message: string, callBack: (_chunk: AIMessageChunk) => void, traceParentId?: string, sessionId?: string) => Promise<void>;
|
|
78
78
|
sessionId: string | null;
|
|
79
79
|
setActiveTool: react.Dispatch<any>;
|
|
80
80
|
setSessionId: react.Dispatch<react.SetStateAction<string | null>>;
|
|
@@ -93,11 +93,11 @@ declare function useAlquimia(config: UseAlquimiaConfig): {
|
|
|
93
93
|
interface UseRatingsParams {
|
|
94
94
|
assistantId: string;
|
|
95
95
|
topicId: string;
|
|
96
|
-
sendRating: (
|
|
97
|
-
onError?: (
|
|
96
|
+
sendRating: (_ratingData: RatingData) => Promise<any>;
|
|
97
|
+
onError?: (_componentName: string, _error: Error) => void;
|
|
98
98
|
}
|
|
99
|
-
declare function useRatings({ assistantId, sendRating, topicId }: UseRatingsParams): {
|
|
100
|
-
handleRate: (key: string, value: any | string, onHandleRateSuccess: (
|
|
99
|
+
declare function useRatings({ assistantId, sendRating, topicId, onError }: UseRatingsParams): {
|
|
100
|
+
handleRate: (key: string, value: any | string, onHandleRateSuccess: (_success: boolean, _err?: string) => void) => Promise<void>;
|
|
101
101
|
ratingStars: number;
|
|
102
102
|
ratingThumbs: "" | "thumbsUp" | "thumbsDown";
|
|
103
103
|
ratingComment: string;
|
package/dist/hooks/index.js
CHANGED
|
@@ -46,6 +46,8 @@ var AlquimiaSDK = class {
|
|
|
46
46
|
this.sessionId = null;
|
|
47
47
|
// Internal subscription id from infer (`taskid` on the wire).
|
|
48
48
|
this.streamId = null;
|
|
49
|
+
// W3C traceparent for the current turn, so infer and stream share one trace.
|
|
50
|
+
this.traceParent = null;
|
|
49
51
|
this.tools = [];
|
|
50
52
|
this.extraInstructions = null;
|
|
51
53
|
this.assistantConfig = null;
|
|
@@ -166,11 +168,12 @@ var AlquimiaSDK = class {
|
|
|
166
168
|
const result = (await this.axiosInstance.post(inferUrl, initMessage, {
|
|
167
169
|
headers: {
|
|
168
170
|
"Content-Type": "application/json",
|
|
169
|
-
"x-trace-parent": traceParent
|
|
171
|
+
...traceParent && { "x-trace-parent": traceParent },
|
|
170
172
|
...adapterHeaders,
|
|
171
173
|
...this.buildIdentityHeaders()
|
|
172
174
|
}
|
|
173
175
|
})).data;
|
|
176
|
+
this.traceParent = traceParent ?? null;
|
|
174
177
|
this.streamId = result.taskid ?? null;
|
|
175
178
|
this.attachmentResponses = result.attachments ?? [];
|
|
176
179
|
this.attachments = [];
|
|
@@ -270,7 +273,10 @@ var AlquimiaSDK = class {
|
|
|
270
273
|
if (!this.streamId) {
|
|
271
274
|
throw new Error("Stream ID not initialized. Call sendMessage() first");
|
|
272
275
|
}
|
|
273
|
-
|
|
276
|
+
const url = this.adapter.resolveStreamUrl(this.streamId);
|
|
277
|
+
if (!this.traceParent) return url;
|
|
278
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
279
|
+
return `${url}${separator}trace_parent=${encodeURIComponent(this.traceParent)}`;
|
|
274
280
|
}
|
|
275
281
|
getStreamId() {
|
|
276
282
|
return this.streamId;
|
|
@@ -523,7 +529,9 @@ function frameToRecord(frame) {
|
|
|
523
529
|
control_id: frame.control_id ?? null,
|
|
524
530
|
data: frame.data,
|
|
525
531
|
status,
|
|
526
|
-
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : ""
|
|
532
|
+
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : "",
|
|
533
|
+
entry_hash: frame.entry_hash ?? null,
|
|
534
|
+
previous_hash: frame.previous_hash ?? null
|
|
527
535
|
};
|
|
528
536
|
}
|
|
529
537
|
|
|
@@ -732,7 +740,15 @@ var surfaceShape = import_zod3.z.object({
|
|
|
732
740
|
});
|
|
733
741
|
var UAX31_ID = /^[\p{XID_Start}_][\p{XID_Continue}]*$/u;
|
|
734
742
|
function validateProps(node, def2) {
|
|
735
|
-
const {
|
|
743
|
+
const {
|
|
744
|
+
id,
|
|
745
|
+
component: _component,
|
|
746
|
+
children: _children,
|
|
747
|
+
child: _child,
|
|
748
|
+
binding: _binding,
|
|
749
|
+
action: _action,
|
|
750
|
+
...props
|
|
751
|
+
} = node;
|
|
736
752
|
const parsed = def2.schema.safeParse(props);
|
|
737
753
|
if (parsed.success) return { ok: true, value: parsed.data, errors: [] };
|
|
738
754
|
return {
|
|
@@ -1395,14 +1411,14 @@ function ratingReducer(state, action) {
|
|
|
1395
1411
|
return state;
|
|
1396
1412
|
}
|
|
1397
1413
|
}
|
|
1398
|
-
function useRatings({ assistantId, sendRating, topicId }) {
|
|
1414
|
+
function useRatings({ assistantId, sendRating, topicId, onError }) {
|
|
1399
1415
|
const [isLoading, setIsLoading] = (0, import_react3.useState)(false);
|
|
1400
1416
|
const [hasReviewed, setHasReviewed] = (0, import_react3.useState)(false);
|
|
1401
1417
|
const [state, dispatch] = (0, import_react3.useReducer)(ratingReducer, initialState);
|
|
1402
1418
|
const setRatingStars = (rating) => {
|
|
1403
1419
|
dispatch({ type: "SET_RATING_STARS", payload: rating });
|
|
1404
1420
|
};
|
|
1405
|
-
const
|
|
1421
|
+
const _setRatingThumbs = (rating) => {
|
|
1406
1422
|
dispatch({ type: "SET_RATING_THUMBS", payload: rating });
|
|
1407
1423
|
};
|
|
1408
1424
|
const setRatingComment = (comment) => {
|
|
@@ -1425,7 +1441,9 @@ function useRatings({ assistantId, sendRating, topicId }) {
|
|
|
1425
1441
|
const response = await sendRating(ratingObj);
|
|
1426
1442
|
if (!response.success) {
|
|
1427
1443
|
setIsLoading(false);
|
|
1428
|
-
|
|
1444
|
+
const error = new Error(response.error?.message ?? "Failed to send rating");
|
|
1445
|
+
onHandleRateSuccess(false, error.message);
|
|
1446
|
+
onError?.("useRatings", error);
|
|
1429
1447
|
return;
|
|
1430
1448
|
}
|
|
1431
1449
|
if (key === "score") {
|
|
@@ -1438,7 +1456,9 @@ function useRatings({ assistantId, sendRating, topicId }) {
|
|
|
1438
1456
|
onHandleRateSuccess(true);
|
|
1439
1457
|
} catch (err) {
|
|
1440
1458
|
setIsLoading(false);
|
|
1441
|
-
|
|
1459
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
1460
|
+
onHandleRateSuccess(false, error.message);
|
|
1461
|
+
onError?.("useRatings", error);
|
|
1442
1462
|
}
|
|
1443
1463
|
};
|
|
1444
1464
|
return {
|