terse-types 0.1.5 → 0.1.7

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.
@@ -20,6 +20,9 @@ export var IntegrationType;
20
20
  IntegrationType["SNOWFLAKE"] = "snowflake";
21
21
  IntegrationType["WEBHOOK"] = "webhook";
22
22
  IntegrationType["WEBMONITOR"] = "webmonitor";
23
+ IntegrationType["GOOGLE_SEARCH_CONSOLE"] = "google_search_console";
24
+ IntegrationType["META_ADS"] = "meta_ads";
25
+ IntegrationType["HIGGSFIELD"] = "higgsfield";
23
26
  })(IntegrationType || (IntegrationType = {}));
24
27
  export const integrationTypeEnum = z.enum(IntegrationType);
25
28
  export const BUILT_IN_INTEGRATION_TYPES = [IntegrationType.TERSE, IntegrationType.CRON_JOB, IntegrationType.WEBHOOK, IntegrationType.WEBMONITOR];
@@ -39,6 +42,13 @@ export const GmailIntegrationMetadata = {
39
42
  isInput: true,
40
43
  isOutput: false
41
44
  };
45
+ export const GoogleSearchConsoleIntegrationMetadata = {
46
+ type: IntegrationType.GOOGLE_SEARCH_CONSOLE,
47
+ name: "Google Search Console",
48
+ description: "Read Search Analytics and manage sites and sitemaps",
49
+ isInput: false,
50
+ isOutput: true
51
+ };
42
52
  export const NotionIntegrationMetadata = {
43
53
  type: IntegrationType.NOTION,
44
54
  name: "Notion",
@@ -144,6 +154,13 @@ export const HeyReachIntegrationMetadata = {
144
154
  isInput: true,
145
155
  isOutput: false
146
156
  };
157
+ export const MetaAdsIntegrationMetadata = {
158
+ type: IntegrationType.META_ADS,
159
+ name: "Meta Ads",
160
+ description: "Read ad performance, sync custom audiences, and send offline conversions to Meta Ads",
161
+ isInput: false,
162
+ isOutput: true
163
+ };
147
164
  export const ResendIntegrationMetadata = {
148
165
  type: IntegrationType.RESEND,
149
166
  name: "Resend",
@@ -151,6 +168,13 @@ export const ResendIntegrationMetadata = {
151
168
  isInput: false,
152
169
  isOutput: true
153
170
  };
171
+ export const HiggsfieldIntegrationMetadata = {
172
+ type: IntegrationType.HIGGSFIELD,
173
+ name: "Higgsfield",
174
+ description: "Generate ad creative images and animate them into video with Higgsfield",
175
+ isInput: false,
176
+ isOutput: true
177
+ };
154
178
  export const ApolloIntegrationMetadata = {
155
179
  type: IntegrationType.APOLLO,
156
180
  name: "Apollo",
@@ -160,6 +184,7 @@ export const ApolloIntegrationMetadata = {
160
184
  };
161
185
  export const INTEGRATION_METADATA = {
162
186
  [IntegrationType.GMAIL]: GmailIntegrationMetadata,
187
+ [IntegrationType.GOOGLE_SEARCH_CONSOLE]: GoogleSearchConsoleIntegrationMetadata,
163
188
  [IntegrationType.NOTION]: NotionIntegrationMetadata,
164
189
  [IntegrationType.LINEAR]: LinearIntegrationMetadata,
165
190
  [IntegrationType.SLACK]: SlackIntegrationMetadata,
@@ -176,7 +201,9 @@ export const INTEGRATION_METADATA = {
176
201
  [IntegrationType.WEBMONITOR]: WebMonitorIntegrationMetadata,
177
202
  [IntegrationType.HEY_REACH]: HeyReachIntegrationMetadata,
178
203
  [IntegrationType.RESEND]: ResendIntegrationMetadata,
179
- [IntegrationType.APOLLO]: ApolloIntegrationMetadata
204
+ [IntegrationType.APOLLO]: ApolloIntegrationMetadata,
205
+ [IntegrationType.META_ADS]: MetaAdsIntegrationMetadata,
206
+ [IntegrationType.HIGGSFIELD]: HiggsfieldIntegrationMetadata
180
207
  };
181
208
  // MARK: Integration Details
182
209
  export const IntegrationInstanceSchema = z.object({
@@ -193,6 +220,7 @@ export const SlackInstallationOptionsSchema = z
193
220
  export const InstallationOptionsSchemas = {
194
221
  [IntegrationType.SLACK]: SlackInstallationOptionsSchema,
195
222
  [IntegrationType.GMAIL]: NoInstallationOptionsSchema,
223
+ [IntegrationType.GOOGLE_SEARCH_CONSOLE]: NoInstallationOptionsSchema,
196
224
  [IntegrationType.NOTION]: NoInstallationOptionsSchema,
197
225
  [IntegrationType.LINEAR]: NoInstallationOptionsSchema,
198
226
  [IntegrationType.GITHUB]: NoInstallationOptionsSchema,
@@ -208,7 +236,9 @@ export const InstallationOptionsSchemas = {
208
236
  [IntegrationType.WEBMONITOR]: NoInstallationOptionsSchema,
209
237
  [IntegrationType.HEY_REACH]: NoInstallationOptionsSchema,
210
238
  [IntegrationType.RESEND]: NoInstallationOptionsSchema,
211
- [IntegrationType.APOLLO]: NoInstallationOptionsSchema
239
+ [IntegrationType.APOLLO]: NoInstallationOptionsSchema,
240
+ [IntegrationType.META_ADS]: NoInstallationOptionsSchema,
241
+ [IntegrationType.HIGGSFIELD]: NoInstallationOptionsSchema
212
242
  };
213
243
  export const SlackIntegrationSchema = IntegrationInstanceSchema.extend({
214
244
  teamId: z.string().optional(),
@@ -220,6 +250,18 @@ export const GmailIntegrationSchema = IntegrationInstanceSchema.extend({
220
250
  historyId: z.string().optional(),
221
251
  watchExpiration: z.date().optional()
222
252
  });
253
+ export const GoogleSearchConsoleIntegrationSchema = IntegrationInstanceSchema.extend({
254
+ email: z.email(),
255
+ googleAccountId: z.string()
256
+ });
257
+ export const googleSearchConsolePermissionLevelSchema = z.enum(["siteFullUser", "siteOwner", "siteRestrictedUser", "siteUnverifiedUser"]);
258
+ export const googleSearchConsoleSiteSchema = z.object({
259
+ siteUrl: z.string(),
260
+ permissionLevel: googleSearchConsolePermissionLevelSchema
261
+ });
262
+ export const googleSearchConsoleSitesResponseSchema = z.object({
263
+ sites: z.array(googleSearchConsoleSiteSchema)
264
+ });
223
265
  export const NotionIntegrationSchema = IntegrationInstanceSchema.extend({
224
266
  workspaceId: z.string().optional(),
225
267
  workspaceName: z.string().optional()
@@ -237,6 +279,7 @@ export const PosthogIntegrationSchema = IntegrationInstanceSchema.extend({
237
279
  });
238
280
  export const HeyReachIntegrationSchema = IntegrationInstanceSchema;
239
281
  export const ResendIntegrationSchema = IntegrationInstanceSchema;
282
+ export const HiggsfieldIntegrationSchema = IntegrationInstanceSchema;
240
283
  export const ApolloIntegrationSchema = IntegrationInstanceSchema;
241
284
  export const ResendTemplateVariableSchema = z.object({
242
285
  key: z.string(),
@@ -271,6 +314,16 @@ export const SnowflakeIntegrationSchema = IntegrationInstanceSchema.extend({
271
314
  databaseName: z.string().optional(),
272
315
  schemaName: z.string().optional()
273
316
  });
317
+ export const MetaAdsIntegrationSchema = IntegrationInstanceSchema.extend({
318
+ accountName: z.string().optional()
319
+ });
320
+ export const MetaAdsAdAccountSchema = z.object({
321
+ id: z.string(),
322
+ accountId: z.string(),
323
+ name: z.string(),
324
+ currency: z.string().optional(),
325
+ accountStatus: z.number().optional()
326
+ });
274
327
  export const CliIntegrationDisplayStateSchema = z.discriminatedUnion("status", [
275
328
  z.object({
276
329
  status: z.literal("not_connected")
@@ -19,6 +19,7 @@ export declare const datadogIntegrationsKey: () => readonly [string];
19
19
  export declare const githubRepositoriesKey: (installationId: number | null | undefined) => readonly [string, number] | null;
20
20
  export declare const linearTeamsKey: (integrationId: string | null | undefined) => readonly [string, string] | null;
21
21
  export declare const gmailIntegrationsKey: () => readonly [string];
22
+ export declare const googleSearchConsoleIntegrationsKey: () => readonly [string];
22
23
  export declare const githubIntegrationsKey: () => readonly [string];
23
24
  export declare const linearIntegrationsKey: () => readonly [string];
24
25
  export declare const notionIntegrationsKey: () => readonly [string];
@@ -29,6 +30,8 @@ export declare const snowflakeIntegrationsKey: () => readonly [string];
29
30
  export declare const heyReachIntegrationsKey: () => readonly [string];
30
31
  export declare const resendIntegrationsKey: () => readonly [string];
31
32
  export declare const apolloIntegrationsKey: () => readonly [string];
33
+ export declare const metaAdsIntegrationsKey: () => readonly [string];
34
+ export declare const higgsfieldIntegrationsKey: () => readonly [string];
32
35
  export declare const attioObjectsKey: (integrationId: string | null | undefined) => readonly [string, string] | null;
33
36
  export declare const allRunHistoryKey: (params?: GetRunHistoryParams) => readonly [string, string] | readonly [string];
34
37
  export declare const runHistoryKey: (agentId: string, params?: GetRunHistoryParams) => readonly [string, string, string] | readonly [string, string];
@@ -49,6 +49,9 @@ export const linearTeamsKey = (integrationId) => {
49
49
  export const gmailIntegrationsKey = () => {
50
50
  return ["gmailIntegrations"];
51
51
  };
52
+ export const googleSearchConsoleIntegrationsKey = () => {
53
+ return ["googleSearchConsoleIntegrations"];
54
+ };
52
55
  export const githubIntegrationsKey = () => {
53
56
  return ["githubIntegrations"];
54
57
  };
@@ -75,6 +78,8 @@ export const heyReachIntegrationsKey = () => {
75
78
  };
76
79
  export const resendIntegrationsKey = () => ["resendIntegrations"];
77
80
  export const apolloIntegrationsKey = () => ["apolloIntegrations"];
81
+ export const metaAdsIntegrationsKey = () => ["metaAdsIntegrations"];
82
+ export const higgsfieldIntegrationsKey = () => ["higgsfieldIntegrations"];
78
83
  export const attioObjectsKey = (integrationId) => {
79
84
  if (!integrationId) {
80
85
  return null;
@@ -1065,8 +1065,177 @@ const TOOL_DISPLAY_CONFIG = {
1065
1065
  return `Found ${total} job posting${total !== 1 ? "s" : ""}`;
1066
1066
  return "Job postings loaded";
1067
1067
  }
1068
+ },
1069
+ // Meta Ads Tools
1070
+ // ===================
1071
+ meta_ads_list_ad_accounts: {
1072
+ preparing: "Loading ad accounts",
1073
+ executing: () => "Loading ad accounts",
1074
+ complete: (_params, result) => metaAdsCountLabel(result, "ad account", "Ad accounts loaded")
1075
+ },
1076
+ meta_ads_list_campaigns: {
1077
+ preparing: "Loading campaigns",
1078
+ executing: () => "Loading campaigns",
1079
+ complete: (_params, result) => metaAdsCountLabel(result, "campaign", "Campaigns loaded")
1080
+ },
1081
+ meta_ads_list_adsets: {
1082
+ preparing: "Loading ad sets",
1083
+ executing: () => "Loading ad sets",
1084
+ complete: (_params, result) => metaAdsCountLabel(result, "ad set", "Ad sets loaded")
1085
+ },
1086
+ meta_ads_read_insights: {
1087
+ preparing: "Loading ad performance",
1088
+ executing: () => "Loading Meta Ads insights",
1089
+ complete: (_params, result) => {
1090
+ const parsed = safeParseResult(result);
1091
+ const count = parsed?.count;
1092
+ return count !== undefined ? `Loaded ${count} insight row${count !== 1 ? "s" : ""}` : "Insights loaded";
1093
+ }
1094
+ },
1095
+ meta_ads_list_pixels: {
1096
+ preparing: "Loading pixels",
1097
+ executing: () => "Loading Meta pixels",
1098
+ complete: (_params, result) => metaAdsCountLabel(result, "pixel", "Pixels loaded")
1099
+ },
1100
+ meta_ads_list_audiences: {
1101
+ preparing: "Loading custom audiences",
1102
+ executing: () => "Loading custom audiences",
1103
+ complete: (_params, result) => metaAdsCountLabel(result, "audience", "Audiences loaded")
1104
+ },
1105
+ meta_ads_add_audience_users: {
1106
+ preparing: "Getting audience update ready",
1107
+ executing: params => metaAdsAudienceUsersLabel(params, "Adding"),
1108
+ complete: params => metaAdsAudienceUsersLabel(params, "Added"),
1109
+ approval: params => `${metaAdsAudienceUsersLabel(params, "Add")} to this custom audience?`
1110
+ },
1111
+ meta_ads_remove_audience_users: {
1112
+ preparing: "Getting audience update ready",
1113
+ executing: params => metaAdsAudienceUsersLabel(params, "Removing"),
1114
+ complete: params => metaAdsAudienceUsersLabel(params, "Removed"),
1115
+ approval: params => `${metaAdsAudienceUsersLabel(params, "Remove")} from this custom audience?`
1116
+ },
1117
+ meta_ads_send_conversions: {
1118
+ preparing: "Getting conversion events ready",
1119
+ executing: params => {
1120
+ const count = metaAdsEventCount(params);
1121
+ return count !== undefined ? `Sending ${count} conversion event${count !== 1 ? "s" : ""}` : "Sending conversion events";
1122
+ },
1123
+ complete: (_params, result) => {
1124
+ const parsed = safeParseResult(result);
1125
+ const received = parsed?.eventsReceived;
1126
+ return received !== undefined ? `Meta received ${received} event${received !== 1 ? "s" : ""}` : "Conversion events sent";
1127
+ },
1128
+ approval: params => {
1129
+ const count = metaAdsEventCount(params) ?? 0;
1130
+ return `Send ${count} conversion event${count !== 1 ? "s" : ""} to Meta?`;
1131
+ }
1132
+ },
1133
+ higgsfield_generate_image: {
1134
+ preparing: "Getting image generation ready",
1135
+ executing: params => {
1136
+ const batchSize = params?.batchSize;
1137
+ return batchSize && batchSize > 1 ? `Generating ${batchSize} creative variants` : "Generating creative";
1138
+ },
1139
+ complete: (_params, result) => {
1140
+ const parsed = safeParseResult(result);
1141
+ const count = parsed?.count;
1142
+ return count !== undefined ? `Generated ${count} image${count !== 1 ? "s" : ""}` : "Image generation complete";
1143
+ },
1144
+ approval: params => {
1145
+ const prompt = params?.prompt;
1146
+ return prompt ? `Generate creative for "${truncate(prompt)}" via Higgsfield (uses credits)?` : "Generate creative via Higgsfield (uses credits)?";
1147
+ }
1148
+ },
1149
+ meta_ads_list_pages: {
1150
+ preparing: "Loading Facebook Pages",
1151
+ executing: () => "Loading Facebook Pages",
1152
+ complete: (_params, result) => metaAdsCountLabel(result, "Page", "Pages loaded")
1153
+ },
1154
+ meta_ads_list_ads: {
1155
+ preparing: "Loading ads and creatives",
1156
+ executing: () => "Loading ads",
1157
+ complete: (_params, result) => metaAdsCountLabel(result, "ad", "Ads loaded")
1158
+ },
1159
+ higgsfield_generate_video: {
1160
+ preparing: "Getting video generation ready",
1161
+ executing: () => "Animating creative into video",
1162
+ complete: (_params, result) => {
1163
+ const count = safeParseResult(result)?.count;
1164
+ return count !== undefined ? `Generated ${count} video${count !== 1 ? "s" : ""}` : "Video generation complete";
1165
+ },
1166
+ approval: params => {
1167
+ const prompt = params?.prompt;
1168
+ return prompt ? `Animate this image with "${truncate(prompt)}" via Higgsfield (uses credits)?` : "Animate this image via Higgsfield (uses credits)?";
1169
+ }
1170
+ },
1171
+ higgsfield_list_motions: {
1172
+ preparing: "Loading motion presets",
1173
+ executing: () => "Loading Higgsfield motions",
1174
+ complete: (_params, result) => metaAdsCountLabel(result, "motion", "Motions loaded")
1175
+ },
1176
+ meta_ads_create_ad: {
1177
+ preparing: "Getting the new ad ready",
1178
+ executing: params => {
1179
+ const name = params?.name;
1180
+ const format = metaAdsCreativeFormat(params);
1181
+ const label = name ? `Creating ${format} ad ${truncate(name)}` : `Creating ${format} ad`;
1182
+ return label;
1183
+ },
1184
+ complete: (params, result) => {
1185
+ const parsed = safeParseResult(result);
1186
+ const adId = parsed?.adId;
1187
+ const name = params?.name;
1188
+ if (name)
1189
+ return `Created ad ${truncate(name)}`;
1190
+ return adId ? `Created ad ${adId}` : "Ad created";
1191
+ },
1192
+ approval: params => {
1193
+ const name = params?.name;
1194
+ const label = name ? truncate(name) : "a new ad";
1195
+ return `Create ${metaAdsCreativeFormat(params)} ad ${label} in this ad set${params?.status === "ACTIVE" ? " and start delivery" : " (paused)"}?`;
1196
+ }
1197
+ },
1198
+ meta_ads_set_status: {
1199
+ preparing: "Getting the status change ready",
1200
+ executing: params => `${metaAdsStatusVerb(params, "ing")} ${params?.entityType ?? "entity"}`,
1201
+ complete: params => `${metaAdsStatusVerb(params, "ed")} ${params?.entityType ?? "entity"}`,
1202
+ approval: params => {
1203
+ const entityId = params?.entityId;
1204
+ return `${metaAdsStatusVerb(params, "")} ${params?.entityType ?? "entity"} ${entityId ?? ""}?`.replace(/\s+\?$/, "?");
1205
+ }
1068
1206
  }
1069
1207
  };
1208
+ function metaAdsCreativeFormat(params) {
1209
+ const format = params?.creative?.format;
1210
+ switch (format) {
1211
+ case "single_video":
1212
+ return "video";
1213
+ case "carousel":
1214
+ return "carousel";
1215
+ case "dynamic_image":
1216
+ case "dynamic_video":
1217
+ case "dynamic_mixed":
1218
+ return "dynamic";
1219
+ default:
1220
+ return "image";
1221
+ }
1222
+ }
1223
+ function metaAdsCountLabel(result, noun, fallback) {
1224
+ const count = safeParseResult(result)?.count;
1225
+ return count !== undefined ? `Found ${count} ${noun}${count !== 1 ? "s" : ""}` : fallback;
1226
+ }
1227
+ function metaAdsAudienceUsersLabel(params, verb) {
1228
+ const count = params?.users?.length;
1229
+ return count !== undefined ? `${verb} ${count} user${count !== 1 ? "s" : ""}` : `${verb} audience users`;
1230
+ }
1231
+ function metaAdsEventCount(params) {
1232
+ return params?.events?.length;
1233
+ }
1234
+ function metaAdsStatusVerb(params, suffix) {
1235
+ if (params?.status === "PAUSED")
1236
+ return suffix === "ing" ? "Pausing" : suffix === "ed" ? "Paused" : "Pause";
1237
+ return suffix === "ing" ? "Resuming" : suffix === "ed" ? "Resumed" : "Resume";
1238
+ }
1070
1239
  /**
1071
1240
  * Safely parse JSON parameters string into an object.
1072
1241
  */