@melaya/runner 1.0.63 → 1.0.65

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.
@@ -1149,6 +1149,19 @@ export async function connect(opts) {
1149
1149
  });
1150
1150
  }
1151
1151
  });
1152
+ // Server relays this when the user cancels a stuck sign-in to retry.
1153
+ // Close the abandoned login window if one is still open; the in-flight
1154
+ // runLumaLoginFlow then resolves as `user_cancelled`. No-op when no
1155
+ // window is open. The server has already cleared its pending lock.
1156
+ socket.on("luma:cancel-login", async (_req) => {
1157
+ try {
1158
+ const { cancelActiveLumaLogin } = await import("./lumaLogin.js");
1159
+ const closed = await cancelActiveLumaLogin();
1160
+ if (closed)
1161
+ console.log(chalk.gray(" [luma] sign-in window closed at server's request (cancel & retry)."));
1162
+ }
1163
+ catch { /* best-effort */ }
1164
+ });
1152
1165
  // ── Kill command ───────────────────────────────────────────────────
1153
1166
  socket.on("runner:kill", (data) => {
1154
1167
  const proc = activeProcesses.get(data.runId);
@@ -39,6 +39,9 @@ export type LumaLoginOutcome = LumaLoginResult | LumaLoginError;
39
39
  interface ProgressEmitter {
40
40
  (msg: string): void;
41
41
  }
42
+ /** Close the in-flight Luma sign-in browser, if any. Returns true if a
43
+ * window was actually open. Best-effort — never throws. */
44
+ export declare function cancelActiveLumaLogin(): Promise<boolean>;
42
45
  export declare function runLumaLoginFlow(progress: ProgressEmitter): Promise<LumaLoginOutcome>;
43
46
  export declare function describeOutcome(outcome: LumaLoginOutcome): string;
44
47
  export {};
package/dist/lumaLogin.js CHANGED
@@ -85,6 +85,25 @@ function _pageLooksLoggedIn(url) {
85
85
  return false;
86
86
  }
87
87
  }
88
+ // Handle to the browser of an in-flight sign-in, so the server's
89
+ // `luma:cancel-login` (relayed via connection.ts) can close a window the
90
+ // user abandoned. Only one login runs per runner at a time, so a single
91
+ // module-level handle is sufficient. Closing it makes the poll loop's
92
+ // `page.url()` throw → the flow returns `user_cancelled` cleanly.
93
+ let _activeLoginBrowser = null;
94
+ /** Close the in-flight Luma sign-in browser, if any. Returns true if a
95
+ * window was actually open. Best-effort — never throws. */
96
+ export async function cancelActiveLumaLogin() {
97
+ const b = _activeLoginBrowser;
98
+ if (!b)
99
+ return false;
100
+ _activeLoginBrowser = null;
101
+ try {
102
+ await b.close();
103
+ }
104
+ catch { /* already closed */ }
105
+ return true;
106
+ }
88
107
  export async function runLumaLoginFlow(progress) {
89
108
  let playwright;
90
109
  try {
@@ -106,6 +125,7 @@ export async function runLumaLoginFlow(progress) {
106
125
  headless: false,
107
126
  args: ["--disable-blink-features=AutomationControlled"],
108
127
  });
128
+ _activeLoginBrowser = browser;
109
129
  const context = await browser.newContext({
110
130
  userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
111
131
  "(KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36",
@@ -230,6 +250,7 @@ export async function runLumaLoginFlow(progress) {
230
250
  }
231
251
  catch { /* already closed */ }
232
252
  }
253
+ _activeLoginBrowser = null;
233
254
  }
234
255
  }
235
256
  export function describeOutcome(outcome) {
package/dist/pythonEnv.js CHANGED
@@ -143,6 +143,18 @@ const PIP_DEPS = [
143
143
  // pipeline Python — see getCertBundlePath() + spawn env merging in
144
144
  // connection.ts.
145
145
  "certifi",
146
+ // ── Trading-crew WSS realtime layer (P0 of the WSS realtime plan) ──
147
+ // websockets — hard module-level import in
148
+ // shared/runtime/ws_ingress_watcher.py, which shared/tools/melaya_ws.py
149
+ // pulls in via shared.runtime.registry. Without it EVERY crew run dies
150
+ // at `from shared.runtime.registry import build_toolkit` with
151
+ // ModuleNotFoundError: websockets (crew exit 1 before the first cycle).
152
+ "websockets",
153
+ // httpx — direct module-level import in shared/runtime/crew_managed_risk.py
154
+ // and shared/runtime/private_ticket.py. It already arrives transitively
155
+ // via the anthropic/openai wheels; pinned explicitly so a future dep
156
+ // shuffle in those SDKs can't silently break the crew risk watcher.
157
+ "httpx",
146
158
  ];
147
159
  export function venvPython() {
148
160
  return platform() === "win32"
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@melaya/runner",
3
- "version": "1.0.63",
4
- "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
- "license": "UNLICENSED",
6
- "private": false,
7
- "type": "module",
8
- "bin": {
9
- "melaya-runner": "dist/cli.js"
10
- },
11
- "main": "dist/index.js",
12
- "files": [
13
- "dist/**/*.js",
14
- "dist/**/*.d.ts",
15
- "dist/**/*.py",
16
- "localRagIngest.py",
17
- "nltk_data/**",
18
- "README.md"
19
- ],
20
- "scripts": {
21
- "build": "tsc && node -e \"require('fs').copyFileSync('localRagIngest.py','dist/localRagIngest.py')\"",
22
- "prepublishOnly": "npm run build"
23
- },
24
- "dependencies": {
25
- "socket.io-client": "^4.8.0",
26
- "commander": "^12.0.0",
27
- "chalk": "^5.3.0",
28
- "ora": "^8.0.0",
29
- "playwright": "^1.47.0"
30
- },
31
- "devDependencies": {
32
- "typescript": "^5.5.0",
33
- "@types/node": "^20.0.0"
34
- },
35
- "engines": {
36
- "node": ">=18"
37
- },
38
- "publishConfig": {
39
- "access": "public"
40
- }
41
- }
1
+ {
2
+ "name": "@melaya/runner",
3
+ "version": "1.0.65",
4
+ "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
+ "license": "UNLICENSED",
6
+ "private": false,
7
+ "type": "module",
8
+ "bin": {
9
+ "melaya-runner": "dist/cli.js"
10
+ },
11
+ "main": "dist/index.js",
12
+ "files": [
13
+ "dist/**/*.js",
14
+ "dist/**/*.d.ts",
15
+ "dist/**/*.py",
16
+ "localRagIngest.py",
17
+ "nltk_data/**",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc && node -e \"require('fs').copyFileSync('localRagIngest.py','dist/localRagIngest.py')\"",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "dependencies": {
25
+ "socket.io-client": "^4.8.0",
26
+ "commander": "^12.0.0",
27
+ "chalk": "^5.3.0",
28
+ "ora": "^8.0.0",
29
+ "playwright": "^1.47.0"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^5.5.0",
33
+ "@types/node": "^20.0.0"
34
+ },
35
+ "engines": {
36
+ "node": ">=18"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }