@stack-spot/portal-network 0.185.1-beta.1 → 0.186.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.
- package/CHANGELOG.md +2 -27
- package/dist/api/cloudPlatform.d.ts +38 -1
- package/dist/api/cloudPlatform.d.ts.map +1 -1
- package/dist/api/cloudPlatform.js +27 -1
- package/dist/api/cloudPlatform.js.map +1 -1
- package/dist/api/codeShift.d.ts +1 -1
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +13 -93
- package/dist/client/ai.js.map +1 -1
- package/dist/client/cloud-platform.d.ts +17 -2
- package/dist/client/cloud-platform.d.ts.map +1 -1
- package/dist/client/cloud-platform.js +19 -1
- package/dist/client/cloud-platform.js.map +1 -1
- package/dist/client/code-shift.d.ts +0 -8
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +1 -10
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +5 -25
- package/dist/client/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +1 -1
- package/src/api/account.ts +0 -1
- package/src/api/agent-tools.ts +0 -3
- package/src/api/agent.ts +0 -2
- package/src/api/cloudPlatform.ts +70 -1
- package/src/api/codeShift.ts +1 -1
- package/src/api/notification.ts +0 -2
- package/src/client/ai.ts +12 -95
- package/src/client/cloud-platform.ts +40 -31
- package/src/client/code-shift.ts +0 -7
- package/src/client/types.ts +5 -26
package/src/api/cloudPlatform.ts
CHANGED
|
@@ -69,6 +69,29 @@ export type CreateVpnRequest = {
|
|
|
69
69
|
peerCustomerGatewayIp: string;
|
|
70
70
|
destinationCidrBlock: string;
|
|
71
71
|
};
|
|
72
|
+
export type TenantDetails = {
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
75
|
+
export type TenantResponse = {
|
|
76
|
+
stackSpotAccountId: string;
|
|
77
|
+
foundationId: string;
|
|
78
|
+
tenantId: string;
|
|
79
|
+
details: TenantDetails;
|
|
80
|
+
status: "READY" | "PENDING" | "PENDING_APPROVAL" | "ERROR";
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
deletedAt?: string;
|
|
84
|
+
};
|
|
85
|
+
export type ListTenantResponse = {
|
|
86
|
+
stackSpotAccountId: string;
|
|
87
|
+
foundationId: string;
|
|
88
|
+
pendingResources: boolean;
|
|
89
|
+
content: TenantResponse[];
|
|
90
|
+
};
|
|
91
|
+
export type CreateTenantRequest = {
|
|
92
|
+
tenantName: string;
|
|
93
|
+
publicCidrs: string[];
|
|
94
|
+
};
|
|
72
95
|
export type ProjectDetails = {
|
|
73
96
|
name: string;
|
|
74
97
|
folderName: string;
|
|
@@ -425,6 +448,37 @@ export function createVpn({ authorization, foundationId, createVpnRequest }: {
|
|
|
425
448
|
})
|
|
426
449
|
})));
|
|
427
450
|
}
|
|
451
|
+
export function listTenant({ authorization, foundationId }: {
|
|
452
|
+
authorization: string;
|
|
453
|
+
foundationId: string;
|
|
454
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
455
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
456
|
+
status: 200;
|
|
457
|
+
data: ListTenantResponse;
|
|
458
|
+
}>(`/v1/foundations/${encodeURIComponent(foundationId)}/tenants`, {
|
|
459
|
+
...opts,
|
|
460
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
461
|
+
Authorization: authorization
|
|
462
|
+
})
|
|
463
|
+
}));
|
|
464
|
+
}
|
|
465
|
+
export function createTenant({ authorization, foundationId, createTenantRequest }: {
|
|
466
|
+
authorization: string;
|
|
467
|
+
foundationId: string;
|
|
468
|
+
createTenantRequest: CreateTenantRequest;
|
|
469
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
470
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
471
|
+
status: 202;
|
|
472
|
+
data: TenantResponse;
|
|
473
|
+
}>(`/v1/foundations/${encodeURIComponent(foundationId)}/tenants`, oazapfts.json({
|
|
474
|
+
...opts,
|
|
475
|
+
method: "POST",
|
|
476
|
+
body: createTenantRequest,
|
|
477
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
478
|
+
Authorization: authorization
|
|
479
|
+
})
|
|
480
|
+
})));
|
|
481
|
+
}
|
|
428
482
|
export function listProject({ authorization, foundationId, parentFolderId }: {
|
|
429
483
|
authorization: string;
|
|
430
484
|
foundationId: string;
|
|
@@ -795,7 +849,22 @@ export function getVpnConfiguration({ authorization, foundationId, vpnId }: {
|
|
|
795
849
|
})
|
|
796
850
|
}));
|
|
797
851
|
}
|
|
798
|
-
export function getProject({ authorization, foundationId,
|
|
852
|
+
export function getProject({ authorization, foundationId, tenantId }: {
|
|
853
|
+
authorization: string;
|
|
854
|
+
foundationId: string;
|
|
855
|
+
tenantId: string;
|
|
856
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
857
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
858
|
+
status: 200;
|
|
859
|
+
data: TenantResponse;
|
|
860
|
+
}>(`/v1/foundations/${encodeURIComponent(foundationId)}/tenants/${encodeURIComponent(tenantId)}`, {
|
|
861
|
+
...opts,
|
|
862
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
863
|
+
Authorization: authorization
|
|
864
|
+
})
|
|
865
|
+
}));
|
|
866
|
+
}
|
|
867
|
+
export function getProject1({ authorization, foundationId, projectId }: {
|
|
799
868
|
authorization: string;
|
|
800
869
|
foundationId: string;
|
|
801
870
|
projectId: string;
|
package/src/api/codeShift.ts
CHANGED
|
@@ -60,7 +60,7 @@ export type CreateModuleRequest = {
|
|
|
60
60
|
} | null;
|
|
61
61
|
gitAction?: GitAction | null;
|
|
62
62
|
};
|
|
63
|
-
export type ExceptionType = "CODE_SHIFT_API_0000_UNEXPECTED_ERROR" | "CODE_SHIFT_API_0001_INVALID_VALUE" | "CODE_SHIFT_API_0002_NOT_IMPLEMENTED" | "CODE_SHIFT_API_0003_NOT_FOUND" | "CODE_SHIFT_API_0004_VALIDATION_ERROR" | "CODE_SHIFT_API_0005_CONFLICT" | "CODE_SHIFT_API_0006_INVALID_REPO_URL" | "CODE_SHIFT_API_0007_FORBIDDEN" | "CODE_SHIFT_API_0008_DEFAULT_BRANCH" | "CODE_SHIFT_API_0009_INVALID_SPREADSHEET" | "CODE_SHIFT_API_0010_PR_LINK_NOT_EXISTS" | "CODE_SHIFT_API_0011_EMPTY_SPREADSHEET" | "CODE_SHIFT_API_0012_REPOSITORY_NOT_EXISTS_IN_SCM" | "CODE_SHIFT_API_0013_SCM_BRANCH_NOT_EXISTS_EXCEPTION" | "CODE_SHIFT_API_0014_ACCOUNT_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0015_INVALID_WORKFLOW_URL_EXCEPTION" | "CODE_SHIFT_API_0016_INVALID_ACTION_YAML_EXCEPTION" | "CODE_SHIFT_API_0017_FAIL_READING_ACTION_INPUTS_EXCEPTION" | "CODE_SHIFT_API_0018_MODULE_DISPATCHER_GENERIC_EXCEPTION" | "CODE_SHIFT_API_0019_GITHUB_DISPATCH_WORKFLOW_UNAUTHORIZED_EXCEPTION" | "CODE_SHIFT_API_0020_GITHUB_SAML_EXCEPTION" | "CODE_SHIFT_API_0021_GITHUB_AUTHORIZATION_ENCODING_EXCEPTION" | "CODE_SHIFT_API_0022_GITHUB_DISPATCH_WORKFLOW_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0023_GENERIC_FAILURE_SEARCHING_REPOSITORY_EXCEPTION" | "CODE_SHIFT_API_0024_COMPONENTS_MAX_SIZE_ALLOWED_EXCEPTION" | "CODE_SHIFT_API_0025_INVALID_SEARCH_REPOSITORY_STATUS_SAVE_EXCEPTION" | "CODE_SHIFT_API_0026_SEARCH_REPO_EMPTY_RESULT_EXCEPTION" | "CODE_SHIFT_API_0027_ACCOUNT_SCM_CONFIG_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0028_USER_SCM_CONFIG_NOT_FOUND_EXCEPTION" | "
|
|
63
|
+
export type ExceptionType = "CODE_SHIFT_API_0000_UNEXPECTED_ERROR" | "CODE_SHIFT_API_0001_INVALID_VALUE" | "CODE_SHIFT_API_0002_NOT_IMPLEMENTED" | "CODE_SHIFT_API_0003_NOT_FOUND" | "CODE_SHIFT_API_0004_VALIDATION_ERROR" | "CODE_SHIFT_API_0005_CONFLICT" | "CODE_SHIFT_API_0006_INVALID_REPO_URL" | "CODE_SHIFT_API_0007_FORBIDDEN" | "CODE_SHIFT_API_0008_DEFAULT_BRANCH" | "CODE_SHIFT_API_0009_INVALID_SPREADSHEET" | "CODE_SHIFT_API_0010_PR_LINK_NOT_EXISTS" | "CODE_SHIFT_API_0011_EMPTY_SPREADSHEET" | "CODE_SHIFT_API_0012_REPOSITORY_NOT_EXISTS_IN_SCM" | "CODE_SHIFT_API_0013_SCM_BRANCH_NOT_EXISTS_EXCEPTION" | "CODE_SHIFT_API_0014_ACCOUNT_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0015_INVALID_WORKFLOW_URL_EXCEPTION" | "CODE_SHIFT_API_0016_INVALID_ACTION_YAML_EXCEPTION" | "CODE_SHIFT_API_0017_FAIL_READING_ACTION_INPUTS_EXCEPTION" | "CODE_SHIFT_API_0018_MODULE_DISPATCHER_GENERIC_EXCEPTION" | "CODE_SHIFT_API_0019_GITHUB_DISPATCH_WORKFLOW_UNAUTHORIZED_EXCEPTION" | "CODE_SHIFT_API_0020_GITHUB_SAML_EXCEPTION" | "CODE_SHIFT_API_0021_GITHUB_AUTHORIZATION_ENCODING_EXCEPTION" | "CODE_SHIFT_API_0022_GITHUB_DISPATCH_WORKFLOW_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0023_GENERIC_FAILURE_SEARCHING_REPOSITORY_EXCEPTION" | "CODE_SHIFT_API_0024_COMPONENTS_MAX_SIZE_ALLOWED_EXCEPTION" | "CODE_SHIFT_API_0025_INVALID_SEARCH_REPOSITORY_STATUS_SAVE_EXCEPTION" | "CODE_SHIFT_API_0026_SEARCH_REPO_EMPTY_RESULT_EXCEPTION" | "CODE_SHIFT_API_0027_ACCOUNT_SCM_CONFIG_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_0028_USER_SCM_CONFIG_NOT_FOUND_EXCEPTION" | "CODE_SHIFT_API_3000_WORKFLOW_API_DISPATCH_FAILURE" | "CODE_SHIFT_API_3001_WORKFLOW_API_DISPATCH_FORBIDDEN" | "CODE_SHIFT_API_3009_WORKFLOW_API_DISPATCH_PARSE_ERROR" | "CODE_SHIFT_API_3010_AWS_SECRET_MANAGER_GET_SECRET_FAILURE" | "CODE_SHIFT_API_3011_AWS_SECRET_MANAGER_PARSE_SECRET_ERROR" | "CODE_SHIFT_API_3100_SCM_GET_REPOSITORIES_FAILURE" | "CODE_SHIFT_API_3101_SCM_GET_REPOSITORIES_NOT_FOUND" | "CODE_SHIFT_API_3102_SCM_GET_REPOSITORIES_UNAUTHORIZED" | "CODE_SHIFT_API_3103_SCM_GET_REPOSITORIES_FORBIDDEN" | "CODE_SHIFT_API_3104_SCM_GET_REPOSITORIES_SAML_ERROR" | "CODE_SHIFT_API_3110_SCM_GET_PULL_REQUEST_FAILURE" | "CODE_SHIFT_API_3111_SCM_GET_PULL_REQUEST_NOT_FOUND" | "CODE_SHIFT_API_3112_SCM_GET_PULL_REQUEST_UNAUTHORIZED" | "CODE_SHIFT_API_3113_SCM_GET_PULL_REQUEST_FORBIDDEN" | "CODE_SHIFT_API_3114_SCM_GET_PULL_REQUEST_SAML_ERROR" | "CODE_SHIFT_API_3120_SCM_GET_BRANCHES_FAILURE" | "CODE_SHIFT_API_3121_SCM_GET_BRANCHES_NOT_FOUND" | "CODE_SHIFT_API_3122_SCM_GET_BRANCHES_UNAUTHORIZED" | "CODE_SHIFT_API_3123_SCM_GET_BRANCHES_FORBIDDEN" | "CODE_SHIFT_API_3124_SCM_GET_BRANCHES_SAML_ERROR" | "CODE_SHIFT_API_3130_SCM_GET_SCM_REPOSITORY_FETCH_FAILURE" | "CODE_SHIFT_API_3131_SCM_REPOSITORY_NOT_FOUND" | "CODE_SHIFT_API_3132_SCM_REPOSITORY_UNAUTHORIZED" | "CODE_SHIFT_API_3133_SCM_REPOSITORY_FORBIDDEN" | "CODE_SHIFT_API_3134_SCM_REPOSITORY_SAML_ERROR" | "CODE_SHIFT_API_3140_SCM_GET_BRANCH_FAILURE" | "CODE_SHIFT_API_3142_SCM_GET_BRANCH_NOT_FOUND" | "CODE_SHIFT_API_3143_SCM_GET_BRANCH_UNAUTHORIZED" | "CODE_SHIFT_API_3144_SCM_GET_BRANCH_FORBIDDEN" | "CODE_SHIFT_API_3145_SCM_GET_BRANCH_SAML_ERROR" | "CODE_SHIFT_API_3150_SCM_GET_REPOSITORY_FILE_FAILURE" | "CODE_SHIFT_API_3151_SCM_GET_REPOSITORY_FILE_NOT_FOUND" | "CODE_SHIFT_API_3152_SCM_GET_REPOSITORY_FILE_UNAUTHORIZED" | "CODE_SHIFT_API_3153_SCM_GET_REPOSITORY_FILE_FORBIDDEN" | "CODE_SHIFT_API_3154_SCM_GET_REPOSITORY_FILE_SAML_ERROR" | "CODE_SHIFT_API_3160_SCM_GET_REPOSITORY_FILE_FAILURE" | "CODE_SHIFT_API_3161_SCM_GET_REPOSITORY_FILE_NOT_FOUND" | "CODE_SHIFT_API_3162_SCM_GET_REPOSITORY_FILE_UNAUTHORIZED" | "CODE_SHIFT_API_3163_SCM_GET_REPOSITORY_FILE_FORBIDDEN" | "CODE_SHIFT_API_3164_SCM_GET_REPOSITORY_FILE_SAML_ERROR" | "CODE_SHIFT_API_3500_CONTENT_API_GET_WORKFLOW_VERSION_FAILURE" | "CODE_SHIFT_API_4000_ACCOUNTS_API_PAT_FAILURE" | "CODE_SHIFT_API_4001_ACCOUNTS_API_PAT_FORBIDDEN" | "CODE_SHIFT_API_4002_ACCOUNTS_API_PAT_NOT_FOUND" | "CODE_SHIFT_API_4009_ACCOUNTS_API_PAT_PARSE_ERROR" | "CODE_SHIFT_API_4010_GET_SCM_CREDENTIALS_FAILURE" | "CODE_SHIFT_API_4011_GET_SCM_CREDENTIALS_FORBIDDEN" | "CODE_SHIFT_API_4012_GET_SCM_CREDENTIALS_NOT_FOUND" | "CODE_SHIFT_API_4019_GET_SCM_CREDENTIALS_PARSE_ERROR" | "CODE_SHIFT_API_6000_IAM_GENERATE_TOKEN_FAILURE" | "CODE_SHIFT_API_6000_IAM_INTROSPECT_TOKEN_FAILURE";
|
|
64
64
|
export type BadRequestExceptionTypes = "CODE_SHIFT_API_1001_DECODE_JWT_ERROR" | "CODE_SHIFT_API_2001_BAD_REQUEST_REQUIRED_FIELD" | "CODE_SHIFT_API_2002_BAD_REQUEST_EMPTY_FIELD_NOT_ALLOWED" | "CODE_SHIFT_API_2003_BAD_REQUEST_TYPE_FIELD_NOT_ALLOWED" | "CODE_SHIFT_API_2004_BAD_REQUEST_VALUE_FIELD_NOT_ALLOWED" | "CODE_SHIFT_API_2005_BAD_REQUEST_VALUE_FIELD_MAX_LENGTH" | "CODE_SHIFT_API_2006_BAD_REQUEST_VALUE_FIELD_MIN_LENGTH" | "CODE_SHIFT_API_2007_BAD_REQUEST_VALUE_REGEX_DOESNT_MATCH" | "CODE_SHIFT_API_2008_BAD_REQUEST_VALUE_FIELD_NUMBER_NOT_LT" | "CODE_SHIFT_API_2100_CREATE_BODY_REPO_AND_REPO_CREATE_ACTION" | "CODE_SHIFT_API_2101_CREATE_BODY_NOT_REPO_AND_NOT_REPO_CREATE_ACTION" | "CODE_SHIFT_API_2102_BAD_REQUEST_DATE_MAX_INTERVAL" | "CODE_SHIFT_API_2103_BAD_REQUEST_INVALID_PAGE" | "CODE_SHIFT_API_2104_BAD_REQUEST_DUPLICATED_ALIAS" | "CODE_SHIFT_API_2105_BAD_REQUEST_INVALID_REPO_URL" | "CODE_SHIFT_API_2110_BAD_REQUEST_PUT_STEP_STATUS_COMPLETED_WITHOUT_CONCLUSION" | "CODE_SHIFT_API_2112_BAD_REQUEST_PUT_STEP_STATUS_NOT_COMPLETED_AND_CONCLUSION_DEFINED" | "CODE_SHIFT_API_2113_BAD_REQUEST_PUT_STEP_STATUS_COMPLETED_AND_COMPLETED_AT_NOT_DEFINED" | "CODE_SHIFT_API_2114_BAD_REQUEST_PUT_STEP_STATUS_IN_PROGRESS_AND_STARTED_AT_NOT_DEFINED" | "CODE_SHIFT_API_2115_BAD_REQUEST_PUT_STEP_COMPLETED_AT_DEFINED_AND_STATUS_NOT_COMPLETED" | "CODE_SHIFT_API_2116_BAD_REQUEST_PUT_STEP_STARTED_AT_DEFINED_AND_STATUS_PENDING" | "CODE_SHIFT_API_2117_BAD_REQUEST_PUT_STEP_LOG_DEFINED_AND_CONCLUSION_IS_NOT_FAILURE" | "CODE_SHIFT_API_2120_BAD_REQUEST_MULTIPLE_INTEGRATION" | "CODE_SHIFT_API_2121_BAD_REQUEST_EMPTY_INTEGRATION" | "CODE_SHIFT_API_2121_BAD_REQUEST_EMPTY_TARGET" | "CODE_SHIFT_API_2121_BAD_REQUEST_FILLED_TARGET" | "CODE_SHIFT_API_2999_BAD_REQUEST_UNMAPPED";
|
|
65
65
|
export type InvalidPayloadDetails = {
|
|
66
66
|
code: BadRequestExceptionTypes | ExceptionType;
|
package/src/api/notification.ts
CHANGED
package/src/client/ai.ts
CHANGED
|
@@ -266,9 +266,6 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
266
266
|
agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
267
267
|
if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
|
|
268
268
|
}))
|
|
269
|
-
agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
|
|
270
|
-
if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
|
|
271
|
-
}))
|
|
272
269
|
return tools
|
|
273
270
|
} catch {
|
|
274
271
|
return []
|
|
@@ -306,33 +303,6 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
306
303
|
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
307
304
|
goal: info.data?.plan_goal ?? '',
|
|
308
305
|
})
|
|
309
|
-
|
|
310
|
-
info.data?.steps.forEach(s => data.steps?.push({
|
|
311
|
-
id: s.id,
|
|
312
|
-
type: 'step',
|
|
313
|
-
status: 'pending',
|
|
314
|
-
input: s.goal,
|
|
315
|
-
attempts: [{
|
|
316
|
-
tools: s.tools?.map(t => ({
|
|
317
|
-
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
318
|
-
executionId: t.tool_execution_id,
|
|
319
|
-
goal: t.goal,
|
|
320
|
-
})),
|
|
321
|
-
}],
|
|
322
|
-
}))
|
|
323
|
-
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (info.type === 'planning' && info.action === 'awaiting_approval') {
|
|
327
|
-
data.steps.push({
|
|
328
|
-
id: 'planning',
|
|
329
|
-
type: 'planning',
|
|
330
|
-
status: 'awaiting_approval',
|
|
331
|
-
user_question: info.data?.user_question,
|
|
332
|
-
duration: info.duration || 0,
|
|
333
|
-
steps: info.data?.steps?.map(s => s.goal) ?? [],
|
|
334
|
-
goal: info.data?.plan_goal ?? '',
|
|
335
|
-
})
|
|
336
306
|
info.data?.steps.forEach(s => data.steps?.push({
|
|
337
307
|
id: s.id,
|
|
338
308
|
type: 'step',
|
|
@@ -342,7 +312,6 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
342
312
|
tools: s.tools?.map(t => ({
|
|
343
313
|
...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
|
|
344
314
|
executionId: t.tool_execution_id,
|
|
345
|
-
goal: t.goal,
|
|
346
315
|
})),
|
|
347
316
|
}],
|
|
348
317
|
}))
|
|
@@ -365,78 +334,27 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
365
334
|
}
|
|
366
335
|
}
|
|
367
336
|
|
|
368
|
-
if (info.type === 'tool' && info.action === 'awaiting_approval') {
|
|
369
|
-
const tool = tools.find(({ id }) => id === info.data?.tool_id)
|
|
370
|
-
data.steps.push({
|
|
371
|
-
id: info.id,
|
|
372
|
-
type: 'tool',
|
|
373
|
-
status: 'awaiting_approval',
|
|
374
|
-
duration: info.duration || 0,
|
|
375
|
-
input: info.data?.input,
|
|
376
|
-
user_question: info.data?.user_question,
|
|
377
|
-
attempts: [{
|
|
378
|
-
tools: [{
|
|
379
|
-
executionId: info.id,
|
|
380
|
-
id: info.data?.tool_id ?? '',
|
|
381
|
-
name: tool?.name ?? '',
|
|
382
|
-
goal: tool?.goal,
|
|
383
|
-
...tool,
|
|
384
|
-
}],
|
|
385
|
-
}],
|
|
386
|
-
})
|
|
387
|
-
data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
|
|
388
|
-
}
|
|
389
|
-
|
|
390
337
|
if (info.type === 'tool' && info.action === 'start') {
|
|
391
338
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
392
|
-
if (!info.data) return
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
data.steps.push({
|
|
399
|
-
id: info.id,
|
|
400
|
-
type: 'tool',
|
|
401
|
-
status: 'running',
|
|
402
|
-
duration: info.duration || 0,
|
|
403
|
-
input: info.data?.input,
|
|
404
|
-
user_question: info.data?.user_question,
|
|
405
|
-
attempts: [{
|
|
406
|
-
tools:[{ ...tool, executionId: info.id, input }],
|
|
407
|
-
}],
|
|
408
|
-
})
|
|
339
|
+
if (!currentStep || !info.data || !currentStep.attempts[0].tools) return
|
|
340
|
+
const toolInFirstAttempt = currentStep.attempts[0].tools.find(t => t.executionId === info.id)
|
|
341
|
+
if (!toolInFirstAttempt) return
|
|
342
|
+
const input = formatJson(info.data.input)
|
|
343
|
+
if (info.data.attempt === 0) {
|
|
344
|
+
toolInFirstAttempt.input = input
|
|
409
345
|
} else {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
416
|
-
currentStep.attempts[info.data.attempt-1].tools?.push({
|
|
417
|
-
...tool,
|
|
418
|
-
input,
|
|
419
|
-
})
|
|
420
|
-
} else {
|
|
421
|
-
const input = formatJson(info.data.input)
|
|
422
|
-
if (info.data.attempt === 1) {
|
|
423
|
-
toolInFirstAttempt.input = input
|
|
424
|
-
} else {
|
|
425
|
-
const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
|
|
426
|
-
currentStep.attempts[info.data.attempt-1] ??= { tools: [] }
|
|
427
|
-
currentStep.attempts[info.data.attempt-1].tools?.push({
|
|
428
|
-
...tool,
|
|
429
|
-
input,
|
|
430
|
-
})
|
|
431
|
-
}
|
|
432
|
-
}
|
|
346
|
+
currentStep.attempts[info.data.attempt] ??= { tools: [] }
|
|
347
|
+
currentStep.attempts[info.data.attempt].tools?.push({
|
|
348
|
+
...toolInFirstAttempt,
|
|
349
|
+
input,
|
|
350
|
+
})
|
|
433
351
|
}
|
|
434
352
|
}
|
|
435
353
|
|
|
436
354
|
if (info.type === 'tool' && info.action === 'end') {
|
|
437
355
|
const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
|
|
438
356
|
if (!currentStep || !info.data) return
|
|
439
|
-
const tool = currentStep.attempts[info.data.attempt
|
|
357
|
+
const tool = currentStep.attempts[info.data.attempt]?.tools?.find(t => t.executionId === info.id)
|
|
440
358
|
if (tool) {
|
|
441
359
|
tool.output = formatJson(info.data.output)
|
|
442
360
|
tool.duration = info.duration
|
|
@@ -475,4 +393,3 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
475
393
|
}
|
|
476
394
|
|
|
477
395
|
export const aiClient = new AIClient()
|
|
478
|
-
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
import {
|
|
3
|
+
acceptNetworkConnection,
|
|
4
|
+
createCertificate,
|
|
5
|
+
createCidr,
|
|
6
|
+
createDnsRecord,
|
|
7
|
+
createDnsZone,
|
|
8
|
+
createFolder,
|
|
9
|
+
createFoundation,
|
|
10
|
+
createInbound,
|
|
11
|
+
createNetwork,
|
|
12
|
+
createNetworkConnection,
|
|
13
|
+
createProject,
|
|
14
|
+
createTenant,
|
|
15
|
+
createVpn,
|
|
16
|
+
defaults,
|
|
17
|
+
getCertificate,
|
|
18
|
+
getFolder,
|
|
19
|
+
getFoundation,
|
|
20
|
+
getNetwork,
|
|
21
|
+
getProject,
|
|
22
|
+
getVpnConfiguration,
|
|
23
|
+
listCertificates,
|
|
24
|
+
listCidr,
|
|
25
|
+
listDnsRecord,
|
|
26
|
+
listDnsZone,
|
|
27
|
+
listFoundations,
|
|
28
|
+
listInbound,
|
|
29
|
+
listNetwork,
|
|
30
|
+
listNetworkConnection,
|
|
31
|
+
listTenant,
|
|
32
|
+
listVpns,
|
|
33
|
+
providers,
|
|
33
34
|
} from '../api/cloudPlatform'
|
|
34
35
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
35
36
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
@@ -158,6 +159,14 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
|
|
|
158
159
|
* Get a network details
|
|
159
160
|
*/
|
|
160
161
|
getNetworkById = this.query(removeAuthorizationParam(getNetwork))
|
|
162
|
+
/**
|
|
163
|
+
* Get a list of tenants
|
|
164
|
+
*/
|
|
165
|
+
listTenants = this.query(removeAuthorizationParam(listTenant))
|
|
166
|
+
/**
|
|
167
|
+
* Create a tenant
|
|
168
|
+
*/
|
|
169
|
+
createTenant = this.mutation(removeAuthorizationParam(createTenant))
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
export const cloudPlatformClient = new CloudPlatformClient()
|
package/src/client/code-shift.ts
CHANGED
|
@@ -58,7 +58,6 @@ import {
|
|
|
58
58
|
getModuleV1ModulesModuleIdGet,
|
|
59
59
|
analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
|
|
60
60
|
analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
|
|
61
|
-
putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
|
|
62
61
|
searchReposScmServiceV2ReposSearchScmPost,
|
|
63
62
|
importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
|
|
64
63
|
searchReposScmV2V2ReposSearchScmSearchIdGet,
|
|
@@ -145,12 +144,6 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
145
144
|
* Downloads a report as a csv file.
|
|
146
145
|
*/
|
|
147
146
|
downloadReport = this.query(removeAuthorizationParam(downloadReportV1ReportsReportIdDownloadGet))
|
|
148
|
-
/**
|
|
149
|
-
* Put Customer Rating Report
|
|
150
|
-
*/
|
|
151
|
-
updateReportRating = this.mutation(
|
|
152
|
-
removeAuthorizationParam(putCustomerRatingReportV1ReportsReportIdCustomerRatingPut),
|
|
153
|
-
)
|
|
154
147
|
/**
|
|
155
148
|
* Gets code shift settings
|
|
156
149
|
*/
|
package/src/client/types.ts
CHANGED
|
@@ -245,7 +245,6 @@ export interface ChatAgentTool {
|
|
|
245
245
|
image?: string,
|
|
246
246
|
input?: string,
|
|
247
247
|
output?: string,
|
|
248
|
-
goal?: string,
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
export interface ChatStepAttempt {
|
|
@@ -257,8 +256,8 @@ export interface ChatStepAttempt {
|
|
|
257
256
|
|
|
258
257
|
export interface BaseChatStep {
|
|
259
258
|
id: string,
|
|
260
|
-
type: 'planning' | 'step' | 'answer'
|
|
261
|
-
status: 'pending' | 'running' | 'success' | 'error'
|
|
259
|
+
type: 'planning' | 'step' | 'answer',
|
|
260
|
+
status: 'pending' | 'running' | 'success' | 'error',
|
|
262
261
|
/**
|
|
263
262
|
* Duration in seconds.
|
|
264
263
|
*/
|
|
@@ -267,24 +266,9 @@ export interface BaseChatStep {
|
|
|
267
266
|
|
|
268
267
|
export interface PlanningChatStep extends BaseChatStep {
|
|
269
268
|
type: 'planning',
|
|
270
|
-
status: 'success'
|
|
269
|
+
status: 'success',
|
|
271
270
|
steps: string[],
|
|
272
271
|
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
272
|
}
|
|
289
273
|
|
|
290
274
|
export interface StepChatStep extends BaseChatStep {
|
|
@@ -304,19 +288,17 @@ export interface AnswerChatStep extends BaseChatStep {
|
|
|
304
288
|
type: 'answer',
|
|
305
289
|
}
|
|
306
290
|
|
|
307
|
-
export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
|
|
291
|
+
export type ChatStep = PlanningChatStep | StepChatStep | AnswerChatStep
|
|
308
292
|
|
|
309
293
|
export interface BaseAgentInfo {
|
|
310
294
|
type: 'chat' | 'planning' | 'step' | 'tool' | 'final_answer',
|
|
311
|
-
action: 'start' | 'end'
|
|
295
|
+
action: 'start' | 'end',
|
|
312
296
|
duration?: number,
|
|
313
|
-
id: string,
|
|
314
297
|
}
|
|
315
298
|
|
|
316
299
|
export interface AgentTool {
|
|
317
300
|
tool_id: string,
|
|
318
301
|
tool_execution_id: string,
|
|
319
|
-
goal: string,
|
|
320
302
|
}
|
|
321
303
|
|
|
322
304
|
export interface PlanningAgentInfo extends BaseAgentInfo {
|
|
@@ -329,7 +311,6 @@ export interface PlanningAgentInfo extends BaseAgentInfo {
|
|
|
329
311
|
goal: string,
|
|
330
312
|
tools?: AgentTool[],
|
|
331
313
|
}[],
|
|
332
|
-
user_question?: string,
|
|
333
314
|
},
|
|
334
315
|
}
|
|
335
316
|
|
|
@@ -345,8 +326,6 @@ export interface ToolAgentInfo extends BaseAgentInfo {
|
|
|
345
326
|
input?: any,
|
|
346
327
|
attempt: number,
|
|
347
328
|
output?: string,
|
|
348
|
-
user_question?: string,
|
|
349
|
-
tool_id: string,
|
|
350
329
|
},
|
|
351
330
|
}
|
|
352
331
|
|