@melaya/runner 1.0.2 → 1.0.5

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.
@@ -100,7 +100,11 @@ export async function connect(opts) {
100
100
  PYTHONIOENCODING: "utf-8",
101
101
  PYTHONUTF8: "1",
102
102
  MEL_RUN_ID: payload.runId,
103
- MEL_STUDIO_URL: payload.studioUrl,
103
+ // Point agentscope hooks at the REAL server (not the browser's Vite URL).
104
+ // Convert wss://api.melaya.org → https://api.melaya.org so pushMessage,
105
+ // registerRun, and other agentscope HTTP calls reach the tRPC server.
106
+ MEL_STUDIO_URL: opts.serverUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:"),
107
+ // Event relay goes through our local HTTP relay → WebSocket → server
104
108
  MEL_BUILDER_URL: `http://127.0.0.1:${relay.port}`,
105
109
  MEL_RELAY_NONCE: relay.nonce,
106
110
  LMSTUDIO_BASE_URL: "http://127.0.0.1:1234",
@@ -15,14 +15,18 @@ const CACHE_DIR = join(homedir(), ".melaya-runner");
15
15
  const SHARED_DIR = join(CACHE_DIR, "shared");
16
16
  const VERSION_FILE = join(CACHE_DIR, "shared-version.txt");
17
17
  export function getSharedDir() {
18
- return SHARED_DIR;
18
+ // Return the CACHE_DIR root (not shared/ subdir) because the bundle
19
+ // now includes agentscope/ and crews/ alongside shared/. PYTHONPATH
20
+ // needs to be the parent so `import agentscope`, `import shared.*`,
21
+ // and `from crews.X.main import ...` all resolve.
22
+ return CACHE_DIR;
19
23
  }
20
24
  export async function ensureSharedModules(serverUrl, expectedVersion) {
21
- mkdirSync(SHARED_DIR, { recursive: true });
25
+ mkdirSync(CACHE_DIR, { recursive: true });
22
26
  // Check cached version
23
27
  if (existsSync(VERSION_FILE)) {
24
28
  const cached = readFileSync(VERSION_FILE, "utf-8").trim();
25
- if (cached === expectedVersion && existsSync(join(SHARED_DIR, "events.py"))) {
29
+ if (cached === expectedVersion && existsSync(join(CACHE_DIR, "shared", "events.py")) && existsSync(join(CACHE_DIR, "agentscope", "__init__.py"))) {
26
30
  return; // cache is up-to-date
27
31
  }
28
32
  }
@@ -44,16 +48,19 @@ export async function ensureSharedModules(serverUrl, expectedVersion) {
44
48
  const safe = filename.replace(/\.\./g, "").replace(/^\//, "").replace(/\\/g, "/");
45
49
  if (safe.includes("..") || safe.startsWith("/"))
46
50
  continue;
47
- const filepath = join(SHARED_DIR, safe);
48
- if (!filepath.startsWith(SHARED_DIR))
51
+ const filepath = join(CACHE_DIR, safe);
52
+ if (!filepath.startsWith(CACHE_DIR))
49
53
  continue;
50
54
  const dir = join(filepath, "..");
51
55
  mkdirSync(dir, { recursive: true });
52
56
  writeFileSync(filepath, content, "utf-8");
53
57
  }
54
- // Write __init__.py if missing
55
- if (!existsSync(join(SHARED_DIR, "__init__.py"))) {
56
- writeFileSync(join(SHARED_DIR, "__init__.py"), "", "utf-8");
58
+ // Ensure __init__.py in shared/ and crews/ if missing
59
+ for (const sub of ["shared", "crews"]) {
60
+ const init = join(CACHE_DIR, sub, "__init__.py");
61
+ if (existsSync(join(CACHE_DIR, sub)) && !existsSync(init)) {
62
+ writeFileSync(init, "", "utf-8");
63
+ }
57
64
  }
58
65
  writeFileSync(VERSION_FILE, expectedVersion, "utf-8");
59
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,