@arbidocs/react 0.3.8 → 0.3.10
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/README.md +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -42
- package/dist/index.d.ts +89 -42
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @arbidocs/react
|
|
2
2
|
|
|
3
|
-
React hooks and provider for the ARBI SDK. Built on `@arbidocs/
|
|
3
|
+
React hooks and provider for the ARBI SDK. Built on `@arbidocs/sdk` and `@tanstack/react-query`.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -146,7 +146,7 @@ arbiQueryKeys.health()
|
|
|
146
146
|
|
|
147
147
|
## Re-exports
|
|
148
148
|
|
|
149
|
-
The package re-exports key types from `@arbidocs/
|
|
149
|
+
The package re-exports key types from `@arbidocs/sdk/browser` for convenience:
|
|
150
150
|
|
|
151
151
|
```tsx
|
|
152
152
|
import { Arbi, ArbiError } from '@arbidocs/react'
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
|
-
var browser = require('@arbidocs/
|
|
4
|
+
var browser = require('@arbidocs/sdk/browser');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ function useDocuments(workspaceId, options) {
|
|
|
42
42
|
const arbi = useArbi();
|
|
43
43
|
return reactQuery.useQuery({
|
|
44
44
|
queryKey: arbiQueryKeys.documents(workspaceId ?? ""),
|
|
45
|
-
queryFn: () => arbi.documents.list(
|
|
45
|
+
queryFn: () => arbi.documents.list(),
|
|
46
46
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
47
47
|
});
|
|
48
48
|
}
|
|
@@ -50,7 +50,7 @@ function useConversations(workspaceId, options) {
|
|
|
50
50
|
const arbi = useArbi();
|
|
51
51
|
return reactQuery.useQuery({
|
|
52
52
|
queryKey: arbiQueryKeys.conversations(workspaceId ?? ""),
|
|
53
|
-
queryFn: () => arbi.conversations.list(
|
|
53
|
+
queryFn: () => arbi.conversations.list(),
|
|
54
54
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -58,7 +58,7 @@ function useTags(workspaceId, options) {
|
|
|
58
58
|
const arbi = useArbi();
|
|
59
59
|
return reactQuery.useQuery({
|
|
60
60
|
queryKey: arbiQueryKeys.tags(workspaceId ?? ""),
|
|
61
|
-
queryFn: () => arbi.tags.list(
|
|
61
|
+
queryFn: () => arbi.tags.list(),
|
|
62
62
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
63
63
|
});
|
|
64
64
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ArbiProvider.tsx","../src/useArbi.ts","../src/hooks.ts"],"names":["createContext","useMemo","Arbi","useContext","useQuery","useMutation"],"mappings":";;;;;;;;AAYO,IAAM,WAAA,GAAcA,oBAA2B,IAAI,CAAA;AAMnD,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,GAAG,SAAQ,EAAsB;AACxE,EAAA,MAAM,IAAA,GAAOC,aAAA;AAAA,IACX,MAAM,IAAIC,YAAA,CAAK,OAAO,CAAA;AAAA;AAAA;AAAA,IAGtB,CAAC,OAAA,CAAQ,GAAA,EAAK,OAAA,CAAQ,gBAAA,EAAkB,QAAQ,WAAW;AAAA,GAC7D;AAEA,EAAA,sCAAQ,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,MAAO,QAAA,EAAS,CAAA;AACtD;ACnBO,SAAS,OAAA,GAAgB;AAC9B,EAAA,MAAM,IAAA,GAAOC,iBAAW,WAAW,CAAA;AACnC,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,IAAA;AACT;ACJO,IAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY,MAAM,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,EACvC,WAAW,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,aAAa,WAAW,CAAA;AAAA,EACrE,eAAe,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,iBAAiB,WAAW,CAAA;AAAA,EAC7E,MAAM,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,QAAQ,WAAW,CAAA;AAAA,EAC3D,MAAA,EAAQ,MAAM,CAAC,MAAA,EAAQ,QAAQ;AACjC;AAKO,SAAS,cAAc,OAAA,EAAiC;AAC7D,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,OAAOC,mBAAA,CAAS;AAAA,IACd,QAAA,EAAU,cAAc,UAAA,EAAW;AAAA,IACnC,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA,CAAW,IAAA,EAAK;AAAA,IACpC,OAAA,EAAS,OAAA,EAAS,OAAA,IAAW,IAAA,CAAK;AAAA,GACnC,CAAA;AACH;AAGO,SAAS,YAAA,CAAa,aAAiC,OAAA,EAAiC;AAC7F,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,OAAOA,mBAAA,CAAS;AAAA,IACd,QAAA,EAAU,aAAA,CAAc,SAAA,CAAU,WAAA,IAAe,EAAE,CAAA;AAAA,IACnD,OAAA,EAAS,MAAM,IAAA,CAAK,SAAA,CAAU,
|
|
1
|
+
{"version":3,"sources":["../src/ArbiProvider.tsx","../src/useArbi.ts","../src/hooks.ts"],"names":["createContext","useMemo","Arbi","useContext","useQuery","useMutation"],"mappings":";;;;;;;;A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EAAE,QAAA,EAAU,GAAG,OAAA,EAAQ,KAAM,IAAA,CAAK,SAAA,CAAU,KAAA,CAAM,QAAA,EAAU,OAAO;AAAA,GACjF,CAAA;AACH;AAGO,SAAS,UAAU,OAAA,EAAiC;AACzD,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,OAAOD,mBAAA,CAAS;AAAA,IACd,QAAA,EAAU,cAAc,MAAA,EAAO;AAAA,IAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,KAAA,EAAM;AAAA,IACjC,SAAS,OAAA,EAAS;AAAA,GACnB,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * ArbiProvider — React context that holds an Arbi instance.\n *\n * Usage:\n * <ArbiProvider url=\"https://arbi.mycompany.com\">\n * <App />\n * </ArbiProvider>\n */\n\nimport { createContext, useMemo, type ReactNode } from 'react'\nimport { Arbi, type ArbiOptions } from '@arbidocs/sdk/browser'\n\nexport const ArbiContext = createContext<Arbi | null>(null)\n\nexport interface ArbiProviderProps extends ArbiOptions {\n children: ReactNode\n}\n\nexport function ArbiProvider({ children, ...options }: ArbiProviderProps) {\n const arbi = useMemo(\n () => new Arbi(options),\n // Stable on url + deploymentDomain — re-creating the instance on every render would be wrong\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.url, options.deploymentDomain, options.credentials]\n )\n\n return <ArbiContext.Provider value={arbi}>{children}</ArbiContext.Provider>\n}\n","/**\n * Hook to access the Arbi instance from the nearest ArbiProvider.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { ArbiContext } from './ArbiProvider'\n\nexport function useArbi(): Arbi {\n const arbi = useContext(ArbiContext)\n if (!arbi) {\n throw new Error('useArbi() must be used within an <ArbiProvider>')\n }\n return arbi\n}\n","/**\n * React Query hooks that use the Arbi instance from context.\n */\n\nimport { useQuery, useMutation } from '@tanstack/react-query'\nimport type { SSEStreamResult, SSEStreamStartData, AgentStepEvent } from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\n\n// ── Query keys ──────────────────────────────────────────────────────────────\n\nexport const arbiQueryKeys = {\n workspaces: () => ['arbi', 'workspaces'] as const,\n documents: (workspaceId: string) => ['arbi', 'documents', workspaceId] as const,\n conversations: (workspaceId: string) => ['arbi', 'conversations', workspaceId] as const,\n tags: (workspaceId: string) => ['arbi', 'tags', workspaceId] as const,\n health: () => ['arbi', 'health'] as const,\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\n/** List the logged-in user's workspaces. */\nexport function useWorkspaces(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workspaces(),\n queryFn: () => arbi.workspaces.list(),\n enabled: options?.enabled ?? arbi.isLoggedIn,\n })\n}\n\n/** List documents in a workspace. */\nexport function useDocuments(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.documents(workspaceId ?? ''),\n queryFn: () => arbi.documents.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** List conversations in a workspace. */\nexport function useConversations(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversations(workspaceId ?? ''),\n queryFn: () => arbi.conversations.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** List tags in a workspace. */\nexport function useTags(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.tags(workspaceId ?? ''),\n queryFn: () => arbi.tags.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** Send a streaming query to the RAG assistant. Returns a mutation. */\nexport function useAssistantQuery() {\n const arbi = useArbi()\n\n return useMutation<\n SSEStreamResult,\n Error,\n {\n question: string\n docIds: string[]\n previousResponseId?: string | null\n model?: string\n onToken?: (content: string) => void\n onStreamStart?: (data: SSEStreamStartData) => void\n onAgentStep?: (data: AgentStepEvent) => void\n onError?: (message: string) => void\n onComplete?: () => void\n }\n >({\n mutationFn: ({ question, ...options }) => arbi.assistant.query(question, options),\n })\n}\n\n/** Check backend health. */\nexport function useHealth(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.health(),\n queryFn: () => arbi.health.check(),\n enabled: options?.enabled,\n })\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ArbiOptions, Arbi, SSEStreamResult } from '@arbidocs/
|
|
4
|
-
export { Arbi, ArbiError, ArbiOptions, QueryOptions, SSEStreamCallbacks, SSEStreamResult } from '@arbidocs/
|
|
3
|
+
import { ArbiOptions, Arbi, SSEStreamResult, SSEStreamStartData, AgentStepEvent } from '@arbidocs/sdk/browser';
|
|
4
|
+
export { AgentStepEvent, Arbi, ArbiError, ArbiOptions, ArtifactEvent, MessageMetadataPayload, OutputTokensDetails, QueryOptions, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseCreatedEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextDoneEvent, ResponseUsage, SSEStreamCallbacks, SSEStreamResult, SSEStreamStartData, UserInputRequestEvent, UserMessageEvent } from '@arbidocs/sdk/browser';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
-
import * as
|
|
6
|
+
import * as _arbidocs_client from '@arbidocs/client';
|
|
7
7
|
|
|
8
8
|
interface ArbiProviderProps extends ArbiOptions {
|
|
9
9
|
children: ReactNode;
|
|
@@ -32,16 +32,29 @@ declare function useWorkspaces(options?: {
|
|
|
32
32
|
description: string | null;
|
|
33
33
|
is_public: boolean;
|
|
34
34
|
created_by_ext_id: string;
|
|
35
|
-
updated_by_ext_id?: string | null;
|
|
35
|
+
updated_by_ext_id?: string | null | undefined;
|
|
36
36
|
created_at: string;
|
|
37
37
|
updated_at: string;
|
|
38
|
-
wrapped_key?: string | null;
|
|
38
|
+
wrapped_key?: string | null | undefined;
|
|
39
39
|
shared_conversation_count: number;
|
|
40
40
|
private_conversation_count: number;
|
|
41
41
|
shared_document_count: number;
|
|
42
42
|
private_document_count: number;
|
|
43
43
|
user_files_mb: number;
|
|
44
|
-
users:
|
|
44
|
+
users: {
|
|
45
|
+
user: {
|
|
46
|
+
external_id: string;
|
|
47
|
+
email: string;
|
|
48
|
+
given_name: string;
|
|
49
|
+
family_name: string;
|
|
50
|
+
picture?: string | null | undefined;
|
|
51
|
+
encryption_public_key: string;
|
|
52
|
+
};
|
|
53
|
+
role: _arbidocs_client.components["schemas"]["WorkspaceRole"];
|
|
54
|
+
joined_at: string;
|
|
55
|
+
conversation_count: number;
|
|
56
|
+
document_count: number;
|
|
57
|
+
}[];
|
|
45
58
|
}[], Error>;
|
|
46
59
|
/** List documents in a workspace. */
|
|
47
60
|
declare function useDocuments(workspaceId: string | undefined, options?: {
|
|
@@ -49,27 +62,49 @@ declare function useDocuments(workspaceId: string | undefined, options?: {
|
|
|
49
62
|
}): _tanstack_react_query.UseQueryResult<{
|
|
50
63
|
external_id: string;
|
|
51
64
|
workspace_ext_id: string;
|
|
52
|
-
file_name?: string | null;
|
|
53
|
-
status?: string | null;
|
|
54
|
-
n_pages?: number | null;
|
|
55
|
-
n_chunks?: number | null;
|
|
56
|
-
tokens?: number | null;
|
|
57
|
-
file_type?: string | null;
|
|
58
|
-
file_size?: number | null;
|
|
59
|
-
storage_type?: string | null;
|
|
60
|
-
storage_uri?: string | null;
|
|
61
|
-
content_hash?: string | null;
|
|
62
|
-
shared?: boolean | null;
|
|
63
|
-
re_ocred?: boolean | null;
|
|
64
|
-
config_ext_id?: string | null;
|
|
65
|
-
parent_ext_id?: string | null;
|
|
65
|
+
file_name?: string | null | undefined;
|
|
66
|
+
status?: string | null | undefined;
|
|
67
|
+
n_pages?: number | null | undefined;
|
|
68
|
+
n_chunks?: number | null | undefined;
|
|
69
|
+
tokens?: number | null | undefined;
|
|
70
|
+
file_type?: string | null | undefined;
|
|
71
|
+
file_size?: number | null | undefined;
|
|
72
|
+
storage_type?: string | null | undefined;
|
|
73
|
+
storage_uri?: string | null | undefined;
|
|
74
|
+
content_hash?: string | null | undefined;
|
|
75
|
+
shared?: boolean | null | undefined;
|
|
76
|
+
re_ocred?: boolean | null | undefined;
|
|
77
|
+
config_ext_id?: string | null | undefined;
|
|
78
|
+
parent_ext_id?: string | null | undefined;
|
|
66
79
|
created_by_ext_id: string;
|
|
67
|
-
updated_by_ext_id?: string | null;
|
|
80
|
+
updated_by_ext_id?: string | null | undefined;
|
|
68
81
|
created_at: string;
|
|
69
82
|
updated_at: string;
|
|
70
|
-
wp_type?: string | null;
|
|
71
|
-
doctags:
|
|
72
|
-
|
|
83
|
+
wp_type?: string | null | undefined;
|
|
84
|
+
doctags: {
|
|
85
|
+
doc_ext_id: string;
|
|
86
|
+
tag_ext_id: string;
|
|
87
|
+
note?: string | null | undefined;
|
|
88
|
+
citations?: {
|
|
89
|
+
[x: string]: {
|
|
90
|
+
chunk_ids: string[];
|
|
91
|
+
statement: string;
|
|
92
|
+
offset_start: number;
|
|
93
|
+
offset_end: number;
|
|
94
|
+
};
|
|
95
|
+
} | null | undefined;
|
|
96
|
+
created_by_ext_id: string;
|
|
97
|
+
updated_by_ext_id?: string | null | undefined;
|
|
98
|
+
created_at: string;
|
|
99
|
+
updated_at: string;
|
|
100
|
+
}[];
|
|
101
|
+
doc_metadata?: {
|
|
102
|
+
doc_nature?: string | null | undefined;
|
|
103
|
+
doc_author?: string | null | undefined;
|
|
104
|
+
doc_subject?: string | null | undefined;
|
|
105
|
+
doc_date?: string | null | undefined;
|
|
106
|
+
title?: string | null | undefined;
|
|
107
|
+
} | null | undefined;
|
|
73
108
|
}[], Error>;
|
|
74
109
|
/** List conversations in a workspace. */
|
|
75
110
|
declare function useConversations(workspaceId: string | undefined, options?: {
|
|
@@ -78,7 +113,7 @@ declare function useConversations(workspaceId: string | undefined, options?: {
|
|
|
78
113
|
external_id: string;
|
|
79
114
|
title: string | null;
|
|
80
115
|
created_by_ext_id: string;
|
|
81
|
-
updated_by_ext_id?: string | null;
|
|
116
|
+
updated_by_ext_id?: string | null | undefined;
|
|
82
117
|
created_at: string;
|
|
83
118
|
updated_at: string;
|
|
84
119
|
is_shared: boolean;
|
|
@@ -91,13 +126,16 @@ declare function useTags(workspaceId: string | undefined, options?: {
|
|
|
91
126
|
external_id: string;
|
|
92
127
|
workspace_ext_id: string;
|
|
93
128
|
name: string;
|
|
94
|
-
instruction?: string | null;
|
|
95
|
-
tag_type:
|
|
129
|
+
instruction?: string | null | undefined;
|
|
130
|
+
tag_type: {
|
|
131
|
+
type: "checkbox" | "text" | "number" | "select" | "folder" | "search" | "date";
|
|
132
|
+
options: string[];
|
|
133
|
+
};
|
|
96
134
|
shared: boolean;
|
|
97
|
-
parent_ext_id?: string | null;
|
|
135
|
+
parent_ext_id?: string | null | undefined;
|
|
98
136
|
doctag_count: number;
|
|
99
137
|
created_by_ext_id: string;
|
|
100
|
-
updated_by_ext_id?: string | null;
|
|
138
|
+
updated_by_ext_id?: string | null | undefined;
|
|
101
139
|
created_at: string;
|
|
102
140
|
updated_at: string;
|
|
103
141
|
}[], Error>;
|
|
@@ -105,16 +143,11 @@ declare function useTags(workspaceId: string | undefined, options?: {
|
|
|
105
143
|
declare function useAssistantQuery(): _tanstack_react_query.UseMutationResult<SSEStreamResult, Error, {
|
|
106
144
|
question: string;
|
|
107
145
|
docIds: string[];
|
|
108
|
-
|
|
109
|
-
|
|
146
|
+
previousResponseId?: string | null;
|
|
147
|
+
model?: string;
|
|
110
148
|
onToken?: (content: string) => void;
|
|
111
|
-
onStreamStart?: (data:
|
|
112
|
-
|
|
113
|
-
}) => void;
|
|
114
|
-
onAgentStep?: (data: {
|
|
115
|
-
focus?: string;
|
|
116
|
-
status?: string;
|
|
117
|
-
}) => void;
|
|
149
|
+
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
150
|
+
onAgentStep?: (data: AgentStepEvent) => void;
|
|
118
151
|
onError?: (message: string) => void;
|
|
119
152
|
onComplete?: () => void;
|
|
120
153
|
}, unknown>;
|
|
@@ -123,10 +156,24 @@ declare function useHealth(options?: {
|
|
|
123
156
|
enabled?: boolean;
|
|
124
157
|
}): _tanstack_react_query.UseQueryResult<{
|
|
125
158
|
status: string;
|
|
126
|
-
backend_git_hash?: string | null;
|
|
127
|
-
frontend_docker_version?: string | null;
|
|
128
|
-
services:
|
|
129
|
-
|
|
159
|
+
backend_git_hash?: string | null | undefined;
|
|
160
|
+
frontend_docker_version?: string | null | undefined;
|
|
161
|
+
services: {
|
|
162
|
+
name: string;
|
|
163
|
+
status: string;
|
|
164
|
+
detail?: string | null | undefined;
|
|
165
|
+
service_info?: {
|
|
166
|
+
[x: string]: unknown;
|
|
167
|
+
} | null | undefined;
|
|
168
|
+
}[];
|
|
169
|
+
models_health?: {
|
|
170
|
+
application: string;
|
|
171
|
+
models: {
|
|
172
|
+
model: string;
|
|
173
|
+
status: string;
|
|
174
|
+
detail?: string | null | undefined;
|
|
175
|
+
}[];
|
|
176
|
+
} | null | undefined;
|
|
130
177
|
available_models: string[];
|
|
131
178
|
}, Error>;
|
|
132
179
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { ArbiOptions, Arbi, SSEStreamResult } from '@arbidocs/
|
|
4
|
-
export { Arbi, ArbiError, ArbiOptions, QueryOptions, SSEStreamCallbacks, SSEStreamResult } from '@arbidocs/
|
|
3
|
+
import { ArbiOptions, Arbi, SSEStreamResult, SSEStreamStartData, AgentStepEvent } from '@arbidocs/sdk/browser';
|
|
4
|
+
export { AgentStepEvent, Arbi, ArbiError, ArbiOptions, ArtifactEvent, MessageMetadataPayload, OutputTokensDetails, QueryOptions, ResponseCompletedEvent, ResponseContentPartAddedEvent, ResponseCreatedEvent, ResponseFailedEvent, ResponseOutputItemAddedEvent, ResponseOutputItemDoneEvent, ResponseOutputTextDeltaEvent, ResponseOutputTextDoneEvent, ResponseUsage, SSEStreamCallbacks, SSEStreamResult, SSEStreamStartData, UserInputRequestEvent, UserMessageEvent } from '@arbidocs/sdk/browser';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
-
import * as
|
|
6
|
+
import * as _arbidocs_client from '@arbidocs/client';
|
|
7
7
|
|
|
8
8
|
interface ArbiProviderProps extends ArbiOptions {
|
|
9
9
|
children: ReactNode;
|
|
@@ -32,16 +32,29 @@ declare function useWorkspaces(options?: {
|
|
|
32
32
|
description: string | null;
|
|
33
33
|
is_public: boolean;
|
|
34
34
|
created_by_ext_id: string;
|
|
35
|
-
updated_by_ext_id?: string | null;
|
|
35
|
+
updated_by_ext_id?: string | null | undefined;
|
|
36
36
|
created_at: string;
|
|
37
37
|
updated_at: string;
|
|
38
|
-
wrapped_key?: string | null;
|
|
38
|
+
wrapped_key?: string | null | undefined;
|
|
39
39
|
shared_conversation_count: number;
|
|
40
40
|
private_conversation_count: number;
|
|
41
41
|
shared_document_count: number;
|
|
42
42
|
private_document_count: number;
|
|
43
43
|
user_files_mb: number;
|
|
44
|
-
users:
|
|
44
|
+
users: {
|
|
45
|
+
user: {
|
|
46
|
+
external_id: string;
|
|
47
|
+
email: string;
|
|
48
|
+
given_name: string;
|
|
49
|
+
family_name: string;
|
|
50
|
+
picture?: string | null | undefined;
|
|
51
|
+
encryption_public_key: string;
|
|
52
|
+
};
|
|
53
|
+
role: _arbidocs_client.components["schemas"]["WorkspaceRole"];
|
|
54
|
+
joined_at: string;
|
|
55
|
+
conversation_count: number;
|
|
56
|
+
document_count: number;
|
|
57
|
+
}[];
|
|
45
58
|
}[], Error>;
|
|
46
59
|
/** List documents in a workspace. */
|
|
47
60
|
declare function useDocuments(workspaceId: string | undefined, options?: {
|
|
@@ -49,27 +62,49 @@ declare function useDocuments(workspaceId: string | undefined, options?: {
|
|
|
49
62
|
}): _tanstack_react_query.UseQueryResult<{
|
|
50
63
|
external_id: string;
|
|
51
64
|
workspace_ext_id: string;
|
|
52
|
-
file_name?: string | null;
|
|
53
|
-
status?: string | null;
|
|
54
|
-
n_pages?: number | null;
|
|
55
|
-
n_chunks?: number | null;
|
|
56
|
-
tokens?: number | null;
|
|
57
|
-
file_type?: string | null;
|
|
58
|
-
file_size?: number | null;
|
|
59
|
-
storage_type?: string | null;
|
|
60
|
-
storage_uri?: string | null;
|
|
61
|
-
content_hash?: string | null;
|
|
62
|
-
shared?: boolean | null;
|
|
63
|
-
re_ocred?: boolean | null;
|
|
64
|
-
config_ext_id?: string | null;
|
|
65
|
-
parent_ext_id?: string | null;
|
|
65
|
+
file_name?: string | null | undefined;
|
|
66
|
+
status?: string | null | undefined;
|
|
67
|
+
n_pages?: number | null | undefined;
|
|
68
|
+
n_chunks?: number | null | undefined;
|
|
69
|
+
tokens?: number | null | undefined;
|
|
70
|
+
file_type?: string | null | undefined;
|
|
71
|
+
file_size?: number | null | undefined;
|
|
72
|
+
storage_type?: string | null | undefined;
|
|
73
|
+
storage_uri?: string | null | undefined;
|
|
74
|
+
content_hash?: string | null | undefined;
|
|
75
|
+
shared?: boolean | null | undefined;
|
|
76
|
+
re_ocred?: boolean | null | undefined;
|
|
77
|
+
config_ext_id?: string | null | undefined;
|
|
78
|
+
parent_ext_id?: string | null | undefined;
|
|
66
79
|
created_by_ext_id: string;
|
|
67
|
-
updated_by_ext_id?: string | null;
|
|
80
|
+
updated_by_ext_id?: string | null | undefined;
|
|
68
81
|
created_at: string;
|
|
69
82
|
updated_at: string;
|
|
70
|
-
wp_type?: string | null;
|
|
71
|
-
doctags:
|
|
72
|
-
|
|
83
|
+
wp_type?: string | null | undefined;
|
|
84
|
+
doctags: {
|
|
85
|
+
doc_ext_id: string;
|
|
86
|
+
tag_ext_id: string;
|
|
87
|
+
note?: string | null | undefined;
|
|
88
|
+
citations?: {
|
|
89
|
+
[x: string]: {
|
|
90
|
+
chunk_ids: string[];
|
|
91
|
+
statement: string;
|
|
92
|
+
offset_start: number;
|
|
93
|
+
offset_end: number;
|
|
94
|
+
};
|
|
95
|
+
} | null | undefined;
|
|
96
|
+
created_by_ext_id: string;
|
|
97
|
+
updated_by_ext_id?: string | null | undefined;
|
|
98
|
+
created_at: string;
|
|
99
|
+
updated_at: string;
|
|
100
|
+
}[];
|
|
101
|
+
doc_metadata?: {
|
|
102
|
+
doc_nature?: string | null | undefined;
|
|
103
|
+
doc_author?: string | null | undefined;
|
|
104
|
+
doc_subject?: string | null | undefined;
|
|
105
|
+
doc_date?: string | null | undefined;
|
|
106
|
+
title?: string | null | undefined;
|
|
107
|
+
} | null | undefined;
|
|
73
108
|
}[], Error>;
|
|
74
109
|
/** List conversations in a workspace. */
|
|
75
110
|
declare function useConversations(workspaceId: string | undefined, options?: {
|
|
@@ -78,7 +113,7 @@ declare function useConversations(workspaceId: string | undefined, options?: {
|
|
|
78
113
|
external_id: string;
|
|
79
114
|
title: string | null;
|
|
80
115
|
created_by_ext_id: string;
|
|
81
|
-
updated_by_ext_id?: string | null;
|
|
116
|
+
updated_by_ext_id?: string | null | undefined;
|
|
82
117
|
created_at: string;
|
|
83
118
|
updated_at: string;
|
|
84
119
|
is_shared: boolean;
|
|
@@ -91,13 +126,16 @@ declare function useTags(workspaceId: string | undefined, options?: {
|
|
|
91
126
|
external_id: string;
|
|
92
127
|
workspace_ext_id: string;
|
|
93
128
|
name: string;
|
|
94
|
-
instruction?: string | null;
|
|
95
|
-
tag_type:
|
|
129
|
+
instruction?: string | null | undefined;
|
|
130
|
+
tag_type: {
|
|
131
|
+
type: "checkbox" | "text" | "number" | "select" | "folder" | "search" | "date";
|
|
132
|
+
options: string[];
|
|
133
|
+
};
|
|
96
134
|
shared: boolean;
|
|
97
|
-
parent_ext_id?: string | null;
|
|
135
|
+
parent_ext_id?: string | null | undefined;
|
|
98
136
|
doctag_count: number;
|
|
99
137
|
created_by_ext_id: string;
|
|
100
|
-
updated_by_ext_id?: string | null;
|
|
138
|
+
updated_by_ext_id?: string | null | undefined;
|
|
101
139
|
created_at: string;
|
|
102
140
|
updated_at: string;
|
|
103
141
|
}[], Error>;
|
|
@@ -105,16 +143,11 @@ declare function useTags(workspaceId: string | undefined, options?: {
|
|
|
105
143
|
declare function useAssistantQuery(): _tanstack_react_query.UseMutationResult<SSEStreamResult, Error, {
|
|
106
144
|
question: string;
|
|
107
145
|
docIds: string[];
|
|
108
|
-
|
|
109
|
-
|
|
146
|
+
previousResponseId?: string | null;
|
|
147
|
+
model?: string;
|
|
110
148
|
onToken?: (content: string) => void;
|
|
111
|
-
onStreamStart?: (data:
|
|
112
|
-
|
|
113
|
-
}) => void;
|
|
114
|
-
onAgentStep?: (data: {
|
|
115
|
-
focus?: string;
|
|
116
|
-
status?: string;
|
|
117
|
-
}) => void;
|
|
149
|
+
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
150
|
+
onAgentStep?: (data: AgentStepEvent) => void;
|
|
118
151
|
onError?: (message: string) => void;
|
|
119
152
|
onComplete?: () => void;
|
|
120
153
|
}, unknown>;
|
|
@@ -123,10 +156,24 @@ declare function useHealth(options?: {
|
|
|
123
156
|
enabled?: boolean;
|
|
124
157
|
}): _tanstack_react_query.UseQueryResult<{
|
|
125
158
|
status: string;
|
|
126
|
-
backend_git_hash?: string | null;
|
|
127
|
-
frontend_docker_version?: string | null;
|
|
128
|
-
services:
|
|
129
|
-
|
|
159
|
+
backend_git_hash?: string | null | undefined;
|
|
160
|
+
frontend_docker_version?: string | null | undefined;
|
|
161
|
+
services: {
|
|
162
|
+
name: string;
|
|
163
|
+
status: string;
|
|
164
|
+
detail?: string | null | undefined;
|
|
165
|
+
service_info?: {
|
|
166
|
+
[x: string]: unknown;
|
|
167
|
+
} | null | undefined;
|
|
168
|
+
}[];
|
|
169
|
+
models_health?: {
|
|
170
|
+
application: string;
|
|
171
|
+
models: {
|
|
172
|
+
model: string;
|
|
173
|
+
status: string;
|
|
174
|
+
detail?: string | null | undefined;
|
|
175
|
+
}[];
|
|
176
|
+
} | null | undefined;
|
|
130
177
|
available_models: string[];
|
|
131
178
|
}, Error>;
|
|
132
179
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useMemo, useContext } from 'react';
|
|
2
|
-
import { Arbi } from '@arbidocs/
|
|
3
|
-
export { Arbi, ArbiError } from '@arbidocs/
|
|
2
|
+
import { Arbi } from '@arbidocs/sdk/browser';
|
|
3
|
+
export { Arbi, ArbiError } from '@arbidocs/sdk/browser';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
6
6
|
|
|
@@ -41,7 +41,7 @@ function useDocuments(workspaceId, options) {
|
|
|
41
41
|
const arbi = useArbi();
|
|
42
42
|
return useQuery({
|
|
43
43
|
queryKey: arbiQueryKeys.documents(workspaceId ?? ""),
|
|
44
|
-
queryFn: () => arbi.documents.list(
|
|
44
|
+
queryFn: () => arbi.documents.list(),
|
|
45
45
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -49,7 +49,7 @@ function useConversations(workspaceId, options) {
|
|
|
49
49
|
const arbi = useArbi();
|
|
50
50
|
return useQuery({
|
|
51
51
|
queryKey: arbiQueryKeys.conversations(workspaceId ?? ""),
|
|
52
|
-
queryFn: () => arbi.conversations.list(
|
|
52
|
+
queryFn: () => arbi.conversations.list(),
|
|
53
53
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -57,7 +57,7 @@ function useTags(workspaceId, options) {
|
|
|
57
57
|
const arbi = useArbi();
|
|
58
58
|
return useQuery({
|
|
59
59
|
queryKey: arbiQueryKeys.tags(workspaceId ?? ""),
|
|
60
|
-
queryFn: () => arbi.tags.list(
|
|
60
|
+
queryFn: () => arbi.tags.list(),
|
|
61
61
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace
|
|
62
62
|
});
|
|
63
63
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ArbiProvider.tsx","../src/useArbi.ts","../src/hooks.ts"],"names":[],"mappings":";;;;;;;AAYO,IAAM,WAAA,GAAc,cAA2B,IAAI,CAAA;AAMnD,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,GAAG,SAAQ,EAAsB;AACxE,EAAA,MAAM,IAAA,GAAO,OAAA;AAAA,IACX,MAAM,IAAI,IAAA,CAAK,OAAO,CAAA;AAAA;AAAA;AAAA,IAGtB,CAAC,OAAA,CAAQ,GAAA,EAAK,OAAA,CAAQ,gBAAA,EAAkB,QAAQ,WAAW;AAAA,GAC7D;AAEA,EAAA,2BAAQ,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,MAAO,QAAA,EAAS,CAAA;AACtD;ACnBO,SAAS,OAAA,GAAgB;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAW,WAAW,CAAA;AACnC,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,IAAA;AACT;ACJO,IAAM,aAAA,GAAgB;AAAA,EAC3B,UAAA,EAAY,MAAM,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,EACvC,WAAW,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,aAAa,WAAW,CAAA;AAAA,EACrE,eAAe,CAAC,WAAA,KAAwB,CAAC,MAAA,EAAQ,iBAAiB,WAAW,CAAA;AAAA,EAC7E,MAAM,CAAC,W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AAAA,IACd,QAAA,EAAU,aAAA,CAAc,aAAA,CAAc,WAAA,IAAe,EAAE,CAAA;AAAA,IACvD,OAAA,EAAS,MAAM,IAAA,CAAK,aAAA,CAAc,IAAA,EAAK;AAAA,IACvC,UAAU,OAAA,EAAS,OAAA,IAAW,SAAS,CAAC,CAAC,eAAe,IAAA,CAAK;AAAA,GAC9D,CAAA;AACH;AAGO,SAAS,OAAA,CAAQ,aAAiC,OAAA,EAAiC;AACxF,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,aAAA,CAAc,IAAA,CAAK,WAAA,IAAe,EAAE,CAAA;AAAA,IAC9C,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAA,EAAK;AAAA,IAC9B,UAAU,OAAA,EAAS,OAAA,IAAW,SAAS,CAAC,CAAC,eAAe,IAAA,CAAK;AAAA,GAC9D,CAAA;AACH;AAGO,SAAS,iBAAA,GAAoB;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AAErB,EAAA,OAAO,WAAA,CAcL;AAAA,IACA,UAAA,EAAY,CAAC,EAAE,QAAA,EAAU,GAAG,OAAA,EAAQ,KAAM,IAAA,CAAK,SAAA,CAAU,KAAA,CAAM,QAAA,EAAU,OAAO;AAAA,GACjF,CAAA;AACH;AAGO,SAAS,UAAU,OAAA,EAAiC;AACzD,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,cAAc,MAAA,EAAO;AAAA,IAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,KAAA,EAAM;AAAA,IACjC,SAAS,OAAA,EAAS;AAAA,GACnB,CAAA;AACH","file":"index.js","sourcesContent":["/**\n * ArbiProvider — React context that holds an Arbi instance.\n *\n * Usage:\n * <ArbiProvider url=\"https://arbi.mycompany.com\">\n * <App />\n * </ArbiProvider>\n */\n\nimport { createContext, useMemo, type ReactNode } from 'react'\nimport { Arbi, type ArbiOptions } from '@arbidocs/sdk/browser'\n\nexport const ArbiContext = createContext<Arbi | null>(null)\n\nexport interface ArbiProviderProps extends ArbiOptions {\n children: ReactNode\n}\n\nexport function ArbiProvider({ children, ...options }: ArbiProviderProps) {\n const arbi = useMemo(\n () => new Arbi(options),\n // Stable on url + deploymentDomain — re-creating the instance on every render would be wrong\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.url, options.deploymentDomain, options.credentials]\n )\n\n return <ArbiContext.Provider value={arbi}>{children}</ArbiContext.Provider>\n}\n","/**\n * Hook to access the Arbi instance from the nearest ArbiProvider.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { ArbiContext } from './ArbiProvider'\n\nexport function useArbi(): Arbi {\n const arbi = useContext(ArbiContext)\n if (!arbi) {\n throw new Error('useArbi() must be used within an <ArbiProvider>')\n }\n return arbi\n}\n","/**\n * React Query hooks that use the Arbi instance from context.\n */\n\nimport { useQuery, useMutation } from '@tanstack/react-query'\nimport type { SSEStreamResult, SSEStreamStartData, AgentStepEvent } from '@arbidocs/sdk/browser'\nimport { useArbi } from './useArbi'\n\n// ── Query keys ──────────────────────────────────────────────────────────────\n\nexport const arbiQueryKeys = {\n workspaces: () => ['arbi', 'workspaces'] as const,\n documents: (workspaceId: string) => ['arbi', 'documents', workspaceId] as const,\n conversations: (workspaceId: string) => ['arbi', 'conversations', workspaceId] as const,\n tags: (workspaceId: string) => ['arbi', 'tags', workspaceId] as const,\n health: () => ['arbi', 'health'] as const,\n}\n\n// ── Hooks ───────────────────────────────────────────────────────────────────\n\n/** List the logged-in user's workspaces. */\nexport function useWorkspaces(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.workspaces(),\n queryFn: () => arbi.workspaces.list(),\n enabled: options?.enabled ?? arbi.isLoggedIn,\n })\n}\n\n/** List documents in a workspace. */\nexport function useDocuments(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.documents(workspaceId ?? ''),\n queryFn: () => arbi.documents.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** List conversations in a workspace. */\nexport function useConversations(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.conversations(workspaceId ?? ''),\n queryFn: () => arbi.conversations.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** List tags in a workspace. */\nexport function useTags(workspaceId: string | undefined, options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.tags(workspaceId ?? ''),\n queryFn: () => arbi.tags.list(),\n enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,\n })\n}\n\n/** Send a streaming query to the RAG assistant. Returns a mutation. */\nexport function useAssistantQuery() {\n const arbi = useArbi()\n\n return useMutation<\n SSEStreamResult,\n Error,\n {\n question: string\n docIds: string[]\n previousResponseId?: string | null\n model?: string\n onToken?: (content: string) => void\n onStreamStart?: (data: SSEStreamStartData) => void\n onAgentStep?: (data: AgentStepEvent) => void\n onError?: (message: string) => void\n onComplete?: () => void\n }\n >({\n mutationFn: ({ question, ...options }) => arbi.assistant.query(question, options),\n })\n}\n\n/** Check backend health. */\nexport function useHealth(options?: { enabled?: boolean }) {\n const arbi = useArbi()\n return useQuery({\n queryKey: arbiQueryKeys.health(),\n queryFn: () => arbi.health.check(),\n enabled: options?.enabled,\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "React hooks and provider for the ARBI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"typecheck": "tsc --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@arbidocs/
|
|
26
|
-
"@arbidocs/
|
|
25
|
+
"@arbidocs/sdk": "0.3.10",
|
|
26
|
+
"@arbidocs/client": "0.3.10",
|
|
27
27
|
"@tanstack/react-query": ">=5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/
|
|
50
|
+
"url": "git+https://github.com/arbicity/ARBI-frontend.git",
|
|
51
51
|
"directory": "packages/arbi-react"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|