@rnsk/toolkits 0.0.3 → 0.0.5
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 +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/toolkits/github/tools/Actions/get-workflow-job.d.ts +3 -3
- package/dist/toolkits/github/tools/Actions/list-artifacts.d.ts +1 -1
- package/dist/toolkits/github/tools/Actions/list-workflow-jobs.d.ts +3 -3
- package/dist/toolkits/github/tools/Actions/list-workflow-run-artifacts.d.ts +1 -1
- package/dist/toolkits/github/tools/Activity/list-notifications.d.ts +1 -1
- package/dist/toolkits/github/tools/Activity/list-public-events.d.ts +1 -1
- package/dist/toolkits/github/tools/Activity/list-repo-events.d.ts +1 -1
- package/dist/toolkits/github/tools/Activity/list-user-events.d.ts +1 -1
- package/dist/toolkits/github/tools/Apps/list-installations.d.ts +1 -1
- package/dist/toolkits/github/tools/Checks/create-check-run.d.ts +5 -5
- package/dist/toolkits/github/tools/Checks/create-check-suite.d.ts +2 -2
- package/dist/toolkits/github/tools/Checks/get-check-run.d.ts +2 -2
- package/dist/toolkits/github/tools/Checks/get-check-suite.d.ts +2 -2
- package/dist/toolkits/github/tools/Checks/list-check-runs.d.ts +4 -4
- package/dist/toolkits/github/tools/Checks/update-check-run.d.ts +4 -4
- package/dist/toolkits/github/tools/CodeScanning/list-alerts.d.ts +2 -2
- package/dist/toolkits/github/tools/CodeScanning/update-alert.d.ts +1 -1
- package/dist/toolkits/github/tools/Collaborators/add-collaborator.d.ts +1 -1
- package/dist/toolkits/github/tools/Collaborators/check-collaborator.d.ts +1 -1
- package/dist/toolkits/github/tools/Collaborators/list-collaborators.d.ts +1 -1
- package/dist/toolkits/github/tools/Collaborators/remove-collaborator.d.ts +1 -1
- package/dist/toolkits/github/tools/Commits/compare-commits.d.ts +2 -2
- package/dist/toolkits/github/tools/Commits/get-commit.d.ts +2 -2
- package/dist/toolkits/github/tools/Commits/list-commits.d.ts +1 -1
- package/dist/toolkits/github/tools/Commits/list-pull-requests-associated-with-commit.d.ts +2 -2
- package/dist/toolkits/github/tools/Dependabot/list-alerts.d.ts +1 -1
- package/dist/toolkits/github/tools/Dependabot/update-alert.d.ts +1 -1
- package/dist/toolkits/github/tools/DeployKeys/list-deploy-keys.d.ts +1 -1
- package/dist/toolkits/github/tools/Deployments/create-deployment.d.ts +1 -1
- package/dist/toolkits/github/tools/Deployments/list-deployments.d.ts +1 -1
- package/dist/toolkits/github/tools/Environments/list-environments.d.ts +1 -1
- package/dist/toolkits/github/tools/Files/create-or-update-file.d.ts +1 -1
- package/dist/toolkits/github/tools/Gists/create-gist.d.ts +1 -1
- package/dist/toolkits/github/tools/Git/create-blob.d.ts +1 -1
- package/dist/toolkits/github/tools/Git/create-tree.d.ts +1 -1
- package/dist/toolkits/github/tools/Issues/add-issue-assignees.d.ts +1 -1
- package/dist/toolkits/github/tools/Issues/list-authenticated-user-issues.d.ts +3 -3
- package/dist/toolkits/github/tools/Issues/list-issue-comments.d.ts +1 -1
- package/dist/toolkits/github/tools/Issues/list-org-issues.d.ts +3 -3
- package/dist/toolkits/github/tools/Issues/list-repo-issues.d.ts +2 -2
- package/dist/toolkits/github/tools/Issues/list-user-account-issues.d.ts +3 -3
- package/dist/toolkits/github/tools/Organizations/get-org-membership.d.ts +1 -1
- package/dist/toolkits/github/tools/Organizations/list-org-members.d.ts +1 -1
- package/dist/toolkits/github/tools/Organizations/list-org-repositories.d.ts +2 -2
- package/dist/toolkits/github/tools/Organizations/list-user-organizations.d.ts +1 -1
- package/dist/toolkits/github/tools/Organizations/update-organization.d.ts +1 -1
- package/dist/toolkits/github/tools/PRs/create-pull-request-review.d.ts +1 -1
- package/dist/toolkits/github/tools/PRs/list-pull-request-files.d.ts +1 -1
- package/dist/toolkits/github/tools/PRs/list-pull-requests.d.ts +1 -1
- package/dist/toolkits/github/tools/Projects/list-org-projects.d.ts +1 -1
- package/dist/toolkits/github/tools/Projects/list-project-columns.d.ts +1 -1
- package/dist/toolkits/github/tools/Projects/list-repo-projects.d.ts +1 -1
- package/dist/toolkits/github/tools/Projects/update-project.d.ts +1 -1
- package/dist/toolkits/github/tools/Reactions/create-commit-comment-reaction.d.ts +1 -1
- package/dist/toolkits/github/tools/Reactions/create-issue-reaction.d.ts +1 -1
- package/dist/toolkits/github/tools/Reactions/list-commit-comment-reactions.d.ts +1 -1
- package/dist/toolkits/github/tools/Reactions/list-issue-reactions.d.ts +1 -1
- package/dist/toolkits/github/tools/Reactions/list-pr-comment-reactions.d.ts +1 -1
- package/dist/toolkits/github/tools/Releases/list-releases.d.ts +1 -1
- package/dist/toolkits/github/tools/Repos/get-repo-contributors.d.ts +1 -1
- package/dist/toolkits/github/tools/Repos/list-branches.d.ts +1 -1
- package/dist/toolkits/github/tools/Repos/list-repos.d.ts +2 -2
- package/dist/toolkits/github/tools/Repos/watch-repo.d.ts +1 -1
- package/dist/toolkits/github/tools/Search/search-repos.d.ts +1 -1
- package/dist/toolkits/github/tools/SecretScanning/list-alerts.d.ts +1 -1
- package/dist/toolkits/github/tools/SecretScanning/update-alert.d.ts +1 -1
- package/dist/toolkits/github/tools/SecurityAdvisories/create-repository-advisory.d.ts +1 -1
- package/dist/toolkits/github/tools/SecurityAdvisories/get-repository-advisory.d.ts +1 -1
- package/dist/toolkits/github/tools/SecurityAdvisories/list-global-advisories.d.ts +1 -1
- package/dist/toolkits/github/tools/SecurityAdvisories/list-repository-advisories.d.ts +2 -2
- package/dist/toolkits/github/tools/Stars/list-stargazers.d.ts +1 -1
- package/dist/toolkits/github/tools/Stars/list-starred-repos.d.ts +1 -1
- package/dist/toolkits/github/tools/Statuses/create-commit-status.d.ts +1 -1
- package/dist/toolkits/github/tools/Statuses/list-commit-statuses.d.ts +1 -1
- package/dist/toolkits/github/tools/Teams/list-team-members.d.ts +1 -1
- package/dist/toolkits/github/tools/Teams/list-team-repos.d.ts +1 -1
- package/dist/toolkits/github/tools/Teams/list-teams.d.ts +1 -1
- package/dist/toolkits/github/tools/Users/get-user-context.d.ts +1 -1
- package/dist/toolkits/github/tools/Users/update-authenticated-user.d.ts +1 -1
- package/dist/toolkits/github/tools/Webhooks/create-repo-webhook.d.ts +1 -1
- package/dist/toolkits/github/tools/Webhooks/list-repo-webhooks.d.ts +1 -1
- package/dist/toolkits/github/tools/Webhooks/update-repo-webhook.d.ts +1 -1
- package/dist/toolkits/github/tools/Workflows/list-workflow-runs.d.ts +2 -2
- package/dist/toolkits/github/tools/Workflows/list-workflows.d.ts +1 -1
- package/dist/toolkits/github/tools/index.d.ts +4859 -175
- package/dist/toolkits/github/tools/index.js +342 -342
- package/dist/toolkits/gmail/manifest.js +1 -1
- package/dist/toolkits/gmail/tools/create-draft.d.ts +1 -1
- package/dist/toolkits/gmail/tools/reply-to-thread.d.ts +1 -1
- package/dist/toolkits/gmail/tools/send-message.d.ts +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/dist/toolkits/linear/manifest.js +35 -0
- package/dist/toolkits/linear/tools/add-comment.d.ts +6 -0
- package/dist/toolkits/linear/tools/add-comment.js +52 -0
- package/dist/toolkits/linear/tools/get-issue.d.ts +6 -0
- package/dist/toolkits/linear/tools/get-issue.js +117 -0
- package/dist/toolkits/linear/tools/list-projects.d.ts +4 -0
- package/dist/toolkits/linear/tools/list-projects.js +46 -0
- package/dist/toolkits/linear/tools/list-workflow-states.d.ts +26 -0
- package/dist/toolkits/linear/tools/list-workflow-states.js +59 -0
- package/dist/toolkits/linear/tools/update-issue.d.ts +11 -0
- package/dist/toolkits/linear/tools/update-issue.js +78 -0
- package/dist/toolkits/notion/tools/append-block-children.d.ts +1 -1
- package/dist/toolkits/notion/tools/index.d.ts +105 -12
- package/dist/toolkits/notion/tools/index.js +8 -8
- package/dist/toolkits/notion/tools/query-database.d.ts +1 -1
- package/package.json +20 -4
- package/dist/runtime/credentials.d.ts +0 -28
- package/dist/runtime/credentials.js +0 -15
- package/dist/runtime/index.d.ts +0 -5
- package/dist/runtime/index.js +0 -5
- package/dist/runtime/meta-tools.d.ts +0 -101
- package/dist/runtime/meta-tools.js +0 -250
- package/dist/runtime/registry.d.ts +0 -20
- package/dist/runtime/registry.js +0 -35
- package/dist/runtime/schema-helpers.d.ts +0 -20
- package/dist/runtime/schema-helpers.js +0 -157
|
@@ -12,7 +12,7 @@ export default defineToolkit({
|
|
|
12
12
|
tokenField: 'gmailToken',
|
|
13
13
|
provider: {
|
|
14
14
|
slug: 'gmail',
|
|
15
|
-
env: { clientId: '
|
|
15
|
+
env: { clientId: 'GOOGLE_GMAIL_CLIENT_ID', clientSecret: 'GOOGLE_GMAIL_CLIENT_SECRET' },
|
|
16
16
|
authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
17
17
|
tokenUrl: 'https://oauth2.googleapis.com/token',
|
|
18
18
|
scopes: [
|
|
@@ -13,12 +13,7 @@ export default defineToolkit({
|
|
|
13
13
|
tokenField: 'googleCalendarToken',
|
|
14
14
|
provider: {
|
|
15
15
|
slug: 'googlecalendar',
|
|
16
|
-
env: {
|
|
17
|
-
clientId: 'GOOGLE_CALENDAR_CLIENT_ID',
|
|
18
|
-
clientSecret: 'GOOGLE_CALENDAR_CLIENT_SECRET',
|
|
19
|
-
clientIdFallback: 'GMAIL_CLIENT_ID',
|
|
20
|
-
clientSecretFallback: 'GMAIL_CLIENT_SECRET',
|
|
21
|
-
},
|
|
16
|
+
env: { clientId: 'GOOGLE_CALENDAR_CLIENT_ID', clientSecret: 'GOOGLE_CALENDAR_CLIENT_SECRET' },
|
|
22
17
|
authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
23
18
|
tokenUrl: 'https://oauth2.googleapis.com/token',
|
|
24
19
|
scopes: [
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192" fill="none"><mask id="mask0_37242_8762" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="32" y="8" width="128" height="176"><path d="M130.334 184L61.6 184C52.6565 184 48.1848 184 44.6375 182.596C39.5029 180.563 35.4374 176.497 33.4045 171.362C32 167.815 32 163.343 32 154.4L32 37.6C32 28.6565 32 24.1848 33.4045 20.6375C35.4374 15.5029 39.5029 11.4374 44.6375 9.40447C48.1848 8 52.6565 8 61.6 8L100 8L154.793 62.7933L154.793 62.7934C156.454 64.4543 157.285 65.2848 157.923 66.2239C158.845 67.5811 159.479 69.1131 159.785 70.725C159.997 71.8404 159.997 73.0264 159.995 75.3985C159.96 124.317 159.938 124.799 159.937 154.366C159.937 163.332 159.937 167.816 158.532 171.363C156.499 176.498 152.434 180.562 147.299 182.596C143.752 184 139.279 184 130.334 184Z" fill="#3186FF"/></mask><g mask="url(#mask0_37242_8762)"><path d="M159.94 184L31.9999 184L31.9999 8.00001L99.9999 8L159.999 68L159.94 184Z" fill="#3186FF"/><g filter="url(#filter0_f_37242_8762)"><path d="M43 192H149V70.2271V20H43V192Z" fill="url(#paint0_linear_37242_8762)"/></g></g><path d="M154.995 62.9951C152.489 61.1143 149.375 60 146 60H112.8C105.731 60 100 54.2692 100 47.2002V8L154.995 62.9951Z" fill="#76BBFF"/><rect x="64.001" y="114" width="64" height="12" rx="6" fill="white"/><rect x="64.001" y="143" width="48" height="12" rx="6" fill="white"/><defs><filter id="filter0_f_37242_8762" x="31" y="8" width="130" height="196" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur stdDeviation="6" result="effect1_foregroundBlur_37242_8762"/></filter><linearGradient id="paint0_linear_37242_8762" x1="96" y1="59.2839" x2="54.6124" y2="171.338" gradientUnits="userSpaceOnUse"><stop offset="0.33" stop-color="#3186FF"/><stop offset="1" stop-color="#A9A8FF"/></linearGradient></defs></svg>`;
|
|
2
|
+
export const GDOCS_ICON = {
|
|
3
|
+
kind: 'svg',
|
|
4
|
+
dataUri: `data:image/svg+xml;base64,${Buffer.from(SVG).toString('base64')}`,
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=icon.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineToolkit, defineTool } from '../../core/define.js';
|
|
2
|
+
import { inferToolScope } from '../../core/scope.js';
|
|
3
|
+
import { GDOCS_ICON } from './icon.js';
|
|
4
|
+
import { googleDocsTools } from './tools/index.js';
|
|
5
|
+
export default defineToolkit({
|
|
6
|
+
id: 'google-docs',
|
|
7
|
+
displayName: 'Google Docs',
|
|
8
|
+
shortDescription: 'Create, read, edit, and manage Google Docs documents.',
|
|
9
|
+
category: 'Document & File Management',
|
|
10
|
+
icon: GDOCS_ICON,
|
|
11
|
+
auth: {
|
|
12
|
+
type: 'oauth2',
|
|
13
|
+
tokenField: 'googleDocsToken',
|
|
14
|
+
provider: {
|
|
15
|
+
slug: 'google-docs',
|
|
16
|
+
env: { clientId: 'GOOGLE_DOCS_CLIENT_ID', clientSecret: 'GOOGLE_DOCS_CLIENT_SECRET' },
|
|
17
|
+
authorizeUrl: 'https://accounts.google.com/o/oauth2/v2/auth',
|
|
18
|
+
tokenUrl: 'https://oauth2.googleapis.com/token',
|
|
19
|
+
scopes: [
|
|
20
|
+
'https://www.googleapis.com/auth/documents',
|
|
21
|
+
'https://www.googleapis.com/auth/drive',
|
|
22
|
+
],
|
|
23
|
+
exchangeStyle: 'form',
|
|
24
|
+
extraAuthParams: { access_type: 'offline', prompt: 'consent' },
|
|
25
|
+
connectDescription: 'Connect Google Docs to create, read, and edit documents.',
|
|
26
|
+
callbackPath: '/api/auth/google-docs/callback',
|
|
27
|
+
stateCookie: 'google_docs_oauth_state',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
allowedHosts: ['docs.googleapis.com', 'www.googleapis.com'],
|
|
31
|
+
tools: googleDocsTools.map((entry) => defineTool({
|
|
32
|
+
name: entry.name,
|
|
33
|
+
description: entry.description,
|
|
34
|
+
tool: entry.tool,
|
|
35
|
+
requiredAuth: entry.requiredAuth,
|
|
36
|
+
scope: entry.scope ?? inferToolScope(entry.name),
|
|
37
|
+
})),
|
|
38
|
+
meta: { since: '0.0.5' },
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const appendText: import("ai").Tool<{
|
|
2
|
+
text: string;
|
|
3
|
+
googleDocsToken: string;
|
|
4
|
+
documentId: string;
|
|
5
|
+
}, {
|
|
6
|
+
error: string;
|
|
7
|
+
details: any;
|
|
8
|
+
success?: undefined;
|
|
9
|
+
documentId?: undefined;
|
|
10
|
+
index?: undefined;
|
|
11
|
+
replies?: undefined;
|
|
12
|
+
message?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
success: boolean;
|
|
15
|
+
documentId: string;
|
|
16
|
+
index: number;
|
|
17
|
+
replies: any;
|
|
18
|
+
error?: undefined;
|
|
19
|
+
details?: undefined;
|
|
20
|
+
message?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
error: string;
|
|
23
|
+
message: string;
|
|
24
|
+
details?: undefined;
|
|
25
|
+
success?: undefined;
|
|
26
|
+
documentId?: undefined;
|
|
27
|
+
index?: undefined;
|
|
28
|
+
replies?: undefined;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=append-text.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { getDocumentEndIndex } from './utils.js';
|
|
5
|
+
export const appendText = tool({
|
|
6
|
+
description: 'Append text to the end 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
|
+
text: z.string().describe('Text to append'),
|
|
11
|
+
}),
|
|
12
|
+
execute: async ({ googleDocsToken, documentId, text }) => {
|
|
13
|
+
try {
|
|
14
|
+
const docResponse = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}`, {
|
|
15
|
+
headers: { Authorization: `Bearer ${googleDocsToken}` },
|
|
16
|
+
});
|
|
17
|
+
if (!docResponse.ok) {
|
|
18
|
+
const error = await docResponse.json();
|
|
19
|
+
return { error: 'Failed to get document for append', details: error };
|
|
20
|
+
}
|
|
21
|
+
const document = await docResponse.json();
|
|
22
|
+
const index = getDocumentEndIndex(document);
|
|
23
|
+
const response = await fetch(`https://docs.googleapis.com/v1/documents/${documentId}:batchUpdate`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${googleDocsToken}`,
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify({
|
|
30
|
+
requests: [{ insertText: { location: { index }, text } }],
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const error = await response.json();
|
|
35
|
+
return { error: 'Failed to append text', details: error };
|
|
36
|
+
}
|
|
37
|
+
const data = await response.json();
|
|
38
|
+
return { success: true, documentId, index, replies: data.replies };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
error: 'Error appending text',
|
|
43
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=append-text.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const copyDocument: import("ai").Tool<{
|
|
2
|
+
googleDocsToken: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
}, {
|
|
6
|
+
error: string;
|
|
7
|
+
details: any;
|
|
8
|
+
documentId?: undefined;
|
|
9
|
+
name?: undefined;
|
|
10
|
+
webViewLink?: undefined;
|
|
11
|
+
message?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
documentId: any;
|
|
14
|
+
name: any;
|
|
15
|
+
webViewLink: any;
|
|
16
|
+
error?: undefined;
|
|
17
|
+
details?: undefined;
|
|
18
|
+
message?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
error: string;
|
|
21
|
+
message: string;
|
|
22
|
+
details?: undefined;
|
|
23
|
+
documentId?: undefined;
|
|
24
|
+
name?: undefined;
|
|
25
|
+
webViewLink?: undefined;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=copy-document.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const copyDocument = tool({
|
|
5
|
+
description: 'Copy 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 to copy'),
|
|
9
|
+
name: z.string().optional().describe('Name for the copy'),
|
|
10
|
+
}),
|
|
11
|
+
execute: async ({ googleDocsToken, documentId, name }) => {
|
|
12
|
+
try {
|
|
13
|
+
const metadata = {};
|
|
14
|
+
if (name)
|
|
15
|
+
metadata.name = name;
|
|
16
|
+
const response = await fetch(`https://www.googleapis.com/drive/v3/files/${documentId}/copy`, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${googleDocsToken}`,
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify(metadata),
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const error = await response.json();
|
|
26
|
+
return { error: 'Failed to copy document', details: error };
|
|
27
|
+
}
|
|
28
|
+
const data = await response.json();
|
|
29
|
+
return {
|
|
30
|
+
documentId: data.id,
|
|
31
|
+
name: data.name,
|
|
32
|
+
webViewLink: data.webViewLink,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return {
|
|
37
|
+
error: 'Error copying document',
|
|
38
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=copy-document.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const createDocument: import("ai").Tool<{
|
|
2
|
+
title: string;
|
|
3
|
+
googleDocsToken: string;
|
|
4
|
+
}, {
|
|
5
|
+
error: string;
|
|
6
|
+
details: any;
|
|
7
|
+
documentId?: undefined;
|
|
8
|
+
title?: undefined;
|
|
9
|
+
revisionId?: undefined;
|
|
10
|
+
message?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
documentId: any;
|
|
13
|
+
title: any;
|
|
14
|
+
revisionId: any;
|
|
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
|
+
revisionId?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=create-document.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export const createDocument = tool({
|
|
5
|
+
description: 'Create a new blank Google Docs document with a title.',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
googleDocsToken: z.string().describe('The Google Docs access token'),
|
|
8
|
+
title: z.string().describe('Title of the new document'),
|
|
9
|
+
}),
|
|
10
|
+
execute: async ({ googleDocsToken, title }) => {
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch('https://docs.googleapis.com/v1/documents', {
|
|
13
|
+
method: 'POST',
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${googleDocsToken}`,
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
body: JSON.stringify({ title }),
|
|
19
|
+
});
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
const error = await response.json();
|
|
22
|
+
return { error: 'Failed to create document', details: error };
|
|
23
|
+
}
|
|
24
|
+
const data = await response.json();
|
|
25
|
+
return {
|
|
26
|
+
documentId: data.documentId,
|
|
27
|
+
title: data.title,
|
|
28
|
+
revisionId: data.revisionId,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
error: 'Error creating document',
|
|
34
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=create-document.js.map
|
|
@@ -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
|