thread-mcp 1.0.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/LICENSE +674 -0
- package/README.md +497 -0
- package/dist/formatters/index.d.ts +5 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +12 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/json.d.ts +3 -0
- package/dist/formatters/json.d.ts.map +1 -0
- package/dist/formatters/json.js +25 -0
- package/dist/formatters/json.js.map +1 -0
- package/dist/formatters/markdown.d.ts +3 -0
- package/dist/formatters/markdown.d.ts.map +1 -0
- package/dist/formatters/markdown.js +134 -0
- package/dist/formatters/markdown.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +175 -0
- package/dist/server.js.map +1 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +3 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/local.d.ts +23 -0
- package/dist/storage/local.d.ts.map +1 -0
- package/dist/storage/local.js +126 -0
- package/dist/storage/local.js.map +1 -0
- package/dist/storage/remote.d.ts +15 -0
- package/dist/storage/remote.d.ts.map +1 -0
- package/dist/storage/remote.js +91 -0
- package/dist/storage/remote.js.map +1 -0
- package/dist/tools/delete-thread.d.ts +71 -0
- package/dist/tools/delete-thread.d.ts.map +1 -0
- package/dist/tools/delete-thread.js +74 -0
- package/dist/tools/delete-thread.js.map +1 -0
- package/dist/tools/find-threads.d.ts +175 -0
- package/dist/tools/find-threads.d.ts.map +1 -0
- package/dist/tools/find-threads.js +265 -0
- package/dist/tools/find-threads.js.map +1 -0
- package/dist/tools/index.d.ts +270 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/resume-thread.d.ts +138 -0
- package/dist/tools/resume-thread.d.ts.map +1 -0
- package/dist/tools/resume-thread.js +191 -0
- package/dist/tools/resume-thread.js.map +1 -0
- package/dist/tools/save-thread.d.ts +155 -0
- package/dist/tools/save-thread.d.ts.map +1 -0
- package/dist/tools/save-thread.js +116 -0
- package/dist/tools/save-thread.js.map +1 -0
- package/dist/tools/update-thread.d.ts +180 -0
- package/dist/tools/update-thread.d.ts.map +1 -0
- package/dist/tools/update-thread.js +159 -0
- package/dist/tools/update-thread.js.map +1 -0
- package/dist/types.d.ts +177 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +41 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SaveThreadInputSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
5
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
6
|
+
content: z.ZodString;
|
|
7
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
role: "user" | "assistant" | "system";
|
|
10
|
+
content: string;
|
|
11
|
+
timestamp?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
role: "user" | "assistant" | "system";
|
|
14
|
+
content: string;
|
|
15
|
+
timestamp?: string | undefined;
|
|
16
|
+
}>, "many">;
|
|
17
|
+
destination: z.ZodDefault<z.ZodEnum<["local", "remote"]>>;
|
|
18
|
+
format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
19
|
+
sourceApp: z.ZodOptional<z.ZodString>;
|
|
20
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
22
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
23
|
+
remoteUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
25
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
+
includeMetadata: z.ZodDefault<z.ZodBoolean>;
|
|
27
|
+
includeTimestamps: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
title: string;
|
|
30
|
+
messages: {
|
|
31
|
+
role: "user" | "assistant" | "system";
|
|
32
|
+
content: string;
|
|
33
|
+
timestamp?: string | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
format: "markdown" | "json";
|
|
36
|
+
includeMetadata: boolean;
|
|
37
|
+
includeTimestamps: boolean;
|
|
38
|
+
destination: "local" | "remote";
|
|
39
|
+
sourceApp?: string | undefined;
|
|
40
|
+
tags?: string[] | undefined;
|
|
41
|
+
summary?: string | undefined;
|
|
42
|
+
apiKey?: string | undefined;
|
|
43
|
+
headers?: Record<string, string> | undefined;
|
|
44
|
+
remoteUrl?: string | undefined;
|
|
45
|
+
outputDir?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
title: string;
|
|
48
|
+
messages: {
|
|
49
|
+
role: "user" | "assistant" | "system";
|
|
50
|
+
content: string;
|
|
51
|
+
timestamp?: string | undefined;
|
|
52
|
+
}[];
|
|
53
|
+
sourceApp?: string | undefined;
|
|
54
|
+
tags?: string[] | undefined;
|
|
55
|
+
summary?: string | undefined;
|
|
56
|
+
format?: "markdown" | "json" | undefined;
|
|
57
|
+
includeMetadata?: boolean | undefined;
|
|
58
|
+
includeTimestamps?: boolean | undefined;
|
|
59
|
+
apiKey?: string | undefined;
|
|
60
|
+
headers?: Record<string, string> | undefined;
|
|
61
|
+
remoteUrl?: string | undefined;
|
|
62
|
+
destination?: "local" | "remote" | undefined;
|
|
63
|
+
outputDir?: string | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export type SaveThreadInput = z.infer<typeof SaveThreadInputSchema>;
|
|
66
|
+
export declare function saveThread(input: SaveThreadInput): Promise<{
|
|
67
|
+
success: boolean;
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
destination: string;
|
|
71
|
+
remoteUrl: string | undefined;
|
|
72
|
+
format: "markdown" | "json";
|
|
73
|
+
savedAt: string;
|
|
74
|
+
messageCount: number;
|
|
75
|
+
filePath?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
success: boolean;
|
|
78
|
+
id: string;
|
|
79
|
+
title: string;
|
|
80
|
+
destination: string;
|
|
81
|
+
filePath: string | undefined;
|
|
82
|
+
format: "markdown" | "json";
|
|
83
|
+
savedAt: string;
|
|
84
|
+
messageCount: number;
|
|
85
|
+
remoteUrl?: undefined;
|
|
86
|
+
}>;
|
|
87
|
+
export declare const saveThreadTool: {
|
|
88
|
+
name: string;
|
|
89
|
+
description: string;
|
|
90
|
+
inputSchema: z.ZodObject<{
|
|
91
|
+
title: z.ZodString;
|
|
92
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
93
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
94
|
+
content: z.ZodString;
|
|
95
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
role: "user" | "assistant" | "system";
|
|
98
|
+
content: string;
|
|
99
|
+
timestamp?: string | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
role: "user" | "assistant" | "system";
|
|
102
|
+
content: string;
|
|
103
|
+
timestamp?: string | undefined;
|
|
104
|
+
}>, "many">;
|
|
105
|
+
destination: z.ZodDefault<z.ZodEnum<["local", "remote"]>>;
|
|
106
|
+
format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
107
|
+
sourceApp: z.ZodOptional<z.ZodString>;
|
|
108
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
109
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
110
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
111
|
+
remoteUrl: z.ZodOptional<z.ZodString>;
|
|
112
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
113
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
114
|
+
includeMetadata: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
includeTimestamps: z.ZodDefault<z.ZodBoolean>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
title: string;
|
|
118
|
+
messages: {
|
|
119
|
+
role: "user" | "assistant" | "system";
|
|
120
|
+
content: string;
|
|
121
|
+
timestamp?: string | undefined;
|
|
122
|
+
}[];
|
|
123
|
+
format: "markdown" | "json";
|
|
124
|
+
includeMetadata: boolean;
|
|
125
|
+
includeTimestamps: boolean;
|
|
126
|
+
destination: "local" | "remote";
|
|
127
|
+
sourceApp?: string | undefined;
|
|
128
|
+
tags?: string[] | undefined;
|
|
129
|
+
summary?: string | undefined;
|
|
130
|
+
apiKey?: string | undefined;
|
|
131
|
+
headers?: Record<string, string> | undefined;
|
|
132
|
+
remoteUrl?: string | undefined;
|
|
133
|
+
outputDir?: string | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
title: string;
|
|
136
|
+
messages: {
|
|
137
|
+
role: "user" | "assistant" | "system";
|
|
138
|
+
content: string;
|
|
139
|
+
timestamp?: string | undefined;
|
|
140
|
+
}[];
|
|
141
|
+
sourceApp?: string | undefined;
|
|
142
|
+
tags?: string[] | undefined;
|
|
143
|
+
summary?: string | undefined;
|
|
144
|
+
format?: "markdown" | "json" | undefined;
|
|
145
|
+
includeMetadata?: boolean | undefined;
|
|
146
|
+
includeTimestamps?: boolean | undefined;
|
|
147
|
+
apiKey?: string | undefined;
|
|
148
|
+
headers?: Record<string, string> | undefined;
|
|
149
|
+
remoteUrl?: string | undefined;
|
|
150
|
+
destination?: "local" | "remote" | undefined;
|
|
151
|
+
outputDir?: string | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
handler: typeof saveThread;
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=save-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-thread.d.ts","sourceRoot":"","sources":["../../src/tools/save-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,wBAAsB,UAAU,CAAC,KAAK,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;GAiEtD;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAO1B,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { OutputFormatSchema } from "../types.js";
|
|
3
|
+
import { getDefaultLocalStorage, createLocalStorage } from "../storage/local.js";
|
|
4
|
+
import { createRemoteStorage } from "../storage/remote.js";
|
|
5
|
+
export const SaveThreadInputSchema = z.object({
|
|
6
|
+
title: z.string().describe("Title for the thread"),
|
|
7
|
+
messages: z
|
|
8
|
+
.array(z.object({
|
|
9
|
+
role: z.enum(["user", "assistant", "system"]),
|
|
10
|
+
content: z.string(),
|
|
11
|
+
timestamp: z.string().optional(),
|
|
12
|
+
}))
|
|
13
|
+
.describe("Array of messages in the thread"),
|
|
14
|
+
destination: z
|
|
15
|
+
.enum(["local", "remote"])
|
|
16
|
+
.default("local")
|
|
17
|
+
.describe("Where to save: 'local' for filesystem, 'remote' for server"),
|
|
18
|
+
format: OutputFormatSchema.default("markdown").describe("Output format: 'markdown' or 'json'"),
|
|
19
|
+
sourceApp: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Name of the AI application (e.g., 'Claude', 'ChatGPT')"),
|
|
23
|
+
tags: z.array(z.string()).optional().describe("Tags for categorization"),
|
|
24
|
+
summary: z.string().optional().describe("Summary of the thread"),
|
|
25
|
+
// Local options
|
|
26
|
+
outputDir: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Custom output directory for local storage (defaults to ~/.thread-mcp)"),
|
|
30
|
+
// Remote options
|
|
31
|
+
remoteUrl: z
|
|
32
|
+
.string()
|
|
33
|
+
.url()
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("Base URL of the remote server (required if destination is 'remote')"),
|
|
36
|
+
apiKey: z.string().optional().describe("API key for remote authentication"),
|
|
37
|
+
headers: z
|
|
38
|
+
.record(z.string())
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Additional headers for remote requests"),
|
|
41
|
+
// Output options
|
|
42
|
+
includeMetadata: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.default(true)
|
|
45
|
+
.describe("Whether to include metadata in the output"),
|
|
46
|
+
includeTimestamps: z
|
|
47
|
+
.boolean()
|
|
48
|
+
.default(true)
|
|
49
|
+
.describe("Whether to include timestamps for each message"),
|
|
50
|
+
});
|
|
51
|
+
export async function saveThread(input) {
|
|
52
|
+
const conversation = {
|
|
53
|
+
id: crypto.randomUUID(),
|
|
54
|
+
metadata: {
|
|
55
|
+
title: input.title,
|
|
56
|
+
sourceApp: input.sourceApp,
|
|
57
|
+
createdAt: new Date().toISOString(),
|
|
58
|
+
tags: input.tags,
|
|
59
|
+
summary: input.summary,
|
|
60
|
+
},
|
|
61
|
+
messages: input.messages.map((msg) => ({
|
|
62
|
+
role: msg.role,
|
|
63
|
+
content: msg.content,
|
|
64
|
+
timestamp: msg.timestamp,
|
|
65
|
+
})),
|
|
66
|
+
};
|
|
67
|
+
const options = {
|
|
68
|
+
format: input.format,
|
|
69
|
+
includeMetadata: input.includeMetadata,
|
|
70
|
+
includeTimestamps: input.includeTimestamps,
|
|
71
|
+
};
|
|
72
|
+
if (input.destination === "remote") {
|
|
73
|
+
if (!input.remoteUrl) {
|
|
74
|
+
throw new Error("remoteUrl is required when destination is 'remote'");
|
|
75
|
+
}
|
|
76
|
+
const storage = createRemoteStorage({
|
|
77
|
+
url: input.remoteUrl,
|
|
78
|
+
apiKey: input.apiKey,
|
|
79
|
+
headers: input.headers,
|
|
80
|
+
});
|
|
81
|
+
const result = await storage.save(conversation, options);
|
|
82
|
+
return {
|
|
83
|
+
success: true,
|
|
84
|
+
id: result.id,
|
|
85
|
+
title: result.title,
|
|
86
|
+
destination: "remote",
|
|
87
|
+
remoteUrl: result.remoteUrl,
|
|
88
|
+
format: result.format,
|
|
89
|
+
savedAt: result.savedAt,
|
|
90
|
+
messageCount: conversation.messages.length,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Local storage
|
|
94
|
+
const storage = input.outputDir
|
|
95
|
+
? createLocalStorage(input.outputDir)
|
|
96
|
+
: getDefaultLocalStorage();
|
|
97
|
+
const result = await storage.save(conversation, options);
|
|
98
|
+
return {
|
|
99
|
+
success: true,
|
|
100
|
+
id: result.id,
|
|
101
|
+
title: result.title,
|
|
102
|
+
destination: "local",
|
|
103
|
+
filePath: result.filePath,
|
|
104
|
+
format: result.format,
|
|
105
|
+
savedAt: result.savedAt,
|
|
106
|
+
messageCount: conversation.messages.length,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export const saveThreadTool = {
|
|
110
|
+
name: "save_thread",
|
|
111
|
+
description: "Save a conversation thread to local storage or a remote server. " +
|
|
112
|
+
"Supports Markdown and JSON formats with rich metadata including tags, summary, and timestamps.",
|
|
113
|
+
inputSchema: SaveThreadInputSchema,
|
|
114
|
+
handler: saveThread,
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=save-thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"save-thread.js","sourceRoot":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C,EAAE;QACb,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,YAAY,CAAC,QAAQ,CAAC,MAAM;KAC3C,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,kEAAkE;QAClE,gGAAgG;IAClG,WAAW,EAAE,qBAAqB;IAClC,OAAO,EAAE,UAAU;CACpB,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const UpdateThreadInputSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodOptional<z.ZodString>;
|
|
4
|
+
title: z.ZodOptional<z.ZodString>;
|
|
5
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
6
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
7
|
+
content: z.ZodString;
|
|
8
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
role: "user" | "assistant" | "system";
|
|
11
|
+
content: string;
|
|
12
|
+
timestamp?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
role: "user" | "assistant" | "system";
|
|
15
|
+
content: string;
|
|
16
|
+
timestamp?: string | undefined;
|
|
17
|
+
}>, "many">;
|
|
18
|
+
mode: z.ZodDefault<z.ZodEnum<["append", "replace"]>>;
|
|
19
|
+
deduplicate: z.ZodDefault<z.ZodBoolean>;
|
|
20
|
+
newTitle: z.ZodOptional<z.ZodString>;
|
|
21
|
+
newTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
22
|
+
newSummary: z.ZodOptional<z.ZodString>;
|
|
23
|
+
source: z.ZodDefault<z.ZodEnum<["local", "remote"]>>;
|
|
24
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
25
|
+
remoteUrl: z.ZodOptional<z.ZodString>;
|
|
26
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
27
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
28
|
+
format: z.ZodOptional<z.ZodEnum<["markdown", "json"]>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
messages: {
|
|
31
|
+
role: "user" | "assistant" | "system";
|
|
32
|
+
content: string;
|
|
33
|
+
timestamp?: string | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
source: "local" | "remote";
|
|
36
|
+
mode: "replace" | "append";
|
|
37
|
+
deduplicate: boolean;
|
|
38
|
+
title?: string | undefined;
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
format?: "markdown" | "json" | undefined;
|
|
41
|
+
apiKey?: string | undefined;
|
|
42
|
+
headers?: Record<string, string> | undefined;
|
|
43
|
+
remoteUrl?: string | undefined;
|
|
44
|
+
outputDir?: string | undefined;
|
|
45
|
+
newTitle?: string | undefined;
|
|
46
|
+
newTags?: string[] | undefined;
|
|
47
|
+
newSummary?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
messages: {
|
|
50
|
+
role: "user" | "assistant" | "system";
|
|
51
|
+
content: string;
|
|
52
|
+
timestamp?: string | undefined;
|
|
53
|
+
}[];
|
|
54
|
+
title?: string | undefined;
|
|
55
|
+
id?: string | undefined;
|
|
56
|
+
format?: "markdown" | "json" | undefined;
|
|
57
|
+
apiKey?: string | undefined;
|
|
58
|
+
headers?: Record<string, string> | undefined;
|
|
59
|
+
remoteUrl?: string | undefined;
|
|
60
|
+
outputDir?: string | undefined;
|
|
61
|
+
source?: "local" | "remote" | undefined;
|
|
62
|
+
mode?: "replace" | "append" | undefined;
|
|
63
|
+
deduplicate?: boolean | undefined;
|
|
64
|
+
newTitle?: string | undefined;
|
|
65
|
+
newTags?: string[] | undefined;
|
|
66
|
+
newSummary?: string | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
export type UpdateThreadInput = z.infer<typeof UpdateThreadInputSchema>;
|
|
69
|
+
export declare function updateThread(input: UpdateThreadInput): Promise<{
|
|
70
|
+
success: boolean;
|
|
71
|
+
error: string;
|
|
72
|
+
source: "local" | "remote";
|
|
73
|
+
id?: undefined;
|
|
74
|
+
title?: undefined;
|
|
75
|
+
filePath?: undefined;
|
|
76
|
+
remoteUrl?: undefined;
|
|
77
|
+
format?: undefined;
|
|
78
|
+
savedAt?: undefined;
|
|
79
|
+
messageCount?: undefined;
|
|
80
|
+
messagesAdded?: undefined;
|
|
81
|
+
mode?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
success: boolean;
|
|
84
|
+
error: string;
|
|
85
|
+
id: string | undefined;
|
|
86
|
+
source: "local" | "remote";
|
|
87
|
+
title?: undefined;
|
|
88
|
+
filePath?: undefined;
|
|
89
|
+
remoteUrl?: undefined;
|
|
90
|
+
format?: undefined;
|
|
91
|
+
savedAt?: undefined;
|
|
92
|
+
messageCount?: undefined;
|
|
93
|
+
messagesAdded?: undefined;
|
|
94
|
+
mode?: undefined;
|
|
95
|
+
} | {
|
|
96
|
+
success: boolean;
|
|
97
|
+
id: string;
|
|
98
|
+
title: string;
|
|
99
|
+
source: "local" | "remote";
|
|
100
|
+
filePath: string | undefined;
|
|
101
|
+
remoteUrl: string | undefined;
|
|
102
|
+
format: "markdown" | "json";
|
|
103
|
+
savedAt: string;
|
|
104
|
+
messageCount: number;
|
|
105
|
+
messagesAdded: number;
|
|
106
|
+
mode: "replace" | "append";
|
|
107
|
+
error?: undefined;
|
|
108
|
+
}>;
|
|
109
|
+
export declare const updateThreadTool: {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
inputSchema: z.ZodObject<{
|
|
113
|
+
id: z.ZodOptional<z.ZodString>;
|
|
114
|
+
title: z.ZodOptional<z.ZodString>;
|
|
115
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
116
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
117
|
+
content: z.ZodString;
|
|
118
|
+
timestamp: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
role: "user" | "assistant" | "system";
|
|
121
|
+
content: string;
|
|
122
|
+
timestamp?: string | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
role: "user" | "assistant" | "system";
|
|
125
|
+
content: string;
|
|
126
|
+
timestamp?: string | undefined;
|
|
127
|
+
}>, "many">;
|
|
128
|
+
mode: z.ZodDefault<z.ZodEnum<["append", "replace"]>>;
|
|
129
|
+
deduplicate: z.ZodDefault<z.ZodBoolean>;
|
|
130
|
+
newTitle: z.ZodOptional<z.ZodString>;
|
|
131
|
+
newTags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
132
|
+
newSummary: z.ZodOptional<z.ZodString>;
|
|
133
|
+
source: z.ZodDefault<z.ZodEnum<["local", "remote"]>>;
|
|
134
|
+
outputDir: z.ZodOptional<z.ZodString>;
|
|
135
|
+
remoteUrl: z.ZodOptional<z.ZodString>;
|
|
136
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
137
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
138
|
+
format: z.ZodOptional<z.ZodEnum<["markdown", "json"]>>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
messages: {
|
|
141
|
+
role: "user" | "assistant" | "system";
|
|
142
|
+
content: string;
|
|
143
|
+
timestamp?: string | undefined;
|
|
144
|
+
}[];
|
|
145
|
+
source: "local" | "remote";
|
|
146
|
+
mode: "replace" | "append";
|
|
147
|
+
deduplicate: boolean;
|
|
148
|
+
title?: string | undefined;
|
|
149
|
+
id?: string | undefined;
|
|
150
|
+
format?: "markdown" | "json" | undefined;
|
|
151
|
+
apiKey?: string | undefined;
|
|
152
|
+
headers?: Record<string, string> | undefined;
|
|
153
|
+
remoteUrl?: string | undefined;
|
|
154
|
+
outputDir?: string | undefined;
|
|
155
|
+
newTitle?: string | undefined;
|
|
156
|
+
newTags?: string[] | undefined;
|
|
157
|
+
newSummary?: string | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
messages: {
|
|
160
|
+
role: "user" | "assistant" | "system";
|
|
161
|
+
content: string;
|
|
162
|
+
timestamp?: string | undefined;
|
|
163
|
+
}[];
|
|
164
|
+
title?: string | undefined;
|
|
165
|
+
id?: string | undefined;
|
|
166
|
+
format?: "markdown" | "json" | undefined;
|
|
167
|
+
apiKey?: string | undefined;
|
|
168
|
+
headers?: Record<string, string> | undefined;
|
|
169
|
+
remoteUrl?: string | undefined;
|
|
170
|
+
outputDir?: string | undefined;
|
|
171
|
+
source?: "local" | "remote" | undefined;
|
|
172
|
+
mode?: "replace" | "append" | undefined;
|
|
173
|
+
deduplicate?: boolean | undefined;
|
|
174
|
+
newTitle?: string | undefined;
|
|
175
|
+
newTags?: string[] | undefined;
|
|
176
|
+
newSummary?: string | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
handler: typeof updateThread;
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=update-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-thread.d.ts","sourceRoot":"","sources":["../../src/tools/update-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0ClC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAmBxE,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8G1D;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ5B,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { OutputFormatSchema } from "../types.js";
|
|
3
|
+
import { getDefaultLocalStorage, createLocalStorage } from "../storage/local.js";
|
|
4
|
+
import { createRemoteStorage } from "../storage/remote.js";
|
|
5
|
+
export const UpdateThreadInputSchema = z.object({
|
|
6
|
+
// Lookup (use one)
|
|
7
|
+
id: z.string().optional().describe("ID of the thread to update"),
|
|
8
|
+
title: z.string().optional().describe("Find thread by exact title match"),
|
|
9
|
+
// Messages to add/replace
|
|
10
|
+
messages: z
|
|
11
|
+
.array(z.object({
|
|
12
|
+
role: z.enum(["user", "assistant", "system"]),
|
|
13
|
+
content: z.string(),
|
|
14
|
+
timestamp: z.string().optional(),
|
|
15
|
+
}))
|
|
16
|
+
.describe("Messages to append or replace with"),
|
|
17
|
+
mode: z
|
|
18
|
+
.enum(["append", "replace"])
|
|
19
|
+
.default("append")
|
|
20
|
+
.describe("'append' adds to existing messages, 'replace' overwrites all"),
|
|
21
|
+
deduplicate: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.default(true)
|
|
24
|
+
.describe("When appending, skip messages that already exist (by role+content)"),
|
|
25
|
+
// Metadata updates (optional)
|
|
26
|
+
newTitle: z.string().optional().describe("New title for the thread"),
|
|
27
|
+
newTags: z.array(z.string()).optional().describe("New tags (replaces existing)"),
|
|
28
|
+
newSummary: z.string().optional().describe("New summary"),
|
|
29
|
+
// Source
|
|
30
|
+
source: z
|
|
31
|
+
.enum(["local", "remote"])
|
|
32
|
+
.default("local")
|
|
33
|
+
.describe("Source where thread is stored"),
|
|
34
|
+
outputDir: z.string().optional().describe("Custom directory for local storage"),
|
|
35
|
+
remoteUrl: z.string().url().optional().describe("Remote server URL"),
|
|
36
|
+
apiKey: z.string().optional().describe("API key for remote"),
|
|
37
|
+
headers: z.record(z.string()).optional().describe("Additional headers for remote"),
|
|
38
|
+
format: OutputFormatSchema.optional().describe("Output format (keeps existing if not set)"),
|
|
39
|
+
});
|
|
40
|
+
function messagesEqual(a, b) {
|
|
41
|
+
return a.role === b.role && a.content === b.content;
|
|
42
|
+
}
|
|
43
|
+
function deduplicateMessages(existing, incoming) {
|
|
44
|
+
const newMessages = [];
|
|
45
|
+
for (const msg of incoming) {
|
|
46
|
+
const isDuplicate = existing.some((e) => messagesEqual(e, msg));
|
|
47
|
+
if (!isDuplicate) {
|
|
48
|
+
newMessages.push(msg);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return newMessages;
|
|
52
|
+
}
|
|
53
|
+
export async function updateThread(input) {
|
|
54
|
+
if (!input.id && !input.title) {
|
|
55
|
+
throw new Error("Either 'id' or 'title' must be provided to identify the thread");
|
|
56
|
+
}
|
|
57
|
+
if (input.source === "remote" && !input.remoteUrl) {
|
|
58
|
+
throw new Error("remoteUrl is required when source is 'remote'");
|
|
59
|
+
}
|
|
60
|
+
const storage = input.source === "remote"
|
|
61
|
+
? createRemoteStorage({
|
|
62
|
+
url: input.remoteUrl,
|
|
63
|
+
apiKey: input.apiKey,
|
|
64
|
+
headers: input.headers,
|
|
65
|
+
})
|
|
66
|
+
: input.outputDir
|
|
67
|
+
? createLocalStorage(input.outputDir)
|
|
68
|
+
: getDefaultLocalStorage();
|
|
69
|
+
// Find the thread
|
|
70
|
+
let threadId = input.id;
|
|
71
|
+
let existingInfo;
|
|
72
|
+
if (!threadId && input.title) {
|
|
73
|
+
const allInfos = await storage.list();
|
|
74
|
+
for (const info of allInfos) {
|
|
75
|
+
const conv = await storage.get(info.id);
|
|
76
|
+
if (conv && conv.metadata.title === input.title) {
|
|
77
|
+
threadId = info.id;
|
|
78
|
+
existingInfo = info;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!threadId) {
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: `Thread with title '${input.title}' not found`,
|
|
86
|
+
source: input.source,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const existing = await storage.get(threadId);
|
|
91
|
+
if (!existing) {
|
|
92
|
+
return {
|
|
93
|
+
success: false,
|
|
94
|
+
error: `Thread with ID '${threadId}' not found`,
|
|
95
|
+
id: threadId,
|
|
96
|
+
source: input.source,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// Get format from existing info if not provided
|
|
100
|
+
if (!existingInfo) {
|
|
101
|
+
const allInfos = await storage.list();
|
|
102
|
+
existingInfo = allInfos.find((i) => i.id === threadId);
|
|
103
|
+
}
|
|
104
|
+
const originalFormat = existingInfo?.format || "markdown";
|
|
105
|
+
// Build updated messages
|
|
106
|
+
let updatedMessages;
|
|
107
|
+
if (input.mode === "replace") {
|
|
108
|
+
updatedMessages = input.messages;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
const messagesToAdd = input.deduplicate
|
|
112
|
+
? deduplicateMessages(existing.messages, input.messages)
|
|
113
|
+
: input.messages;
|
|
114
|
+
updatedMessages = [...existing.messages, ...messagesToAdd];
|
|
115
|
+
}
|
|
116
|
+
// Build updated conversation
|
|
117
|
+
const updated = {
|
|
118
|
+
id: existing.id,
|
|
119
|
+
metadata: {
|
|
120
|
+
...existing.metadata,
|
|
121
|
+
title: input.newTitle ?? existing.metadata.title,
|
|
122
|
+
tags: input.newTags ?? existing.metadata.tags,
|
|
123
|
+
summary: input.newSummary ?? existing.metadata.summary,
|
|
124
|
+
updatedAt: new Date().toISOString(),
|
|
125
|
+
},
|
|
126
|
+
messages: updatedMessages,
|
|
127
|
+
};
|
|
128
|
+
const options = {
|
|
129
|
+
format: input.format ?? originalFormat,
|
|
130
|
+
includeMetadata: true,
|
|
131
|
+
includeTimestamps: true,
|
|
132
|
+
};
|
|
133
|
+
// Delete old and save updated
|
|
134
|
+
await storage.delete(existing.id);
|
|
135
|
+
const result = await storage.save(updated, options);
|
|
136
|
+
const messagesAdded = input.mode === "append" ? updatedMessages.length - existing.messages.length : updatedMessages.length;
|
|
137
|
+
return {
|
|
138
|
+
success: true,
|
|
139
|
+
id: result.id,
|
|
140
|
+
title: updated.metadata.title,
|
|
141
|
+
source: input.source,
|
|
142
|
+
filePath: result.filePath,
|
|
143
|
+
remoteUrl: result.remoteUrl,
|
|
144
|
+
format: result.format,
|
|
145
|
+
savedAt: result.savedAt,
|
|
146
|
+
messageCount: updatedMessages.length,
|
|
147
|
+
messagesAdded,
|
|
148
|
+
mode: input.mode,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export const updateThreadTool = {
|
|
152
|
+
name: "update_thread",
|
|
153
|
+
description: "Update an existing conversation thread. Can find by ID or title. " +
|
|
154
|
+
"Use 'append' mode to add new messages (with automatic deduplication). " +
|
|
155
|
+
"Use 'replace' mode to overwrite all messages. Can also update title, tags, and summary.",
|
|
156
|
+
inputSchema: UpdateThreadInputSchema,
|
|
157
|
+
handler: updateThread,
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=update-thread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-thread.js","sourceRoot":"","sources":["../../src/tools/update-thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,mBAAmB;IACnB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAChE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,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