@rnsk/toolkits 0.0.4 → 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/README.md +13 -8
- package/dist/core/index.d.ts +1 -1
- package/dist/core/types.d.ts +43 -1
- package/dist/core/validate.d.ts +1 -1
- package/dist/core/validate.js +14 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -1
- package/dist/toolkits/aws/icon.d.ts +5 -0
- package/dist/toolkits/aws/icon.js +41 -0
- package/dist/toolkits/aws/manifest.d.ts +3 -0
- package/dist/toolkits/aws/manifest.js +27 -0
- package/dist/toolkits/aws/tools/client.d.ts +13 -0
- package/dist/toolkits/aws/tools/client.js +25 -0
- package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.d.ts +26 -0
- package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.js +45 -0
- package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.d.ts +35 -0
- package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.js +62 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-alarms.d.ts +29 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-alarms.js +46 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.d.ts +25 -0
- package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.js +38 -0
- package/dist/toolkits/aws/tools/ec2/get-instance.d.ts +65 -0
- package/dist/toolkits/aws/tools/ec2/get-instance.js +46 -0
- package/dist/toolkits/aws/tools/ec2/list-instances.d.ts +30 -0
- package/dist/toolkits/aws/tools/ec2/list-instances.js +46 -0
- package/dist/toolkits/aws/tools/ec2/start-instance.d.ts +24 -0
- package/dist/toolkits/aws/tools/ec2/start-instance.js +31 -0
- package/dist/toolkits/aws/tools/ec2/stop-instance.d.ts +24 -0
- package/dist/toolkits/aws/tools/ec2/stop-instance.js +31 -0
- package/dist/toolkits/aws/tools/index.d.ts +273 -0
- package/dist/toolkits/aws/tools/index.js +68 -0
- package/dist/toolkits/gcp/icon.d.ts +5 -0
- package/dist/toolkits/gcp/icon.js +5 -0
- package/dist/toolkits/gcp/manifest.d.ts +3 -0
- package/dist/toolkits/gcp/manifest.js +27 -0
- package/dist/toolkits/gcp/tools/client.d.ts +12 -0
- package/dist/toolkits/gcp/tools/client.js +24 -0
- package/dist/toolkits/gcp/tools/compute/get-instance.d.ts +36 -0
- package/dist/toolkits/gcp/tools/compute/get-instance.js +37 -0
- package/dist/toolkits/gcp/tools/compute/list-instances.d.ts +20 -0
- package/dist/toolkits/gcp/tools/compute/list-instances.js +62 -0
- package/dist/toolkits/gcp/tools/compute/start-instance.d.ts +27 -0
- package/dist/toolkits/gcp/tools/compute/start-instance.js +29 -0
- package/dist/toolkits/gcp/tools/compute/stop-instance.d.ts +27 -0
- package/dist/toolkits/gcp/tools/compute/stop-instance.js +29 -0
- package/dist/toolkits/gcp/tools/index.d.ts +162 -0
- package/dist/toolkits/gcp/tools/index.js +52 -0
- package/dist/toolkits/gcp/tools/monitoring/get-metrics.d.ts +26 -0
- package/dist/toolkits/gcp/tools/monitoring/get-metrics.js +53 -0
- package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.d.ts +24 -0
- package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.js +40 -0
- package/dist/toolkits/gmail/manifest.js +1 -1
- package/dist/toolkits/google-calendar/manifest.js +1 -6
- package/dist/toolkits/google-docs/icon.d.ts +5 -0
- package/dist/toolkits/google-docs/icon.js +6 -0
- package/dist/toolkits/google-docs/manifest.d.ts +3 -0
- package/dist/toolkits/google-docs/manifest.js +40 -0
- package/dist/toolkits/google-docs/tools/append-text.d.ts +30 -0
- package/dist/toolkits/google-docs/tools/append-text.js +48 -0
- package/dist/toolkits/google-docs/tools/copy-document.d.ts +27 -0
- package/dist/toolkits/google-docs/tools/copy-document.js +43 -0
- package/dist/toolkits/google-docs/tools/create-document.d.ts +26 -0
- package/dist/toolkits/google-docs/tools/create-document.js +39 -0
- package/dist/toolkits/google-docs/tools/delete-content.d.ts +28 -0
- package/dist/toolkits/google-docs/tools/delete-content.js +45 -0
- package/dist/toolkits/google-docs/tools/delete-document.d.ts +23 -0
- package/dist/toolkits/google-docs/tools/delete-document.js +30 -0
- package/dist/toolkits/google-docs/tools/get-document-text.d.ts +26 -0
- package/dist/toolkits/google-docs/tools/get-document-text.js +35 -0
- package/dist/toolkits/google-docs/tools/get-document.d.ts +5 -0
- package/dist/toolkits/google-docs/tools/get-document.js +29 -0
- package/dist/toolkits/google-docs/tools/index.d.ts +299 -0
- package/dist/toolkits/google-docs/tools/index.js +85 -0
- package/dist/toolkits/google-docs/tools/insert-text.d.ts +28 -0
- package/dist/toolkits/google-docs/tools/insert-text.js +39 -0
- package/dist/toolkits/google-docs/tools/list-documents.d.ts +21 -0
- package/dist/toolkits/google-docs/tools/list-documents.js +39 -0
- package/dist/toolkits/google-docs/tools/replace-text.d.ts +32 -0
- package/dist/toolkits/google-docs/tools/replace-text.js +48 -0
- package/dist/toolkits/google-docs/tools/utils.d.ts +12 -0
- package/dist/toolkits/google-docs/tools/utils.js +48 -0
- package/dist/toolkits/google-drive/icon.d.ts +5 -0
- package/dist/toolkits/google-drive/icon.js +6 -0
- package/dist/toolkits/google-drive/manifest.d.ts +3 -0
- package/dist/toolkits/google-drive/manifest.js +37 -0
- package/dist/toolkits/google-drive/tools/copy-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/copy-file.js +41 -0
- package/dist/toolkits/google-drive/tools/create-folder.d.ts +6 -0
- package/dist/toolkits/google-drive/tools/create-folder.js +42 -0
- package/dist/toolkits/google-drive/tools/delete-file.d.ts +23 -0
- package/dist/toolkits/google-drive/tools/delete-file.js +30 -0
- package/dist/toolkits/google-drive/tools/download-file.d.ts +30 -0
- package/dist/toolkits/google-drive/tools/download-file.js +61 -0
- package/dist/toolkits/google-drive/tools/get-file.d.ts +5 -0
- package/dist/toolkits/google-drive/tools/get-file.js +31 -0
- package/dist/toolkits/google-drive/tools/index.d.ts +188 -0
- package/dist/toolkits/google-drive/tools/index.js +85 -0
- package/dist/toolkits/google-drive/tools/list-files.d.ts +21 -0
- package/dist/toolkits/google-drive/tools/list-files.js +42 -0
- package/dist/toolkits/google-drive/tools/move-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/move-file.js +51 -0
- package/dist/toolkits/google-drive/tools/search-files.d.ts +21 -0
- package/dist/toolkits/google-drive/tools/search-files.js +36 -0
- package/dist/toolkits/google-drive/tools/update-file.d.ts +7 -0
- package/dist/toolkits/google-drive/tools/update-file.js +44 -0
- package/dist/toolkits/google-drive/tools/upload-file.d.ts +8 -0
- package/dist/toolkits/google-drive/tools/upload-file.js +58 -0
- package/dist/toolkits/google-sheets/manifest.js +1 -6
- package/package.json +22 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const deleteContent: import("ai").Tool<{
|
|
2
|
+
googleDocsToken: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
startIndex: number;
|
|
5
|
+
endIndex: number;
|
|
6
|
+
}, {
|
|
7
|
+
error: string;
|
|
8
|
+
details: any;
|
|
9
|
+
success?: undefined;
|
|
10
|
+
documentId?: undefined;
|
|
11
|
+
replies?: undefined;
|
|
12
|
+
message?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
success: boolean;
|
|
15
|
+
documentId: string;
|
|
16
|
+
replies: any;
|
|
17
|
+
error?: undefined;
|
|
18
|
+
details?: undefined;
|
|
19
|
+
message?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
error: string;
|
|
22
|
+
message: string;
|
|
23
|
+
details?: undefined;
|
|
24
|
+
success?: undefined;
|
|
25
|
+
documentId?: undefined;
|
|
26
|
+
replies?: undefined;
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=delete-content.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const deleteContent = tool({
|
|
5
|
+
description: 'Delete a range of content from a Google Docs document.',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
8
|
+
documentId: z.string().describe('The ID of the document'),
|
|
9
|
+
startIndex: z.number().describe('Start index of the range to delete (inclusive)'),
|
|
10
|
+
endIndex: z.number().describe('End index of the range to delete (exclusive)'),
|
|
11
|
+
}),
|
|
12
|
+
execute: async ({ googleDocsToken, documentId, startIndex, endIndex }) => {
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}:batchUpdate`, {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${googleDocsToken}`,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify({
|
|
21
|
+
requests: [
|
|
22
|
+
{
|
|
23
|
+
deleteContentRange: {
|
|
24
|
+
range: { startIndex, endIndex },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const error = await response.json();
|
|
32
|
+
return { error: 'Failed to delete content', details: error };
|
|
33
|
+
}
|
|
34
|
+
const data = await response.json();
|
|
35
|
+
return { success: true, documentId, replies: data.replies };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return {
|
|
39
|
+
error: 'Error deleting content',
|
|
40
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=delete-content.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const deleteDocument: import("ai").Tool<{
|
|
2
|
+
googleDocsToken: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
}, {
|
|
5
|
+
error: string;
|
|
6
|
+
details: any;
|
|
7
|
+
success?: undefined;
|
|
8
|
+
documentId?: undefined;
|
|
9
|
+
message?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
success: boolean;
|
|
12
|
+
documentId: string;
|
|
13
|
+
error?: undefined;
|
|
14
|
+
details?: undefined;
|
|
15
|
+
message?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
error: string;
|
|
18
|
+
message: string;
|
|
19
|
+
details?: undefined;
|
|
20
|
+
success?: undefined;
|
|
21
|
+
documentId?: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=delete-document.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const deleteDocument = tool({
|
|
5
|
+
description: 'Delete a Google Docs document (moves to trash).',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
8
|
+
documentId: z.string().describe('The ID of the document to delete'),
|
|
9
|
+
}),
|
|
10
|
+
execute: async ({ googleDocsToken, documentId }) => {
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch(`https://www.googleapis.com/drive/v3/files/${documentId}`, {
|
|
13
|
+
method: 'DELETE',
|
|
14
|
+
headers: { Authorization: `Bearer ${googleDocsToken}` },
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
18
|
+
return { error: 'Failed to delete document', details: error };
|
|
19
|
+
}
|
|
20
|
+
return { success: true, documentId };
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return {
|
|
24
|
+
error: 'Error deleting document',
|
|
25
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=delete-document.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const getDocumentText: import("ai").Tool<{
|
|
2
|
+
googleDocsToken: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
}, {
|
|
5
|
+
error: string;
|
|
6
|
+
details: any;
|
|
7
|
+
documentId?: undefined;
|
|
8
|
+
title?: undefined;
|
|
9
|
+
text?: undefined;
|
|
10
|
+
message?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
documentId: any;
|
|
13
|
+
title: any;
|
|
14
|
+
text: string;
|
|
15
|
+
error?: undefined;
|
|
16
|
+
details?: undefined;
|
|
17
|
+
message?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
error: string;
|
|
20
|
+
message: string;
|
|
21
|
+
details?: undefined;
|
|
22
|
+
documentId?: undefined;
|
|
23
|
+
title?: undefined;
|
|
24
|
+
text?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=get-document-text.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { extractPlainText } from './utils.js';
|
|
5
|
+
export const getDocumentText = tool({
|
|
6
|
+
description: 'Get the plain text content of a Google Docs document.',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
9
|
+
documentId: z.string().describe('The ID of the document'),
|
|
10
|
+
}),
|
|
11
|
+
execute: async ({ googleDocsToken, documentId }) => {
|
|
12
|
+
try {
|
|
13
|
+
const response = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}`, {
|
|
14
|
+
headers: { Authorization: `Bearer ${googleDocsToken}` },
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) {
|
|
17
|
+
const error = await response.json();
|
|
18
|
+
return { error: 'Failed to get document', details: error };
|
|
19
|
+
}
|
|
20
|
+
const document = await response.json();
|
|
21
|
+
return {
|
|
22
|
+
documentId: document.documentId,
|
|
23
|
+
title: document.title,
|
|
24
|
+
text: extractPlainText(document),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return {
|
|
29
|
+
error: 'Error getting document text',
|
|
30
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=get-document-text.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const getDocument = tool({
|
|
5
|
+
description: 'Get the full Google Docs document structure including title and body content.',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
8
|
+
documentId: z.string().describe('The ID of the document'),
|
|
9
|
+
}),
|
|
10
|
+
execute: async ({ googleDocsToken, documentId }) => {
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}`, {
|
|
13
|
+
headers: { Authorization: `Bearer ${googleDocsToken}` },
|
|
14
|
+
});
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
const error = await response.json();
|
|
17
|
+
return { error: 'Failed to get document', details: error };
|
|
18
|
+
}
|
|
19
|
+
return await response.json();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
error: 'Error getting document',
|
|
24
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=get-document.js.map
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { listDocuments } from './list-documents.js';
|
|
2
|
+
import { getDocument } from './get-document.js';
|
|
3
|
+
import { getDocumentText } from './get-document-text.js';
|
|
4
|
+
import { createDocument } from './create-document.js';
|
|
5
|
+
import { insertText } from './insert-text.js';
|
|
6
|
+
import { appendText } from './append-text.js';
|
|
7
|
+
import { replaceText } from './replace-text.js';
|
|
8
|
+
import { deleteContent } from './delete-content.js';
|
|
9
|
+
import { copyDocument } from './copy-document.js';
|
|
10
|
+
import { deleteDocument } from './delete-document.js';
|
|
11
|
+
export { listDocuments, getDocument, getDocumentText, createDocument, insertText, appendText, replaceText, deleteContent, copyDocument, deleteDocument, };
|
|
12
|
+
export declare const googleDocsTools: ({
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
tool: import("ai").Tool<{
|
|
16
|
+
pageSize: number;
|
|
17
|
+
googleDocsToken: string;
|
|
18
|
+
q?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
error: string;
|
|
21
|
+
details: any;
|
|
22
|
+
documents?: undefined;
|
|
23
|
+
message?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
documents: any;
|
|
26
|
+
error?: undefined;
|
|
27
|
+
details?: undefined;
|
|
28
|
+
message?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
error: string;
|
|
31
|
+
message: string;
|
|
32
|
+
details?: undefined;
|
|
33
|
+
documents?: undefined;
|
|
34
|
+
}>;
|
|
35
|
+
requiredAuth: "googleDocsToken";
|
|
36
|
+
scope: "read";
|
|
37
|
+
} | {
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
tool: import("ai").Tool<{
|
|
41
|
+
googleDocsToken: string;
|
|
42
|
+
documentId: string;
|
|
43
|
+
}, any>;
|
|
44
|
+
requiredAuth: "googleDocsToken";
|
|
45
|
+
scope: "read";
|
|
46
|
+
} | {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
tool: import("ai").Tool<{
|
|
50
|
+
googleDocsToken: string;
|
|
51
|
+
documentId: string;
|
|
52
|
+
}, {
|
|
53
|
+
error: string;
|
|
54
|
+
details: any;
|
|
55
|
+
documentId?: undefined;
|
|
56
|
+
title?: undefined;
|
|
57
|
+
text?: undefined;
|
|
58
|
+
message?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
documentId: any;
|
|
61
|
+
title: any;
|
|
62
|
+
text: string;
|
|
63
|
+
error?: undefined;
|
|
64
|
+
details?: undefined;
|
|
65
|
+
message?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
error: string;
|
|
68
|
+
message: string;
|
|
69
|
+
details?: undefined;
|
|
70
|
+
documentId?: undefined;
|
|
71
|
+
title?: undefined;
|
|
72
|
+
text?: undefined;
|
|
73
|
+
}>;
|
|
74
|
+
requiredAuth: "googleDocsToken";
|
|
75
|
+
scope: "read";
|
|
76
|
+
} | {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
tool: import("ai").Tool<{
|
|
80
|
+
title: string;
|
|
81
|
+
googleDocsToken: string;
|
|
82
|
+
}, {
|
|
83
|
+
error: string;
|
|
84
|
+
details: any;
|
|
85
|
+
documentId?: undefined;
|
|
86
|
+
title?: undefined;
|
|
87
|
+
revisionId?: undefined;
|
|
88
|
+
message?: undefined;
|
|
89
|
+
} | {
|
|
90
|
+
documentId: any;
|
|
91
|
+
title: any;
|
|
92
|
+
revisionId: any;
|
|
93
|
+
error?: undefined;
|
|
94
|
+
details?: undefined;
|
|
95
|
+
message?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
error: string;
|
|
98
|
+
message: string;
|
|
99
|
+
details?: undefined;
|
|
100
|
+
documentId?: undefined;
|
|
101
|
+
title?: undefined;
|
|
102
|
+
revisionId?: undefined;
|
|
103
|
+
}>;
|
|
104
|
+
requiredAuth: "googleDocsToken";
|
|
105
|
+
scope: "write";
|
|
106
|
+
} | {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
tool: import("ai").Tool<{
|
|
110
|
+
text: string;
|
|
111
|
+
googleDocsToken: string;
|
|
112
|
+
documentId: string;
|
|
113
|
+
index: number;
|
|
114
|
+
}, {
|
|
115
|
+
error: string;
|
|
116
|
+
details: any;
|
|
117
|
+
success?: undefined;
|
|
118
|
+
documentId?: undefined;
|
|
119
|
+
replies?: undefined;
|
|
120
|
+
message?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
success: boolean;
|
|
123
|
+
documentId: string;
|
|
124
|
+
replies: any;
|
|
125
|
+
error?: undefined;
|
|
126
|
+
details?: undefined;
|
|
127
|
+
message?: undefined;
|
|
128
|
+
} | {
|
|
129
|
+
error: string;
|
|
130
|
+
message: string;
|
|
131
|
+
details?: undefined;
|
|
132
|
+
success?: undefined;
|
|
133
|
+
documentId?: undefined;
|
|
134
|
+
replies?: undefined;
|
|
135
|
+
}>;
|
|
136
|
+
requiredAuth: "googleDocsToken";
|
|
137
|
+
scope: "write";
|
|
138
|
+
} | {
|
|
139
|
+
name: string;
|
|
140
|
+
description: string;
|
|
141
|
+
tool: import("ai").Tool<{
|
|
142
|
+
text: string;
|
|
143
|
+
googleDocsToken: string;
|
|
144
|
+
documentId: string;
|
|
145
|
+
}, {
|
|
146
|
+
error: string;
|
|
147
|
+
details: any;
|
|
148
|
+
success?: undefined;
|
|
149
|
+
documentId?: undefined;
|
|
150
|
+
index?: undefined;
|
|
151
|
+
replies?: undefined;
|
|
152
|
+
message?: undefined;
|
|
153
|
+
} | {
|
|
154
|
+
success: boolean;
|
|
155
|
+
documentId: string;
|
|
156
|
+
index: number;
|
|
157
|
+
replies: any;
|
|
158
|
+
error?: undefined;
|
|
159
|
+
details?: undefined;
|
|
160
|
+
message?: undefined;
|
|
161
|
+
} | {
|
|
162
|
+
error: string;
|
|
163
|
+
message: string;
|
|
164
|
+
details?: undefined;
|
|
165
|
+
success?: undefined;
|
|
166
|
+
documentId?: undefined;
|
|
167
|
+
index?: undefined;
|
|
168
|
+
replies?: undefined;
|
|
169
|
+
}>;
|
|
170
|
+
requiredAuth: "googleDocsToken";
|
|
171
|
+
scope: "write";
|
|
172
|
+
} | {
|
|
173
|
+
name: string;
|
|
174
|
+
description: string;
|
|
175
|
+
tool: import("ai").Tool<{
|
|
176
|
+
googleDocsToken: string;
|
|
177
|
+
documentId: string;
|
|
178
|
+
findText: string;
|
|
179
|
+
replaceText: string;
|
|
180
|
+
matchCase: boolean;
|
|
181
|
+
}, {
|
|
182
|
+
error: string;
|
|
183
|
+
details: any;
|
|
184
|
+
success?: undefined;
|
|
185
|
+
documentId?: undefined;
|
|
186
|
+
occurrencesChanged?: undefined;
|
|
187
|
+
replies?: undefined;
|
|
188
|
+
message?: undefined;
|
|
189
|
+
} | {
|
|
190
|
+
success: boolean;
|
|
191
|
+
documentId: string;
|
|
192
|
+
occurrencesChanged: any;
|
|
193
|
+
replies: any;
|
|
194
|
+
error?: undefined;
|
|
195
|
+
details?: undefined;
|
|
196
|
+
message?: undefined;
|
|
197
|
+
} | {
|
|
198
|
+
error: string;
|
|
199
|
+
message: string;
|
|
200
|
+
details?: undefined;
|
|
201
|
+
success?: undefined;
|
|
202
|
+
documentId?: undefined;
|
|
203
|
+
occurrencesChanged?: undefined;
|
|
204
|
+
replies?: undefined;
|
|
205
|
+
}>;
|
|
206
|
+
requiredAuth: "googleDocsToken";
|
|
207
|
+
scope: "write";
|
|
208
|
+
} | {
|
|
209
|
+
name: string;
|
|
210
|
+
description: string;
|
|
211
|
+
tool: import("ai").Tool<{
|
|
212
|
+
googleDocsToken: string;
|
|
213
|
+
documentId: string;
|
|
214
|
+
startIndex: number;
|
|
215
|
+
endIndex: number;
|
|
216
|
+
}, {
|
|
217
|
+
error: string;
|
|
218
|
+
details: any;
|
|
219
|
+
success?: undefined;
|
|
220
|
+
documentId?: undefined;
|
|
221
|
+
replies?: undefined;
|
|
222
|
+
message?: undefined;
|
|
223
|
+
} | {
|
|
224
|
+
success: boolean;
|
|
225
|
+
documentId: string;
|
|
226
|
+
replies: any;
|
|
227
|
+
error?: undefined;
|
|
228
|
+
details?: undefined;
|
|
229
|
+
message?: undefined;
|
|
230
|
+
} | {
|
|
231
|
+
error: string;
|
|
232
|
+
message: string;
|
|
233
|
+
details?: undefined;
|
|
234
|
+
success?: undefined;
|
|
235
|
+
documentId?: undefined;
|
|
236
|
+
replies?: undefined;
|
|
237
|
+
}>;
|
|
238
|
+
requiredAuth: "googleDocsToken";
|
|
239
|
+
scope: "delete";
|
|
240
|
+
} | {
|
|
241
|
+
name: string;
|
|
242
|
+
description: string;
|
|
243
|
+
tool: import("ai").Tool<{
|
|
244
|
+
googleDocsToken: string;
|
|
245
|
+
documentId: string;
|
|
246
|
+
name?: string | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
error: string;
|
|
249
|
+
details: any;
|
|
250
|
+
documentId?: undefined;
|
|
251
|
+
name?: undefined;
|
|
252
|
+
webViewLink?: undefined;
|
|
253
|
+
message?: undefined;
|
|
254
|
+
} | {
|
|
255
|
+
documentId: any;
|
|
256
|
+
name: any;
|
|
257
|
+
webViewLink: any;
|
|
258
|
+
error?: undefined;
|
|
259
|
+
details?: undefined;
|
|
260
|
+
message?: undefined;
|
|
261
|
+
} | {
|
|
262
|
+
error: string;
|
|
263
|
+
message: string;
|
|
264
|
+
details?: undefined;
|
|
265
|
+
documentId?: undefined;
|
|
266
|
+
name?: undefined;
|
|
267
|
+
webViewLink?: undefined;
|
|
268
|
+
}>;
|
|
269
|
+
requiredAuth: "googleDocsToken";
|
|
270
|
+
scope: "write";
|
|
271
|
+
} | {
|
|
272
|
+
name: string;
|
|
273
|
+
description: string;
|
|
274
|
+
tool: import("ai").Tool<{
|
|
275
|
+
googleDocsToken: string;
|
|
276
|
+
documentId: string;
|
|
277
|
+
}, {
|
|
278
|
+
error: string;
|
|
279
|
+
details: any;
|
|
280
|
+
success?: undefined;
|
|
281
|
+
documentId?: undefined;
|
|
282
|
+
message?: undefined;
|
|
283
|
+
} | {
|
|
284
|
+
success: boolean;
|
|
285
|
+
documentId: string;
|
|
286
|
+
error?: undefined;
|
|
287
|
+
details?: undefined;
|
|
288
|
+
message?: undefined;
|
|
289
|
+
} | {
|
|
290
|
+
error: string;
|
|
291
|
+
message: string;
|
|
292
|
+
details?: undefined;
|
|
293
|
+
success?: undefined;
|
|
294
|
+
documentId?: undefined;
|
|
295
|
+
}>;
|
|
296
|
+
requiredAuth: "googleDocsToken";
|
|
297
|
+
scope: "delete";
|
|
298
|
+
})[];
|
|
299
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { listDocuments } from './list-documents.js';
|
|
3
|
+
import { getDocument } from './get-document.js';
|
|
4
|
+
import { getDocumentText } from './get-document-text.js';
|
|
5
|
+
import { createDocument } from './create-document.js';
|
|
6
|
+
import { insertText } from './insert-text.js';
|
|
7
|
+
import { appendText } from './append-text.js';
|
|
8
|
+
import { replaceText } from './replace-text.js';
|
|
9
|
+
import { deleteContent } from './delete-content.js';
|
|
10
|
+
import { copyDocument } from './copy-document.js';
|
|
11
|
+
import { deleteDocument } from './delete-document.js';
|
|
12
|
+
export { listDocuments, getDocument, getDocumentText, createDocument, insertText, appendText, replaceText, deleteContent, copyDocument, deleteDocument, };
|
|
13
|
+
export const googleDocsTools = [
|
|
14
|
+
{
|
|
15
|
+
name: 'googleDocsListDocuments',
|
|
16
|
+
description: 'List Google Docs documents in the user\'s Drive.',
|
|
17
|
+
tool: listDocuments,
|
|
18
|
+
requiredAuth: 'googleDocsToken',
|
|
19
|
+
scope: 'read',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'googleDocsGetDocument',
|
|
23
|
+
description: 'Get the full Google Docs document structure including title and body content.',
|
|
24
|
+
tool: getDocument,
|
|
25
|
+
requiredAuth: 'googleDocsToken',
|
|
26
|
+
scope: 'read',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'googleDocsGetDocumentText',
|
|
30
|
+
description: 'Get the plain text content of a Google Docs document.',
|
|
31
|
+
tool: getDocumentText,
|
|
32
|
+
requiredAuth: 'googleDocsToken',
|
|
33
|
+
scope: 'read',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'googleDocsCreateDocument',
|
|
37
|
+
description: 'Create a new blank Google Docs document with a title.',
|
|
38
|
+
tool: createDocument,
|
|
39
|
+
requiredAuth: 'googleDocsToken',
|
|
40
|
+
scope: 'write',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'googleDocsInsertText',
|
|
44
|
+
description: 'Insert text at a specific index in a Google Docs document.',
|
|
45
|
+
tool: insertText,
|
|
46
|
+
requiredAuth: 'googleDocsToken',
|
|
47
|
+
scope: 'write',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'googleDocsAppendText',
|
|
51
|
+
description: 'Append text to the end of a Google Docs document.',
|
|
52
|
+
tool: appendText,
|
|
53
|
+
requiredAuth: 'googleDocsToken',
|
|
54
|
+
scope: 'write',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'googleDocsReplaceText',
|
|
58
|
+
description: 'Find and replace all occurrences of text in a Google Docs document.',
|
|
59
|
+
tool: replaceText,
|
|
60
|
+
requiredAuth: 'googleDocsToken',
|
|
61
|
+
scope: 'write',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'googleDocsDeleteContent',
|
|
65
|
+
description: 'Delete a range of content from a Google Docs document.',
|
|
66
|
+
tool: deleteContent,
|
|
67
|
+
requiredAuth: 'googleDocsToken',
|
|
68
|
+
scope: 'delete',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'googleDocsCopyDocument',
|
|
72
|
+
description: 'Copy a Google Docs document.',
|
|
73
|
+
tool: copyDocument,
|
|
74
|
+
requiredAuth: 'googleDocsToken',
|
|
75
|
+
scope: 'write',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'googleDocsDeleteDocument',
|
|
79
|
+
description: 'Delete a Google Docs document (moves to trash).',
|
|
80
|
+
tool: deleteDocument,
|
|
81
|
+
requiredAuth: 'googleDocsToken',
|
|
82
|
+
scope: 'delete',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const insertText: import("ai").Tool<{
|
|
2
|
+
text: string;
|
|
3
|
+
googleDocsToken: string;
|
|
4
|
+
documentId: string;
|
|
5
|
+
index: number;
|
|
6
|
+
}, {
|
|
7
|
+
error: string;
|
|
8
|
+
details: any;
|
|
9
|
+
success?: undefined;
|
|
10
|
+
documentId?: undefined;
|
|
11
|
+
replies?: undefined;
|
|
12
|
+
message?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
success: boolean;
|
|
15
|
+
documentId: string;
|
|
16
|
+
replies: any;
|
|
17
|
+
error?: undefined;
|
|
18
|
+
details?: undefined;
|
|
19
|
+
message?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
error: string;
|
|
22
|
+
message: string;
|
|
23
|
+
details?: undefined;
|
|
24
|
+
success?: undefined;
|
|
25
|
+
documentId?: undefined;
|
|
26
|
+
replies?: undefined;
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=insert-text.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const insertText = tool({
|
|
5
|
+
description: 'Insert text at a specific index in a Google Docs document.',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
8
|
+
documentId: z.string().describe('The ID of the document'),
|
|
9
|
+
text: z.string().describe('Text to insert'),
|
|
10
|
+
index: z.number().optional().default(1).describe('Character index where text should be inserted (default: 1)'),
|
|
11
|
+
}),
|
|
12
|
+
execute: async ({ googleDocsToken, documentId, text, index = 1 }) => {
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}:batchUpdate`, {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: {
|
|
17
|
+
Authorization: `Bearer ${googleDocsToken}`,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify({
|
|
21
|
+
requests: [{ insertText: { location: { index }, text } }],
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const error = await response.json();
|
|
26
|
+
return { error: 'Failed to insert text', details: error };
|
|
27
|
+
}
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
return { success: true, documentId, replies: data.replies };
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
error: 'Error inserting text',
|
|
34
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=insert-text.js.map
|