terse-types 0.0.34 → 0.0.36

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.
package/dist/Configs.js CHANGED
@@ -19,6 +19,7 @@ export var ConfigType;
19
19
  ConfigType["IMAGE_EDIT"] = "image_edit";
20
20
  ConfigType["WORKOS_INPUT"] = "workos_input";
21
21
  ConfigType["WORKOS_OUTPUT"] = "workos_output";
22
+ ConfigType["ATTIO_INPUT"] = "attio_input";
22
23
  ConfigType["ATTIO_OUTPUT"] = "attio_output";
23
24
  ConfigType["SNOWFLAKE_OUTPUT"] = "snowflake_output";
24
25
  ConfigType["WEBHOOK_INPUT"] = "webhook_input";
@@ -164,6 +165,14 @@ export const WorkOSOutputConfigMetadata = {
164
165
  isInput: false,
165
166
  isOutput: true
166
167
  };
168
+ export const AttioInputConfigMetadata = {
169
+ configType: ConfigType.ATTIO_INPUT,
170
+ name: "Attio",
171
+ description: "Trigger on Attio record events (created, updated, deleted)",
172
+ integrationType: IntegrationType.ATTIO,
173
+ isInput: true,
174
+ isOutput: false
175
+ };
167
176
  export const AttioOutputConfigMetadata = {
168
177
  configType: ConfigType.ATTIO_OUTPUT,
169
178
  name: "Attio",
@@ -222,6 +231,7 @@ export const CONFIG_DETAILS = {
222
231
  [ConfigType.IMAGE_EDIT]: ImageEditConfigMetadata,
223
232
  [ConfigType.WORKOS_INPUT]: WorkOSInputConfigMetadata,
224
233
  [ConfigType.WORKOS_OUTPUT]: WorkOSOutputConfigMetadata,
234
+ [ConfigType.ATTIO_INPUT]: AttioInputConfigMetadata,
225
235
  [ConfigType.ATTIO_OUTPUT]: AttioOutputConfigMetadata,
226
236
  [ConfigType.SNOWFLAKE_OUTPUT]: SnowflakeOutputConfigMetadata,
227
237
  [ConfigType.WEBHOOK_INPUT]: WebhookInputConfigMetadata,
@@ -267,6 +277,36 @@ export const HeyReachEventType = {
267
277
  LEAD_TAG_UPDATED: "LEAD_TAG_UPDATED"
268
278
  };
269
279
  export const heyReachEventTypeSchema = z.enum(HeyReachEventType);
280
+ export const AttioEventType = {
281
+ CALL_RECORDING_CREATED: "call-recording.created",
282
+ COMMENT_CREATED: "comment.created",
283
+ COMMENT_RESOLVED: "comment.resolved",
284
+ COMMENT_UNRESOLVED: "comment.unresolved",
285
+ COMMENT_DELETED: "comment.deleted",
286
+ LIST_CREATED: "list.created",
287
+ LIST_UPDATED: "list.updated",
288
+ LIST_DELETED: "list.deleted",
289
+ LIST_ATTRIBUTE_CREATED: "list-attribute.created",
290
+ LIST_ATTRIBUTE_UPDATED: "list-attribute.updated",
291
+ LIST_ENTRY_CREATED: "list-entry.created",
292
+ LIST_ENTRY_UPDATED: "list-entry.updated",
293
+ LIST_ENTRY_DELETED: "list-entry.deleted",
294
+ OBJECT_ATTRIBUTE_CREATED: "object-attribute.created",
295
+ OBJECT_ATTRIBUTE_UPDATED: "object-attribute.updated",
296
+ NOTE_CREATED: "note.created",
297
+ NOTE_CONTENT_UPDATED: "note-content.updated",
298
+ NOTE_UPDATED: "note.updated",
299
+ NOTE_DELETED: "note.deleted",
300
+ RECORD_CREATED: "record.created",
301
+ RECORD_MERGED: "record.merged",
302
+ RECORD_UPDATED: "record.updated",
303
+ RECORD_DELETED: "record.deleted",
304
+ TASK_CREATED: "task.created",
305
+ TASK_UPDATED: "task.updated",
306
+ TASK_DELETED: "task.deleted",
307
+ WORKSPACE_MEMBER_CREATED: "workspace-member.created"
308
+ };
309
+ export const attioEventTypeSchema = z.enum(AttioEventType);
270
310
  export const WorkOSEventType = {
271
311
  USER_CREATED: "user.created",
272
312
  USER_UPDATED: "user.updated",
@@ -769,6 +809,43 @@ export class WorkOSOutputConfig extends BaseConfigInstance {
769
809
  return `Type: WorkOS Skill\nIntegration ID: ${this.integrationId}`;
770
810
  }
771
811
  }
812
+ export const AttioFilterOperator = {
813
+ EQUALS: "equals",
814
+ NOT_EQUALS: "not_equals"
815
+ };
816
+ export const attioFilterOperatorSchema = z.enum(AttioFilterOperator);
817
+ export const attioFilterClauseSchema = z.object({
818
+ field: z.string(),
819
+ operator: attioFilterOperatorSchema,
820
+ value: z.union([z.string(), z.number(), z.boolean()])
821
+ });
822
+ export const attioFilterSchema = z.union([z.object({ $and: z.array(attioFilterClauseSchema) }), z.object({ $or: z.array(attioFilterClauseSchema) })]);
823
+ export const attioSubscriptionSchema = z.object({
824
+ eventType: attioEventTypeSchema,
825
+ filter: attioFilterSchema.nullish()
826
+ });
827
+ export const AttioInputConfigSchema = ConfigInstanceSchema.extend({
828
+ integrationType: z.literal(IntegrationType.ATTIO),
829
+ configType: z.literal(ConfigType.ATTIO_INPUT),
830
+ subscriptions: z.array(attioSubscriptionSchema).default([])
831
+ });
832
+ export class AttioInputConfig extends BaseConfigInstance {
833
+ subscriptions;
834
+ constructor(integrationId, subscriptions = []) {
835
+ super(integrationId, IntegrationType.ATTIO, ConfigType.ATTIO_INPUT);
836
+ this.subscriptions = subscriptions;
837
+ }
838
+ isComplete() {
839
+ return this.subscriptions.length > 0;
840
+ }
841
+ formatForAgent() {
842
+ const parts = [`Type: Attio Events`, `Integration ID: ${this.integrationId}`];
843
+ for (const sub of this.subscriptions) {
844
+ parts.push(`- ${sub.eventType}`);
845
+ }
846
+ return parts.join("\n");
847
+ }
848
+ }
772
849
  export const AttioOutputConfigSchema = ConfigInstanceSchema.extend({
773
850
  integrationType: z.literal(IntegrationType.ATTIO),
774
851
  configType: z.literal(ConfigType.ATTIO_OUTPUT),
@@ -916,6 +993,7 @@ export const configDataSchema = z.union([
916
993
  ImageEditConfigSchema,
917
994
  WorkOSInputConfigSchema,
918
995
  WorkOSOutputConfigSchema,
996
+ AttioInputConfigSchema,
919
997
  AttioOutputConfigSchema,
920
998
  SnowflakeOutputConfigSchema,
921
999
  WebhookInputConfigSchema,
@@ -930,6 +1008,7 @@ export const triggerConfigDataSchema = z.union([
930
1008
  GitHubConfigSchema,
931
1009
  TimeTriggerConfigSchema,
932
1010
  WorkOSInputConfigSchema,
1011
+ AttioInputConfigSchema,
933
1012
  WebhookInputConfigSchema,
934
1013
  WebMonitorConfigSchema,
935
1014
  HeyReachInputConfigSchema
@@ -990,6 +1069,8 @@ export function isConfigComplete(config) {
990
1069
  return config.eventTypes.length > 0;
991
1070
  case ConfigType.HEY_REACH_INPUT:
992
1071
  return !!config.eventType;
1072
+ case ConfigType.ATTIO_INPUT:
1073
+ return config.subscriptions.length > 0;
993
1074
  case ConfigType.ATTIO_OUTPUT:
994
1075
  return !!config.objectSlug;
995
1076
  default:
@@ -1120,6 +1201,12 @@ export function formatConfigForAgent(config) {
1120
1201
  }
1121
1202
  case ConfigType.WORKOS_OUTPUT:
1122
1203
  return `Type: WorkOS Skill\nIntegration ID: ${config.integrationId}`;
1204
+ case ConfigType.ATTIO_INPUT: {
1205
+ const parts = [`Type: Attio Events`, `Integration ID: ${config.integrationId}`];
1206
+ for (const sub of config.subscriptions)
1207
+ parts.push(`- ${sub.eventType}`);
1208
+ return parts.join("\n");
1209
+ }
1123
1210
  case ConfigType.ATTIO_OUTPUT: {
1124
1211
  const parts = [`Type: Attio Output`, `Integration ID: ${config.integrationId}`];
1125
1212
  if (config.objectSlug)
@@ -1162,6 +1249,7 @@ export const CONFIG_METADATA = {
1162
1249
  [ConfigType.IMAGE_EDIT]: ImageEditConfig,
1163
1250
  [ConfigType.WORKOS_INPUT]: WorkOSInputConfig,
1164
1251
  [ConfigType.WORKOS_OUTPUT]: WorkOSOutputConfig,
1252
+ [ConfigType.ATTIO_INPUT]: AttioInputConfig,
1165
1253
  [ConfigType.ATTIO_OUTPUT]: AttioOutputConfig,
1166
1254
  [ConfigType.SNOWFLAKE_OUTPUT]: SnowflakeOutputConfig,
1167
1255
  [ConfigType.WEBHOOK_INPUT]: WebhookInputConfig,
@@ -112,8 +112,8 @@ export declare const WorkOSIntegrationMetadata: {
112
112
  export declare const AttioIntegrationMetadata: {
113
113
  readonly type: IntegrationType.ATTIO;
114
114
  readonly name: "Attio";
115
- readonly description: "Add and update contacts in Attio";
116
- readonly isInput: false;
115
+ readonly description: "Trigger on Attio record events and add/update contacts in Attio";
116
+ readonly isInput: true;
117
117
  readonly isOutput: true;
118
118
  };
119
119
  export declare const SnowflakeIntegrationMetadata: {
@@ -108,8 +108,8 @@ export const WorkOSIntegrationMetadata = {
108
108
  export const AttioIntegrationMetadata = {
109
109
  type: IntegrationType.ATTIO,
110
110
  name: "Attio",
111
- description: "Add and update contacts in Attio",
112
- isInput: false,
111
+ description: "Trigger on Attio record events and add/update contacts in Attio",
112
+ isInput: true,
113
113
  isOutput: true
114
114
  };
115
115
  export const SnowflakeIntegrationMetadata = {
package/dist/Tools.d.ts CHANGED
@@ -4605,6 +4605,10 @@ export declare const imageEditTool: {
4605
4605
  }, z.core.$strip>;
4606
4606
  };
4607
4607
  export declare const attioObjectSchema: z.ZodObject<{
4608
+ id: z.ZodObject<{
4609
+ workspace_id: z.ZodString;
4610
+ object_id: z.ZodString;
4611
+ }, z.core.$strip>;
4608
4612
  api_slug: z.ZodString;
4609
4613
  singular_noun: z.ZodString;
4610
4614
  plural_noun: z.ZodString;
@@ -4617,6 +4621,10 @@ export declare const attioAttributeSchema: z.ZodObject<{
4617
4621
  is_unique: z.ZodOptional<z.ZodBoolean>;
4618
4622
  }, z.core.$catchall<z.ZodUnknown>>;
4619
4623
  export declare const attioObjectWithAttributesSchema: z.ZodObject<{
4624
+ id: z.ZodObject<{
4625
+ workspace_id: z.ZodString;
4626
+ object_id: z.ZodString;
4627
+ }, z.core.$strip>;
4620
4628
  api_slug: z.ZodString;
4621
4629
  singular_noun: z.ZodString;
4622
4630
  plural_noun: z.ZodString;
@@ -4823,6 +4831,10 @@ export declare const attioListObjectsTool: {
4823
4831
  }, z.core.$strip>>>;
4824
4832
  }, z.core.$strip>>>;
4825
4833
  objects: z.ZodArray<z.ZodObject<{
4834
+ id: z.ZodObject<{
4835
+ workspace_id: z.ZodString;
4836
+ object_id: z.ZodString;
4837
+ }, z.core.$strip>;
4826
4838
  api_slug: z.ZodString;
4827
4839
  singular_noun: z.ZodString;
4828
4840
  plural_noun: z.ZodString;
@@ -7419,6 +7431,10 @@ export declare const ToolDefinitions: {
7419
7431
  }, z.core.$strip>>>;
7420
7432
  }, z.core.$strip>>>;
7421
7433
  objects: z.ZodArray<z.ZodObject<{
7434
+ id: z.ZodObject<{
7435
+ workspace_id: z.ZodString;
7436
+ object_id: z.ZodString;
7437
+ }, z.core.$strip>;
7422
7438
  api_slug: z.ZodString;
7423
7439
  singular_noun: z.ZodString;
7424
7440
  plural_noun: z.ZodString;
package/dist/Tools.js CHANGED
@@ -1537,6 +1537,10 @@ export const imageEditTool = defineTool({
1537
1537
  });
1538
1538
  // Attio schemas
1539
1539
  export const attioObjectSchema = z.object({
1540
+ id: z.object({
1541
+ workspace_id: z.string(),
1542
+ object_id: z.string()
1543
+ }),
1540
1544
  api_slug: z.string(),
1541
1545
  singular_noun: z.string(),
1542
1546
  plural_noun: z.string()
@@ -6,3 +6,4 @@ export interface TriggerDisplay {
6
6
  export declare function formatTriggerForAgent(event: Trigger): string;
7
7
  export declare function debugTrigger(event: Trigger): string;
8
8
  export declare function displayTrigger(event: Trigger): TriggerDisplay;
9
+ export declare function humanizeAttioEventType(eventType: string): string;
@@ -60,6 +60,11 @@ const TriggerPresenters = {
60
60
  debug: (event) => `HeyReach ${event.eventType}${event.lead?.id != null ? ` lead=${event.lead.id}` : ""}`,
61
61
  display: formatHeyReachDisplay
62
62
  },
63
+ [IntegrationType.ATTIO]: {
64
+ formatForAgent: formatAttioTrigger,
65
+ debug: (event) => `Attio ${event.eventType}${event.objectSlug ? ` object=${event.objectSlug}` : ""}`,
66
+ display: formatAttioDisplay
67
+ },
63
68
  [IntegrationType.WEBHOOK]: {
64
69
  formatForAgent: formatWebhookTrigger,
65
70
  debug: (event) => `Webhook Trigger (${event.method})`,
@@ -90,6 +95,8 @@ function dispatchPresenter(event, method) {
90
95
  return TriggerPresenters[IntegrationType.WORKOS][method](event);
91
96
  case IntegrationType.HEY_REACH:
92
97
  return TriggerPresenters[IntegrationType.HEY_REACH][method](event);
98
+ case IntegrationType.ATTIO:
99
+ return TriggerPresenters[IntegrationType.ATTIO][method](event);
93
100
  case IntegrationType.WEBHOOK:
94
101
  return TriggerPresenters[IntegrationType.WEBHOOK][method](event);
95
102
  case IntegrationType.CRON_JOB:
@@ -464,6 +471,53 @@ function humanizeHeyReachEventType(eventType) {
464
471
  .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
465
472
  .join(" ");
466
473
  }
474
+ function attioResourceLabel(event) {
475
+ const ids = event.resourceIds;
476
+ if (ids.record_id)
477
+ return `${event.objectSlug ?? "record"} ${ids.record_id}`;
478
+ if (ids.entry_id)
479
+ return `list entry ${ids.entry_id}`;
480
+ if (ids.list_id)
481
+ return `list ${ids.list_id}`;
482
+ if (ids.note_id)
483
+ return `note ${ids.note_id}`;
484
+ if (ids.task_id)
485
+ return `task ${ids.task_id}`;
486
+ if (ids.comment_id)
487
+ return `comment ${ids.comment_id}`;
488
+ if (ids.call_recording_id)
489
+ return `call recording ${ids.call_recording_id}`;
490
+ if (ids.workspace_member_id)
491
+ return `workspace member ${ids.workspace_member_id}`;
492
+ if (ids.attribute_id)
493
+ return `attribute ${ids.attribute_id}`;
494
+ return null;
495
+ }
496
+ export function humanizeAttioEventType(eventType) {
497
+ return eventType
498
+ .replace(/[-.]/g, " ")
499
+ .split(" ")
500
+ .filter(Boolean)
501
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
502
+ .join(" ");
503
+ }
504
+ function formatAttioTrigger(event) {
505
+ const lines = [`Attio Event: ${event.eventType}`, `Event ID: ${event.eventId}`, `Created At: ${event.createdAt}`, `Workspace ID: ${event.workspaceId}`];
506
+ if (event.objectSlug)
507
+ lines.push(`Object: ${event.objectSlug}`);
508
+ const resource = attioResourceLabel(event);
509
+ if (resource)
510
+ lines.push(`Resource: ${resource}`);
511
+ if (event.actor.type)
512
+ lines.push(`Actor: ${event.actor.type}${event.actor.id ? ` (${event.actor.id})` : ""}`);
513
+ lines.push(`\nFull Event:\n${JSON.stringify(event.rawEvent, null, 2)}`);
514
+ return lines.join("\n");
515
+ }
516
+ function formatAttioDisplay(event) {
517
+ const subtitle = humanizeAttioEventType(event.eventType);
518
+ const resource = attioResourceLabel(event);
519
+ return { title: resource ?? "Attio event", subtitle };
520
+ }
467
521
  function formatHeyReachDisplay(event) {
468
522
  const subtitle = humanizeHeyReachEventType(event.eventType);
469
523
  const leadName = heyReachLeadFullName(event);