skedyul 1.7.26 → 1.7.28

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.
@@ -31,11 +31,12 @@ export interface InstallConfig {
31
31
  export interface ProvisionConfig {
32
32
  /** Global environment variables (developer-level, shared across all installs) */
33
33
  env?: EnvSchema;
34
- /** INTERNAL model definitions (app-owned, not visible to users) */
34
+ /** INTERNAL model definitions for data shared across installs */
35
35
  models?: ModelDefinition[];
36
36
  /**
37
- * App entity contracts for install-time CRM maps (not shared models).
37
+ * App entity contracts for install-time CRM maps (not shared or internal models).
38
38
  * Workplaces map these to CRM; workflows apply maps via app-handle Liquid filters.
39
+ * Runtime `instance.*('<entity>')` resolves the mapped workplace model.
39
40
  */
40
41
  entities?: EntityDefinition[];
41
42
  /** Relationship definitions between INTERNAL models */
@@ -83,6 +83,11 @@ export interface BackendFieldDefinition {
83
83
  }>;
84
84
  limitChoices?: number;
85
85
  };
86
+ aiMeta?: {
87
+ description?: string;
88
+ mutability?: 'always' | 'restricted' | 'create_only' | 'immutable';
89
+ };
90
+ section?: string;
86
91
  }
87
92
  /**
88
93
  * Backend-compatible relationship definition.
@@ -159,7 +164,11 @@ export interface BackendDesiredSchema {
159
164
  navigation?: BackendNavigationDefinition;
160
165
  }
161
166
  /**
162
- * Transform a CRM schema to the backend's DesiredSchema format.
167
+ * Transform a CRM schema to a legacy backend DesiredSchema format.
168
+ *
169
+ * @deprecated The CLI API and UI upload accept public CRM v1 JSON directly
170
+ * (`list` / `unique` / `default` / `requirement` / `section` / `aiMeta`).
171
+ * Prefer sending the loaded schema without this transform.
163
172
  */
164
173
  export declare function transformToBackendSchema(schema: CRMSchema): BackendDesiredSchema;
165
174
  /**
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Sync direction for events:
3
+ * - 'inbound': Events from external system → platform (e.g. Google Calendar changes)
4
+ * - 'outbound': Events from platform CRM → external system (e.g. pushing CRM changes to Google)
5
+ */
6
+ export type EventDirection = 'inbound' | 'outbound';
1
7
  /**
2
8
  * App event definition for integration executable config.
3
9
  *
@@ -15,6 +21,13 @@ export interface AppEventDefinition {
15
21
  group?: string;
16
22
  /** Optional Lucide icon name for pickers */
17
23
  icon?: string;
24
+ /**
25
+ * Sync direction for this event type.
26
+ * - 'inbound': External system → platform (e.g. webhook events from Google)
27
+ * - 'outbound': Platform CRM → external (e.g. CRM instance.updated triggers)
28
+ * Defaults to 'inbound' for app.* events when not specified.
29
+ */
30
+ direction?: EventDirection;
18
31
  /**
19
32
  * Example flat domain payload for liquid context reference (e.g. external_id, phone, …).
20
33
  * Not the full emit payload — studio/branch metadata is added at emit time.
@@ -2,8 +2,10 @@
2
2
  * App entity definition types.
3
3
  *
4
4
  * Entities describe external/logical payload shapes that workplaces map to CRM
5
- * via install-time CRM maps. They are NOT shared models — the app does not own
6
- * CRM writes; workflows/agents apply maps.
5
+ * via install-time CRM maps. They are NOT shared models and they are NOT
6
+ * internal models (internal models are for data shared across installs).
7
+ * Workflows apply maps with an app-handle Liquid filter. Runtime
8
+ * `instance.list/create/update('<entity>')` also resolves the mapped workplace model.
7
9
  */
8
10
  import type { BaseDefinition, FieldOption } from './base';
9
11
  /**
@@ -51,6 +53,13 @@ export interface EntityFieldDefinition {
51
53
  matchCandidate?: boolean;
52
54
  /** Whether this field should be mapped for a complete configuration */
53
55
  required?: boolean;
56
+ /**
57
+ * Optional global FieldDefinition handle to attach when CRM apply creates
58
+ * or retargets the mapped workplace field (e.g. `calendar/recurrence`,
59
+ * `calendar/series_id`, `phone`). Core looks this up by handle; do not
60
+ * mint a private definition.
61
+ */
62
+ definition?: string;
54
63
  /** Enum options when the source value is constrained */
55
64
  options?: FieldOption[] | string[];
56
65
  }
@@ -27,8 +27,9 @@ export type FieldType = 'string' | 'long_string' | 'number' | 'boolean' | 'date'
27
27
  * - 'none': No action (orphan the reference)
28
28
  * - 'cascade': Delete related records
29
29
  * - 'restrict': Prevent deletion if references exist
30
+ * - 'set_null': Clear the relation field on related records
30
31
  */
31
- export type OnDelete = 'none' | 'cascade' | 'restrict';
32
+ export type OnDelete = 'none' | 'cascade' | 'restrict' | 'set_null';
32
33
  /**
33
34
  * Field requirement types.
34
35
  * - 'optional': Field is never required
@@ -180,23 +181,22 @@ export interface RelationshipLink {
180
181
  label: string;
181
182
  }
182
183
  /**
183
- * Relationship cardinality from source (one) to target (many or one).
184
+ * Relationship cardinality from source to target.
184
185
  * - 'one_to_one': One source record relates to one target record
185
186
  * - 'one_to_many': One source record relates to many target records
186
- *
187
- * Note: For many-to-one relationships, swap source and target and use 'one_to_many'.
187
+ * - 'many_to_one': Many source records relate to one target record
188
+ * - 'many_to_many': Many source records relate to many target records
188
189
  */
189
- export type Cardinality = 'one_to_one' | 'one_to_many';
190
+ export type Cardinality = 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
190
191
  /**
191
192
  * Relationship definition between two models.
192
- * Source is always the "one" side, target is the "many" side (for one_to_many).
193
193
  */
194
194
  export interface RelationshipDefinition {
195
- /** Source side of the relationship (the "one" side) */
195
+ /** Source side of the relationship */
196
196
  source: RelationshipLink;
197
- /** Target side of the relationship (the "many" side for one_to_many) */
197
+ /** Target side of the relationship */
198
198
  target: RelationshipLink;
199
- /** Cardinality: 'one_to_one' or 'one_to_many' */
199
+ /** Cardinality from the source side */
200
200
  cardinality: Cardinality;
201
201
  /** Behavior when a related record is deleted */
202
202
  onDelete?: OnDelete;
@@ -109,6 +109,12 @@ export interface ReceiveMessageInput {
109
109
  contact?: ReceiveMessageContact;
110
110
  /** Optional remote/external message ID (provider message id) */
111
111
  remoteId?: string;
112
+ /**
113
+ * How many files will be linked via attachFilesToMessage after this call.
114
+ * When set, the platform holds thread.message.received until that many
115
+ * attachments land (or a timeout), so consumers see the files.
116
+ */
117
+ expectedAttachmentCount?: number;
112
118
  }
113
119
  /**
114
120
  * Parameters for creating a communication channel.
@@ -208,7 +214,9 @@ export declare const communicationChannel: {
208
214
  * - Before: attachments are stashed on MessageInbox and linked when the message is created
209
215
  * - After: rows are created immediately and `thread.attachment.received` is emitted
210
216
  *
211
- * Typical flow for email/MMS: `receiveMessage` → `file.upload` → `attachFilesToMessage`.
217
+ * Typical flow for email/MMS: `receiveMessage({ expectedAttachmentCount })` →
218
+ * `file.upload` → `attachFilesToMessage`. Pass `expectedAttachmentCount` so
219
+ * `thread.message.received` waits for the files.
212
220
  *
213
221
  * @example
214
222
  * ```ts
@@ -545,8 +553,9 @@ export declare const file: {
545
553
  /**
546
554
  * Upload file content and create a File record.
547
555
  *
548
- * Files are scoped to the app installation and stored privately.
556
+ * Files are stored privately under workplaces/{subdomain}/files/{timestamp}-{name}.
549
557
  * Use file.getUrl() to generate a temporary download URL when needed.
558
+ * The optional `path` argument is accepted for compatibility but ignored for the S3 key.
550
559
  *
551
560
  * @example
552
561
  * ```ts
@@ -557,14 +566,6 @@ export declare const file: {
557
566
  * name: 'document.pdf',
558
567
  * mimeType: 'application/pdf',
559
568
  * })
560
- *
561
- * // Upload with a path prefix for organization
562
- * const { id } = await file.upload({
563
- * content: imageBuffer,
564
- * name: 'photo.jpg',
565
- * mimeType: 'image/jpeg',
566
- * path: 'attachments',
567
- * })
568
569
  * ```
569
570
  */
570
571
  upload(params: FileUploadParams): Promise<FileUploadResult>;
@@ -364,6 +364,10 @@ var CRMFieldAppearanceSchemaZ = z3.object({
364
364
  placeholder: z3.string().optional(),
365
365
  helpText: z3.string().optional()
366
366
  });
367
+ var CRMFieldAiMetaSchemaZ = z3.object({
368
+ description: z3.string().optional(),
369
+ mutability: z3.enum(["always", "restricted", "create_only", "immutable"]).optional()
370
+ });
367
371
  var CRMFieldSchemaZ = z3.object({
368
372
  handle: z3.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
369
373
  label: z3.string().min(1, "Label is required"),
@@ -377,6 +381,8 @@ var CRMFieldSchemaZ = z3.object({
377
381
  list: z3.boolean().optional(),
378
382
  default: z3.unknown().optional(),
379
383
  definition: CRMFieldDefinitionSchema.optional(),
384
+ /** AI metadata - description and mutability hints for agents */
385
+ aiMeta: CRMFieldAiMetaSchemaZ.optional(),
380
386
  /**
381
387
  * Workplace-scoped field section handle (visualization helper).
382
388
  * Find-or-create on apply; display name is derived from the handle on create.
@@ -392,8 +398,18 @@ var CRMModelSchemaZ = z3.object({
392
398
  icon: z3.string().optional(),
393
399
  fields: z3.array(CRMFieldSchemaZ)
394
400
  });
395
- var CRMCardinalitySchema = z3.enum(["one_to_one", "one_to_many"]);
396
- var CRMOnDeleteSchema = z3.enum(["none", "cascade", "restrict"]);
401
+ var CRMCardinalitySchema = z3.enum([
402
+ "one_to_one",
403
+ "one_to_many",
404
+ "many_to_one",
405
+ "many_to_many"
406
+ ]);
407
+ var CRMOnDeleteSchema = z3.enum([
408
+ "none",
409
+ "cascade",
410
+ "restrict",
411
+ "set_null"
412
+ ]);
397
413
  var CRMRelationshipLinkSchema = z3.object({
398
414
  model: z3.string(),
399
415
  field: z3.string(),
@@ -1327,6 +1343,8 @@ var EntityFieldDefinitionSchema = z8.object({
1327
1343
  /** @deprecated Prefer isUnique */
1328
1344
  matchCandidate: z8.boolean().optional(),
1329
1345
  required: z8.boolean().optional(),
1346
+ /** Global FieldDefinition handle (e.g. calendar/recurrence, calendar/series_id) */
1347
+ definition: z8.string().optional(),
1330
1348
  options: z8.array(
1331
1349
  z8.union([
1332
1350
  z8.string(),
@@ -1360,9 +1378,16 @@ var EntityDefinitionSchema = z8.object({
1360
1378
  });
1361
1379
  var RelationshipCardinalitySchema = z8.enum([
1362
1380
  "ONE_TO_ONE",
1363
- "ONE_TO_MANY"
1381
+ "ONE_TO_MANY",
1382
+ "MANY_TO_ONE",
1383
+ "MANY_TO_MANY"
1384
+ ]);
1385
+ var OnDeleteBehaviorSchema = z8.enum([
1386
+ "NONE",
1387
+ "CASCADE",
1388
+ "RESTRICT",
1389
+ "SET_NULL"
1364
1390
  ]);
1365
- var OnDeleteBehaviorSchema = z8.enum(["NONE", "CASCADE", "RESTRICT"]);
1366
1391
  var RelationshipLinkSchema = z8.object({
1367
1392
  model: z8.string(),
1368
1393
  field: z8.string(),
@@ -1968,9 +1993,9 @@ var BatchOperationDefinitionSchema = z8.object({
1968
1993
  });
1969
1994
  var ProvisionConfigSchema = z8.object({
1970
1995
  env: EnvSchemaSchema.optional(),
1971
- /** INTERNAL model definitions (app-owned, not visible to users) */
1996
+ /** INTERNAL model definitions for data shared across installs */
1972
1997
  models: z8.array(ModelDefinitionSchema).optional(),
1973
- /** App entity contracts for install-time CRM maps (not shared models) */
1998
+ /** App entity contracts for install-time CRM maps (not shared or internal models) */
1974
1999
  entities: z8.array(EntityDefinitionSchema).optional(),
1975
2000
  /** Relationship definitions between INTERNAL models */
1976
2001
  relationships: z8.array(RelationshipDefinitionSchema).optional(),
@@ -2649,7 +2674,8 @@ var communicationChannel = {
2649
2674
  from: input.from,
2650
2675
  message: input.message,
2651
2676
  contact: input.contact,
2652
- ...input.remoteId ? { remoteId: input.remoteId } : {}
2677
+ ...input.remoteId ? { remoteId: input.remoteId } : {},
2678
+ ...input.expectedAttachmentCount != null ? { expectedAttachmentCount: input.expectedAttachmentCount } : {}
2653
2679
  });
2654
2680
  return data;
2655
2681
  },
@@ -2660,7 +2686,9 @@ var communicationChannel = {
2660
2686
  * - Before: attachments are stashed on MessageInbox and linked when the message is created
2661
2687
  * - After: rows are created immediately and `thread.attachment.received` is emitted
2662
2688
  *
2663
- * Typical flow for email/MMS: `receiveMessage` → `file.upload` → `attachFilesToMessage`.
2689
+ * Typical flow for email/MMS: `receiveMessage({ expectedAttachmentCount })` →
2690
+ * `file.upload` → `attachFilesToMessage`. Pass `expectedAttachmentCount` so
2691
+ * `thread.message.received` waits for the files.
2664
2692
  *
2665
2693
  * @example
2666
2694
  * ```ts
@@ -3246,8 +3274,9 @@ var file = {
3246
3274
  /**
3247
3275
  * Upload file content and create a File record.
3248
3276
  *
3249
- * Files are scoped to the app installation and stored privately.
3277
+ * Files are stored privately under workplaces/{subdomain}/files/{timestamp}-{name}.
3250
3278
  * Use file.getUrl() to generate a temporary download URL when needed.
3279
+ * The optional `path` argument is accepted for compatibility but ignored for the S3 key.
3251
3280
  *
3252
3281
  * @example
3253
3282
  * ```ts
@@ -3258,14 +3287,6 @@ var file = {
3258
3287
  * name: 'document.pdf',
3259
3288
  * mimeType: 'application/pdf',
3260
3289
  * })
3261
- *
3262
- * // Upload with a path prefix for organization
3263
- * const { id } = await file.upload({
3264
- * content: imageBuffer,
3265
- * name: 'photo.jpg',
3266
- * mimeType: 'image/jpeg',
3267
- * path: 'attachments',
3268
- * })
3269
3290
  * ```
3270
3291
  */
3271
3292
  async upload(params) {
@@ -8864,6 +8885,8 @@ export {
8864
8885
  CRMCardinalitySchema,
8865
8886
  CRMContextSchema2 as CRMContextSchema,
8866
8887
  CRMDataSchema,
8888
+ CRMFieldAiMetaSchemaZ,
8889
+ CRMFieldAppearanceSchemaZ,
8867
8890
  CRMFieldDefinitionSchema,
8868
8891
  CRMFieldOptionSchema,
8869
8892
  CRMFieldRequirementSchema,
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export { CRMContextSchema, SenderContextSchema, ThreadContextItemSchema, ThreadI
34
34
  export type { CRMContext, SenderContext, ThreadContextItem, ThreadInfo, SandboxConfig, Subscription, Association, Contact, AgentSenderContext, AgentThreadContext, AgentContext, ContextIssueSeverity, ContextIssueType, ContextIssue, ContextValidationResult, MockSenderContext, MockThreadContext, MockContext, } from './context';
35
35
  export { MemoryEntryTypeSchema, MemoryEntrySchema, WorkingMemoryConfigSchema, SemanticMemoryConfigSchema, ExternalMemoryConfigSchema, MemoryConfigSchema, MemoryScopeSchema, MemoryQueryOptionsSchema, ConversationSummarySchema, AgentObservationSchema, ExternalDataCacheSchema, MemoryService, InMemoryStore, createInMemoryService, } from './memory';
36
36
  export type { MemoryEntryType, MemoryEntry, WorkingMemoryConfig as MemoryWorkingConfig, SemanticMemoryConfig as MemorySemanticConfig, ExternalMemoryConfig as MemoryExternalConfig, MemoryConfig, MemoryScope, MemoryQueryOptions, ConversationSummary, AgentObservation, ExternalDataCache, MemoryStore, } from './memory';
37
- export type { CRMFieldType, CRMFieldRequirement, CRMFieldOption, CRMFieldDefinition, CRMFieldSchema, CRMModelSchema, CRMCardinality, CRMOnDelete, CRMRelationshipLink, CRMRelationshipSchema, CRMSchema, CRMSchemaValidationResult, } from './schemas';
37
+ export type { CRMFieldType, CRMFieldRequirement, CRMFieldOption, CRMFieldDefinition, CRMFieldAppearance, CRMFieldAiMeta, CRMFieldSchema, CRMModelSchema, CRMCardinality, CRMOnDelete, CRMRelationshipLink, CRMRelationshipSchema, CRMSchema, CRMSchemaValidationResult, } from './schemas';
38
38
  export type { SkedyulConfig, SerializableSkedyulConfig, InstallConfig, ProvisionConfig, BaseDefinition, Scope, FieldOwner, Visibility, ComputeLayer, StructuredFilter, FilterOperator, FilterCondition, FieldOption, EnvVariable, EnvSchema, InstallPhase, FieldType, Cardinality, OnDelete, InlineFieldDefinition, FieldVisibility, FieldDefinition, ModelDefinition, RelationshipLink, RelationshipDefinition, CapabilityType, ChannelCapability, ChannelBatchCapability, ChannelFieldPermissions, ChannelField, ChannelDefinition, WorkflowActionInput, WorkflowAction, WorkflowDefinition, AgentDefinition, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, ContextMode, ContextItemModel, ContextItemTool, ContextItem, ContextDefinition, FormStyleProps, ButtonVariant, ButtonSize, ButtonProps, RelationshipExtension, FormHeader, FormActionDefinition, ActionDefinition, ModalFormDefinition, InputComponent, TextareaComponent, SelectComponent, ComboboxComponent, CheckboxComponent, DatePickerComponent, TimePickerComponent, StatusIndicator, FieldSettingComponent, ImageSettingComponent, FileSettingComponent, ListItemTemplate, ListComponent, EmptyFormComponent, AlertComponent, FormComponent, FormLayoutColumn, FormLayoutRow, FormLayoutConfig, FormProps, CardHeader, CardBlock, ListBlock, BlockDefinition, SetupStepDefinition, SetupStepKind, BatchCascadePhase, BatchOperationDefinition, BatchOperationContext, BatchOperationIterateResult, BatchOperationSetupResult, PageType, PageDefinition, HttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, } from './config';
39
39
  export { compileAgent, compileWorkflow } from './compiler';
40
40
  export type { ValidationError, ValidationWarning, ResolvedPersona, ResolvedTool, EventConfig as CompilerEventConfig, IRMemoryConfig, PolicyConfig, IRRuntimeConfig, AgentIR, WorkflowStepIR, WorkflowIR, CompilationResult, } from './compiler';
@@ -48,3 +48,4 @@ export type { MessageBulkRecipient, MessageBulkSendInput, MessageBulkSendOutput,
48
48
  export type { QueueTouchPoint } from './types';
49
49
  export { toGsm7, estimateSmsSegments } from './tools/sms/gsm7';
50
50
  export type { SmsEncoding, SmsSegmentEstimate } from './tools/sms/gsm7';
51
+ export type { EventDirection } from './config/types/app-event';
package/dist/index.js CHANGED
@@ -51,6 +51,8 @@ __export(index_exports, {
51
51
  CRMCardinalitySchema: () => CRMCardinalitySchema,
52
52
  CRMContextSchema: () => CRMContextSchema2,
53
53
  CRMDataSchema: () => CRMDataSchema,
54
+ CRMFieldAiMetaSchemaZ: () => CRMFieldAiMetaSchemaZ,
55
+ CRMFieldAppearanceSchemaZ: () => CRMFieldAppearanceSchemaZ,
54
56
  CRMFieldDefinitionSchema: () => CRMFieldDefinitionSchema,
55
57
  CRMFieldOptionSchema: () => CRMFieldOptionSchema,
56
58
  CRMFieldRequirementSchema: () => CRMFieldRequirementSchema,
@@ -753,6 +755,10 @@ var CRMFieldAppearanceSchemaZ = import_v43.z.object({
753
755
  placeholder: import_v43.z.string().optional(),
754
756
  helpText: import_v43.z.string().optional()
755
757
  });
758
+ var CRMFieldAiMetaSchemaZ = import_v43.z.object({
759
+ description: import_v43.z.string().optional(),
760
+ mutability: import_v43.z.enum(["always", "restricted", "create_only", "immutable"]).optional()
761
+ });
756
762
  var CRMFieldSchemaZ = import_v43.z.object({
757
763
  handle: import_v43.z.string().regex(/^[a-z][a-z0-9_]*$/, "Handle must be lowercase alphanumeric with underscores, starting with a letter"),
758
764
  label: import_v43.z.string().min(1, "Label is required"),
@@ -766,6 +772,8 @@ var CRMFieldSchemaZ = import_v43.z.object({
766
772
  list: import_v43.z.boolean().optional(),
767
773
  default: import_v43.z.unknown().optional(),
768
774
  definition: CRMFieldDefinitionSchema.optional(),
775
+ /** AI metadata - description and mutability hints for agents */
776
+ aiMeta: CRMFieldAiMetaSchemaZ.optional(),
769
777
  /**
770
778
  * Workplace-scoped field section handle (visualization helper).
771
779
  * Find-or-create on apply; display name is derived from the handle on create.
@@ -781,8 +789,18 @@ var CRMModelSchemaZ = import_v43.z.object({
781
789
  icon: import_v43.z.string().optional(),
782
790
  fields: import_v43.z.array(CRMFieldSchemaZ)
783
791
  });
784
- var CRMCardinalitySchema = import_v43.z.enum(["one_to_one", "one_to_many"]);
785
- var CRMOnDeleteSchema = import_v43.z.enum(["none", "cascade", "restrict"]);
792
+ var CRMCardinalitySchema = import_v43.z.enum([
793
+ "one_to_one",
794
+ "one_to_many",
795
+ "many_to_one",
796
+ "many_to_many"
797
+ ]);
798
+ var CRMOnDeleteSchema = import_v43.z.enum([
799
+ "none",
800
+ "cascade",
801
+ "restrict",
802
+ "set_null"
803
+ ]);
786
804
  var CRMRelationshipLinkSchema = import_v43.z.object({
787
805
  model: import_v43.z.string(),
788
806
  field: import_v43.z.string(),
@@ -1716,6 +1734,8 @@ var EntityFieldDefinitionSchema = import_v48.z.object({
1716
1734
  /** @deprecated Prefer isUnique */
1717
1735
  matchCandidate: import_v48.z.boolean().optional(),
1718
1736
  required: import_v48.z.boolean().optional(),
1737
+ /** Global FieldDefinition handle (e.g. calendar/recurrence, calendar/series_id) */
1738
+ definition: import_v48.z.string().optional(),
1719
1739
  options: import_v48.z.array(
1720
1740
  import_v48.z.union([
1721
1741
  import_v48.z.string(),
@@ -1749,9 +1769,16 @@ var EntityDefinitionSchema = import_v48.z.object({
1749
1769
  });
1750
1770
  var RelationshipCardinalitySchema = import_v48.z.enum([
1751
1771
  "ONE_TO_ONE",
1752
- "ONE_TO_MANY"
1772
+ "ONE_TO_MANY",
1773
+ "MANY_TO_ONE",
1774
+ "MANY_TO_MANY"
1775
+ ]);
1776
+ var OnDeleteBehaviorSchema = import_v48.z.enum([
1777
+ "NONE",
1778
+ "CASCADE",
1779
+ "RESTRICT",
1780
+ "SET_NULL"
1753
1781
  ]);
1754
- var OnDeleteBehaviorSchema = import_v48.z.enum(["NONE", "CASCADE", "RESTRICT"]);
1755
1782
  var RelationshipLinkSchema = import_v48.z.object({
1756
1783
  model: import_v48.z.string(),
1757
1784
  field: import_v48.z.string(),
@@ -2357,9 +2384,9 @@ var BatchOperationDefinitionSchema = import_v48.z.object({
2357
2384
  });
2358
2385
  var ProvisionConfigSchema = import_v48.z.object({
2359
2386
  env: EnvSchemaSchema.optional(),
2360
- /** INTERNAL model definitions (app-owned, not visible to users) */
2387
+ /** INTERNAL model definitions for data shared across installs */
2361
2388
  models: import_v48.z.array(ModelDefinitionSchema).optional(),
2362
- /** App entity contracts for install-time CRM maps (not shared models) */
2389
+ /** App entity contracts for install-time CRM maps (not shared or internal models) */
2363
2390
  entities: import_v48.z.array(EntityDefinitionSchema).optional(),
2364
2391
  /** Relationship definitions between INTERNAL models */
2365
2392
  relationships: import_v48.z.array(RelationshipDefinitionSchema).optional(),
@@ -3038,7 +3065,8 @@ var communicationChannel = {
3038
3065
  from: input.from,
3039
3066
  message: input.message,
3040
3067
  contact: input.contact,
3041
- ...input.remoteId ? { remoteId: input.remoteId } : {}
3068
+ ...input.remoteId ? { remoteId: input.remoteId } : {},
3069
+ ...input.expectedAttachmentCount != null ? { expectedAttachmentCount: input.expectedAttachmentCount } : {}
3042
3070
  });
3043
3071
  return data;
3044
3072
  },
@@ -3049,7 +3077,9 @@ var communicationChannel = {
3049
3077
  * - Before: attachments are stashed on MessageInbox and linked when the message is created
3050
3078
  * - After: rows are created immediately and `thread.attachment.received` is emitted
3051
3079
  *
3052
- * Typical flow for email/MMS: `receiveMessage` → `file.upload` → `attachFilesToMessage`.
3080
+ * Typical flow for email/MMS: `receiveMessage({ expectedAttachmentCount })` →
3081
+ * `file.upload` → `attachFilesToMessage`. Pass `expectedAttachmentCount` so
3082
+ * `thread.message.received` waits for the files.
3053
3083
  *
3054
3084
  * @example
3055
3085
  * ```ts
@@ -3635,8 +3665,9 @@ var file = {
3635
3665
  /**
3636
3666
  * Upload file content and create a File record.
3637
3667
  *
3638
- * Files are scoped to the app installation and stored privately.
3668
+ * Files are stored privately under workplaces/{subdomain}/files/{timestamp}-{name}.
3639
3669
  * Use file.getUrl() to generate a temporary download URL when needed.
3670
+ * The optional `path` argument is accepted for compatibility but ignored for the S3 key.
3640
3671
  *
3641
3672
  * @example
3642
3673
  * ```ts
@@ -3647,14 +3678,6 @@ var file = {
3647
3678
  * name: 'document.pdf',
3648
3679
  * mimeType: 'application/pdf',
3649
3680
  * })
3650
- *
3651
- * // Upload with a path prefix for organization
3652
- * const { id } = await file.upload({
3653
- * content: imageBuffer,
3654
- * name: 'photo.jpg',
3655
- * mimeType: 'image/jpeg',
3656
- * path: 'attachments',
3657
- * })
3658
3681
  * ```
3659
3682
  */
3660
3683
  async upload(params) {
@@ -9254,6 +9277,8 @@ var index_default = { z: import_v414.z };
9254
9277
  CRMCardinalitySchema,
9255
9278
  CRMContextSchema,
9256
9279
  CRMDataSchema,
9280
+ CRMFieldAiMetaSchemaZ,
9281
+ CRMFieldAppearanceSchemaZ,
9257
9282
  CRMFieldDefinitionSchema,
9258
9283
  CRMFieldOptionSchema,
9259
9284
  CRMFieldRequirementSchema,
@@ -77,6 +77,19 @@ export declare const CRMFieldAppearanceSchemaZ: z.ZodObject<{
77
77
  helpText: z.ZodOptional<z.ZodString>;
78
78
  }, z.core.$strip>;
79
79
  export type CRMFieldAppearance = z.infer<typeof CRMFieldAppearanceSchemaZ>;
80
+ /**
81
+ * AI metadata for CRM fields (hints for agents / auto-fill).
82
+ */
83
+ export declare const CRMFieldAiMetaSchemaZ: z.ZodObject<{
84
+ description: z.ZodOptional<z.ZodString>;
85
+ mutability: z.ZodOptional<z.ZodEnum<{
86
+ always: "always";
87
+ restricted: "restricted";
88
+ create_only: "create_only";
89
+ immutable: "immutable";
90
+ }>>;
91
+ }, z.core.$strip>;
92
+ export type CRMFieldAiMeta = z.infer<typeof CRMFieldAiMetaSchemaZ>;
80
93
  /**
81
94
  * Field schema for CRM models.
82
95
  */
@@ -123,6 +136,15 @@ export declare const CRMFieldSchemaZ: z.ZodObject<{
123
136
  max: z.ZodOptional<z.ZodNumber>;
124
137
  pattern: z.ZodOptional<z.ZodString>;
125
138
  }, z.core.$strip>]>>;
139
+ aiMeta: z.ZodOptional<z.ZodObject<{
140
+ description: z.ZodOptional<z.ZodString>;
141
+ mutability: z.ZodOptional<z.ZodEnum<{
142
+ always: "always";
143
+ restricted: "restricted";
144
+ create_only: "create_only";
145
+ immutable: "immutable";
146
+ }>>;
147
+ }, z.core.$strip>>;
126
148
  section: z.ZodOptional<z.ZodString>;
127
149
  }, z.core.$strip>;
128
150
  export type CRMFieldSchema = z.infer<typeof CRMFieldSchemaZ>;
@@ -179,6 +201,15 @@ export declare const CRMModelSchemaZ: z.ZodObject<{
179
201
  max: z.ZodOptional<z.ZodNumber>;
180
202
  pattern: z.ZodOptional<z.ZodString>;
181
203
  }, z.core.$strip>]>>;
204
+ aiMeta: z.ZodOptional<z.ZodObject<{
205
+ description: z.ZodOptional<z.ZodString>;
206
+ mutability: z.ZodOptional<z.ZodEnum<{
207
+ always: "always";
208
+ restricted: "restricted";
209
+ create_only: "create_only";
210
+ immutable: "immutable";
211
+ }>>;
212
+ }, z.core.$strip>>;
182
213
  section: z.ZodOptional<z.ZodString>;
183
214
  }, z.core.$strip>>;
184
215
  }, z.core.$strip>;
@@ -189,6 +220,8 @@ export type CRMModelSchema = z.infer<typeof CRMModelSchemaZ>;
189
220
  export declare const CRMCardinalitySchema: z.ZodEnum<{
190
221
  one_to_one: "one_to_one";
191
222
  one_to_many: "one_to_many";
223
+ many_to_one: "many_to_one";
224
+ many_to_many: "many_to_many";
192
225
  }>;
193
226
  export type CRMCardinality = z.infer<typeof CRMCardinalitySchema>;
194
227
  /**
@@ -198,6 +231,7 @@ export declare const CRMOnDeleteSchema: z.ZodEnum<{
198
231
  none: "none";
199
232
  cascade: "cascade";
200
233
  restrict: "restrict";
234
+ set_null: "set_null";
201
235
  }>;
202
236
  export type CRMOnDelete = z.infer<typeof CRMOnDeleteSchema>;
203
237
  /**
@@ -226,11 +260,14 @@ export declare const CRMRelationshipSchemaZ: z.ZodObject<{
226
260
  cardinality: z.ZodEnum<{
227
261
  one_to_one: "one_to_one";
228
262
  one_to_many: "one_to_many";
263
+ many_to_one: "many_to_one";
264
+ many_to_many: "many_to_many";
229
265
  }>;
230
266
  onDelete: z.ZodOptional<z.ZodEnum<{
231
267
  none: "none";
232
268
  cascade: "cascade";
233
269
  restrict: "restrict";
270
+ set_null: "set_null";
234
271
  }>>;
235
272
  }, z.core.$strip>;
236
273
  export type CRMRelationshipSchema = z.infer<typeof CRMRelationshipSchemaZ>;
@@ -380,6 +417,15 @@ export declare const CRMSchemaZ: z.ZodObject<{
380
417
  max: z.ZodOptional<z.ZodNumber>;
381
418
  pattern: z.ZodOptional<z.ZodString>;
382
419
  }, z.core.$strip>]>>;
420
+ aiMeta: z.ZodOptional<z.ZodObject<{
421
+ description: z.ZodOptional<z.ZodString>;
422
+ mutability: z.ZodOptional<z.ZodEnum<{
423
+ always: "always";
424
+ restricted: "restricted";
425
+ create_only: "create_only";
426
+ immutable: "immutable";
427
+ }>>;
428
+ }, z.core.$strip>>;
383
429
  section: z.ZodOptional<z.ZodString>;
384
430
  }, z.core.$strip>>;
385
431
  }, z.core.$strip>>;
@@ -397,11 +443,14 @@ export declare const CRMSchemaZ: z.ZodObject<{
397
443
  cardinality: z.ZodEnum<{
398
444
  one_to_one: "one_to_one";
399
445
  one_to_many: "one_to_many";
446
+ many_to_one: "many_to_one";
447
+ many_to_many: "many_to_many";
400
448
  }>;
401
449
  onDelete: z.ZodOptional<z.ZodEnum<{
402
450
  none: "none";
403
451
  cascade: "cascade";
404
452
  restrict: "restrict";
453
+ set_null: "set_null";
405
454
  }>>;
406
455
  }, z.core.$strip>>>;
407
456
  pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1,2 +1,2 @@
1
- export { CRMFieldTypeSchema, CRMFieldRequirementSchema, CRMFieldOptionSchema, CRMFieldDefinitionSchema, CRMFieldSchemaZ, CRMModelSchemaZ, CRMCardinalitySchema, CRMOnDeleteSchema, CRMRelationshipLinkSchema, CRMRelationshipSchemaZ, CRMSchemaZ, type CRMFieldType, type CRMFieldRequirement, type CRMFieldOption, type CRMFieldDefinition, type CRMFieldSchema, type CRMModelSchema, type CRMCardinality, type CRMOnDelete, type CRMRelationshipLink, type CRMRelationshipSchema, type CRMSchema, type CRMSchemaValidationResult, defineSchema, validateCRMSchema, parseCRMSchema, safeParseCRMSchema, } from './crm-schema';
1
+ export { CRMFieldTypeSchema, CRMFieldRequirementSchema, CRMFieldOptionSchema, CRMFieldDefinitionSchema, CRMFieldAppearanceSchemaZ, CRMFieldAiMetaSchemaZ, CRMFieldSchemaZ, CRMModelSchemaZ, CRMCardinalitySchema, CRMOnDeleteSchema, CRMRelationshipLinkSchema, CRMRelationshipSchemaZ, CRMSchemaZ, type CRMFieldType, type CRMFieldRequirement, type CRMFieldOption, type CRMFieldDefinition, type CRMFieldAppearance, type CRMFieldAiMeta, type CRMFieldSchema, type CRMModelSchema, type CRMCardinality, type CRMOnDelete, type CRMRelationshipLink, type CRMRelationshipSchema, type CRMSchema, type CRMSchemaValidationResult, defineSchema, validateCRMSchema, parseCRMSchema, safeParseCRMSchema, } from './crm-schema';
2
2
  export { AGENT_SCHEMA_VERSION_V3, PersonaVoiceFormatV3Schema, PersonaVoiceV3Schema, PersonaV3Schema, ToolApprovalConfigSchema, ToolRefV3Schema, WorkingMemoryConfigSchema, ExternalMemoryConfigSchema, SemanticMemoryConfigSchema, MemoryConfigV3Schema, PoliciesConfigV3Schema, RuntimeConfigV3Schema, AgentYAMLV3Schema, TimeWindowTimeStampSchema, TimeWindowDayOfWeekSchema, TimeWindowSlotAgentSchema, ResponseModeSchema, TimeWindowBehaviorSchema, TimeWindowPolicySchema, TimeWindowPoliciesSchema, TimeWindowDefaultSchema, SchedulingDelaySchema, SchedulingPatternSchema, SchedulingBehaviorConfigSchema, type PersonaVoiceFormatV3, type PersonaVoiceV3, type PersonaV3, type ToolApprovalConfig, type ToolRefV3, type WorkingMemoryConfig, type ExternalMemoryConfig, type SemanticMemoryConfig, type MemoryConfigV3, type PoliciesConfigV3, type RuntimeConfigV3, type AgentYAMLV3, type TimeWindowTimeStamp, type TimeWindowDayOfWeek, type TimeWindowSlotAgent, type ResponseMode, type TimeWindowBehavior, type TimeWindowPolicy, type TimeWindowPolicies, type TimeWindowDefault, type SchedulingDelay, type SchedulingPattern, type SchedulingBehaviorConfig, defineAgentV3, validateAgentYAMLV3, } from './agent-schema-v3';