conversationalist 0.0.5 → 0.0.6
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/index.js +40 -33
- package/dist/index.js.map +8 -4
- package/dist/utilities/content.d.ts +12 -0
- package/dist/utilities/content.d.ts.map +1 -0
- package/dist/utilities/index.d.ts +8 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/markdown.d.ts +76 -0
- package/dist/utilities/markdown.d.ts.map +1 -0
- package/dist/utilities/message.d.ts +32 -0
- package/dist/utilities/message.d.ts.map +1 -0
- package/dist/utilities/tool-calls.d.ts +33 -0
- package/dist/utilities/tool-calls.d.ts.map +1 -0
- package/dist/utilities/type-helpers.d.ts +11 -0
- package/dist/utilities/type-helpers.d.ts.map +1 -0
- package/dist/utilities.d.ts +15 -151
- package/dist/utilities.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3588,29 +3588,28 @@ var conversationShape = {
|
|
|
3588
3588
|
updatedAt: z.string()
|
|
3589
3589
|
};
|
|
3590
3590
|
var conversationSchema = z.object(conversationShape);
|
|
3591
|
-
// src/utilities.ts
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
pairs.push({
|
|
3604
|
-
call: msg.toolCall,
|
|
3605
|
-
result: resultsMap.get(msg.toolCall.id)
|
|
3606
|
-
});
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
return pairs;
|
|
3591
|
+
// src/utilities/content.ts
|
|
3592
|
+
function toMultiModalArray(input) {
|
|
3593
|
+
if (typeof input === "string")
|
|
3594
|
+
return [{ type: "text", text: input }];
|
|
3595
|
+
return Array.isArray(input) ? input : [input];
|
|
3596
|
+
}
|
|
3597
|
+
function normalizeContent(content) {
|
|
3598
|
+
if (content === undefined)
|
|
3599
|
+
return;
|
|
3600
|
+
if (typeof content === "string")
|
|
3601
|
+
return content;
|
|
3602
|
+
return Array.isArray(content) ? content : [content];
|
|
3610
3603
|
}
|
|
3604
|
+
// src/utilities/markdown.ts
|
|
3605
|
+
var import_gray_matter = __toESM(require_gray_matter(), 1);
|
|
3606
|
+
|
|
3607
|
+
// src/utilities/type-helpers.ts
|
|
3611
3608
|
function toReadonly(value) {
|
|
3612
3609
|
return value;
|
|
3613
3610
|
}
|
|
3611
|
+
|
|
3612
|
+
// src/utilities/message.ts
|
|
3614
3613
|
function createMessage(props) {
|
|
3615
3614
|
const content = Array.isArray(props.content) ? toReadonly([...props.content]) : props.content;
|
|
3616
3615
|
const message = {
|
|
@@ -3628,18 +3627,6 @@ function createMessage(props) {
|
|
|
3628
3627
|
};
|
|
3629
3628
|
return toReadonly(message);
|
|
3630
3629
|
}
|
|
3631
|
-
function toMultiModalArray(input) {
|
|
3632
|
-
if (typeof input === "string")
|
|
3633
|
-
return [{ type: "text", text: input }];
|
|
3634
|
-
return Array.isArray(input) ? input : [input];
|
|
3635
|
-
}
|
|
3636
|
-
function normalizeContent(content) {
|
|
3637
|
-
if (content === undefined)
|
|
3638
|
-
return;
|
|
3639
|
-
if (typeof content === "string")
|
|
3640
|
-
return content;
|
|
3641
|
-
return Array.isArray(content) ? content : [content];
|
|
3642
|
-
}
|
|
3643
3630
|
function messageParts(message) {
|
|
3644
3631
|
if (typeof message.content === "string") {
|
|
3645
3632
|
return message.content ? [{ type: "text", text: message.content }] : [];
|
|
@@ -3656,6 +3643,8 @@ function messageText(message, joiner = `
|
|
|
3656
3643
|
function messageHasImages(message) {
|
|
3657
3644
|
return messageParts(message).some((p) => p.type === "image");
|
|
3658
3645
|
}
|
|
3646
|
+
|
|
3647
|
+
// src/utilities/markdown.ts
|
|
3659
3648
|
var ROLE_DISPLAY_NAMES = {
|
|
3660
3649
|
user: "User",
|
|
3661
3650
|
assistant: "Assistant",
|
|
@@ -3876,7 +3865,25 @@ function parseMarkdownSimple(body) {
|
|
|
3876
3865
|
};
|
|
3877
3866
|
return toReadonly(conversation);
|
|
3878
3867
|
}
|
|
3879
|
-
|
|
3868
|
+
// src/utilities/tool-calls.ts
|
|
3869
|
+
function pairToolCallsWithResults(messages) {
|
|
3870
|
+
const pairs = [];
|
|
3871
|
+
const resultsMap = new Map;
|
|
3872
|
+
for (const msg of messages) {
|
|
3873
|
+
if (msg.toolResult) {
|
|
3874
|
+
resultsMap.set(msg.toolResult.callId, msg.toolResult);
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
for (const msg of messages) {
|
|
3878
|
+
if (msg.toolCall) {
|
|
3879
|
+
pairs.push({
|
|
3880
|
+
call: msg.toolCall,
|
|
3881
|
+
result: resultsMap.get(msg.toolCall.id)
|
|
3882
|
+
});
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
return pairs;
|
|
3886
|
+
}
|
|
3880
3887
|
// src/environment.ts
|
|
3881
3888
|
function simpleTokenEstimator(message) {
|
|
3882
3889
|
const text = messageText(message);
|
|
@@ -4997,4 +5004,4 @@ export {
|
|
|
4997
5004
|
ConversationHistory
|
|
4998
5005
|
};
|
|
4999
5006
|
|
|
5000
|
-
//# debugId=
|
|
5007
|
+
//# debugId=5ABC5C6EA1F008F764756E2164756E21
|