@josephyan/qingflow-app-user-mcp 0.2.0-beta.42 → 0.2.0-beta.44
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/README.md
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Install:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @josephyan/qingflow-app-user-mcp@0.2.0-beta.
|
|
6
|
+
npm install @josephyan/qingflow-app-user-mcp@0.2.0-beta.44
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Run:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx -y -p @josephyan/qingflow-app-user-mcp@0.2.0-beta.
|
|
12
|
+
npx -y -p @josephyan/qingflow-app-user-mcp@0.2.0-beta.44 qingflow-app-user-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from threading import Event
|
|
5
|
+
from time import sleep
|
|
5
6
|
from typing import Any
|
|
6
7
|
from urllib.parse import urlsplit, urlunsplit
|
|
7
8
|
from uuid import uuid4
|
|
@@ -307,18 +308,25 @@ class BackendClient:
|
|
|
307
308
|
failure_event_received = Event()
|
|
308
309
|
sio = socketio.Client(reconnection=False, logger=False, engineio_logger=False)
|
|
309
310
|
|
|
311
|
+
def _unwrap_socket_event_payload(payload: Any) -> Any:
|
|
312
|
+
if isinstance(payload, list) and payload:
|
|
313
|
+
return payload[0]
|
|
314
|
+
return payload
|
|
315
|
+
|
|
310
316
|
def _handle_initial(payload: Any) -> None:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
317
|
+
normalized_payload = _unwrap_socket_event_payload(payload)
|
|
318
|
+
import_result["initial_event"] = normalized_payload
|
|
319
|
+
if isinstance(normalized_payload, dict):
|
|
320
|
+
process_id = normalized_payload.get("processIdStr") or normalized_payload.get("process_id_str") or normalized_payload.get("processId")
|
|
314
321
|
if process_id is not None:
|
|
315
322
|
import_result["process_id_str"] = str(process_id)
|
|
316
323
|
initial_event_received.set()
|
|
317
324
|
|
|
318
325
|
def _handle_failure(payload: Any) -> None:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
326
|
+
normalized_payload = _unwrap_socket_event_payload(payload)
|
|
327
|
+
import_result["failure_event"] = normalized_payload
|
|
328
|
+
if isinstance(normalized_payload, dict):
|
|
329
|
+
process_id = normalized_payload.get("processIdStr") or normalized_payload.get("process_id_str") or normalized_payload.get("processId")
|
|
322
330
|
if process_id is not None:
|
|
323
331
|
import_result["process_id_str"] = str(process_id)
|
|
324
332
|
failure_event_received.set()
|
|
@@ -326,7 +334,7 @@ class BackendClient:
|
|
|
326
334
|
try:
|
|
327
335
|
sio.connect(
|
|
328
336
|
socket_base_url,
|
|
329
|
-
transports=["
|
|
337
|
+
transports=["websocket"],
|
|
330
338
|
socketio_path="socket.io",
|
|
331
339
|
headers=self._base_headers(
|
|
332
340
|
context.token,
|
|
@@ -335,6 +343,8 @@ class BackendClient:
|
|
|
335
343
|
),
|
|
336
344
|
wait_timeout=ack_timeout_seconds,
|
|
337
345
|
)
|
|
346
|
+
sio.emit("token", [context.token])
|
|
347
|
+
sleep(0.2)
|
|
338
348
|
ack = sio.call(
|
|
339
349
|
"dataImport",
|
|
340
350
|
[
|
|
@@ -348,7 +358,19 @@ class BackendClient:
|
|
|
348
358
|
],
|
|
349
359
|
timeout=ack_timeout_seconds,
|
|
350
360
|
)
|
|
351
|
-
|
|
361
|
+
ack_payload = ack[0] if isinstance(ack, list) and ack else ack
|
|
362
|
+
if isinstance(ack_payload, dict):
|
|
363
|
+
error_code = ack_payload.get("error")
|
|
364
|
+
ack_message = ack_payload.get("message")
|
|
365
|
+
import_id = ack_payload.get("data")
|
|
366
|
+
if error_code not in (None, 0):
|
|
367
|
+
raise QingflowApiError(
|
|
368
|
+
category="backend",
|
|
369
|
+
message=str(ack_message or f"socket import rejected with error {error_code}"),
|
|
370
|
+
details={"socket_error_code": error_code, "import_id": import_id},
|
|
371
|
+
)
|
|
372
|
+
else:
|
|
373
|
+
import_id = ack_payload
|
|
352
374
|
if not import_id:
|
|
353
375
|
raise QingflowApiError(category="backend", message="socket import ack did not return import_id")
|
|
354
376
|
import_result["import_id"] = str(import_id)
|
|
@@ -228,7 +228,8 @@ class ImportTools(ToolBase):
|
|
|
228
228
|
backend_verification = payload
|
|
229
229
|
else:
|
|
230
230
|
backend_verification = {}
|
|
231
|
-
|
|
231
|
+
being_validated = backend_verification.get("beingValidated", True)
|
|
232
|
+
if being_validated is False:
|
|
232
233
|
can_import = False
|
|
233
234
|
issues.append(
|
|
234
235
|
_issue(
|
|
@@ -288,7 +289,8 @@ class ImportTools(ToolBase):
|
|
|
288
289
|
"warnings": warnings,
|
|
289
290
|
"verification": {
|
|
290
291
|
"local_precheck_passed": bool(local_check["local_precheck_passed"]),
|
|
291
|
-
"backend_verification_passed":
|
|
292
|
+
"backend_verification_passed": isinstance(backend_verification, dict)
|
|
293
|
+
and backend_verification.get("beingValidated", True) is not False,
|
|
292
294
|
"schema_fingerprint": schema_fingerprint,
|
|
293
295
|
"file_sha256": local_check["file_sha256"],
|
|
294
296
|
"file_format": local_check["extension"],
|