terse-types 0.1.2 → 0.1.4

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.
@@ -98,6 +98,9 @@ export declare const ApiRoutes: {
98
98
  INTEGRATIONS: string;
99
99
  TEMPLATES: string;
100
100
  };
101
+ APOLLO: {
102
+ INTEGRATIONS: string;
103
+ };
101
104
  AGENTS: {
102
105
  LIST: string;
103
106
  RECENT: string;
@@ -98,6 +98,9 @@
98
98
  "INTEGRATIONS": "/resend/integrations",
99
99
  "TEMPLATES": "/resend/templates"
100
100
  },
101
+ "APOLLO": {
102
+ "INTEGRATIONS": "/apollo/integrations"
103
+ },
101
104
  "AGENTS": {
102
105
  "LIST": "/agents",
103
106
  "RECENT": "/agents/recent",
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
3
+ * simple objects, matching the shape produced for generated Attio tool outputs.
4
+ */
5
+ export declare function flattenAttioLeafValue(value: unknown): unknown;
6
+ /**
7
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
8
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
9
+ */
10
+ export declare function flattenAttioAttributeValue(rawValue: unknown, preferArray: boolean): unknown;
11
+ /**
12
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
13
+ */
14
+ export declare function flattenAttioRecordValues(values: Record<string, unknown>, isMultiValueAttribute: (attributeSlug: string) => boolean): Record<string, unknown>;
15
+ /**
16
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
17
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
18
+ */
19
+ export declare function isProbablyAttioMultiValueAttributeSlug(attributeSlug: string): boolean;
@@ -0,0 +1,71 @@
1
+ /** Keys Attio nests on attribute timeline entries (not the semantic payload). */
2
+ const ATTIO_VALUE_METADATA_KEYS = new Set([
3
+ "active_from",
4
+ "active_until",
5
+ "attribute_type",
6
+ "created_by_actor"
7
+ ]);
8
+ /**
9
+ * Collapses a single Attio value entry (or nested structure) toward primitives /
10
+ * simple objects, matching the shape produced for generated Attio tool outputs.
11
+ */
12
+ export function flattenAttioLeafValue(value) {
13
+ if (value === null || value === undefined)
14
+ return value;
15
+ if (Array.isArray(value))
16
+ return value.map(entry => flattenAttioLeafValue(entry));
17
+ if (typeof value !== "object")
18
+ return value;
19
+ const rawObject = value;
20
+ if (typeof rawObject.full_name === "string")
21
+ return rawObject.full_name;
22
+ if (typeof rawObject.email_address === "string")
23
+ return rawObject.email_address;
24
+ if (typeof rawObject.domain === "string")
25
+ return rawObject.domain;
26
+ if (typeof rawObject.phone_number === "string")
27
+ return rawObject.phone_number;
28
+ if ("value" in rawObject)
29
+ return flattenAttioLeafValue(rawObject.value);
30
+ const dataEntries = Object.entries(rawObject).filter(([key]) => !ATTIO_VALUE_METADATA_KEYS.has(key));
31
+ if (dataEntries.length === 0)
32
+ return rawObject;
33
+ if (dataEntries.length === 1)
34
+ return flattenAttioLeafValue(dataEntries[0][1]);
35
+ return Object.fromEntries(dataEntries.map(([key, entryValue]) => [key, flattenAttioLeafValue(entryValue)]));
36
+ }
37
+ /**
38
+ * Flattens one attribute’s raw value (often an array of interaction rows from the REST API).
39
+ * @param preferArray When true, keep all entries as an array; when false, use the first entry only.
40
+ */
41
+ export function flattenAttioAttributeValue(rawValue, preferArray) {
42
+ if (!Array.isArray(rawValue))
43
+ return flattenAttioLeafValue(rawValue);
44
+ const flattened = rawValue.map(entry => flattenAttioLeafValue(entry)).filter(entry => entry !== undefined);
45
+ return preferArray ? flattened : flattened[0];
46
+ }
47
+ /**
48
+ * Flattens `record.values` from Attio’s GET record / webhook enrichment payload.
49
+ */
50
+ export function flattenAttioRecordValues(values, isMultiValueAttribute) {
51
+ const flattenedValues = {};
52
+ for (const [attributeSlug, rawValue] of Object.entries(values)) {
53
+ flattenedValues[attributeSlug] = flattenAttioAttributeValue(rawValue, isMultiValueAttribute(attributeSlug));
54
+ }
55
+ return flattenedValues;
56
+ }
57
+ /**
58
+ * Slug-only heuristic when object attribute metadata is unavailable (e.g. Attio webhook triggers).
59
+ * Prefer {@link flattenAttioRecordValues} with object-aware multi-value info from codegen when possible.
60
+ */
61
+ export function isProbablyAttioMultiValueAttributeSlug(attributeSlug) {
62
+ const slug = attributeSlug.toLowerCase();
63
+ return (slug === "email_addresses" ||
64
+ slug === "domains" ||
65
+ slug === "phone_numbers" ||
66
+ slug === "social_profiles" ||
67
+ slug === "links" ||
68
+ slug === "tags" ||
69
+ slug.endsWith("_addresses") ||
70
+ slug.endsWith("_ids"));
71
+ }
package/dist/Configs.d.ts CHANGED
@@ -26,7 +26,8 @@ export declare enum ConfigType {
26
26
  WEBHOOK_INPUT = "webhook_input",
27
27
  WEBMONITOR = "webmonitor",
28
28
  HEY_REACH_INPUT = "hey_reach_input",
29
- RESEND_OUTPUT = "resend_output"
29
+ RESEND_OUTPUT = "resend_output",
30
+ APOLLO_OUTPUT = "apollo_output"
30
31
  }
31
32
  export declare const configTypeEnum: z.ZodEnum<typeof ConfigType>;
32
33
  export declare const frequencyUnitSchema: z.ZodEnum<{
@@ -243,6 +244,14 @@ export declare const ResendOutputConfigMetadata: {
243
244
  readonly isInput: false;
244
245
  readonly isOutput: true;
245
246
  };
247
+ export declare const ApolloOutputConfigMetadata: {
248
+ readonly configType: ConfigType.APOLLO_OUTPUT;
249
+ readonly name: "Apollo";
250
+ readonly description: "Enrich people and companies and search for prospects using Apollo.io";
251
+ readonly integrationType: IntegrationType.APOLLO;
252
+ readonly isInput: false;
253
+ readonly isOutput: true;
254
+ };
246
255
  export type ConfigDetailsMap = Record<ConfigType, ConfigDetails>;
247
256
  export declare const CONFIG_DETAILS: ConfigDetailsMap;
248
257
  export declare const SlackEventType: {
@@ -1383,6 +1392,18 @@ export declare class ResendOutputConfig extends BaseConfigInstance<IntegrationTy
1383
1392
  isComplete(): boolean;
1384
1393
  formatForAgent(): string;
1385
1394
  }
1395
+ export declare const ApolloOutputConfigSchema: z.ZodObject<{
1396
+ integrationId: z.ZodString;
1397
+ integrationType: z.ZodLiteral<IntegrationType.APOLLO>;
1398
+ configType: z.ZodLiteral<ConfigType.APOLLO_OUTPUT>;
1399
+ }, z.core.$strip>;
1400
+ export type ApolloOutputConfigData = z.infer<typeof ApolloOutputConfigSchema>;
1401
+ export type ApolloOutputConfigInstance = ApolloOutputConfigData & ConfigBehavior;
1402
+ export declare class ApolloOutputConfig extends BaseConfigInstance<IntegrationType.APOLLO, ConfigType.APOLLO_OUTPUT> implements ApolloOutputConfigInstance {
1403
+ constructor(integrationId: string);
1404
+ isComplete(): boolean;
1405
+ formatForAgent(): string;
1406
+ }
1386
1407
  export declare const WebhookInputConfigSchema: z.ZodObject<{
1387
1408
  integrationId: z.ZodLiteral<"system">;
1388
1409
  integrationType: z.ZodLiteral<IntegrationType.WEBHOOK>;
@@ -2106,6 +2127,10 @@ export declare const configDataSchema: z.ZodUnion<readonly [z.ZodObject<{
2106
2127
  integrationId: z.ZodString;
2107
2128
  integrationType: z.ZodLiteral<IntegrationType.RESEND>;
2108
2129
  configType: z.ZodLiteral<ConfigType.RESEND_OUTPUT>;
2130
+ }, z.core.$strip>, z.ZodObject<{
2131
+ integrationId: z.ZodString;
2132
+ integrationType: z.ZodLiteral<IntegrationType.APOLLO>;
2133
+ configType: z.ZodLiteral<ConfigType.APOLLO_OUTPUT>;
2109
2134
  }, z.core.$strip>]>;
2110
2135
  export type ConfigData = z.infer<typeof configDataSchema>;
2111
2136
  /** Configs that can serve as triggers (event sources). */
@@ -2779,6 +2804,10 @@ export declare const skillConfigDataSchema: z.ZodUnion<readonly [z.ZodObject<{
2779
2804
  integrationId: z.ZodString;
2780
2805
  integrationType: z.ZodLiteral<IntegrationType.RESEND>;
2781
2806
  configType: z.ZodLiteral<ConfigType.RESEND_OUTPUT>;
2807
+ }, z.core.$strip>, z.ZodObject<{
2808
+ integrationId: z.ZodString;
2809
+ integrationType: z.ZodLiteral<IntegrationType.APOLLO>;
2810
+ configType: z.ZodLiteral<ConfigType.APOLLO_OUTPUT>;
2782
2811
  }, z.core.$strip>]>;
2783
2812
  export type SkillConfigData = z.infer<typeof skillConfigDataSchema>;
2784
2813
  export declare function isConfigComplete(config: ConfigData | undefined): boolean;
@@ -2810,6 +2839,7 @@ export type ConfigMetadataMap = EnsureExhaustiveMetadata<{
2810
2839
  [ConfigType.WEBMONITOR]: typeof WebMonitorConfig;
2811
2840
  [ConfigType.HEY_REACH_INPUT]: typeof HeyReachInputConfig;
2812
2841
  [ConfigType.RESEND_OUTPUT]: typeof ResendOutputConfig;
2842
+ [ConfigType.APOLLO_OUTPUT]: typeof ApolloOutputConfig;
2813
2843
  }>;
2814
2844
  export declare const CONFIG_METADATA: ConfigMetadataMap;
2815
2845
  export {};
package/dist/Configs.js CHANGED
@@ -28,6 +28,7 @@ export var ConfigType;
28
28
  ConfigType["WEBMONITOR"] = "webmonitor";
29
29
  ConfigType["HEY_REACH_INPUT"] = "hey_reach_input";
30
30
  ConfigType["RESEND_OUTPUT"] = "resend_output";
31
+ ConfigType["APOLLO_OUTPUT"] = "apollo_output";
31
32
  })(ConfigType || (ConfigType = {}));
32
33
  export const configTypeEnum = z.enum(ConfigType);
33
34
  export const frequencyUnitSchema = z.enum(["hour", "day", "week"]);
@@ -232,6 +233,14 @@ export const ResendOutputConfigMetadata = {
232
233
  isInput: false,
233
234
  isOutput: true
234
235
  };
236
+ export const ApolloOutputConfigMetadata = {
237
+ configType: ConfigType.APOLLO_OUTPUT,
238
+ name: "Apollo",
239
+ description: "Enrich people and companies and search for prospects using Apollo.io",
240
+ integrationType: IntegrationType.APOLLO,
241
+ isInput: false,
242
+ isOutput: true
243
+ };
235
244
  export const CONFIG_DETAILS = {
236
245
  [ConfigType.GMAIL]: GmailConfigMetadata,
237
246
  [ConfigType.GMAIL_OUTPUT]: GmailOutputConfigMetadata,
@@ -257,7 +266,8 @@ export const CONFIG_DETAILS = {
257
266
  [ConfigType.WEBHOOK_INPUT]: WebhookInputConfigMetadata,
258
267
  [ConfigType.WEBMONITOR]: WebMonitorConfigMetadata,
259
268
  [ConfigType.HEY_REACH_INPUT]: HeyReachInputConfigMetadata,
260
- [ConfigType.RESEND_OUTPUT]: ResendOutputConfigMetadata
269
+ [ConfigType.RESEND_OUTPUT]: ResendOutputConfigMetadata,
270
+ [ConfigType.APOLLO_OUTPUT]: ApolloOutputConfigMetadata
261
271
  };
262
272
  // MARK: Event Types — specific events within each integration trigger
263
273
  export const SlackEventType = {
@@ -946,6 +956,21 @@ export class ResendOutputConfig extends BaseConfigInstance {
946
956
  return `Type: Resend Output\nIntegration ID: ${this.integrationId}`;
947
957
  }
948
958
  }
959
+ export const ApolloOutputConfigSchema = ConfigInstanceSchema.extend({
960
+ integrationType: z.literal(IntegrationType.APOLLO),
961
+ configType: z.literal(ConfigType.APOLLO_OUTPUT)
962
+ });
963
+ export class ApolloOutputConfig extends BaseConfigInstance {
964
+ constructor(integrationId) {
965
+ super(integrationId, IntegrationType.APOLLO, ConfigType.APOLLO_OUTPUT);
966
+ }
967
+ isComplete() {
968
+ return !!this.integrationId;
969
+ }
970
+ formatForAgent() {
971
+ return `Type: Apollo Output\nIntegration ID: ${this.integrationId}`;
972
+ }
973
+ }
949
974
  export const WebhookInputConfigSchema = ConfigInstanceSchema.extend({
950
975
  integrationId: z.literal("system"),
951
976
  integrationType: z.literal(IntegrationType.WEBHOOK),
@@ -1062,7 +1087,8 @@ export const configDataSchema = z.union([
1062
1087
  WebhookInputConfigSchema,
1063
1088
  WebMonitorConfigSchema,
1064
1089
  HeyReachInputConfigSchema,
1065
- ResendOutputConfigSchema
1090
+ ResendOutputConfigSchema,
1091
+ ApolloOutputConfigSchema
1066
1092
  ]);
1067
1093
  /** Configs that can serve as triggers (event sources). */
1068
1094
  export const triggerConfigDataSchema = z.union([
@@ -1094,7 +1120,8 @@ export const skillConfigDataSchema = z.union([
1094
1120
  WorkOSOutputConfigSchema,
1095
1121
  AttioOutputConfigSchema,
1096
1122
  SnowflakeOutputConfigSchema,
1097
- ResendOutputConfigSchema
1123
+ ResendOutputConfigSchema,
1124
+ ApolloOutputConfigSchema
1098
1125
  ]);
1099
1126
  export function isConfigComplete(config) {
1100
1127
  if (!config) {
@@ -1122,6 +1149,7 @@ export function isConfigComplete(config) {
1122
1149
  case ConfigType.WORKOS_OUTPUT:
1123
1150
  case ConfigType.SNOWFLAKE_OUTPUT:
1124
1151
  case ConfigType.RESEND_OUTPUT:
1152
+ case ConfigType.APOLLO_OUTPUT:
1125
1153
  return !!config.integrationId;
1126
1154
  case ConfigType.GITHUB:
1127
1155
  return (config.repositoryIds?.length ?? 0) > 0;
@@ -1287,6 +1315,8 @@ export function formatConfigForAgent(config) {
1287
1315
  return `Type: Snowflake Output\nIntegration ID: ${config.integrationId}`;
1288
1316
  case ConfigType.RESEND_OUTPUT:
1289
1317
  return `Type: Resend Output\nIntegration ID: ${config.integrationId}`;
1318
+ case ConfigType.APOLLO_OUTPUT:
1319
+ return `Type: Apollo Output\nIntegration ID: ${config.integrationId}`;
1290
1320
  case ConfigType.WEBHOOK_INPUT:
1291
1321
  return "Type: Webhook Trigger";
1292
1322
  case ConfigType.WEBMONITOR: {
@@ -1328,5 +1358,6 @@ export const CONFIG_METADATA = {
1328
1358
  [ConfigType.WEBHOOK_INPUT]: WebhookInputConfig,
1329
1359
  [ConfigType.WEBMONITOR]: WebMonitorConfig,
1330
1360
  [ConfigType.HEY_REACH_INPUT]: HeyReachInputConfig,
1331
- [ConfigType.RESEND_OUTPUT]: ResendOutputConfig
1361
+ [ConfigType.RESEND_OUTPUT]: ResendOutputConfig,
1362
+ [ConfigType.APOLLO_OUTPUT]: ApolloOutputConfig
1332
1363
  };
@@ -3,6 +3,7 @@ export declare enum IntegrationType {
3
3
  GITHUB = "github",
4
4
  HEY_REACH = "hey_reach",
5
5
  RESEND = "resend",
6
+ APOLLO = "apollo",
6
7
  GMAIL = "gmail",
7
8
  LINEAR = "linear",
8
9
  SLACK = "slack",
@@ -151,6 +152,13 @@ export declare const ResendIntegrationMetadata: {
151
152
  readonly isInput: false;
152
153
  readonly isOutput: true;
153
154
  };
155
+ export declare const ApolloIntegrationMetadata: {
156
+ readonly type: IntegrationType.APOLLO;
157
+ readonly name: "Apollo";
158
+ readonly description: "Enrich people and companies and search for prospects using Apollo.io";
159
+ readonly isInput: false;
160
+ readonly isOutput: true;
161
+ };
154
162
  export type IntegrationMetadataMap = Record<IntegrationType, IntegrationDetails>;
155
163
  export declare const INTEGRATION_METADATA: IntegrationMetadataMap;
156
164
  export declare const IntegrationInstanceSchema: z.ZodObject<{
@@ -184,6 +192,7 @@ export declare const InstallationOptionsSchemas: {
184
192
  readonly webmonitor: z.ZodObject<{}, z.core.$strict>;
185
193
  readonly hey_reach: z.ZodObject<{}, z.core.$strict>;
186
194
  readonly resend: z.ZodObject<{}, z.core.$strict>;
195
+ readonly apollo: z.ZodObject<{}, z.core.$strict>;
187
196
  };
188
197
  export type InstallationOptionsFor<T extends IntegrationType> = z.infer<(typeof InstallationOptionsSchemas)[T]>;
189
198
  export declare const SlackIntegrationSchema: z.ZodObject<{
@@ -231,6 +240,10 @@ export declare const ResendIntegrationSchema: z.ZodObject<{
231
240
  id: z.ZodString;
232
241
  }, z.core.$strip>;
233
242
  export type ResendIntegration = z.infer<typeof ResendIntegrationSchema>;
243
+ export declare const ApolloIntegrationSchema: z.ZodObject<{
244
+ id: z.ZodString;
245
+ }, z.core.$strip>;
246
+ export type ApolloIntegration = z.infer<typeof ApolloIntegrationSchema>;
234
247
  export declare const ResendTemplateVariableSchema: z.ZodObject<{
235
248
  key: z.ZodString;
236
249
  type: z.ZodEnum<{
@@ -5,6 +5,7 @@ export var IntegrationType;
5
5
  IntegrationType["GITHUB"] = "github";
6
6
  IntegrationType["HEY_REACH"] = "hey_reach";
7
7
  IntegrationType["RESEND"] = "resend";
8
+ IntegrationType["APOLLO"] = "apollo";
8
9
  IntegrationType["GMAIL"] = "gmail";
9
10
  IntegrationType["LINEAR"] = "linear";
10
11
  IntegrationType["SLACK"] = "slack";
@@ -150,6 +151,13 @@ export const ResendIntegrationMetadata = {
150
151
  isInput: false,
151
152
  isOutput: true
152
153
  };
154
+ export const ApolloIntegrationMetadata = {
155
+ type: IntegrationType.APOLLO,
156
+ name: "Apollo",
157
+ description: "Enrich people and companies and search for prospects using Apollo.io",
158
+ isInput: false,
159
+ isOutput: true
160
+ };
153
161
  export const INTEGRATION_METADATA = {
154
162
  [IntegrationType.GMAIL]: GmailIntegrationMetadata,
155
163
  [IntegrationType.NOTION]: NotionIntegrationMetadata,
@@ -167,7 +175,8 @@ export const INTEGRATION_METADATA = {
167
175
  [IntegrationType.WEBHOOK]: WebhookIntegrationMetadata,
168
176
  [IntegrationType.WEBMONITOR]: WebMonitorIntegrationMetadata,
169
177
  [IntegrationType.HEY_REACH]: HeyReachIntegrationMetadata,
170
- [IntegrationType.RESEND]: ResendIntegrationMetadata
178
+ [IntegrationType.RESEND]: ResendIntegrationMetadata,
179
+ [IntegrationType.APOLLO]: ApolloIntegrationMetadata
171
180
  };
172
181
  // MARK: Integration Details
173
182
  export const IntegrationInstanceSchema = z.object({
@@ -198,7 +207,8 @@ export const InstallationOptionsSchemas = {
198
207
  [IntegrationType.WEBHOOK]: NoInstallationOptionsSchema,
199
208
  [IntegrationType.WEBMONITOR]: NoInstallationOptionsSchema,
200
209
  [IntegrationType.HEY_REACH]: NoInstallationOptionsSchema,
201
- [IntegrationType.RESEND]: NoInstallationOptionsSchema
210
+ [IntegrationType.RESEND]: NoInstallationOptionsSchema,
211
+ [IntegrationType.APOLLO]: NoInstallationOptionsSchema
202
212
  };
203
213
  export const SlackIntegrationSchema = IntegrationInstanceSchema.extend({
204
214
  teamId: z.string().optional(),
@@ -227,6 +237,7 @@ export const PosthogIntegrationSchema = IntegrationInstanceSchema.extend({
227
237
  });
228
238
  export const HeyReachIntegrationSchema = IntegrationInstanceSchema;
229
239
  export const ResendIntegrationSchema = IntegrationInstanceSchema;
240
+ export const ApolloIntegrationSchema = IntegrationInstanceSchema;
230
241
  export const ResendTemplateVariableSchema = z.object({
231
242
  key: z.string(),
232
243
  type: z.enum(["string", "number"]),
@@ -28,6 +28,7 @@ export declare const attioIntegrationsKey: () => readonly [string];
28
28
  export declare const snowflakeIntegrationsKey: () => readonly [string];
29
29
  export declare const heyReachIntegrationsKey: () => readonly [string];
30
30
  export declare const resendIntegrationsKey: () => readonly [string];
31
+ export declare const apolloIntegrationsKey: () => readonly [string];
31
32
  export declare const attioObjectsKey: (integrationId: string | null | undefined) => readonly [string, string] | null;
32
33
  export declare const allRunHistoryKey: (params?: GetRunHistoryParams) => readonly [string, string] | readonly [string];
33
34
  export declare const runHistoryKey: (agentId: string, params?: GetRunHistoryParams) => readonly [string, string, string] | readonly [string, string];
@@ -74,6 +74,7 @@ export const heyReachIntegrationsKey = () => {
74
74
  return ["heyReachIntegrations"];
75
75
  };
76
76
  export const resendIntegrationsKey = () => ["resendIntegrations"];
77
+ export const apolloIntegrationsKey = () => ["apolloIntegrations"];
77
78
  export const attioObjectsKey = (integrationId) => {
78
79
  if (!integrationId) {
79
80
  return null;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const organizationMetadataSchema: z.ZodObject<{
3
+ stripeCustomerId: z.ZodString;
4
+ runExecutionBlocked: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<boolean, string | boolean | undefined>>;
5
+ }, z.core.$strip>;
6
+ export type OrganizationMetadata = z.infer<typeof organizationMetadataSchema>;
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ // Can be serialized a string, supports deserialization
3
+ const booleanMetadataSchema = z
4
+ .union([z.boolean(), z.string()])
5
+ .optional()
6
+ .transform(value => value === true || value === "true");
7
+ export const organizationMetadataSchema = z.object({
8
+ stripeCustomerId: z.string(),
9
+ runExecutionBlocked: booleanMetadataSchema
10
+ });
@@ -976,6 +976,95 @@ const TOOL_DISPLAY_CONFIG = {
976
976
  return `Query plan retrieved (${rowCount} step${rowCount !== 1 ? "s" : ""})`;
977
977
  return "Query plan retrieved";
978
978
  }
979
+ },
980
+ // ===================
981
+ // Apollo Tools
982
+ // ===================
983
+ apollo_enrich_person: {
984
+ preparing: "Preparing person enrichment",
985
+ executing: params => {
986
+ const target = (params?.email ?? params?.name);
987
+ return target ? `Enriching ${truncate(target)}` : "Enriching person";
988
+ },
989
+ complete: (params, result) => {
990
+ const parsed = safeParseResult(result);
991
+ const person = parsed?.person;
992
+ if (person?.name)
993
+ return `Enriched ${truncate(person.name)}`;
994
+ if (parsed && parsed.found === false)
995
+ return "No match found";
996
+ const target = (params?.email ?? params?.name);
997
+ return target ? `Enriched ${truncate(target)}` : "Person enrichment complete";
998
+ },
999
+ approval: params => {
1000
+ const target = (params?.email ?? params?.name);
1001
+ return target ? `Enrich ${truncate(target)} via Apollo (uses a credit)?` : "Enrich this person via Apollo (uses a credit)?";
1002
+ }
1003
+ },
1004
+ apollo_bulk_enrich_people: {
1005
+ preparing: "Preparing bulk enrichment",
1006
+ executing: params => {
1007
+ const people = params?.people;
1008
+ return people ? `Enriching ${people.length} people` : "Enriching people";
1009
+ },
1010
+ complete: (_params, result) => {
1011
+ const parsed = safeParseResult(result);
1012
+ const matched = parsed?.matchedCount;
1013
+ const requested = parsed?.requestedCount;
1014
+ if (matched !== undefined && requested !== undefined)
1015
+ return `Enriched ${matched} of ${requested} people`;
1016
+ return "Bulk enrichment complete";
1017
+ },
1018
+ approval: params => {
1019
+ const people = params?.people;
1020
+ return people ? `Enrich ${people.length} people via Apollo (uses credits)?` : "Bulk enrich people via Apollo (uses credits)?";
1021
+ }
1022
+ },
1023
+ apollo_enrich_organization: {
1024
+ preparing: "Preparing company enrichment",
1025
+ executing: params => {
1026
+ const domain = params?.domain;
1027
+ return domain ? `Enriching ${truncate(domain)}` : "Enriching company";
1028
+ },
1029
+ complete: (params, result) => {
1030
+ const parsed = safeParseResult(result);
1031
+ const organization = parsed?.organization;
1032
+ if (organization?.name)
1033
+ return `Enriched ${truncate(organization.name)}`;
1034
+ if (parsed && parsed.found === false)
1035
+ return "No match found";
1036
+ const domain = params?.domain;
1037
+ return domain ? `Enriched ${truncate(domain)}` : "Company enrichment complete";
1038
+ },
1039
+ approval: params => {
1040
+ const domain = params?.domain;
1041
+ return domain ? `Enrich ${truncate(domain)} via Apollo (uses a credit)?` : "Enrich this company via Apollo (uses a credit)?";
1042
+ }
1043
+ },
1044
+ apollo_search_people: {
1045
+ preparing: "Preparing prospect search",
1046
+ executing: () => "Searching Apollo for people",
1047
+ complete: (_params, result) => {
1048
+ const parsed = safeParseResult(result);
1049
+ const total = parsed?.totalEntries;
1050
+ if (total !== undefined)
1051
+ return `Found ${total} matching ${total === 1 ? "person" : "people"}`;
1052
+ return "People search complete";
1053
+ }
1054
+ },
1055
+ apollo_list_job_postings: {
1056
+ preparing: "Preparing job posting lookup",
1057
+ executing: params => {
1058
+ const organizationId = params?.organizationId;
1059
+ return organizationId ? `Loading job postings for ${truncate(organizationId)}` : "Loading job postings";
1060
+ },
1061
+ complete: (_params, result) => {
1062
+ const parsed = safeParseResult(result);
1063
+ const total = parsed?.totalPostings;
1064
+ if (total !== undefined)
1065
+ return `Found ${total} job posting${total !== 1 ? "s" : ""}`;
1066
+ return "Job postings loaded";
1067
+ }
979
1068
  }
980
1069
  };
981
1070
  /**