corkcrm-mcp 0.8.0 → 0.10.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/dist/auth.d.ts +2 -0
- package/dist/auth.js +5 -0
- package/dist/auth.js.map +1 -1
- package/dist/changeFiles.d.ts +23 -0
- package/dist/changeFiles.js +239 -0
- package/dist/changeFiles.js.map +1 -0
- package/dist/descriptions.d.ts +1 -1
- package/dist/descriptions.js +8 -0
- package/dist/descriptions.js.map +1 -1
- package/dist/fileKinds.d.ts +36 -0
- package/dist/fileKinds.js +149 -0
- package/dist/fileKinds.js.map +1 -0
- package/dist/files.d.ts +24 -0
- package/dist/files.js +228 -0
- package/dist/files.js.map +1 -0
- package/dist/format.d.ts +2 -0
- package/dist/format.js +8 -4
- package/dist/format.js.map +1 -1
- package/dist/formatChangeFiles.d.ts +61 -0
- package/dist/formatChangeFiles.js +75 -0
- package/dist/formatChangeFiles.js.map +1 -0
- package/dist/formatFiles.d.ts +86 -0
- package/dist/formatFiles.js +82 -0
- package/dist/formatFiles.js.map +1 -0
- package/dist/help.d.ts +5 -5
- package/dist/help.js +42 -2
- package/dist/help.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/result.d.ts +12 -0
- package/dist/result.js +22 -0
- package/dist/result.js.map +1 -0
- package/dist/schemas.d.ts +27 -0
- package/dist/schemas.js +16 -0
- package/dist/schemas.js.map +1 -1
- package/dist/tools.js +9 -2
- package/dist/tools.js.map +1 -1
- package/dist/writeSchemas.d.ts +29 -0
- package/dist/writeSchemas.js +18 -2
- package/dist/writeSchemas.js.map +1 -1
- package/package.json +1 -1
package/dist/auth.d.ts
CHANGED
|
@@ -11,3 +11,5 @@ export declare function getConvexUrl(): string;
|
|
|
11
11
|
* Called once on first tool invocation.
|
|
12
12
|
*/
|
|
13
13
|
export declare function ensureAuthenticated(testFn: () => Promise<unknown>): Promise<void>;
|
|
14
|
+
/** The folder a download goes to when the call names none: CORK_DOWNLOAD_DIR, else null (files.ts uses ~/Downloads). */
|
|
15
|
+
export declare function getDownloadDir(): string | null;
|
package/dist/auth.js
CHANGED
|
@@ -37,4 +37,9 @@ export async function ensureAuthenticated(testFn) {
|
|
|
37
37
|
throw new Error(`API key validation failed: ${msg}`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
/** The folder a download goes to when the call names none: CORK_DOWNLOAD_DIR, else null (files.ts uses ~/Downloads). */
|
|
41
|
+
export function getDownloadDir() {
|
|
42
|
+
const dir = process.env.CORK_DOWNLOAD_DIR?.trim();
|
|
43
|
+
return dir ? dir : null;
|
|
44
|
+
}
|
|
40
45
|
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACrC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,iDAAiD;YAC/C,gDAAgD,CACnD,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IACnC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,+CAA+C;YAC7C,mFAAmF,CACtF,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAA8B;IAE9B,IAAI,SAAS;QAAE,OAAO;IACtB,IAAI,CAAC;QACH,MAAM,MAAM,EAAE,CAAC;QACf,SAAS,GAAG,IAAI,CA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AED,wHAAwH;AACxH,MAAM,UAAU,cAAc;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAClD,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
type Args = Record<string, unknown>;
|
|
3
|
+
/** One file ready to upload: its name, the MIME type it is sent with, and its bytes. */
|
|
4
|
+
type Upload = {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
size: number;
|
|
8
|
+
bytes: () => Promise<Uint8Array>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The local checks for paths, in the design's order, so a bad call never uploads: the count, then each
|
|
12
|
+
* path: absolute, there, a file and not a folder, at most 25 MB, a type the app takes.
|
|
13
|
+
*/
|
|
14
|
+
export declare function checkPaths(raw: unknown): Promise<Upload[]>;
|
|
15
|
+
/** The local checks for a text add: its length, then the name's extension, then its UTF-8 size. */
|
|
16
|
+
export declare function checkText(text: unknown, rawName: unknown): Upload;
|
|
17
|
+
/** POSTs one file's bytes to its upload URL with its MIME type; answers the storage ID. The URL never goes into an error. */
|
|
18
|
+
export declare function uploadBytes(url: string, file: {
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}, bytes: Uint8Array): Promise<string>;
|
|
22
|
+
export declare function runChangeFiles(args: Args): Promise<CallToolResult>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// The change_files tool's run path (Tool Design, "change_files"). add reads files from disk and uploads
|
|
2
|
+
// their bytes straight to Convex storage, so it runs here instead of through the shared callback in tools.ts.
|
|
3
|
+
// Backend actions: upload_start, add, discard, rename, move, copy, delete (write/files.ts).
|
|
4
|
+
import { readFile, stat } from "node:fs/promises";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import { basename, isAbsolute, join } from "node:path";
|
|
7
|
+
import { callTool } from "./client.js";
|
|
8
|
+
import { FILES_PER_CALL, formatSize, isTextType, MAX_FILE_SIZE, TEXT_ADD_MAX, typeOfName, TYPES_SENTENCE, } from "./fileKinds.js";
|
|
9
|
+
import { formatChangeFiles, formatFilePreview, isFilePreview, } from "./formatChangeFiles.js";
|
|
10
|
+
import { errorResult, refuse, textResult, ToolRefusal } from "./result.js";
|
|
11
|
+
const TOOL = "change_files";
|
|
12
|
+
const NOTHING_CHANGED = "Nothing changed.";
|
|
13
|
+
const UPLOAD_TIMEOUT_MS = 120_000;
|
|
14
|
+
// The arguments each action takes; anything else is bad_argument, naming it (Tool Design, Arguments).
|
|
15
|
+
const TAKES = {
|
|
16
|
+
add: ["action", "task", "paths", "text", "name"],
|
|
17
|
+
rename: ["action", "task", "files", "name"],
|
|
18
|
+
move: ["action", "task", "files", "to"],
|
|
19
|
+
copy: ["action", "task", "files", "to"],
|
|
20
|
+
delete: ["action", "task", "files", "confirm_token"],
|
|
21
|
+
};
|
|
22
|
+
/** Every change_files refusal ends "Nothing changed." (write rule 7); a sentence may carry it already. */
|
|
23
|
+
const withNothingChanged = (m) => (m.includes(NOTHING_CHANGED) ? m : `${m.trimEnd()} ${NOTHING_CHANGED}`);
|
|
24
|
+
/** "That's 11 files, over the limit of 10 per call. ..." (W68 (b) for add; write/cap.ts). */
|
|
25
|
+
function checkPerCall(count, action) {
|
|
26
|
+
if (count <= FILES_PER_CALL)
|
|
27
|
+
return;
|
|
28
|
+
const split = action === "add" ? "Add them in two calls, or zip them." : `${action[0].toUpperCase()}${action.slice(1)} them in two calls.`;
|
|
29
|
+
refuse("over_limit", `That's ${count} files, over the limit of ${FILES_PER_CALL} per call. ${split}`);
|
|
30
|
+
}
|
|
31
|
+
function checkArgs(action, args) {
|
|
32
|
+
for (const key of Object.keys(args)) {
|
|
33
|
+
if (args[key] === undefined || TAKES[action].includes(key))
|
|
34
|
+
continue;
|
|
35
|
+
if (key === "confirm_token")
|
|
36
|
+
refuse("bad_argument", `${action} doesn't take confirm_token; only a delete's second call does.`);
|
|
37
|
+
refuse("bad_argument", `${action} doesn't take ${key}.`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof args.task !== "string" || !args.task.trim()) {
|
|
40
|
+
refuse("bad_argument", "task is required: the alpha-ID of a milestone, task, or subtask.");
|
|
41
|
+
}
|
|
42
|
+
if (action !== "add") {
|
|
43
|
+
if (!Array.isArray(args.files))
|
|
44
|
+
refuse("bad_argument", `files is required: the names or IDs of the files to ${action}.`);
|
|
45
|
+
checkPerCall(args.files.length, action);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** "~/Desktop/a.pdf" -> "/Users/me/Desktop/a.pdf". */
|
|
49
|
+
const expandHome = (p) => (p === "~" ? homedir() : p.startsWith("~/") ? join(homedir(), p.slice(2)) : p);
|
|
50
|
+
/**
|
|
51
|
+
* The local checks for paths, in the design's order, so a bad call never uploads: the count, then each
|
|
52
|
+
* path: absolute, there, a file and not a folder, at most 25 MB, a type the app takes.
|
|
53
|
+
*/
|
|
54
|
+
export async function checkPaths(raw) {
|
|
55
|
+
const paths = raw;
|
|
56
|
+
checkPerCall(paths.length, "add");
|
|
57
|
+
const uploads = [];
|
|
58
|
+
for (const given of paths) {
|
|
59
|
+
const path = expandHome(given.trim());
|
|
60
|
+
if (!isAbsolute(path))
|
|
61
|
+
refuse("bad_argument", `paths must be absolute, like /Users/you/Desktop/spec.pdf. Got '${given}'.`);
|
|
62
|
+
let info;
|
|
63
|
+
try {
|
|
64
|
+
info = await stat(path);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return refuse("not_found", `No file at ${path}.`);
|
|
68
|
+
}
|
|
69
|
+
const name = basename(path);
|
|
70
|
+
if (info.isDirectory()) {
|
|
71
|
+
refuse("bad_argument", `'${name}' is a folder. Name the files, up to ${FILES_PER_CALL}, or zip the folder and add the zip.`);
|
|
72
|
+
}
|
|
73
|
+
if (!info.isFile())
|
|
74
|
+
refuse("bad_argument", `${path} isn't a regular file.`);
|
|
75
|
+
if (info.size > MAX_FILE_SIZE)
|
|
76
|
+
refuse("over_limit", `'${name}' is ${formatSize(info.size)}, over the app's 25 MB limit per file.`);
|
|
77
|
+
const type = typeOfName(name);
|
|
78
|
+
if (!type)
|
|
79
|
+
refuse("not_allowed", `'${name}' is a type the app doesn't take. ${TYPES_SENTENCE}`);
|
|
80
|
+
uploads.push({ name, type: type, size: info.size, bytes: async () => new Uint8Array(await readFile(path)) });
|
|
81
|
+
}
|
|
82
|
+
return uploads;
|
|
83
|
+
}
|
|
84
|
+
/** The local checks for a text add: its length, then the name's extension, then its UTF-8 size. */
|
|
85
|
+
export function checkText(text, rawName) {
|
|
86
|
+
const body = text;
|
|
87
|
+
if (body.length > TEXT_ADD_MAX) {
|
|
88
|
+
refuse("over_limit", `The text is ${body.length.toLocaleString("en-US")} characters, over the limit of ${TEXT_ADD_MAX.toLocaleString("en-US")} for a text add. Split it, or save it as a file and add the path.`);
|
|
89
|
+
}
|
|
90
|
+
if (typeof rawName !== "string" || !rawName.trim()) {
|
|
91
|
+
refuse("bad_argument", "add with text needs name: the file name with its extension, like notes.md.");
|
|
92
|
+
}
|
|
93
|
+
const name = rawName.trim();
|
|
94
|
+
const type = typeOfName(name);
|
|
95
|
+
if (!type || !isTextType(type)) {
|
|
96
|
+
refuse("bad_argument", `'${name}' needs a text extension: .md, .txt, .csv, .json, .html, .css, or .js.`);
|
|
97
|
+
}
|
|
98
|
+
const bytes = new TextEncoder().encode(body);
|
|
99
|
+
if (bytes.length > MAX_FILE_SIZE)
|
|
100
|
+
refuse("over_limit", `'${name}' is ${formatSize(bytes.length)}, over the app's 25 MB limit per file.`);
|
|
101
|
+
return { name, type: type, size: bytes.length, bytes: async () => bytes };
|
|
102
|
+
}
|
|
103
|
+
/** A backend call; a refusal comes back as a ToolRefusal with the backend's error. */
|
|
104
|
+
async function backend(args) {
|
|
105
|
+
const result = await callTool(TOOL, args);
|
|
106
|
+
if (!result.ok)
|
|
107
|
+
throw new ToolRefusal(result.error);
|
|
108
|
+
return result.data;
|
|
109
|
+
}
|
|
110
|
+
/** POSTs one file's bytes to its upload URL with its MIME type; answers the storage ID. The URL never goes into an error. */
|
|
111
|
+
export async function uploadBytes(url, file, bytes) {
|
|
112
|
+
let response;
|
|
113
|
+
try {
|
|
114
|
+
response = await fetch(url, {
|
|
115
|
+
method: "POST",
|
|
116
|
+
headers: { "Content-Type": file.type },
|
|
117
|
+
body: bytes, // Node takes any Uint8Array; the DOM types want an ArrayBuffer-backed one
|
|
118
|
+
signal: AbortSignal.timeout(UPLOAD_TIMEOUT_MS),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
const message = (e instanceof Error ? e.message : String(e)).split(url).join("the upload URL");
|
|
123
|
+
throw new Error(`Could not upload '${file.name}': ${message}.`);
|
|
124
|
+
}
|
|
125
|
+
if (!response.ok)
|
|
126
|
+
throw new Error(`Could not upload '${file.name}' (HTTP ${response.status}).`);
|
|
127
|
+
let storageId;
|
|
128
|
+
try {
|
|
129
|
+
storageId = (await response.json()).storageId;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
storageId = undefined;
|
|
133
|
+
}
|
|
134
|
+
if (typeof storageId !== "string" || !storageId)
|
|
135
|
+
throw new Error(`Could not upload '${file.name}': no storage ID came back.`);
|
|
136
|
+
return storageId;
|
|
137
|
+
}
|
|
138
|
+
/** Deletes this call's uploads that have no file row. Best effort: its own failure never hides the first error. */
|
|
139
|
+
async function discard(storageIds) {
|
|
140
|
+
if (!storageIds.length)
|
|
141
|
+
return;
|
|
142
|
+
try {
|
|
143
|
+
await callTool(TOOL, { action: "discard", storage_ids: storageIds });
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// The backend's add already discards on its own refusals; an upload left behind expires unused.
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async function add(args) {
|
|
150
|
+
if (args.paths !== undefined && args.text !== undefined) {
|
|
151
|
+
refuse("bad_argument", "add takes paths or text, not both. Add the text file in its own call.");
|
|
152
|
+
}
|
|
153
|
+
if (args.paths !== undefined && args.name !== undefined) {
|
|
154
|
+
refuse("bad_argument", "add with paths doesn't take name; each file keeps its own name. Rename it after.");
|
|
155
|
+
}
|
|
156
|
+
if (args.paths === undefined && args.text === undefined) {
|
|
157
|
+
refuse("bad_argument", "add needs paths (absolute file paths) or text plus name.");
|
|
158
|
+
}
|
|
159
|
+
const uploads = args.paths !== undefined ? await checkPaths(args.paths) : [checkText(args.text, args.name)];
|
|
160
|
+
const task = args.task.trim();
|
|
161
|
+
// Nothing is written until add: upload_start checks the item, its count, and each declared size and type.
|
|
162
|
+
const start = await backend({
|
|
163
|
+
action: "upload_start",
|
|
164
|
+
task,
|
|
165
|
+
files: uploads.map((u) => ({ name: u.name, size: u.size, type: u.type })),
|
|
166
|
+
});
|
|
167
|
+
const stored = [];
|
|
168
|
+
try {
|
|
169
|
+
for (const [i, u] of uploads.entries())
|
|
170
|
+
stored.push(await uploadBytes(start.upload_urls[i], u, await u.bytes()));
|
|
171
|
+
return await backend({
|
|
172
|
+
action: "add",
|
|
173
|
+
task,
|
|
174
|
+
files: uploads.map((u, i) => ({ storage_id: stored[i], name: u.name })),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
await discard(stored);
|
|
179
|
+
throw e;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** structuredContent: text first, then the change; never the backend's summary or a storage URL. */
|
|
183
|
+
function fieldsOf(r) {
|
|
184
|
+
const small = (f) => ({ id: f.id, name: f.name, kind: f.kind, size: f.size });
|
|
185
|
+
if (isFilePreview(r)) {
|
|
186
|
+
return {
|
|
187
|
+
action: "delete",
|
|
188
|
+
preview: true,
|
|
189
|
+
task: r.task,
|
|
190
|
+
files: r.files.map((f) => ({ ...small(f), added_by: f.added_by, added_at: f.added_at })),
|
|
191
|
+
count: r.count,
|
|
192
|
+
confirm_token: r.confirm_token,
|
|
193
|
+
expires_at: r.expires_at,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
const out = { action: r.action, task: r.task };
|
|
197
|
+
if ("to" in r)
|
|
198
|
+
out.to = r.to;
|
|
199
|
+
out.files = r.files.map(small);
|
|
200
|
+
out.count = r.count;
|
|
201
|
+
if ("source_count" in r)
|
|
202
|
+
out.source_count = r.source_count;
|
|
203
|
+
if ("same_name" in r)
|
|
204
|
+
out.same_name = r.same_name.map((s) => ({ id: s.id, name: s.older_name, added_at: s.added_at }));
|
|
205
|
+
if ("unchanged" in r) {
|
|
206
|
+
out.old_name = r.old_name;
|
|
207
|
+
out.unchanged = r.unchanged;
|
|
208
|
+
}
|
|
209
|
+
return out;
|
|
210
|
+
}
|
|
211
|
+
/** A refusal: the sentence ending "Nothing changed.", and for a refused delete confirm, the fresh preview. */
|
|
212
|
+
function refusal(error) {
|
|
213
|
+
const message = withNothingChanged(error.message);
|
|
214
|
+
if (error.code === "confirm_required" && isFilePreview(error.details)) {
|
|
215
|
+
const text = `${message}\n${formatFilePreview(error.details)}`;
|
|
216
|
+
return { content: [{ type: "text", text }], structuredContent: { text, error: { ...error, message } }, isError: true };
|
|
217
|
+
}
|
|
218
|
+
// The ambiguous sentence already lists the files with dates, sizes, and IDs; don't print them twice.
|
|
219
|
+
const shown = error.code === "ambiguous" ? { ...error, message, candidates: undefined } : { ...error, message };
|
|
220
|
+
const result = errorResult(TOOL, shown);
|
|
221
|
+
return { ...result, structuredContent: { ...result.structuredContent, error: { ...error, message } } };
|
|
222
|
+
}
|
|
223
|
+
export async function runChangeFiles(args) {
|
|
224
|
+
try {
|
|
225
|
+
const action = args.action;
|
|
226
|
+
checkArgs(action, args);
|
|
227
|
+
const data = action === "add"
|
|
228
|
+
? await add(args)
|
|
229
|
+
: await backend(Object.fromEntries(Object.entries(args).filter(([, v]) => v !== undefined)));
|
|
230
|
+
return textResult(formatChangeFiles(data), fieldsOf(data));
|
|
231
|
+
}
|
|
232
|
+
catch (e) {
|
|
233
|
+
if (e instanceof ToolRefusal)
|
|
234
|
+
return refusal(e.error);
|
|
235
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
236
|
+
return refusal({ code: "internal", message });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=changeFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeFiles.js","sourceRoot":"","sources":["../src/changeFiles.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,8GAA8G;AAC9G,4FAA4F;AAG5F,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,GAId,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK3E,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAC3C,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC,sGAAsG;AACtG,MAAM,KAAK,GAA6B;IACtC,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;IAChD,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAA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W,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;QACpH,OAAO,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,WAAW;YAAE,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
package/dist/descriptions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ToolName = "find_tasks" | "get_task" | "count_tasks" | "list_views" | "list_projects" | "get_workspace_info" | "resolve" | "find_timecards" | "sum_time" | "find_comments" | "create_task" | "update_task" | "place_task" | "set_order" | "bulk_update_tasks" | "move_task" | "delete_task" | "add_comment" | "edit_comment" | "delete_comment" | "link_pull_request" | "help";
|
|
1
|
+
export type ToolName = "find_tasks" | "get_task" | "count_tasks" | "list_views" | "list_projects" | "get_workspace_info" | "resolve" | "find_timecards" | "sum_time" | "find_comments" | "files" | "change_files" | "create_task" | "update_task" | "place_task" | "set_order" | "bulk_update_tasks" | "move_task" | "delete_task" | "add_comment" | "edit_comment" | "delete_comment" | "link_pull_request" | "help";
|
|
2
2
|
export declare const DESCRIPTIONS: Record<ToolName, {
|
|
3
3
|
title: string;
|
|
4
4
|
description: string;
|
package/dist/descriptions.js
CHANGED
|
@@ -86,6 +86,14 @@ export const DESCRIPTIONS = {
|
|
|
86
86
|
title: "Link a pull request",
|
|
87
87
|
description: `Attaches a GitHub pull request to a task. Usually not needed: a pull request whose branch, title, or body has the task's alpha-ID links itself. Use it for one that can't mention the ID. More: help topic link_pull_request.`,
|
|
88
88
|
},
|
|
89
|
+
files: {
|
|
90
|
+
title: "Files",
|
|
91
|
+
description: `Lists, finds, reads, or downloads files on a milestone, task, or subtask. No answer holds a whole file: list and find give names and sizes; read gives one part (text by lines, an image, or other types saved to disk); download saves to a folder. More: help topic files.`,
|
|
92
|
+
},
|
|
93
|
+
change_files: {
|
|
94
|
+
title: "Change files",
|
|
95
|
+
description: `Adds, renames, moves, copies, or deletes files on a milestone, task, or subtask. add takes absolute paths, or text plus a name: 10 files per call, 10 per item, 25 MB each. To edit a file, download it, change it, add the copy. delete previews first: show it, wait for a yes, never confirm in the same turn. More: help topic change_files.`,
|
|
96
|
+
},
|
|
89
97
|
help: {
|
|
90
98
|
title: "CorkTasks help",
|
|
91
99
|
description: `Rules and examples for the corktasks tools: how search matches, what is hidden by default, dev views, dates, paging, placement, and answer style. Call it once before your first corktasks call in a chat, and with a topic before a tool you haven't used or after an error.`,
|
package/dist/descriptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../src/descriptions.ts"],"names":[],"mappings":"AA0BA,2GAA2G;AAC3G,gGAAgG;AAChG,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAA6D;IACpF,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,6gBAA6gB;KAC3hB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kUAAkU;KAChV;IACD,WAAW,EAAE;QACX,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,qRAAqR;KACnS;IACD,UAAU,EAAE;QACV,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KAC/M;IACD,iBAAiB,EAAE;QACjB,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,+NAA+N;KAC7O;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,8QAA8Q;KAC5R;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,kVAAkV;KAChW;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,+QAA+Q;KAC7R;CACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const MAX_FILE_SIZE: number;
|
|
2
|
+
export declare const MAX_FILES_PER_TASK = 10;
|
|
3
|
+
export declare const IMAGE_READ_MAX = 3670016;
|
|
4
|
+
export declare const READ_LINES_DEFAULT = 200;
|
|
5
|
+
export declare const READ_LINES_MAX = 500;
|
|
6
|
+
export declare const READ_CHARS_MAX = 40000;
|
|
7
|
+
export declare const FILES_PER_CALL = 10;
|
|
8
|
+
export declare const TEXT_ADD_MAX = 100000;
|
|
9
|
+
/** The kinds the app takes, in words (read/fileShared.ts TYPES_SENTENCE). */
|
|
10
|
+
export declare const TYPES_SENTENCE = "It takes PDF, Word, Excel, images (PNG, JPEG, GIF, WebP), text, CSV, Markdown, JSON, HTML, CSS, JavaScript, and ZIP.";
|
|
11
|
+
/** Extension to the MIME type an upload is stored with. */
|
|
12
|
+
export declare const EXTENSION_TYPES: Record<string, string>;
|
|
13
|
+
/** "text/markdown; charset=utf-8" -> "text/markdown". */
|
|
14
|
+
export declare const baseType: (type: string | undefined) => string;
|
|
15
|
+
/** "Spec.PDF" -> "pdf"; no extension -> "". */
|
|
16
|
+
export declare function extensionOf(name: string): string;
|
|
17
|
+
/** The MIME type an upload of this name is sent with, or undefined for a type the app doesn't take. */
|
|
18
|
+
export declare function typeOfName(name: string): string | undefined;
|
|
19
|
+
/** A MIME type in words: "PDF", "Markdown", "PNG". An unknown type prints as is. */
|
|
20
|
+
export declare const typeWords: (type: string) => string;
|
|
21
|
+
/** Text kinds are read by lines: text/* and JSON. */
|
|
22
|
+
export declare const isTextType: (type: string) => boolean;
|
|
23
|
+
export declare const isImageType: (type: string) => boolean;
|
|
24
|
+
/** "512 B", "39 KB" (whole), "5.2 MB" (one decimal). */
|
|
25
|
+
export declare function formatSize(bytes: number): string;
|
|
26
|
+
/** A name safe to write in one folder: no slashes, NUL, "..", or leading dots; empty becomes "file". */
|
|
27
|
+
export declare function cleanName(name: string): string;
|
|
28
|
+
/** "spec.pdf", n 2 -> "spec (2).pdf"; a name with no extension gets the number at the end. */
|
|
29
|
+
export declare function numberedName(name: string, n: number): string;
|
|
30
|
+
/**
|
|
31
|
+
* Writes bytes to `folder` under the cleaned name, never overwriting: a taken name gets " (1)", " (2)".
|
|
32
|
+
* The wx flag makes a race between the check and the write fail instead of overwrite.
|
|
33
|
+
*/
|
|
34
|
+
export declare function writeNew(folder: string, name: string, bytes: Uint8Array): Promise<string>;
|
|
35
|
+
/** Fetches a stored copy's bytes. The URL never goes into an error message. */
|
|
36
|
+
export declare function fetchBytes(url: string, name: string): Promise<Uint8Array>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Shared file facts for the file tools: the app's limits, MIME types in words, sizes, and safe names on disk.
|
|
2
|
+
// Copied from convex/routes/tasks/files.ts and convex/routes/mcp/read/fileShared.ts; the package can't import
|
|
3
|
+
// Convex code, so keep these in step by hand (Tool Design, "Limits").
|
|
4
|
+
import { constants } from "node:fs";
|
|
5
|
+
import { open } from "node:fs/promises";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
export const MAX_FILE_SIZE = 25 * 1024 * 1024; // 26,214,400 bytes
|
|
8
|
+
export const MAX_FILES_PER_TASK = 10;
|
|
9
|
+
export const IMAGE_READ_MAX = 3_670_016; // 3.5 MB
|
|
10
|
+
export const READ_LINES_DEFAULT = 200;
|
|
11
|
+
export const READ_LINES_MAX = 500;
|
|
12
|
+
export const READ_CHARS_MAX = 40_000;
|
|
13
|
+
export const FILES_PER_CALL = 10; // change_files: add, move, copy, delete (write/cap.ts)
|
|
14
|
+
export const TEXT_ADD_MAX = 100_000; // change_files: characters in a text add (write/cap.ts)
|
|
15
|
+
/** The kinds the app takes, in words (read/fileShared.ts TYPES_SENTENCE). */
|
|
16
|
+
export const TYPES_SENTENCE = "It takes PDF, Word, Excel, images (PNG, JPEG, GIF, WebP), text, CSV, Markdown, JSON, HTML, CSS, JavaScript, and ZIP.";
|
|
17
|
+
/** Extension to the MIME type an upload is stored with. */
|
|
18
|
+
export const EXTENSION_TYPES = {
|
|
19
|
+
pdf: "application/pdf",
|
|
20
|
+
doc: "application/msword",
|
|
21
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
22
|
+
xls: "application/vnd.ms-excel",
|
|
23
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
24
|
+
txt: "text/plain",
|
|
25
|
+
csv: "text/csv",
|
|
26
|
+
md: "text/markdown",
|
|
27
|
+
markdown: "text/markdown",
|
|
28
|
+
png: "image/png",
|
|
29
|
+
jpg: "image/jpeg",
|
|
30
|
+
jpeg: "image/jpeg",
|
|
31
|
+
gif: "image/gif",
|
|
32
|
+
webp: "image/webp",
|
|
33
|
+
json: "application/json",
|
|
34
|
+
html: "text/html",
|
|
35
|
+
htm: "text/html",
|
|
36
|
+
css: "text/css",
|
|
37
|
+
js: "text/javascript",
|
|
38
|
+
mjs: "text/javascript",
|
|
39
|
+
zip: "application/zip",
|
|
40
|
+
};
|
|
41
|
+
const TYPE_WORDS = {
|
|
42
|
+
"application/pdf": "PDF",
|
|
43
|
+
"application/msword": "Word",
|
|
44
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "Word",
|
|
45
|
+
"application/vnd.ms-excel": "Excel",
|
|
46
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "Excel",
|
|
47
|
+
"text/csv": "CSV",
|
|
48
|
+
"text/markdown": "Markdown",
|
|
49
|
+
"text/plain": "text",
|
|
50
|
+
"application/json": "JSON",
|
|
51
|
+
"text/html": "HTML",
|
|
52
|
+
"text/css": "CSS",
|
|
53
|
+
"text/javascript": "JavaScript",
|
|
54
|
+
"image/png": "PNG",
|
|
55
|
+
"image/jpeg": "JPEG",
|
|
56
|
+
"image/gif": "GIF",
|
|
57
|
+
"image/webp": "WebP",
|
|
58
|
+
"application/zip": "ZIP",
|
|
59
|
+
"application/x-zip-compressed": "ZIP",
|
|
60
|
+
};
|
|
61
|
+
const IMAGE_TYPES = ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
62
|
+
/** "text/markdown; charset=utf-8" -> "text/markdown". */
|
|
63
|
+
export const baseType = (type) => (type ?? "").split(";")[0].trim().toLowerCase();
|
|
64
|
+
/** "Spec.PDF" -> "pdf"; no extension -> "". */
|
|
65
|
+
export function extensionOf(name) {
|
|
66
|
+
const dot = name.lastIndexOf(".");
|
|
67
|
+
return dot > 0 ? name.slice(dot + 1).toLowerCase() : "";
|
|
68
|
+
}
|
|
69
|
+
/** The MIME type an upload of this name is sent with, or undefined for a type the app doesn't take. */
|
|
70
|
+
export function typeOfName(name) {
|
|
71
|
+
const ext = extensionOf(name);
|
|
72
|
+
return Object.hasOwn(EXTENSION_TYPES, ext) ? EXTENSION_TYPES[ext] : undefined;
|
|
73
|
+
}
|
|
74
|
+
/** A MIME type in words: "PDF", "Markdown", "PNG". An unknown type prints as is. */
|
|
75
|
+
export const typeWords = (type) => TYPE_WORDS[baseType(type)] ?? (baseType(type) || "file");
|
|
76
|
+
/** Text kinds are read by lines: text/* and JSON. */
|
|
77
|
+
export const isTextType = (type) => {
|
|
78
|
+
const t = baseType(type);
|
|
79
|
+
return t.startsWith("text/") || t === "application/json";
|
|
80
|
+
};
|
|
81
|
+
export const isImageType = (type) => IMAGE_TYPES.includes(baseType(type));
|
|
82
|
+
/** "512 B", "39 KB" (whole), "5.2 MB" (one decimal). */
|
|
83
|
+
export function formatSize(bytes) {
|
|
84
|
+
if (bytes < 1024)
|
|
85
|
+
return `${bytes} B`;
|
|
86
|
+
if (bytes < 1024 * 1024)
|
|
87
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
88
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
89
|
+
}
|
|
90
|
+
/** A name safe to write in one folder: no slashes, NUL, "..", or leading dots; empty becomes "file". */
|
|
91
|
+
export function cleanName(name) {
|
|
92
|
+
const cleaned = name
|
|
93
|
+
.replace(/\0/g, "")
|
|
94
|
+
.replace(/[/\\]/g, "-")
|
|
95
|
+
.replace(/\.\./g, "")
|
|
96
|
+
.replace(/^[.\s]+/, "")
|
|
97
|
+
.trim();
|
|
98
|
+
return cleaned || "file";
|
|
99
|
+
}
|
|
100
|
+
/** "spec.pdf", n 2 -> "spec (2).pdf"; a name with no extension gets the number at the end. */
|
|
101
|
+
export function numberedName(name, n) {
|
|
102
|
+
if (n === 0)
|
|
103
|
+
return name;
|
|
104
|
+
const dot = name.lastIndexOf(".");
|
|
105
|
+
return dot > 0 ? `${name.slice(0, dot)} (${n})${name.slice(dot)}` : `${name} (${n})`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Writes bytes to `folder` under the cleaned name, never overwriting: a taken name gets " (1)", " (2)".
|
|
109
|
+
* The wx flag makes a race between the check and the write fail instead of overwrite.
|
|
110
|
+
*/
|
|
111
|
+
export async function writeNew(folder, name, bytes) {
|
|
112
|
+
const clean = cleanName(name);
|
|
113
|
+
for (let n = 0; n < 1000; n++) {
|
|
114
|
+
const path = join(folder, numberedName(clean, n));
|
|
115
|
+
let handle;
|
|
116
|
+
try {
|
|
117
|
+
handle = await open(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 0o644);
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
if (e.code === "EEXIST")
|
|
121
|
+
continue;
|
|
122
|
+
throw e;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
await handle.writeFile(bytes);
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
await handle.close();
|
|
129
|
+
}
|
|
130
|
+
return path;
|
|
131
|
+
}
|
|
132
|
+
throw new Error(`Too many files named '${clean}' in ${folder}.`);
|
|
133
|
+
}
|
|
134
|
+
const FETCH_TIMEOUT_MS = 60_000;
|
|
135
|
+
/** Fetches a stored copy's bytes. The URL never goes into an error message. */
|
|
136
|
+
export async function fetchBytes(url, name) {
|
|
137
|
+
let response;
|
|
138
|
+
try {
|
|
139
|
+
response = await fetch(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
const message = (e instanceof Error ? e.message : String(e)).split(url).join("the stored copy");
|
|
143
|
+
throw new Error(`Could not fetch '${name}': ${message}.`);
|
|
144
|
+
}
|
|
145
|
+
if (!response.ok)
|
|
146
|
+
throw new Error(`Could not fetch '${name}' (HTTP ${response.status}).`);
|
|
147
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=fileKinds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileKinds.js","sourceRoot":"","sources":["../src/fileKinds.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,8GAA8G;AAC9G,sEAAsE;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,SAAS;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GA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,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAChG,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,MAAM,OAAO,GAAG,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,WAAW,QAAQ,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1F,OAAO,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { type ReadPart } from "./formatFiles.js";
|
|
3
|
+
type Args = Record<string, unknown>;
|
|
4
|
+
/** The temp folder PDF, Word, Excel, and ZIP reads are saved to. */
|
|
5
|
+
export declare const readFolder: () => string;
|
|
6
|
+
/** "201-400" or "7" to a 1-based inclusive range; badly formed is bad_argument. */
|
|
7
|
+
export declare function parseLines(raw: string | undefined): {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
};
|
|
11
|
+
/** Splits text into lines on \n (a \r stays); a final newline doesn't add an empty line. */
|
|
12
|
+
export declare function splitLines(text: string): string[];
|
|
13
|
+
/** The asked lines, cut to 500 lines, then to 40,000 characters at a full line. */
|
|
14
|
+
export declare function readPart(name: string, all: string[], asked: {
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
}): {
|
|
18
|
+
part: ReadPart;
|
|
19
|
+
body: string;
|
|
20
|
+
};
|
|
21
|
+
/** The download folder: folder, else CORK_DOWNLOAD_DIR, else ~/Downloads. It must exist; it is never created. */
|
|
22
|
+
export declare function downloadFolder(folder: string | undefined): Promise<string>;
|
|
23
|
+
export declare function runFiles(args: Args): Promise<CallToolResult>;
|
|
24
|
+
export {};
|