terse-types 0.0.72 → 0.0.74

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.
@@ -66,13 +66,13 @@ function attioActionLabel(params, noun, done, count) {
66
66
  return `${verb} ${count} ${noun}${count !== 1 ? "s" : ""}`;
67
67
  return `${verb} ${noun}${plural ? "s" : ""}`;
68
68
  }
69
- function attioRecordsRequest(params) {
69
+ function attioReadRecordsRequest(params) {
70
70
  const request = params?.request;
71
71
  return request && typeof request === "object" && "action" in request ? request : undefined;
72
72
  }
73
- function attioRecordsLabel(request, done, count) {
73
+ function attioReadRecordsLabel(request, done, count) {
74
74
  if (!request)
75
- return done ? "Updated records" : "Working with records";
75
+ return done ? "Loaded records" : "Loading records";
76
76
  const target = `${request.objectSlug} record`;
77
77
  switch (request.action) {
78
78
  case "query":
@@ -84,18 +84,15 @@ function attioRecordsLabel(request, done, count) {
84
84
  return (done ? "Loaded" : "Loading") + ` ${target}`;
85
85
  case "get_attribute_history":
86
86
  return (done ? "Loaded" : "Loading") + ` ${target} history`;
87
- case "create":
88
- return (done ? "Created" : "Creating") + ` ${target}`;
89
- case "update":
90
- return (done ? "Updated" : "Updating") + ` ${target}`;
91
- case "upsert":
92
- if (done && count !== undefined && count !== 1)
93
- return `Saved ${count} ${target}s`;
94
- return (done ? "Saved" : "Saving") + ` ${target}`;
95
- case "delete":
96
- return (done ? "Deleted" : "Deleting") + ` ${target}`;
97
87
  }
98
88
  }
89
+ function attioRecordTarget(params) {
90
+ const request = params?.request;
91
+ return request?.objectSlug ? `${request.objectSlug} record` : "record";
92
+ }
93
+ function attioWriteDisplay(gerund, past, approvalPrompt) {
94
+ return { preparing: gerund, executing: () => gerund, complete: () => past, approval: () => approvalPrompt };
95
+ }
99
96
  /**
100
97
  * Display configurations for all tools.
101
98
  * Each tool defines how it should be displayed in preparing, executing, and complete phases.
@@ -728,20 +725,44 @@ const TOOL_DISPLAY_CONFIG = {
728
725
  // ===================
729
726
  // Attio Tools
730
727
  // ===================
731
- attio_records: {
732
- preparing: "Getting records ready",
733
- executing: params => attioRecordsLabel(attioRecordsRequest(params), false),
728
+ attio_read_records: {
729
+ preparing: "Loading records",
730
+ executing: params => attioReadRecordsLabel(attioReadRecordsRequest(params), false),
734
731
  complete: (params, result) => {
735
732
  const parsed = safeParseResult(result);
736
733
  const count = parsed?.count;
737
- return attioRecordsLabel(attioRecordsRequest(params), true, count);
738
- },
739
- approval: params => {
740
- const request = attioRecordsRequest(params);
741
- const target = request ? `${request.objectSlug} record` : "record";
742
- return request?.action === "delete" ? `Delete this ${target}? This cannot be undone.` : `Save ${target}?`;
734
+ return attioReadRecordsLabel(attioReadRecordsRequest(params), true, count);
743
735
  }
744
736
  },
737
+ attio_create_record: {
738
+ preparing: "Getting record ready",
739
+ executing: params => `Creating ${attioRecordTarget(params)}`,
740
+ complete: params => `Created ${attioRecordTarget(params)}`,
741
+ approval: params => `Create ${attioRecordTarget(params)}?`
742
+ },
743
+ attio_update_record: {
744
+ preparing: "Getting record updates ready",
745
+ executing: params => `Updating ${attioRecordTarget(params)}`,
746
+ complete: params => `Updated ${attioRecordTarget(params)}`,
747
+ approval: params => `Update ${attioRecordTarget(params)}?`
748
+ },
749
+ attio_upsert_record: {
750
+ preparing: "Getting records ready",
751
+ executing: params => `Saving ${attioRecordTarget(params)}`,
752
+ complete: (params, result) => {
753
+ const count = safeParseCount(result);
754
+ if (count !== undefined && count !== 1)
755
+ return `Saved ${count} ${attioRecordTarget(params)}s`;
756
+ return `Saved ${attioRecordTarget(params)}`;
757
+ },
758
+ approval: params => `Save ${attioRecordTarget(params)}?`
759
+ },
760
+ attio_delete_record: {
761
+ preparing: "Getting record ready",
762
+ executing: params => `Deleting ${attioRecordTarget(params)}`,
763
+ complete: params => `Deleted ${attioRecordTarget(params)}`,
764
+ approval: params => `Delete this ${attioRecordTarget(params)}? This cannot be undone.`
765
+ },
745
766
  attio_workspace_members: {
746
767
  preparing: "Looking up workspace members",
747
768
  executing: params => {
@@ -757,41 +778,67 @@ const TOOL_DISPLAY_CONFIG = {
757
778
  return count !== undefined ? `Found ${count} workspace member${count !== 1 ? "s" : ""}` : "Workspace members loaded";
758
779
  }
759
780
  },
760
- attio_tasks: {
761
- preparing: "Working with tasks",
781
+ attio_read_tasks: {
782
+ preparing: "Loading tasks",
762
783
  executing: params => attioActionLabel(params, "task", false),
763
784
  complete: (params, result) => attioActionLabel(params, "task", true, safeParseCount(result))
764
785
  },
765
- attio_notes: {
766
- preparing: "Working with notes",
786
+ attio_create_task: attioWriteDisplay("Creating task", "Created task", "Create this task?"),
787
+ attio_update_task: attioWriteDisplay("Updating task", "Updated task", "Update this task?"),
788
+ attio_delete_task: attioWriteDisplay("Deleting task", "Deleted task", "Delete this task? This cannot be undone."),
789
+ attio_read_notes: {
790
+ preparing: "Loading notes",
767
791
  executing: params => attioActionLabel(params, "note", false),
768
792
  complete: (params, result) => attioActionLabel(params, "note", true, safeParseCount(result))
769
793
  },
770
- attio_comments: {
771
- preparing: "Working with comments",
794
+ attio_create_note: attioWriteDisplay("Creating note", "Created note", "Create this note?"),
795
+ attio_delete_note: attioWriteDisplay("Deleting note", "Deleted note", "Delete this note? This cannot be undone."),
796
+ attio_read_comments: {
797
+ preparing: "Loading comments",
772
798
  executing: params => attioActionLabel(params, "comment", false),
773
799
  complete: (params, result) => attioActionLabel(params, "comment", true, safeParseCount(result))
774
800
  },
775
- attio_lists: {
776
- preparing: "Working with lists",
801
+ attio_create_comment: attioWriteDisplay("Creating comment", "Created comment", "Create this comment?"),
802
+ attio_delete_comment: attioWriteDisplay("Deleting comment", "Deleted comment", "Delete this comment? This cannot be undone."),
803
+ attio_read_lists: {
804
+ preparing: "Loading lists",
805
+ executing: params => attioActionLabel(params, "list", false),
806
+ complete: (params, result) => attioActionLabel(params, "list", true, safeParseCount(result))
807
+ },
808
+ attio_create_list: attioWriteDisplay("Creating list", "Created list", "Create this list?"),
809
+ attio_update_list: attioWriteDisplay("Updating list", "Updated list", "Update this list?"),
810
+ attio_read_list_entries: {
811
+ preparing: "Loading list entries",
777
812
  executing: params => attioActionLabel(params, "list entry", false),
778
813
  complete: (params, result) => attioActionLabel(params, "list entry", true, safeParseCount(result))
779
814
  },
815
+ attio_add_list_entry: attioWriteDisplay("Adding list entry", "Added list entry", "Add this list entry?"),
816
+ attio_upsert_list_entry: attioWriteDisplay("Saving list entry", "Saved list entry", "Save this list entry?"),
817
+ attio_update_list_entry: attioWriteDisplay("Updating list entry", "Updated list entry", "Update this list entry?"),
818
+ attio_remove_list_entry: attioWriteDisplay("Removing list entry", "Removed list entry", "Remove this list entry?"),
780
819
  attio_meetings: {
781
820
  preparing: "Loading meetings",
782
821
  executing: params => attioActionLabel(params, "meeting", false),
783
822
  complete: (params, result) => attioActionLabel(params, "meeting", true, safeParseCount(result))
784
823
  },
785
- attio_files: {
786
- preparing: "Working with files",
824
+ attio_read_files: {
825
+ preparing: "Loading files",
787
826
  executing: params => attioActionLabel(params, "file", false),
788
827
  complete: (params, result) => attioActionLabel(params, "file", true, safeParseCount(result))
789
828
  },
790
- attio_schema: {
829
+ attio_upload_file: attioWriteDisplay("Uploading file", "Uploaded file", "Upload this file?"),
830
+ attio_delete_file: attioWriteDisplay("Deleting file", "Deleted file", "Delete this file? This cannot be undone."),
831
+ attio_read_schema: {
791
832
  preparing: "Loading workspace schema",
792
833
  executing: params => attioActionLabel(params, "schema item", false),
793
834
  complete: (params, result) => attioActionLabel(params, "schema item", true, safeParseCount(result))
794
835
  },
836
+ attio_modify_schema: {
837
+ preparing: "Updating workspace schema",
838
+ executing: params => attioActionLabel(params, "schema item", false),
839
+ complete: (params, result) => attioActionLabel(params, "schema item", true, safeParseCount(result)),
840
+ approval: () => "Change the workspace schema? This affects every user."
841
+ },
795
842
  // ===================
796
843
  // WorkOS Tools
797
844
  // ===================