twenty-sdk 2.55.0 → 2.57.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.
@@ -18,34 +18,6 @@ type AgentJsonResponseFormat = {
18
18
  };
19
19
  type AgentResponseFormat = AgentTextResponseFormat | AgentJsonResponseFormat;
20
20
 
21
- declare enum FieldMetadataType {
22
- ACTOR = "ACTOR",
23
- ADDRESS = "ADDRESS",
24
- ARRAY = "ARRAY",
25
- BOOLEAN = "BOOLEAN",
26
- CURRENCY = "CURRENCY",
27
- DATE = "DATE",
28
- DATE_TIME = "DATE_TIME",
29
- EMAILS = "EMAILS",
30
- FILES = "FILES",
31
- FULL_NAME = "FULL_NAME",
32
- LINKS = "LINKS",
33
- MORPH_RELATION = "MORPH_RELATION",
34
- MULTI_SELECT = "MULTI_SELECT",
35
- NUMBER = "NUMBER",
36
- NUMERIC = "NUMERIC",
37
- PHONES = "PHONES",
38
- POSITION = "POSITION",
39
- RATING = "RATING",
40
- RAW_JSON = "RAW_JSON",
41
- RELATION = "RELATION",
42
- RICH_TEXT = "RICH_TEXT",
43
- SELECT = "SELECT",
44
- TEXT = "TEXT",
45
- TS_VECTOR = "TS_VECTOR",
46
- UUID = "UUID"
47
- }
48
-
49
21
  type _JSONSchema = boolean | JSONSchema;
50
22
  type SchemaType = "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
51
23
  type JSONSchema = {
@@ -2084,6 +2056,11 @@ interface ZodString extends _ZodString<$ZodStringInternals<string>> {
2084
2056
  duration(params?: string | $ZodCheckISODurationParams): this;
2085
2057
  }
2086
2058
  declare const ZodString: $constructor<ZodString>;
2059
+ interface _ZodBoolean<T extends $ZodBooleanInternals = $ZodBooleanInternals> extends _ZodType<T> {
2060
+ }
2061
+ interface ZodBoolean extends _ZodBoolean<$ZodBooleanInternals<boolean>> {
2062
+ }
2063
+ declare const ZodBoolean: $constructor<ZodBoolean>;
2087
2064
  interface ZodAny extends _ZodType<$ZodAnyInternals> {
2088
2065
  }
2089
2066
  declare const ZodAny: $constructor<ZodAny>;
@@ -2231,6 +2208,34 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2231
2208
  }
2232
2209
  declare const ZodReadonly: $constructor<ZodReadonly>;
2233
2210
 
2211
+ declare enum FieldMetadataType {
2212
+ ACTOR = "ACTOR",
2213
+ ADDRESS = "ADDRESS",
2214
+ ARRAY = "ARRAY",
2215
+ BOOLEAN = "BOOLEAN",
2216
+ CURRENCY = "CURRENCY",
2217
+ DATE = "DATE",
2218
+ DATE_TIME = "DATE_TIME",
2219
+ EMAILS = "EMAILS",
2220
+ FILES = "FILES",
2221
+ FULL_NAME = "FULL_NAME",
2222
+ LINKS = "LINKS",
2223
+ MORPH_RELATION = "MORPH_RELATION",
2224
+ MULTI_SELECT = "MULTI_SELECT",
2225
+ NUMBER = "NUMBER",
2226
+ NUMERIC = "NUMERIC",
2227
+ PHONES = "PHONES",
2228
+ POSITION = "POSITION",
2229
+ RATING = "RATING",
2230
+ RAW_JSON = "RAW_JSON",
2231
+ RELATION = "RELATION",
2232
+ RICH_TEXT = "RICH_TEXT",
2233
+ SELECT = "SELECT",
2234
+ TEXT = "TEXT",
2235
+ TS_VECTOR = "TS_VECTOR",
2236
+ UUID = "UUID"
2237
+ }
2238
+
2234
2239
  declare enum HTTPMethod {
2235
2240
  GET = "GET",
2236
2241
  POST = "POST",
@@ -2385,6 +2390,11 @@ type HttpRouteTriggerSettings = {
2385
2390
  forwardedRequestHeaders?: string[];
2386
2391
  };
2387
2392
 
2393
+ type AiRunUsage = {
2394
+ inputTokens: number;
2395
+ outputTokens: number;
2396
+ };
2397
+
2388
2398
  type AppConnectionBase = {
2389
2399
  id: string;
2390
2400
  providerName: string;
@@ -2482,11 +2492,17 @@ type EnqueueJobsInput = EnqueueJobOptions & {
2482
2492
  payloads?: Record<string, unknown>[];
2483
2493
  jobs?: EnqueueJobItem[];
2484
2494
  };
2495
+ type EnqueuedJob = {
2496
+ jobId: string;
2497
+ sizeBytes: number;
2498
+ };
2485
2499
  type EnqueueJobsResult = {
2486
2500
  enqueued: boolean;
2487
2501
  logicFunctionUniversalIdentifier: string;
2488
2502
  enqueuedJobsCount: number;
2489
2503
  jobIds: string[];
2504
+ jobs: EnqueuedJob[];
2505
+ availableBytes?: number | null;
2490
2506
  };
2491
2507
  type JobStatusState = 'COMPLETED' | 'FAILED' | 'ACTIVE' | 'WAITING' | 'DELAYED' | 'PRIORITIZED' | 'WAITING_CHILDREN';
2492
2508
  type JobStatusResult = {
@@ -2499,6 +2515,15 @@ type JobStatusResult = {
2499
2515
  finishedAt?: number | null;
2500
2516
  };
2501
2517
 
2518
+ type GenerateResult = {
2519
+ success: boolean;
2520
+ text: string | null;
2521
+ object: Record<string, unknown> | null;
2522
+ error: string | null;
2523
+ runId: string;
2524
+ usage: AiRunUsage;
2525
+ };
2526
+
2502
2527
  type IdentifyAccountPayload = {
2503
2528
  connectionProviderId: string;
2504
2529
  connectionProviderName: string;
@@ -2568,6 +2593,7 @@ type RunAgentInput = {
2568
2593
  });
2569
2594
  type RunAgentResult = {
2570
2595
  threadId: string;
2596
+ runId: string;
2571
2597
  status: 'COMPLETED' | 'SUSPENDED' | 'FAILED' | 'RUNNING';
2572
2598
  result: object | null;
2573
2599
  error: string | null;
@@ -2870,6 +2896,10 @@ type IngestMessageParticipant = {
2870
2896
  personId?: string;
2871
2897
  workspaceMemberId?: string;
2872
2898
  };
2899
+ type IngestMessageAttachment = {
2900
+ fileId: string;
2901
+ label: string;
2902
+ };
2873
2903
  type IngestMessage = {
2874
2904
  externalId: string;
2875
2905
  threadExternalId: string;
@@ -2878,11 +2908,13 @@ type IngestMessage = {
2878
2908
  receivedAt: Date;
2879
2909
  participants: IngestMessageParticipant[];
2880
2910
  folderExternalIds?: string[];
2911
+ attachments?: IngestMessageAttachment[];
2881
2912
  };
2882
2913
  type IngestedMessage = {
2883
2914
  externalId: string;
2884
2915
  messageId: string;
2885
2916
  messageThreadId: string;
2917
+ hasAttachments: boolean;
2886
2918
  };
2887
2919
 
2888
2920
  declare const ingestMessages: ({ messageChannelId, messages, }: {
@@ -2890,6 +2922,12 @@ declare const ingestMessages: ({ messageChannelId, messages, }: {
2890
2922
  messages: IngestMessage[];
2891
2923
  }) => Promise<IngestedMessage[]>;
2892
2924
 
2925
+ declare const uploadMessageAttachment: ({ filename, content, signal, }: {
2926
+ filename: string;
2927
+ content: Uint8Array;
2928
+ signal?: AbortSignal;
2929
+ }) => Promise<IngestMessageAttachment>;
2930
+
2893
2931
  type ListMessageFoldersFilter = {
2894
2932
  messageChannelId?: string;
2895
2933
  };
@@ -2907,6 +2945,135 @@ declare const syncMessageFolders: (input: SyncMessageFoldersInput) => Promise<Ap
2907
2945
 
2908
2946
  declare const runAgent: ({ input, ...rest }: RunAgentInput) => Promise<RunAgentResult>;
2909
2947
 
2948
+ type AgentConversationInput = {
2949
+ agentUniversalIdentifier: string;
2950
+ threadKey: string;
2951
+ };
2952
+ type AgentConversationMessage = {
2953
+ id: string;
2954
+ role: 'system' | 'user' | 'assistant';
2955
+ parts: ({
2956
+ type: string;
2957
+ } & Record<string, unknown>)[];
2958
+ metadata?: {
2959
+ createdAt?: string;
2960
+ startedAt?: string;
2961
+ finishedAt?: string;
2962
+ senderWorkspaceMemberId?: string | null;
2963
+ turnId?: string | null;
2964
+ };
2965
+ };
2966
+ type AgentConversationHistory = {
2967
+ messages: AgentConversationMessage[];
2968
+ streamCatchup: {
2969
+ chunks: Record<string, unknown>[];
2970
+ maxSeq: number;
2971
+ error: {
2972
+ code: string;
2973
+ message: string;
2974
+ } | null;
2975
+ };
2976
+ };
2977
+
2978
+ declare const listConversationMessages: (conversation: AgentConversationInput) => Promise<AgentConversationHistory>;
2979
+
2980
+ type AgentMessageReactionSummary = {
2981
+ emoji: string;
2982
+ workspaceMemberIds: string[];
2983
+ agentIds: string[];
2984
+ hasAssistantReacted: boolean;
2985
+ };
2986
+
2987
+ type AgentChatSubscriptionEvent = {
2988
+ type: 'stream-chunk';
2989
+ chunk: Record<string, unknown>;
2990
+ seq?: number;
2991
+ } | {
2992
+ type: 'message-persisted';
2993
+ messageId: string;
2994
+ turnId?: string;
2995
+ } | {
2996
+ type: 'stream-ended';
2997
+ } | {
2998
+ type: 'run-finished';
2999
+ turnId: string;
3000
+ } | {
3001
+ type: 'message-added';
3002
+ messageId: string;
3003
+ } | {
3004
+ type: 'queue-updated';
3005
+ } | {
3006
+ type: 'tool-call-resolved';
3007
+ toolCallId: string;
3008
+ } | {
3009
+ type: 'message-reactions-updated';
3010
+ messageId: string;
3011
+ reactions: AgentMessageReactionSummary[];
3012
+ revision: number;
3013
+ } | {
3014
+ type: 'stream-error';
3015
+ code: string;
3016
+ message: string;
3017
+ } | {
3018
+ type: 'credits-exhausted';
3019
+ turnId?: string;
3020
+ } | {
3021
+ type: 'user-credits-exhausted';
3022
+ workspaceMemberId: string;
3023
+ isFallingBackToWorkspaceCredits: boolean;
3024
+ renewsAt: string;
3025
+ } | {
3026
+ type: 'keepalive';
3027
+ };
3028
+
3029
+ declare const aiRunScopeSchema: ZodObject<{
3030
+ canReadAllObjectRecords: ZodOptional<ZodBoolean>;
3031
+ canUpdateAllObjectRecords: ZodOptional<ZodBoolean>;
3032
+ canSoftDeleteAllObjectRecords: ZodOptional<ZodBoolean>;
3033
+ canDestroyAllObjectRecords: ZodOptional<ZodBoolean>;
3034
+ canUpdateAllSettings: ZodOptional<ZodBoolean>;
3035
+ canAccessAllTools: ZodOptional<ZodBoolean>;
3036
+ objectPermissions: ZodOptional<ZodArray<ZodObject<{
3037
+ objectUniversalIdentifier: ZodString;
3038
+ canReadObjectRecords: ZodOptional<ZodBoolean>;
3039
+ canUpdateObjectRecords: ZodOptional<ZodBoolean>;
3040
+ canSoftDeleteObjectRecords: ZodOptional<ZodBoolean>;
3041
+ canDestroyObjectRecords: ZodOptional<ZodBoolean>;
3042
+ }, $strict>>>;
3043
+ fieldPermissions: ZodOptional<ZodArray<ZodObject<{
3044
+ objectUniversalIdentifier: ZodString;
3045
+ fieldUniversalIdentifier: ZodString;
3046
+ canReadFieldValue: ZodOptional<ZodBoolean>;
3047
+ canUpdateFieldValue: ZodOptional<ZodBoolean>;
3048
+ }, $strict>>>;
3049
+ permissionFlagUniversalIdentifiers: ZodOptional<ZodArray<ZodString>>;
3050
+ }, $strict>;
3051
+
3052
+ type AiRunScope = output<typeof aiRunScopeSchema>;
3053
+
3054
+ declare const isAgentChatTurnEndEvent: (event: AgentChatSubscriptionEvent) => boolean;
3055
+
3056
+ type StreamConversationInput = AgentConversationInput & {
3057
+ signal?: AbortSignal;
3058
+ };
3059
+ declare const streamConversation: ({ signal, ...conversation }: StreamConversationInput) => AsyncGenerator<AgentChatSubscriptionEvent>;
3060
+
3061
+ type GenerateChunk = {
3062
+ type: string;
3063
+ } & Record<string, unknown>;
3064
+ type GenerateInput = {
3065
+ input: string | RunAgentMessage[];
3066
+ instructions?: string | null;
3067
+ modelId?: string | null;
3068
+ responseFormat?: AgentResponseFormat | null;
3069
+ scope?: AiRunScope | null;
3070
+ onChunk?: (chunk: GenerateChunk) => void | Promise<void>;
3071
+ signal?: AbortSignal;
3072
+ };
3073
+ declare const ai: {
3074
+ generate: ({ input, onChunk, signal, ...rest }: GenerateInput) => Promise<GenerateResult>;
3075
+ };
3076
+
2910
3077
  declare const sendInboxMessage: (input: SendInboxMessageInput) => Promise<SendInboxMessageResult>;
2911
3078
 
2912
3079
  declare const inboxMention: ({ workspaceMemberId, }: {
@@ -2976,5 +3143,5 @@ declare class Response implements LogicFunctionHttpResponse {
2976
3143
  constructor(body: unknown, init?: ResponseInit);
2977
3144
  }
2978
3145
 
2979
- export { AppConnectionAuthFailedError, INBOX_ASSISTANT_MENTION, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, RetryableLogicFunctionError, attachRecordToInboxThread, createMessageChannel, createTimelineActivity, deleteMessageChannel, detachRecordFromInboxThread, enqueueJob, enqueueJobs, findConnectionForRequest, getConnection, getJobs, inboxMention, inboxReferenceRecord, ingestMessages, jsonSchemaToInputSchema, kv, listConnections, listMessageChannels, listMessageFolders, reportConnectionAuthFailure, runAgent, sendInboxMessage, syncMessageFolders, updateMessageChannel };
2980
- export type { AppConnection, AppKeyValue, AppKeyValueScope, AppMessageChannel, AppMessageFolder, AuthorizeConnectionPayload, AuthorizeConnectionResult, ConnectionCallbackPayload, ConnectionCallbackResult, CreateMessageChannelInput, CreateTimelineActivityInput, CreatedTimelineActivity, CronPayload, DatabaseEventBatchPayload, DatabaseEventPayload, EnqueueJobInput, EnqueueJobItem, EnqueueJobOptions, EnqueueJobResult, EnqueueJobsInput, EnqueueJobsResult, IdentifyAccountPayload, IdentifyAccountResult, InboxThreadRecordInput, IngestMessage, IngestMessageParticipant, IngestedMessage, InputJsonSchema, InstallHandler, InstallPayload, JobStatusResult, JobStatusState, ListConnectionsFilter, ListMessageChannelsFilter, ListMessageFoldersFilter, LogicFunctionConfig, LogicFunctionExecutionContext, LogicFunctionHandler, ObjectRecordEvent, ResponseInit, LogicFunctionEvent as RoutePayload, RunAgentInput, RunAgentResult, SendAppMessagePayload, SendAppMessageRecipient, SendAppMessageResult, SendInboxMessageInput, SendInboxMessageResult, ServerRouteDispatchResult, ServerRouteResolverResult, SyncMessageFoldersInput, UninstallHandler, UninstallPayload, UpdateMessageChannelInput };
3146
+ export { AppConnectionAuthFailedError, INBOX_ASSISTANT_MENTION, ObjectRecordBaseEvent, ObjectRecordCreateEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordRestoreEvent, ObjectRecordUpdateEvent, ObjectRecordUpsertEvent, Response, RetryableLogicFunctionError, ai, attachRecordToInboxThread, createMessageChannel, createTimelineActivity, deleteMessageChannel, detachRecordFromInboxThread, enqueueJob, enqueueJobs, findConnectionForRequest, getConnection, getJobs, inboxMention, inboxReferenceRecord, ingestMessages, isAgentChatTurnEndEvent, jsonSchemaToInputSchema, kv, listConnections, listConversationMessages, listMessageChannels, listMessageFolders, reportConnectionAuthFailure, runAgent, sendInboxMessage, streamConversation, syncMessageFolders, updateMessageChannel, uploadMessageAttachment };
3147
+ export type { AgentChatSubscriptionEvent, AgentConversationHistory, AgentConversationInput, AgentConversationMessage, AiRunScope, AppConnection, AppKeyValue, AppKeyValueScope, AppMessageChannel, AppMessageFolder, AuthorizeConnectionPayload, AuthorizeConnectionResult, ConnectionCallbackPayload, ConnectionCallbackResult, CreateMessageChannelInput, CreateTimelineActivityInput, CreatedTimelineActivity, CronPayload, DatabaseEventBatchPayload, DatabaseEventPayload, EnqueueJobInput, EnqueueJobItem, EnqueueJobOptions, EnqueueJobResult, EnqueueJobsInput, EnqueueJobsResult, GenerateInput, GenerateResult, IdentifyAccountPayload, IdentifyAccountResult, InboxThreadRecordInput, IngestMessage, IngestMessageAttachment, IngestMessageParticipant, IngestedMessage, InputJsonSchema, InstallHandler, InstallPayload, JobStatusResult, JobStatusState, ListConnectionsFilter, ListMessageChannelsFilter, ListMessageFoldersFilter, LogicFunctionConfig, LogicFunctionExecutionContext, LogicFunctionHandler, ObjectRecordEvent, ResponseInit, LogicFunctionEvent as RoutePayload, RunAgentInput, RunAgentResult, SendAppMessagePayload, SendAppMessageRecipient, SendAppMessageResult, SendInboxMessageInput, SendInboxMessageResult, ServerRouteDispatchResult, ServerRouteResolverResult, StreamConversationInput, SyncMessageFoldersInput, UninstallHandler, UninstallPayload, UpdateMessageChannelInput };