@stack-spot/portal-network 0.193.0-alpha.1 → 0.193.0-beta.1

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 (87) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/dist/api/account.d.ts +4 -116
  3. package/dist/api/account.d.ts.map +1 -1
  4. package/dist/api/account.js +9 -95
  5. package/dist/api/account.js.map +1 -1
  6. package/dist/api/ai.d.ts +189 -86
  7. package/dist/api/ai.d.ts.map +1 -1
  8. package/dist/api/ai.js +238 -142
  9. package/dist/api/ai.js.map +1 -1
  10. package/dist/api/cloudPlatform.d.ts +73 -126
  11. package/dist/api/cloudPlatform.d.ts.map +1 -1
  12. package/dist/api/cloudPlatform.js +82 -66
  13. package/dist/api/cloudPlatform.js.map +1 -1
  14. package/dist/api/codeShift.d.ts +171 -40
  15. package/dist/api/codeShift.d.ts.map +1 -1
  16. package/dist/api/codeShift.js +80 -10
  17. package/dist/api/codeShift.js.map +1 -1
  18. package/dist/api/discover.d.ts +23 -12
  19. package/dist/api/discover.d.ts.map +1 -1
  20. package/dist/api/discover.js +10 -0
  21. package/dist/api/discover.js.map +1 -1
  22. package/dist/apis-itau.json +0 -8
  23. package/dist/apis.json +0 -8
  24. package/dist/client/account.d.ts +4 -0
  25. package/dist/client/account.d.ts.map +1 -1
  26. package/dist/client/account.js +10 -1
  27. package/dist/client/account.js.map +1 -1
  28. package/dist/client/ai.d.ts +46 -0
  29. package/dist/client/ai.d.ts.map +1 -1
  30. package/dist/client/ai.js +140 -15
  31. package/dist/client/ai.js.map +1 -1
  32. package/dist/client/cloud-platform.d.ts +155 -51
  33. package/dist/client/cloud-platform.d.ts.map +1 -1
  34. package/dist/client/cloud-platform.js +146 -47
  35. package/dist/client/cloud-platform.js.map +1 -1
  36. package/dist/client/code-shift.d.ts +53 -3
  37. package/dist/client/code-shift.d.ts.map +1 -1
  38. package/dist/client/code-shift.js +55 -1
  39. package/dist/client/code-shift.js.map +1 -1
  40. package/dist/client/discover.d.ts +7 -1
  41. package/dist/client/discover.d.ts.map +1 -1
  42. package/dist/client/discover.js +208 -0
  43. package/dist/client/discover.js.map +1 -1
  44. package/dist/client/types.d.ts +39 -5
  45. package/dist/client/types.d.ts.map +1 -1
  46. package/dist/error/dictionary/cloud-platform.d.ts +6 -0
  47. package/dist/error/dictionary/cloud-platform.d.ts.map +1 -1
  48. package/dist/error/dictionary/cloud-platform.js +6 -0
  49. package/dist/error/dictionary/cloud-platform.js.map +1 -1
  50. package/dist/index.d.ts +0 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +0 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/utils/StreamedJson.d.ts.map +1 -1
  55. package/dist/utils/StreamedJson.js +9 -1
  56. package/dist/utils/StreamedJson.js.map +1 -1
  57. package/package.json +2 -2
  58. package/readme.md +2 -1
  59. package/src/api/account.ts +21 -192
  60. package/src/api/agent-tools.ts +3 -0
  61. package/src/api/agent.ts +2 -0
  62. package/src/api/ai.ts +364 -157
  63. package/src/api/cloudPlatform.ts +147 -204
  64. package/src/api/codeShift.ts +284 -45
  65. package/src/api/discover.ts +35 -12
  66. package/src/api/notification.ts +2 -0
  67. package/src/apis-itau.json +0 -8
  68. package/src/apis.json +0 -8
  69. package/src/client/account.ts +5 -0
  70. package/src/client/ai.ts +136 -13
  71. package/src/client/cloud-platform.ts +84 -29
  72. package/src/client/code-shift.ts +30 -1
  73. package/src/client/discover.ts +220 -3
  74. package/src/client/types.ts +43 -7
  75. package/src/error/dictionary/cloud-platform.ts +6 -0
  76. package/src/index.ts +0 -1
  77. package/src/utils/StreamedJson.tsx +9 -2
  78. package/dist/api/codeGen.d.ts +0 -51
  79. package/dist/api/codeGen.d.ts.map +0 -1
  80. package/dist/api/codeGen.js +0 -49
  81. package/dist/api/codeGen.js.map +0 -1
  82. package/dist/client/code-gen.d.ts +0 -14
  83. package/dist/client/code-gen.d.ts.map +0 -1
  84. package/dist/client/code-gen.js +0 -35
  85. package/dist/client/code-gen.js.map +0 -1
  86. package/src/api/codeGen.ts +0 -92
  87. package/src/client/code-gen.ts +0 -45
@@ -1,12 +1,17 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
+ import { findLast, last } from 'lodash'
2
3
  import { getApiAddresses } from '../api-addresses'
3
4
  import { ConversationResponse } from '../api/ai'
4
- import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse } from '../api/discover'
5
+ import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse, MessageRequest } from '../api/discover'
5
6
  import { DefaultAPIError } from '../error/DefaultAPIError'
6
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
8
+ import { StreamedJson } from '../utils/StreamedJson'
7
9
  import { baseDictionary } from '../error/dictionary/base'
10
+ import { formatJson } from '../utils/string'
8
11
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
9
12
  import { aiClient } from './ai'
13
+ import { ChatAgentTool, ChatResponseWithSteps, FixedChatResponse, StepChatStep } from './types'
14
+ import { agentToolsClient } from './agent-tools'
10
15
 
11
16
  export interface ChatConversionDetails extends ConversationResponse {
12
17
  opportunityName?: string,
@@ -67,8 +72,8 @@ class DiscoverClient extends ReactQueryNetworkClient {
67
72
  { ...variables, page: variables.page, size: variables.size ?? 40 },
68
73
  )
69
74
 
70
- const filteredItems = variables.filter
71
- ? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
75
+ const filteredItems = variables.filter
76
+ ? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
72
77
  : chatsHistory
73
78
 
74
79
  const enrichedChats = filteredItems?.map(chat => {
@@ -84,6 +89,218 @@ class DiscoverClient extends ReactQueryNetworkClient {
84
89
  return enrichedChats as ChatConversionDetails[]
85
90
  },
86
91
  })
92
+
93
+ private static async toolsOfAgent(agentId?: string) {
94
+ try {
95
+ const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
96
+ if (!agent) return []
97
+ const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
98
+ agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
99
+ if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
100
+ }))
101
+ agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
102
+ if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
103
+ }))
104
+ return tools
105
+ } catch {
106
+ return []
107
+ }
108
+ }
109
+
110
+
111
+ sendChatMessage(request: MessageRequest & { agentId: string }, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps> {
112
+ const abortController = new AbortController()
113
+ const headers = {
114
+ 'Content-Type': 'application/json',
115
+ 'Accept': 'text/event-stream',
116
+ }
117
+ const events = this.stream(
118
+ this.resolveURL('/v2/ai/chat'),
119
+ { method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal },
120
+ )
121
+ /**
122
+ * This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
123
+ * normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
124
+ * StreamedJson object whenever an event is triggered.
125
+ */
126
+ async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
127
+ const info = event.agent_info
128
+
129
+ if (!info) return
130
+
131
+ const tools = await DiscoverClient.toolsOfAgent(request.agentId)
132
+ data.steps = data.steps ? [...data.steps] : []
133
+
134
+ if (info.type === 'planning' && info.action === 'end') {
135
+ data.steps.push({
136
+ id: 'planning',
137
+ type: 'planning',
138
+ status: 'success',
139
+ duration: info.duration || 0,
140
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
141
+ goal: info.data?.plan_goal ?? '',
142
+ })
143
+
144
+ info.data?.steps.forEach(s => data.steps?.push({
145
+ id: s.id,
146
+ type: 'step',
147
+ status: 'pending',
148
+ input: s.goal,
149
+ attempts: [{
150
+ tools: s.tools?.map(t => ({
151
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
152
+ executionId: t.tool_execution_id,
153
+ goal: t.goal,
154
+ })),
155
+ }],
156
+ }))
157
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
158
+ }
159
+
160
+ if (info.type === 'planning' && info.action === 'awaiting_approval') {
161
+ data.steps.push({
162
+ id: 'planning',
163
+ type: 'planning',
164
+ status: 'awaiting_approval',
165
+ user_question: info.data?.user_question,
166
+ duration: info.duration || 0,
167
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
168
+ goal: info.data?.plan_goal ?? '',
169
+ })
170
+ info.data?.steps.forEach(s => data.steps?.push({
171
+ id: s.id,
172
+ type: 'step',
173
+ status: 'pending',
174
+ input: s.goal,
175
+ attempts: [{
176
+ tools: s.tools?.map(t => ({
177
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
178
+ executionId: t.tool_execution_id,
179
+ goal: t.goal,
180
+ })),
181
+ }],
182
+ }))
183
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
184
+ }
185
+
186
+ if (info.type === 'step' && info.action === 'start') {
187
+ const step = data.steps.find(s => s.id === info.id)
188
+ if (step) step.status = 'running'
189
+ }
190
+
191
+ if (info.type === 'step' && info.action === 'end') {
192
+ const step = data.steps.find(s => s.id === info.id) as StepChatStep
193
+ if (step) {
194
+ step.status = 'success'
195
+ step.duration = info.duration
196
+ const lastToolId = last(step.attempts[0].tools)?.id
197
+ const lastAttemptOfLastTool = findLast(step.attempts.map(a => a.tools).flat(), t => t?.id === lastToolId)
198
+ step.output = lastAttemptOfLastTool?.output
199
+ }
200
+ }
201
+
202
+ if (info.type === 'tool' && info.action === 'awaiting_approval') {
203
+ const tool = tools.find(({ id }) => id === info.data?.tool_id)
204
+ data.steps.push({
205
+ id: info.id,
206
+ type: 'tool',
207
+ status: 'awaiting_approval',
208
+ duration: info.duration || 0,
209
+ input: info.data?.input,
210
+ user_question: info.data?.user_question,
211
+ attempts: [{
212
+ tools: [{
213
+ executionId: info.id,
214
+ id: info.data?.tool_id ?? '',
215
+ name: tool?.name ?? '',
216
+ goal: tool?.goal,
217
+ ...tool,
218
+ }],
219
+ }],
220
+ })
221
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
222
+ }
223
+
224
+ if (info.type === 'tool' && info.action === 'start') {
225
+ const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
226
+ if (!info.data) return
227
+
228
+ //There might be a tool with status awaiting_approval, so we want to inform tool has already started
229
+ if (!currentStep || !currentStep.attempts[0].tools) {
230
+ const input = formatJson(info.data.input)
231
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
232
+ data.steps.push({
233
+ id: info.id,
234
+ type: 'tool',
235
+ status: 'running',
236
+ duration: info.duration || 0,
237
+ input: info.data?.input,
238
+ user_question: info.data?.user_question,
239
+ attempts: [{
240
+ tools: [{ ...tool, executionId: info.id, input }],
241
+ }],
242
+ })
243
+ } else {
244
+ const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
245
+ //One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
246
+ //So we make sure to add any tools that are not in there.
247
+ if (!toolInFirstAttempt) {
248
+ const input = formatJson(info.data.input)
249
+ const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
250
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
251
+ ...tool,
252
+ executionId: info.id,
253
+ input,
254
+ })
255
+ } else {
256
+ const input = formatJson(info.data.input)
257
+ if (info.data.attempt === 1) {
258
+ toolInFirstAttempt.input = input
259
+ } else {
260
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
261
+ currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
262
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
263
+ ...tool,
264
+ executionId: info.id,
265
+ input,
266
+ })
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ if (info.type === 'tool' && info.action === 'end') {
273
+ const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
274
+ if (!currentStep || !info.data) return
275
+ const tool = currentStep.attempts[info.data.attempt - 1]?.tools?.find(t => t.executionId === info.id)
276
+ if (tool) {
277
+ tool.output = formatJson(info.data.output)
278
+ tool.duration = info.duration
279
+ }
280
+ }
281
+
282
+ if (info.type === 'final_answer' && info.action === 'start') {
283
+ const answerStep = last(data.steps)
284
+ if (answerStep) answerStep.status = 'running'
285
+ }
286
+
287
+ if (info.type === 'chat' && info.action === 'end') {
288
+ const answerStep = last(data.steps)
289
+ if (answerStep) {
290
+ answerStep.status = 'success'
291
+ answerStep.duration = info.duration
292
+ }
293
+ }
294
+ }
295
+
296
+ return new StreamedJson({
297
+ eventsPromise: events,
298
+ abortController,
299
+ minChangeIntervalMS,
300
+ ignoreKeys: ['agent_info'],
301
+ transform,
302
+ })
303
+ }
87
304
  }
88
305
 
89
306
  export const discoverClient = new DiscoverClient()
@@ -246,6 +246,7 @@ export interface ChatAgentTool {
246
246
  image?: string,
247
247
  input?: string,
248
248
  output?: string,
249
+ goal?: string,
249
250
  }
250
251
 
251
252
  export interface ChatStepAttempt {
@@ -257,8 +258,8 @@ export interface ChatStepAttempt {
257
258
 
258
259
  export interface BaseChatStep {
259
260
  id: string,
260
- type: 'planning' | 'step' | 'answer',
261
- status: 'pending' | 'running' | 'success' | 'error',
261
+ type: 'planning' | 'step' | 'answer' | 'tool',
262
+ status: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval',
262
263
  /**
263
264
  * Duration in seconds.
264
265
  */
@@ -267,9 +268,24 @@ export interface BaseChatStep {
267
268
 
268
269
  export interface PlanningChatStep extends BaseChatStep {
269
270
  type: 'planning',
270
- status: 'success',
271
+ status: 'success' | 'awaiting_approval',
271
272
  steps: string[],
272
273
  goal: string,
274
+ user_question?: string,
275
+ }
276
+
277
+ export interface ToolChatStep extends BaseChatStep {
278
+ type: 'tool',
279
+ status: 'running' | 'success' | 'error' | 'awaiting_approval',
280
+ /**
281
+ * Each step might attempt to run for multiple times, with different inputs and outputs. If first attempt succeeds, this array will have
282
+ * only one element.
283
+ *
284
+ * This array never has less than one element, despite the step's status.
285
+ */
286
+ attempts: ChatStepAttempt[],
287
+ input?: Record<string, any>,
288
+ user_question?: string,
273
289
  }
274
290
 
275
291
  export interface StepChatStep extends BaseChatStep {
@@ -289,17 +305,19 @@ export interface AnswerChatStep extends BaseChatStep {
289
305
  type: 'answer',
290
306
  }
291
307
 
292
- export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
308
+ export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep | ToolChatStep
293
309
 
294
310
  export interface BaseAgentInfo {
295
311
  type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
296
- action: 'start' | 'end',
312
+ action: 'start' | 'end' | 'awaiting_approval',
297
313
  duration?: number,
314
+ id: string,
298
315
  }
299
316
 
300
317
  export interface AgentTool {
301
318
  tool_id: string,
302
319
  tool_execution_id: string,
320
+ goal: string,
303
321
  }
304
322
 
305
323
  export interface PlanningAgentInfo extends BaseAgentInfo {
@@ -312,6 +330,7 @@ export interface PlanningAgentInfo extends BaseAgentInfo {
312
330
  goal: string,
313
331
  tools?: AgentTool[],
314
332
  }[],
333
+ user_question?: string,
315
334
  },
316
335
  }
317
336
 
@@ -327,6 +346,8 @@ export interface ToolAgentInfo extends BaseAgentInfo {
327
346
  input?: any,
328
347
  attempt: number,
329
348
  output?: string,
349
+ user_question?: string,
350
+ tool_id: string,
330
351
  },
331
352
  }
332
353
 
@@ -340,10 +361,25 @@ export interface FixedChatResponse extends ChatResponse3 {
340
361
  agent_info: AgentInfo,
341
362
  tools?: string[],
342
363
  }
364
+ export interface OpportunitiesPMAgent {
365
+ title: string,
366
+ description: string,
367
+ }
343
368
 
369
+ export type HypothesisPMAgent = OpportunitiesPMAgent
370
+
371
+ export type PrfaqPMAgent = {
372
+ title: string,
373
+ content: string,
374
+ }
344
375
  export interface ChatResponseWithSteps extends FixedChatResponse {
345
376
  steps: ChatStep[],
346
377
  }
378
+ export interface ChatResponseWithPMResources {
379
+ opportunities?: OpportunitiesPMAgent[],
380
+ hypothesis?: HypothesisPMAgent[],
381
+ prfaq?: PrfaqPMAgent,
382
+ }
347
383
 
348
384
  export type OazapftsFunction<Variables = any, Result = any> = (variables: Variables, opts?: RequestOpts) => Promise<Result>
349
385
 
@@ -359,12 +395,12 @@ export type FixVariables<
359
395
 
360
396
  export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
361
397
 
362
- export interface AgentResponseWithBuiltIn extends Omit<ListAgentResponse, 'conversation_starter' | 'avatar'> {
398
+ export interface AgentResponseWithBuiltIn extends Omit<ListAgentResponse, 'conversation_starter' | 'avatar'> {
363
399
  builtIn?: boolean,
364
400
  spaceName?: string,
365
401
  conversation_starter?: string[] | null,
366
402
  avatar?: string | null | undefined,
367
- }
403
+ }
368
404
 
369
405
  export type AgentVisibilityLevel = AgentVisibilityLevelEnum | VisibilityLevelEnum
370
406
 
@@ -39,6 +39,9 @@ export const scfDictionary = {
39
39
  SCF_VPN_ERROR: 'VPN operation failed.',
40
40
  SCF_VPN_NOT_FOUND_ERROR: 'VPN with ID {1} not found.',
41
41
  SCF_VPN_NOT_READY_ERROR: 'VPN with ID {1} not ready.',
42
+ SCF_DNS_ZONE_NOT_EMPTY_ERROR: 'DNS Zone with ID {1} is not empty.',
43
+ SCF_FOLDER_NOT_EMPTY_ERROR: 'Folder with ID {1} is not empty.',
44
+ SCF_PROJECT_NOT_EMPTY_ERROR: 'Project with ID {1} is not empty.',
42
45
  },
43
46
  pt: {
44
47
  SCF_CERTIFICATE_ERROR: 'Falha na operação de Certificado.',
@@ -78,5 +81,8 @@ export const scfDictionary = {
78
81
  SCF_VPN_ERROR: 'Falha na operação de VPN.',
79
82
  SCF_VPN_NOT_FOUND_ERROR: 'VPN com ID {1} não encontrada.',
80
83
  SCF_VPN_NOT_READY_ERROR: 'VPN com ID {1} não está pronta.',
84
+ SCF_DNS_ZONE_NOT_EMPTY_ERROR: 'DNS Zone com ID {1} não está vazia.',
85
+ SCF_FOLDER_NOT_EMPTY_ERROR: 'Folder com ID {1} não está vazia.',
86
+ SCF_PROJECT_NOT_EMPTY_ERROR: 'Project com ID {1} não está vazia.',
81
87
  },
82
88
  } satisfies Dictionary
package/src/index.ts CHANGED
@@ -21,7 +21,6 @@ export { insightsClient } from './client/insights'
21
21
  export { notificationClient } from './client/notification'
22
22
  export { runtimeManagerClient } from './client/runtime-manager'
23
23
  export { secretsClient } from './client/secrets'
24
- export { codeGenClient } from './client/code-gen'
25
24
  export * from './client/types'
26
25
  export { workflowClient } from './client/workflow'
27
26
  export { workspaceClient } from './client/workspace'
@@ -64,7 +64,14 @@ export class StreamedJson<T> {
64
64
  for await (const event of events) {
65
65
  if (this.error) return
66
66
  if (event.data) {
67
- const json = JSON.parse(event.data)
67
+ let json
68
+ try {
69
+ json = JSON.parse(event.data)
70
+ } catch (e) {
71
+ // eslint-disable-next-line no-console
72
+ console.warn('Mal formed JSON in streaming:', event.data)
73
+ continue
74
+ }
68
75
  await this.transform?.(json, this.data)
69
76
  this.merge(json, this.data)
70
77
  if (new Date().getTime() - lastChangeCall >= minChangeIntervalMS) {
@@ -138,7 +145,7 @@ export class StreamedJson<T> {
138
145
  onChange(listener: (value: Partial<T>) => void) {
139
146
  if (this.fullPromise.resolved) {
140
147
  listener(this.data)
141
- return () => {}
148
+ return () => { }
142
149
  }
143
150
  this.onChangeListeners.push(listener)
144
151
  return () => {
@@ -1,51 +0,0 @@
1
- /**
2
- * FastAPI
3
- * 0.1.0
4
- * DO NOT MODIFY - This file has been generated using oazapfts.
5
- * See https://www.npmjs.com/package/oazapfts
6
- */
7
- import * as Oazapfts from "@oazapfts/runtime";
8
- export declare const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders>;
9
- export declare const servers: {};
10
- export type TaskCreateRequest = {
11
- repo_url: string;
12
- prompt: string;
13
- };
14
- export type TaskStatus = "received" | "vm_requested" | "in_progress" | "completed" | "error";
15
- export type TaskResponse = {
16
- id: string;
17
- repo_url: string;
18
- prompt: string;
19
- status: TaskStatus;
20
- };
21
- export type ValidationError = {
22
- loc: (string | number)[];
23
- msg: string;
24
- "type": string;
25
- };
26
- export type HttpValidationError = {
27
- detail?: ValidationError[];
28
- };
29
- /**
30
- * Read Healthz
31
- */
32
- export declare function readHealthzHealthzGet(opts?: Oazapfts.RequestOpts): Promise<{
33
- [key: string]: string;
34
- }>;
35
- /**
36
- * Create Task
37
- */
38
- export declare function createTaskV1TasksPost({ taskCreateRequest }: {
39
- taskCreateRequest: TaskCreateRequest;
40
- }, opts?: Oazapfts.RequestOpts): Promise<TaskResponse>;
41
- /**
42
- * Perform Task Action
43
- */
44
- export declare function performTaskActionV1TasksTaskIdActionsPost(opts?: Oazapfts.RequestOpts): Promise<any>;
45
- /**
46
- * Sse Endpoint
47
- */
48
- export declare function sseEndpointV1SseTasksTaskIdUpdatesGet({ taskId }: {
49
- taskId: string;
50
- }, opts?: Oazapfts.RequestOpts): Promise<any>;
51
- //# sourceMappingURL=codeGen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeGen.d.ts","sourceRoot":"","sources":["../../src/api/codeGen.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAG9D,CAAC;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC;AAC1B,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,OAAO,CAAC;AAC7F,MAAM,MAAM,YAAY,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AACF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW;;GAShE;AACD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,iBAAiB,EAAE,EAAE;IACzD,iBAAiB,EAAE,iBAAiB,CAAC;CACxC,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,yBAY7B;AACD;;GAEG;AACH,wBAAgB,yCAAyC,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,gBAQpF;AACD;;GAEG;AACH,wBAAgB,qCAAqC,CAAC,EAAE,MAAM,EAAE,EAAE;IAC9D,MAAM,EAAE,MAAM,CAAC;CAClB,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,gBAU7B"}
@@ -1,49 +0,0 @@
1
- /**
2
- * FastAPI
3
- * 0.1.0
4
- * DO NOT MODIFY - This file has been generated using oazapfts.
5
- * See https://www.npmjs.com/package/oazapfts
6
- */
7
- import * as Oazapfts from "@oazapfts/runtime";
8
- export const defaults = {
9
- headers: {},
10
- baseUrl: "/",
11
- };
12
- const oazapfts = Oazapfts.runtime(defaults);
13
- export const servers = {};
14
- /**
15
- * Read Healthz
16
- */
17
- export function readHealthzHealthzGet(opts) {
18
- return oazapfts.ok(oazapfts.fetchJson("/healthz", {
19
- ...opts
20
- }));
21
- }
22
- /**
23
- * Create Task
24
- */
25
- export function createTaskV1TasksPost({ taskCreateRequest }, opts) {
26
- return oazapfts.ok(oazapfts.fetchJson("/v1/tasks", oazapfts.json({
27
- ...opts,
28
- method: "POST",
29
- body: taskCreateRequest
30
- })));
31
- }
32
- /**
33
- * Perform Task Action
34
- */
35
- export function performTaskActionV1TasksTaskIdActionsPost(opts) {
36
- return oazapfts.ok(oazapfts.fetchJson(`/v1/tasks/${encodeURIComponent(taskId)}/actions`, {
37
- ...opts,
38
- method: "POST"
39
- }));
40
- }
41
- /**
42
- * Sse Endpoint
43
- */
44
- export function sseEndpointV1SseTasksTaskIdUpdatesGet({ taskId }, opts) {
45
- return oazapfts.ok(oazapfts.fetchJson(`/v1/sse/tasks/${encodeURIComponent(taskId)}/updates`, {
46
- ...opts
47
- }));
48
- }
49
- //# sourceMappingURL=codeGen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeGen.js","sourceRoot":"","sources":["../../src/api/codeGen.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,MAAM,CAAC,MAAM,QAAQ,GAA8C;IAC/D,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,GAAG;CACf,CAAC;AACF,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAoB1B;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA2B;IAC7D,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAKlC,UAAU,EAAE;QACX,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAE,iBAAiB,EAExD,EAAE,IAA2B;IAC1B,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAMlC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC;QAC1B,GAAG,IAAI;QACP,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;KAC1B,CAAC,CAAC,CAAC,CAAC;AACT,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,yCAAyC,CAAC,IAA2B;IACjF,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAGlC,aAAa,kBAAkB,CAAC,MAAM,CAAC,UAAU,EAAE;QAClD,GAAG,IAAI;QACP,MAAM,EAAE,MAAM;KACjB,CAAC,CAAC,CAAC;AACR,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,qCAAqC,CAAC,EAAE,MAAM,EAE7D,EAAE,IAA2B;IAC1B,OAAO,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAMlC,iBAAiB,kBAAkB,CAAC,MAAM,CAAC,UAAU,EAAE;QACtD,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -1,14 +0,0 @@
1
- import { HttpError } from '@oazapfts/runtime';
2
- import { StackspotAPIError } from '../error/StackspotAPIError.js';
3
- import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
4
- declare class CodeGen extends ReactQueryNetworkClient {
5
- constructor();
6
- protected buildStackSpotError(error: HttpError): StackspotAPIError;
7
- createTask: import("../network/types.js").MutationObject<{
8
- taskCreateRequest: import("../api/codeGen.js").TaskCreateRequest;
9
- }, import("../api/codeGen.js").TaskResponse>;
10
- sseTask(taskId: string, minChangeIntervalMS?: number): any;
11
- }
12
- export declare const codeGenClient: CodeGen;
13
- export {};
14
- //# sourceMappingURL=code-gen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-gen.d.ts","sourceRoot":"","sources":["../../src/client/code-gen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAQ7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAG5E,cAAM,OAAQ,SAAQ,uBAAuB;;IAK3C,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB;IAIlE,UAAU;;8CAAuC;IAEjD,OAAO,CAAC,MAAM,EAAC,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,GAAG;CAkB1D;AAED,eAAO,MAAM,aAAa,SAAgB,CAAA"}
@@ -1,35 +0,0 @@
1
- import { getApiAddresses } from '../api-addresses.js';
2
- import { createTaskV1TasksPost, defaults, } from '../api/codeGen.js';
3
- import { DefaultAPIError } from '../error/DefaultAPIError.js';
4
- import { codeShiftDictionary } from '../error/dictionary/code-shift.js';
5
- import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
6
- import { StreamedJson } from '../utils/StreamedJson.js';
7
- class CodeGen extends ReactQueryNetworkClient {
8
- constructor() {
9
- super(getApiAddresses().codeGen.url, defaults);
10
- Object.defineProperty(this, "createTask", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: this.mutation(createTaskV1TasksPost)
15
- });
16
- }
17
- buildStackSpotError(error) {
18
- return new DefaultAPIError(error.data, error.status, codeShiftDictionary, error.headers);
19
- }
20
- sseTask(taskId, minChangeIntervalMS) {
21
- const abortController = new AbortController();
22
- const headers = {
23
- 'Content-Type': 'application/json',
24
- 'Accept': 'text/event-stream',
25
- };
26
- const events = this.stream(this.resolveURL(`/v1/sse/tasks/${taskId}/updates`), { method: 'get', headers, signal: abortController.signal });
27
- return new StreamedJson({
28
- eventsPromise: events,
29
- abortController,
30
- minChangeIntervalMS,
31
- });
32
- }
33
- }
34
- export const codeGenClient = new CodeGen();
35
- //# sourceMappingURL=code-gen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-gen.js","sourceRoot":"","sources":["../../src/client/code-gen.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,qBAAqB,EACrB,QAAQ,GACT,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,MAAM,OAAQ,SAAQ,uBAAuB;IAC3C;QACE,KAAK,CAAC,eAAe,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;QAOhD;;;;mBAAa,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC;WAAA;IANjD,CAAC;IAES,mBAAmB,CAAC,KAAgB;QAC5C,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1F,CAAC;IAID,OAAO,CAAC,MAAa,EAAE,mBAA4B;QACjD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;QAC7C,MAAM,OAAO,GAAG;YACd,cAAc,EAAE,kBAAkB;YAClC,QAAQ,EAAE,mBAAmB;SAC9B,CAAA;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CACxB,IAAI,CAAC,UAAU,CAAC,iBAAiB,MAAM,UAAU,CAAC,EAClD,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,CAC3D,CAAA;QAED,OAAO,IAAI,YAAY,CAAC;YACtB,aAAa,EAAE,MAAM;YACrB,eAAe;YACf,mBAAmB;SACpB,CAAC,CAAA;IACJ,CAAC;CAEF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAA"}