@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.
Files changed (109) hide show
  1. package/README.md +13 -8
  2. package/dist/core/index.d.ts +1 -1
  3. package/dist/core/types.d.ts +43 -1
  4. package/dist/core/validate.d.ts +1 -1
  5. package/dist/core/validate.js +14 -2
  6. package/dist/index.d.ts +5 -1
  7. package/dist/index.js +9 -1
  8. package/dist/toolkits/aws/icon.d.ts +5 -0
  9. package/dist/toolkits/aws/icon.js +41 -0
  10. package/dist/toolkits/aws/manifest.d.ts +3 -0
  11. package/dist/toolkits/aws/manifest.js +27 -0
  12. package/dist/toolkits/aws/tools/client.d.ts +13 -0
  13. package/dist/toolkits/aws/tools/client.js +25 -0
  14. package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.d.ts +26 -0
  15. package/dist/toolkits/aws/tools/cloudwatch/filter-log-events.js +45 -0
  16. package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.d.ts +35 -0
  17. package/dist/toolkits/aws/tools/cloudwatch/get-metric-data.js +62 -0
  18. package/dist/toolkits/aws/tools/cloudwatch/list-alarms.d.ts +29 -0
  19. package/dist/toolkits/aws/tools/cloudwatch/list-alarms.js +46 -0
  20. package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.d.ts +25 -0
  21. package/dist/toolkits/aws/tools/cloudwatch/list-log-groups.js +38 -0
  22. package/dist/toolkits/aws/tools/ec2/get-instance.d.ts +65 -0
  23. package/dist/toolkits/aws/tools/ec2/get-instance.js +46 -0
  24. package/dist/toolkits/aws/tools/ec2/list-instances.d.ts +30 -0
  25. package/dist/toolkits/aws/tools/ec2/list-instances.js +46 -0
  26. package/dist/toolkits/aws/tools/ec2/start-instance.d.ts +24 -0
  27. package/dist/toolkits/aws/tools/ec2/start-instance.js +31 -0
  28. package/dist/toolkits/aws/tools/ec2/stop-instance.d.ts +24 -0
  29. package/dist/toolkits/aws/tools/ec2/stop-instance.js +31 -0
  30. package/dist/toolkits/aws/tools/index.d.ts +273 -0
  31. package/dist/toolkits/aws/tools/index.js +68 -0
  32. package/dist/toolkits/gcp/icon.d.ts +5 -0
  33. package/dist/toolkits/gcp/icon.js +5 -0
  34. package/dist/toolkits/gcp/manifest.d.ts +3 -0
  35. package/dist/toolkits/gcp/manifest.js +27 -0
  36. package/dist/toolkits/gcp/tools/client.d.ts +12 -0
  37. package/dist/toolkits/gcp/tools/client.js +24 -0
  38. package/dist/toolkits/gcp/tools/compute/get-instance.d.ts +36 -0
  39. package/dist/toolkits/gcp/tools/compute/get-instance.js +37 -0
  40. package/dist/toolkits/gcp/tools/compute/list-instances.d.ts +20 -0
  41. package/dist/toolkits/gcp/tools/compute/list-instances.js +62 -0
  42. package/dist/toolkits/gcp/tools/compute/start-instance.d.ts +27 -0
  43. package/dist/toolkits/gcp/tools/compute/start-instance.js +29 -0
  44. package/dist/toolkits/gcp/tools/compute/stop-instance.d.ts +27 -0
  45. package/dist/toolkits/gcp/tools/compute/stop-instance.js +29 -0
  46. package/dist/toolkits/gcp/tools/index.d.ts +162 -0
  47. package/dist/toolkits/gcp/tools/index.js +52 -0
  48. package/dist/toolkits/gcp/tools/monitoring/get-metrics.d.ts +26 -0
  49. package/dist/toolkits/gcp/tools/monitoring/get-metrics.js +53 -0
  50. package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.d.ts +24 -0
  51. package/dist/toolkits/gcp/tools/monitoring/list-metric-descriptors.js +40 -0
  52. package/dist/toolkits/gmail/manifest.js +1 -1
  53. package/dist/toolkits/google-calendar/manifest.js +1 -6
  54. package/dist/toolkits/google-docs/icon.d.ts +5 -0
  55. package/dist/toolkits/google-docs/icon.js +6 -0
  56. package/dist/toolkits/google-docs/manifest.d.ts +3 -0
  57. package/dist/toolkits/google-docs/manifest.js +40 -0
  58. package/dist/toolkits/google-docs/tools/append-text.d.ts +30 -0
  59. package/dist/toolkits/google-docs/tools/append-text.js +48 -0
  60. package/dist/toolkits/google-docs/tools/copy-document.d.ts +27 -0
  61. package/dist/toolkits/google-docs/tools/copy-document.js +43 -0
  62. package/dist/toolkits/google-docs/tools/create-document.d.ts +26 -0
  63. package/dist/toolkits/google-docs/tools/create-document.js +39 -0
  64. package/dist/toolkits/google-docs/tools/delete-content.d.ts +28 -0
  65. package/dist/toolkits/google-docs/tools/delete-content.js +45 -0
  66. package/dist/toolkits/google-docs/tools/delete-document.d.ts +23 -0
  67. package/dist/toolkits/google-docs/tools/delete-document.js +30 -0
  68. package/dist/toolkits/google-docs/tools/get-document-text.d.ts +26 -0
  69. package/dist/toolkits/google-docs/tools/get-document-text.js +35 -0
  70. package/dist/toolkits/google-docs/tools/get-document.d.ts +5 -0
  71. package/dist/toolkits/google-docs/tools/get-document.js +29 -0
  72. package/dist/toolkits/google-docs/tools/index.d.ts +299 -0
  73. package/dist/toolkits/google-docs/tools/index.js +85 -0
  74. package/dist/toolkits/google-docs/tools/insert-text.d.ts +28 -0
  75. package/dist/toolkits/google-docs/tools/insert-text.js +39 -0
  76. package/dist/toolkits/google-docs/tools/list-documents.d.ts +21 -0
  77. package/dist/toolkits/google-docs/tools/list-documents.js +39 -0
  78. package/dist/toolkits/google-docs/tools/replace-text.d.ts +32 -0
  79. package/dist/toolkits/google-docs/tools/replace-text.js +48 -0
  80. package/dist/toolkits/google-docs/tools/utils.d.ts +12 -0
  81. package/dist/toolkits/google-docs/tools/utils.js +48 -0
  82. package/dist/toolkits/google-drive/icon.d.ts +5 -0
  83. package/dist/toolkits/google-drive/icon.js +6 -0
  84. package/dist/toolkits/google-drive/manifest.d.ts +3 -0
  85. package/dist/toolkits/google-drive/manifest.js +37 -0
  86. package/dist/toolkits/google-drive/tools/copy-file.d.ts +7 -0
  87. package/dist/toolkits/google-drive/tools/copy-file.js +41 -0
  88. package/dist/toolkits/google-drive/tools/create-folder.d.ts +6 -0
  89. package/dist/toolkits/google-drive/tools/create-folder.js +42 -0
  90. package/dist/toolkits/google-drive/tools/delete-file.d.ts +23 -0
  91. package/dist/toolkits/google-drive/tools/delete-file.js +30 -0
  92. package/dist/toolkits/google-drive/tools/download-file.d.ts +30 -0
  93. package/dist/toolkits/google-drive/tools/download-file.js +61 -0
  94. package/dist/toolkits/google-drive/tools/get-file.d.ts +5 -0
  95. package/dist/toolkits/google-drive/tools/get-file.js +31 -0
  96. package/dist/toolkits/google-drive/tools/index.d.ts +188 -0
  97. package/dist/toolkits/google-drive/tools/index.js +85 -0
  98. package/dist/toolkits/google-drive/tools/list-files.d.ts +21 -0
  99. package/dist/toolkits/google-drive/tools/list-files.js +42 -0
  100. package/dist/toolkits/google-drive/tools/move-file.d.ts +7 -0
  101. package/dist/toolkits/google-drive/tools/move-file.js +51 -0
  102. package/dist/toolkits/google-drive/tools/search-files.d.ts +21 -0
  103. package/dist/toolkits/google-drive/tools/search-files.js +36 -0
  104. package/dist/toolkits/google-drive/tools/update-file.d.ts +7 -0
  105. package/dist/toolkits/google-drive/tools/update-file.js +44 -0
  106. package/dist/toolkits/google-drive/tools/upload-file.d.ts +8 -0
  107. package/dist/toolkits/google-drive/tools/upload-file.js +58 -0
  108. package/dist/toolkits/google-sheets/manifest.js +1 -6
  109. package/package.json +22 -2
@@ -0,0 +1,162 @@
1
+ import { gcpListComputeInstances } from './compute/list-instances.js';
2
+ import { gcpGetComputeInstance } from './compute/get-instance.js';
3
+ import { gcpStartComputeInstance } from './compute/start-instance.js';
4
+ import { gcpStopComputeInstance } from './compute/stop-instance.js';
5
+ import { gcpGetMonitoringMetrics } from './monitoring/get-metrics.js';
6
+ import { gcpListMonitoringMetricDescriptors } from './monitoring/list-metric-descriptors.js';
7
+ export { gcpListComputeInstances, gcpGetComputeInstance, gcpStartComputeInstance, gcpStopComputeInstance, gcpGetMonitoringMetrics, gcpListMonitoringMetricDescriptors, };
8
+ export declare const gcpTools: ({
9
+ name: string;
10
+ description: string;
11
+ tool: import("ai").Tool<{
12
+ gcpCredentials?: string | undefined;
13
+ zone?: string | undefined;
14
+ }, {
15
+ error: string;
16
+ count?: undefined;
17
+ instances?: undefined;
18
+ message?: undefined;
19
+ } | {
20
+ count: number;
21
+ instances: Record<string, unknown>[];
22
+ error?: undefined;
23
+ message?: undefined;
24
+ } | {
25
+ error: string;
26
+ message: string;
27
+ count?: undefined;
28
+ instances?: undefined;
29
+ }>;
30
+ requiredAuth: "gcpCredentials";
31
+ scope: "read";
32
+ } | {
33
+ name: string;
34
+ description: string;
35
+ tool: import("ai").Tool<{
36
+ zone: string;
37
+ instance: string;
38
+ gcpCredentials?: string | undefined;
39
+ }, {
40
+ error: string;
41
+ name?: undefined;
42
+ zone?: undefined;
43
+ status?: undefined;
44
+ machineType?: undefined;
45
+ privateIp?: undefined;
46
+ publicIp?: undefined;
47
+ creationTimestamp?: undefined;
48
+ message?: undefined;
49
+ } | {
50
+ name: string | null | undefined;
51
+ zone: string;
52
+ status: string | null | undefined;
53
+ machineType: string | undefined;
54
+ privateIp: string | null | undefined;
55
+ publicIp: string | null | undefined;
56
+ creationTimestamp: string | null | undefined;
57
+ error?: undefined;
58
+ message?: undefined;
59
+ } | {
60
+ error: string;
61
+ message: string;
62
+ name?: undefined;
63
+ zone?: undefined;
64
+ status?: undefined;
65
+ machineType?: undefined;
66
+ privateIp?: undefined;
67
+ publicIp?: undefined;
68
+ creationTimestamp?: undefined;
69
+ }>;
70
+ requiredAuth: "gcpCredentials";
71
+ scope: "read";
72
+ } | {
73
+ name: string;
74
+ description: string;
75
+ tool: import("ai").Tool<{
76
+ zone: string;
77
+ instance: string;
78
+ gcpCredentials?: string | undefined;
79
+ }, {
80
+ error: string;
81
+ instance?: undefined;
82
+ zone?: undefined;
83
+ operation?: undefined;
84
+ status?: undefined;
85
+ message?: undefined;
86
+ } | {
87
+ instance: string;
88
+ zone: string;
89
+ operation: string | undefined;
90
+ status: string;
91
+ error?: undefined;
92
+ message?: undefined;
93
+ } | {
94
+ error: string;
95
+ message: string;
96
+ instance?: undefined;
97
+ zone?: undefined;
98
+ operation?: undefined;
99
+ status?: undefined;
100
+ }>;
101
+ requiredAuth: "gcpCredentials";
102
+ scope: "write";
103
+ } | {
104
+ name: string;
105
+ description: string;
106
+ tool: import("ai").Tool<{
107
+ filter: string;
108
+ startTime?: string | undefined;
109
+ endTime?: string | undefined;
110
+ gcpCredentials?: string | undefined;
111
+ }, {
112
+ error: string;
113
+ timeSeries?: undefined;
114
+ message?: undefined;
115
+ } | {
116
+ timeSeries: {
117
+ metric: import("@google-cloud/monitoring/build/protos/protos.js").google.api.IMetric | null | undefined;
118
+ resource: import("@google-cloud/monitoring/build/protos/protos.js").google.api.IMonitoredResource | null | undefined;
119
+ points: {
120
+ value: import("@google-cloud/monitoring/build/protos/protos.js").google.monitoring.v3.ITypedValue | null | undefined;
121
+ interval: import("@google-cloud/monitoring/build/protos/protos.js").google.monitoring.v3.ITimeInterval | null | undefined;
122
+ }[];
123
+ }[];
124
+ error?: undefined;
125
+ message?: undefined;
126
+ } | {
127
+ error: string;
128
+ message: string;
129
+ timeSeries?: undefined;
130
+ }>;
131
+ requiredAuth: "gcpCredentials";
132
+ scope: "read";
133
+ } | {
134
+ name: string;
135
+ description: string;
136
+ tool: import("ai").Tool<{
137
+ filter?: string | undefined;
138
+ gcpCredentials?: string | undefined;
139
+ }, {
140
+ error: string;
141
+ descriptors?: undefined;
142
+ message?: undefined;
143
+ } | {
144
+ descriptors: {
145
+ type: string | null | undefined;
146
+ displayName: string | null | undefined;
147
+ description: string | null | undefined;
148
+ metricKind: import("@google-cloud/monitoring/build/protos/protos.js").google.api.MetricDescriptor.MetricKind | "METRIC_KIND_UNSPECIFIED" | "GAUGE" | "DELTA" | "CUMULATIVE" | null | undefined;
149
+ valueType: import("@google-cloud/monitoring/build/protos/protos.js").google.api.MetricDescriptor.ValueType | "VALUE_TYPE_UNSPECIFIED" | "BOOL" | "INT64" | "DOUBLE" | "STRING" | "DISTRIBUTION" | "MONEY" | null | undefined;
150
+ unit: string | null | undefined;
151
+ }[];
152
+ error?: undefined;
153
+ message?: undefined;
154
+ } | {
155
+ error: string;
156
+ message: string;
157
+ descriptors?: undefined;
158
+ }>;
159
+ requiredAuth: "gcpCredentials";
160
+ scope: "read";
161
+ })[];
162
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,52 @@
1
+ import { gcpListComputeInstances } from './compute/list-instances.js';
2
+ import { gcpGetComputeInstance } from './compute/get-instance.js';
3
+ import { gcpStartComputeInstance } from './compute/start-instance.js';
4
+ import { gcpStopComputeInstance } from './compute/stop-instance.js';
5
+ import { gcpGetMonitoringMetrics } from './monitoring/get-metrics.js';
6
+ import { gcpListMonitoringMetricDescriptors } from './monitoring/list-metric-descriptors.js';
7
+ export { gcpListComputeInstances, gcpGetComputeInstance, gcpStartComputeInstance, gcpStopComputeInstance, gcpGetMonitoringMetrics, gcpListMonitoringMetricDescriptors, };
8
+ export const gcpTools = [
9
+ {
10
+ name: 'gcpListComputeInstances',
11
+ description: 'List Compute Engine instances, optionally filtered by zone.',
12
+ tool: gcpListComputeInstances,
13
+ requiredAuth: 'gcpCredentials',
14
+ scope: 'read',
15
+ },
16
+ {
17
+ name: 'gcpGetComputeInstance',
18
+ description: 'Get details about a specific Compute Engine instance.',
19
+ tool: gcpGetComputeInstance,
20
+ requiredAuth: 'gcpCredentials',
21
+ scope: 'read',
22
+ },
23
+ {
24
+ name: 'gcpStartComputeInstance',
25
+ description: 'Start a stopped Compute Engine instance.',
26
+ tool: gcpStartComputeInstance,
27
+ requiredAuth: 'gcpCredentials',
28
+ scope: 'write',
29
+ },
30
+ {
31
+ name: 'gcpStopComputeInstance',
32
+ description: 'Stop a running Compute Engine instance.',
33
+ tool: gcpStopComputeInstance,
34
+ requiredAuth: 'gcpCredentials',
35
+ scope: 'write',
36
+ },
37
+ {
38
+ name: 'gcpGetMonitoringMetrics',
39
+ description: 'Retrieve Cloud Monitoring time series data for a metric filter.',
40
+ tool: gcpGetMonitoringMetrics,
41
+ requiredAuth: 'gcpCredentials',
42
+ scope: 'read',
43
+ },
44
+ {
45
+ name: 'gcpListMonitoringMetricDescriptors',
46
+ description: 'List available Cloud Monitoring metric descriptors.',
47
+ tool: gcpListMonitoringMetricDescriptors,
48
+ requiredAuth: 'gcpCredentials',
49
+ scope: 'read',
50
+ },
51
+ ];
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,26 @@
1
+ export declare const gcpGetMonitoringMetrics: import("ai").Tool<{
2
+ filter: string;
3
+ startTime?: string | undefined;
4
+ endTime?: string | undefined;
5
+ gcpCredentials?: string | undefined;
6
+ }, {
7
+ error: string;
8
+ timeSeries?: undefined;
9
+ message?: undefined;
10
+ } | {
11
+ timeSeries: {
12
+ metric: import("@google-cloud/monitoring/build/protos/protos.js").google.api.IMetric | null | undefined;
13
+ resource: import("@google-cloud/monitoring/build/protos/protos.js").google.api.IMonitoredResource | null | undefined;
14
+ points: {
15
+ value: import("@google-cloud/monitoring/build/protos/protos.js").google.monitoring.v3.ITypedValue | null | undefined;
16
+ interval: import("@google-cloud/monitoring/build/protos/protos.js").google.monitoring.v3.ITimeInterval | null | undefined;
17
+ }[];
18
+ }[];
19
+ error?: undefined;
20
+ message?: undefined;
21
+ } | {
22
+ error: string;
23
+ message: string;
24
+ timeSeries?: undefined;
25
+ }>;
26
+ //# sourceMappingURL=get-metrics.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { tool } from 'ai';
2
+ import { z } from 'zod';
3
+ import { createMonitoringClient, getProjectId } from '../client.js';
4
+ export const gcpGetMonitoringMetrics = tool({
5
+ description: 'Retrieve Cloud Monitoring time series data for a metric filter (e.g. compute.googleapis.com/instance/cpu/utilization). Use this to check resource health or usage trends.',
6
+ inputSchema: z.object({
7
+ gcpCredentials: z.string().optional().describe('Injected by system; do not provide'),
8
+ filter: z
9
+ .string()
10
+ .describe('Monitoring filter, e.g. \'metric.type="compute.googleapis.com/instance/cpu/utilization"\''),
11
+ startTime: z.string().optional().describe('Start time in ISO 8601 format (default: 1 hour ago)'),
12
+ endTime: z.string().optional().describe('End time in ISO 8601 format (default: now)'),
13
+ }),
14
+ execute: async ({ gcpCredentials, filter, startTime, endTime }) => {
15
+ if (!gcpCredentials) {
16
+ return { error: 'GCP credentials are required. Connect GCP first.' };
17
+ }
18
+ try {
19
+ const client = createMonitoringClient(gcpCredentials);
20
+ const projectId = getProjectId(gcpCredentials);
21
+ const [timeSeries] = await client.listTimeSeries({
22
+ name: `projects/${projectId}`,
23
+ filter,
24
+ interval: {
25
+ startTime: {
26
+ seconds: startTime ? Math.floor(new Date(startTime).getTime() / 1000) : Math.floor(Date.now() / 1000) - 3600,
27
+ },
28
+ endTime: {
29
+ seconds: endTime ? Math.floor(new Date(endTime).getTime() / 1000) : Math.floor(Date.now() / 1000),
30
+ },
31
+ },
32
+ view: 'FULL',
33
+ });
34
+ return {
35
+ timeSeries: (timeSeries ?? []).map((series) => ({
36
+ metric: series.metric,
37
+ resource: series.resource,
38
+ points: (series.points ?? []).map((point) => ({
39
+ value: point.value,
40
+ interval: point.interval,
41
+ })),
42
+ })),
43
+ };
44
+ }
45
+ catch (err) {
46
+ return {
47
+ error: 'Failed to get Cloud Monitoring metrics',
48
+ message: err instanceof Error ? err.message : 'Unknown error',
49
+ };
50
+ }
51
+ },
52
+ });
53
+ //# sourceMappingURL=get-metrics.js.map
@@ -0,0 +1,24 @@
1
+ export declare const gcpListMonitoringMetricDescriptors: import("ai").Tool<{
2
+ filter?: string | undefined;
3
+ gcpCredentials?: string | undefined;
4
+ }, {
5
+ error: string;
6
+ descriptors?: undefined;
7
+ message?: undefined;
8
+ } | {
9
+ descriptors: {
10
+ type: string | null | undefined;
11
+ displayName: string | null | undefined;
12
+ description: string | null | undefined;
13
+ metricKind: import("@google-cloud/monitoring/build/protos/protos.js").google.api.MetricDescriptor.MetricKind | "METRIC_KIND_UNSPECIFIED" | "GAUGE" | "DELTA" | "CUMULATIVE" | null | undefined;
14
+ valueType: import("@google-cloud/monitoring/build/protos/protos.js").google.api.MetricDescriptor.ValueType | "VALUE_TYPE_UNSPECIFIED" | "BOOL" | "INT64" | "DOUBLE" | "STRING" | "DISTRIBUTION" | "MONEY" | null | undefined;
15
+ unit: string | null | undefined;
16
+ }[];
17
+ error?: undefined;
18
+ message?: undefined;
19
+ } | {
20
+ error: string;
21
+ message: string;
22
+ descriptors?: undefined;
23
+ }>;
24
+ //# sourceMappingURL=list-metric-descriptors.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { tool } from 'ai';
2
+ import { z } from 'zod';
3
+ import { createMonitoringClient, getProjectId } from '../client.js';
4
+ export const gcpListMonitoringMetricDescriptors = tool({
5
+ description: 'List available Cloud Monitoring metric descriptors, optionally filtered by metric type.',
6
+ inputSchema: z.object({
7
+ gcpCredentials: z.string().optional().describe('Injected by system; do not provide'),
8
+ filter: z.string().optional().describe('Optional filter for metric type, e.g. \'metric.type = starts_with("compute")\''),
9
+ }),
10
+ execute: async ({ gcpCredentials, filter }) => {
11
+ if (!gcpCredentials) {
12
+ return { error: 'GCP credentials are required. Connect GCP first.' };
13
+ }
14
+ try {
15
+ const client = createMonitoringClient(gcpCredentials);
16
+ const projectId = getProjectId(gcpCredentials);
17
+ const [descriptors] = await client.listMetricDescriptors({
18
+ name: `projects/${projectId}`,
19
+ filter,
20
+ });
21
+ return {
22
+ descriptors: (descriptors ?? []).map((descriptor) => ({
23
+ type: descriptor.type,
24
+ displayName: descriptor.displayName,
25
+ description: descriptor.description,
26
+ metricKind: descriptor.metricKind,
27
+ valueType: descriptor.valueType,
28
+ unit: descriptor.unit,
29
+ })),
30
+ };
31
+ }
32
+ catch (err) {
33
+ return {
34
+ error: 'Failed to list Cloud Monitoring metric descriptors',
35
+ message: err instanceof Error ? err.message : 'Unknown error',
36
+ };
37
+ }
38
+ },
39
+ });
40
+ //# sourceMappingURL=list-metric-descriptors.js.map
@@ -12,7 +12,7 @@ export default defineToolkit({
12
12
  tokenField: 'gmailToken',
13
13
  provider: {
14
14
  slug: 'gmail',
15
- env: { clientId: 'GMAIL_CLIENT_ID', clientSecret: 'GMAIL_CLIENT_SECRET' },
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,5 @@
1
+ export declare const GDOCS_ICON: {
2
+ kind: "svg";
3
+ dataUri: string;
4
+ };
5
+ //# sourceMappingURL=icon.d.ts.map
@@ -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,3 @@
1
+ declare const _default: import("../../index.js").ToolkitManifest;
2
+ export default _default;
3
+ //# sourceMappingURL=manifest.d.ts.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