@convex-dev/agent 0.1.13-alpha.1 → 0.1.13-alpha.2
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/esm/client/index.d.ts +6 -0
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +33 -1
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/types.d.ts +8 -1
- package/dist/esm/client/types.d.ts.map +1 -1
- package/dist/esm/component/_generated/api.d.ts +30 -0
- package/dist/esm/component/schema.d.ts +24 -4
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +6 -1
- package/dist/esm/component/schema.js.map +1 -1
- package/dist/esm/component/threads.d.ts +25 -0
- package/dist/esm/component/threads.d.ts.map +1 -1
- package/dist/esm/component/threads.js +20 -0
- package/dist/esm/component/threads.js.map +1 -1
- package/dist/esm.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/client/index.test.ts +18 -17
- package/src/client/index.ts +40 -1
- package/src/client/types.ts +9 -0
- package/src/component/_generated/api.d.ts +30 -0
- package/src/component/schema.ts +6 -1
- package/src/component/threads.ts +23 -0
|
@@ -1723,6 +1723,36 @@ export type Mounts = {
|
|
|
1723
1723
|
splitCursor?: string | null;
|
|
1724
1724
|
}
|
|
1725
1725
|
>;
|
|
1726
|
+
searchThreadTitles: FunctionReference<
|
|
1727
|
+
"query",
|
|
1728
|
+
"public",
|
|
1729
|
+
{
|
|
1730
|
+
paginationOpts?: {
|
|
1731
|
+
cursor: string | null;
|
|
1732
|
+
endCursor?: string | null;
|
|
1733
|
+
id?: number;
|
|
1734
|
+
maximumBytesRead?: number;
|
|
1735
|
+
maximumRowsRead?: number;
|
|
1736
|
+
numItems: number;
|
|
1737
|
+
};
|
|
1738
|
+
query: string;
|
|
1739
|
+
userId?: string | null;
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
continueCursor: string;
|
|
1743
|
+
isDone: boolean;
|
|
1744
|
+
page: Array<{
|
|
1745
|
+
_creationTime: number;
|
|
1746
|
+
_id: string;
|
|
1747
|
+
status: "active" | "archived";
|
|
1748
|
+
summary?: string;
|
|
1749
|
+
title?: string;
|
|
1750
|
+
userId?: string;
|
|
1751
|
+
}>;
|
|
1752
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null;
|
|
1753
|
+
splitCursor?: string | null;
|
|
1754
|
+
}
|
|
1755
|
+
>;
|
|
1726
1756
|
updateThread: FunctionReference<
|
|
1727
1757
|
"mutation",
|
|
1728
1758
|
"public",
|
package/src/component/schema.ts
CHANGED
|
@@ -27,7 +27,12 @@ export const schema = defineSchema({
|
|
|
27
27
|
defaultSystemPrompt: v.optional(v.string()),
|
|
28
28
|
parentThreadIds: v.optional(v.array(v.id("threads"))),
|
|
29
29
|
order: /*DEPRECATED*/ v.optional(v.number()),
|
|
30
|
-
})
|
|
30
|
+
})
|
|
31
|
+
.index("userId", ["userId"])
|
|
32
|
+
.searchIndex("title", {
|
|
33
|
+
searchField: "title",
|
|
34
|
+
filterFields: ["userId"],
|
|
35
|
+
}),
|
|
31
36
|
messages: defineTable({
|
|
32
37
|
id: v.optional(v.string()), // external id, e.g. from Vercel AI SDK
|
|
33
38
|
userId: v.optional(v.string()), // useful for searching across threads
|
package/src/component/threads.ts
CHANGED
|
@@ -92,6 +92,29 @@ export const updateThread = mutation({
|
|
|
92
92
|
returns: vThreadDoc,
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
export const searchThreadTitles = query({
|
|
96
|
+
args: {
|
|
97
|
+
query: v.string(),
|
|
98
|
+
userId: v.optional(v.union(v.string(), v.null())),
|
|
99
|
+
paginationOpts: v.optional(paginationOptsValidator),
|
|
100
|
+
},
|
|
101
|
+
handler: async (ctx, args) => {
|
|
102
|
+
const threads = await ctx.db
|
|
103
|
+
.query("threads")
|
|
104
|
+
.withSearchIndex("title", (q) =>
|
|
105
|
+
args.userId
|
|
106
|
+
? q.search("title", args.query).eq("userId", args.userId ?? undefined)
|
|
107
|
+
: q.search("title", args.query)
|
|
108
|
+
)
|
|
109
|
+
.paginate(args.paginationOpts ?? { cursor: null, numItems: 100 });
|
|
110
|
+
return {
|
|
111
|
+
...threads,
|
|
112
|
+
page: threads.page.map(publicThread),
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
returns: vPaginationResult(vThreadDoc),
|
|
116
|
+
});
|
|
117
|
+
|
|
95
118
|
// When we expose this, we need to also hide all the messages and steps
|
|
96
119
|
// export const archiveThread = mutation({
|
|
97
120
|
// args: { threadId: v.id("threads") },
|