@stack-spot/portal-network 0.184.0-beta.1 → 0.184.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +2412 -2431
  2. package/dist/api/account.js +1 -1
  3. package/dist/api/agent-tools.js +1 -1
  4. package/dist/api/agent.js +1 -1
  5. package/dist/api/ai.js +1 -1
  6. package/dist/api/apiManagement.js +1 -1
  7. package/dist/api/apiRuntime.js +1 -1
  8. package/dist/api/cloudAccount.js +1 -1
  9. package/dist/api/cloudPlatform.js +1 -1
  10. package/dist/api/cloudPlatformHorizon.js +1 -1
  11. package/dist/api/cloudRuntimes.js +1 -1
  12. package/dist/api/cloudServices.js +1 -1
  13. package/dist/api/codeShift.d.ts +4 -76
  14. package/dist/api/codeShift.d.ts.map +1 -1
  15. package/dist/api/codeShift.js +1 -14
  16. package/dist/api/codeShift.js.map +1 -1
  17. package/dist/api/content.js +1 -1
  18. package/dist/api/dataIntegration.js +1 -1
  19. package/dist/api/discover.js +1 -1
  20. package/dist/api/genAiInference.js +1 -1
  21. package/dist/api/insights.js +1 -1
  22. package/dist/api/notification.js +1 -1
  23. package/dist/api/secrets.js +1 -1
  24. package/dist/api/serviceCatalog.js +1 -1
  25. package/dist/api/workspace-ai.js +1 -1
  26. package/dist/api/workspace.js +1 -1
  27. package/dist/api/workspaceManager.d.ts +16 -10
  28. package/dist/api/workspaceManager.d.ts.map +1 -1
  29. package/dist/api/workspaceManager.js +11 -1
  30. package/dist/api/workspaceManager.js.map +1 -1
  31. package/dist/api/workspaceSearchEngine.js +1 -1
  32. package/dist/client/ai.d.ts.map +1 -1
  33. package/dist/client/ai.js +14 -84
  34. package/dist/client/ai.js.map +1 -1
  35. package/dist/client/code-shift.d.ts +0 -30
  36. package/dist/client/code-shift.d.ts.map +1 -1
  37. package/dist/client/code-shift.js +1 -37
  38. package/dist/client/code-shift.js.map +1 -1
  39. package/dist/client/types.d.ts +6 -26
  40. package/dist/client/types.d.ts.map +1 -1
  41. package/dist/client/workspace-manager.d.ts +6 -0
  42. package/dist/client/workspace-manager.d.ts.map +1 -1
  43. package/dist/client/workspace-manager.js +10 -1
  44. package/dist/client/workspace-manager.js.map +1 -1
  45. package/package.json +1 -1
  46. package/readme.md +1 -1
  47. package/scripts/generate-apis.ts +134 -134
  48. package/src/api/account.ts +8367 -8368
  49. package/src/api/agent-tools.ts +2169 -2172
  50. package/src/api/agent.ts +1083 -1085
  51. package/src/api/ai.ts +3388 -3388
  52. package/src/api/apiManagement.ts +570 -570
  53. package/src/api/apiRuntime.ts +2103 -2103
  54. package/src/api/cloudAccount.ts +1239 -1239
  55. package/src/api/cloudPlatform.ts +927 -927
  56. package/src/api/cloudPlatformHorizon.ts +2655 -2655
  57. package/src/api/cloudRuntimes.ts +2043 -2043
  58. package/src/api/cloudServices.ts +1445 -1445
  59. package/src/api/codeShift.ts +3481 -3580
  60. package/src/api/content.ts +9785 -9785
  61. package/src/api/dataIntegration.ts +1657 -1657
  62. package/src/api/discover.ts +435 -435
  63. package/src/api/eventBus.ts +171 -171
  64. package/src/api/genAiInference.ts +603 -603
  65. package/src/api/insights.ts +310 -310
  66. package/src/api/notification.ts +334 -336
  67. package/src/api/secrets.ts +342 -342
  68. package/src/api/serviceCatalog.ts +2908 -2908
  69. package/src/api/workflows.ts +1669 -1669
  70. package/src/api/workspace-ai.ts +677 -677
  71. package/src/api/workspace.ts +5889 -5889
  72. package/src/api/workspaceManager.ts +2951 -2936
  73. package/src/api/workspaceSearchEngine.ts +153 -153
  74. package/src/api-addresses.ts +120 -120
  75. package/src/apis-itau.json +225 -225
  76. package/src/apis.json +225 -225
  77. package/src/client/account.ts +902 -902
  78. package/src/client/agent-tools.ts +210 -210
  79. package/src/client/agent.ts +81 -81
  80. package/src/client/ai.ts +395 -469
  81. package/src/client/api-management.ts +40 -40
  82. package/src/client/cloud-account.ts +70 -70
  83. package/src/client/cloud-platform-horizon.ts +113 -113
  84. package/src/client/cloud-platform.ts +163 -163
  85. package/src/client/cloud-runtimes.ts +129 -129
  86. package/src/client/cloud-services.ts +94 -94
  87. package/src/client/code-shift.ts +349 -371
  88. package/src/client/content.ts +538 -538
  89. package/src/client/data-integration.ts +191 -191
  90. package/src/client/discover.ts +89 -89
  91. package/src/client/event-bus.ts +84 -84
  92. package/src/client/gen-ai-inference.ts +65 -65
  93. package/src/client/insights.ts +28 -28
  94. package/src/client/notification.ts +32 -32
  95. package/src/client/runtime-manager.ts +76 -76
  96. package/src/client/secrets.ts +60 -60
  97. package/src/client/types.ts +377 -398
  98. package/src/client/workflow.ts +83 -83
  99. package/src/client/workspace-ai.ts +191 -191
  100. package/src/client/workspace-manager.ts +564 -560
  101. package/src/client/workspace-search.ts +39 -39
  102. package/src/client/workspace.ts +480 -480
  103. package/src/error/DefaultAPIError.ts +151 -151
  104. package/src/error/FileUploadError.ts +18 -18
  105. package/src/error/IgnoredErrorCodes.ts +3 -3
  106. package/src/error/StackspotAPIError.ts +101 -101
  107. package/src/error/StreamCanceledError.ts +10 -10
  108. package/src/error/StreamError.ts +7 -7
  109. package/src/error/StreamJsonError.ts +10 -10
  110. package/src/error/dictionary/account.ts +58 -58
  111. package/src/error/dictionary/action-details.ts +20 -20
  112. package/src/error/dictionary/action.ts +211 -211
  113. package/src/error/dictionary/agent-tools.ts +75 -75
  114. package/src/error/dictionary/ai-inference.ts +28 -28
  115. package/src/error/dictionary/base.ts +22 -22
  116. package/src/error/dictionary/cloud-platform.ts +82 -82
  117. package/src/error/dictionary/cnt-fields.ts +14 -14
  118. package/src/error/dictionary/cnt.ts +103 -103
  119. package/src/error/dictionary/code-shift.ts +12 -12
  120. package/src/error/dictionary/rte.ts +24 -24
  121. package/src/error/dictionary/rtm.ts +10 -10
  122. package/src/error/dictionary/secrets.ts +14 -14
  123. package/src/error/dictionary/workspace-ai.ts +10 -10
  124. package/src/error/dictionary/workspace-details.ts +15 -15
  125. package/src/error/dictionary/workspace-fields.ts +10 -10
  126. package/src/error/dictionary/workspace.ts +209 -209
  127. package/src/error/types.ts +21 -21
  128. package/src/index.ts +43 -43
  129. package/src/network/AutoInfiniteQuery.ts +115 -115
  130. package/src/network/AutoMutation.ts +27 -27
  131. package/src/network/AutoOperation.ts +73 -73
  132. package/src/network/AutoQuery.ts +75 -75
  133. package/src/network/ManualInfiniteQuery.ts +95 -95
  134. package/src/network/ManualMutation.ts +40 -40
  135. package/src/network/ManualOperation.ts +52 -52
  136. package/src/network/ManualQuery.ts +82 -82
  137. package/src/network/NetworkClient.ts +167 -167
  138. package/src/network/ReactQueryNetworkClient.ts +312 -312
  139. package/src/network/react-query-client.ts +14 -14
  140. package/src/network/types.ts +294 -294
  141. package/src/types.ts +1 -1
  142. package/src/utils/StreamedArray.tsx +146 -146
  143. package/src/utils/StreamedJson.tsx +166 -166
  144. package/src/utils/remove-authorization-param.ts +6 -6
  145. package/src/utils/string.ts +19 -19
  146. package/src/utils/use-extended-list.ts +80 -80
  147. package/src/utils/use-streamed-array.ts +17 -17
  148. package/tsconfig.build.json +4 -4
  149. package/tsconfig.json +10 -10
  150. package/logs/simple-failure/01JBER7AWKACEC3Y1NF7M6PHFF/job_id_1.log +0 -3
  151. package/logs/simple-suspend/01JBEMQG94ADPT99MSZ7EJKGXZ/job_id_1.log +0 -5
@@ -1,398 +1,377 @@
1
- import { RequestOpts } from '@oazapfts/runtime'
2
- import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse, GroupsFromResourceResponse, MembersFromResourceResponse } from '../api/account'
3
- import { AgentVisibilityLevelEnum, HttpMethod, ListAgentResponse, VisibilityLevelEnum } from '../api/agent-tools'
4
- import { ChatRequest, ChatResponse3, ContentDependencyResponse, ConversationHistoryResponse, ConversationResponse, DependencyResponse } from '../api/ai'
5
- import { ConnectAccountRequestV2, ManagedAccountProvisionRequest } from '../api/cloudAccount'
6
- import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
7
- import { Action } from '../api/workspace-ai'
8
- import { ActivityResponse, FullInputContextResponse, InputConditionResponse, InputValuesContextResponse, PaginatedActivityResponse, PluginForAppCreationV2Response, PluginInputValuesInConsolidatedContextResponse, ValueByEnvResponse, WorkflowForCreationResponse } from '../api/workspaceManager'
9
-
10
- interface BaseSMCStatus {
11
- /**
12
- * Indicates the current status of the SCM credential.
13
- * - 'valid': the SCM credential is valid.
14
- * - 'missing-account': the SCM credential is not configured at the account level.
15
- * - 'missing-user': the SCM credential is configured at the account level, but the SCM access is not configured for the user.
16
- */
17
- status: 'missing-account' | 'missing-user' | 'valid',
18
- }
19
-
20
- interface ValidSCMStatus extends BaseSMCStatus, AccountScmStatusResponse {
21
- status: 'valid',
22
- }
23
-
24
- interface InvalidSCMStatus extends BaseSMCStatus {
25
- status: 'missing-account' | 'missing-user',
26
- }
27
-
28
- export type SCMStatus = InvalidSCMStatus | ValidSCMStatus
29
-
30
- interface SCMAuthPATValue {
31
- user: string,
32
- pass: string,
33
- }
34
-
35
- interface SCMAuthGitValue {
36
- appId: string,
37
- installationId: string,
38
- privateKey: string,
39
- }
40
-
41
- export interface CreateSCMRequest {
42
- accountScmInfoSaveRequest: AccountScmInfoSaveRequest & {
43
- value: SCMAuthGitValue | SCMAuthPATValue,
44
- },
45
- }
46
-
47
- export interface UpdateSCMRequest {
48
- accountScmInfoUpdateRequest: AccountScmInfoUpdateRequest & {
49
- value?: SCMAuthGitValue | SCMAuthPATValue,
50
- },
51
- }
52
-
53
- export type AllocationCostType = Parameters<typeof getAllocationCostFilters>[0]['$type']
54
-
55
- export interface CostAllocationVariables {
56
- allocationCostRequest: Omit<AllocationCostRequest, 'stackSpotAccountId' | 'billingAccountId'> & {
57
- stackSpotAccountId: string,
58
- billingAccountId: string[],
59
- },
60
- }
61
-
62
- interface ServiceNameResponse {
63
- type: 'ServiceNameResponse',
64
- chargePeriod?: ChargePeriod,
65
- /** Represents an offering that can be purchased from a cloud provider. */
66
- serviceName?: string,
67
- /** Effective cost post discounts and amortizations. */
68
- effectiveCost?: number,
69
- }
70
-
71
- interface TagResponse {
72
- type: 'TagResponse',
73
- chargePeriod?: ChargePeriod,
74
- /** Tag key: Identifies a grouping attribute or category for resources or constructs. */
75
- tagKey?: string,
76
- /** Tag value: Specifies the group or category detail that the resource or construct belongs to. */
77
- tagValue?: string,
78
- /** Effective cost post discounts and amortizations. */
79
- effectiveCost?: number,
80
- }
81
-
82
- interface UsageUnitResponse {
83
- type: 'UsageUnitResponse',
84
- chargePeriod?: ChargePeriod,
85
- /** Represents an offering that can be purchased from a cloud provider. */
86
- serviceName?: string,
87
- /** Represents the volume of a given resource or service used or purchased based on the Usage Unit. */
88
- usageQuantity?: number,
89
- /** Defines the unit of measurement for the resource or service. */
90
- usageUnit?: string,
91
- /** Effective cost post discounts and amortizations. */
92
- effectiveCost?: number,
93
- }
94
-
95
- export type CostAllocationData = ServiceNameResponse | TagResponse | UsageUnitResponse
96
-
97
- export interface CostAllocationResult extends Omit<AllocationCostResponse, 'data'> {
98
- data: CostAllocationData[],
99
- }
100
-
101
- interface FixedServiceResource extends Omit<ServiceResource, 'id'> {
102
- id: string,
103
- }
104
-
105
- export interface FixedManagedService extends Omit<ManagedService, 'resources'> {
106
- resources: FixedServiceResource[],
107
- }
108
-
109
- export interface FixedConnectAccountRequestV2 extends ConnectAccountRequestV2 {
110
- credential?: {
111
- iamRole?: string,
112
- clientId?: string,
113
- clientSecret?: string,
114
- tenantId?: string,
115
- subscriptionId?: string,
116
- },
117
- }
118
-
119
- export interface FixedManagedAccountProvisionRequest extends Omit<ManagedAccountProvisionRequest, 'workspaceId'> {
120
- workspaceId: string,
121
- }
122
-
123
- export interface FixedPluginForAppCreationV2Response extends Omit<PluginForAppCreationV2Response, 'inputs'> {
124
- inputs: FixedPluginInputValuesInConsolidatedContextResponse[],
125
- }
126
-
127
- export type InputType = 'BOOL' | 'INT' | 'MULTISELECT' | 'OBJECT' | 'LIST' | 'REQUIRED-CONNECTION' | 'PASSWORD' |
128
- 'SELECT' | 'TEXT' | 'GENERATED-CONNECTION' | 'TEXTAREA' | 'IMPORT'
129
-
130
- export interface FixedInputConditionResponse extends Omit<InputConditionResponse, 'value'> {
131
- value?: any,
132
- }
133
-
134
- export interface FixedValueByEnvResponse extends Omit<ValueByEnvResponse, 'value'> {
135
- value: any,
136
- }
137
-
138
- export interface FixedInputValuesContextResponse extends Omit<InputValuesContextResponse,
139
- 'inputs' | 'input' | 'type' | 'default' | 'condition' | 'valuesByEnv'> {
140
- inputs: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>[],
141
- input?: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>,
142
- type: InputType,
143
- default?: any,
144
- condition?: FixedInputConditionResponse,
145
- valuesByEnv: FixedValueByEnvResponse[],
146
- scope?: 'default' | 'hidden' | 'env',
147
- }
148
-
149
- export interface FixedFullInputContextResponse extends Omit<FullInputContextResponse, 'inputs'> {
150
- inputs: FixedInputValuesContextResponse[],
151
- }
152
- export interface FixedWorkflowForCreationResponse extends Omit<WorkflowForCreationResponse, 'inputs'> {
153
- inputs: FixedInputValuesContextResponse[],
154
- }
155
-
156
- export interface FixedPluginInputValuesInConsolidatedContextResponse extends
157
- Omit<PluginInputValuesInConsolidatedContextResponse, 'inputs' | 'input' | 'type' | 'default' | 'condition'> {
158
- inputs: FixedInputValuesContextResponse[],
159
- input?: FixedInputValuesContextResponse,
160
- type: InputType,
161
- default?: any,
162
- condition?: FixedInputConditionResponse,
163
- }
164
-
165
- export interface FixedActivityResponse extends Omit<ActivityResponse, 'detail'> {
166
- detail: any,
167
- }
168
-
169
- export interface FixedPaginatedActivityResponse extends Omit<PaginatedActivityResponse, 'items'> {
170
- items: FixedActivityResponse[],
171
- }
172
-
173
- export interface FixedChatRequest extends ChatRequest {
174
- context?: {
175
- workspace?: string,
176
- conversation_id?: string,
177
- stack_id?: string,
178
- language?: string,
179
- project_recent_files?: string,
180
- knowledge_sources?: string[],
181
- agent_id?: string,
182
- agent_built_in?: boolean,
183
- platform?: string,
184
- platform_version?: string,
185
- stackspot_ai_version?: string,
186
- os?: string,
187
- upload_ids?: string[],
188
- },
189
- }
190
-
191
- export interface FixedConversationHistoryResponse extends ConversationHistoryResponse {
192
- sources: ChatResponse3['sources'],
193
- custom_agent?: {
194
- id: string,
195
- built_in: boolean,
196
- },
197
- }
198
-
199
- export interface FixedConversationResponse extends ConversationResponse {
200
- history?: FixedConversationHistoryResponse[],
201
- }
202
-
203
- export interface FixedContentDependencyResponse extends ContentDependencyResponse {
204
- type: 'agent' | 'knowledge-source' | 'quick-command',
205
- visibility: 'account' | 'personal' | 'shared',
206
- }
207
-
208
- export interface FixedDependencyResponse extends DependencyResponse {
209
- promote_contents?: FixedContentDependencyResponse[] | null,
210
- promote_error_list?: FixedContentDependencyResponse[] | null,
211
- missing_list?: FixedContentDependencyResponse[] | null,
212
- delete_contents?: FixedContentDependencyResponse[] | null,
213
- }
214
-
215
- export interface WorkspaceAiMembersPermissions {
216
- items: (MembersFromResourceResponse & { actions: Action[] })[],
217
- page: number,
218
- size: number,
219
- totalPages: number,
220
- }
221
-
222
-
223
- export interface WorkspaceAiGroupsPermissions extends GroupsFromResourceResponse {
224
- actions: Action[],
225
- }
226
-
227
- export interface FixedWorkspaceAiPermissions {
228
- members?: WorkspaceAiMembersPermissions,
229
- groups?: WorkspaceAiGroupsPermissions[],
230
- }
231
-
232
- export interface FixedAddResourceToWorkspaceAi {
233
- error_ids: string[],
234
- }
235
-
236
- export interface ChatAgentTool {
237
- id: string,
238
- executionId?: string,
239
- /**
240
- * Duration in seconds.
241
- */
242
- duration?: number,
243
- name: string,
244
- description?: string,
245
- image?: string,
246
- input?: string,
247
- output?: string,
248
- goal: string,
249
- }
250
-
251
- export interface ChatStepAttempt {
252
- /**
253
- * The tools used by this step.
254
- */
255
- tools?: Partial<ChatAgentTool>[],
256
- }
257
-
258
- export interface BaseChatStep {
259
- id: string,
260
- type: 'planning' | 'step' | 'answer' | 'tool',
261
- status: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval',
262
- /**
263
- * Duration in seconds.
264
- */
265
- duration?: number,
266
- }
267
-
268
- export interface PlanningChatStep extends BaseChatStep {
269
- type: 'planning',
270
- status: 'success' | 'awaiting_approval',
271
- steps: string[],
272
- goal: string,
273
- user_question?: string,
274
- }
275
-
276
- export interface ToolChatStep extends BaseChatStep {
277
- type: 'tool',
278
- status: 'running' | 'success' | 'error' | 'awaiting_approval',
279
- /**
280
- * Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
281
- * only one element.
282
- *
283
- * This array never has less than one element, despite the step's status.
284
- */
285
- attempts: ChatStepAttempt[],
286
- input?: Record<string, any>,
287
- user_question?: string,
288
- }
289
-
290
- export interface StepChatStep extends BaseChatStep {
291
- type: 'step',
292
- /**
293
- * Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
294
- * only one element.
295
- *
296
- * This array never has less than one element, despite the step's status.
297
- */
298
- attempts: ChatStepAttempt[],
299
- input?: string,
300
- output?: string,
301
- }
302
-
303
- export interface AnswerChatStep extends BaseChatStep {
304
- type: 'answer',
305
- }
306
-
307
- export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep | ToolChatStep
308
-
309
- export interface BaseAgentInfo {
310
- type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
311
- action: 'start' | 'end' | 'awaiting_approval',
312
- duration?: number,
313
- id: string,
314
- }
315
-
316
- export interface AgentTool {
317
- tool_id: string,
318
- tool_execution_id: string,
319
- goal: string,
320
- }
321
-
322
- export interface PlanningAgentInfo extends BaseAgentInfo {
323
- type: 'planning',
324
- data?: {
325
- plan_goal: string,
326
- total_steps: number,
327
- steps: {
328
- id: string,
329
- goal: string,
330
- tools?: AgentTool[],
331
- }[],
332
- user_question?: string,
333
- },
334
- }
335
-
336
- export interface StepAgentInfo extends BaseAgentInfo {
337
- type: 'step',
338
- id: string,
339
- }
340
-
341
- export interface ToolAgentInfo extends BaseAgentInfo {
342
- type: 'tool',
343
- id: string,
344
- data?: {
345
- input?: any,
346
- attempt: number,
347
- output?: string,
348
- user_question?: string,
349
- tool_id: string,
350
- },
351
- }
352
-
353
- export interface GenericAgentInfo extends BaseAgentInfo {
354
- type: 'chat' | 'final_answer',
355
- }
356
-
357
- export type AgentInfo = GenericAgentInfo | PlanningAgentInfo | StepAgentInfo | ToolAgentInfo
358
-
359
- export interface FixedChatResponse extends ChatResponse3 {
360
- agent_info: AgentInfo,
361
- tools?: string[],
362
- }
363
-
364
- export interface ChatResponseWithSteps extends FixedChatResponse {
365
- steps: ChatStep[],
366
- }
367
-
368
- export type OazapftsFunction<Variables = any, Result = any> = (variables: Variables, opts?: RequestOpts) => Promise<Result>
369
-
370
- type Unpromisify<T> = T extends Promise<infer R> ? Unpromisify<R> : T
371
-
372
- export type FixVariables<
373
- T extends OazapftsFunction,
374
- Fix extends Record<string, any>,
375
- > = OazapftsFunction<
376
- Omit<Parameters<T>[0], keyof Fix> & { [K in keyof Fix as Fix[K] extends never ? never : K]: Fix[K] },
377
- Unpromisify<ReturnType<T>>
378
- >
379
-
380
- export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
381
-
382
- export interface AgentResponseWithBuiltIn extends Omit<ListAgentResponse, 'conversation_starter' | 'avatar'> {
383
- builtIn?: boolean,
384
- spaceName?: string,
385
- conversation_starter?: string[] | null,
386
- avatar?: string | null | undefined,
387
- }
388
-
389
- export type AgentVisibilityLevel = AgentVisibilityLevelEnum | VisibilityLevelEnum
390
-
391
- export interface AgentToolsOpenAPIPreview {
392
- name: string,
393
- description: string,
394
- method: HttpMethod,
395
- url: string,
396
- parameters?: Record<string, any>,
397
- request_body?: Record<string, any>,
398
- }
1
+ import { RequestOpts } from '@oazapfts/runtime'
2
+ import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse, GroupsFromResourceResponse, MembersFromResourceResponse } from '../api/account'
3
+ import { AgentVisibilityLevelEnum, HttpMethod, ListAgentResponse, VisibilityLevelEnum } from '../api/agent-tools'
4
+ import { ChatRequest, ChatResponse3, ContentDependencyResponse, ConversationHistoryResponse, ConversationResponse, DependencyResponse } from '../api/ai'
5
+ import { ConnectAccountRequestV2, ManagedAccountProvisionRequest } from '../api/cloudAccount'
6
+ import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
7
+ import { Action } from '../api/workspace-ai'
8
+ import { ActivityResponse, FullInputContextResponse, InputConditionResponse, InputValuesContextResponse, PaginatedActivityResponse, PluginForAppCreationV2Response, PluginInputValuesInConsolidatedContextResponse, ValueByEnvResponse, WorkflowForCreationResponse } from '../api/workspaceManager'
9
+
10
+ interface BaseSMCStatus {
11
+ /**
12
+ * Indicates the current status of the SCM credential.
13
+ * - 'valid': the SCM credential is valid.
14
+ * - 'missing-account': the SCM credential is not configured at the account level.
15
+ * - 'missing-user': the SCM credential is configured at the account level, but the SCM access is not configured for the user.
16
+ */
17
+ status: 'missing-account' | 'missing-user' | 'valid',
18
+ }
19
+
20
+ interface ValidSCMStatus extends BaseSMCStatus, AccountScmStatusResponse {
21
+ status: 'valid',
22
+ }
23
+
24
+ interface InvalidSCMStatus extends BaseSMCStatus {
25
+ status: 'missing-account' | 'missing-user',
26
+ }
27
+
28
+ export type SCMStatus = InvalidSCMStatus | ValidSCMStatus
29
+
30
+ interface SCMAuthPATValue {
31
+ user: string,
32
+ pass: string,
33
+ }
34
+
35
+ interface SCMAuthGitValue {
36
+ appId: string,
37
+ installationId: string,
38
+ privateKey: string,
39
+ }
40
+
41
+ export interface CreateSCMRequest {
42
+ accountScmInfoSaveRequest: AccountScmInfoSaveRequest & {
43
+ value: SCMAuthGitValue | SCMAuthPATValue,
44
+ },
45
+ }
46
+
47
+ export interface UpdateSCMRequest {
48
+ accountScmInfoUpdateRequest: AccountScmInfoUpdateRequest & {
49
+ value?: SCMAuthGitValue | SCMAuthPATValue,
50
+ },
51
+ }
52
+
53
+ export type AllocationCostType = Parameters<typeof getAllocationCostFilters>[0]['$type']
54
+
55
+ export interface CostAllocationVariables {
56
+ allocationCostRequest: Omit<AllocationCostRequest, 'stackSpotAccountId' | 'billingAccountId'> & {
57
+ stackSpotAccountId: string,
58
+ billingAccountId: string[],
59
+ },
60
+ }
61
+
62
+ interface ServiceNameResponse {
63
+ type: 'ServiceNameResponse',
64
+ chargePeriod?: ChargePeriod,
65
+ /** Represents an offering that can be purchased from a cloud provider. */
66
+ serviceName?: string,
67
+ /** Effective cost post discounts and amortizations. */
68
+ effectiveCost?: number,
69
+ }
70
+
71
+ interface TagResponse {
72
+ type: 'TagResponse',
73
+ chargePeriod?: ChargePeriod,
74
+ /** Tag key: Identifies a grouping attribute or category for resources or constructs. */
75
+ tagKey?: string,
76
+ /** Tag value: Specifies the group or category detail that the resource or construct belongs to. */
77
+ tagValue?: string,
78
+ /** Effective cost post discounts and amortizations. */
79
+ effectiveCost?: number,
80
+ }
81
+
82
+ interface UsageUnitResponse {
83
+ type: 'UsageUnitResponse',
84
+ chargePeriod?: ChargePeriod,
85
+ /** Represents an offering that can be purchased from a cloud provider. */
86
+ serviceName?: string,
87
+ /** Represents the volume of a given resource or service used or purchased based on the Usage Unit. */
88
+ usageQuantity?: number,
89
+ /** Defines the unit of measurement for the resource or service. */
90
+ usageUnit?: string,
91
+ /** Effective cost post discounts and amortizations. */
92
+ effectiveCost?: number,
93
+ }
94
+
95
+ export type CostAllocationData = ServiceNameResponse | TagResponse | UsageUnitResponse
96
+
97
+ export interface CostAllocationResult extends Omit<AllocationCostResponse, 'data'> {
98
+ data: CostAllocationData[],
99
+ }
100
+
101
+ interface FixedServiceResource extends Omit<ServiceResource, 'id'> {
102
+ id: string,
103
+ }
104
+
105
+ export interface FixedManagedService extends Omit<ManagedService, 'resources'> {
106
+ resources: FixedServiceResource[],
107
+ }
108
+
109
+ export interface FixedConnectAccountRequestV2 extends ConnectAccountRequestV2 {
110
+ credential?: {
111
+ iamRole?: string,
112
+ clientId?: string,
113
+ clientSecret?: string,
114
+ tenantId?: string,
115
+ subscriptionId?: string,
116
+ },
117
+ }
118
+
119
+ export interface FixedManagedAccountProvisionRequest extends Omit<ManagedAccountProvisionRequest, 'workspaceId'> {
120
+ workspaceId: string,
121
+ }
122
+
123
+ export interface FixedPluginForAppCreationV2Response extends Omit<PluginForAppCreationV2Response, 'inputs'> {
124
+ inputs: FixedPluginInputValuesInConsolidatedContextResponse[],
125
+ }
126
+
127
+ export type InputType = 'BOOL' | 'INT' | 'MULTISELECT' | 'OBJECT' | 'LIST' | 'REQUIRED-CONNECTION' | 'PASSWORD' |
128
+ 'SELECT' | 'TEXT' | 'GENERATED-CONNECTION' | 'TEXTAREA' | 'IMPORT'
129
+
130
+ export interface FixedInputConditionResponse extends Omit<InputConditionResponse, 'value'> {
131
+ value?: any,
132
+ }
133
+
134
+ export interface FixedValueByEnvResponse extends Omit<ValueByEnvResponse, 'value'> {
135
+ value: any,
136
+ }
137
+
138
+ export interface FixedInputValuesContextResponse extends Omit<InputValuesContextResponse,
139
+ 'inputs' | 'input' | 'type' | 'default' | 'condition' | 'valuesByEnv'> {
140
+ inputs: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>[],
141
+ input?: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>,
142
+ type: InputType,
143
+ default?: any,
144
+ condition?: FixedInputConditionResponse,
145
+ valuesByEnv: FixedValueByEnvResponse[],
146
+ scope?: 'default' | 'hidden' | 'env',
147
+ }
148
+
149
+ export interface FixedFullInputContextResponse extends Omit<FullInputContextResponse, 'inputs'> {
150
+ inputs: FixedInputValuesContextResponse[],
151
+ }
152
+ export interface FixedWorkflowForCreationResponse extends Omit<WorkflowForCreationResponse, 'inputs'> {
153
+ inputs: FixedInputValuesContextResponse[],
154
+ }
155
+
156
+ export interface FixedPluginInputValuesInConsolidatedContextResponse extends
157
+ Omit<PluginInputValuesInConsolidatedContextResponse, 'inputs' | 'input' | 'type' | 'default' | 'condition'> {
158
+ inputs: FixedInputValuesContextResponse[],
159
+ input?: FixedInputValuesContextResponse,
160
+ type: InputType,
161
+ default?: any,
162
+ condition?: FixedInputConditionResponse,
163
+ }
164
+
165
+ export interface FixedActivityResponse extends Omit<ActivityResponse, 'detail'> {
166
+ detail: any,
167
+ }
168
+
169
+ export interface FixedPaginatedActivityResponse extends Omit<PaginatedActivityResponse, 'items'> {
170
+ items: FixedActivityResponse[],
171
+ }
172
+
173
+ export interface FixedChatRequest extends ChatRequest {
174
+ context?: {
175
+ workspace?: string,
176
+ conversation_id?: string,
177
+ stack_id?: string,
178
+ language?: string,
179
+ project_recent_files?: string,
180
+ knowledge_sources?: string[],
181
+ agent_id?: string,
182
+ agent_built_in?: boolean,
183
+ platform?: string,
184
+ platform_version?: string,
185
+ stackspot_ai_version?: string,
186
+ os?: string,
187
+ upload_ids?: string[],
188
+ },
189
+ }
190
+
191
+ export interface FixedConversationHistoryResponse extends ConversationHistoryResponse {
192
+ sources: ChatResponse3['sources'],
193
+ custom_agent?: {
194
+ id: string,
195
+ built_in: boolean,
196
+ },
197
+ }
198
+
199
+ export interface FixedConversationResponse extends ConversationResponse {
200
+ history?: FixedConversationHistoryResponse[],
201
+ }
202
+
203
+ export interface FixedContentDependencyResponse extends ContentDependencyResponse {
204
+ type: 'agent' | 'knowledge-source' | 'quick-command',
205
+ visibility: 'account' | 'personal' | 'shared',
206
+ }
207
+
208
+ export interface FixedDependencyResponse extends DependencyResponse {
209
+ promote_contents?: FixedContentDependencyResponse[] | null,
210
+ promote_error_list?: FixedContentDependencyResponse[] | null,
211
+ missing_list?: FixedContentDependencyResponse[] | null,
212
+ delete_contents?: FixedContentDependencyResponse[] | null,
213
+ }
214
+
215
+ export interface WorkspaceAiMembersPermissions {
216
+ items: (MembersFromResourceResponse & { actions: Action[] })[],
217
+ page: number,
218
+ size: number,
219
+ totalPages: number,
220
+ }
221
+
222
+
223
+ export interface WorkspaceAiGroupsPermissions extends GroupsFromResourceResponse {
224
+ actions: Action[],
225
+ }
226
+
227
+ export interface FixedWorkspaceAiPermissions {
228
+ members?: WorkspaceAiMembersPermissions,
229
+ groups?: WorkspaceAiGroupsPermissions[],
230
+ }
231
+
232
+ export interface FixedAddResourceToWorkspaceAi {
233
+ error_ids: string[],
234
+ }
235
+
236
+ export interface ChatAgentTool {
237
+ id: string,
238
+ executionId?: string,
239
+ /**
240
+ * Duration in seconds.
241
+ */
242
+ duration?: number,
243
+ name: string,
244
+ description?: string,
245
+ image?: string,
246
+ input?: string,
247
+ output?: string,
248
+ }
249
+
250
+ export interface ChatStepAttempt {
251
+ /**
252
+ * The tools used by this step.
253
+ */
254
+ tools?: ChatAgentTool[],
255
+ }
256
+
257
+ export interface BaseChatStep {
258
+ id: string,
259
+ type: 'planning' | 'step' | 'answer',
260
+ status: 'pending' | 'running' | 'success' | 'error',
261
+ /**
262
+ * Duration in seconds.
263
+ */
264
+ duration?: number,
265
+ }
266
+
267
+ export interface PlanningChatStep extends BaseChatStep {
268
+ type: 'planning',
269
+ status: 'success',
270
+ steps: string[],
271
+ goal: string,
272
+ }
273
+
274
+ export interface StepChatStep extends BaseChatStep {
275
+ type: 'step',
276
+ /**
277
+ * Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
278
+ * only one element.
279
+ *
280
+ * This array never has less than one element, despite the step's status.
281
+ */
282
+ attempts: ChatStepAttempt[],
283
+ input?: string,
284
+ output?: string,
285
+ }
286
+
287
+ export interface AnswerChatStep extends BaseChatStep {
288
+ type: 'answer',
289
+ }
290
+
291
+ export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
292
+
293
+ export interface BaseAgentInfo {
294
+ type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
295
+ action: 'start' | 'end',
296
+ duration?: number,
297
+ }
298
+
299
+ export interface AgentTool {
300
+ tool_id: string,
301
+ tool_execution_id: string,
302
+ }
303
+
304
+ export interface PlanningAgentInfo extends BaseAgentInfo {
305
+ type: 'planning',
306
+ data?: {
307
+ plan_goal: string,
308
+ total_steps: number,
309
+ steps: {
310
+ id: string,
311
+ goal: string,
312
+ tools?: AgentTool[],
313
+ }[],
314
+ },
315
+ }
316
+
317
+ export interface StepAgentInfo extends BaseAgentInfo {
318
+ type: 'step',
319
+ id: string,
320
+ }
321
+
322
+ export interface ToolAgentInfo extends BaseAgentInfo {
323
+ type: 'tool',
324
+ id: string,
325
+ data?: {
326
+ input?: any,
327
+ attempt: number,
328
+ output?: string,
329
+ },
330
+ }
331
+
332
+ export interface GenericAgentInfo extends BaseAgentInfo {
333
+ type: 'chat' | 'final_answer',
334
+ }
335
+
336
+ export type AgentInfo = GenericAgentInfo | PlanningAgentInfo | StepAgentInfo | ToolAgentInfo
337
+
338
+ export interface FixedChatResponse extends ChatResponse3 {
339
+ agent_info: AgentInfo,
340
+ tools?: string[],
341
+ }
342
+
343
+ export interface ChatResponseWithSteps extends FixedChatResponse {
344
+ steps: ChatStep[],
345
+ }
346
+
347
+ export type OazapftsFunction<Variables = any, Result = any> = (variables: Variables, opts?: RequestOpts) => Promise<Result>
348
+
349
+ type Unpromisify<T> = T extends Promise<infer R> ? Unpromisify<R> : T
350
+
351
+ export type FixVariables<
352
+ T extends OazapftsFunction,
353
+ Fix extends Record<string, any>,
354
+ > = OazapftsFunction<
355
+ Omit<Parameters<T>[0], keyof Fix> & { [K in keyof Fix as Fix[K] extends never ? never : K]: Fix[K] },
356
+ Unpromisify<ReturnType<T>>
357
+ >
358
+
359
+ export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
360
+
361
+ export interface AgentResponseWithBuiltIn extends Omit<ListAgentResponse, 'conversation_starter' | 'avatar'> {
362
+ builtIn?: boolean,
363
+ spaceName?: string,
364
+ conversation_starter?: string[] | null,
365
+ avatar?: string | null | undefined,
366
+ }
367
+
368
+ export type AgentVisibilityLevel = AgentVisibilityLevelEnum | VisibilityLevelEnum
369
+
370
+ export interface AgentToolsOpenAPIPreview {
371
+ name: string,
372
+ description: string,
373
+ method: HttpMethod,
374
+ url: string,
375
+ parameters?: Record<string, any>,
376
+ request_body?: Record<string, any>,
377
+ }