@stack-spot/portal-network 0.102.0 → 0.104.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/src/api/ai.ts CHANGED
@@ -12,7 +12,30 @@ export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
12
12
  };
13
13
  const oazapfts = Oazapfts.runtime(defaults);
14
14
  export const servers = {};
15
- export type VisibilityLevelEnum = "account" | "personal" | "shared" | "workspace";
15
+ export type AiStackWorkspaceForkRequest = {
16
+ ids: string[];
17
+ member_id: string;
18
+ };
19
+ export type AiStackWorkspaceForkResponse = {
20
+ stack_ids: string[];
21
+ stack_ids_account: string[];
22
+ error_ids: string[];
23
+ };
24
+ export type ValidationError = {
25
+ loc: (string | number)[];
26
+ msg: string;
27
+ "type": string;
28
+ };
29
+ export type HttpValidationError = {
30
+ detail?: ValidationError[];
31
+ };
32
+ export type AiStackWorkspaceDeleteRequest = {
33
+ ids: string[];
34
+ };
35
+ export type AiStackWorkspaceListRequest = {
36
+ ids: string[];
37
+ name?: string | null;
38
+ };
16
39
  export type GetAiStackResponse = {
17
40
  id: string;
18
41
  name: string;
@@ -31,14 +54,7 @@ export type GetAiStackResponse = {
31
54
  visibility_level: string;
32
55
  use_only?: boolean | null;
33
56
  };
34
- export type ValidationError = {
35
- loc: (string | number)[];
36
- msg: string;
37
- "type": string;
38
- };
39
- export type HttpValidationError = {
40
- detail?: ValidationError[];
41
- };
57
+ export type VisibilityLevelEnum = "account" | "personal" | "shared" | "workspace";
42
58
  export type NewAiStackRequest = {
43
59
  name: string;
44
60
  use_case: string;
@@ -131,6 +147,17 @@ export type ChatResponse = {
131
147
  total_cost?: string | null;
132
148
  sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile | KnowledgeSourceEvent)[];
133
149
  };
150
+ export type AutoCompleteRequest = {
151
+ context?: object | null;
152
+ code_to_complete: string;
153
+ file_extension: string;
154
+ file_path: string;
155
+ file_context: string | null;
156
+ file_relevant: string | null;
157
+ };
158
+ export type AutoCompleteResult = {
159
+ code: string;
160
+ };
134
161
  export type EventTypeEnum = "code_injected" | "code_copied" | "custom_quick_command_execution" | "user_feedback_provided" | "copied_all";
135
162
  export type SourceProjectFile2 = {
136
163
  "type"?: "project_file";
@@ -283,15 +310,46 @@ export type TokensCurrentUsageResponse = {
283
310
  used: number;
284
311
  limit: number;
285
312
  renewal_date: string;
313
+ embeddings_tokens_usage: number;
314
+ prompt_tokens_usage: number;
286
315
  };
287
316
  export type TokensMonthlyUsageResponse = {
288
317
  used: number;
289
318
  month: number;
319
+ embeddings_tokens_usage: number;
320
+ prompt_tokens_usage: number;
290
321
  };
291
322
  export type AddWorkspaceKnowledgeSourceRequest = {
292
323
  knowledge_source_slugs: string[];
293
324
  };
325
+ export type QuickCommandWorkspaceForkRequest = {
326
+ ids: string[];
327
+ member_id: string;
328
+ };
329
+ export type QuickCommandWorkspaceDeleteRequest = {
330
+ ids: string[];
331
+ };
332
+ export type QuickCommandWorkspaceListRequest = {
333
+ ids: string[];
334
+ name?: string | null;
335
+ };
294
336
  export type QuickCommandTypeRequest = "IDE" | "REMOTE";
337
+ export type QuickCommandsReturnType = "CHAT" | "REPLACE_CODE" | "BEFORE_CODE" | "AFTER_CODE";
338
+ export type QuickCommandListResponse = {
339
+ slug: string;
340
+ name: string;
341
+ "type": QuickCommandTypeRequest;
342
+ description: string;
343
+ studio_id?: string | null;
344
+ flow?: object | null;
345
+ preserve_conversation: boolean;
346
+ use_selected_code: boolean;
347
+ return_type?: QuickCommandsReturnType | null;
348
+ creator: string | null;
349
+ visibility_level: string;
350
+ use_only: boolean;
351
+ id: string;
352
+ };
295
353
  export type Method = "GET" | "OPTIONS" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE";
296
354
  export type QuickCommandsStepFetchRequest = {
297
355
  slug: string;
@@ -312,7 +370,6 @@ export type QuickCommandsStepPromptRequest = {
312
370
  agent_id?: string | null;
313
371
  agent_built_in?: boolean | null;
314
372
  };
315
- export type QuickCommandsReturnType = "CHAT" | "REPLACE_CODE" | "BEFORE_CODE" | "AFTER_CODE";
316
373
  export type CustomInputRequest = {
317
374
  slug: string;
318
375
  question: string;
@@ -333,21 +390,6 @@ export type QuickCommandsCreateRequest = {
333
390
  export type BaseContextualRequest = {
334
391
  context?: object | null;
335
392
  };
336
- export type QuickCommandListResponse = {
337
- slug: string;
338
- name: string;
339
- "type": QuickCommandTypeRequest;
340
- description: string;
341
- studio_id?: string | null;
342
- flow?: object | null;
343
- preserve_conversation: boolean;
344
- use_selected_code: boolean;
345
- return_type?: QuickCommandsReturnType | null;
346
- creator: string | null;
347
- visibility_level: string;
348
- use_only: boolean;
349
- id: string;
350
- };
351
393
  export type QuickCommandsUpdateRequest = {
352
394
  name?: string | null;
353
395
  description?: string | null;
@@ -606,6 +648,83 @@ export function metricsMetricsGet(opts?: Oazapfts.RequestOpts) {
606
648
  ...opts
607
649
  }));
608
650
  }
651
+ /**
652
+ * Workspace Fork
653
+ */
654
+ export function workspaceForkV1AiStacksWorkspaceForkPost({ authorization, xAccountId, aiStackWorkspaceForkRequest }: {
655
+ authorization: string;
656
+ xAccountId?: string | null;
657
+ aiStackWorkspaceForkRequest: AiStackWorkspaceForkRequest;
658
+ }, opts?: Oazapfts.RequestOpts) {
659
+ return oazapfts.ok(oazapfts.fetchJson<{
660
+ status: 200;
661
+ data: AiStackWorkspaceForkResponse;
662
+ } | {
663
+ status: 404;
664
+ } | {
665
+ status: 422;
666
+ data: HttpValidationError;
667
+ }>("/v1/ai-stacks/workspace/fork", oazapfts.json({
668
+ ...opts,
669
+ method: "POST",
670
+ body: aiStackWorkspaceForkRequest,
671
+ headers: oazapfts.mergeHeaders(opts?.headers, {
672
+ authorization,
673
+ "x-account-id": xAccountId
674
+ })
675
+ })));
676
+ }
677
+ /**
678
+ * Workspace Delete Fork
679
+ */
680
+ export function workspaceDeleteForkV1AiStacksWorkspaceForkDelete({ authorization, xAccountId, aiStackWorkspaceDeleteRequest }: {
681
+ authorization: string;
682
+ xAccountId?: string | null;
683
+ aiStackWorkspaceDeleteRequest: AiStackWorkspaceDeleteRequest;
684
+ }, opts?: Oazapfts.RequestOpts) {
685
+ return oazapfts.ok(oazapfts.fetchJson<{
686
+ status: 204;
687
+ } | {
688
+ status: 404;
689
+ } | {
690
+ status: 422;
691
+ data: HttpValidationError;
692
+ }>("/v1/ai-stacks/workspace/fork", oazapfts.json({
693
+ ...opts,
694
+ method: "DELETE",
695
+ body: aiStackWorkspaceDeleteRequest,
696
+ headers: oazapfts.mergeHeaders(opts?.headers, {
697
+ authorization,
698
+ "x-account-id": xAccountId
699
+ })
700
+ })));
701
+ }
702
+ /**
703
+ * Workspace List
704
+ */
705
+ export function workspaceListV1AiStacksWorkspaceListPost({ authorization, xAccountId, aiStackWorkspaceListRequest }: {
706
+ authorization: string;
707
+ xAccountId?: string | null;
708
+ aiStackWorkspaceListRequest: AiStackWorkspaceListRequest;
709
+ }, opts?: Oazapfts.RequestOpts) {
710
+ return oazapfts.ok(oazapfts.fetchJson<{
711
+ status: 200;
712
+ data: GetAiStackResponse[];
713
+ } | {
714
+ status: 404;
715
+ } | {
716
+ status: 422;
717
+ data: HttpValidationError;
718
+ }>("/v1/ai-stacks/workspace/list", oazapfts.json({
719
+ ...opts,
720
+ method: "POST",
721
+ body: aiStackWorkspaceListRequest,
722
+ headers: oazapfts.mergeHeaders(opts?.headers, {
723
+ authorization,
724
+ "x-account-id": xAccountId
725
+ })
726
+ })));
727
+ }
609
728
  /**
610
729
  * List Ai Stacks
611
730
  */
@@ -897,6 +1016,26 @@ export function devAssistantV1ChatPost(opts?: Oazapfts.RequestOpts) {
897
1016
  method: "POST"
898
1017
  }));
899
1018
  }
1019
+ /**
1020
+ * Autocomplete V1
1021
+ */
1022
+ export function autocompleteV1V1AutocompletePost({ autoCompleteRequest }: {
1023
+ autoCompleteRequest: AutoCompleteRequest;
1024
+ }, opts?: Oazapfts.RequestOpts) {
1025
+ return oazapfts.ok(oazapfts.fetchJson<{
1026
+ status: 200;
1027
+ data: string | AutoCompleteResult;
1028
+ } | {
1029
+ status: 404;
1030
+ } | {
1031
+ status: 422;
1032
+ data: HttpValidationError;
1033
+ }>("/v1/autocomplete", oazapfts.json({
1034
+ ...opts,
1035
+ method: "POST",
1036
+ body: autoCompleteRequest
1037
+ })));
1038
+ }
900
1039
  /**
901
1040
  * Post Event
902
1041
  */
@@ -1683,6 +1822,29 @@ export function changeExternalConfigsV1AccountsExternalConfigPatch({ body }: {
1683
1822
  body
1684
1823
  })));
1685
1824
  }
1825
+ /**
1826
+ * Current
1827
+ */
1828
+ export function currentV1TokensUsageTotalGet({ authorization, xAccountId }: {
1829
+ authorization: string;
1830
+ xAccountId?: string | null;
1831
+ }, opts?: Oazapfts.RequestOpts) {
1832
+ return oazapfts.ok(oazapfts.fetchJson<{
1833
+ status: 200;
1834
+ data: TokensCurrentUsageResponse;
1835
+ } | {
1836
+ status: 404;
1837
+ } | {
1838
+ status: 422;
1839
+ data: HttpValidationError;
1840
+ }>("/v1/tokens-usage/total", {
1841
+ ...opts,
1842
+ headers: oazapfts.mergeHeaders(opts?.headers, {
1843
+ authorization,
1844
+ "x-account-id": xAccountId
1845
+ })
1846
+ }));
1847
+ }
1686
1848
  /**
1687
1849
  * Current
1688
1850
  */
@@ -1840,6 +2002,83 @@ export function deleteAssociationV1WorkspaceWorkspaceIdKnowledgeSourceKnowledgeS
1840
2002
  })
1841
2003
  }));
1842
2004
  }
2005
+ /**
2006
+ * Workspace Fork
2007
+ */
2008
+ export function workspaceForkV1QuickCommandsWorkspaceForkPost({ authorization, xAccountId, quickCommandWorkspaceForkRequest }: {
2009
+ authorization: string;
2010
+ xAccountId?: string | null;
2011
+ quickCommandWorkspaceForkRequest: QuickCommandWorkspaceForkRequest;
2012
+ }, opts?: Oazapfts.RequestOpts) {
2013
+ return oazapfts.ok(oazapfts.fetchJson<{
2014
+ status: 200;
2015
+ data: any;
2016
+ } | {
2017
+ status: 404;
2018
+ } | {
2019
+ status: 422;
2020
+ data: HttpValidationError;
2021
+ }>("/v1/quick-commands/workspace/fork", oazapfts.json({
2022
+ ...opts,
2023
+ method: "POST",
2024
+ body: quickCommandWorkspaceForkRequest,
2025
+ headers: oazapfts.mergeHeaders(opts?.headers, {
2026
+ authorization,
2027
+ "x-account-id": xAccountId
2028
+ })
2029
+ })));
2030
+ }
2031
+ /**
2032
+ * Workspace Delete Fork
2033
+ */
2034
+ export function workspaceDeleteForkV1QuickCommandsWorkspaceForkDelete({ authorization, xAccountId, quickCommandWorkspaceDeleteRequest }: {
2035
+ authorization: string;
2036
+ xAccountId?: string | null;
2037
+ quickCommandWorkspaceDeleteRequest: QuickCommandWorkspaceDeleteRequest;
2038
+ }, opts?: Oazapfts.RequestOpts) {
2039
+ return oazapfts.ok(oazapfts.fetchJson<{
2040
+ status: 204;
2041
+ } | {
2042
+ status: 404;
2043
+ } | {
2044
+ status: 422;
2045
+ data: HttpValidationError;
2046
+ }>("/v1/quick-commands/workspace/fork", oazapfts.json({
2047
+ ...opts,
2048
+ method: "DELETE",
2049
+ body: quickCommandWorkspaceDeleteRequest,
2050
+ headers: oazapfts.mergeHeaders(opts?.headers, {
2051
+ authorization,
2052
+ "x-account-id": xAccountId
2053
+ })
2054
+ })));
2055
+ }
2056
+ /**
2057
+ * Workspace List
2058
+ */
2059
+ export function workspaceListV1QuickCommandsWorkspaceListPost({ authorization, xAccountId, quickCommandWorkspaceListRequest }: {
2060
+ authorization: string;
2061
+ xAccountId?: string | null;
2062
+ quickCommandWorkspaceListRequest: QuickCommandWorkspaceListRequest;
2063
+ }, opts?: Oazapfts.RequestOpts) {
2064
+ return oazapfts.ok(oazapfts.fetchJson<{
2065
+ status: 200;
2066
+ data: QuickCommandListResponse[];
2067
+ } | {
2068
+ status: 404;
2069
+ } | {
2070
+ status: 422;
2071
+ data: HttpValidationError;
2072
+ }>("/v1/quick-commands/workspace/list", oazapfts.json({
2073
+ ...opts,
2074
+ method: "POST",
2075
+ body: quickCommandWorkspaceListRequest,
2076
+ headers: oazapfts.mergeHeaders(opts?.headers, {
2077
+ authorization,
2078
+ "x-account-id": xAccountId
2079
+ })
2080
+ })));
2081
+ }
1843
2082
  /**
1844
2083
  * Create Quick Command
1845
2084
  */
package/src/apis.json CHANGED
@@ -23,6 +23,14 @@
23
23
  },
24
24
  "docs": "/q/openapi"
25
25
  },
26
+ "agent-tools": {
27
+ "url": {
28
+ "dev": "https://genai-agent-tools-api.dev.stackspot.com",
29
+ "stg": "https://genai-agent-tools-api.stg.stackspot.com",
30
+ "prd": "https://genai-agent-tools-api.stackspot.com"
31
+ },
32
+ "docs": "/openapi.json"
33
+ },
26
34
  "workspace": {
27
35
  "url": {
28
36
  "dev": "https://workspace-workspace-api.dev.stackspot.com",
@@ -86,6 +86,7 @@ import {
86
86
  listScmCredentials1, partialUpdateSso, personalAccessTokenAuthorization,
87
87
  personalContact,
88
88
  removeRoleFromMember,
89
+ removeTrialAccount,
89
90
  resetOtp,
90
91
  resetPassword, revokeServiceCredential1, save,
91
92
  scmCredentialSave, scmCredentialSave1, scmCredentialUpdate, scmCredentialUpdate1, scmDelete, sendDownloadEmail, ssoAddAttributes,
@@ -738,6 +739,10 @@ class AccountClient extends ReactQueryNetworkClient {
738
739
  * Create trial account
739
740
  */
740
741
  createTrialAccount = this.mutation(createTrialAccount)
742
+ /**
743
+ * Deletes trial account
744
+ */
745
+ deleteTrialAccount = this.mutation(removeTrialAccount)
741
746
  /**
742
747
  * Update trial account info
743
748
  */
@@ -0,0 +1,24 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { defaults, getPublicToolKitsV1BuiltinToolkitGet, HttpValidationError } from '../api/agent-tools'
3
+ import apis from '../apis.json'
4
+ import { StackspotAPIError } from '../error/StackspotAPIError'
5
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
+
7
+ class AgentToolsClient extends ReactQueryNetworkClient {
8
+ constructor() {
9
+ super(apis['agent-tools'].url, defaults)
10
+ }
11
+
12
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
13
+ return new StackspotAPIError({
14
+ status: error.status,
15
+ headers: error.headers,
16
+ stack: error.stack,
17
+ message: (error.data as HttpValidationError | undefined)?.detail?.map(d => d.msg)?.join('\n'),
18
+ })
19
+ }
20
+
21
+ tools = this.query(getPublicToolKitsV1BuiltinToolkitGet)
22
+ }
23
+
24
+ export const agentToolsClient = new AgentToolsClient()
package/src/client/ai.ts CHANGED
@@ -3,6 +3,7 @@ import { last } from 'lodash'
3
3
  import {
4
4
  addFavoriteV1FavoritesPost,
5
5
  conversationHistoryV1ConversationsConversationIdGet,
6
+ currentV1TokensUsageTotalGet,
6
7
  defaults,
7
8
  deleteConversationV1ConversationsConversationIdDelete,
8
9
  deleteFavoriteV1FavoritesDelete,
@@ -63,6 +64,10 @@ class AIClient extends ReactQueryNetworkClient {
63
64
  * Lists the AI Stacks according to their visibilities.
64
65
  */
65
66
  aiStacks = this.query(removeAuthorizationParam(listAiStacksV1AiStacksGet))
67
+ /**
68
+ * Gets total tokens usage
69
+ */
70
+ totalTokensUsage = this.query(removeAuthorizationParam(currentV1TokensUsageTotalGet))
66
71
  /**
67
72
  * Gets a workspace by its id.
68
73
  */
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export { CancelledError } from '@tanstack/react-query'
2
2
  export { apiAddresses } from './api-addresses'
3
3
  export { accountClient } from './client/account'
4
4
  export { agentClient } from './client/agent'
5
+ export { agentToolsClient } from './client/agent-tools'
5
6
  export { aiClient } from './client/ai'
6
7
  export { cloudAccountClient } from './client/cloud-account'
7
8
  export { cloudPlatformClient } from './client/cloud-platform'