@proteos/sdk 0.33.0 → 0.34.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.
@@ -176,6 +176,20 @@ export interface ReactionCapability {
176
176
  max_per_actor: number
177
177
  }
178
178
 
179
+ /** How far back a historical backfill ("sync all") reaches. */
180
+ export type ConnectionSyncRange = '30d' | '90d' | '365d' | 'all'
181
+
182
+ /**
183
+ * Lifecycle of a historical backfill, carried as settings.sync_status.
184
+ * Absent key = 'none' (never synced). 'in_progress' is claimed before the
185
+ * trigger request returns — poll get(id) until it flips to done/failed.
186
+ */
187
+ export type ConnectionSyncStatus = 'none' | 'in_progress' | 'done' | 'failed'
188
+
189
+ export interface SyncConnectionRequest {
190
+ range: ConnectionSyncRange
191
+ }
192
+
179
193
  export interface Connection {
180
194
  id: string
181
195
  org_id: string
@@ -187,6 +201,11 @@ export interface Connection {
187
201
  owner?: UserRef
188
202
  external_account_id: string
189
203
  credentials: ConnectionCredentials
204
+ /**
205
+ * Connector-shaped configuration + state. A historical backfill writes the
206
+ * sync_* keys here: sync_status (ConnectionSyncStatus), sync_range,
207
+ * sync_started_at, sync_completed_at, sync_synced_count, sync_error.
208
+ */
190
209
  settings: Record<string, unknown>
191
210
  status: ConnectionStatus
192
211
  /** Computed on read: the connector implements the reaction capability. */
package/src/index.ts CHANGED
@@ -198,6 +198,8 @@ export type {
198
198
  ConnectionScope,
199
199
  ConnectionService,
200
200
  ConnectionStatus,
201
+ ConnectionSyncRange,
202
+ ConnectionSyncStatus,
201
203
  ConnectorKey,
202
204
  ConnectorProvider,
203
205
  ConsentStatus,
@@ -272,6 +274,7 @@ export type {
272
274
  Room,
273
275
  SendMessageRequest,
274
276
  SendRecipient,
277
+ SyncConnectionRequest,
275
278
  TranscribeStreamOptions,
276
279
  TranscriptResult,
277
280
  UnreadCounts,
@@ -422,6 +425,8 @@ export type {
422
425
  // App types
423
426
  App,
424
427
  AppService,
428
+ // Array/enum attribute metas (config_schema renderers narrow on these)
429
+ ArrayAttributeMeta,
425
430
  Attribute,
426
431
  AttributeType,
427
432
  Column,
@@ -451,6 +456,8 @@ export type {
451
456
  Entity,
452
457
  EntityService,
453
458
  EntityWithSchema,
459
+ EnumAttributeMeta,
460
+ EnumValue,
454
461
  // File attribute meta
455
462
  FileAttributeMeta,
456
463
  FilterElement,
@@ -614,6 +621,7 @@ export type {
614
621
  ListWorkflowsOptions,
615
622
  ManualTriggerParams,
616
623
  MessageTriggerParams,
624
+ ModelCallParams,
617
625
  NodeDescriptor,
618
626
  NodeExecution,
619
627
  NodeGroup,
@@ -631,6 +639,7 @@ export type {
631
639
  PropertyOption,
632
640
  PropertyType,
633
641
  RunWorkflowRequest,
642
+ SystemSource,
634
643
  TestNodeCandidate,
635
644
  TestNodeInputSource,
636
645
  TestNodeRequest,
@@ -15,6 +15,7 @@ export const LayoutElementType = {
15
15
  Tabs: 'tabs',
16
16
  Field: 'field',
17
17
  RelatedList: 'related_list',
18
+ RelatedRecord: 'related_record',
18
19
  Component: 'component',
19
20
  Divider: 'divider',
20
21
  Text: 'text',
@@ -96,6 +97,31 @@ export type RelatedListElement = CommonProps & {
96
97
  follows_parent_edit_mode?: boolean
97
98
  }
98
99
 
100
+ /**
101
+ * Renders the FIRST record of `related_entity_slug` that references the
102
+ * current record through the `via_attribute` relation attribute — the
103
+ * singular counterpart of `related_list`, addressing the relation the same
104
+ * inbound way. The match is taken oldest-first so the choice is stable.
105
+ *
106
+ * `page_slug` optionally pins which record page supplies the layout; when
107
+ * omitted (or dangling) the renderer falls back to the related entity's
108
+ * default record page. The element renders that page bare — wrap it in a
109
+ * `section` element for a title or collapse affordance.
110
+ */
111
+ export type RelatedRecordElement = CommonProps & {
112
+ type: 'related_record'
113
+ related_entity_slug: string
114
+ via_attribute: string
115
+ page_slug?: string
116
+ /**
117
+ * When absent or true, the element enters edit mode together with the host
118
+ * page's edit mode. False keeps it independent — editable only through its
119
+ * own hover control. Either way the element saves the related record
120
+ * itself; the host page's Save never covers it.
121
+ */
122
+ follows_parent_edit_mode?: boolean
123
+ }
124
+
99
125
  export type ComponentElement = CommonProps & {
100
126
  type: 'component'
101
127
  component_slug: string
@@ -127,6 +153,7 @@ export type LayoutElement =
127
153
  | TabsElement
128
154
  | FieldElement
129
155
  | RelatedListElement
156
+ | RelatedRecordElement
130
157
  | ComponentElement
131
158
  | DividerElement
132
159
  | TextElement
@@ -196,6 +223,14 @@ export const LayoutElementSchema: z.ZodType<LayoutElement> = z.lazy(() =>
196
223
  list_slug: z.string().min(1).optional(),
197
224
  follows_parent_edit_mode: z.boolean().optional(),
198
225
  }),
226
+ z.object({
227
+ type: z.literal('related_record'),
228
+ ...commonPropsShape,
229
+ related_entity_slug: z.string().min(1),
230
+ via_attribute: z.string().min(1),
231
+ page_slug: z.string().min(1).optional(),
232
+ follows_parent_edit_mode: z.boolean().optional(),
233
+ }),
199
234
  z.object({
200
235
  type: z.literal('component'),
201
236
  ...commonPropsShape,
@@ -26,6 +26,7 @@ export {
26
26
  LayoutElementType,
27
27
  type LayoutTab,
28
28
  type RelatedListElement,
29
+ type RelatedRecordElement,
29
30
  type RowElement,
30
31
  type SectionElement,
31
32
  type TabsElement,
package/src/meta/types.ts CHANGED
@@ -782,6 +782,8 @@ export interface List extends AuditFields {
782
782
  name: string
783
783
  entity_slug: string
784
784
  columns: Column[]
785
+ /** Record page to open from this list; empty/absent = org default for the entity. */
786
+ default_page_slug?: string
785
787
  sorting: SortConfig[]
786
788
  filters: FilterGroup[]
787
789
  }
@@ -803,6 +805,7 @@ export const ListSchema = AuditFieldsSchema.extend({
803
805
  name: z.string(),
804
806
  entity_slug: z.string(),
805
807
  columns: z.array(ColumnSchema),
808
+ default_page_slug: z.string().optional(),
806
809
  sorting: z.array(SortConfigSchema),
807
810
  filters: z.array(FilterGroupSchema),
808
811
  })
@@ -826,6 +829,7 @@ export interface CreateListRequest {
826
829
  entity_slug: string
827
830
  name: string
828
831
  columns: Column[]
832
+ default_page_slug?: string
829
833
  sorting: SortConfig[]
830
834
  filters: FilterGroup[]
831
835
  }
@@ -837,6 +841,8 @@ export interface UpdateListRequest {
837
841
  name?: string
838
842
  module_slug?: string
839
843
  columns?: Column[]
844
+ /** Set to '' to clear back to the org default. */
845
+ default_page_slug?: string
840
846
  sorting?: SortConfig[]
841
847
  filters?: FilterGroup[]
842
848
  }
@@ -66,6 +66,7 @@ export type {
66
66
  ListWorkflowsOptions,
67
67
  ManualTriggerParams,
68
68
  MessageTriggerParams,
69
+ ModelCallParams,
69
70
  NodeDescriptor,
70
71
  NodeExecution,
71
72
  NodeGroup,
@@ -82,6 +83,7 @@ export type {
82
83
  PropertyOption,
83
84
  PropertyType,
84
85
  RunWorkflowRequest,
86
+ SystemSource,
85
87
  TestNodeCandidate,
86
88
  TestNodeInputSource,
87
89
  TestNodeRequest,
@@ -358,6 +358,22 @@ export interface MessageTriggerParams {
358
358
  event_types?: string[]
359
359
  }
360
360
 
361
+ /** Matches every event type on the subscribed topic. */
362
+ export const PLATFORM_EVENT_WILDCARD = '*'
363
+
364
+ /**
365
+ * Fires the workflow when an event whose type is in `event_types` arrives on
366
+ * the named platform bus topic. Unlike {@link EventTriggerParams} (records
367
+ * only), any per-org topic in the event catalog is a valid target.
368
+ *
369
+ * `event_types` may hold the single wildcard `'*'` to match every type — custom
370
+ * topics have no catalogued type list, so there is nothing to enumerate.
371
+ */
372
+ export interface PlatformEventTriggerParams {
373
+ topic: string
374
+ event_types: string[]
375
+ }
376
+
361
377
  export type KickoffType = 'message' | 'outcome'
362
378
 
363
379
  /**
@@ -393,6 +409,37 @@ export interface AgentActionParams {
393
409
  is_output_required?: boolean
394
410
  }
395
411
 
412
+ /**
413
+ * Where a model call's optional system instruction comes from. Empty/absent
414
+ * defaults to `none`.
415
+ */
416
+ export type SystemSource = 'none' | 'manual' | 'prompt'
417
+
418
+ /**
419
+ * Flat, descriptor-driven parameters of the `proteos-nodes-core.model-call`
420
+ * node: one stateless LLM call per input item. The prompt and the optional
421
+ * system instruction are independently sourced — typed inline (`manual`,
422
+ * Liquid-resolved per item) or resolved verbatim from a reusable Prompt by key
423
+ * (`prompt`). With `has_structured_output`, `output_schema` declares the
424
+ * reply's shape as platform attributes: generation is schema-constrained
425
+ * (forced tool) AND the node validates the returned JSON, failing the item
426
+ * after one automatic repair attempt.
427
+ */
428
+ export interface ModelCallParams {
429
+ /** Empty resolves to the platform default model. */
430
+ model_id?: string
431
+ temperature?: number
432
+ max_tokens?: number
433
+ prompt_source?: KickoffSource
434
+ prompt_text?: string
435
+ prompt_key?: string
436
+ system_source?: SystemSource
437
+ system_text?: string
438
+ system_prompt_key?: string
439
+ has_structured_output?: boolean
440
+ output_schema?: Attribute[]
441
+ }
442
+
396
443
  // ---------------------------------------------------------------------------
397
444
  // Workflow
398
445
  // ---------------------------------------------------------------------------
@@ -532,7 +579,15 @@ export type ExecutionStatus =
532
579
  | 'cancelled'
533
580
  | 'skipped'
534
581
 
535
- export type TriggerKind = 'schedule' | 'manual' | 'webhook' | 'event' | 'message' | 'workflow'
582
+ export type TriggerKind =
583
+ | 'schedule'
584
+ | 'manual'
585
+ | 'webhook'
586
+ | 'event'
587
+ | 'message'
588
+ | 'connector'
589
+ | 'platform_event'
590
+ | 'workflow'
536
591
 
537
592
  /**
538
593
  * Why and how an execution fired. Flat, kind-discriminated: `kind` selects