@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.mjs
CHANGED
|
@@ -9,6 +9,8 @@ var AlquimiaSDK = class {
|
|
|
9
9
|
this.sessionId = null;
|
|
10
10
|
// Internal subscription id from infer (`taskid` on the wire).
|
|
11
11
|
this.streamId = null;
|
|
12
|
+
// W3C traceparent for the current turn, so infer and stream share one trace.
|
|
13
|
+
this.traceParent = null;
|
|
12
14
|
this.tools = [];
|
|
13
15
|
this.extraInstructions = null;
|
|
14
16
|
this.assistantConfig = null;
|
|
@@ -129,11 +131,12 @@ var AlquimiaSDK = class {
|
|
|
129
131
|
const result = (await this.axiosInstance.post(inferUrl, initMessage, {
|
|
130
132
|
headers: {
|
|
131
133
|
"Content-Type": "application/json",
|
|
132
|
-
"x-trace-parent": traceParent
|
|
134
|
+
...traceParent && { "x-trace-parent": traceParent },
|
|
133
135
|
...adapterHeaders,
|
|
134
136
|
...this.buildIdentityHeaders()
|
|
135
137
|
}
|
|
136
138
|
})).data;
|
|
139
|
+
this.traceParent = traceParent ?? null;
|
|
137
140
|
this.streamId = result.taskid ?? null;
|
|
138
141
|
this.attachmentResponses = result.attachments ?? [];
|
|
139
142
|
this.attachments = [];
|
|
@@ -233,7 +236,10 @@ var AlquimiaSDK = class {
|
|
|
233
236
|
if (!this.streamId) {
|
|
234
237
|
throw new Error("Stream ID not initialized. Call sendMessage() first");
|
|
235
238
|
}
|
|
236
|
-
|
|
239
|
+
const url = this.adapter.resolveStreamUrl(this.streamId);
|
|
240
|
+
if (!this.traceParent) return url;
|
|
241
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
242
|
+
return `${url}${separator}trace_parent=${encodeURIComponent(this.traceParent)}`;
|
|
237
243
|
}
|
|
238
244
|
getStreamId() {
|
|
239
245
|
return this.streamId;
|
|
@@ -486,7 +492,9 @@ function frameToRecord(frame) {
|
|
|
486
492
|
control_id: frame.control_id ?? null,
|
|
487
493
|
data: frame.data,
|
|
488
494
|
status,
|
|
489
|
-
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : ""
|
|
495
|
+
date_submitted: typeof frame.date_submitted === "string" ? frame.date_submitted : "",
|
|
496
|
+
entry_hash: frame.entry_hash ?? null,
|
|
497
|
+
previous_hash: frame.previous_hash ?? null
|
|
490
498
|
};
|
|
491
499
|
}
|
|
492
500
|
|
|
@@ -695,7 +703,15 @@ var surfaceShape = z3.object({
|
|
|
695
703
|
});
|
|
696
704
|
var UAX31_ID = /^[\p{XID_Start}_][\p{XID_Continue}]*$/u;
|
|
697
705
|
function validateProps(node, def2) {
|
|
698
|
-
const {
|
|
706
|
+
const {
|
|
707
|
+
id,
|
|
708
|
+
component: _component,
|
|
709
|
+
children: _children,
|
|
710
|
+
child: _child,
|
|
711
|
+
binding: _binding,
|
|
712
|
+
action: _action,
|
|
713
|
+
...props
|
|
714
|
+
} = node;
|
|
699
715
|
const parsed = def2.schema.safeParse(props);
|
|
700
716
|
if (parsed.success) return { ok: true, value: parsed.data, errors: [] };
|
|
701
717
|
return {
|
|
@@ -1358,14 +1374,14 @@ function ratingReducer(state, action) {
|
|
|
1358
1374
|
return state;
|
|
1359
1375
|
}
|
|
1360
1376
|
}
|
|
1361
|
-
function useRatings({ assistantId, sendRating, topicId }) {
|
|
1377
|
+
function useRatings({ assistantId, sendRating, topicId, onError }) {
|
|
1362
1378
|
const [isLoading, setIsLoading] = useState2(false);
|
|
1363
1379
|
const [hasReviewed, setHasReviewed] = useState2(false);
|
|
1364
1380
|
const [state, dispatch] = useReducer2(ratingReducer, initialState);
|
|
1365
1381
|
const setRatingStars = (rating) => {
|
|
1366
1382
|
dispatch({ type: "SET_RATING_STARS", payload: rating });
|
|
1367
1383
|
};
|
|
1368
|
-
const
|
|
1384
|
+
const _setRatingThumbs = (rating) => {
|
|
1369
1385
|
dispatch({ type: "SET_RATING_THUMBS", payload: rating });
|
|
1370
1386
|
};
|
|
1371
1387
|
const setRatingComment = (comment) => {
|
|
@@ -1388,7 +1404,9 @@ function useRatings({ assistantId, sendRating, topicId }) {
|
|
|
1388
1404
|
const response = await sendRating(ratingObj);
|
|
1389
1405
|
if (!response.success) {
|
|
1390
1406
|
setIsLoading(false);
|
|
1391
|
-
|
|
1407
|
+
const error = new Error(response.error?.message ?? "Failed to send rating");
|
|
1408
|
+
onHandleRateSuccess(false, error.message);
|
|
1409
|
+
onError?.("useRatings", error);
|
|
1392
1410
|
return;
|
|
1393
1411
|
}
|
|
1394
1412
|
if (key === "score") {
|
|
@@ -1401,7 +1419,9 @@ function useRatings({ assistantId, sendRating, topicId }) {
|
|
|
1401
1419
|
onHandleRateSuccess(true);
|
|
1402
1420
|
} catch (err) {
|
|
1403
1421
|
setIsLoading(false);
|
|
1404
|
-
|
|
1422
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
1423
|
+
onHandleRateSuccess(false, error.message);
|
|
1424
|
+
onError?.("useRatings", error);
|
|
1405
1425
|
}
|
|
1406
1426
|
};
|
|
1407
1427
|
return {
|