@stack-spot/portal-network 0.40.1 → 0.41.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/apis.json CHANGED
@@ -7,6 +7,14 @@
7
7
  },
8
8
  "docs": "/openapi.json"
9
9
  },
10
+ "agent": {
11
+ "url": {
12
+ "dev": "https://genai-ai-agent-mgmt-api.dev.stackspot.com",
13
+ "stg": "https://genai-ai-agent-mgmt-api.stg.stackspot.com",
14
+ "prd": "https://genai-ai-agent-mgmt-api.stackspot.com"
15
+ },
16
+ "docs": "/q/openapi"
17
+ },
10
18
  "workspace": {
11
19
  "url": {
12
20
  "dev": "https://workspace-workspace-api.dev.stackspot.com",
@@ -0,0 +1,35 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { defaults, getV1Agents, getV1PublicAgents } from '../api/agent'
3
+ import apis from '../apis.json'
4
+ import { StackspotAPIError } from '../error/StackspotAPIError'
5
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
+
7
+ interface AgentError {
8
+ code?: string,
9
+ details?: string,
10
+ additionalInformation?: Record<string, any>,
11
+ }
12
+
13
+ class AgentClient extends ReactQueryNetworkClient {
14
+ constructor() {
15
+ super(apis.agent.url, defaults)
16
+ }
17
+
18
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
19
+ const errorData = error.data as AgentError | undefined
20
+ const message = [errorData?.details]
21
+ Object.keys(errorData?.additionalInformation ?? {}).forEach(k => message.push(` - ${k}: ${errorData?.additionalInformation?.[k]}`))
22
+ return new StackspotAPIError({
23
+ status: error.status,
24
+ headers: error.headers,
25
+ stack: error.stack,
26
+ code: error.data?.code,
27
+ message: message.join('\n'),
28
+ })
29
+ }
30
+
31
+ agents = this.query(getV1Agents)
32
+ publicAgents = this.query(getV1PublicAgents)
33
+ }
34
+
35
+ export const agentClient = new AgentClient()
package/src/client/ai.ts CHANGED
@@ -44,7 +44,7 @@ class AIClient extends ReactQueryNetworkClient {
44
44
  quickCommands = this.query(removeAuthorizationParam(listAllV1QuickCommandsAllGet))
45
45
  quickCommand = this.query(removeAuthorizationParam(getQuickCommandV1QuickCommandsSlugGet))
46
46
  knowledgeSources = this.query(removeAuthorizationParam(listKnowledgeSourcesV1KnowledgeSourcesGet))
47
- knowledgeSource = this.query(removeAuthorizationParam(findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet))
47
+ knowledgeSourceDocument = this.query(removeAuthorizationParam(findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet))
48
48
  chats = this.infiniteQuery(removeAuthorizationParam(listConversationsV1ConversationsGet))
49
49
  chat = this.query(removeAuthorizationParam(conversationHistoryV1ConversationsConversationIdGet))
50
50
  deleteChat = this.mutation(removeAuthorizationParam(deleteConversationV1ConversationsConversationIdDelete))
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { accountClient } from './client/account'
2
+ export { agentClient } from './client/agent'
2
3
  export { aiClient } from './client/ai'
3
4
  export { cloudAccountClient } from './client/cloud-account'
4
5
  export { cloudPlatformClient } from './client/cloud-platform'
@@ -23,4 +24,3 @@ export { queryClient } from './network/react-query-client'
23
24
  export { OperationResult, OperationVariables, UseQueryObjectOptions } from './network/types'
24
25
  export { StreamedJson } from './utils/StreamedJson'
25
26
  export { useExtendedList } from './utils/use-extended-list'
26
-