@gravity-rail/sdk 0.4.0 → 0.5.1

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.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  DataSensitivity,
9
9
  DataTypeRecordScope,
10
10
  IndexStatus
11
- } from "./chunk-RJ5TGOOB.js";
11
+ } from "./chunk-QS6ZRQUZ.js";
12
12
 
13
13
  // src/schemas/accounts.ts
14
14
  import { z } from "zod";
@@ -121,7 +121,8 @@ var OrganizationSchema = z.object({
121
121
  });
122
122
  var AdminOrganizationSchema = OrganizationSchema.extend({
123
123
  accountCount: z.number(),
124
- workspaceCount: z.number()
124
+ workspaceCount: z.number(),
125
+ enforceCreditLimit: z.boolean()
125
126
  });
126
127
  var CreateOrganizationRequestSchema = z.object({
127
128
  name: z.string(),
@@ -148,7 +149,10 @@ var UpdateOrganizationRequestSchema = z.object({
148
149
  logoMimeType: z.string().optional(),
149
150
  // Twilio sub-account linkage. Explicit null clears the field so SMS
150
151
  // falls through to the master client (does not touch Twilio itself).
151
- twilioSubAccountSid: z.string().nullable().optional()
152
+ twilioSubAccountSid: z.string().nullable().optional(),
153
+ // Hard credit enforcement toggle — flips between the legacy soft
154
+ // alert-only mode and the hard 402 stop at zero credits.
155
+ enforceCreditLimit: z.boolean().optional()
152
156
  });
153
157
  var AdminAccountMembershipSchema = z.object({
154
158
  workspaceUuid: z.string(),
@@ -569,7 +573,11 @@ var ChatFormDataSchema = z4.object({
569
573
  paused: z4.boolean().optional(),
570
574
  muted: z4.boolean().optional(),
571
575
  needsResponse: z4.boolean().optional(),
572
- workflowVersionNumber: z4.number().nullable().optional()
576
+ workflowVersionNumber: z4.number().nullable().optional(),
577
+ // Human-typed initial SMS/email body. Optional, request-body only.
578
+ // Backend dispatches via the existing initial-message path when the
579
+ // Agent is disabled. Treat as PHI client-side.
580
+ initialMessage: z4.string().nullable().optional()
573
581
  });
574
582
  var ChatFiltersSchema = z4.object({
575
583
  page: z4.number().optional(),
@@ -639,8 +647,16 @@ var CreateChatForWorkflowSchema = WorkspaceIdSchema.extend({
639
647
  var CreateChatCompletionSchema = WorkspaceIdSchema.extend({
640
648
  chatId: z4.number().describe("Chat ID"),
641
649
  model: z4.string().optional().describe("AI model to use"),
650
+ // ``id`` on each message is optional but, when provided for the latest
651
+ // user message, the backend uses it as the per-turn discriminator for
652
+ // the Temporal inference workflow. MCP/tool callers that validate
653
+ // through this schema would otherwise have ``id`` stripped and lose
654
+ // the same-message-retry idempotency the per-turn workflow IDs rely
655
+ // on (see lib/services/inference_keys.py and
656
+ // ChatCompletionMessageSchema below).
642
657
  messages: z4.array(
643
658
  z4.object({
659
+ id: z4.string().optional(),
644
660
  role: z4.string(),
645
661
  content: z4.string()
646
662
  })
@@ -744,9 +760,21 @@ var ChatMessageAPIResponseSchema = z4.object({
744
760
  error_details: z4.any().optional(),
745
761
  createdAt: z4.string(),
746
762
  email_id: z4.number().optional(),
747
- inbox_id: z4.number().optional()
763
+ inbox_id: z4.number().optional(),
764
+ // Task this message was produced under. Null for messages that predate the
765
+ // workflow-task tracking or that originated outside a task (e.g. manager
766
+ // chats). Surfaced in chat transcripts to help reviewers trace messages
767
+ // back to the workflow task that produced them.
768
+ taskId: z4.number().nullable().optional(),
769
+ // SMS delivery fields — only present on messages sent via Twilio SMS.
770
+ smsDeliveryStatus: z4.string().nullable().optional(),
771
+ smsDeliveryErrorCode: z4.string().nullable().optional(),
772
+ smsDeliveryUpdatedAt: z4.string().nullable().optional(),
773
+ // Friendly failure reason — only set when smsDeliveryStatus is failed/undelivered.
774
+ smsDeliveryFailureReason: z4.string().nullable().optional()
748
775
  });
749
776
  var ChatCompletionMessageSchema = z4.object({
777
+ id: z4.string().optional(),
750
778
  role: z4.enum(["user", "assistant", "system"]),
751
779
  content: z4.string()
752
780
  });
@@ -1167,11 +1195,23 @@ var InboxRuleSchema = z6.object({
1167
1195
  operator: z6.enum(["contains", "equals", "ends_with", "regex", "ip_in_range"]),
1168
1196
  value: z6.string()
1169
1197
  });
1198
+ var RateLimitOverrideSchema = z6.object({
1199
+ enabled: z6.boolean().nullish(),
1200
+ per_minute: z6.number().int().nullish(),
1201
+ per_hour: z6.number().int().nullish()
1202
+ });
1203
+ var RateLimitAllowlistEntrySchema = z6.object({
1204
+ sender: z6.string(),
1205
+ reason: z6.string().nullish()
1206
+ });
1170
1207
  var InboxRulesConfigSchema = z6.object({
1171
1208
  allowMode: z6.enum(["all", "none", "rules"]).optional(),
1172
1209
  denyMode: z6.enum(["all", "none", "rules"]).optional(),
1173
1210
  allowRules: z6.array(InboxRuleSchema).optional(),
1174
- denyRules: z6.array(InboxRuleSchema).optional()
1211
+ denyRules: z6.array(InboxRuleSchema).optional(),
1212
+ rateLimitEnabled: z6.boolean().nullish(),
1213
+ rateLimitOverride: RateLimitOverrideSchema.nullish(),
1214
+ rateLimitAllowlist: z6.array(RateLimitAllowlistEntrySchema).nullish()
1175
1215
  });
1176
1216
  var InboxFormDataSchema = z6.object({
1177
1217
  name: z6.string(),
@@ -1180,7 +1220,10 @@ var InboxFormDataSchema = z6.object({
1180
1220
  defaultWorkflowId: z6.number().optional(),
1181
1221
  assistantEnabled: z6.boolean().optional(),
1182
1222
  autoReplyEnabled: z6.boolean().optional(),
1183
- recipient: z6.string().optional()
1223
+ recipient: z6.string().optional(),
1224
+ // Optional OrgDomain UUID for inboxes hosted on a verified org-tier custom
1225
+ // domain. Backend validates ownership and email-config status.
1226
+ orgDomainUuid: z6.string().uuid().optional()
1184
1227
  });
1185
1228
  var InboxEmailFiltersSchema = z6.object({
1186
1229
  page: z6.number().optional(),
@@ -1430,6 +1473,8 @@ var MemberFilterObjectTypeEnum = z8.enum([
1430
1473
  "notifySms",
1431
1474
  "notifyEmail",
1432
1475
  "notifyVoice",
1476
+ "smsDeliveryStatus",
1477
+ "callForwarded",
1433
1478
  "calendarEvent",
1434
1479
  "chatEngagement",
1435
1480
  "lastMessageActivity",
@@ -1470,7 +1515,9 @@ var MemberFilterFilterTypeEnum = z8.enum([
1470
1515
  "lessThanDaysAgo",
1471
1516
  "daysUntil",
1472
1517
  "hasKey",
1473
- "hasKeyValue"
1518
+ "hasKeyValue",
1519
+ "smsDeliveryStatusNeedsAttention",
1520
+ "callForwardedAny"
1474
1521
  ]);
1475
1522
  var MemberFilterRuleSchema = z8.object({
1476
1523
  id: z8.number(),
@@ -1781,10 +1828,24 @@ var UnarchiveTaskSchema = WorkspaceIdSchema.extend({
1781
1828
 
1782
1829
  // src/schemas/workflows.ts
1783
1830
  import { z as z13 } from "zod";
1831
+ var WorkflowMemberRoleAccessInputSchema = z13.object({
1832
+ memberRoleId: z13.number(),
1833
+ accessMode: z13.number()
1834
+ });
1784
1835
  var WorkflowFormDataSchema = z13.object({
1785
1836
  name: z13.string(),
1786
1837
  description: z13.string().optional(),
1787
- agentId: z13.number()
1838
+ prompt: z13.string().optional(),
1839
+ ownerId: z13.number().optional(),
1840
+ startTaskId: z13.number().nullable().optional(),
1841
+ agentId: z13.number().nullable().optional(),
1842
+ createMode: z13.enum(["task", "taskless"]).optional(),
1843
+ defaultPhoneNumberId: z13.number().nullable().optional(),
1844
+ defaultInboxId: z13.number().nullable().optional(),
1845
+ defaultTaskName: z13.string().optional(),
1846
+ defaultTaskDescription: z13.string().optional(),
1847
+ defaultTaskPrompt: z13.string().optional(),
1848
+ memberRoleAccess: z13.array(WorkflowMemberRoleAccessInputSchema).optional()
1788
1849
  });
1789
1850
  var ListWorkflowsSchema = WorkspaceIdSchema;
1790
1851
  var GetWorkflowSchema = WorkspaceIdSchema.extend({
@@ -2019,6 +2080,8 @@ export {
2019
2080
  OperatorChatParticipantSchema,
2020
2081
  OrganizationSchema,
2021
2082
  PhoneNumberFormDataSchema,
2083
+ RateLimitAllowlistEntrySchema,
2084
+ RateLimitOverrideSchema,
2022
2085
  RateMessageSchema,
2023
2086
  RemoveDataFieldSchema,
2024
2087
  RemoveWorkspaceMemberSchema,