@applica-software-guru/persona-sdk 0.1.100 → 0.1.101

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.
Files changed (170) hide show
  1. package/.eslintrc.cjs +6 -5
  2. package/.nvmrc +1 -1
  3. package/.prettierignore +3 -5
  4. package/.prettierrc +3 -5
  5. package/README.md +360 -20
  6. package/bitbucket-pipelines.yml +6 -5
  7. package/dist/bundle.cjs.js +1 -27
  8. package/dist/bundle.cjs.js.map +1 -1
  9. package/dist/bundle.es.js +700 -5086
  10. package/dist/bundle.es.js.map +1 -1
  11. package/dist/index.d.ts +1442 -8
  12. package/package.json +9 -51
  13. package/src/agents/agents-api.ts +66 -0
  14. package/src/agents/types.ts +349 -0
  15. package/src/auth/api-key-auth.ts +13 -0
  16. package/src/auth/authentication-provider.ts +4 -0
  17. package/src/auth/bearer-token-auth.ts +13 -0
  18. package/src/auth/index.ts +3 -0
  19. package/src/billing/billing-client.ts +182 -0
  20. package/src/billing/types.ts +166 -0
  21. package/src/credentials/credentials-api.ts +40 -0
  22. package/src/credentials/types.ts +67 -0
  23. package/src/exceptions.ts +10 -0
  24. package/src/features/feature-templates-api.ts +43 -0
  25. package/src/features/features-api.ts +16 -0
  26. package/src/features/types.ts +25 -0
  27. package/src/http-api.ts +102 -0
  28. package/src/index.ts +179 -7
  29. package/src/knowledges/knowledge-base-documents-api.ts +39 -0
  30. package/src/knowledges/knowledge-bases-api.ts +48 -0
  31. package/src/knowledges/types.ts +70 -0
  32. package/src/known-models/known-models-api.ts +33 -0
  33. package/src/known-models/types.ts +7 -0
  34. package/src/missions/missions-api.ts +62 -0
  35. package/src/missions/types.ts +25 -0
  36. package/src/paginated.ts +6 -0
  37. package/src/persona-sdk.ts +104 -0
  38. package/src/projects/projects-api.ts +90 -0
  39. package/src/projects/types.ts +52 -0
  40. package/src/revisions/types.ts +9 -0
  41. package/src/service-prices/service-prices-api.ts +33 -0
  42. package/src/service-prices/types.ts +8 -0
  43. package/src/sessions/sessions-api.ts +90 -0
  44. package/src/sessions/types.ts +150 -0
  45. package/src/triggers/trigger-executions-api.ts +28 -0
  46. package/src/triggers/triggers-api.ts +38 -0
  47. package/src/triggers/types.ts +50 -0
  48. package/src/values/values-api.ts +84 -0
  49. package/src/workflows/types.ts +150 -0
  50. package/src/workflows/workflow-executions-api.ts +28 -0
  51. package/src/workflows/workflows-api.ts +52 -0
  52. package/tsconfig.json +20 -28
  53. package/vite.config.ts +20 -67
  54. package/.github/copilot-instructions.md +0 -3
  55. package/CLAUDE.md +0 -3
  56. package/GEMINI.md +0 -3
  57. package/components.json +0 -24
  58. package/dist/bundle.iife.js +0 -28
  59. package/dist/bundle.iife.js.map +0 -1
  60. package/dist/bundle.umd.js +0 -28
  61. package/dist/bundle.umd.js.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/logging.d.ts +0 -18
  64. package/dist/logging.d.ts.map +0 -1
  65. package/dist/messages.d.ts +0 -9
  66. package/dist/messages.d.ts.map +0 -1
  67. package/dist/projects.d.ts +0 -17
  68. package/dist/projects.d.ts.map +0 -1
  69. package/dist/protocol/base.d.ts +0 -25
  70. package/dist/protocol/base.d.ts.map +0 -1
  71. package/dist/protocol/index.d.ts +0 -6
  72. package/dist/protocol/index.d.ts.map +0 -1
  73. package/dist/protocol/rest.d.ts +0 -25
  74. package/dist/protocol/rest.d.ts.map +0 -1
  75. package/dist/protocol/transaction.d.ts +0 -56
  76. package/dist/protocol/transaction.d.ts.map +0 -1
  77. package/dist/protocol/webrtc.d.ts +0 -60
  78. package/dist/protocol/webrtc.d.ts.map +0 -1
  79. package/dist/protocol/websocket.d.ts +0 -22
  80. package/dist/protocol/websocket.d.ts.map +0 -1
  81. package/dist/runtime/context.d.ts +0 -34
  82. package/dist/runtime/context.d.ts.map +0 -1
  83. package/dist/runtime/file-attachment-adapter.d.ts +0 -15
  84. package/dist/runtime/file-attachment-adapter.d.ts.map +0 -1
  85. package/dist/runtime/handlers.d.ts +0 -21
  86. package/dist/runtime/handlers.d.ts.map +0 -1
  87. package/dist/runtime/listeners.d.ts +0 -6
  88. package/dist/runtime/listeners.d.ts.map +0 -1
  89. package/dist/runtime/protocols.d.ts +0 -17
  90. package/dist/runtime/protocols.d.ts.map +0 -1
  91. package/dist/runtime/threads.d.ts +0 -34
  92. package/dist/runtime/threads.d.ts.map +0 -1
  93. package/dist/runtime/utils.d.ts +0 -10
  94. package/dist/runtime/utils.d.ts.map +0 -1
  95. package/dist/runtime.d.ts +0 -6
  96. package/dist/runtime.d.ts.map +0 -1
  97. package/dist/storage/base.d.ts +0 -9
  98. package/dist/storage/base.d.ts.map +0 -1
  99. package/dist/storage/index.d.ts +0 -3
  100. package/dist/storage/index.d.ts.map +0 -1
  101. package/dist/storage/persona.d.ts +0 -29
  102. package/dist/storage/persona.d.ts.map +0 -1
  103. package/dist/tools.d.ts +0 -72
  104. package/dist/tools.d.ts.map +0 -1
  105. package/dist/types.d.ts +0 -237
  106. package/dist/types.d.ts.map +0 -1
  107. package/docs/README.md +0 -13
  108. package/docs/api-reference.md +0 -16
  109. package/docs/contributing.md +0 -21
  110. package/docs/customization.md +0 -74
  111. package/docs/features.md +0 -7
  112. package/docs/installation.md +0 -9
  113. package/docs/messages.md +0 -214
  114. package/docs/protocols.md +0 -39
  115. package/docs/transactions.md +0 -121
  116. package/docs/usage.md +0 -40
  117. package/jsconfig.node.json +0 -10
  118. package/playground/index.html +0 -14
  119. package/playground/src/app.tsx +0 -10
  120. package/playground/src/chat.tsx +0 -117
  121. package/playground/src/components/assistant-ui/assistant-modal.tsx +0 -57
  122. package/playground/src/components/assistant-ui/attachment.tsx +0 -197
  123. package/playground/src/components/assistant-ui/markdown-text.tsx +0 -228
  124. package/playground/src/components/assistant-ui/thread-list.tsx +0 -91
  125. package/playground/src/components/assistant-ui/thread.tsx +0 -302
  126. package/playground/src/components/assistant-ui/threadlist-sidebar.tsx +0 -59
  127. package/playground/src/components/assistant-ui/tool-fallback.tsx +0 -93
  128. package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +0 -42
  129. package/playground/src/components/chat/logging.tsx +0 -53
  130. package/playground/src/components/ui/avatar.tsx +0 -51
  131. package/playground/src/components/ui/button.tsx +0 -60
  132. package/playground/src/components/ui/dialog.tsx +0 -141
  133. package/playground/src/components/ui/input.tsx +0 -21
  134. package/playground/src/components/ui/separator.tsx +0 -26
  135. package/playground/src/components/ui/sheet.tsx +0 -139
  136. package/playground/src/components/ui/sidebar.tsx +0 -619
  137. package/playground/src/components/ui/skeleton.tsx +0 -13
  138. package/playground/src/components/ui/tooltip.tsx +0 -59
  139. package/playground/src/hooks/theme.ts +0 -70
  140. package/playground/src/hooks/use-mobile.ts +0 -19
  141. package/playground/src/lib/utils.ts +0 -6
  142. package/playground/src/main.tsx +0 -10
  143. package/playground/src/styles.css +0 -120
  144. package/playground/src/tools.ts +0 -149
  145. package/playground/src/vite-env.d.ts +0 -1
  146. package/preview-build.sh +0 -23
  147. package/src/logging.ts +0 -34
  148. package/src/messages.ts +0 -202
  149. package/src/projects.ts +0 -57
  150. package/src/protocol/base.ts +0 -73
  151. package/src/protocol/index.ts +0 -5
  152. package/src/protocol/rest.ts +0 -107
  153. package/src/protocol/transaction.ts +0 -182
  154. package/src/protocol/webrtc.ts +0 -379
  155. package/src/protocol/websocket.ts +0 -111
  156. package/src/runtime/context.ts +0 -88
  157. package/src/runtime/file-attachment-adapter.ts +0 -48
  158. package/src/runtime/handlers.ts +0 -322
  159. package/src/runtime/index.ts +0 -6
  160. package/src/runtime/listeners.ts +0 -79
  161. package/src/runtime/protocols.ts +0 -169
  162. package/src/runtime/threads.ts +0 -105
  163. package/src/runtime/utils.ts +0 -46
  164. package/src/runtime.tsx +0 -334
  165. package/src/storage/base.ts +0 -13
  166. package/src/storage/index.ts +0 -2
  167. package/src/storage/persona.ts +0 -138
  168. package/src/tools.ts +0 -211
  169. package/src/types.ts +0 -284
  170. package/tsconfig.node.json +0 -15
@@ -0,0 +1,52 @@
1
+ export interface Project {
2
+ id?: string;
3
+ name?: string;
4
+ tag?: string;
5
+ apiKey?: string;
6
+ }
7
+
8
+ export interface ProjectCreateRequest {
9
+ name: string;
10
+ tag?: string;
11
+ }
12
+
13
+ export interface ProjectUpdateRequest {
14
+ projectId: string;
15
+ name?: string;
16
+ tag?: string;
17
+ }
18
+
19
+ export interface ProjectDuplicateRequest {
20
+ name: string;
21
+ tag?: string;
22
+ }
23
+
24
+ export interface ProjectSubscription {
25
+ id?: string;
26
+ projectId?: string;
27
+ owner?: string;
28
+ planType?: string;
29
+ status?: string;
30
+ startDate?: string;
31
+ planCredits?: number;
32
+ extraCredits?: number;
33
+ keepCreditsOnRenew?: boolean;
34
+ infiniteCredits?: boolean;
35
+ endDate?: string;
36
+ createdAt?: string;
37
+ updatedAt?: string;
38
+ stripeCustomerId?: string;
39
+ stripeSubscriptionId?: string;
40
+ }
41
+
42
+ export interface ChangeProjectSubscriptionPlanRequest {
43
+ toPlanType: string;
44
+ }
45
+
46
+ export interface AddProjectSubscriptionCreditsRequest {
47
+ credits: number;
48
+ }
49
+
50
+ export interface SetProjectSubscriptionInfiniteCreditsRequest {
51
+ enabled: boolean;
52
+ }
@@ -0,0 +1,9 @@
1
+ export interface Revision {
2
+ id?: string;
3
+ entityId?: string;
4
+ entityType?: string;
5
+ timestamp?: string;
6
+ data?: Record<string, unknown>;
7
+ userId?: string;
8
+ comment?: string;
9
+ }
@@ -0,0 +1,33 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { Paginated } from '../paginated';
3
+ import { AuthenticationProvider } from '../auth/authentication-provider';
4
+ import { ServicePrice } from './types';
5
+
6
+ export class ServicePricesApi extends HttpApi {
7
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
8
+ super(baseUrl, auth);
9
+ }
10
+
11
+ async list(keyword?: string | null, page?: number, size?: number, extraParams?: Record<string, string>): Promise<Paginated<ServicePrice>> {
12
+ const { page: p, size: s } = this.normalizePageParams(page, size);
13
+ const params: Record<string, unknown> = { page: p, size: s, ...extraParams };
14
+ if (keyword) params.keyword = keyword;
15
+ return this.httpGet<Paginated<ServicePrice>>('/service-prices', params);
16
+ }
17
+
18
+ async get(id: string): Promise<ServicePrice> {
19
+ return this.httpGet<ServicePrice>('/service-prices/' + id);
20
+ }
21
+
22
+ async create(servicePrice: ServicePrice): Promise<ServicePrice> {
23
+ return this.httpPost<ServicePrice>('/service-prices', servicePrice);
24
+ }
25
+
26
+ async update(id: string, servicePrice: ServicePrice): Promise<ServicePrice> {
27
+ return this.httpPut<ServicePrice>('/service-prices/' + id, servicePrice);
28
+ }
29
+
30
+ async remove(id: string): Promise<void> {
31
+ await this.httpDelete('/service-prices/' + id);
32
+ }
33
+ }
@@ -0,0 +1,8 @@
1
+ export interface ServicePrice {
2
+ id?: string;
3
+ service?: string;
4
+ cost?: number;
5
+ unit?: string;
6
+ markupPercentage?: number;
7
+ fixedPrice?: number;
8
+ }
@@ -0,0 +1,90 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { Paginated } from '../paginated';
3
+ import { AuthenticationProvider } from '../auth/authentication-provider';
4
+ import {
5
+ Session,
6
+ GenerationRequest,
7
+ GenerationResponse,
8
+ Message,
9
+ CommittedUsage,
10
+ AgentStateInfo,
11
+ SteerAccepted,
12
+ } from './types';
13
+
14
+ export class SessionsApi extends HttpApi {
15
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
16
+ super(baseUrl, auth);
17
+ }
18
+
19
+ async list(
20
+ keyword?: string | null,
21
+ status?: string | null,
22
+ agentId?: string | null,
23
+ userId?: string | null,
24
+ page?: number,
25
+ size?: number,
26
+ ): Promise<Paginated<Session>> {
27
+ const { page: p, size: s } = this.normalizePageParams(page, size);
28
+ const params: Record<string, unknown> = { page: p, size: s };
29
+ if (keyword) params.keyword = keyword;
30
+ if (status) params.status = status;
31
+ if (agentId) params.agentId = agentId;
32
+ if (userId) params.userId = userId;
33
+ return this.httpGet<Paginated<Session>>('/sessions', params);
34
+ }
35
+
36
+ async get(sessionId: string): Promise<Session> {
37
+ return this.httpGet<Session>('/sessions/' + sessionId);
38
+ }
39
+
40
+ async getUsage(sessionId: string): Promise<CommittedUsage[]> {
41
+ return this.httpGet<CommittedUsage[]>('/sessions/' + sessionId + '/usage');
42
+ }
43
+
44
+ async generateMessage(code: string, request: GenerationRequest): Promise<GenerationResponse> {
45
+ return this.httpPost<GenerationResponse>('/sessions/' + code + '/messages', request);
46
+ }
47
+
48
+ async findMessages(code: string, page?: number, size?: number): Promise<Paginated<Message>> {
49
+ const { page: p, size: s } = this.normalizePageParams(page, size);
50
+ const params: Record<string, unknown> = { page: p, size: s };
51
+ return this.httpGet<Paginated<Message>>('/sessions/' + code + '/messages', params);
52
+ }
53
+
54
+ async remove(code: string): Promise<void> {
55
+ await this.httpDelete('/sessions/' + code);
56
+ }
57
+
58
+ async rename(sessionId: string, name: string): Promise<Session> {
59
+ return this.httpPut<Session>('/sessions/' + sessionId + '/name', { name });
60
+ }
61
+
62
+ // ─── Agent Execution Lifecycle ────────────────────────────────
63
+
64
+ /**
65
+ * Get the current state of the agent execution for a session.
66
+ */
67
+ async getAgentState(code: string): Promise<AgentStateInfo> {
68
+ return this.httpGet<AgentStateInfo>('/sessions/' + encodeURIComponent(code) + '/agent-state');
69
+ }
70
+
71
+ /**
72
+ * Cancel a running agent execution for a session.
73
+ */
74
+ async cancelExecution(code: string): Promise<{ status: string; sessionId: string }> {
75
+ return this.httpPost<{ status: string; sessionId: string }>(
76
+ '/sessions/' + encodeURIComponent(code) + '/cancel',
77
+ {},
78
+ );
79
+ }
80
+
81
+ /**
82
+ * Steer a running agent execution by injecting an instruction.
83
+ */
84
+ async steerExecution(code: string, text: string): Promise<SteerAccepted> {
85
+ return this.httpPost<SteerAccepted>(
86
+ '/sessions/' + encodeURIComponent(code) + '/steer',
87
+ { text },
88
+ );
89
+ }
90
+ }
@@ -0,0 +1,150 @@
1
+ export interface Image {
2
+ content?: string;
3
+ contentType?: string;
4
+ }
5
+
6
+ export interface SessionFile {
7
+ name?: string;
8
+ url?: string;
9
+ base64?: string;
10
+ contentType?: string;
11
+ }
12
+
13
+ export interface FunctionCall {
14
+ name?: string;
15
+ args?: Record<string, unknown>;
16
+ id?: string;
17
+ }
18
+
19
+ export type ToolResultItem = string | SessionFile | Image | Record<string, unknown>;
20
+
21
+ export interface FunctionResponse {
22
+ name?: string;
23
+ result?: ToolResultItem | ToolResultItem[] | null;
24
+ functionCallId?: string;
25
+ }
26
+
27
+ export interface SourceChunk {
28
+ start?: number;
29
+ end?: number;
30
+ }
31
+
32
+ export interface Source {
33
+ type?: string;
34
+ url?: string;
35
+ documentId?: string;
36
+ pageId?: string;
37
+ pageNumber?: number;
38
+ chunks?: SourceChunk[];
39
+ mostRelevant?: boolean;
40
+ }
41
+
42
+ export type CollaborationMode = 'delegate_and_return' | 'persistent_transfer' | 'consult_then_respond';
43
+
44
+ export interface TransferAction {
45
+ request?: string;
46
+ thought?: string;
47
+ agent?: string;
48
+ functionCallMessage?: Message;
49
+ functionResponseMessage?: Message;
50
+ collaborationMode?: CollaborationMode;
51
+ }
52
+
53
+ export interface Message {
54
+ id?: string;
55
+ sessionId?: string;
56
+ text?: string;
57
+ image?: Image;
58
+ file?: SessionFile;
59
+ role?: string;
60
+ timestamp?: number;
61
+ createdAt?: string;
62
+ functionCalls?: FunctionCall[];
63
+ functionResponse?: FunctionResponse;
64
+ finishReason?: string;
65
+ sources?: Source[];
66
+ task?: Record<string, unknown>;
67
+ sender?: string;
68
+ thought?: boolean;
69
+ }
70
+
71
+ export interface AgentResponse {
72
+ messages?: Message[];
73
+ transfer?: TransferAction;
74
+ }
75
+
76
+ export interface AgentContext {}
77
+
78
+ export interface UsageCost {
79
+ service?: string;
80
+ value?: number;
81
+ cost?: number;
82
+ price?: number;
83
+ credits?: number;
84
+ unit?: string;
85
+ }
86
+
87
+ export interface CommittedUsage {
88
+ id?: string;
89
+ committedAt?: string;
90
+ projectId?: string;
91
+ sessionId?: string;
92
+ creditsUsed?: number;
93
+ totalCost?: number;
94
+ totalPrice?: number;
95
+ userId?: string;
96
+ details?: UsageCost[];
97
+ }
98
+
99
+ export interface Session {
100
+ id?: string;
101
+ code?: string;
102
+ name?: string;
103
+ projectId?: string;
104
+ agentId?: string;
105
+ currentAgentId?: string;
106
+ userId?: string;
107
+ status?: string;
108
+ visibility?: string;
109
+ type?: string;
110
+ createdAt?: string;
111
+ finishedAt?: string;
112
+ parentSessionId?: string;
113
+ protocol?: string;
114
+ extras?: Record<string, unknown>;
115
+ isNew?: boolean;
116
+ }
117
+
118
+ export interface GenerationRequest {
119
+ agentId?: string;
120
+ userMessage?: unknown;
121
+ initialContext?: AgentContext;
122
+ responseSchema?: Record<string, unknown>;
123
+ parentSessionId?: string;
124
+ userId?: string;
125
+ }
126
+
127
+ export interface GenerationResponse {
128
+ json?: unknown;
129
+ response?: AgentResponse;
130
+ sessionId?: string;
131
+ }
132
+
133
+ // ─── Agent Execution Lifecycle types ────────────────────────────
134
+
135
+ export interface AgentStateInfo {
136
+ state: string;
137
+ sessionId?: string;
138
+ agentId?: string;
139
+ currentTurn?: number;
140
+ pendingSteers?: number;
141
+ eventCount?: number;
142
+ message?: string;
143
+ }
144
+
145
+ export interface SteerAccepted {
146
+ steerId: string;
147
+ text: string;
148
+ acceptedAt: string;
149
+ willProcessAfterTurn: number | null;
150
+ }
@@ -0,0 +1,28 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { Paginated } from '../paginated';
3
+ import { AuthenticationProvider } from '../auth/authentication-provider';
4
+ import { TriggerExecutionResult } from './types';
5
+
6
+ export class TriggerExecutionsApi extends HttpApi {
7
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
8
+ super(baseUrl, auth);
9
+ }
10
+
11
+ async list(triggerId: string, page?: number, size?: number): Promise<Paginated<TriggerExecutionResult>> {
12
+ const { page: p, size: s } = this.normalizePageParams(page, size);
13
+ const params: Record<string, unknown> = { page: p, size: s };
14
+ return this.httpGet<Paginated<TriggerExecutionResult>>('/triggers/' + triggerId + '/executions', params);
15
+ }
16
+
17
+ async execute(triggerId: string, execution: TriggerExecutionResult): Promise<TriggerExecutionResult> {
18
+ return this.httpPost<TriggerExecutionResult>('/triggers/' + triggerId + '/executions', execution);
19
+ }
20
+
21
+ async get(executionId: string): Promise<TriggerExecutionResult> {
22
+ return this.httpGet<TriggerExecutionResult>('/triggers/executions/' + executionId);
23
+ }
24
+
25
+ async remove(executionId: string): Promise<void> {
26
+ await this.httpDelete('/triggers/executions/' + executionId);
27
+ }
28
+ }
@@ -0,0 +1,38 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { Paginated } from '../paginated';
3
+ import { AuthenticationProvider } from '../auth/authentication-provider';
4
+ import { Trigger } from './types';
5
+ import { TriggerExecutionsApi } from './trigger-executions-api';
6
+
7
+ export class TriggersApi extends HttpApi {
8
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
9
+ super(baseUrl, auth);
10
+ }
11
+
12
+ async list(keyword?: string | null, page?: number, size?: number, extraParams?: Record<string, string>): Promise<Paginated<Trigger>> {
13
+ const { page: p, size: s } = this.normalizePageParams(page, size);
14
+ const params: Record<string, unknown> = { page: p, size: s, ...extraParams };
15
+ if (keyword) params.keyword = keyword;
16
+ return this.httpGet<Paginated<Trigger>>('/triggers', params);
17
+ }
18
+
19
+ async create(trigger: Trigger): Promise<Trigger> {
20
+ return this.httpPost<Trigger>('/triggers', trigger);
21
+ }
22
+
23
+ async update(triggerId: string, trigger: Trigger): Promise<Trigger> {
24
+ return this.httpPut<Trigger>('/triggers/' + triggerId, trigger);
25
+ }
26
+
27
+ async remove(triggerId: string): Promise<void> {
28
+ await this.httpDelete('/triggers/' + triggerId);
29
+ }
30
+
31
+ async get(triggerId: string): Promise<Trigger> {
32
+ return this.httpGet<Trigger>('/triggers/' + triggerId);
33
+ }
34
+
35
+ executions(): TriggerExecutionsApi {
36
+ return new TriggerExecutionsApi(this.getBaseUrl(), this.getAuthProvider());
37
+ }
38
+ }
@@ -0,0 +1,50 @@
1
+ export type TriggerSourceType = 'webhook' | 'schedule' | 'gmail' | 'imap';
2
+
3
+ export interface GmailTriggerSourceConfiguration {
4
+ event?: string;
5
+ query?: string;
6
+ credentialsId?: string;
7
+ userEmail?: string;
8
+ watchExpiration?: number;
9
+ lastHistoryId?: number;
10
+ }
11
+
12
+ export interface ImapTriggerSourceConfiguration {
13
+ event?: string;
14
+ credentialsId?: string;
15
+ mailbox?: string;
16
+ searchCriteria?: string;
17
+ processAttachments?: boolean;
18
+ allowedMimeTypes?: string[];
19
+ }
20
+
21
+ export type TriggerSourceConfiguration = GmailTriggerSourceConfiguration | ImapTriggerSourceConfiguration | Record<string, unknown>;
22
+
23
+ export interface TriggerSource {
24
+ type?: TriggerSourceType;
25
+ configuration?: TriggerSourceConfiguration;
26
+ }
27
+
28
+ export interface TriggerDestination {
29
+ type?: string;
30
+ configuration?: Record<string, unknown>;
31
+ }
32
+
33
+ export interface Trigger {
34
+ id?: string;
35
+ projectId?: string;
36
+ name?: string;
37
+ source?: TriggerSource;
38
+ destination?: TriggerDestination;
39
+ enabled?: boolean;
40
+ createdAt?: string;
41
+ processedAt?: string;
42
+ }
43
+
44
+ export interface TriggerExecutionResult {
45
+ id?: string;
46
+ triggerId?: string;
47
+ success?: boolean;
48
+ message?: string;
49
+ processedAt?: string;
50
+ }
@@ -0,0 +1,84 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { AuthenticationProvider } from '../auth/authentication-provider';
3
+
4
+ export class ValuesApi extends HttpApi {
5
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
6
+ super(baseUrl, auth);
7
+ }
8
+
9
+ async get(category: string): Promise<Record<string, unknown>[]> {
10
+ return this.httpGet<Record<string, unknown>[]>('/values/' + category);
11
+ }
12
+
13
+ async getLanguageCodes(): Promise<string[]> {
14
+ return this.httpGet<string[]>('/values/language-codes');
15
+ }
16
+
17
+ async getModelNames(): Promise<string[]> {
18
+ return this.httpGet<string[]>('/values/model-names');
19
+ }
20
+
21
+ async getModelProviders(): Promise<string[]> {
22
+ return this.httpGet<string[]>('/values/model-providers');
23
+ }
24
+
25
+ async getKnowledgeTypes(): Promise<string[]> {
26
+ return this.httpGet<string[]>('/values/knowledge-types');
27
+ }
28
+
29
+ async getCollaborationModes(): Promise<string[]> {
30
+ return this.httpGet<string[]>('/values/collaboration-modes');
31
+ }
32
+
33
+ async getTranscriberNames(): Promise<string[]> {
34
+ return this.httpGet<string[]>('/values/transcriber-names');
35
+ }
36
+
37
+ async getSynthesizerNames(): Promise<string[]> {
38
+ return this.httpGet<string[]>('/values/synthesizer-names');
39
+ }
40
+
41
+ async getSynthesizerVoices(synthesizerName: string): Promise<string[]> {
42
+ return this.httpGet<string[]>('/values/synthesizers/' + synthesizerName + '/voices');
43
+ }
44
+
45
+ async getStmTypes(): Promise<string[]> {
46
+ return this.httpGet<string[]>('/values/stm-types');
47
+ }
48
+
49
+ async getDocumentExtractors(): Promise<string[]> {
50
+ return this.httpGet<string[]>('/values/document-extractors');
51
+ }
52
+
53
+ async getEmbeddingModels(): Promise<string[]> {
54
+ return this.httpGet<string[]>('/values/embedding-models');
55
+ }
56
+
57
+ async getQualityOptions(): Promise<string[]> {
58
+ return this.httpGet<string[]>('/values/quality');
59
+ }
60
+
61
+ async getChunkSizeOptions(): Promise<string[]> {
62
+ return this.httpGet<string[]>('/values/chunk-size');
63
+ }
64
+
65
+ async getFeatureTypes(): Promise<string[]> {
66
+ return this.httpGet<string[]>('/values/feature-types');
67
+ }
68
+
69
+ async getRoles(): Promise<string[]> {
70
+ return this.httpGet<string[]>('/values/roles');
71
+ }
72
+
73
+ async getServiceUnits(): Promise<string[]> {
74
+ return this.httpGet<string[]>('/values/service-units');
75
+ }
76
+
77
+ async getTriggerSourceTypes(): Promise<string[]> {
78
+ return this.httpGet<string[]>('/values/trigger-source-types');
79
+ }
80
+
81
+ async getTriggerDestinationTypes(): Promise<string[]> {
82
+ return this.httpGet<string[]>('/values/trigger-destination-types');
83
+ }
84
+ }
@@ -0,0 +1,150 @@
1
+ export type NodeType =
2
+ | 'start'
3
+ | 'action'
4
+ | 'condition'
5
+ | 'loop'
6
+ | 'tool'
7
+ | 'agent'
8
+ | 'set_var'
9
+ | 'output'
10
+ | 'workflow'
11
+ | 'resource'
12
+ | 'script';
13
+
14
+ export type VariableType = 'string' | 'number' | 'boolean' | 'object' | 'file' | 'list';
15
+
16
+ export type VariableDirection = 'in' | 'out';
17
+
18
+ export type ExecutionStatus = 'running' | 'completed' | 'failed' | 'cancelled';
19
+
20
+ export interface Position {
21
+ x?: number;
22
+ y?: number;
23
+ }
24
+
25
+ export interface Handle {
26
+ name?: string;
27
+ description?: string;
28
+ type?: string;
29
+ }
30
+
31
+ export interface WorkflowVariable {
32
+ name?: string;
33
+ description?: string;
34
+ type?: VariableType;
35
+ direction?: VariableDirection;
36
+ defaultValue?: unknown;
37
+ }
38
+
39
+ export interface WorkflowTrigger {
40
+ type?: string;
41
+ }
42
+
43
+ export interface Node {
44
+ id?: string;
45
+ type?: NodeType;
46
+ name?: string;
47
+ description?: string;
48
+ position?: Position;
49
+ allowDynamicInputVariables?: boolean;
50
+ allowDynamicOutputVariables?: boolean;
51
+ allowDynamicHandles?: boolean;
52
+ staticVariables?: WorkflowVariable[];
53
+ variables?: WorkflowVariable[];
54
+ values?: Record<string, unknown>;
55
+ staticHandles?: Handle[];
56
+ handles?: Handle[];
57
+ }
58
+
59
+ export interface StartNode extends Node {
60
+ trigger?: WorkflowTrigger;
61
+ }
62
+
63
+ export interface Connection {
64
+ id?: string;
65
+ sourceId?: string;
66
+ targetId?: string;
67
+ sourceHandle?: string;
68
+ targetHandle?: string;
69
+ }
70
+
71
+ export interface Step {
72
+ id?: string;
73
+ nodeId?: string;
74
+ status?: string;
75
+ startedAt?: string;
76
+ endedAt?: string;
77
+ result?: Record<string, unknown>;
78
+ error?: string;
79
+ output?: Record<string, unknown>;
80
+ }
81
+
82
+ export interface RunResult {
83
+ source?: Node;
84
+ success?: boolean;
85
+ message?: string;
86
+ nextNodes?: string[];
87
+ }
88
+
89
+ export interface NodeExecutionResult {
90
+ nextNodes?: Node[];
91
+ output?: Record<string, unknown>;
92
+ }
93
+
94
+ export interface Execution {
95
+ id?: string;
96
+ workflowId?: string;
97
+ status?: string;
98
+ userId?: string;
99
+ steps?: Step[];
100
+ startedAt?: string;
101
+ endedAt?: string;
102
+ output?: Record<string, unknown>;
103
+ error?: string;
104
+ }
105
+
106
+ export interface WorkflowResult {
107
+ workflowId?: string;
108
+ steps?: RunResult[];
109
+ }
110
+
111
+ export interface AgentValue {
112
+ agentId?: string;
113
+ initialContext?: Record<string, unknown>;
114
+ }
115
+
116
+ export interface ContentItemFile {
117
+ content?: string;
118
+ contentType?: string;
119
+ }
120
+
121
+ export interface Ref {
122
+ nodeId?: string;
123
+ variableName?: string;
124
+ }
125
+
126
+ export interface ContentItem {
127
+ text?: string | Ref;
128
+ file?: ContentItemFile | Ref;
129
+ }
130
+
131
+ export interface ContentValue {
132
+ content?: ContentItem[];
133
+ }
134
+
135
+ export interface ExecuteRequest {
136
+ userId?: string;
137
+ initialData?: Record<string, unknown>;
138
+ callbackUrl?: string;
139
+ }
140
+
141
+ export interface Workflow {
142
+ id?: string;
143
+ projectId?: string;
144
+ name?: string;
145
+ description?: string;
146
+ rootNode?: StartNode;
147
+ nodes?: Node[];
148
+ connections?: Connection[];
149
+ features?: import('../agents/types').Feature[];
150
+ }