@josephyan/qingflow-app-user-mcp 0.2.0-beta.997 → 0.2.0-beta.998
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.998
|
|
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.998 qingflow-app-user-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Environment:
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -1148,53 +1148,61 @@ class TaskContextTools(ToolBase):
|
|
|
1148
1148
|
"reported_total": matched_total,
|
|
1149
1149
|
}
|
|
1150
1150
|
|
|
1151
|
-
def
|
|
1151
|
+
def _resolve_task_locator_by_task_id(self, *, profile: str, task_id: Any) -> dict[str, Any]:
|
|
1152
1152
|
task_id_text = normalize_positive_id_text(task_id, field_name="task_id")
|
|
1153
|
-
|
|
1153
|
+
searched_task_boxes = ("todo", "initiated", "cc", "done")
|
|
1154
|
+
incomplete_task_boxes: list[str] = []
|
|
1154
1155
|
page_size = 100
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1156
|
+
for task_box in searched_task_boxes:
|
|
1157
|
+
page = 1
|
|
1158
|
+
page_amount: int | None = None
|
|
1159
|
+
while True:
|
|
1160
|
+
response = self._list_normalized_task_items(
|
|
1161
|
+
profile=profile,
|
|
1162
|
+
task_box=task_box,
|
|
1163
|
+
flow_status="all",
|
|
1164
|
+
app_key=None,
|
|
1165
|
+
workflow_node_id=None,
|
|
1166
|
+
query=None,
|
|
1167
|
+
page=page,
|
|
1168
|
+
page_size=page_size,
|
|
1169
|
+
)
|
|
1170
|
+
items = response.get("items") if isinstance(response.get("items"), list) else []
|
|
1171
|
+
for item in items:
|
|
1172
|
+
if not isinstance(item, dict) or not ids_equal(item.get("task_id"), task_id_text):
|
|
1173
|
+
continue
|
|
1174
|
+
app_key = str(item.get("app_key") or "").strip()
|
|
1175
|
+
record_id = stringify_backend_id(item.get("record_id"))
|
|
1176
|
+
workflow_node_id = int(item.get("workflow_node_id") or 0)
|
|
1177
|
+
if not app_key or record_id is None or workflow_node_id <= 0:
|
|
1178
|
+
incomplete_task_boxes.append(task_box)
|
|
1179
|
+
continue
|
|
1180
|
+
return {
|
|
1181
|
+
"task_id": task_id_text,
|
|
1182
|
+
"task_box": task_box,
|
|
1183
|
+
"app_key": app_key,
|
|
1184
|
+
"record_id": record_id,
|
|
1185
|
+
"workflow_node_id": workflow_node_id,
|
|
1186
|
+
}
|
|
1187
|
+
if page_amount is None:
|
|
1188
|
+
coerced_page_amount = _coerce_count(response.get("page_amount"))
|
|
1189
|
+
if coerced_page_amount is not None and coerced_page_amount > 0:
|
|
1190
|
+
page_amount = coerced_page_amount
|
|
1191
|
+
if page_amount is not None and page >= page_amount:
|
|
1192
|
+
break
|
|
1193
|
+
if not items or len(items) < page_size:
|
|
1194
|
+
break
|
|
1195
|
+
page += 1
|
|
1196
|
+
if incomplete_task_boxes:
|
|
1197
|
+
searched = ", ".join(incomplete_task_boxes)
|
|
1198
|
+
raise_tool_error(
|
|
1199
|
+
QingflowApiError.config_error(
|
|
1200
|
+
f"task_id={task_id_text} resolved to an incomplete task locator in task_box={searched}; please refresh the task list and retry"
|
|
1201
|
+
)
|
|
1166
1202
|
)
|
|
1167
|
-
items = response.get("items") if isinstance(response.get("items"), list) else []
|
|
1168
|
-
for item in items:
|
|
1169
|
-
if not isinstance(item, dict) or not ids_equal(item.get("task_id"), task_id_text):
|
|
1170
|
-
continue
|
|
1171
|
-
app_key = str(item.get("app_key") or "").strip()
|
|
1172
|
-
record_id = stringify_backend_id(item.get("record_id"))
|
|
1173
|
-
workflow_node_id = int(item.get("workflow_node_id") or 0)
|
|
1174
|
-
if not app_key or record_id is None or workflow_node_id <= 0:
|
|
1175
|
-
raise_tool_error(
|
|
1176
|
-
QingflowApiError.config_error(
|
|
1177
|
-
f"task_id={task_id_text} resolved to an incomplete task locator; please refresh the todo list and retry"
|
|
1178
|
-
)
|
|
1179
|
-
)
|
|
1180
|
-
return {
|
|
1181
|
-
"task_id": task_id_text,
|
|
1182
|
-
"app_key": app_key,
|
|
1183
|
-
"record_id": record_id,
|
|
1184
|
-
"workflow_node_id": workflow_node_id,
|
|
1185
|
-
}
|
|
1186
|
-
if page_amount is None:
|
|
1187
|
-
coerced_page_amount = _coerce_count(response.get("page_amount"))
|
|
1188
|
-
if coerced_page_amount is not None and coerced_page_amount > 0:
|
|
1189
|
-
page_amount = coerced_page_amount
|
|
1190
|
-
if page_amount is not None and page >= page_amount:
|
|
1191
|
-
break
|
|
1192
|
-
if not items or len(items) < page_size:
|
|
1193
|
-
break
|
|
1194
|
-
page += 1
|
|
1195
1203
|
raise_tool_error(
|
|
1196
1204
|
QingflowApiError.config_error(
|
|
1197
|
-
f"task_id={task_id_text} was not found in the current
|
|
1205
|
+
f"task_id={task_id_text} was not found in the current visible task boxes (todo, initiated, cc, done)"
|
|
1198
1206
|
)
|
|
1199
1207
|
)
|
|
1200
1208
|
|
|
@@ -1212,7 +1220,7 @@ class TaskContextTools(ToolBase):
|
|
|
1212
1220
|
resolved_record_id: int
|
|
1213
1221
|
resolved_workflow_node_id: int
|
|
1214
1222
|
if task_id_text is not None:
|
|
1215
|
-
locator = self.
|
|
1223
|
+
locator = self._resolve_task_locator_by_task_id(profile=profile, task_id=task_id_text)
|
|
1216
1224
|
resolved_app_key = str(locator["app_key"])
|
|
1217
1225
|
resolved_record_id = normalize_positive_id_int(locator["record_id"], field_name="record_id")
|
|
1218
1226
|
resolved_workflow_node_id = int(locator["workflow_node_id"])
|