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

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 (171) 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 +753 -5084
  10. package/dist/bundle.es.js.map +1 -1
  11. package/dist/index.d.ts +1504 -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 +181 -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/human-tasks-api.ts +44 -0
  50. package/src/workflows/types.ts +173 -0
  51. package/src/workflows/workflow-executions-api.ts +94 -0
  52. package/src/workflows/workflows-api.ts +57 -0
  53. package/tsconfig.json +20 -28
  54. package/vite.config.ts +20 -67
  55. package/.github/copilot-instructions.md +0 -3
  56. package/CLAUDE.md +0 -3
  57. package/GEMINI.md +0 -3
  58. package/components.json +0 -24
  59. package/dist/bundle.iife.js +0 -28
  60. package/dist/bundle.iife.js.map +0 -1
  61. package/dist/bundle.umd.js +0 -28
  62. package/dist/bundle.umd.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/logging.d.ts +0 -18
  65. package/dist/logging.d.ts.map +0 -1
  66. package/dist/messages.d.ts +0 -9
  67. package/dist/messages.d.ts.map +0 -1
  68. package/dist/projects.d.ts +0 -17
  69. package/dist/projects.d.ts.map +0 -1
  70. package/dist/protocol/base.d.ts +0 -25
  71. package/dist/protocol/base.d.ts.map +0 -1
  72. package/dist/protocol/index.d.ts +0 -6
  73. package/dist/protocol/index.d.ts.map +0 -1
  74. package/dist/protocol/rest.d.ts +0 -25
  75. package/dist/protocol/rest.d.ts.map +0 -1
  76. package/dist/protocol/transaction.d.ts +0 -56
  77. package/dist/protocol/transaction.d.ts.map +0 -1
  78. package/dist/protocol/webrtc.d.ts +0 -60
  79. package/dist/protocol/webrtc.d.ts.map +0 -1
  80. package/dist/protocol/websocket.d.ts +0 -22
  81. package/dist/protocol/websocket.d.ts.map +0 -1
  82. package/dist/runtime/context.d.ts +0 -34
  83. package/dist/runtime/context.d.ts.map +0 -1
  84. package/dist/runtime/file-attachment-adapter.d.ts +0 -15
  85. package/dist/runtime/file-attachment-adapter.d.ts.map +0 -1
  86. package/dist/runtime/handlers.d.ts +0 -21
  87. package/dist/runtime/handlers.d.ts.map +0 -1
  88. package/dist/runtime/listeners.d.ts +0 -6
  89. package/dist/runtime/listeners.d.ts.map +0 -1
  90. package/dist/runtime/protocols.d.ts +0 -17
  91. package/dist/runtime/protocols.d.ts.map +0 -1
  92. package/dist/runtime/threads.d.ts +0 -34
  93. package/dist/runtime/threads.d.ts.map +0 -1
  94. package/dist/runtime/utils.d.ts +0 -10
  95. package/dist/runtime/utils.d.ts.map +0 -1
  96. package/dist/runtime.d.ts +0 -6
  97. package/dist/runtime.d.ts.map +0 -1
  98. package/dist/storage/base.d.ts +0 -9
  99. package/dist/storage/base.d.ts.map +0 -1
  100. package/dist/storage/index.d.ts +0 -3
  101. package/dist/storage/index.d.ts.map +0 -1
  102. package/dist/storage/persona.d.ts +0 -29
  103. package/dist/storage/persona.d.ts.map +0 -1
  104. package/dist/tools.d.ts +0 -72
  105. package/dist/tools.d.ts.map +0 -1
  106. package/dist/types.d.ts +0 -237
  107. package/dist/types.d.ts.map +0 -1
  108. package/docs/README.md +0 -13
  109. package/docs/api-reference.md +0 -16
  110. package/docs/contributing.md +0 -21
  111. package/docs/customization.md +0 -74
  112. package/docs/features.md +0 -7
  113. package/docs/installation.md +0 -9
  114. package/docs/messages.md +0 -214
  115. package/docs/protocols.md +0 -39
  116. package/docs/transactions.md +0 -121
  117. package/docs/usage.md +0 -40
  118. package/jsconfig.node.json +0 -10
  119. package/playground/index.html +0 -14
  120. package/playground/src/app.tsx +0 -10
  121. package/playground/src/chat.tsx +0 -117
  122. package/playground/src/components/assistant-ui/assistant-modal.tsx +0 -57
  123. package/playground/src/components/assistant-ui/attachment.tsx +0 -197
  124. package/playground/src/components/assistant-ui/markdown-text.tsx +0 -228
  125. package/playground/src/components/assistant-ui/thread-list.tsx +0 -91
  126. package/playground/src/components/assistant-ui/thread.tsx +0 -302
  127. package/playground/src/components/assistant-ui/threadlist-sidebar.tsx +0 -59
  128. package/playground/src/components/assistant-ui/tool-fallback.tsx +0 -93
  129. package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +0 -42
  130. package/playground/src/components/chat/logging.tsx +0 -53
  131. package/playground/src/components/ui/avatar.tsx +0 -51
  132. package/playground/src/components/ui/button.tsx +0 -60
  133. package/playground/src/components/ui/dialog.tsx +0 -141
  134. package/playground/src/components/ui/input.tsx +0 -21
  135. package/playground/src/components/ui/separator.tsx +0 -26
  136. package/playground/src/components/ui/sheet.tsx +0 -139
  137. package/playground/src/components/ui/sidebar.tsx +0 -619
  138. package/playground/src/components/ui/skeleton.tsx +0 -13
  139. package/playground/src/components/ui/tooltip.tsx +0 -59
  140. package/playground/src/hooks/theme.ts +0 -70
  141. package/playground/src/hooks/use-mobile.ts +0 -19
  142. package/playground/src/lib/utils.ts +0 -6
  143. package/playground/src/main.tsx +0 -10
  144. package/playground/src/styles.css +0 -120
  145. package/playground/src/tools.ts +0 -149
  146. package/playground/src/vite-env.d.ts +0 -1
  147. package/preview-build.sh +0 -23
  148. package/src/logging.ts +0 -34
  149. package/src/messages.ts +0 -202
  150. package/src/projects.ts +0 -57
  151. package/src/protocol/base.ts +0 -73
  152. package/src/protocol/index.ts +0 -5
  153. package/src/protocol/rest.ts +0 -107
  154. package/src/protocol/transaction.ts +0 -182
  155. package/src/protocol/webrtc.ts +0 -379
  156. package/src/protocol/websocket.ts +0 -111
  157. package/src/runtime/context.ts +0 -88
  158. package/src/runtime/file-attachment-adapter.ts +0 -48
  159. package/src/runtime/handlers.ts +0 -322
  160. package/src/runtime/index.ts +0 -6
  161. package/src/runtime/listeners.ts +0 -79
  162. package/src/runtime/protocols.ts +0 -169
  163. package/src/runtime/threads.ts +0 -105
  164. package/src/runtime/utils.ts +0 -46
  165. package/src/runtime.tsx +0 -334
  166. package/src/storage/base.ts +0 -13
  167. package/src/storage/index.ts +0 -2
  168. package/src/storage/persona.ts +0 -138
  169. package/src/tools.ts +0 -211
  170. package/src/types.ts +0 -284
  171. 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,44 @@
1
+ import { HttpApi } from '../http-api';
2
+ import { Paginated } from '../paginated';
3
+ import { AuthenticationProvider } from '../auth/authentication-provider';
4
+ import { HumanTask } from './types';
5
+
6
+ /**
7
+ * Human-in-the-loop tasks. A task is created when a workflow step
8
+ * suspends waiting for a human (a declared `human` node or an agent
9
+ * escalation); responding to it resumes the run. Lives on the workflows
10
+ * service.
11
+ */
12
+ export class HumanTasksApi extends HttpApi {
13
+ constructor(baseUrl: string, auth: string | AuthenticationProvider) {
14
+ super(baseUrl, auth);
15
+ }
16
+
17
+ /** The project's human-task inbox. */
18
+ async list(
19
+ filters: {
20
+ status?: string;
21
+ assignee?: string;
22
+ workflowId?: string;
23
+ executionId?: string;
24
+ page?: number;
25
+ size?: number;
26
+ } = {},
27
+ ): Promise<Paginated<HumanTask>> {
28
+ const { page, size } = this.normalizePageParams(filters.page, filters.size ?? 50);
29
+ const params: Record<string, unknown> = { page, size };
30
+ if (filters.status ?? 'pending') params.status = filters.status ?? 'pending';
31
+ if (filters.assignee) params.assignee = filters.assignee;
32
+ if (filters.workflowId) params.workflowId = filters.workflowId;
33
+ if (filters.executionId) params.executionId = filters.executionId;
34
+ return this.httpGet<Paginated<HumanTask>>('/human-tasks', params);
35
+ }
36
+
37
+ /** Answer a pending human task, resuming the suspended workflow execution. */
38
+ async respond(humanTaskId: string, response: unknown, respondedBy?: string): Promise<HumanTask> {
39
+ return this.httpPost<HumanTask>('/human-tasks/' + humanTaskId + '/respond', {
40
+ response,
41
+ respondedBy,
42
+ });
43
+ }
44
+ }