terse-cli 0.3.8 → 0.4.1

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 (270) hide show
  1. package/dist/cliUi.js +1 -1
  2. package/dist/cliUi.js.map +1 -1
  3. package/dist/commands/deploy.d.ts.map +1 -1
  4. package/dist/commands/deploy.js +138 -22
  5. package/dist/commands/deploy.js.map +1 -1
  6. package/dist/providers/typescript/TypeScriptProvider.js +2 -2
  7. package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
  8. package/dist/providers/typescript/durableRuntime.d.ts +1 -1
  9. package/dist/providers/typescript/durableRuntime.d.ts.map +1 -1
  10. package/dist/providers/typescript/durableRuntime.js +7 -6
  11. package/dist/providers/typescript/durableRuntime.js.map +1 -1
  12. package/dist/providers/typescript/workflowShim.d.ts +2 -0
  13. package/dist/providers/typescript/workflowShim.d.ts.map +1 -0
  14. package/dist/providers/typescript/workflowShim.js +51 -0
  15. package/dist/providers/typescript/workflowShim.js.map +1 -0
  16. package/package.json +5 -5
  17. package/templates/typescript/init/package.json.hbs +1 -1
  18. package/templates/typescript/workflow-shim/api.js +5 -0
  19. package/templates/typescript/workflow-shim/index.js +2 -0
  20. package/templates/typescript/workflow-shim/internal/builtins.js +83 -0
  21. package/templates/typescript/workflow-shim/internal/class-serialization.js +1 -0
  22. package/templates/typescript/workflow-shim/runtime.js +1 -0
  23. package/templates/typescript/workflow-shim/stdlib.js +18 -0
  24. package/templates/typescript/workflow-shim/workflow.js +2 -0
  25. package/dist/_tmp_create_project.d.ts +0 -2
  26. package/dist/_tmp_create_project.d.ts.map +0 -1
  27. package/dist/_tmp_create_project.js +0 -17
  28. package/dist/_tmp_create_project.js.map +0 -1
  29. package/dist/_tmp_delete_agent.d.ts +0 -2
  30. package/dist/_tmp_delete_agent.d.ts.map +0 -1
  31. package/dist/_tmp_delete_agent.js +0 -14
  32. package/dist/_tmp_delete_agent.js.map +0 -1
  33. package/dist/_tmp_manual_trigger.d.ts +0 -2
  34. package/dist/_tmp_manual_trigger.d.ts.map +0 -1
  35. package/dist/_tmp_manual_trigger.js +0 -17
  36. package/dist/_tmp_manual_trigger.js.map +0 -1
  37. package/dist/_tmp_patch_active.d.ts +0 -2
  38. package/dist/_tmp_patch_active.d.ts.map +0 -1
  39. package/dist/_tmp_patch_active.js +0 -21
  40. package/dist/_tmp_patch_active.js.map +0 -1
  41. package/dist/attach.d.ts +0 -3
  42. package/dist/attach.d.ts.map +0 -1
  43. package/dist/attach.js +0 -61
  44. package/dist/attach.js.map +0 -1
  45. package/dist/auth.d.ts +0 -15
  46. package/dist/auth.d.ts.map +0 -1
  47. package/dist/auth.js +0 -169
  48. package/dist/auth.js.map +0 -1
  49. package/dist/codegen.d.ts +0 -135
  50. package/dist/codegen.d.ts.map +0 -1
  51. package/dist/codegen.js +0 -1196
  52. package/dist/codegen.js.map +0 -1
  53. package/dist/commands/deployTheme.d.ts +0 -28
  54. package/dist/commands/deployTheme.d.ts.map +0 -1
  55. package/dist/commands/deployTheme.js +0 -68
  56. package/dist/commands/deployTheme.js.map +0 -1
  57. package/dist/commands/dev.d.ts +0 -3
  58. package/dist/commands/dev.d.ts.map +0 -1
  59. package/dist/commands/dev.js +0 -47
  60. package/dist/commands/dev.js.map +0 -1
  61. package/dist/commands/fsExec.d.ts +0 -8
  62. package/dist/commands/fsExec.d.ts.map +0 -1
  63. package/dist/commands/fsExec.js +0 -46
  64. package/dist/commands/fsExec.js.map +0 -1
  65. package/dist/commands/metaAdsScope.d.ts +0 -12
  66. package/dist/commands/metaAdsScope.d.ts.map +0 -1
  67. package/dist/commands/metaAdsScope.js +0 -120
  68. package/dist/commands/metaAdsScope.js.map +0 -1
  69. package/dist/commands/serve.d.ts +0 -1
  70. package/dist/commands/serve.d.ts.map +0 -1
  71. package/dist/commands/serve.js +0 -2
  72. package/dist/commands/serve.js.map +0 -1
  73. package/dist/commands/terseCliTheme.d.ts +0 -28
  74. package/dist/commands/terseCliTheme.d.ts.map +0 -1
  75. package/dist/commands/terseCliTheme.js +0 -68
  76. package/dist/commands/terseCliTheme.js.map +0 -1
  77. package/dist/commands/tool.d.ts +0 -6
  78. package/dist/commands/tool.d.ts.map +0 -1
  79. package/dist/commands/tool.js +0 -34
  80. package/dist/commands/tool.js.map +0 -1
  81. package/dist/data/standardSlackEmoji.d.ts +0 -2
  82. package/dist/data/standardSlackEmoji.d.ts.map +0 -1
  83. package/dist/data/standardSlackEmoji.js +0 -1978
  84. package/dist/data/standardSlackEmoji.js.map +0 -1
  85. package/dist/data/standardSlackEmoji.json +0 -1974
  86. package/dist/deploy.d.ts +0 -3
  87. package/dist/deploy.d.ts.map +0 -1
  88. package/dist/deploy.js +0 -124
  89. package/dist/deploy.js.map +0 -1
  90. package/dist/generate.d.ts +0 -3
  91. package/dist/generate.d.ts.map +0 -1
  92. package/dist/generate.js +0 -282
  93. package/dist/generate.js.map +0 -1
  94. package/dist/init.d.ts +0 -3
  95. package/dist/init.d.ts.map +0 -1
  96. package/dist/init.js +0 -98
  97. package/dist/init.js.map +0 -1
  98. package/dist/integrate.d.ts +0 -3
  99. package/dist/integrate.d.ts.map +0 -1
  100. package/dist/integrate.js +0 -214
  101. package/dist/integrate.js.map +0 -1
  102. package/dist/nonInteractive.d.ts +0 -20
  103. package/dist/nonInteractive.d.ts.map +0 -1
  104. package/dist/nonInteractive.js +0 -60
  105. package/dist/nonInteractive.js.map +0 -1
  106. package/dist/perf.d.ts +0 -9
  107. package/dist/perf.d.ts.map +0 -1
  108. package/dist/perf.js +0 -59
  109. package/dist/perf.js.map +0 -1
  110. package/dist/providers/codegen.test.d.ts +0 -2
  111. package/dist/providers/codegen.test.d.ts.map +0 -1
  112. package/dist/providers/codegen.test.js +0 -45
  113. package/dist/providers/codegen.test.js.map +0 -1
  114. package/dist/providers/python/PythonProvider.d.ts +0 -51
  115. package/dist/providers/python/PythonProvider.d.ts.map +0 -1
  116. package/dist/providers/python/PythonProvider.js +0 -414
  117. package/dist/providers/python/PythonProvider.js.map +0 -1
  118. package/dist/providers/python/PythonProvider.test.d.ts +0 -2
  119. package/dist/providers/python/PythonProvider.test.d.ts.map +0 -1
  120. package/dist/providers/python/PythonProvider.test.js +0 -169
  121. package/dist/providers/python/PythonProvider.test.js.map +0 -1
  122. package/dist/providers/python/preparePythonCodegenData.d.ts +0 -139
  123. package/dist/providers/python/preparePythonCodegenData.d.ts.map +0 -1
  124. package/dist/providers/python/preparePythonCodegenData.js +0 -452
  125. package/dist/providers/python/preparePythonCodegenData.js.map +0 -1
  126. package/dist/providers/python/pythonTemplateEngine.d.ts +0 -3
  127. package/dist/providers/python/pythonTemplateEngine.d.ts.map +0 -1
  128. package/dist/providers/python/pythonTemplateEngine.js +0 -30
  129. package/dist/providers/python/pythonTemplateEngine.js.map +0 -1
  130. package/dist/providers/shared/shellUtils.d.ts +0 -2
  131. package/dist/providers/shared/shellUtils.d.ts.map +0 -1
  132. package/dist/providers/shared/shellUtils.js +0 -25
  133. package/dist/providers/shared/shellUtils.js.map +0 -1
  134. package/dist/providers/typescript/attioProjection.d.ts +0 -50
  135. package/dist/providers/typescript/attioProjection.d.ts.map +0 -1
  136. package/dist/providers/typescript/attioProjection.js +0 -358
  137. package/dist/providers/typescript/attioProjection.js.map +0 -1
  138. package/dist/providers/typescript/modules/cursor/CursorModule.d.ts +0 -20
  139. package/dist/providers/typescript/modules/cursor/CursorModule.d.ts.map +0 -1
  140. package/dist/providers/typescript/modules/cursor/CursorModule.js +0 -27
  141. package/dist/providers/typescript/modules/cursor/CursorModule.js.map +0 -1
  142. package/dist/providers/typescript/prepareCodegenData.d.ts +0 -166
  143. package/dist/providers/typescript/prepareCodegenData.d.ts.map +0 -1
  144. package/dist/providers/typescript/prepareCodegenData.js +0 -1431
  145. package/dist/providers/typescript/prepareCodegenData.js.map +0 -1
  146. package/dist/providers/typescript/prepareCodegenData.test.d.ts +0 -2
  147. package/dist/providers/typescript/prepareCodegenData.test.d.ts.map +0 -1
  148. package/dist/providers/typescript/prepareCodegenData.test.js +0 -54
  149. package/dist/providers/typescript/prepareCodegenData.test.js.map +0 -1
  150. package/dist/providers/typescript/projectedTypes.d.ts +0 -11
  151. package/dist/providers/typescript/projectedTypes.d.ts.map +0 -1
  152. package/dist/providers/typescript/projectedTypes.js +0 -53
  153. package/dist/providers/typescript/projectedTypes.js.map +0 -1
  154. package/dist/providers/typescript/projectionPrinter.d.ts +0 -26
  155. package/dist/providers/typescript/projectionPrinter.d.ts.map +0 -1
  156. package/dist/providers/typescript/projectionPrinter.js +0 -110
  157. package/dist/providers/typescript/projectionPrinter.js.map +0 -1
  158. package/dist/providers/typescript/replayLogDedupe.d.ts +0 -6
  159. package/dist/providers/typescript/replayLogDedupe.d.ts.map +0 -1
  160. package/dist/providers/typescript/replayLogDedupe.js +0 -156
  161. package/dist/providers/typescript/replayLogDedupe.js.map +0 -1
  162. package/dist/providers/typescript/triggerPayloads.d.ts +0 -7
  163. package/dist/providers/typescript/triggerPayloads.d.ts.map +0 -1
  164. package/dist/providers/typescript/triggerPayloads.js +0 -60
  165. package/dist/providers/typescript/triggerPayloads.js.map +0 -1
  166. package/dist/providers/typescript/triggerTypeRegistry.d.ts +0 -7
  167. package/dist/providers/typescript/triggerTypeRegistry.d.ts.map +0 -1
  168. package/dist/providers/typescript/triggerTypeRegistry.js +0 -198
  169. package/dist/providers/typescript/triggerTypeRegistry.js.map +0 -1
  170. package/dist/run.d.ts +0 -3
  171. package/dist/run.d.ts.map +0 -1
  172. package/dist/run.js +0 -72
  173. package/dist/run.js.map +0 -1
  174. package/dist/sampleEventCache.d.ts +0 -9
  175. package/dist/sampleEventCache.d.ts.map +0 -1
  176. package/dist/sampleEventCache.js +0 -47
  177. package/dist/sampleEventCache.js.map +0 -1
  178. package/dist/sampleEventId.d.ts +0 -9
  179. package/dist/sampleEventId.d.ts.map +0 -1
  180. package/dist/sampleEventId.js +0 -16
  181. package/dist/sampleEventId.js.map +0 -1
  182. package/dist/shared/ApiRoutes.d.ts +0 -348
  183. package/dist/shared/ApiRoutes.d.ts.map +0 -1
  184. package/dist/shared/ApiRoutes.js +0 -325
  185. package/dist/shared/ApiRoutes.js.map +0 -1
  186. package/dist/shared/ApprovalTypes.d.ts +0 -29
  187. package/dist/shared/ApprovalTypes.d.ts.map +0 -1
  188. package/dist/shared/ApprovalTypes.js +0 -8
  189. package/dist/shared/ApprovalTypes.js.map +0 -1
  190. package/dist/shared/ClientBoundTools.d.ts +0 -37
  191. package/dist/shared/ClientBoundTools.d.ts.map +0 -1
  192. package/dist/shared/ClientBoundTools.js +0 -37
  193. package/dist/shared/ClientBoundTools.js.map +0 -1
  194. package/dist/shared/Configs.d.ts +0 -488
  195. package/dist/shared/Configs.d.ts.map +0 -1
  196. package/dist/shared/Configs.js +0 -785
  197. package/dist/shared/Configs.js.map +0 -1
  198. package/dist/shared/DonatedState.d.ts +0 -5
  199. package/dist/shared/DonatedState.d.ts.map +0 -1
  200. package/dist/shared/DonatedState.js +0 -13
  201. package/dist/shared/DonatedState.js.map +0 -1
  202. package/dist/shared/Entities.d.ts +0 -8
  203. package/dist/shared/Entities.d.ts.map +0 -1
  204. package/dist/shared/Entities.js +0 -9
  205. package/dist/shared/Entities.js.map +0 -1
  206. package/dist/shared/FrontendRoutes.d.ts +0 -54
  207. package/dist/shared/FrontendRoutes.d.ts.map +0 -1
  208. package/dist/shared/FrontendRoutes.js +0 -54
  209. package/dist/shared/FrontendRoutes.js.map +0 -1
  210. package/dist/shared/Integrations.d.ts +0 -235
  211. package/dist/shared/Integrations.d.ts.map +0 -1
  212. package/dist/shared/Integrations.js +0 -143
  213. package/dist/shared/Integrations.js.map +0 -1
  214. package/dist/shared/InvalidationKeys.d.ts +0 -53
  215. package/dist/shared/InvalidationKeys.d.ts.map +0 -1
  216. package/dist/shared/InvalidationKeys.js +0 -166
  217. package/dist/shared/InvalidationKeys.js.map +0 -1
  218. package/dist/shared/ModelEvents.d.ts +0 -176
  219. package/dist/shared/ModelEvents.d.ts.map +0 -1
  220. package/dist/shared/ModelEvents.js +0 -29
  221. package/dist/shared/ModelEvents.js.map +0 -1
  222. package/dist/shared/Notifications.d.ts +0 -43
  223. package/dist/shared/Notifications.d.ts.map +0 -1
  224. package/dist/shared/Notifications.js +0 -6
  225. package/dist/shared/Notifications.js.map +0 -1
  226. package/dist/shared/RunHistoryTypes.d.ts +0 -95
  227. package/dist/shared/RunHistoryTypes.d.ts.map +0 -1
  228. package/dist/shared/RunHistoryTypes.js +0 -11
  229. package/dist/shared/RunHistoryTypes.js.map +0 -1
  230. package/dist/shared/SentNotifications.d.ts +0 -30
  231. package/dist/shared/SentNotifications.d.ts.map +0 -1
  232. package/dist/shared/SentNotifications.js +0 -13
  233. package/dist/shared/SentNotifications.js.map +0 -1
  234. package/dist/shared/SocketEvents.d.ts +0 -49
  235. package/dist/shared/SocketEvents.d.ts.map +0 -1
  236. package/dist/shared/SocketEvents.js +0 -53
  237. package/dist/shared/SocketEvents.js.map +0 -1
  238. package/dist/shared/Survey.d.ts +0 -10
  239. package/dist/shared/Survey.d.ts.map +0 -1
  240. package/dist/shared/Survey.js +0 -2
  241. package/dist/shared/Survey.js.map +0 -1
  242. package/dist/shared/TicketSystem.d.ts +0 -154
  243. package/dist/shared/TicketSystem.d.ts.map +0 -1
  244. package/dist/shared/TicketSystem.js +0 -21
  245. package/dist/shared/TicketSystem.js.map +0 -1
  246. package/dist/shared/ToolDisplayUtils.d.ts +0 -30
  247. package/dist/shared/ToolDisplayUtils.d.ts.map +0 -1
  248. package/dist/shared/ToolDisplayUtils.js +0 -1163
  249. package/dist/shared/ToolDisplayUtils.js.map +0 -1
  250. package/dist/shared/ToolsTypes.d.ts +0 -18
  251. package/dist/shared/ToolsTypes.d.ts.map +0 -1
  252. package/dist/shared/ToolsTypes.js +0 -2
  253. package/dist/shared/ToolsTypes.js.map +0 -1
  254. package/dist/shared/types.d.ts +0 -1732
  255. package/dist/shared/types.d.ts.map +0 -1
  256. package/dist/shared/types.js +0 -17
  257. package/dist/shared/types.js.map +0 -1
  258. package/dist/test.d.ts +0 -3
  259. package/dist/test.d.ts.map +0 -1
  260. package/dist/test.js +0 -82
  261. package/dist/test.js.map +0 -1
  262. package/dist/triggerParseDetail.d.ts +0 -8
  263. package/dist/triggerParseDetail.d.ts.map +0 -1
  264. package/dist/triggerParseDetail.js +0 -30
  265. package/dist/triggerParseDetail.js.map +0 -1
  266. package/dist/util.d.ts +0 -3
  267. package/dist/util.d.ts.map +0 -1
  268. package/dist/util.js +0 -5
  269. package/dist/util.js.map +0 -1
  270. package/templates/typescript/codegen/.impeccable/hook.cache.json +0 -1
@@ -1,1163 +0,0 @@
1
- import { INTEGRATION_METADATA } from "../shared/Integrations";
2
- var PolledRunStatus;
3
- (function (PolledRunStatus) {
4
- PolledRunStatus["SUCCESS"] = "success";
5
- PolledRunStatus["FAILED"] = "failed";
6
- PolledRunStatus["CANCELLED"] = "cancelled";
7
- PolledRunStatus["SKIPPED"] = "skipped";
8
- PolledRunStatus["AWAITING_APPROVAL"] = "awaiting_approval";
9
- PolledRunStatus["IN_PROGRESS"] = "in_progress";
10
- })(PolledRunStatus || (PolledRunStatus = {}));
11
- /**
12
- * Helper to get a friendly integration name from params
13
- */
14
- function getIntegrationName(integrationType) {
15
- if (!integrationType)
16
- return "integration";
17
- const meta = INTEGRATION_METADATA[integrationType];
18
- return meta?.name || integrationType;
19
- }
20
- /** Truncate a string to maxLen characters with an ellipsis */
21
- function truncate(text, maxLen = 35) {
22
- return text.length > maxLen ? `${text.slice(0, maxLen)}…` : text;
23
- }
24
- /** Safely parse a JSON result string into an object */
25
- function safeParseResult(result) {
26
- if (!result)
27
- return undefined;
28
- try {
29
- const parsed = JSON.parse(result);
30
- return typeof parsed === "object" && parsed !== null ? parsed : undefined;
31
- }
32
- catch {
33
- return undefined;
34
- }
35
- }
36
- function toPolledRunStatus(status) {
37
- switch (status) {
38
- case PolledRunStatus.SUCCESS:
39
- return PolledRunStatus.SUCCESS;
40
- case PolledRunStatus.FAILED:
41
- return PolledRunStatus.FAILED;
42
- case PolledRunStatus.CANCELLED:
43
- return PolledRunStatus.CANCELLED;
44
- case PolledRunStatus.SKIPPED:
45
- return PolledRunStatus.SKIPPED;
46
- case PolledRunStatus.AWAITING_APPROVAL:
47
- return PolledRunStatus.AWAITING_APPROVAL;
48
- case PolledRunStatus.IN_PROGRESS:
49
- return PolledRunStatus.IN_PROGRESS;
50
- default:
51
- return null;
52
- }
53
- }
54
- /**
55
- * Display configurations for all tools.
56
- * Each tool defines how it should be displayed in preparing, executing, and complete phases.
57
- *
58
- * Phase meanings:
59
- * - preparing: The AI is generating parameters for the tool call (thinking/planning)
60
- * - executing: The tool is actively running (performing the action)
61
- * - complete: The tool has finished — params and result are both available
62
- */
63
- const TOOL_DISPLAY_CONFIG = {
64
- // ===================
65
- // ChatAgent Tools
66
- // ===================
67
- applyAgent: {
68
- preparing: "Getting your workflow ready",
69
- executing: params => {
70
- const agent = params?.agent;
71
- const name = agent?.name;
72
- return name ? `Setting up "${truncate(name)}"` : "Setting up your workflow";
73
- },
74
- complete: params => {
75
- const agent = params?.agent;
76
- const name = agent?.name;
77
- return name ? `You're all set: "${truncate(name)}"` : "Your workflow is ready";
78
- }
79
- },
80
- promptForIntegration: {
81
- preparing: "Getting connection ready",
82
- executing: params => {
83
- const integration = getIntegrationName(params?.integration);
84
- return `Connecting ${integration}`;
85
- },
86
- complete: params => {
87
- const integration = getIntegrationName(params?.integration);
88
- return `${integration} is connected`;
89
- }
90
- },
91
- askSurveyQuestion: {
92
- preparing: "Quick question",
93
- executing: params => {
94
- const question = params?.question || "A quick question";
95
- return question.length > 40 ? `${question.slice(0, 40)}…` : question;
96
- },
97
- complete: (_params, result) => {
98
- if (!result)
99
- return "Answered";
100
- // Result may be a JSON-encoded string (e.g. "\"Option A\"") or a JSON object
101
- try {
102
- const parsed = JSON.parse(result);
103
- if (typeof parsed === "string")
104
- return truncate(parsed, 50);
105
- if (typeof parsed === "object" && parsed !== null) {
106
- const answer = parsed.text;
107
- if (typeof answer === "string")
108
- return truncate(answer, 50);
109
- return "Answered";
110
- }
111
- }
112
- catch {
113
- // raw string, use as-is
114
- }
115
- return `Answered: ${truncate(result, 50)}`;
116
- }
117
- },
118
- fetchResourcesForIntegration: {
119
- preparing: "Looking things up",
120
- executing: params => {
121
- const integration = getIntegrationName(params?.integrationType);
122
- return `Checking what's available in ${integration}`;
123
- },
124
- complete: params => {
125
- const integration = getIntegrationName(params?.integrationType);
126
- return `Found available options in ${integration}`;
127
- }
128
- },
129
- getSampleEvents: {
130
- preparing: "Finding recent examples",
131
- executing: params => {
132
- const integration = getIntegrationName(params?.integrationType);
133
- return `Getting recent examples from ${integration}`;
134
- },
135
- complete: (params, result) => {
136
- const parsed = safeParseResult(result);
137
- const events = parsed?.events;
138
- const count = events?.length;
139
- const integration = getIntegrationName(params?.integrationType);
140
- if (count !== undefined && integration)
141
- return `Found ${count} recent example${count !== 1 ? "s" : ""} from ${integration}`;
142
- if (count !== undefined)
143
- return `Found ${count} recent example${count !== 1 ? "s" : ""}`;
144
- return `Found recent examples from ${integration}`;
145
- }
146
- },
147
- triggerAgentRun: {
148
- preparing: "Starting a run",
149
- executing: () => "Starting a run",
150
- complete: (_params, result) => {
151
- const parsed = safeParseResult(result);
152
- const name = parsed?.agentName;
153
- if (name)
154
- return `Started "${truncate(name)}"`;
155
- return "Run started";
156
- },
157
- approval: () => "Start this run?"
158
- },
159
- pollTriggeredRunStatus: {
160
- preparing: "Getting the latest progress",
161
- executing: () => "Checking progress",
162
- complete: (_params, result) => {
163
- const parsed = safeParseResult(result);
164
- const status = toPolledRunStatus(parsed?.status);
165
- const timedOut = parsed?.timedOut;
166
- const name = parsed?.agentName;
167
- if (timedOut) {
168
- return name ? `"${truncate(name)}" is still running` : "Still running";
169
- }
170
- switch (status) {
171
- case PolledRunStatus.SUCCESS:
172
- return name ? `"${truncate(name)}" finished` : "Finished";
173
- case PolledRunStatus.FAILED:
174
- return name ? `"${truncate(name)}" could not finish` : "Could not finish";
175
- case PolledRunStatus.CANCELLED:
176
- return name ? `"${truncate(name)}" was cancelled` : "Cancelled";
177
- case PolledRunStatus.SKIPPED:
178
- return name ? `"${truncate(name)}" was skipped` : "Skipped";
179
- case PolledRunStatus.AWAITING_APPROVAL:
180
- return name ? `"${truncate(name)}" needs approval` : "Needs approval";
181
- case PolledRunStatus.IN_PROGRESS:
182
- return name ? `"${truncate(name)}" is still running` : "Still running";
183
- default:
184
- return "Checked progress";
185
- }
186
- }
187
- },
188
- // ===================
189
- // Linear Tools
190
- // ===================
191
- linear_create_ticket: {
192
- preparing: "Getting a task ready",
193
- executing: params => {
194
- const ticket = params?.ticket;
195
- const title = ticket?.title;
196
- return title ? `Creating task: "${truncate(title)}"` : "Creating task";
197
- },
198
- complete: (params, result) => {
199
- const parsed = safeParseResult(result);
200
- const issue = parsed?.issue;
201
- const identifier = issue?.identifier;
202
- const ticketParams = params?.ticket;
203
- const title = ticketParams?.title || issue?.title;
204
- if (identifier && title)
205
- return `Created task ${identifier}: "${truncate(title, 30)}"`;
206
- if (identifier)
207
- return `Created task ${identifier}`;
208
- if (title)
209
- return `Created task "${truncate(title)}"`;
210
- return "Task created";
211
- },
212
- approval: params => {
213
- const ticket = params?.ticket;
214
- const title = ticket?.title;
215
- return title ? `Create task: "${truncate(title)}"?` : "Create this task?";
216
- }
217
- },
218
- linear_update_ticket: {
219
- preparing: "Getting your updates ready",
220
- executing: params => {
221
- const issueId = params?.issueId;
222
- return issueId ? `Updating task ${issueId}` : "Updating task";
223
- },
224
- complete: (_params, result) => {
225
- const parsed = safeParseResult(result);
226
- const issue = parsed?.issue;
227
- const identifier = issue?.identifier;
228
- return identifier ? `Updated task ${identifier}` : "Task updated";
229
- },
230
- approval: () => "Update this task?"
231
- },
232
- linear_add_comment: {
233
- preparing: "Getting your note ready",
234
- executing: params => {
235
- const issueId = params?.issueId;
236
- return issueId ? `Adding a note to ${issueId}` : "Adding a note";
237
- },
238
- complete: (_params, result) => {
239
- const parsed = safeParseResult(result);
240
- const actions = parsed?.actions;
241
- const target = actions?.[0]?.target;
242
- return target ? `Added a note to ${target}` : "Note added";
243
- },
244
- approval: () => "Add this comment?"
245
- },
246
- linear_search_ticket: {
247
- preparing: "Looking for tasks",
248
- executing: params => {
249
- const query = params?.searchTerm;
250
- return query ? `Looking for tasks about "${truncate(query)}"` : "Looking for tasks";
251
- },
252
- complete: (params, result) => {
253
- const parsed = safeParseResult(result);
254
- const count = parsed?.count;
255
- const query = params?.searchTerm;
256
- if (count !== undefined && query)
257
- return `Found ${count} task${count !== 1 ? "s" : ""} about "${truncate(query, 25)}"`;
258
- if (count !== undefined)
259
- return `Found ${count} task${count !== 1 ? "s" : ""}`;
260
- if (query)
261
- return `Looked for "${truncate(query)}"`;
262
- return "Search complete";
263
- }
264
- },
265
- linear_read_ticket: {
266
- preparing: "Loading task details",
267
- executing: params => {
268
- const issueId = params?.issueId;
269
- return issueId ? `Loading task ${issueId}` : "Loading task details";
270
- },
271
- complete: (_params, result) => {
272
- const parsed = safeParseResult(result);
273
- const issue = parsed?.issue;
274
- const identifier = issue?.identifier;
275
- const title = issue?.title;
276
- if (identifier && title)
277
- return `Loaded ${identifier}: "${truncate(title, 30)}"`;
278
- if (identifier)
279
- return `Loaded task ${identifier}`;
280
- return "Task loaded";
281
- }
282
- },
283
- linear_get_states: {
284
- preparing: "Loading status options",
285
- executing: () => "Loading status options",
286
- complete: (_params, result) => {
287
- const parsed = safeParseResult(result);
288
- const states = parsed?.states;
289
- const n = Array.isArray(states) ? states.length : undefined;
290
- if (n !== undefined)
291
- return `Found ${n} status option${n !== 1 ? "s" : ""}`;
292
- return "Status options loaded";
293
- }
294
- },
295
- linear_get_labels: {
296
- preparing: "Loading tags",
297
- executing: () => "Loading tags",
298
- complete: (_params, result) => {
299
- const parsed = safeParseResult(result);
300
- const labels = parsed?.labels;
301
- const n = Array.isArray(labels) ? labels.length : undefined;
302
- if (n !== undefined)
303
- return `Found ${n} tag${n !== 1 ? "s" : ""}`;
304
- return "Tags loaded";
305
- }
306
- },
307
- linear_get_teams: {
308
- preparing: "Loading teams",
309
- executing: () => "Loading teams",
310
- complete: (_params, result) => {
311
- const parsed = safeParseResult(result);
312
- const teams = parsed?.teams;
313
- const n = Array.isArray(teams) ? teams.length : undefined;
314
- if (n !== undefined)
315
- return `Found ${n} team${n !== 1 ? "s" : ""}`;
316
- return "Teams loaded";
317
- }
318
- },
319
- linear_get_projects: {
320
- preparing: "Loading projects",
321
- executing: () => "Loading projects",
322
- complete: (_params, result) => {
323
- const parsed = safeParseResult(result);
324
- const projects = parsed?.projects;
325
- const n = Array.isArray(projects) ? projects.length : undefined;
326
- if (n !== undefined)
327
- return `Found ${n} project${n !== 1 ? "s" : ""}`;
328
- return "Projects loaded";
329
- }
330
- },
331
- linear_get_users: {
332
- preparing: "Loading people",
333
- executing: () => "Loading people",
334
- complete: (_params, result) => {
335
- const parsed = safeParseResult(result);
336
- const users = parsed?.users;
337
- const n = Array.isArray(users) ? users.length : undefined;
338
- if (n !== undefined)
339
- return `Found ${n} person${n !== 1 ? "s" : ""}`;
340
- return "People loaded";
341
- }
342
- },
343
- // ===================
344
- // Jira Tools
345
- // ===================
346
- jira_create_ticket: {
347
- preparing: "Getting a task ready",
348
- executing: params => {
349
- const title = params?.title;
350
- return title ? `Creating task: "${truncate(title)}"` : "Creating task";
351
- },
352
- complete: (params, result) => {
353
- const parsed = safeParseResult(result);
354
- const issue = parsed?.issue;
355
- const key = issue?.key;
356
- const title = params?.title || issue?.title;
357
- if (key && title)
358
- return `Created task ${key}: "${truncate(title, 30)}"`;
359
- if (key)
360
- return `Created task ${key}`;
361
- if (title)
362
- return `Created task "${truncate(title)}"`;
363
- return "Task created";
364
- },
365
- approval: params => {
366
- const title = params?.title;
367
- return title ? `Create Jira ticket: "${truncate(title)}"?` : "Create this Jira ticket?";
368
- }
369
- },
370
- jira_update_ticket: {
371
- preparing: "Getting your updates ready",
372
- executing: params => {
373
- const issueKey = params?.issueKey;
374
- return issueKey ? `Updating task ${issueKey}` : "Updating task";
375
- },
376
- complete: params => {
377
- const issueKey = params?.issueKey;
378
- return issueKey ? `Updated task ${issueKey}` : "Task updated";
379
- },
380
- approval: () => "Update this task?"
381
- },
382
- jira_search_ticket: {
383
- preparing: "Looking for tasks",
384
- executing: params => {
385
- const text = params?.text;
386
- return text ? `Looking for tasks about "${truncate(text)}"` : "Looking for tasks";
387
- },
388
- complete: (params, result) => {
389
- const parsed = safeParseResult(result);
390
- const count = parsed?.count;
391
- const text = params?.text;
392
- if (count !== undefined && text)
393
- return `Found ${count} task${count !== 1 ? "s" : ""} about "${truncate(text, 25)}"`;
394
- if (count !== undefined)
395
- return `Found ${count} task${count !== 1 ? "s" : ""}`;
396
- if (text)
397
- return `Looked for "${truncate(text)}"`;
398
- return "Search complete";
399
- }
400
- },
401
- // ===================
402
- // Notion Tools
403
- // ===================
404
- notion_create_or_update_database_row: {
405
- preparing: "Getting your update ready",
406
- executing: () => "Saving your update",
407
- complete: () => "Your update was saved",
408
- approval: () => "Save this database update?"
409
- },
410
- notion_create_or_update_page: {
411
- preparing: "Getting page changes ready",
412
- executing: () => "Saving page changes",
413
- complete: () => "Page updated",
414
- approval: () => "Save page changes?"
415
- },
416
- notion_modify_blocks: {
417
- preparing: "Getting changes ready",
418
- executing: () => "Updating page content",
419
- complete: (_params, result) => {
420
- const parsed = safeParseResult(result);
421
- const operation = parsed?.operation;
422
- if (operation === "append")
423
- return "Added to page";
424
- if (operation === "update")
425
- return "Updated page";
426
- if (operation === "delete")
427
- return "Removed from page";
428
- return "Page updated";
429
- },
430
- approval: () => "Modify page content?"
431
- },
432
- notion_query_page: {
433
- preparing: "Finding page",
434
- executing: () => "Loading page",
435
- complete: () => "Page loaded"
436
- },
437
- notion_query_database: {
438
- preparing: "Searching your workspace",
439
- executing: () => "Looking through your workspace",
440
- complete: (_params, result) => {
441
- const parsed = safeParseResult(result);
442
- const total = parsed?.total_returned;
443
- return total !== undefined ? `Found ${total} match${total !== 1 ? "es" : ""}` : "Search complete";
444
- }
445
- },
446
- notion_get_schema: {
447
- preparing: "Checking how this is organized",
448
- executing: () => "Loading layout details",
449
- complete: (_params, result) => {
450
- const parsed = safeParseResult(result);
451
- const name = parsed?.database_name;
452
- return name ? `Loaded layout for "${truncate(name)}"` : "Layout loaded";
453
- }
454
- },
455
- notion_fetch_related_events: {
456
- preparing: "Looking for related activity",
457
- executing: () => "Loading related activity",
458
- complete: (_params, result) => {
459
- const parsed = safeParseResult(result);
460
- const count = parsed?.events_count;
461
- return count !== undefined ? `Found ${count} related update${count !== 1 ? "s" : ""}` : "Related activity loaded";
462
- }
463
- },
464
- notion_list_users: {
465
- preparing: "Loading workspace members",
466
- executing: () => "Loading workspace members",
467
- complete: (_params, result) => {
468
- const parsed = safeParseResult(result);
469
- const count = parsed?.count;
470
- if (count !== undefined)
471
- return `Found ${count} workspace member${count !== 1 ? "s" : ""}`;
472
- return "Workspace members loaded";
473
- }
474
- },
475
- // ===================
476
- // Gmail Tools
477
- // ===================
478
- gmail_send_email: {
479
- preparing: "Getting your email ready",
480
- executing: params => {
481
- const to = params?.to;
482
- return to ? `Sending email to ${truncate(to, 30)}` : "Sending email";
483
- },
484
- complete: params => {
485
- const to = params?.to;
486
- const subject = params?.subject;
487
- if (subject && to)
488
- return `Sent "${truncate(subject, 25)}" to ${truncate(to, 20)}`;
489
- if (to)
490
- return `Sent email to ${truncate(to, 30)}`;
491
- return "Email sent";
492
- },
493
- approval: params => {
494
- const to = params?.to;
495
- const subject = params?.subject;
496
- if (subject && to)
497
- return `Send "${truncate(subject, 25)}" to ${truncate(to, 20)}?`;
498
- if (to)
499
- return `Send email to ${truncate(to, 30)}?`;
500
- return "Send this email?";
501
- }
502
- },
503
- gmail_create_draft: {
504
- preparing: "Getting your draft ready",
505
- executing: params => {
506
- const to = params?.to;
507
- return to ? `Creating draft for ${truncate(to, 30)}` : "Creating draft";
508
- },
509
- complete: params => {
510
- const to = params?.to;
511
- const subject = params?.subject;
512
- if (subject && to)
513
- return `Draft created: "${truncate(subject, 25)}" to ${truncate(to, 20)}`;
514
- if (to)
515
- return `Draft created for ${truncate(to, 30)}`;
516
- return "Draft created";
517
- },
518
- approval: params => {
519
- const to = params?.to;
520
- return to ? `Create draft for ${truncate(to, 30)}?` : "Create this draft?";
521
- }
522
- },
523
- // ===================
524
- // Slack Tools
525
- // ===================
526
- slack_send_message: {
527
- preparing: "Getting your message ready",
528
- executing: () => "Sending your message",
529
- complete: (_params, result) => {
530
- const parsed = safeParseResult(result);
531
- const channel = parsed?.channel;
532
- return channel ? `Sent message to ${channel}` : "Slack message sent";
533
- },
534
- approval: () => "Send this Slack message?"
535
- },
536
- slack_list_channels: {
537
- preparing: "Loading channels",
538
- executing: () => "Loading channels",
539
- complete: (_params, result) => {
540
- const parsed = safeParseResult(result);
541
- const count = parsed?.count;
542
- if (count !== undefined)
543
- return `Found ${count} channel${count !== 1 ? "s" : ""}`;
544
- return "Channels loaded";
545
- }
546
- },
547
- slack_list_users: {
548
- preparing: "Loading people",
549
- executing: params => {
550
- const query = params?.query;
551
- return query ? `Looking for "${truncate(query)}"` : "Loading people";
552
- },
553
- complete: (params, result) => {
554
- const parsed = safeParseResult(result);
555
- const count = parsed?.count;
556
- const query = params?.query;
557
- if (count !== undefined && query)
558
- return `Found ${count} person${count !== 1 ? "s" : ""} matching "${truncate(query, 25)}"`;
559
- if (count !== undefined)
560
- return `Found ${count} person${count !== 1 ? "s" : ""}`;
561
- return "People loaded";
562
- }
563
- },
564
- slack_read_conversation: {
565
- preparing: "Loading conversation",
566
- executing: () => "Loading conversation",
567
- complete: (_params, result) => {
568
- const parsed = safeParseResult(result);
569
- const channelName = parsed?.channelName;
570
- const count = parsed?.count;
571
- if (channelName && count !== undefined)
572
- return `Loaded ${count} message${count !== 1 ? "s" : ""} from ${channelName}`;
573
- if (channelName)
574
- return `Loaded conversation from ${channelName}`;
575
- return "Conversation loaded";
576
- }
577
- },
578
- // ===================
579
- // Confluence Tools
580
- // ===================
581
- confluence_query_page: {
582
- preparing: "Finding page",
583
- executing: () => "Loading page",
584
- complete: (_params, result) => {
585
- const parsed = safeParseResult(result);
586
- const title = parsed?.title;
587
- return title ? `Opened "${truncate(title)}"` : "Page loaded";
588
- }
589
- },
590
- confluence_add_comment: {
591
- preparing: "Getting your note ready",
592
- executing: () => "Adding your note",
593
- complete: () => "Note added",
594
- approval: () => "Add this comment?"
595
- },
596
- // ===================
597
- // GitHub Tools
598
- // ===================
599
- searchGitHubCode: {
600
- preparing: "Looking through code",
601
- executing: params => {
602
- const query = params?.query;
603
- return query ? `Looking for "${truncate(query)}" in code` : "Looking through code";
604
- },
605
- complete: (params, result) => {
606
- const parsed = safeParseResult(result);
607
- const total = parsed?.totalCount;
608
- const query = params?.query;
609
- if (total !== undefined && query)
610
- return `Found ${total} match${total !== 1 ? "es" : ""} for "${truncate(query, 25)}"`;
611
- if (query)
612
- return `Looked for "${truncate(query)}"`;
613
- return "Search complete";
614
- }
615
- },
616
- readGitHubFile: {
617
- preparing: "Finding file",
618
- executing: params => {
619
- const path = params?.path;
620
- return path ? `Opening ${truncate(path, 40)}` : "Opening file";
621
- },
622
- complete: params => {
623
- const path = params?.path;
624
- return path ? `Opened ${truncate(path, 40)}` : "Done";
625
- }
626
- },
627
- listGitHubPullRequests: {
628
- preparing: "Loading change requests",
629
- executing: params => {
630
- const repo = params?.repository;
631
- return repo ? `Loading change requests from ${repo}` : "Loading change requests";
632
- },
633
- complete: (params, result) => {
634
- const parsed = safeParseResult(result);
635
- const summary = parsed?.summary;
636
- const total = summary?.total;
637
- const repo = params?.repository;
638
- if (total !== undefined && repo)
639
- return `Found ${total} change request${total !== 1 ? "s" : ""} in ${repo}`;
640
- if (total !== undefined)
641
- return `Found ${total} change request${total !== 1 ? "s" : ""}`;
642
- if (repo)
643
- return `Loaded change requests from ${repo}`;
644
- return "Change requests loaded";
645
- }
646
- },
647
- listGitHubDirectory: {
648
- preparing: "Finding folder",
649
- executing: params => {
650
- const path = params?.path;
651
- return path ? `Listing files in ${truncate(path, 40)}` : "Opening folder";
652
- },
653
- complete: params => {
654
- const path = params?.path;
655
- return path ? `Listed files in ${truncate(path, 40)}` : "Done";
656
- }
657
- },
658
- listGitHubCommits: {
659
- preparing: "Loading recent updates",
660
- executing: params => {
661
- const repo = params?.repository;
662
- return repo ? `Loading recent updates from ${repo}` : "Loading recent updates";
663
- },
664
- complete: (params, result) => {
665
- const parsed = safeParseResult(result);
666
- const summary = parsed?.summary;
667
- const total = summary?.total;
668
- const repo = params?.repository;
669
- if (total !== undefined && repo)
670
- return `Found ${total} update${total !== 1 ? "s" : ""} in ${repo}`;
671
- if (total !== undefined)
672
- return `Found ${total} update${total !== 1 ? "s" : ""}`;
673
- if (repo)
674
- return `Loaded recent updates from ${repo}`;
675
- return "Recent updates loaded";
676
- }
677
- },
678
- grepGitHubCode: {
679
- preparing: "Looking through code",
680
- executing: params => {
681
- const pattern = params?.pattern;
682
- return pattern ? `Looking for "${truncate(pattern)}"` : "Looking through code";
683
- },
684
- complete: (params, result) => {
685
- const parsed = safeParseResult(result);
686
- const total = parsed?.totalCount;
687
- const pattern = params?.pattern;
688
- if (total !== undefined && pattern)
689
- return `Found ${total} match${total !== 1 ? "es" : ""} for "${truncate(pattern, 25)}"`;
690
- if (pattern)
691
- return `Looked for "${truncate(pattern)}"`;
692
- return "Search complete";
693
- }
694
- },
695
- summarizeGitHubPullRequestDiff: {
696
- preparing: "Reviewing changes",
697
- executing: params => {
698
- const prNumber = params?.pullNumber;
699
- return prNumber ? `Summarizing change request #${prNumber}` : "Summarizing changes";
700
- },
701
- complete: (params, result) => {
702
- const parsed = safeParseResult(result);
703
- const pr = parsed?.pullRequest;
704
- const title = pr?.title;
705
- const prNumber = params?.pullNumber || pr?.number;
706
- if (prNumber && title)
707
- return `Summarized change request #${prNumber}: "${truncate(title, 30)}"`;
708
- if (prNumber)
709
- return `Summarized change request #${prNumber}`;
710
- return "Summary ready";
711
- }
712
- },
713
- // ===================
714
- // PostHog Tools
715
- // ===================
716
- searchPosthogSessions: {
717
- preparing: "Looking through visits",
718
- executing: params => {
719
- const email = params?.userEmail;
720
- return email ? `Looking for visits from ${email}` : "Looking through visits";
721
- },
722
- complete: (params, result) => {
723
- const parsed = safeParseResult(result);
724
- const total = parsed?.totalSessions;
725
- const email = params?.userEmail;
726
- if (total !== undefined && email)
727
- return `Found ${total} visit${total !== 1 ? "s" : ""} for ${truncate(email, 25)}`;
728
- if (total !== undefined)
729
- return `Found ${total} visit${total !== 1 ? "s" : ""}`;
730
- if (email)
731
- return `Looked up visits for ${truncate(email, 25)}`;
732
- return "Visits found";
733
- }
734
- },
735
- searchPosthogLogs: {
736
- preparing: "Looking through activity logs",
737
- executing: params => {
738
- const search = params?.messageSearch;
739
- return search ? `Looking through logs for "${truncate(search)}"` : "Looking through activity logs";
740
- },
741
- complete: (params, result) => {
742
- const parsed = safeParseResult(result);
743
- const total = parsed?.totalLogs;
744
- const search = params?.messageSearch;
745
- if (total !== undefined && search)
746
- return `Found ${total} log${total !== 1 ? "s" : ""} for "${truncate(search, 25)}"`;
747
- if (total !== undefined)
748
- return `Found ${total} log${total !== 1 ? "s" : ""}`;
749
- if (search)
750
- return `Looked through logs for "${truncate(search)}"`;
751
- return "Log search complete";
752
- }
753
- },
754
- getPosthogSessionEvents: {
755
- preparing: "Loading visit details",
756
- executing: () => "Loading visit details",
757
- complete: (_params, result) => {
758
- const parsed = safeParseResult(result);
759
- const summary = parsed?.summary;
760
- const total = summary?.meaningfulEventsReturned;
761
- return total !== undefined ? `Loaded ${total} visit update${total !== 1 ? "s" : ""}` : "Visit details loaded";
762
- }
763
- },
764
- searchPosthogEvents: {
765
- preparing: "Looking through events",
766
- executing: params => {
767
- const eventName = params?.eventName;
768
- const userEmail = params?.userEmail;
769
- if (eventName)
770
- return `Looking for "${truncate(eventName)}" events`;
771
- if (userEmail)
772
- return `Looking for events from ${truncate(userEmail, 30)}`;
773
- return "Looking through events";
774
- },
775
- complete: (params, result) => {
776
- const parsed = safeParseResult(result);
777
- const totalEventTypes = parsed?.totalEventTypes;
778
- const totalEvents = parsed?.totalEvents;
779
- const eventName = params?.eventName;
780
- if (totalEventTypes !== undefined)
781
- return `Found ${totalEventTypes} event type${totalEventTypes !== 1 ? "s" : ""}`;
782
- if (totalEvents !== undefined && eventName)
783
- return `Found ${totalEvents} "${truncate(eventName, 25)}" event${totalEvents !== 1 ? "s" : ""}`;
784
- if (totalEvents !== undefined)
785
- return `Found ${totalEvents} event${totalEvents !== 1 ? "s" : ""}`;
786
- return "Event search complete";
787
- }
788
- },
789
- // ===================
790
- // LaunchDarkly Tools
791
- // ===================
792
- listLaunchDarklyFlags: {
793
- preparing: "Loading feature settings",
794
- executing: params => {
795
- const project = params?.projectKey;
796
- return project ? `Loading feature settings from ${project}` : "Loading feature settings";
797
- },
798
- complete: (params, result) => {
799
- const parsed = safeParseResult(result);
800
- const total = parsed?.totalFlags;
801
- const project = params?.projectKey;
802
- if (total !== undefined && project)
803
- return `Found ${total} feature setting${total !== 1 ? "s" : ""} in ${project}`;
804
- if (total !== undefined)
805
- return `Found ${total} feature setting${total !== 1 ? "s" : ""}`;
806
- if (project)
807
- return `Loaded feature settings from ${project}`;
808
- return "Feature settings loaded";
809
- }
810
- },
811
- getLaunchDarklyFlagDetails: {
812
- preparing: "Loading setting details",
813
- executing: params => {
814
- const flagKey = params?.flagKey;
815
- return flagKey ? `Loading "${flagKey}"` : "Loading setting details";
816
- },
817
- complete: params => {
818
- const flagKey = params?.flagKey;
819
- return flagKey ? `Loaded "${flagKey}"` : "Loaded details";
820
- }
821
- },
822
- // ===================
823
- // Datadog Tools
824
- // ===================
825
- searchDatadogLogs: {
826
- preparing: "Looking through logs",
827
- executing: params => {
828
- const query = params?.query;
829
- return query ? `Looking through logs for "${truncate(query)}"` : "Looking through logs";
830
- },
831
- complete: (params, result) => {
832
- const parsed = safeParseResult(result);
833
- const total = parsed?.totalLogs;
834
- const query = params?.query;
835
- if (total !== undefined && query)
836
- return `Found ${total} log${total !== 1 ? "s" : ""} for "${truncate(query, 25)}"`;
837
- if (total !== undefined)
838
- return `Found ${total} log${total !== 1 ? "s" : ""}`;
839
- if (query)
840
- return `Looked through logs for "${truncate(query)}"`;
841
- return "Log search complete";
842
- }
843
- },
844
- searchRumEvents: {
845
- preparing: "Looking at app activity",
846
- executing: params => {
847
- const query = params?.query;
848
- return query ? `Looking for "${truncate(query)}"` : "Loading app activity";
849
- },
850
- complete: (params, result) => {
851
- const parsed = safeParseResult(result);
852
- const total = parsed?.totalEvents;
853
- const query = params?.query;
854
- if (total !== undefined && query)
855
- return `Found ${total} result${total !== 1 ? "s" : ""} for "${truncate(query, 25)}"`;
856
- if (total !== undefined)
857
- return `Found ${total} result${total !== 1 ? "s" : ""}`;
858
- return "Search complete";
859
- }
860
- },
861
- listRumEvents: {
862
- preparing: "Loading app activity",
863
- executing: () => "Loading app activity",
864
- complete: (_params, result) => {
865
- const parsed = safeParseResult(result);
866
- const total = parsed?.totalEvents;
867
- return total !== undefined ? `Loaded ${total} activity item${total !== 1 ? "s" : ""}` : "Loaded activity";
868
- }
869
- },
870
- aggregateRumEvents: {
871
- preparing: "Summarizing app activity",
872
- executing: () => "Summarizing app activity",
873
- complete: (_params, result) => {
874
- const parsed = safeParseResult(result);
875
- const total = parsed?.totalBuckets;
876
- return total !== undefined ? `Summarized ${total} group${total !== 1 ? "s" : ""}` : "Summary ready";
877
- }
878
- },
879
- // ===================
880
- // Attio Tools
881
- // ===================
882
- attio_upsert_record: {
883
- preparing: "Getting your record ready",
884
- executing: params => {
885
- const objectSlug = params?.objectSlug;
886
- return objectSlug ? `Saving ${objectSlug} record` : "Saving record";
887
- },
888
- complete: (params, result) => {
889
- const parsed = safeParseResult(result);
890
- const actions = parsed?.actions;
891
- const target = actions?.[0]?.target;
892
- const objectSlug = params?.objectSlug;
893
- if (target)
894
- return `Saved ${objectSlug || "record"}: ${truncate(target, 30)}`;
895
- if (objectSlug)
896
- return `Saved ${objectSlug} record`;
897
- return "Record saved";
898
- },
899
- approval: params => {
900
- const objectSlug = params?.objectSlug;
901
- return objectSlug ? `Save ${objectSlug} record?` : "Save this record?";
902
- }
903
- },
904
- attio_query_records: {
905
- preparing: "Looking up records",
906
- executing: params => {
907
- const objectSlug = params?.objectSlug;
908
- return objectSlug ? `Searching ${objectSlug} records` : "Searching records";
909
- },
910
- complete: (params, result) => {
911
- const parsed = safeParseResult(result);
912
- const count = parsed?.count;
913
- const objectSlug = params?.objectSlug;
914
- if (count !== undefined && objectSlug)
915
- return `Found ${count} ${objectSlug} record${count !== 1 ? "s" : ""}`;
916
- if (count !== undefined)
917
- return `Found ${count} record${count !== 1 ? "s" : ""}`;
918
- if (objectSlug)
919
- return `Searched ${objectSlug} records`;
920
- return "Search complete";
921
- }
922
- },
923
- attio_list_objects: {
924
- preparing: "Loading object types",
925
- executing: () => "Loading object types",
926
- complete: (_params, result) => {
927
- const parsed = safeParseResult(result);
928
- const count = parsed?.count;
929
- if (count !== undefined)
930
- return `Found ${count} object type${count !== 1 ? "s" : ""}`;
931
- return "Object types loaded";
932
- }
933
- },
934
- // ===================
935
- // WorkOS Tools
936
- // ===================
937
- listWorkOSUsers: {
938
- preparing: "Loading users",
939
- executing: params => {
940
- const email = params?.email;
941
- return email ? `Looking up ${truncate(email, 30)}` : "Loading users";
942
- },
943
- complete: (params, result) => {
944
- const parsed = safeParseResult(result);
945
- const users = parsed?.users;
946
- const count = Array.isArray(users) ? users.length : undefined;
947
- const email = params?.email;
948
- if (email && count !== undefined)
949
- return `Found ${count} user${count !== 1 ? "s" : ""} for ${truncate(email, 25)}`;
950
- if (count !== undefined)
951
- return `Found ${count} user${count !== 1 ? "s" : ""}`;
952
- return "Users loaded";
953
- }
954
- },
955
- listWorkOSOrganizations: {
956
- preparing: "Loading organizations",
957
- executing: () => "Loading organizations",
958
- complete: (_params, result) => {
959
- const parsed = safeParseResult(result);
960
- const organizations = parsed?.organizations;
961
- const count = Array.isArray(organizations) ? organizations.length : undefined;
962
- if (count !== undefined)
963
- return `Found ${count} organization${count !== 1 ? "s" : ""}`;
964
- return "Organizations loaded";
965
- }
966
- },
967
- getWorkOSUser: {
968
- preparing: "Loading user details",
969
- executing: () => "Loading user details",
970
- complete: (_params, result) => {
971
- const parsed = safeParseResult(result);
972
- const user = parsed?.user;
973
- const email = user?.email;
974
- const firstName = user?.firstName;
975
- if (firstName && email)
976
- return `Loaded ${firstName} (${truncate(email, 25)})`;
977
- if (email)
978
- return `Loaded user ${truncate(email, 30)}`;
979
- return "User loaded";
980
- }
981
- },
982
- // ===================
983
- // Terse Tools
984
- // ===================
985
- web_search: {
986
- preparing: "Looking on the web",
987
- executing: params => {
988
- const query = params?.query;
989
- return query ? `Searching the web for "${truncate(query)}"` : "Searching the web";
990
- },
991
- complete: (_params, result) => {
992
- const res = safeParseResult(result);
993
- const count = res?.results?.length ?? 0;
994
- return count ? `Found ${count} result${count !== 1 ? "s" : ""}` : "Web search complete";
995
- }
996
- },
997
- web_extract: {
998
- preparing: "Preparing to read page",
999
- executing: params => {
1000
- const urls = params?.urls;
1001
- const firstUrl = Array.isArray(urls) ? urls[0] : urls;
1002
- return firstUrl ? `Reading ${truncate(firstUrl, 40)}` : "Reading page";
1003
- },
1004
- complete: (_params, result) => {
1005
- const res = safeParseResult(result);
1006
- const count = res?.results?.length ?? 0;
1007
- return count ? `Read ${count} page${count !== 1 ? "s" : ""}` : "Page read complete";
1008
- }
1009
- },
1010
- web_research: {
1011
- preparing: "Starting research",
1012
- executing: params => {
1013
- const input = params?.input;
1014
- return input ? `Researching: "${truncate(input)}"` : "Conducting research";
1015
- },
1016
- complete: () => "Research complete"
1017
- },
1018
- image_edit: {
1019
- preparing: "Getting image ready",
1020
- executing: params => {
1021
- const prompt = params?.prompt;
1022
- return prompt ? `Editing image: "${truncate(prompt)}"` : "Editing image";
1023
- },
1024
- complete: params => {
1025
- const prompt = params?.prompt;
1026
- return prompt ? `Image edited: "${truncate(prompt)}"` : "Image edited";
1027
- }
1028
- },
1029
- // ===================
1030
- // Snowflake Tools
1031
- // ===================
1032
- snowflakeExecuteQuery: {
1033
- preparing: "Preparing Snowflake query",
1034
- executing: params => {
1035
- const query = params?.query;
1036
- return query ? `Querying Snowflake: "${truncate(query, 40)}"` : "Querying Snowflake";
1037
- },
1038
- complete: (params, result) => {
1039
- const parsed = safeParseResult(result);
1040
- const rowCount = parsed?.rowCount;
1041
- const query = params?.query;
1042
- if (rowCount !== undefined)
1043
- return `Query returned ${rowCount} row${rowCount !== 1 ? "s" : ""}`;
1044
- if (query)
1045
- return `Queried Snowflake: "${truncate(query, 35)}"`;
1046
- return "Query complete";
1047
- },
1048
- approval: params => {
1049
- const query = params?.query;
1050
- return query ? `Run query: "${truncate(query, 40)}"?` : "Run this Snowflake query?";
1051
- }
1052
- },
1053
- snowflakeExplainQuery: {
1054
- preparing: "Preparing query plan",
1055
- executing: params => {
1056
- const query = params?.query;
1057
- return query ? `Explaining query: "${truncate(query, 40)}"` : "Explaining Snowflake query";
1058
- },
1059
- complete: (_params, result) => {
1060
- const parsed = safeParseResult(result);
1061
- const rowCount = parsed?.rowCount;
1062
- if (rowCount !== undefined)
1063
- return `Query plan retrieved (${rowCount} step${rowCount !== 1 ? "s" : ""})`;
1064
- return "Query plan retrieved";
1065
- }
1066
- },
1067
- // ===================
1068
- // Sandbox Lifecycle
1069
- // ===================
1070
- "Downloading source code": {
1071
- preparing: "Downloading source code",
1072
- executing: () => "Downloading source code",
1073
- complete: (_params, result) => `Downloaded source code${result ? ` (${result})` : ""}`
1074
- },
1075
- "Booting sandbox": {
1076
- preparing: "Booting sandbox",
1077
- executing: () => "Booting sandbox",
1078
- complete: (_params, result) => `Sandbox booted${result ? ` (${result})` : ""}`
1079
- },
1080
- "Installing dependencies": {
1081
- preparing: "Installing dependencies",
1082
- executing: () => "Installing dependencies",
1083
- complete: (_params, result) => `Dependencies installed${result ? ` (${result})` : ""}`
1084
- },
1085
- "Installing CLI": {
1086
- preparing: "Installing CLI",
1087
- executing: () => "Installing CLI",
1088
- complete: (_params, result) => `CLI installed${result ? ` (${result})` : ""}`
1089
- },
1090
- "Running agent": {
1091
- preparing: "Running agent",
1092
- executing: () => "Running agent",
1093
- complete: (_params, result) => `Agent finished${result ? ` (${result})` : ""}`
1094
- }
1095
- };
1096
- /**
1097
- * Safely parse JSON parameters string into an object.
1098
- */
1099
- export function parseToolParams(parametersJson) {
1100
- if (!parametersJson)
1101
- return undefined;
1102
- try {
1103
- return JSON.parse(parametersJson);
1104
- }
1105
- catch {
1106
- return undefined;
1107
- }
1108
- }
1109
- /**
1110
- * Get display string for a tool call based on its current phase.
1111
- *
1112
- * @param toolName - The internal tool name (e.g., 'linear_create_ticket')
1113
- * @param phase - The current phase: 'preparing', 'executing', or 'complete'
1114
- * @param options - Optional params, integration, and result for dynamic display
1115
- * @returns Human-readable display string
1116
- *
1117
- * @example
1118
- * getToolDisplayForPhase('fetchResourcesForIntegration', 'executing', { params: { integrationType: 'notion' } })
1119
- * // Returns: "Fetching resources from Notion"
1120
- */
1121
- export function getToolDisplayForPhase(toolName, phase, options) {
1122
- const config = TOOL_DISPLAY_CONFIG[toolName];
1123
- const { params, result } = options || {};
1124
- if (!config) {
1125
- // Fallback for unknown tools - use the tool name in a readable format
1126
- const readableName = getReadableFallbackName(toolName);
1127
- switch (phase) {
1128
- case "preparing":
1129
- return `Getting ready: ${readableName}`;
1130
- case "executing":
1131
- return `Working on ${readableName}`;
1132
- case "approval":
1133
- return `Approve: ${readableName}?`;
1134
- case "complete":
1135
- return "Done";
1136
- }
1137
- }
1138
- switch (phase) {
1139
- case "preparing":
1140
- return config.preparing;
1141
- case "executing":
1142
- return config.executing(params);
1143
- case "approval":
1144
- return config.approval ? config.approval(params) : config.executing(params);
1145
- case "complete":
1146
- return config.complete(params, result);
1147
- }
1148
- }
1149
- export function getReadableFallbackName(toolName) {
1150
- return toolName
1151
- .replace(/_/g, " ")
1152
- .replace(/([A-Z])/g, " $1")
1153
- .toLowerCase()
1154
- .trim();
1155
- }
1156
- /**
1157
- * Convenience function that parses parameters JSON and gets the display string.
1158
- */
1159
- export function getToolDisplayFromCall(toolName, phase, parametersJson, result) {
1160
- const params = parseToolParams(parametersJson);
1161
- return getToolDisplayForPhase(toolName, phase, { params, result });
1162
- }
1163
- //# sourceMappingURL=ToolDisplayUtils.js.map