@google/gemini-cli-core 0.0.77777772 → 0.0.899999999

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 (174) hide show
  1. package/README.md +4 -10
  2. package/dist/index.d.ts +2 -3
  3. package/dist/index.js +2 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/config/config.d.ts +6 -11
  6. package/dist/src/config/config.js +11 -31
  7. package/dist/src/config/config.js.map +1 -1
  8. package/dist/src/core/baseLlmClient.d.ts +0 -4
  9. package/dist/src/core/baseLlmClient.js +2 -5
  10. package/dist/src/core/baseLlmClient.js.map +1 -1
  11. package/dist/src/core/baseLlmClient.test.js +0 -23
  12. package/dist/src/core/baseLlmClient.test.js.map +1 -1
  13. package/dist/src/core/client.js +2 -1
  14. package/dist/src/core/client.js.map +1 -1
  15. package/dist/src/core/client.test.js +39 -0
  16. package/dist/src/core/client.test.js.map +1 -1
  17. package/dist/src/core/coreToolScheduler.js +3 -12
  18. package/dist/src/core/coreToolScheduler.js.map +1 -1
  19. package/dist/src/core/coreToolScheduler.test.js +0 -99
  20. package/dist/src/core/coreToolScheduler.test.js.map +1 -1
  21. package/dist/src/core/geminiChat.d.ts +3 -4
  22. package/dist/src/core/geminiChat.js +56 -50
  23. package/dist/src/core/geminiChat.js.map +1 -1
  24. package/dist/src/core/geminiChat.test.js +27 -217
  25. package/dist/src/core/geminiChat.test.js.map +1 -1
  26. package/dist/src/core/prompts.js +2 -3
  27. package/dist/src/core/prompts.js.map +1 -1
  28. package/dist/src/core/turn.d.ts +4 -1
  29. package/dist/src/core/turn.js +12 -2
  30. package/dist/src/core/turn.js.map +1 -1
  31. package/dist/src/generated/git-commit.d.ts +2 -2
  32. package/dist/src/generated/git-commit.js +2 -2
  33. package/dist/src/generated/git-commit.js.map +1 -1
  34. package/dist/src/ide/detect-ide.d.ts +2 -4
  35. package/dist/src/ide/detect-ide.js +1 -7
  36. package/dist/src/ide/detect-ide.js.map +1 -1
  37. package/dist/src/ide/detect-ide.test.js +0 -23
  38. package/dist/src/ide/detect-ide.test.js.map +1 -1
  39. package/dist/src/ide/ide-client.d.ts +1 -2
  40. package/dist/src/ide/ide-client.js +17 -22
  41. package/dist/src/ide/ide-client.js.map +1 -1
  42. package/dist/src/ide/ide-client.test.js +2 -2
  43. package/dist/src/ide/ide-client.test.js.map +1 -1
  44. package/dist/src/index.d.ts +0 -2
  45. package/dist/src/index.js +0 -2
  46. package/dist/src/index.js.map +1 -1
  47. package/dist/src/mcp/oauth-provider.d.ts +0 -1
  48. package/dist/src/mcp/oauth-provider.js +14 -19
  49. package/dist/src/mcp/oauth-provider.js.map +1 -1
  50. package/dist/src/mcp/oauth-provider.test.js +1 -137
  51. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  52. package/dist/src/mcp/oauth-utils.js +0 -1
  53. package/dist/src/mcp/oauth-utils.js.map +1 -1
  54. package/dist/src/routing/strategies/compositeStrategy.js +3 -4
  55. package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
  56. package/dist/src/services/chatRecordingService.d.ts +1 -1
  57. package/dist/src/services/chatRecordingService.js +1 -1
  58. package/dist/src/services/chatRecordingService.js.map +1 -1
  59. package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +2 -6
  60. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -38
  61. package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
  62. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +0 -1
  63. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +1 -128
  64. package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
  65. package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +1 -7
  66. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +0 -12
  67. package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
  68. package/dist/src/telemetry/constants.d.ts +0 -18
  69. package/dist/src/telemetry/constants.js +0 -20
  70. package/dist/src/telemetry/constants.js.map +1 -1
  71. package/dist/src/telemetry/index.d.ts +1 -3
  72. package/dist/src/telemetry/index.js +1 -9
  73. package/dist/src/telemetry/index.js.map +1 -1
  74. package/dist/src/telemetry/loggers.d.ts +1 -3
  75. package/dist/src/telemetry/loggers.js +2 -36
  76. package/dist/src/telemetry/loggers.js.map +1 -1
  77. package/dist/src/telemetry/loggers.test.js +3 -31
  78. package/dist/src/telemetry/loggers.test.js.map +1 -1
  79. package/dist/src/telemetry/metrics.d.ts +1 -40
  80. package/dist/src/telemetry/metrics.js +2 -248
  81. package/dist/src/telemetry/metrics.js.map +1 -1
  82. package/dist/src/telemetry/metrics.test.js +1 -387
  83. package/dist/src/telemetry/metrics.test.js.map +1 -1
  84. package/dist/src/telemetry/sdk.js +1 -4
  85. package/dist/src/telemetry/sdk.js.map +1 -1
  86. package/dist/src/telemetry/sdk.test.js +0 -13
  87. package/dist/src/telemetry/sdk.test.js.map +1 -1
  88. package/dist/src/telemetry/types.d.ts +3 -18
  89. package/dist/src/telemetry/types.js +2 -28
  90. package/dist/src/telemetry/types.js.map +1 -1
  91. package/dist/src/tools/edit.js +0 -6
  92. package/dist/src/tools/edit.js.map +1 -1
  93. package/dist/src/tools/edit.test.js +0 -41
  94. package/dist/src/tools/edit.test.js.map +1 -1
  95. package/dist/src/tools/glob.js +1 -2
  96. package/dist/src/tools/glob.js.map +1 -1
  97. package/dist/src/tools/ls.js +1 -1
  98. package/dist/src/tools/ls.js.map +1 -1
  99. package/dist/src/tools/mcp-client.d.ts +12 -2
  100. package/dist/src/tools/mcp-client.js +64 -5
  101. package/dist/src/tools/mcp-client.js.map +1 -1
  102. package/dist/src/tools/mcp-client.test.js +154 -9
  103. package/dist/src/tools/mcp-client.test.js.map +1 -1
  104. package/dist/src/tools/mcp-tool.js +2 -30
  105. package/dist/src/tools/mcp-tool.js.map +1 -1
  106. package/dist/src/tools/mcp-tool.test.js +0 -117
  107. package/dist/src/tools/mcp-tool.test.js.map +1 -1
  108. package/dist/src/tools/shell.js +3 -59
  109. package/dist/src/tools/shell.js.map +1 -1
  110. package/dist/src/tools/shell.test.js +0 -1
  111. package/dist/src/tools/shell.test.js.map +1 -1
  112. package/dist/src/tools/smart-edit.js +2 -8
  113. package/dist/src/tools/smart-edit.js.map +1 -1
  114. package/dist/src/tools/smart-edit.test.js +2 -47
  115. package/dist/src/tools/smart-edit.test.js.map +1 -1
  116. package/dist/src/tools/tool-error.d.ts +0 -1
  117. package/dist/src/tools/tool-error.js +0 -1
  118. package/dist/src/tools/tool-error.js.map +1 -1
  119. package/dist/src/tools/tools.d.ts +3 -11
  120. package/dist/src/tools/tools.js +3 -94
  121. package/dist/src/tools/tools.js.map +1 -1
  122. package/dist/src/utils/bfsFileSearch.d.ts +1 -1
  123. package/dist/src/utils/getFolderStructure.d.ts +1 -1
  124. package/dist/src/utils/getFolderStructure.js +1 -1
  125. package/dist/src/utils/getFolderStructure.js.map +1 -1
  126. package/dist/src/utils/llm-edit-fixer.js +0 -1
  127. package/dist/src/utils/llm-edit-fixer.js.map +1 -1
  128. package/dist/src/utils/memoryDiscovery.d.ts +1 -1
  129. package/dist/src/utils/memoryDiscovery.js +1 -1
  130. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  131. package/dist/src/utils/retry.js +1 -7
  132. package/dist/src/utils/retry.js.map +1 -1
  133. package/dist/src/utils/retry.test.js +0 -29
  134. package/dist/src/utils/retry.test.js.map +1 -1
  135. package/dist/src/utils/schemaValidator.js +1 -11
  136. package/dist/src/utils/schemaValidator.js.map +1 -1
  137. package/dist/src/utils/shell-utils.d.ts +0 -1
  138. package/dist/src/utils/shell-utils.js +2 -6
  139. package/dist/src/utils/shell-utils.js.map +1 -1
  140. package/dist/src/utils/shell-utils.test.js +0 -5
  141. package/dist/src/utils/shell-utils.test.js.map +1 -1
  142. package/dist/src/utils/tool-utils.js +2 -2
  143. package/dist/src/utils/tool-utils.js.map +1 -1
  144. package/dist/src/utils/tool-utils.test.js +0 -8
  145. package/dist/src/utils/tool-utils.test.js.map +1 -1
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/package.json +2 -2
  148. package/dist/src/config/constants.d.ts +0 -11
  149. package/dist/src/config/constants.js +0 -16
  150. package/dist/src/config/constants.js.map +0 -1
  151. package/dist/src/telemetry/config.d.ts +0 -31
  152. package/dist/src/telemetry/config.js +0 -76
  153. package/dist/src/telemetry/config.js.map +0 -1
  154. package/dist/src/telemetry/config.test.d.ts +0 -6
  155. package/dist/src/telemetry/config.test.js +0 -124
  156. package/dist/src/telemetry/config.test.js.map +0 -1
  157. package/dist/src/tools/message-bus-integration.test.d.ts +0 -6
  158. package/dist/src/tools/message-bus-integration.test.js +0 -183
  159. package/dist/src/tools/message-bus-integration.test.js.map +0 -1
  160. package/dist/src/tools/write-todos.d.ts +0 -25
  161. package/dist/src/tools/write-todos.js +0 -150
  162. package/dist/src/tools/write-todos.js.map +0 -1
  163. package/dist/src/tools/write-todos.test.d.ts +0 -6
  164. package/dist/src/tools/write-todos.test.js +0 -89
  165. package/dist/src/tools/write-todos.test.js.map +0 -1
  166. package/dist/src/utils/schemaValidator.test.d.ts +0 -6
  167. package/dist/src/utils/schemaValidator.test.js +0 -113
  168. package/dist/src/utils/schemaValidator.test.js.map +0 -1
  169. package/dist/src/utils/thoughtUtils.d.ts +0 -21
  170. package/dist/src/utils/thoughtUtils.js +0 -39
  171. package/dist/src/utils/thoughtUtils.js.map +0 -1
  172. package/dist/src/utils/thoughtUtils.test.d.ts +0 -6
  173. package/dist/src/utils/thoughtUtils.test.js +0 -78
  174. package/dist/src/utils/thoughtUtils.test.js.map +0 -1
@@ -1,150 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { BaseDeclarativeTool, BaseToolInvocation, Kind, } from './tools.js';
7
- // Insprired by langchain/deepagents.
8
- export const WRITE_TODOS_DESCRIPTION = `This tool can help you list out the current subtasks that are required to be completed for a given user request. The list of subtasks helps you keep track of the current task, organize complex queries and help ensure that you don't miss any steps. With this list, the user can also see the current progress you are making in executing a given task.
9
-
10
- Depending on the task complexity, you should first divide a given task into subtasks and then use this tool to list out the subtasks that are required to be completed for a given user request.
11
- Each of the subtasks should be clear and distinct.
12
-
13
- Use this tool for complex queries that require multiple steps. If you find that the request is actually complex after you have started executing the user task, create a todo list and use it. If execution of the user task requires multiple steps, planning and generally is higher complexity than a simple Q&A, use this tool.
14
-
15
- DO NOT use this tool for simple tasks that can be completed in less than 2 steps. If the user query is simple and straightforward, do not use the tool. If you can respond with an answer in a single turn then this tool is not required.
16
-
17
- ## Task state definitions
18
-
19
- - pending: Work has not begun on a given subtask.
20
- - in_progress: Marked just prior to beginning work on a given subtask. You should only have one subtask as in_progress at a time.
21
- - completed: Subtask was succesfully completed with no errors or issues. If the subtask required more steps to complete, update the todo list with the subtasks. All steps should be identified as completed only when they are completed.
22
- - cancelled: As you update the todo list, some tasks are not required anymore due to the dynamic nature of the task. In this case, mark the subtasks as cancelled.
23
-
24
-
25
- ## Methodology for using this tool
26
- 1. Use this todo list list as soon as you receive a user request based on the complexity of the task.
27
- 2. Keep track of every subtask that you update the list with.
28
- 3. Mark a subtask as in_progress before you begin working on it. You should only have one subtask as in_progress at a time.
29
- 4. Update the subtask list as you proceed in executing the task. The subtask list is not static and should reflect your progress and current plans, which may evolve as you acquire new information.
30
- 5. Mark a subtask as completed when you have completed it.
31
- 6. Mark a subtask as cancelled if the subtask is no longer needed.
32
- 7. You must update the todo list as soon as you start, stop or cancel a subtask. Don't batch or wait to update the todo list.
33
-
34
-
35
- ## Examples of When to Use the Todo List
36
-
37
- <example>
38
- User request: Create a website with a React for creating fancy logos using gemini-2.5-flash-image
39
-
40
- ToDo list created by the agent:
41
- 1. Initialize a new React project environment (e.g., using Vite).
42
- 2. Design and build the core UI components: a text input (prompt field) for the logo description, selection controls for style parameters (if the API supports them), and an image preview area.
43
- 3. Implement state management (e.g., React Context or Zustand) to manage the user's input prompt, the API loading status (pending, success, error), and the resulting image data.
44
- 4. Create an API service module within the React app (using "fetch" or "axios") to securely format and send the prompt data via an HTTP POST request to the specified "gemini-2.5-flash-image" (Gemini model) endpoint.
45
- 5. Implement asynchronous logic to handle the API call: show a loading indicator while the request is pending, retrieve the generated image (e.g., as a URL or base64 string) upon success, and display any errors.
46
- 6. Display the returned "fancy logo" from the API response in the preview area component.
47
- 7. Add functionality (e.g., a "Download" button) to allow the user to save the generated image file.
48
- 8. Deploy the application to a web server or hosting platform.
49
-
50
- <reasoning>
51
- The agent used the todo list to break the task into distinct, manageable steps:
52
- 1. Building an entire interactive web application from scratch is a highly complex, multi-stage process involving setup, UI development, logic integration, and deployment.
53
- 2. The agent inferred the core functionality required for a "logo creator," such as UI controls for customization (Task 3) and an export feature (Task 7), which must be tracked as distinct goals.
54
- 3. The agent rightly inferred the requirement of an API service model for interacting with the image model endpoint.
55
- </reasoning>
56
- </example>
57
-
58
-
59
- ## Examples of When NOT to Use the Todo List
60
-
61
- <example>
62
- User request: Ensure that the test <test file> passes.
63
-
64
- Agent:
65
- <Goes into a loop of running the test, identifying errors, and updating the code until the test passes.>
66
-
67
- <reasoning>
68
- The agent did not use the todo list because this task could be completed by a tight loop of execute test->edit->execute test.
69
- </reasoning>
70
- </example>
71
- `;
72
- class WriteTodosToolInvocation extends BaseToolInvocation {
73
- getDescription() {
74
- const count = this.params.todos?.length ?? 0;
75
- if (count === 0) {
76
- return 'Cleared todo list';
77
- }
78
- return `Set ${count} todo(s)`;
79
- }
80
- async execute(_signal, _updateOutput) {
81
- const todos = this.params.todos ?? [];
82
- const todoListString = todos
83
- .map((todo, index) => `${index + 1}. [${todo.status}] ${todo.description}`)
84
- .join('\n');
85
- const llmContent = todos.length > 0
86
- ? `Successfully updated the todo list. The current list is now:\n${todoListString}`
87
- : 'Successfully cleared the todo list.';
88
- return {
89
- llmContent,
90
- returnDisplay: llmContent,
91
- };
92
- }
93
- }
94
- export class WriteTodosTool extends BaseDeclarativeTool {
95
- static Name = 'write_todos_list';
96
- constructor() {
97
- super(WriteTodosTool.Name, 'Write Todos', WRITE_TODOS_DESCRIPTION, Kind.Other, {
98
- type: 'object',
99
- properties: {
100
- todos: {
101
- type: 'array',
102
- description: 'The complete list of todo items. This will replace the existing list.',
103
- items: {
104
- type: 'object',
105
- description: 'A single todo item.',
106
- properties: {
107
- description: {
108
- type: 'string',
109
- description: 'The description of the task.',
110
- },
111
- status: {
112
- type: 'string',
113
- description: 'The current status of the task.',
114
- enum: ['pending', 'in_progress', 'completed'],
115
- },
116
- },
117
- required: ['description', 'status'],
118
- },
119
- },
120
- },
121
- required: ['todos'],
122
- });
123
- }
124
- validateToolParamValues(params) {
125
- const todos = params?.todos;
126
- if (!params || !Array.isArray(todos)) {
127
- return '`todos` parameter must be an array';
128
- }
129
- for (const todo of todos) {
130
- if (typeof todo !== 'object' || todo === null) {
131
- return 'Each todo item must be an object';
132
- }
133
- if (typeof todo.description !== 'string' || !todo.description.trim()) {
134
- return 'Each todo must have a non-empty description string';
135
- }
136
- if (!['pending', 'in_progress', 'completed'].includes(todo.status)) {
137
- return 'Each todo must have a valid status (pending, in_progress, or completed)';
138
- }
139
- }
140
- const inProgressCount = todos.filter((todo) => todo.status === 'in_progress').length;
141
- if (inProgressCount > 1) {
142
- return 'Invalid parameters: Only one task can be "in_progress" at a time.';
143
- }
144
- return null;
145
- }
146
- createInvocation(params) {
147
- return new WriteTodosToolInvocation(params);
148
- }
149
- }
150
- //# sourceMappingURL=write-todos.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-todos.js","sourceRoot":"","sources":["../../../src/tools/write-todos.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,IAAI,GAEL,MAAM,YAAY,CAAC;AAEpB,qCAAqC;AACrC,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,IAAI,CAAC;IACd,CAAC;IAES,gBAAgB,CACxB,MAA4B;QAE5B,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export {};
@@ -1,89 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { describe, expect, it } from 'vitest';
7
- import { WriteTodosTool } from './write-todos.js';
8
- describe('WriteTodosTool', () => {
9
- const tool = new WriteTodosTool();
10
- const signal = new AbortController().signal;
11
- describe('validation', () => {
12
- it('should not throw for valid parameters', async () => {
13
- const params = {
14
- todos: [
15
- { description: 'Task 1', status: 'pending' },
16
- { description: 'Task 2', status: 'in_progress' },
17
- { description: 'Task 3', status: 'completed' },
18
- ],
19
- };
20
- await expect(tool.buildAndExecute(params, signal)).resolves.toBeDefined();
21
- });
22
- it('should not throw for an empty list', async () => {
23
- const params = {
24
- todos: [],
25
- };
26
- await expect(tool.buildAndExecute(params, signal)).resolves.toBeDefined();
27
- });
28
- it('should throw an error if todos is not an array', async () => {
29
- const params = {
30
- todos: 'not-an-array',
31
- };
32
- await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos must be array');
33
- });
34
- it('should throw an error if a todo item is not an object', async () => {
35
- const params = {
36
- todos: ['not-an-object'],
37
- };
38
- await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos/0 must be object');
39
- });
40
- it('should throw an error if a todo description is missing or empty', async () => {
41
- const params = {
42
- todos: [{ description: ' ', status: 'pending' }],
43
- };
44
- await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('Each todo must have a non-empty description string');
45
- });
46
- it('should throw an error if a todo status is invalid', async () => {
47
- const params = {
48
- todos: [{ description: 'Task 1', status: 'invalid-status' }],
49
- };
50
- await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('params/todos/0/status must be equal to one of the allowed values');
51
- });
52
- it('should throw an error if more than one task is in_progress', async () => {
53
- const params = {
54
- todos: [
55
- { description: 'Task 1', status: 'in_progress' },
56
- { description: 'Task 2', status: 'in_progress' },
57
- ],
58
- };
59
- await expect(tool.buildAndExecute(params, signal)).rejects.toThrow('Invalid parameters: Only one task can be "in_progress" at a time.');
60
- });
61
- });
62
- describe('execute', () => {
63
- it('should return a success message for clearing the list', async () => {
64
- const params = {
65
- todos: [],
66
- };
67
- const result = await tool.buildAndExecute(params, signal);
68
- expect(result.llmContent).toBe('Successfully cleared the todo list.');
69
- expect(result.returnDisplay).toBe('Successfully cleared the todo list.');
70
- });
71
- it('should return a formatted todo list on success', async () => {
72
- const params = {
73
- todos: [
74
- { description: 'First task', status: 'completed' },
75
- { description: 'Second task', status: 'in_progress' },
76
- { description: 'Third task', status: 'pending' },
77
- ],
78
- };
79
- const result = await tool.buildAndExecute(params, signal);
80
- const expectedOutput = `Successfully updated the todo list. The current list is now:
81
- 1. [completed] First task
82
- 2. [in_progress] Second task
83
- 3. [pending] Third task`;
84
- expect(result.llmContent).toBe(expectedOutput);
85
- expect(result.returnDisplay).toBe(expectedOutput);
86
- });
87
- });
88
- });
89
- //# sourceMappingURL=write-todos.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-todos.test.js","sourceRoot":"","sources":["../../../src/tools/write-todos.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAA6B,MAAM,kBAAkB,CAAC;AAE7E,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC;IAE5C,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE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AM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC1D,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;YACtE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;YAC9D,MAAM,MAAM,GAAyB;gBACnC,KAAK,EAAE;oBACL,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE;oBAClD,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE;oBACrD,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE;iBACjD;aACF,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC1D,MAAM,cAAc,GAAG;;;wBAGL,CAAC;YACnB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC/C,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export {};
@@ -1,113 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { describe, expect, it } from 'vitest';
7
- import { SchemaValidator } from './schemaValidator.js';
8
- describe('SchemaValidator', () => {
9
- it('should allow any params if schema is undefined', () => {
10
- const params = {
11
- foo: 'bar',
12
- };
13
- expect(SchemaValidator.validate(undefined, params)).toBeNull();
14
- });
15
- it('rejects null params', () => {
16
- const schema = {
17
- type: 'object',
18
- properties: {
19
- foo: {
20
- type: 'string',
21
- },
22
- },
23
- };
24
- expect(SchemaValidator.validate(schema, null)).toBe('Value of params must be an object');
25
- });
26
- it('rejects params that are not objects', () => {
27
- const schema = {
28
- type: 'object',
29
- properties: {
30
- foo: {
31
- type: 'string',
32
- },
33
- },
34
- };
35
- expect(SchemaValidator.validate(schema, 'not an object')).toBe('Value of params must be an object');
36
- });
37
- it('allows schema with extra properties', () => {
38
- const schema = {
39
- type: 'object',
40
- properties: {
41
- example_enum: {
42
- type: 'string',
43
- enum: ['FOO', 'BAR'],
44
- // enum-descriptions is not part of the JSON schema spec.
45
- // This test verifies that the SchemaValidator allows the
46
- // use of extra keywords, like this one, in the schema.
47
- 'enum-descriptions': ['a foo', 'a bar'],
48
- },
49
- },
50
- };
51
- const params = {
52
- example_enum: 'BAR',
53
- };
54
- expect(SchemaValidator.validate(schema, params)).toBeNull();
55
- });
56
- it('allows custom format values', () => {
57
- const schema = {
58
- type: 'object',
59
- properties: {
60
- duration: {
61
- type: 'string',
62
- // See: https://cloud.google.com/docs/discovery/type-format
63
- format: 'google-duration',
64
- },
65
- mask: {
66
- type: 'string',
67
- format: 'google-fieldmask',
68
- },
69
- foo: {
70
- type: 'string',
71
- format: 'something-totally-custom',
72
- },
73
- },
74
- };
75
- const params = {
76
- duration: '10s',
77
- mask: 'foo.bar,biz.baz',
78
- foo: 'some value',
79
- };
80
- expect(SchemaValidator.validate(schema, params)).toBeNull();
81
- });
82
- it('allows valid values for known formats', () => {
83
- const schema = {
84
- type: 'object',
85
- properties: {
86
- today: {
87
- type: 'string',
88
- format: 'date',
89
- },
90
- },
91
- };
92
- const params = {
93
- today: '2025-04-08',
94
- };
95
- expect(SchemaValidator.validate(schema, params)).toBeNull();
96
- });
97
- it('rejects invalid values for known formats', () => {
98
- const schema = {
99
- type: 'object',
100
- properties: {
101
- today: {
102
- type: 'string',
103
- format: 'date',
104
- },
105
- },
106
- };
107
- const params = {
108
- today: 'this is not a date',
109
- };
110
- expect(SchemaValidator.validate(schema, params)).not.toBeNull();
111
- });
112
- });
113
- //# sourceMappingURL=schemaValidator.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaValidator.test.js","sourceRoot":"","sources":["../../../src/utils/schemaValidator.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,MAAM,GAAG;YACb,GAAG,EAAE,KAAK;SACX,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;iBACf;aACF;SACF,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CACjD,mCAAmC,CACpC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;iBACf;aACF;SACF,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,C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E;QAC/C,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,MAAM;iBACf;aACF;SACF,CAAC;QACF,MAAM,MAAM,GAAG;YACb,KAAK,EAAE,YAAY;SACpB,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,MAAM;iBACf;aACF;SACF,CAAC;QACF,MAAM,MAAM,GAAG;YACb,KAAK,EAAE,oBAAoB;SAC5B,CAAC;QACF,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export type ThoughtSummary = {
7
- subject: string;
8
- description: string;
9
- };
10
- /**
11
- * Parses a raw thought string into a structured ThoughtSummary object.
12
- *
13
- * Thoughts are expected to have a bold "subject" part enclosed in double
14
- * asterisks (e.g., **Subject**). The rest of the string is considered
15
- * the description. This function only parses the first valid subject found.
16
- *
17
- * @param rawText The raw text of the thought.
18
- * @returns A ThoughtSummary object. If no valid subject is found, the entire
19
- * string is treated as the description.
20
- */
21
- export declare function parseThought(rawText: string): ThoughtSummary;
@@ -1,39 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- const START_DELIMITER = '**';
7
- const END_DELIMITER = '**';
8
- /**
9
- * Parses a raw thought string into a structured ThoughtSummary object.
10
- *
11
- * Thoughts are expected to have a bold "subject" part enclosed in double
12
- * asterisks (e.g., **Subject**). The rest of the string is considered
13
- * the description. This function only parses the first valid subject found.
14
- *
15
- * @param rawText The raw text of the thought.
16
- * @returns A ThoughtSummary object. If no valid subject is found, the entire
17
- * string is treated as the description.
18
- */
19
- export function parseThought(rawText) {
20
- const startIndex = rawText.indexOf(START_DELIMITER);
21
- if (startIndex === -1) {
22
- // No start delimiter found, the whole text is the description.
23
- return { subject: '', description: rawText.trim() };
24
- }
25
- const endIndex = rawText.indexOf(END_DELIMITER, startIndex + START_DELIMITER.length);
26
- if (endIndex === -1) {
27
- // Start delimiter found but no end delimiter, so it's not a valid subject.
28
- // Treat the entire string as the description.
29
- return { subject: '', description: rawText.trim() };
30
- }
31
- const subject = rawText
32
- .substring(startIndex + START_DELIMITER.length, endIndex)
33
- .trim();
34
- // The description is everything before the start delimiter and after the end delimiter.
35
- const description = (rawText.substring(0, startIndex) +
36
- rawText.substring(endIndex + END_DELIMITER.length)).trim();
37
- return { subject, description };
38
- }
39
- //# sourceMappingURL=thoughtUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thoughtUtils.js","sourceRoot":"","sources":["../../../src/utils/thoughtUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACpD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,+DAA+D;QAC/D,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAC9B,aAAa,EACb,UAAU,GAAG,eAAe,CAAC,MAAM,CACpC,CAAC;IACF,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,2EAA2E;QAC3E,8CAA8C;QAC9C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,OAAO,GAAG,OAAO;SACpB,SAAS,CAAC,UAAU,GAAG,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC;SACxD,IAAI,EAAE,CAAC;IAEV,wFAAwF;IACxF,MAAM,WAAW,GAAG,CAClB,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC;QAChC,OAAO,CAAC,SAAS,CAAC,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CACnD,CAAC,IAAI,EAAE,CAAC;IAET,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export {};
@@ -1,78 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { describe, it, expect } from 'vitest';
7
- import { parseThought } from './thoughtUtils.js';
8
- describe('parseThought', () => {
9
- it.each([
10
- {
11
- name: 'a standard thought with subject and description',
12
- rawText: '**Subject:** This is the description.',
13
- expected: {
14
- subject: 'Subject:',
15
- description: 'This is the description.',
16
- },
17
- },
18
- {
19
- name: 'leading and trailing whitespace in the raw string',
20
- rawText: ' **Subject** description with spaces ',
21
- expected: { subject: 'Subject', description: 'description with spaces' },
22
- },
23
- {
24
- name: 'whitespace surrounding the subject content',
25
- rawText: '** Subject **',
26
- expected: { subject: 'Subject', description: '' },
27
- },
28
- {
29
- name: 'a thought with only a subject',
30
- rawText: '**Only Subject**',
31
- expected: { subject: 'Only Subject', description: '' },
32
- },
33
- {
34
- name: 'a thought with only a description (no subject)',
35
- rawText: 'This is just a description.',
36
- expected: { subject: '', description: 'This is just a description.' },
37
- },
38
- {
39
- name: 'an empty string input',
40
- rawText: '',
41
- expected: { subject: '', description: '' },
42
- },
43
- {
44
- name: 'newlines within the subject and description',
45
- rawText: '**Multi-line\nSubject**\nHere is a description\nspread across lines.',
46
- expected: {
47
- subject: 'Multi-line\nSubject',
48
- description: 'Here is a description\nspread across lines.',
49
- },
50
- },
51
- {
52
- name: 'only the first subject if multiple are present',
53
- rawText: '**First** some text **Second**',
54
- expected: { subject: 'First', description: 'some text **Second**' },
55
- },
56
- {
57
- name: 'text before and after the subject',
58
- rawText: 'Prefix text **Subject** Suffix text.',
59
- expected: {
60
- subject: 'Subject',
61
- description: 'Prefix text Suffix text.',
62
- },
63
- },
64
- {
65
- name: 'an unclosed subject tag',
66
- rawText: 'Text with **an unclosed subject',
67
- expected: { subject: '', description: 'Text with **an unclosed subject' },
68
- },
69
- {
70
- name: 'an empty subject tag',
71
- rawText: 'A thought with **** in the middle.',
72
- expected: { subject: '', description: 'A thought with in the middle.' },
73
- },
74
- ])('should correctly parse $name', ({ rawText, expected }) => {
75
- expect(parseThought(rawText)).toEqual(expected);
76
- });
77
- });
78
- //# sourceMappingURL=thoughtUtils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thoughtUtils.test.js","sourceRoot":"","sources":["../../../src/utils/thoughtUtils.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,IAAI,CAAC;QACN;YACE,IAAI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