terse-types 0.0.27 → 0.0.28

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.
@@ -0,0 +1,15 @@
1
+ export type SandboxLogEntry = {
2
+ stream: "stdout" | "stderr";
3
+ text: string;
4
+ timestamp: number;
5
+ };
6
+ export type SandboxLogPayload = SandboxLogEntry & {
7
+ runId: string;
8
+ agentId: string;
9
+ };
10
+ export type SandboxLogsResponse = {
11
+ sandboxId: string | null;
12
+ entries: SandboxLogEntry[];
13
+ timestamp: number;
14
+ error?: string;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -233,15 +233,6 @@ const TOOL_DISPLAY_CONFIG = {
233
233
  return name ? `Loaded layout for "${truncate(name)}"` : "Layout loaded";
234
234
  }
235
235
  },
236
- notion_fetch_related_events: {
237
- preparing: "Looking for related activity",
238
- executing: () => "Loading related activity",
239
- complete: (_params, result) => {
240
- const parsed = safeParseResult(result);
241
- const count = parsed?.events_count;
242
- return count !== undefined ? `Found ${count} related update${count !== 1 ? "s" : ""}` : "Related activity loaded";
243
- }
244
- },
245
236
  notion_list_users: {
246
237
  preparing: "Loading workspace members",
247
238
  executing: () => "Loading workspace members",
package/dist/Tools.d.ts CHANGED
@@ -1532,11 +1532,6 @@ export declare const notionGetSchemaInputSchema: z.ZodObject<{
1532
1532
  integrationId: z.ZodString;
1533
1533
  databaseId: z.ZodString;
1534
1534
  }, z.core.$strip>;
1535
- export declare const notionFetchRelatedEventsInputSchema: z.ZodObject<{
1536
- integrationId: z.ZodString;
1537
- pageId: z.ZodString;
1538
- block_id: z.ZodString;
1539
- }, z.core.$strip>;
1540
1535
  export declare const notionListUsersInputSchema: z.ZodObject<{
1541
1536
  integrationId: z.ZodString;
1542
1537
  query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -3274,41 +3269,6 @@ export declare const notionGetSchemaTool: {
3274
3269
  property_count: z.ZodNumber;
3275
3270
  }, z.core.$strip>;
3276
3271
  };
3277
- export declare const notionFetchRelatedEventsTool: {
3278
- name: "notion_fetch_related_events";
3279
- inputSchema: z.ZodObject<{
3280
- integrationId: z.ZodString;
3281
- pageId: z.ZodString;
3282
- block_id: z.ZodString;
3283
- }, z.core.$strip>;
3284
- outputSchema: z.ZodObject<{
3285
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
3286
- action: z.ZodString;
3287
- integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
3288
- target: z.ZodString;
3289
- details: z.ZodString;
3290
- url: z.ZodOptional<z.ZodString>;
3291
- step_id: z.ZodOptional<z.ZodString>;
3292
- type: z.ZodEnum<{
3293
- error: "error";
3294
- create: "create";
3295
- update: "update";
3296
- delete: "delete";
3297
- read: "read";
3298
- approve: "approve";
3299
- }>;
3300
- isReadOnly: z.ZodOptional<z.ZodBoolean>;
3301
- output_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
3302
- output_item_id: z.ZodString;
3303
- output_item_type: z.ZodEnum<typeof import("./Configs.js").ConfigType>;
3304
- }, z.core.$strip>>>;
3305
- }, z.core.$strip>>>;
3306
- success: z.ZodLiteral<true>;
3307
- events_count: z.ZodNumber;
3308
- events: z.ZodOptional<z.ZodString>;
3309
- message: z.ZodString;
3310
- }, z.core.$strip>;
3311
- };
3312
3272
  export declare const notionListUsersTool: {
3313
3273
  name: "notion_list_users";
3314
3274
  inputSchema: z.ZodObject<{
@@ -4183,8 +4143,8 @@ export declare const webExtractInputSchema: z.ZodObject<{
4183
4143
  export declare const webResearchInputSchema: z.ZodObject<{
4184
4144
  input: z.ZodString;
4185
4145
  model: z.ZodNullable<z.ZodEnum<{
4186
- mini: "mini";
4187
4146
  pro: "pro";
4147
+ mini: "mini";
4188
4148
  auto: "auto";
4189
4149
  }>>;
4190
4150
  }, z.core.$strip>;
@@ -4573,8 +4533,8 @@ export declare const webResearchTool: {
4573
4533
  inputSchema: z.ZodObject<{
4574
4534
  input: z.ZodString;
4575
4535
  model: z.ZodNullable<z.ZodEnum<{
4576
- mini: "mini";
4577
4536
  pro: "pro";
4537
+ mini: "mini";
4578
4538
  auto: "auto";
4579
4539
  }>>;
4580
4540
  }, z.core.$strip>;
@@ -6951,41 +6911,6 @@ export declare const ToolDefinitions: {
6951
6911
  property_count: z.ZodNumber;
6952
6912
  }, z.core.$strip>;
6953
6913
  };
6954
- readonly notion_fetch_related_events: {
6955
- name: "notion_fetch_related_events";
6956
- inputSchema: z.ZodObject<{
6957
- integrationId: z.ZodString;
6958
- pageId: z.ZodString;
6959
- block_id: z.ZodString;
6960
- }, z.core.$strip>;
6961
- outputSchema: z.ZodObject<{
6962
- actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
6963
- action: z.ZodString;
6964
- integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
6965
- target: z.ZodString;
6966
- details: z.ZodString;
6967
- url: z.ZodOptional<z.ZodString>;
6968
- step_id: z.ZodOptional<z.ZodString>;
6969
- type: z.ZodEnum<{
6970
- error: "error";
6971
- create: "create";
6972
- update: "update";
6973
- delete: "delete";
6974
- read: "read";
6975
- approve: "approve";
6976
- }>;
6977
- isReadOnly: z.ZodOptional<z.ZodBoolean>;
6978
- output_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
6979
- output_item_id: z.ZodString;
6980
- output_item_type: z.ZodEnum<typeof import("./Configs.js").ConfigType>;
6981
- }, z.core.$strip>>>;
6982
- }, z.core.$strip>>>;
6983
- success: z.ZodLiteral<true>;
6984
- events_count: z.ZodNumber;
6985
- events: z.ZodOptional<z.ZodString>;
6986
- message: z.ZodString;
6987
- }, z.core.$strip>;
6988
- };
6989
6914
  readonly notion_list_users: {
6990
6915
  name: "notion_list_users";
6991
6916
  inputSchema: z.ZodObject<{
@@ -8344,8 +8269,8 @@ export declare const ToolDefinitions: {
8344
8269
  inputSchema: z.ZodObject<{
8345
8270
  input: z.ZodString;
8346
8271
  model: z.ZodNullable<z.ZodEnum<{
8347
- mini: "mini";
8348
8272
  pro: "pro";
8273
+ mini: "mini";
8349
8274
  auto: "auto";
8350
8275
  }>>;
8351
8276
  }, z.core.$strip>;
package/dist/Tools.js CHANGED
@@ -823,11 +823,6 @@ export const notionGetSchemaInputSchema = z.object({
823
823
  integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
824
824
  databaseId: z.string().describe("The Notion database ID (data source ID) to get the schema for.")
825
825
  });
826
- export const notionFetchRelatedEventsInputSchema = z.object({
827
- integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
828
- pageId: z.string().describe("The Notion page ID (not used directly, but required for consistency)."),
829
- block_id: z.string().describe("The Notion block ID to fetch related events for")
830
- });
831
826
  export const notionListUsersInputSchema = z.object({
832
827
  integrationId: z.string().describe("The integration ID of the Notion workspace to use."),
833
828
  query: z.string().nullable().optional().describe("Optional search query to filter users by name. Case-insensitive partial match.")
@@ -1187,15 +1182,6 @@ export const notionGetSchemaTool = defineTool({
1187
1182
  property_count: z.number().int()
1188
1183
  })
1189
1184
  });
1190
- export const notionFetchRelatedEventsTool = defineTool({
1191
- name: "notion_fetch_related_events",
1192
- inputSchema: notionFetchRelatedEventsInputSchema,
1193
- outputSchema: toolOutputSuccessSchema.extend({
1194
- events_count: z.number().int(),
1195
- events: z.string().optional(),
1196
- message: z.string()
1197
- })
1198
- });
1199
1185
  export const notionListUsersTool = defineTool({
1200
1186
  name: "notion_list_users",
1201
1187
  inputSchema: notionListUsersInputSchema,
@@ -1858,7 +1844,6 @@ export const ToolDefinitions = {
1858
1844
  [notionQueryPageTool.name]: notionQueryPageTool,
1859
1845
  [notionQueryDatabaseTool.name]: notionQueryDatabaseTool,
1860
1846
  [notionGetSchemaTool.name]: notionGetSchemaTool,
1861
- [notionFetchRelatedEventsTool.name]: notionFetchRelatedEventsTool,
1862
1847
  [notionListUsersTool.name]: notionListUsersTool,
1863
1848
  [gmailSendEmailTool.name]: gmailSendEmailTool,
1864
1849
  [gmailCreateDraftTool.name]: gmailCreateDraftTool,
@@ -0,0 +1,3 @@
1
+ import type { Trigger } from "./Triggers.js";
2
+ export declare function formatTriggerForAgent(event: Trigger): string;
3
+ export declare function debugTrigger(event: Trigger): string;
@@ -0,0 +1,238 @@
1
+ import { IntegrationType } from "./Integrations.js";
2
+ const TriggerPresenters = {
3
+ manual_sample: {
4
+ formatForAgent: (event) => `Manual sample event for ${event.integrationType}.`,
5
+ debug: (event) => `${event.integrationType} ${event.eventType}`
6
+ },
7
+ [IntegrationType.GITHUB]: {
8
+ formatForAgent: formatGithubTrigger,
9
+ debug: (event) => `GitHub Event: ${event.eventType} - ${event.repository.owner}/${event.repository.name} - ${event.sender.login}`
10
+ },
11
+ [IntegrationType.SLACK]: {
12
+ formatForAgent: formatSlackTrigger,
13
+ debug: (event) => {
14
+ const isDM = event.channelType === "im";
15
+ return `Slack Event: ${event.eventType} - ${isDM ? "DM" : event.channelName || event.channelId} - ${event.userName || event.userId}`;
16
+ }
17
+ },
18
+ [IntegrationType.GMAIL]: {
19
+ formatForAgent: formatGmailTrigger,
20
+ debug: (event) => `Gmail Event: ${event.subject} message ID: ${event.messageId}`
21
+ },
22
+ [IntegrationType.LINEAR]: {
23
+ formatForAgent: formatLinearTrigger,
24
+ debug: (event) => {
25
+ if (event.type === "Issue") {
26
+ return `Linear ${event.type} Event: ${event.data.identifier} - ${event.data.title} (${event.action})`;
27
+ }
28
+ return `Linear ${event.type} Event: Comment on issue ${event.data.issueId || "Unknown"} (${event.action})`;
29
+ }
30
+ },
31
+ [IntegrationType.WORKOS]: {
32
+ formatForAgent: formatWorkOSTrigger,
33
+ debug: (event) => `WorkOS ${event.eventType}`
34
+ },
35
+ [IntegrationType.WEBHOOK]: {
36
+ formatForAgent: formatWebhookTrigger,
37
+ debug: (event) => `Webhook Trigger (${event.method})`
38
+ },
39
+ [IntegrationType.CRON_JOB]: {
40
+ formatForAgent: formatCronTrigger,
41
+ debug: (event) => (event.isManualTrigger ? "Manual Trigger" : "Scheduled Event")
42
+ }
43
+ };
44
+ export function formatTriggerForAgent(event) {
45
+ if (event.eventType === "manual_sample") {
46
+ return TriggerPresenters.manual_sample.formatForAgent(event);
47
+ }
48
+ const presenter = TriggerPresenters[event.integrationType];
49
+ return presenter.formatForAgent(event);
50
+ }
51
+ export function debugTrigger(event) {
52
+ if (event.eventType === "manual_sample") {
53
+ return TriggerPresenters.manual_sample.debug(event);
54
+ }
55
+ const presenter = TriggerPresenters[event.integrationType];
56
+ return presenter.debug(event);
57
+ }
58
+ function formatGithubTrigger(event) {
59
+ const indentMultiline = (text) => text
60
+ .split("\n")
61
+ .map(line => ` ${line}`)
62
+ .join("\n");
63
+ const eventTypeDescriptions = {
64
+ push: "Code Push Event",
65
+ "pull_request.opened": "Pull Request Opened",
66
+ "pull_request.synchronize": "Pull Request Updated (new commits added)",
67
+ "pull_request.closed": "Pull Request Closed",
68
+ "pull_request.merged": "Pull Request Merged"
69
+ };
70
+ const eventDescription = eventTypeDescriptions[event.eventType] || event.eventType;
71
+ const repoInfo = [
72
+ `Repository: ${event.repository.owner}/${event.repository.name}`,
73
+ `Repository ID: ${event.repository.id}`,
74
+ `Default Branch: ${event.repository.defaultBranch}`,
75
+ `View on GitHub: https://github.com/${event.repository.owner}/${event.repository.name}`
76
+ ].join("\n");
77
+ const senderInfo = [`Actor: ${event.sender.login}`, ...(event.sender.email ? [`Email: ${event.sender.email}`] : [])].join("\n");
78
+ const branchInfo = event.branch ? `Branch: ${event.branch}` : null;
79
+ let prInfo = "";
80
+ if (event.pullRequest) {
81
+ const pr = event.pullRequest;
82
+ const author = pr.author ?? pr.user;
83
+ const prLines = [
84
+ `Pull Request #${pr.number}: ${pr.title}`,
85
+ `State: ${pr.state}${pr.merged ? " (merged)" : ""}`,
86
+ `Author: ${author.login}${author.email ? ` (${author.email})` : ""}`,
87
+ `Head Branch: ${pr.head.ref} (${pr.head.sha.substring(0, 7)})`,
88
+ `Base Branch: ${pr.base.ref} (${pr.base.sha.substring(0, 7)})`,
89
+ `View PR: ${pr.url}`
90
+ ];
91
+ if (pr.body) {
92
+ prLines.push(`\nDescription:\n${indentMultiline(pr.body)}`);
93
+ }
94
+ prInfo = prLines.join("\n");
95
+ }
96
+ let commitsInfo = "";
97
+ if (event.commits.length > 0) {
98
+ const commitLines = [];
99
+ commitLines.push(`Commits (${event.commits.length}):`);
100
+ event.commits.forEach((commit, index) => {
101
+ const shortSha = commit.sha.substring(0, 7);
102
+ const commitUrl = `https://github.com/${event.repository.owner}/${event.repository.name}/commit/${commit.sha}`;
103
+ commitLines.push(`\n${index + 1}. Commit ${shortSha}: ${commit.message || commit.name || ""}`);
104
+ commitLines.push(` URL: ${commitUrl}`);
105
+ if (commit.fileDiffs.length > 0) {
106
+ commitLines.push(` Files Changed: ${commit.fileDiffs.length}`);
107
+ const fileList = commit.fileDiffs.map(f => ` - ${f.filename}`).join("\n");
108
+ commitLines.push(` Files:\n${fileList}`);
109
+ }
110
+ });
111
+ commitsInfo = commitLines.join("\n");
112
+ }
113
+ return [
114
+ `Incoming GitHub Event: ${eventDescription}`,
115
+ `\nRepository Information:\n${indentMultiline(repoInfo)}`,
116
+ `\nActor Information:\n${indentMultiline(senderInfo)}`,
117
+ ...(branchInfo ? [`\nBranch Information:\n${indentMultiline(branchInfo)}`] : []),
118
+ ...(prInfo ? [`\nPull Request Information:\n${indentMultiline(prInfo)}`] : []),
119
+ ...(commitsInfo ? [`\n${commitsInfo}`] : [])
120
+ ].join("\n\n");
121
+ }
122
+ function formatSlackTrigger(event) {
123
+ const blockContent = JSON.stringify(event.blocks);
124
+ const attachmentContent = JSON.stringify(event.attachments);
125
+ const messageText = event.text || "(no plain text)";
126
+ const threadTs = event.threadTs ?? event.threadTimestamp ?? null;
127
+ const eventLabel = event.eventType === "app_mention" ? "Incoming Slack App Mention Event." : event.eventType === "reaction_added" ? "Incoming Slack Reaction Added Event." : "Incoming Slack Message Event.";
128
+ const reactionInfo = event.eventType === "reaction_added"
129
+ ? `Reaction: ${event.reaction || "unknown"}\n Target Message Timestamp: ${event.itemTimestamp || "unknown"}\n Target User: ${event.itemUserId || "unknown"}`
130
+ : "";
131
+ return `
132
+ ${eventLabel}
133
+
134
+ Slack Event:
135
+ Event Type: ${event.eventType}
136
+ Channel: ${event.channelName || event.channelId}
137
+ User: ${event.userName || event.userId}
138
+ Message: ${messageText}
139
+ Timestamp: ${event.timestamp}
140
+ ${threadTs ? `Thread: ${threadTs}` : ""}
141
+ Team ID: ${event.teamId}
142
+ ${reactionInfo}
143
+ ${blockContent
144
+ ? `
145
+ Rich Content (from blocks):
146
+ ${blockContent}`
147
+ : ""}
148
+ ${attachmentContent
149
+ ? `
150
+ Attachment Content:
151
+ ${attachmentContent}`
152
+ : ""}
153
+ `;
154
+ }
155
+ function formatGmailTrigger(event) {
156
+ const attachmentInfo = event.attachments?.map(attachment => `- ${attachment.filename} ${attachment.isInline ? "Inline" : "Attachment"} (${attachment.mimeType})`).join("\n") || "No attachments";
157
+ return `
158
+ Incoming Email Event.
159
+
160
+ Gmail Event:
161
+ Subject: ${event.subject}
162
+ From: ${event.from}
163
+ To: ${event.to}
164
+ Date: ${event.date}
165
+ Message ID: ${event.messageId}
166
+ Thread ID: ${event.threadId}
167
+ Body: ${event.body}
168
+ Snippet: ${event.snippet}
169
+ Attachments (if any listed, actual files should be added below):
170
+ ${attachmentInfo}
171
+ `;
172
+ }
173
+ function formatLinearTrigger(event) {
174
+ const indentMultiline = (text) => text
175
+ .split("\n")
176
+ .map(line => ` ${line}`)
177
+ .join("\n");
178
+ const sections = [];
179
+ sections.push(`Incoming Linear ${event.type} Event`);
180
+ sections.push(`Action: ${event.action}`);
181
+ sections.push(`Actor: ${event.actor.name} (${event.actor.email})`);
182
+ sections.push(`Created: ${event.createdAt}`);
183
+ if (event.type === "Issue" && event.data) {
184
+ const issue = event.data;
185
+ const issueSections = [];
186
+ issueSections.push(`Issue: ${issue.identifier} - ${issue.title}`);
187
+ if (issue.description)
188
+ issueSections.push(`Description:\n${indentMultiline(issue.description)}`);
189
+ issueSections.push(`Priority: ${issue.priorityLabel || issue.priority}`);
190
+ issueSections.push(`State: ${issue.state?.name || "Unknown"}`);
191
+ issueSections.push(`Team: ${issue.team?.name || "Unknown"}`);
192
+ if (issue.assignee)
193
+ issueSections.push(`Assignee: ${issue.assignee.name}`);
194
+ if (issue.labels?.length)
195
+ issueSections.push(`Labels: ${issue.labels.map((label) => label.name || label).join(", ")}`);
196
+ if (issue.url)
197
+ issueSections.push(`URL: ${issue.url}`);
198
+ sections.push(issueSections.join("\n"));
199
+ }
200
+ else if (event.type === "Comment" && event.data) {
201
+ const commentSections = [`Comment on Issue: ${event.data.issueId || "Unknown"}`];
202
+ if (event.data.body)
203
+ commentSections.push(`Comment:\n${indentMultiline(event.data.body)}`);
204
+ sections.push(commentSections.join("\n"));
205
+ }
206
+ else {
207
+ sections.push(`Event Data:\n${indentMultiline(JSON.stringify(event.data, null, 2))}`);
208
+ }
209
+ if (event.organizationId) {
210
+ sections.push(`Organization ID: ${event.organizationId}`);
211
+ }
212
+ return sections.join("\n\n");
213
+ }
214
+ function formatWorkOSTrigger(event) {
215
+ const parts = [`WorkOS Event: ${event.eventType}`];
216
+ if ("user" in event && event.user) {
217
+ parts.push(`User Email: ${event.user.email}`);
218
+ if (event.user.firstName || event.user.lastName) {
219
+ parts.push(`User Name: ${[event.user.firstName, event.user.lastName].filter(Boolean).join(" ")}`);
220
+ }
221
+ parts.push(`User ID: ${event.user.id}`);
222
+ }
223
+ parts.push(`\nFull Event Data:\n${JSON.stringify(event, null, 2)}`);
224
+ return parts.join("\n");
225
+ }
226
+ function formatWebhookTrigger(event) {
227
+ return `Webhook request received.\n\nMethod: ${event.method}\n\nPayload:\n${JSON.stringify(event.body, null, 2)}`;
228
+ }
229
+ function formatCronTrigger(event) {
230
+ if (event.isManualTrigger) {
231
+ let message = `This is a manually triggered event for the channel input ${event.inputId}.`;
232
+ if (event.manualContext) {
233
+ message += `\n\nUser provided context for this manual trigger:\n${event.manualContext}`;
234
+ }
235
+ return message;
236
+ }
237
+ return `This is a scheduled event for the channel input ${event.inputId}. The channel input is configured to run at the following cron expression.`;
238
+ }