hypha-rpc 0.21.8 → 0.21.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.
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2026-02-10T16:07:47.553Z
89
+ at 2026-02-10T21:10:45.358Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
package/index.d.ts CHANGED
@@ -186,101 +186,98 @@ interface WorkspaceManager {
186
186
  getRTCService?(config: any): Promise<any>;
187
187
  }
188
188
 
189
+ /**
190
+ * The hyphaWebsocketClient namespace containing all Hypha RPC exports.
191
+ */
192
+ interface HyphaWebsocketClient {
193
+ RPC: hRPC;
194
+ API_VERSION: string;
195
+
196
+ /**
197
+ * Annotate a function with JSON Schema for RPC.
198
+ */
199
+ schemaFunction: (func: Function, annotation: FunctionAnnotation) => Function;
200
+
201
+ /**
202
+ * Load JavaScript requirements dynamically.
203
+ */
204
+ loadRequirements: (config: any) => Promise<any>;
205
+
206
+ /**
207
+ * Login to Hypha server via OAuth.
208
+ */
209
+ login: (config: LoginConfig) => Promise<any>;
210
+
211
+ /**
212
+ * Logout from Hypha server.
213
+ */
214
+ logout: (config: LogoutConfig) => Promise<any>;
215
+
216
+ /**
217
+ * Connect to a Hypha server with unified transport support.
218
+ * Supports both WebSocket (default) and HTTP streaming transports.
219
+ *
220
+ * @example
221
+ * // WebSocket transport (default)
222
+ * const server = await connectToServer({ server_url: "https://hypha.aicell.io" });
223
+ *
224
+ * // HTTP streaming transport
225
+ * const server = await connectToServer({
226
+ * server_url: "https://hypha.aicell.io",
227
+ * transport: "http"
228
+ * });
229
+ */
230
+ connectToServer: (config: ServerConfig) => Promise<WorkspaceManager>;
231
+
232
+ /**
233
+ * Connect using HTTP streaming transport explicitly.
234
+ */
235
+ connectToServerHTTP: (config: ServerConfig) => Promise<WorkspaceManager>;
236
+
237
+ /**
238
+ * Get a remote service by URI.
239
+ */
240
+ getRemoteService: (serviceUri: string, config?: ServerConfig) => Promise<any>;
241
+
242
+ /**
243
+ * Get a remote service using HTTP streaming transport explicitly.
244
+ */
245
+ getRemoteServiceHTTP: (serviceUri: string, config?: ServerConfig) => Promise<any>;
246
+
247
+ /**
248
+ * Register a WebRTC service for peer-to-peer communication.
249
+ */
250
+ registerRTCService: (server: WorkspaceManager, service_id: string, config?: any) => Promise<any>;
251
+
252
+ /**
253
+ * Get a WebRTC service for peer-to-peer communication.
254
+ */
255
+ getRTCService: (server: WorkspaceManager, service_id: string, config?: any) => Promise<any>;
256
+
257
+ /**
258
+ * Setup local client for iframe/web worker communication.
259
+ */
260
+ setupLocalClient: (config: {
261
+ enable_execution?: boolean;
262
+ on_ready?: Function;
263
+ }) => Promise<WorkspaceManager>;
264
+
265
+ /**
266
+ * LocalWebSocket class for iframe/web worker communication.
267
+ */
268
+ LocalWebSocket: any;
269
+
270
+ /**
271
+ * HTTP Streaming RPC Connection class.
272
+ */
273
+ HTTPStreamingRPCConnection: HTTPStreamingRPCConnection;
274
+
275
+ /**
276
+ * Normalize server URL for HTTP transport.
277
+ */
278
+ normalizeServerUrlHTTP: (server_url: string) => string;
279
+ }
280
+
189
281
  declare module "hypha-rpc" {
190
- const hyphaRPCModule: {
191
- /**
192
- * Main Hypha RPC client with unified transport support.
193
- * Supports both WebSocket (default) and HTTP streaming transports.
194
- */
195
- hyphaWebsocketClient: {
196
- RPC: hRPC;
197
- API_VERSION: string;
198
-
199
- /**
200
- * Annotate a function with JSON Schema for RPC.
201
- */
202
- schemaFunction: (func: Function, annotation: FunctionAnnotation) => Function;
203
-
204
- /**
205
- * Load JavaScript requirements dynamically.
206
- */
207
- loadRequirements: (config: any) => Promise<any>;
208
-
209
- /**
210
- * Login to Hypha server via OAuth.
211
- */
212
- login: (config: LoginConfig) => Promise<any>;
213
-
214
- /**
215
- * Logout from Hypha server.
216
- */
217
- logout: (config: LogoutConfig) => Promise<any>;
218
-
219
- /**
220
- * Connect to a Hypha server with unified transport support.
221
- * Supports both WebSocket (default) and HTTP streaming transports.
222
- *
223
- * @example
224
- * // WebSocket transport (default)
225
- * const server = await connectToServer({ server_url: "https://hypha.aicell.io" });
226
- *
227
- * // HTTP streaming transport
228
- * const server = await connectToServer({
229
- * server_url: "https://hypha.aicell.io",
230
- * transport: "http"
231
- * });
232
- */
233
- connectToServer: (config: ServerConfig) => Promise<WorkspaceManager>;
234
-
235
- /**
236
- * Connect using HTTP streaming transport explicitly.
237
- */
238
- connectToServerHTTP: (config: ServerConfig) => Promise<WorkspaceManager>;
239
-
240
- /**
241
- * Get a remote service by URI.
242
- */
243
- getRemoteService: (serviceUri: string, config?: ServerConfig) => Promise<any>;
244
-
245
- /**
246
- * Get a remote service using HTTP streaming transport explicitly.
247
- */
248
- getRemoteServiceHTTP: (serviceUri: string, config?: ServerConfig) => Promise<any>;
249
-
250
- /**
251
- * Register a WebRTC service for peer-to-peer communication.
252
- */
253
- registerRTCService: (server: WorkspaceManager, service_id: string, config?: any) => Promise<any>;
254
-
255
- /**
256
- * Get a WebRTC service for peer-to-peer communication.
257
- */
258
- getRTCService: (server: WorkspaceManager, service_id: string, config?: any) => Promise<any>;
259
-
260
- /**
261
- * Setup local client for iframe/web worker communication.
262
- */
263
- setupLocalClient: (config: {
264
- enable_execution?: boolean;
265
- on_ready?: Function;
266
- }) => Promise<WorkspaceManager>;
267
-
268
- /**
269
- * LocalWebSocket class for iframe/web worker communication.
270
- */
271
- LocalWebSocket: any;
272
-
273
- /**
274
- * HTTP Streaming RPC Connection class.
275
- */
276
- HTTPStreamingRPCConnection: HTTPStreamingRPCConnection;
277
-
278
- /**
279
- * Normalize server URL for HTTP transport.
280
- */
281
- normalizeServerUrlHTTP: (server_url: string) => string;
282
- };
283
- };
284
-
285
- export = hyphaRPCModule;
282
+ export const hyphaWebsocketClient: HyphaWebsocketClient;
286
283
  }
package/index.mjs ADDED
@@ -0,0 +1,26 @@
1
+ import * as hyphaWebsocketClient from "./dist/hypha-rpc-websocket.mjs";
2
+
3
+ // Primary export: the hyphaWebsocketClient namespace (most common pattern)
4
+ export { hyphaWebsocketClient };
5
+
6
+ // Re-export all individual members for backward compatibility with the old
7
+ // "module" entry point (dist/hypha-rpc-websocket.mjs) which exported them
8
+ // as top-level named exports, and for direct import convenience.
9
+ export {
10
+ RPC,
11
+ API_VERSION,
12
+ schemaFunction,
13
+ loadRequirements,
14
+ getRTCService,
15
+ registerRTCService,
16
+ HTTPStreamingRPCConnection,
17
+ connectToServerHTTP,
18
+ getRemoteServiceHTTP,
19
+ normalizeServerUrlHTTP,
20
+ connectToServer,
21
+ getRemoteService,
22
+ login,
23
+ logout,
24
+ setupLocalClient,
25
+ LocalWebSocket,
26
+ } from "./dist/hypha-rpc-websocket.mjs";
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "hypha-rpc",
3
- "version": "0.21.8",
3
+ "version": "0.21.10",
4
4
  "description": "Hypha RPC client for connecting to Hypha server for data management and AI model serving.",
5
5
  "main": "index.js",
6
- "module": "dist/hypha-rpc-websocket.mjs",
6
+ "module": "index.mjs",
7
7
  "browser": "dist/hypha-rpc-websocket.min.js",
8
8
  "types": "index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./index.mjs",
12
+ "require": "./index.js",
13
+ "default": "./index.js"
14
+ },
15
+ "./dist/*": "./dist/*"
16
+ },
9
17
  "scripts": {
10
18
  "build": "rm -rf dist && npm run build-umd && BUILD_ESM=true npm run build-umd",
11
19
  "build-umd": "webpack --config webpack.config.js --mode development && NODE_ENV=production webpack --config webpack.config.js --mode production",