@gravity-rail/sdk 0.4.0 → 0.5.0

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/schemas.cjs CHANGED
@@ -216,6 +216,8 @@ __export(schemas_exports, {
216
216
  OperatorChatParticipantSchema: () => OperatorChatParticipantSchema,
217
217
  OrganizationSchema: () => OrganizationSchema,
218
218
  PhoneNumberFormDataSchema: () => PhoneNumberFormDataSchema,
219
+ RateLimitAllowlistEntrySchema: () => RateLimitAllowlistEntrySchema,
220
+ RateLimitOverrideSchema: () => RateLimitOverrideSchema,
219
221
  RateMessageSchema: () => RateMessageSchema,
220
222
  RemoveDataFieldSchema: () => RemoveDataFieldSchema,
221
223
  RemoveWorkspaceMemberSchema: () => RemoveWorkspaceMemberSchema,
@@ -390,7 +392,8 @@ var OrganizationSchema = import_zod.z.object({
390
392
  });
391
393
  var AdminOrganizationSchema = OrganizationSchema.extend({
392
394
  accountCount: import_zod.z.number(),
393
- workspaceCount: import_zod.z.number()
395
+ workspaceCount: import_zod.z.number(),
396
+ enforceCreditLimit: import_zod.z.boolean()
394
397
  });
395
398
  var CreateOrganizationRequestSchema = import_zod.z.object({
396
399
  name: import_zod.z.string(),
@@ -417,7 +420,10 @@ var UpdateOrganizationRequestSchema = import_zod.z.object({
417
420
  logoMimeType: import_zod.z.string().optional(),
418
421
  // Twilio sub-account linkage. Explicit null clears the field so SMS
419
422
  // falls through to the master client (does not touch Twilio itself).
420
- twilioSubAccountSid: import_zod.z.string().nullable().optional()
423
+ twilioSubAccountSid: import_zod.z.string().nullable().optional(),
424
+ // Hard credit enforcement toggle — flips between the legacy soft
425
+ // alert-only mode and the hard 402 stop at zero credits.
426
+ enforceCreditLimit: import_zod.z.boolean().optional()
421
427
  });
422
428
  var AdminAccountMembershipSchema = import_zod.z.object({
423
429
  workspaceUuid: import_zod.z.string(),
@@ -870,7 +876,11 @@ var ChatFormDataSchema = import_zod4.z.object({
870
876
  paused: import_zod4.z.boolean().optional(),
871
877
  muted: import_zod4.z.boolean().optional(),
872
878
  needsResponse: import_zod4.z.boolean().optional(),
873
- workflowVersionNumber: import_zod4.z.number().nullable().optional()
879
+ workflowVersionNumber: import_zod4.z.number().nullable().optional(),
880
+ // Human-typed initial SMS/email body. Optional, request-body only.
881
+ // Backend dispatches via the existing initial-message path when the
882
+ // Agent is disabled. Treat as PHI client-side.
883
+ initialMessage: import_zod4.z.string().nullable().optional()
874
884
  });
875
885
  var ChatFiltersSchema = import_zod4.z.object({
876
886
  page: import_zod4.z.number().optional(),
@@ -940,8 +950,16 @@ var CreateChatForWorkflowSchema = WorkspaceIdSchema.extend({
940
950
  var CreateChatCompletionSchema = WorkspaceIdSchema.extend({
941
951
  chatId: import_zod4.z.number().describe("Chat ID"),
942
952
  model: import_zod4.z.string().optional().describe("AI model to use"),
953
+ // ``id`` on each message is optional but, when provided for the latest
954
+ // user message, the backend uses it as the per-turn discriminator for
955
+ // the Temporal inference workflow. MCP/tool callers that validate
956
+ // through this schema would otherwise have ``id`` stripped and lose
957
+ // the same-message-retry idempotency the per-turn workflow IDs rely
958
+ // on (see lib/services/inference_keys.py and
959
+ // ChatCompletionMessageSchema below).
943
960
  messages: import_zod4.z.array(
944
961
  import_zod4.z.object({
962
+ id: import_zod4.z.string().optional(),
945
963
  role: import_zod4.z.string(),
946
964
  content: import_zod4.z.string()
947
965
  })
@@ -1045,9 +1063,21 @@ var ChatMessageAPIResponseSchema = import_zod4.z.object({
1045
1063
  error_details: import_zod4.z.any().optional(),
1046
1064
  createdAt: import_zod4.z.string(),
1047
1065
  email_id: import_zod4.z.number().optional(),
1048
- inbox_id: import_zod4.z.number().optional()
1066
+ inbox_id: import_zod4.z.number().optional(),
1067
+ // Task this message was produced under. Null for messages that predate the
1068
+ // workflow-task tracking or that originated outside a task (e.g. manager
1069
+ // chats). Surfaced in chat transcripts to help reviewers trace messages
1070
+ // back to the workflow task that produced them.
1071
+ taskId: import_zod4.z.number().nullable().optional(),
1072
+ // SMS delivery fields — only present on messages sent via Twilio SMS.
1073
+ smsDeliveryStatus: import_zod4.z.string().nullable().optional(),
1074
+ smsDeliveryErrorCode: import_zod4.z.string().nullable().optional(),
1075
+ smsDeliveryUpdatedAt: import_zod4.z.string().nullable().optional(),
1076
+ // Friendly failure reason — only set when smsDeliveryStatus is failed/undelivered.
1077
+ smsDeliveryFailureReason: import_zod4.z.string().nullable().optional()
1049
1078
  });
1050
1079
  var ChatCompletionMessageSchema = import_zod4.z.object({
1080
+ id: import_zod4.z.string().optional(),
1051
1081
  role: import_zod4.z.enum(["user", "assistant", "system"]),
1052
1082
  content: import_zod4.z.string()
1053
1083
  });
@@ -1080,29 +1110,29 @@ var DataFieldType = /* @__PURE__ */ ((DataFieldType2) => {
1080
1110
  DataFieldType2["TEXT"] = "text";
1081
1111
  DataFieldType2["LONGTEXT"] = "longtext";
1082
1112
  DataFieldType2["NUMBER"] = "number";
1113
+ DataFieldType2["INTEGER"] = "integer";
1083
1114
  DataFieldType2["DATE"] = "date";
1084
1115
  DataFieldType2["DATETIME"] = "datetime";
1085
1116
  DataFieldType2["TIME_OF_DAY"] = "time_of_day";
1086
- DataFieldType2["US_ZIP_CODE"] = "us_zip_code";
1087
- DataFieldType2["INTEGER"] = "integer";
1088
1117
  DataFieldType2["BOOLEAN"] = "boolean";
1118
+ DataFieldType2["FILE"] = "file";
1119
+ DataFieldType2["REFERENCE"] = "reference";
1120
+ DataFieldType2["FUNCTION"] = "function";
1089
1121
  DataFieldType2["ARRAY"] = "array";
1090
1122
  DataFieldType2["OBJECT"] = "object";
1091
- DataFieldType2["FUNCTION"] = "function";
1123
+ DataFieldType2["US_ZIP_CODE"] = "us_zip_code";
1092
1124
  return DataFieldType2;
1093
1125
  })(DataFieldType || {});
1094
1126
  var IndexStatus = /* @__PURE__ */ ((IndexStatus2) => {
1095
- IndexStatus2["NONE"] = "none";
1096
- IndexStatus2["PENDING"] = "pending";
1097
- IndexStatus2["CREATING"] = "creating";
1098
- IndexStatus2["REMOVING"] = "removing";
1099
- IndexStatus2["READY"] = "ready";
1127
+ IndexStatus2["NOT_INDEXED"] = "not_indexed";
1128
+ IndexStatus2["INDEXING"] = "indexing";
1129
+ IndexStatus2["INDEXED"] = "indexed";
1100
1130
  IndexStatus2["ERROR"] = "error";
1101
1131
  return IndexStatus2;
1102
1132
  })(IndexStatus || {});
1103
1133
  var DataTypeRecordScope = /* @__PURE__ */ ((DataTypeRecordScope2) => {
1104
- DataTypeRecordScope2["MEMBER"] = "member";
1105
1134
  DataTypeRecordScope2["WORKSPACE"] = "workspace";
1135
+ DataTypeRecordScope2["MEMBER"] = "member";
1106
1136
  return DataTypeRecordScope2;
1107
1137
  })(DataTypeRecordScope || {});
1108
1138
  var DataSensitivity = /* @__PURE__ */ ((DataSensitivity2) => {
@@ -1114,10 +1144,13 @@ var DataSensitivity = /* @__PURE__ */ ((DataSensitivity2) => {
1114
1144
  return DataSensitivity2;
1115
1145
  })(DataSensitivity || {});
1116
1146
  var DataCategory = /* @__PURE__ */ ((DataCategory2) => {
1117
- DataCategory2["PERSONAL"] = "personal";
1118
- DataCategory2["IDENTIFIER"] = "identifier";
1119
1147
  DataCategory2["PHI"] = "phi";
1148
+ DataCategory2["PII"] = "pii";
1149
+ DataCategory2["FINANCIAL"] = "financial";
1150
+ DataCategory2["OPERATIONAL"] = "operational";
1120
1151
  DataCategory2["CREDENTIAL"] = "credential";
1152
+ DataCategory2["PERSONAL"] = "personal";
1153
+ DataCategory2["IDENTIFIER"] = "identifier";
1121
1154
  return DataCategory2;
1122
1155
  })(DataCategory || {});
1123
1156
 
@@ -1519,11 +1552,23 @@ var InboxRuleSchema = import_zod6.z.object({
1519
1552
  operator: import_zod6.z.enum(["contains", "equals", "ends_with", "regex", "ip_in_range"]),
1520
1553
  value: import_zod6.z.string()
1521
1554
  });
1555
+ var RateLimitOverrideSchema = import_zod6.z.object({
1556
+ enabled: import_zod6.z.boolean().nullish(),
1557
+ per_minute: import_zod6.z.number().int().nullish(),
1558
+ per_hour: import_zod6.z.number().int().nullish()
1559
+ });
1560
+ var RateLimitAllowlistEntrySchema = import_zod6.z.object({
1561
+ sender: import_zod6.z.string(),
1562
+ reason: import_zod6.z.string().nullish()
1563
+ });
1522
1564
  var InboxRulesConfigSchema = import_zod6.z.object({
1523
1565
  allowMode: import_zod6.z.enum(["all", "none", "rules"]).optional(),
1524
1566
  denyMode: import_zod6.z.enum(["all", "none", "rules"]).optional(),
1525
1567
  allowRules: import_zod6.z.array(InboxRuleSchema).optional(),
1526
- denyRules: import_zod6.z.array(InboxRuleSchema).optional()
1568
+ denyRules: import_zod6.z.array(InboxRuleSchema).optional(),
1569
+ rateLimitEnabled: import_zod6.z.boolean().nullish(),
1570
+ rateLimitOverride: RateLimitOverrideSchema.nullish(),
1571
+ rateLimitAllowlist: import_zod6.z.array(RateLimitAllowlistEntrySchema).nullish()
1527
1572
  });
1528
1573
  var InboxFormDataSchema = import_zod6.z.object({
1529
1574
  name: import_zod6.z.string(),
@@ -1532,7 +1577,10 @@ var InboxFormDataSchema = import_zod6.z.object({
1532
1577
  defaultWorkflowId: import_zod6.z.number().optional(),
1533
1578
  assistantEnabled: import_zod6.z.boolean().optional(),
1534
1579
  autoReplyEnabled: import_zod6.z.boolean().optional(),
1535
- recipient: import_zod6.z.string().optional()
1580
+ recipient: import_zod6.z.string().optional(),
1581
+ // Optional OrgDomain UUID for inboxes hosted on a verified org-tier custom
1582
+ // domain. Backend validates ownership and email-config status.
1583
+ orgDomainUuid: import_zod6.z.string().uuid().optional()
1536
1584
  });
1537
1585
  var InboxEmailFiltersSchema = import_zod6.z.object({
1538
1586
  page: import_zod6.z.number().optional(),
@@ -1782,6 +1830,8 @@ var MemberFilterObjectTypeEnum = import_zod8.z.enum([
1782
1830
  "notifySms",
1783
1831
  "notifyEmail",
1784
1832
  "notifyVoice",
1833
+ "smsDeliveryStatus",
1834
+ "callForwarded",
1785
1835
  "calendarEvent",
1786
1836
  "chatEngagement",
1787
1837
  "lastMessageActivity",
@@ -1822,7 +1872,9 @@ var MemberFilterFilterTypeEnum = import_zod8.z.enum([
1822
1872
  "lessThanDaysAgo",
1823
1873
  "daysUntil",
1824
1874
  "hasKey",
1825
- "hasKeyValue"
1875
+ "hasKeyValue",
1876
+ "smsDeliveryStatusNeedsAttention",
1877
+ "callForwardedAny"
1826
1878
  ]);
1827
1879
  var MemberFilterRuleSchema = import_zod8.z.object({
1828
1880
  id: import_zod8.z.number(),
@@ -2133,10 +2185,24 @@ var UnarchiveTaskSchema = WorkspaceIdSchema.extend({
2133
2185
 
2134
2186
  // src/schemas/workflows.ts
2135
2187
  var import_zod13 = require("zod");
2188
+ var WorkflowMemberRoleAccessInputSchema = import_zod13.z.object({
2189
+ memberRoleId: import_zod13.z.number(),
2190
+ accessMode: import_zod13.z.number()
2191
+ });
2136
2192
  var WorkflowFormDataSchema = import_zod13.z.object({
2137
2193
  name: import_zod13.z.string(),
2138
2194
  description: import_zod13.z.string().optional(),
2139
- agentId: import_zod13.z.number()
2195
+ prompt: import_zod13.z.string().optional(),
2196
+ ownerId: import_zod13.z.number().optional(),
2197
+ startTaskId: import_zod13.z.number().nullable().optional(),
2198
+ agentId: import_zod13.z.number().nullable().optional(),
2199
+ createMode: import_zod13.z.enum(["task", "taskless"]).optional(),
2200
+ defaultPhoneNumberId: import_zod13.z.number().nullable().optional(),
2201
+ defaultInboxId: import_zod13.z.number().nullable().optional(),
2202
+ defaultTaskName: import_zod13.z.string().optional(),
2203
+ defaultTaskDescription: import_zod13.z.string().optional(),
2204
+ defaultTaskPrompt: import_zod13.z.string().optional(),
2205
+ memberRoleAccess: import_zod13.z.array(WorkflowMemberRoleAccessInputSchema).optional()
2140
2206
  });
2141
2207
  var ListWorkflowsSchema = WorkspaceIdSchema;
2142
2208
  var GetWorkflowSchema = WorkspaceIdSchema.extend({
@@ -2372,6 +2438,8 @@ var GetProductSchema = import_zod14.z.object({
2372
2438
  OperatorChatParticipantSchema,
2373
2439
  OrganizationSchema,
2374
2440
  PhoneNumberFormDataSchema,
2441
+ RateLimitAllowlistEntrySchema,
2442
+ RateLimitOverrideSchema,
2375
2443
  RateMessageSchema,
2376
2444
  RemoveDataFieldSchema,
2377
2445
  RemoveWorkspaceMemberSchema,