@tuturuuu/ai 0.0.10

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 (130) hide show
  1. package/README.md +76 -0
  2. package/package.json +106 -0
  3. package/src/api-key-hash.ts +28 -0
  4. package/src/calendar/events.ts +34 -0
  5. package/src/calendar/route.ts +114 -0
  6. package/src/chat/credit-source.ts +1 -0
  7. package/src/chat/google/chat-request-schema.ts +150 -0
  8. package/src/chat/google/default-system-instruction.ts +198 -0
  9. package/src/chat/google/message-file-processing.ts +212 -0
  10. package/src/chat/google/mira-step-preparation.ts +221 -0
  11. package/src/chat/google/new/route.ts +368 -0
  12. package/src/chat/google/route-auth.ts +81 -0
  13. package/src/chat/google/route-chat-resolution.ts +98 -0
  14. package/src/chat/google/route-credits.ts +61 -0
  15. package/src/chat/google/route-message-preparation.ts +331 -0
  16. package/src/chat/google/route-mira-runtime.ts +206 -0
  17. package/src/chat/google/route.ts +632 -0
  18. package/src/chat/google/stream-finish-persistence.ts +722 -0
  19. package/src/chat/google/summary/route.ts +153 -0
  20. package/src/chat/mira-render-ui-policy.ts +540 -0
  21. package/src/chat/mira-system-instruction.ts +484 -0
  22. package/src/chat-sdk/adapters.ts +389 -0
  23. package/src/chat-sdk/registry.ts +197 -0
  24. package/src/chat-sdk.ts +33 -0
  25. package/src/core.ts +3 -0
  26. package/src/credits/cap-output-tokens.ts +90 -0
  27. package/src/credits/check-credits.ts +232 -0
  28. package/src/credits/constants.ts +30 -0
  29. package/src/credits/index.ts +46 -0
  30. package/src/credits/model-mapping.ts +92 -0
  31. package/src/credits/reservations.ts +514 -0
  32. package/src/credits/resolve-plan-model.ts +219 -0
  33. package/src/credits/sync-gateway-models.ts +351 -0
  34. package/src/credits/types.ts +109 -0
  35. package/src/credits/use-ai-credits.ts +3 -0
  36. package/src/embeddings/metered.ts +283 -0
  37. package/src/executions/route.ts +137 -0
  38. package/src/generate/route.ts +411 -0
  39. package/src/hooks.ts +7 -0
  40. package/src/meetings/summary/route.ts +7 -0
  41. package/src/meetings/transcription/route.ts +134 -0
  42. package/src/memory/client.ts +158 -0
  43. package/src/memory/config.ts +38 -0
  44. package/src/memory/index.ts +32 -0
  45. package/src/memory/ingest.ts +51 -0
  46. package/src/memory/middleware.ts +35 -0
  47. package/src/memory/operations.ts +480 -0
  48. package/src/memory/scope.ts +102 -0
  49. package/src/memory/settings.ts +121 -0
  50. package/src/memory/types.ts +101 -0
  51. package/src/memory/workspace.ts +36 -0
  52. package/src/memory.ts +1 -0
  53. package/src/mind/patch.ts +146 -0
  54. package/src/mind/route.ts +687 -0
  55. package/src/mind/tools.ts +1500 -0
  56. package/src/mind/types.ts +20 -0
  57. package/src/object/core.ts +3 -0
  58. package/src/object/flashcards/route.ts +140 -0
  59. package/src/object/quizzes/explanation/route.ts +145 -0
  60. package/src/object/quizzes/route.ts +142 -0
  61. package/src/object/types.ts +187 -0
  62. package/src/object/year-plan/route.ts +196 -0
  63. package/src/react.ts +1 -0
  64. package/src/scheduling/algorithm.ts +791 -0
  65. package/src/scheduling/default.ts +36 -0
  66. package/src/scheduling/duration-optimizer.ts +689 -0
  67. package/src/scheduling/index.ts +79 -0
  68. package/src/scheduling/priority-calculator.ts +187 -0
  69. package/src/scheduling/recurrence-calculator.ts +621 -0
  70. package/src/scheduling/templates.ts +892 -0
  71. package/src/scheduling/types.ts +136 -0
  72. package/src/scheduling/web-adapter.ts +308 -0
  73. package/src/scheduling.ts +6 -0
  74. package/src/supported-actions.ts +1 -0
  75. package/src/supported-providers.ts +6 -0
  76. package/src/tools/context-builder.ts +372 -0
  77. package/src/tools/core.ts +1 -0
  78. package/src/tools/definitions/calendar.ts +106 -0
  79. package/src/tools/definitions/finance.ts +197 -0
  80. package/src/tools/definitions/image.ts +74 -0
  81. package/src/tools/definitions/memory.ts +83 -0
  82. package/src/tools/definitions/meta.ts +154 -0
  83. package/src/tools/definitions/render-ui.ts +81 -0
  84. package/src/tools/definitions/tasks.ts +343 -0
  85. package/src/tools/definitions/time-tracking.ts +381 -0
  86. package/src/tools/definitions/workspace-context.ts +45 -0
  87. package/src/tools/definitions/workspace-user-chat.ts +111 -0
  88. package/src/tools/executors/calendar.ts +371 -0
  89. package/src/tools/executors/chat.ts +15 -0
  90. package/src/tools/executors/finance.ts +638 -0
  91. package/src/tools/executors/helpers/encryption.ts +107 -0
  92. package/src/tools/executors/image.ts +247 -0
  93. package/src/tools/executors/markitdown.ts +684 -0
  94. package/src/tools/executors/memory.ts +277 -0
  95. package/src/tools/executors/parallel-checks.ts +176 -0
  96. package/src/tools/executors/qr.ts +170 -0
  97. package/src/tools/executors/scope-helpers.ts +192 -0
  98. package/src/tools/executors/search.ts +149 -0
  99. package/src/tools/executors/settings.ts +40 -0
  100. package/src/tools/executors/tasks.ts +1087 -0
  101. package/src/tools/executors/theme.ts +23 -0
  102. package/src/tools/executors/timer/timer-categories-executor.ts +110 -0
  103. package/src/tools/executors/timer/timer-category-mutations.ts +240 -0
  104. package/src/tools/executors/timer/timer-goal-mutations.ts +323 -0
  105. package/src/tools/executors/timer/timer-goals-executor.ts +272 -0
  106. package/src/tools/executors/timer/timer-helpers.ts +372 -0
  107. package/src/tools/executors/timer/timer-mutation-schemas.ts +160 -0
  108. package/src/tools/executors/timer/timer-mutation-types.ts +212 -0
  109. package/src/tools/executors/timer/timer-mutations.ts +19 -0
  110. package/src/tools/executors/timer/timer-queries.ts +18 -0
  111. package/src/tools/executors/timer/timer-session-lifecycle.ts +299 -0
  112. package/src/tools/executors/timer/timer-session-mutations.ts +10 -0
  113. package/src/tools/executors/timer/timer-session-queries.ts +153 -0
  114. package/src/tools/executors/timer/timer-session-updates.ts +200 -0
  115. package/src/tools/executors/timer/timer-sessions-executor.ts +91 -0
  116. package/src/tools/executors/timer/timer-stats-executor.ts +157 -0
  117. package/src/tools/executors/timer.ts +22 -0
  118. package/src/tools/executors/user.ts +60 -0
  119. package/src/tools/executors/workspace.ts +135 -0
  120. package/src/tools/json-render-catalog.ts +875 -0
  121. package/src/tools/mira-tool-definitions.ts +55 -0
  122. package/src/tools/mira-tool-dispatcher.ts +265 -0
  123. package/src/tools/mira-tool-metadata.ts +164 -0
  124. package/src/tools/mira-tool-names.ts +95 -0
  125. package/src/tools/mira-tool-render-ui.ts +54 -0
  126. package/src/tools/mira-tool-types.ts +17 -0
  127. package/src/tools/mira-tools.ts +167 -0
  128. package/src/tools/normalize-render-ui-input.ts +321 -0
  129. package/src/tools/workspace-context.ts +233 -0
  130. package/src/types.ts +38 -0
@@ -0,0 +1,343 @@
1
+ import { z } from 'zod';
2
+ import { tool } from '../core';
3
+
4
+ const colorHexRegex = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
5
+
6
+ export const taskToolDefinitions = {
7
+ get_my_tasks: tool({
8
+ description:
9
+ "Get the current user's tasks organized by status. Returns overdue, due today, and upcoming tasks with priority and dates. Use category (or status) with values: all, overdue, today, upcoming.",
10
+ inputSchema: z
11
+ .object({
12
+ category: z
13
+ .enum(['all', 'overdue', 'today', 'upcoming'])
14
+ .optional()
15
+ .describe(
16
+ 'Filter tasks by time category. Use "all" to get everything.'
17
+ ),
18
+ status: z
19
+ .enum(['all', 'overdue', 'today', 'upcoming'])
20
+ .optional()
21
+ .describe('Alias for category. Use either category or status.'),
22
+ })
23
+ .refine(
24
+ (data) =>
25
+ data.category === undefined ||
26
+ data.status === undefined ||
27
+ data.category === data.status,
28
+ {
29
+ message: 'category and status must match when both are provided',
30
+ path: ['status'],
31
+ }
32
+ ),
33
+ }),
34
+
35
+ create_task: tool({
36
+ description:
37
+ "Create a new task in the user's workspace. Tasks MUST be placed in a task list (board → list hierarchy). Use list_boards and list_task_lists first to discover existing structure, then pass boardId and listId. If omitted, the system auto-picks the first board/list or creates defaults. By default the task is assigned to the current user.",
38
+ inputSchema: z.object({
39
+ name: z.string().describe('Task title'),
40
+ description: z
41
+ .string()
42
+ .nullish()
43
+ .describe('Task description (plain text), or null/omit'),
44
+ priority: z
45
+ .enum(['low', 'normal', 'high', 'critical'])
46
+ .nullish()
47
+ .describe('Task priority level, or null/omit for no priority'),
48
+ boardId: z
49
+ .guid()
50
+ .optional()
51
+ .describe(
52
+ 'UUID of the board to create the task in. Use list_boards to discover. If omitted, uses the first workspace board or creates a default one.'
53
+ ),
54
+ listId: z
55
+ .guid()
56
+ .optional()
57
+ .describe(
58
+ 'UUID of the task list to place the task in. Use list_task_lists to discover lists within a board. If omitted, uses the first list in the board or creates a default one.'
59
+ ),
60
+ assignToSelf: z
61
+ .boolean()
62
+ .optional()
63
+ .describe('Assign to current user. Defaults to true.'),
64
+ }),
65
+ }),
66
+
67
+ complete_task: tool({
68
+ description: 'Mark a task as completed by its ID.',
69
+ inputSchema: z.object({
70
+ taskId: z.guid().describe('UUID of the task to complete'),
71
+ }),
72
+ }),
73
+
74
+ update_task: tool({
75
+ description:
76
+ 'Update fields on an existing task. Use taskId (or id) for the task UUID and endDate (or dueDate) for due date (ISO). Only pass fields that need changing.',
77
+ inputSchema: z
78
+ .object({
79
+ taskId: z.guid().optional().describe('UUID of the task'),
80
+ id: z
81
+ .guid()
82
+ .optional()
83
+ .describe('Alias for taskId. Use either taskId or id.'),
84
+ name: z.string().optional().describe('New task name'),
85
+ description: z
86
+ .string()
87
+ .nullable()
88
+ .optional()
89
+ .describe('New description'),
90
+ priority: z
91
+ .enum(['low', 'normal', 'high', 'critical'])
92
+ .nullable()
93
+ .optional()
94
+ .describe('New priority'),
95
+ startDate: z
96
+ .string()
97
+ .datetime()
98
+ .nullable()
99
+ .optional()
100
+ .describe('Start date ISO'),
101
+ endDate: z
102
+ .string()
103
+ .datetime()
104
+ .nullable()
105
+ .optional()
106
+ .describe('Due date ISO (use for due date)'),
107
+ dueDate: z
108
+ .string()
109
+ .datetime()
110
+ .nullable()
111
+ .optional()
112
+ .describe('Alias for endDate. Use either endDate or dueDate.'),
113
+ estimationPoints: z
114
+ .number()
115
+ .int()
116
+ .min(0)
117
+ .max(7)
118
+ .optional()
119
+ .describe('Estimation point index (0-7)'),
120
+ listId: z.guid().optional().describe('Move to a different list'),
121
+ })
122
+ .refine(
123
+ (data) =>
124
+ [data.taskId, data.id].some(
125
+ (value) => typeof value === 'string' && value.trim().length > 0
126
+ ),
127
+ {
128
+ message: 'taskId or id is required',
129
+ path: ['taskId'],
130
+ }
131
+ )
132
+ .refine(
133
+ (data) =>
134
+ data.taskId === undefined ||
135
+ data.id === undefined ||
136
+ data.taskId === data.id,
137
+ {
138
+ message: 'taskId and id must match when both are provided',
139
+ path: ['id'],
140
+ }
141
+ )
142
+ .refine(
143
+ (data) =>
144
+ data.endDate === undefined ||
145
+ data.dueDate === undefined ||
146
+ data.endDate === data.dueDate,
147
+ {
148
+ message: 'endDate and dueDate must match when both are provided',
149
+ path: ['dueDate'],
150
+ }
151
+ ),
152
+ }),
153
+
154
+ delete_task: tool({
155
+ description: 'Soft-delete a task by ID.',
156
+ inputSchema: z.object({
157
+ taskId: z.guid().describe('UUID of the task to delete'),
158
+ }),
159
+ }),
160
+
161
+ list_boards: tool({
162
+ description: 'List all task boards in the workspace.',
163
+ inputSchema: z.object({}),
164
+ }),
165
+
166
+ create_board: tool({
167
+ description: 'Create a new task board.',
168
+ inputSchema: z.object({
169
+ name: z.string().describe('Board name'),
170
+ }),
171
+ }),
172
+
173
+ update_board: tool({
174
+ description: 'Update a board name.',
175
+ inputSchema: z.object({
176
+ boardId: z.guid().describe('Board UUID'),
177
+ name: z.string().describe('New board name'),
178
+ }),
179
+ }),
180
+
181
+ delete_board: tool({
182
+ description: 'Delete a task board.',
183
+ inputSchema: z.object({
184
+ boardId: z.guid().describe('Board UUID'),
185
+ }),
186
+ }),
187
+
188
+ list_task_lists: tool({
189
+ description: 'List columns/lists within a specific board.',
190
+ inputSchema: z.object({
191
+ boardId: z.guid().describe('Board UUID'),
192
+ }),
193
+ }),
194
+
195
+ create_task_list: tool({
196
+ description: 'Create a new list/column in a board.',
197
+ inputSchema: z.object({
198
+ boardId: z.guid().describe('Board UUID'),
199
+ name: z.string().describe('List name'),
200
+ color: z
201
+ .string()
202
+ .regex(colorHexRegex, 'Color must be a valid hex code')
203
+ .optional()
204
+ .describe('Color hex code'),
205
+ }),
206
+ }),
207
+
208
+ update_task_list: tool({
209
+ description: 'Update a task list.',
210
+ inputSchema: z.object({
211
+ listId: z.guid().describe('List UUID'),
212
+ name: z.string().optional().describe('New name'),
213
+ color: z
214
+ .string()
215
+ .regex(colorHexRegex, 'Color must be a valid hex code')
216
+ .optional()
217
+ .describe('New color'),
218
+ position: z.number().int().optional().describe('New sort position'),
219
+ }),
220
+ }),
221
+
222
+ delete_task_list: tool({
223
+ description: 'Delete a task list.',
224
+ inputSchema: z.object({
225
+ listId: z.guid().describe('List UUID'),
226
+ }),
227
+ }),
228
+
229
+ list_task_labels: tool({
230
+ description: 'List all task labels in the workspace.',
231
+ inputSchema: z.object({}),
232
+ }),
233
+
234
+ create_task_label: tool({
235
+ description: 'Create a task label.',
236
+ inputSchema: z.object({
237
+ name: z.string().describe('Label name'),
238
+ color: z
239
+ .string()
240
+ .regex(colorHexRegex, 'Color must be a valid hex code')
241
+ .optional()
242
+ .describe('Color hex code'),
243
+ }),
244
+ }),
245
+
246
+ update_task_label: tool({
247
+ description: 'Update a task label.',
248
+ inputSchema: z.object({
249
+ labelId: z.guid().describe('Label UUID'),
250
+ name: z.string().optional().describe('New name'),
251
+ color: z
252
+ .string()
253
+ .regex(colorHexRegex, 'Color must be a valid hex code')
254
+ .optional()
255
+ .describe('New color'),
256
+ }),
257
+ }),
258
+
259
+ delete_task_label: tool({
260
+ description: 'Delete a task label.',
261
+ inputSchema: z.object({
262
+ labelId: z.guid().describe('Label UUID'),
263
+ }),
264
+ }),
265
+
266
+ add_task_labels: tool({
267
+ description: 'Assign one or more labels to a task.',
268
+ inputSchema: z.object({
269
+ taskId: z.guid().describe('Task UUID'),
270
+ labelIds: z.array(z.guid()).min(1).describe('Label UUIDs to add'),
271
+ }),
272
+ }),
273
+
274
+ remove_task_labels: tool({
275
+ description: 'Remove one or more labels from a task.',
276
+ inputSchema: z.object({
277
+ taskId: z.guid().describe('Task UUID'),
278
+ labelIds: z.array(z.guid()).min(1).describe('Label UUIDs to remove'),
279
+ }),
280
+ }),
281
+
282
+ list_projects: tool({
283
+ description: 'List all projects in the workspace.',
284
+ inputSchema: z.object({}),
285
+ }),
286
+
287
+ create_project: tool({
288
+ description: 'Create a new project.',
289
+ inputSchema: z.object({
290
+ name: z.string().describe('Project name'),
291
+ description: z.string().optional().describe('Project description'),
292
+ }),
293
+ }),
294
+
295
+ update_project: tool({
296
+ description: 'Update a project.',
297
+ inputSchema: z.object({
298
+ projectId: z.guid().describe('Project UUID'),
299
+ name: z.string().optional().describe('New name'),
300
+ description: z.string().optional().describe('New description'),
301
+ }),
302
+ }),
303
+
304
+ delete_project: tool({
305
+ description: 'Delete a project.',
306
+ inputSchema: z.object({
307
+ projectId: z.guid().describe('Project UUID'),
308
+ }),
309
+ }),
310
+
311
+ add_task_to_project: tool({
312
+ description: 'Link a task to a project.',
313
+ inputSchema: z.object({
314
+ taskId: z.guid().describe('Task UUID'),
315
+ projectId: z.guid().describe('Project UUID'),
316
+ }),
317
+ }),
318
+
319
+ remove_task_from_project: tool({
320
+ description: 'Unlink a task from a project.',
321
+ inputSchema: z.object({
322
+ taskId: z.guid().describe('Task UUID'),
323
+ projectId: z.guid().describe('Project UUID'),
324
+ }),
325
+ }),
326
+
327
+ add_task_assignee: tool({
328
+ description:
329
+ 'Assign a user to a task. Use list_workspace_members to find user IDs.',
330
+ inputSchema: z.object({
331
+ taskId: z.guid().describe('Task UUID'),
332
+ userId: z.guid().describe('User UUID to assign'),
333
+ }),
334
+ }),
335
+
336
+ remove_task_assignee: tool({
337
+ description: 'Remove a user from a task.',
338
+ inputSchema: z.object({
339
+ taskId: z.guid().describe('Task UUID'),
340
+ userId: z.guid().describe('User UUID to remove'),
341
+ }),
342
+ }),
343
+ } as const;