hypha-rpc 0.20.11 → 0.20.13

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/index.d.ts CHANGED
@@ -82,10 +82,12 @@ declare module "hypha-rpc" {
82
82
  API_VERSION: string;
83
83
  VERSION: string;
84
84
  schemaFunction: (func: Function, annotation: FunctionAnnotation ) => Function;
85
+ loadRequirements: (config: any) => Promise<any>;
85
86
  login: (config: LoginConfig) => Promise<any>;
86
87
  connectToServer: (config: ServerConfig) => Promise<any>;
87
88
  registerRTCService: (server: any, service_id: string, config?: any) => Promise<any>;
88
89
  getRTCService: (server: any, service_id: string, config?: any) => Promise<any>;
90
+ setupLocalClient: (enable_execution: boolean, on_ready?: Function) => Promise<any>;
89
91
  };
90
92
  };
91
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypha-rpc",
3
- "version": "0.20.11",
3
+ "version": "0.20.13",
4
4
  "description": "Hypha RPC client for connecting to Hypha server for data management and AI model serving.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/rpc.js CHANGED
@@ -685,12 +685,13 @@ export class RPC extends MessageEmitter {
685
685
 
686
686
  _extract_service_info(service) {
687
687
  const config = service.config || {};
688
- config.workspace = config.workspace || self._local_workspace;
688
+ config.workspace =
689
+ config.workspace || this._local_workspace || this._connection.workspace;
689
690
  const skipContext = config.require_context;
690
691
  const serviceSchema = _get_schema(service, null, skipContext);
691
692
  const serviceInfo = {
692
693
  config: config,
693
- id: `${this._client_id}:${service["id"]}`,
694
+ id: `${config.workspace}/${this._client_id}:${service["id"]}`,
694
695
  name: service.name || service["id"],
695
696
  description: service.description || "",
696
697
  type: service.type || "generic",
@@ -1,9 +1,10 @@
1
1
  import { RPC, API_VERSION } from "./rpc.js";
2
- import { assert, randId, waitFor } from "./utils";
2
+ import { assert, randId, waitFor, loadRequirements } from "./utils";
3
3
  import { schemaFunction } from "./utils/schema.js";
4
4
  import { getRTCService, registerRTCService } from "./webrtc-client.js";
5
5
 
6
6
  export { RPC, API_VERSION, schemaFunction };
7
+ export { loadRequirements };
7
8
  export { getRTCService, registerRTCService };
8
9
 
9
10
  const MAX_RETRY = 1000000;
@@ -618,7 +619,7 @@ export async function connectToServer(config) {
618
619
  return wm;
619
620
  }
620
621
 
621
- class LocalWebSocket {
622
+ export class LocalWebSocket {
622
623
  constructor(url, client_id, workspace) {
623
624
  this.url = url;
624
625
  this.onopen = () => {};
@@ -173,7 +173,9 @@ describe("RPC", async () => {
173
173
  server_url: SERVER_URL,
174
174
  client_id: "test-plugin-1",
175
175
  });
176
- await server.registerService(plugin_interface);
176
+ const info = await server.registerService(plugin_interface);
177
+ expect(info.id).to.contain("/");
178
+ expect(info.id).to.contain(":");
177
179
  const api = await server.rpc.get_remote_service("default");
178
180
 
179
181
  const msg = "this is an messge.";