@rickydata/react 0.1.1 → 0.1.3

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/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  useAgents: () => useAgents,
34
34
  useApiKeyStatus: () => useApiKeyStatus,
35
35
  useDeleteApiKey: () => useDeleteApiKey,
36
+ useDeleteOpenAIApiKey: () => useDeleteOpenAIApiKey,
36
37
  useDeleteSession: () => useDeleteSession,
37
38
  useOpenAIApiKeyStatus: () => useOpenAIApiKeyStatus,
38
39
  useRickyData: () => useRickyData,
@@ -57,10 +58,11 @@ function RickyDataProvider({ config, client, children }) {
57
58
  const agentClient = (0, import_react.useMemo)(() => {
58
59
  if (client) return client;
59
60
  if (!config) throw new Error("RickyDataProvider requires either `config` or `client`");
60
- return new import_agent.AgentClient({
61
- tokenGetter: config.getAuthToken,
61
+ const opts = {
62
62
  gatewayUrl: config.gatewayUrl
63
- });
63
+ };
64
+ opts.tokenGetter = config.getAuthToken;
65
+ return new import_agent.AgentClient(opts);
64
66
  }, [client, config?.getAuthToken, config?.gatewayUrl]);
65
67
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RickyDataContext.Provider, { value: agentClient, children });
66
68
  }
@@ -105,12 +107,13 @@ var apiKeyKeys = {
105
107
  status: () => [...apiKeyKeys.all, "status"],
106
108
  openai: () => [...apiKeyKeys.all, "openai"]
107
109
  };
108
- function useApiKeyStatus() {
110
+ function useApiKeyStatus(opts) {
109
111
  const client = useRickyData();
110
112
  return (0, import_react_query2.useQuery)({
111
113
  queryKey: apiKeyKeys.status(),
112
114
  queryFn: () => client.getApiKeyStatus(),
113
- staleTime: 3e4
115
+ staleTime: 3e4,
116
+ enabled: opts?.enabled !== false
114
117
  });
115
118
  }
116
119
  function useSetApiKey() {
@@ -133,12 +136,13 @@ function useDeleteApiKey() {
133
136
  }
134
137
  });
135
138
  }
136
- function useOpenAIApiKeyStatus() {
139
+ function useOpenAIApiKeyStatus(opts) {
137
140
  const client = useRickyData();
138
141
  return (0, import_react_query2.useQuery)({
139
142
  queryKey: apiKeyKeys.openai(),
140
143
  queryFn: () => client.getOpenAIApiKeyStatus(),
141
- staleTime: 3e4
144
+ staleTime: 3e4,
145
+ enabled: opts?.enabled !== false
142
146
  });
143
147
  }
144
148
  function useSetOpenAIApiKey() {
@@ -151,6 +155,16 @@ function useSetOpenAIApiKey() {
151
155
  }
152
156
  });
153
157
  }
158
+ function useDeleteOpenAIApiKey() {
159
+ const client = useRickyData();
160
+ const queryClient = (0, import_react_query2.useQueryClient)();
161
+ return (0, import_react_query2.useMutation)({
162
+ mutationFn: () => client.deleteOpenAIApiKey(),
163
+ onSuccess: () => {
164
+ queryClient.invalidateQueries({ queryKey: apiKeyKeys.openai() });
165
+ }
166
+ });
167
+ }
154
168
 
155
169
  // src/hooks/balance.ts
156
170
  var import_react_query3 = require("@tanstack/react-query");
@@ -953,6 +967,7 @@ function WalletChip({ address, balanceDisplay, displayName, onPress, className }
953
967
  useAgents,
954
968
  useApiKeyStatus,
955
969
  useDeleteApiKey,
970
+ useDeleteOpenAIApiKey,
956
971
  useDeleteSession,
957
972
  useOpenAIApiKeyStatus,
958
973
  useRickyData,
package/dist/index.d.cts CHANGED
@@ -48,7 +48,9 @@ declare const apiKeyKeys: {
48
48
  openai: () => readonly ["apikey", "openai"];
49
49
  };
50
50
  /** Check if Anthropic API key is configured. */
51
- declare function useApiKeyStatus(): _tanstack_react_query.UseQueryResult<{
51
+ declare function useApiKeyStatus(opts?: {
52
+ enabled?: boolean;
53
+ }): _tanstack_react_query.UseQueryResult<{
52
54
  configured: boolean;
53
55
  }, Error>;
54
56
  /** Mutation to set the Anthropic API key. Invalidates status on success. */
@@ -58,13 +60,17 @@ declare function useSetApiKey(): _tanstack_react_query.UseMutationResult<{
58
60
  /** Mutation to delete the Anthropic API key. */
59
61
  declare function useDeleteApiKey(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
60
62
  /** Check if OpenAI API key is configured. */
61
- declare function useOpenAIApiKeyStatus(): _tanstack_react_query.UseQueryResult<{
63
+ declare function useOpenAIApiKeyStatus(opts?: {
64
+ enabled?: boolean;
65
+ }): _tanstack_react_query.UseQueryResult<{
62
66
  configured: boolean;
63
67
  }, Error>;
64
68
  /** Mutation to set the OpenAI API key. */
65
69
  declare function useSetOpenAIApiKey(): _tanstack_react_query.UseMutationResult<{
66
70
  configured: boolean;
67
71
  }, Error, string, unknown>;
72
+ /** Mutation to delete the OpenAI API key. */
73
+ declare function useDeleteOpenAIApiKey(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
68
74
 
69
75
  declare const balanceKeys: {
70
76
  all: readonly ["wallet-balance"];
@@ -600,4 +606,4 @@ interface WalletChipProps {
600
606
  */
601
607
  declare function WalletChip({ address, balanceDisplay, displayName, onPress, className }: WalletChipProps): react_jsx_runtime.JSX.Element;
602
608
 
603
- export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
609
+ export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
package/dist/index.d.ts CHANGED
@@ -48,7 +48,9 @@ declare const apiKeyKeys: {
48
48
  openai: () => readonly ["apikey", "openai"];
49
49
  };
50
50
  /** Check if Anthropic API key is configured. */
51
- declare function useApiKeyStatus(): _tanstack_react_query.UseQueryResult<{
51
+ declare function useApiKeyStatus(opts?: {
52
+ enabled?: boolean;
53
+ }): _tanstack_react_query.UseQueryResult<{
52
54
  configured: boolean;
53
55
  }, Error>;
54
56
  /** Mutation to set the Anthropic API key. Invalidates status on success. */
@@ -58,13 +60,17 @@ declare function useSetApiKey(): _tanstack_react_query.UseMutationResult<{
58
60
  /** Mutation to delete the Anthropic API key. */
59
61
  declare function useDeleteApiKey(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
60
62
  /** Check if OpenAI API key is configured. */
61
- declare function useOpenAIApiKeyStatus(): _tanstack_react_query.UseQueryResult<{
63
+ declare function useOpenAIApiKeyStatus(opts?: {
64
+ enabled?: boolean;
65
+ }): _tanstack_react_query.UseQueryResult<{
62
66
  configured: boolean;
63
67
  }, Error>;
64
68
  /** Mutation to set the OpenAI API key. */
65
69
  declare function useSetOpenAIApiKey(): _tanstack_react_query.UseMutationResult<{
66
70
  configured: boolean;
67
71
  }, Error, string, unknown>;
72
+ /** Mutation to delete the OpenAI API key. */
73
+ declare function useDeleteOpenAIApiKey(): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
68
74
 
69
75
  declare const balanceKeys: {
70
76
  all: readonly ["wallet-balance"];
@@ -600,4 +606,4 @@ interface WalletChipProps {
600
606
  */
601
607
  declare function WalletChip({ address, balanceDisplay, displayName, onPress, className }: WalletChipProps): react_jsx_runtime.JSX.Element;
602
608
 
603
- export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
609
+ export { type ChatMessage, RickyDataProvider, type RickyDataProviderProps, SecretForm, type SecretFormProps, SecretOrchestrator, type SecretOrchestratorProps, type SecretSection, type ToolExecution, type UseAgentChatOptions, type UseAgentChatResult, WalletChip, type WalletChipProps, agentKeys, apiKeyKeys, balanceKeys, sessionKeys, useAgent, useAgentChat, useAgents, useApiKeyStatus, useDeleteApiKey, useDeleteOpenAIApiKey, useDeleteSession, useOpenAIApiKeyStatus, useRickyData, useSecrets, useSession, useSessions, useSetApiKey, useSetOpenAIApiKey, useWalletBalance, useWalletSettings, useWalletTransactions, walletSettingsKeys };
package/dist/index.js CHANGED
@@ -7,10 +7,11 @@ function RickyDataProvider({ config, client, children }) {
7
7
  const agentClient = useMemo(() => {
8
8
  if (client) return client;
9
9
  if (!config) throw new Error("RickyDataProvider requires either `config` or `client`");
10
- return new AgentClient({
11
- tokenGetter: config.getAuthToken,
10
+ const opts = {
12
11
  gatewayUrl: config.gatewayUrl
13
- });
12
+ };
13
+ opts.tokenGetter = config.getAuthToken;
14
+ return new AgentClient(opts);
14
15
  }, [client, config?.getAuthToken, config?.gatewayUrl]);
15
16
  return /* @__PURE__ */ jsx(RickyDataContext.Provider, { value: agentClient, children });
16
17
  }
@@ -55,12 +56,13 @@ var apiKeyKeys = {
55
56
  status: () => [...apiKeyKeys.all, "status"],
56
57
  openai: () => [...apiKeyKeys.all, "openai"]
57
58
  };
58
- function useApiKeyStatus() {
59
+ function useApiKeyStatus(opts) {
59
60
  const client = useRickyData();
60
61
  return useQuery2({
61
62
  queryKey: apiKeyKeys.status(),
62
63
  queryFn: () => client.getApiKeyStatus(),
63
- staleTime: 3e4
64
+ staleTime: 3e4,
65
+ enabled: opts?.enabled !== false
64
66
  });
65
67
  }
66
68
  function useSetApiKey() {
@@ -83,12 +85,13 @@ function useDeleteApiKey() {
83
85
  }
84
86
  });
85
87
  }
86
- function useOpenAIApiKeyStatus() {
88
+ function useOpenAIApiKeyStatus(opts) {
87
89
  const client = useRickyData();
88
90
  return useQuery2({
89
91
  queryKey: apiKeyKeys.openai(),
90
92
  queryFn: () => client.getOpenAIApiKeyStatus(),
91
- staleTime: 3e4
93
+ staleTime: 3e4,
94
+ enabled: opts?.enabled !== false
92
95
  });
93
96
  }
94
97
  function useSetOpenAIApiKey() {
@@ -101,6 +104,16 @@ function useSetOpenAIApiKey() {
101
104
  }
102
105
  });
103
106
  }
107
+ function useDeleteOpenAIApiKey() {
108
+ const client = useRickyData();
109
+ const queryClient = useQueryClient();
110
+ return useMutation({
111
+ mutationFn: () => client.deleteOpenAIApiKey(),
112
+ onSuccess: () => {
113
+ queryClient.invalidateQueries({ queryKey: apiKeyKeys.openai() });
114
+ }
115
+ });
116
+ }
104
117
 
105
118
  // src/hooks/balance.ts
106
119
  import { useQuery as useQuery3 } from "@tanstack/react-query";
@@ -902,6 +915,7 @@ export {
902
915
  useAgents,
903
916
  useApiKeyStatus,
904
917
  useDeleteApiKey,
918
+ useDeleteOpenAIApiKey,
905
919
  useDeleteSession,
906
920
  useOpenAIApiKeyStatus,
907
921
  useRickyData,
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@rickydata/react",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "React hooks, providers, and components for the rickydata Agent Gateway SDK",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./dist/index.d.ts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.js"
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
14
  }
15
15
  },
16
16
  "files": ["dist"],