@emblemvault/hustle-react 1.0.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.
Files changed (38) hide show
  1. package/README.md +225 -0
  2. package/dist/browser/hustle-react.js +14705 -0
  3. package/dist/browser/hustle-react.js.map +1 -0
  4. package/dist/components/index.cjs +3170 -0
  5. package/dist/components/index.cjs.map +1 -0
  6. package/dist/components/index.d.cts +58 -0
  7. package/dist/components/index.d.ts +58 -0
  8. package/dist/components/index.js +3143 -0
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/hooks/index.cjs +695 -0
  11. package/dist/hooks/index.cjs.map +1 -0
  12. package/dist/hooks/index.d.cts +46 -0
  13. package/dist/hooks/index.d.ts +46 -0
  14. package/dist/hooks/index.js +691 -0
  15. package/dist/hooks/index.js.map +1 -0
  16. package/dist/hustle-S48t4lTZ.d.cts +222 -0
  17. package/dist/hustle-S48t4lTZ.d.ts +222 -0
  18. package/dist/index.cjs +3588 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.cts +229 -0
  21. package/dist/index.d.ts +229 -0
  22. package/dist/index.js +3547 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/plugin-BUg7vMxe.d.cts +172 -0
  25. package/dist/plugin-BUg7vMxe.d.ts +172 -0
  26. package/dist/plugins/index.cjs +1235 -0
  27. package/dist/plugins/index.cjs.map +1 -0
  28. package/dist/plugins/index.d.cts +192 -0
  29. package/dist/plugins/index.d.ts +192 -0
  30. package/dist/plugins/index.js +1225 -0
  31. package/dist/plugins/index.js.map +1 -0
  32. package/dist/providers/index.cjs +694 -0
  33. package/dist/providers/index.cjs.map +1 -0
  34. package/dist/providers/index.d.cts +46 -0
  35. package/dist/providers/index.d.ts +46 -0
  36. package/dist/providers/index.js +691 -0
  37. package/dist/providers/index.js.map +1 -0
  38. package/package.json +87 -0
@@ -0,0 +1,229 @@
1
+ export { HustleProvider, useHustle } from './providers/index.cjs';
2
+ export { HustleChat, HustleChatProps, MarkdownContent } from './components/index.cjs';
3
+ export { A as Attachment, C as ChatMessage, b as ChatOptions, d as ChatResponse, H as HustleConfig, h as HustleContextValue, i as HustleProviderProps, M as Model, c as StreamChunk, g as StreamEndEvent, S as StreamOptions, T as ToolCall, f as ToolEndEvent, a as ToolResult, e as ToolStartEvent } from './hustle-S48t4lTZ.cjs';
4
+ import { S as StoredPlugin, H as HustlePlugin, a as HydratedPlugin } from './plugin-BUg7vMxe.cjs';
5
+ export { C as ClientToolDefinition, E as ErrorContext, d as HustleRequest, J as JSONSchema, b as JSONSchemaProperty, e as PluginHooks, P as ProcessedResponse, f as SerializedHooks, c as SerializedToolDefinition, T as ToolExecutor } from './plugin-BUg7vMxe.cjs';
6
+ export { UsePluginsReturn, usePlugins } from './hooks/index.cjs';
7
+ export { AvailablePlugin, availablePlugins, getAvailablePlugin, migrateFunPlugin, predictionMarketPlugin } from './plugins/index.cjs';
8
+ import 'react/jsx-runtime';
9
+ import 'hustle-incognito';
10
+
11
+ /**
12
+ * Plugin Registry
13
+ *
14
+ * Manages plugin storage and state in localStorage.
15
+ *
16
+ * Storage model:
17
+ * - Installed plugins are GLOBAL (hustle-plugins) - install once, available everywhere
18
+ * - Enabled/disabled state is INSTANCE-SCOPED (hustle-plugin-state-{instanceId})
19
+ *
20
+ * Executor functions are serialized as strings (executorCode) and
21
+ * reconstituted at runtime via new Function().
22
+ *
23
+ * SECURITY TODO: Add signature verification before executing stored code.
24
+ * Plugins should be signed by trusted publishers and verified before
25
+ * any eval/Function execution occurs.
26
+ */
27
+
28
+ type PluginChangeCallback = (plugins: StoredPlugin[]) => void;
29
+ /**
30
+ * Hydrate a stored plugin - reconstitute executors from executorCode
31
+ *
32
+ * FIXME: Add signature verification before execution
33
+ */
34
+ declare function hydratePlugin(stored: StoredPlugin): HydratedPlugin;
35
+ /**
36
+ * Plugin Registry class
37
+ *
38
+ * Manages plugin persistence with:
39
+ * - Global plugin installations (with serialized executorCode)
40
+ * - Instance-scoped enabled/disabled state
41
+ */
42
+ declare class PluginRegistry {
43
+ private listeners;
44
+ /**
45
+ * Get listeners for a specific instance
46
+ */
47
+ private getListeners;
48
+ /**
49
+ * Load installed plugins (global)
50
+ */
51
+ private loadInstalledPlugins;
52
+ /**
53
+ * Save installed plugins (global)
54
+ * Serializes executors as executorCode strings
55
+ */
56
+ private saveInstalledPlugins;
57
+ /**
58
+ * Load enabled state for an instance
59
+ */
60
+ private loadEnabledState;
61
+ /**
62
+ * Save enabled state for an instance
63
+ */
64
+ private saveEnabledState;
65
+ /**
66
+ * Load plugins with instance-specific enabled state
67
+ * Combines global plugin list with per-instance enabled state
68
+ */
69
+ loadFromStorage(instanceId?: string): StoredPlugin[];
70
+ /**
71
+ * Register a new plugin (global - available to all instances)
72
+ * Serializes executors as executorCode for persistence
73
+ *
74
+ * @param plugin The plugin to install
75
+ * @param enabled Initial enabled state for this instance (default: true)
76
+ * @param instanceId Instance to set initial enabled state for
77
+ */
78
+ register(plugin: HustlePlugin, enabled?: boolean, instanceId?: string): void;
79
+ /**
80
+ * Unregister a plugin (global - removes from all instances)
81
+ */
82
+ unregister(pluginName: string, instanceId?: string): void;
83
+ /**
84
+ * Enable or disable a plugin (instance-scoped)
85
+ */
86
+ setEnabled(pluginName: string, enabled: boolean, instanceId?: string): void;
87
+ /**
88
+ * Check if a plugin is installed (global)
89
+ */
90
+ isRegistered(pluginName: string): boolean;
91
+ /**
92
+ * Get a specific plugin with instance-specific enabled state
93
+ */
94
+ getPlugin(pluginName: string, instanceId?: string): StoredPlugin | undefined;
95
+ /**
96
+ * Get all enabled plugins for an instance (hydrated with executors)
97
+ */
98
+ getEnabledPlugins(instanceId?: string): HydratedPlugin[];
99
+ /**
100
+ * Subscribe to plugin changes for a specific instance
101
+ */
102
+ onChange(callback: PluginChangeCallback, instanceId?: string): () => void;
103
+ /**
104
+ * Notify all listeners for a specific instance
105
+ */
106
+ private notifyListeners;
107
+ /**
108
+ * Clear enabled state for an instance (plugins remain installed globally)
109
+ */
110
+ clear(instanceId?: string): void;
111
+ /**
112
+ * Clear all installed plugins globally
113
+ */
114
+ clearAll(): void;
115
+ }
116
+ declare const pluginRegistry: PluginRegistry;
117
+
118
+ /**
119
+ * Format file size for display
120
+ * @example formatFileSize(1024) => '1 KB'
121
+ */
122
+ declare function formatFileSize(bytes: number): string;
123
+ /**
124
+ * Create a debounced function
125
+ */
126
+ declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): (...args: Parameters<T>) => void;
127
+ /**
128
+ * Storage keys for persistence
129
+ */
130
+ declare const STORAGE_KEYS: {
131
+ readonly AUTH_SESSION: "emblem_auth_session";
132
+ readonly HUSTLE_SETTINGS: "hustle_settings";
133
+ readonly CHAT_HISTORY: "hustle_chat_history";
134
+ readonly PLUGINS: "hustle-plugins";
135
+ };
136
+ /**
137
+ * Default configuration values
138
+ */
139
+ declare const DEFAULTS: {
140
+ readonly HUSTLE_API_URL: "https://agenthustle.ai";
141
+ readonly EMBLEM_API_URL: "https://api.emblemvault.ai";
142
+ readonly EMBLEM_MODAL_URL: "https://emblemvault.ai/connect";
143
+ };
144
+
145
+ declare const tokens: {
146
+ colors: {
147
+ bgPrimary: string;
148
+ bgSecondary: string;
149
+ bgTertiary: string;
150
+ bgHover: string;
151
+ bgOverlay: string;
152
+ borderPrimary: string;
153
+ borderSecondary: string;
154
+ borderHover: string;
155
+ textPrimary: string;
156
+ textSecondary: string;
157
+ textTertiary: string;
158
+ textInverse: string;
159
+ accentPrimary: string;
160
+ accentPrimaryHover: string;
161
+ accentPrimaryBg: string;
162
+ accentSuccess: string;
163
+ accentSuccessHover: string;
164
+ accentSuccessBg: string;
165
+ accentWarning: string;
166
+ accentWarningBg: string;
167
+ accentError: string;
168
+ accentErrorHover: string;
169
+ accentErrorBg: string;
170
+ msgUser: string;
171
+ msgAssistant: string;
172
+ };
173
+ typography: {
174
+ fontFamily: string;
175
+ fontFamilyMono: string;
176
+ fontSizeXs: string;
177
+ fontSizeSm: string;
178
+ fontSizeMd: string;
179
+ fontSizeLg: string;
180
+ fontSizeXl: string;
181
+ fontWeightNormal: number;
182
+ fontWeightMedium: number;
183
+ fontWeightSemibold: number;
184
+ lineHeightTight: number;
185
+ lineHeightNormal: number;
186
+ lineHeightRelaxed: number;
187
+ };
188
+ spacing: {
189
+ xs: string;
190
+ sm: string;
191
+ md: string;
192
+ lg: string;
193
+ xl: string;
194
+ xxl: string;
195
+ };
196
+ radius: {
197
+ sm: string;
198
+ md: string;
199
+ lg: string;
200
+ xl: string;
201
+ pill: string;
202
+ full: string;
203
+ };
204
+ shadows: {
205
+ sm: string;
206
+ md: string;
207
+ lg: string;
208
+ xl: string;
209
+ };
210
+ glows: {
211
+ primary: string;
212
+ success: string;
213
+ error: string;
214
+ ambient: string;
215
+ };
216
+ transitions: {
217
+ fast: string;
218
+ normal: string;
219
+ slow: string;
220
+ };
221
+ zIndex: {
222
+ dropdown: number;
223
+ modal: number;
224
+ fullscreen: number;
225
+ modalOverFullscreen: number;
226
+ };
227
+ };
228
+
229
+ export { DEFAULTS, HustlePlugin, HydratedPlugin, STORAGE_KEYS, StoredPlugin, debounce, formatFileSize, hydratePlugin, pluginRegistry, tokens };
@@ -0,0 +1,229 @@
1
+ export { HustleProvider, useHustle } from './providers/index.js';
2
+ export { HustleChat, HustleChatProps, MarkdownContent } from './components/index.js';
3
+ export { A as Attachment, C as ChatMessage, b as ChatOptions, d as ChatResponse, H as HustleConfig, h as HustleContextValue, i as HustleProviderProps, M as Model, c as StreamChunk, g as StreamEndEvent, S as StreamOptions, T as ToolCall, f as ToolEndEvent, a as ToolResult, e as ToolStartEvent } from './hustle-S48t4lTZ.js';
4
+ import { S as StoredPlugin, H as HustlePlugin, a as HydratedPlugin } from './plugin-BUg7vMxe.js';
5
+ export { C as ClientToolDefinition, E as ErrorContext, d as HustleRequest, J as JSONSchema, b as JSONSchemaProperty, e as PluginHooks, P as ProcessedResponse, f as SerializedHooks, c as SerializedToolDefinition, T as ToolExecutor } from './plugin-BUg7vMxe.js';
6
+ export { UsePluginsReturn, usePlugins } from './hooks/index.js';
7
+ export { AvailablePlugin, availablePlugins, getAvailablePlugin, migrateFunPlugin, predictionMarketPlugin } from './plugins/index.js';
8
+ import 'react/jsx-runtime';
9
+ import 'hustle-incognito';
10
+
11
+ /**
12
+ * Plugin Registry
13
+ *
14
+ * Manages plugin storage and state in localStorage.
15
+ *
16
+ * Storage model:
17
+ * - Installed plugins are GLOBAL (hustle-plugins) - install once, available everywhere
18
+ * - Enabled/disabled state is INSTANCE-SCOPED (hustle-plugin-state-{instanceId})
19
+ *
20
+ * Executor functions are serialized as strings (executorCode) and
21
+ * reconstituted at runtime via new Function().
22
+ *
23
+ * SECURITY TODO: Add signature verification before executing stored code.
24
+ * Plugins should be signed by trusted publishers and verified before
25
+ * any eval/Function execution occurs.
26
+ */
27
+
28
+ type PluginChangeCallback = (plugins: StoredPlugin[]) => void;
29
+ /**
30
+ * Hydrate a stored plugin - reconstitute executors from executorCode
31
+ *
32
+ * FIXME: Add signature verification before execution
33
+ */
34
+ declare function hydratePlugin(stored: StoredPlugin): HydratedPlugin;
35
+ /**
36
+ * Plugin Registry class
37
+ *
38
+ * Manages plugin persistence with:
39
+ * - Global plugin installations (with serialized executorCode)
40
+ * - Instance-scoped enabled/disabled state
41
+ */
42
+ declare class PluginRegistry {
43
+ private listeners;
44
+ /**
45
+ * Get listeners for a specific instance
46
+ */
47
+ private getListeners;
48
+ /**
49
+ * Load installed plugins (global)
50
+ */
51
+ private loadInstalledPlugins;
52
+ /**
53
+ * Save installed plugins (global)
54
+ * Serializes executors as executorCode strings
55
+ */
56
+ private saveInstalledPlugins;
57
+ /**
58
+ * Load enabled state for an instance
59
+ */
60
+ private loadEnabledState;
61
+ /**
62
+ * Save enabled state for an instance
63
+ */
64
+ private saveEnabledState;
65
+ /**
66
+ * Load plugins with instance-specific enabled state
67
+ * Combines global plugin list with per-instance enabled state
68
+ */
69
+ loadFromStorage(instanceId?: string): StoredPlugin[];
70
+ /**
71
+ * Register a new plugin (global - available to all instances)
72
+ * Serializes executors as executorCode for persistence
73
+ *
74
+ * @param plugin The plugin to install
75
+ * @param enabled Initial enabled state for this instance (default: true)
76
+ * @param instanceId Instance to set initial enabled state for
77
+ */
78
+ register(plugin: HustlePlugin, enabled?: boolean, instanceId?: string): void;
79
+ /**
80
+ * Unregister a plugin (global - removes from all instances)
81
+ */
82
+ unregister(pluginName: string, instanceId?: string): void;
83
+ /**
84
+ * Enable or disable a plugin (instance-scoped)
85
+ */
86
+ setEnabled(pluginName: string, enabled: boolean, instanceId?: string): void;
87
+ /**
88
+ * Check if a plugin is installed (global)
89
+ */
90
+ isRegistered(pluginName: string): boolean;
91
+ /**
92
+ * Get a specific plugin with instance-specific enabled state
93
+ */
94
+ getPlugin(pluginName: string, instanceId?: string): StoredPlugin | undefined;
95
+ /**
96
+ * Get all enabled plugins for an instance (hydrated with executors)
97
+ */
98
+ getEnabledPlugins(instanceId?: string): HydratedPlugin[];
99
+ /**
100
+ * Subscribe to plugin changes for a specific instance
101
+ */
102
+ onChange(callback: PluginChangeCallback, instanceId?: string): () => void;
103
+ /**
104
+ * Notify all listeners for a specific instance
105
+ */
106
+ private notifyListeners;
107
+ /**
108
+ * Clear enabled state for an instance (plugins remain installed globally)
109
+ */
110
+ clear(instanceId?: string): void;
111
+ /**
112
+ * Clear all installed plugins globally
113
+ */
114
+ clearAll(): void;
115
+ }
116
+ declare const pluginRegistry: PluginRegistry;
117
+
118
+ /**
119
+ * Format file size for display
120
+ * @example formatFileSize(1024) => '1 KB'
121
+ */
122
+ declare function formatFileSize(bytes: number): string;
123
+ /**
124
+ * Create a debounced function
125
+ */
126
+ declare function debounce<T extends (...args: unknown[]) => unknown>(fn: T, delay: number): (...args: Parameters<T>) => void;
127
+ /**
128
+ * Storage keys for persistence
129
+ */
130
+ declare const STORAGE_KEYS: {
131
+ readonly AUTH_SESSION: "emblem_auth_session";
132
+ readonly HUSTLE_SETTINGS: "hustle_settings";
133
+ readonly CHAT_HISTORY: "hustle_chat_history";
134
+ readonly PLUGINS: "hustle-plugins";
135
+ };
136
+ /**
137
+ * Default configuration values
138
+ */
139
+ declare const DEFAULTS: {
140
+ readonly HUSTLE_API_URL: "https://agenthustle.ai";
141
+ readonly EMBLEM_API_URL: "https://api.emblemvault.ai";
142
+ readonly EMBLEM_MODAL_URL: "https://emblemvault.ai/connect";
143
+ };
144
+
145
+ declare const tokens: {
146
+ colors: {
147
+ bgPrimary: string;
148
+ bgSecondary: string;
149
+ bgTertiary: string;
150
+ bgHover: string;
151
+ bgOverlay: string;
152
+ borderPrimary: string;
153
+ borderSecondary: string;
154
+ borderHover: string;
155
+ textPrimary: string;
156
+ textSecondary: string;
157
+ textTertiary: string;
158
+ textInverse: string;
159
+ accentPrimary: string;
160
+ accentPrimaryHover: string;
161
+ accentPrimaryBg: string;
162
+ accentSuccess: string;
163
+ accentSuccessHover: string;
164
+ accentSuccessBg: string;
165
+ accentWarning: string;
166
+ accentWarningBg: string;
167
+ accentError: string;
168
+ accentErrorHover: string;
169
+ accentErrorBg: string;
170
+ msgUser: string;
171
+ msgAssistant: string;
172
+ };
173
+ typography: {
174
+ fontFamily: string;
175
+ fontFamilyMono: string;
176
+ fontSizeXs: string;
177
+ fontSizeSm: string;
178
+ fontSizeMd: string;
179
+ fontSizeLg: string;
180
+ fontSizeXl: string;
181
+ fontWeightNormal: number;
182
+ fontWeightMedium: number;
183
+ fontWeightSemibold: number;
184
+ lineHeightTight: number;
185
+ lineHeightNormal: number;
186
+ lineHeightRelaxed: number;
187
+ };
188
+ spacing: {
189
+ xs: string;
190
+ sm: string;
191
+ md: string;
192
+ lg: string;
193
+ xl: string;
194
+ xxl: string;
195
+ };
196
+ radius: {
197
+ sm: string;
198
+ md: string;
199
+ lg: string;
200
+ xl: string;
201
+ pill: string;
202
+ full: string;
203
+ };
204
+ shadows: {
205
+ sm: string;
206
+ md: string;
207
+ lg: string;
208
+ xl: string;
209
+ };
210
+ glows: {
211
+ primary: string;
212
+ success: string;
213
+ error: string;
214
+ ambient: string;
215
+ };
216
+ transitions: {
217
+ fast: string;
218
+ normal: string;
219
+ slow: string;
220
+ };
221
+ zIndex: {
222
+ dropdown: number;
223
+ modal: number;
224
+ fullscreen: number;
225
+ modalOverFullscreen: number;
226
+ };
227
+ };
228
+
229
+ export { DEFAULTS, HustlePlugin, HydratedPlugin, STORAGE_KEYS, StoredPlugin, debounce, formatFileSize, hydratePlugin, pluginRegistry, tokens };