ai-project-manage-cli 8.1.18 → 8.1.19
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/dist/worker-script.js +24 -42
- package/package.json +1 -1
package/dist/worker-script.js
CHANGED
|
@@ -2702,47 +2702,28 @@ function jsonSafePayload(value) {
|
|
|
2702
2702
|
}
|
|
2703
2703
|
function mirrorRunEventsForVisualization(cfg2, local) {
|
|
2704
2704
|
const api = createApmApiClient(cfg2);
|
|
2705
|
-
const queues = /* @__PURE__ */ new Map();
|
|
2706
|
-
const draining = /* @__PURE__ */ new Set();
|
|
2707
|
-
const drain = async (runId) => {
|
|
2708
|
-
if (draining.has(runId)) return;
|
|
2709
|
-
draining.add(runId);
|
|
2710
|
-
try {
|
|
2711
|
-
for (; ; ) {
|
|
2712
|
-
const pending2 = queues.get(runId);
|
|
2713
|
-
if (!pending2 || pending2.length === 0) {
|
|
2714
|
-
queues.delete(runId);
|
|
2715
|
-
return;
|
|
2716
|
-
}
|
|
2717
|
-
const batch = pending2.splice(0, 200);
|
|
2718
|
-
try {
|
|
2719
|
-
await api.cli.cursorStoreAppendRunEvents({ events: batch });
|
|
2720
|
-
} catch (err) {
|
|
2721
|
-
console.warn(
|
|
2722
|
-
`[apm] runEvents \u53EF\u89C6\u5316\u540C\u6B65\u5931\u8D25 runId=${runId} n=${batch.length}:`,
|
|
2723
|
-
err instanceof Error ? err.message : err
|
|
2724
|
-
);
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
} finally {
|
|
2728
|
-
draining.delete(runId);
|
|
2729
|
-
if ((queues.get(runId)?.length ?? 0) > 0) void drain(runId);
|
|
2730
|
-
}
|
|
2731
|
-
};
|
|
2732
2705
|
return {
|
|
2733
2706
|
async append(input) {
|
|
2734
2707
|
const row = await local.append(input);
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2708
|
+
try {
|
|
2709
|
+
await api.cli.cursorStoreAppendRunEvents({
|
|
2710
|
+
events: [
|
|
2711
|
+
{
|
|
2712
|
+
runId: input.runId,
|
|
2713
|
+
eventType: input.eventType,
|
|
2714
|
+
payload: jsonSafePayload(input.payload),
|
|
2715
|
+
payloadRef: input.payloadRef ?? null,
|
|
2716
|
+
idempotencyKey: input.idempotencyKey ?? `${input.runId}:${row.seq}`,
|
|
2717
|
+
createdAt: row.createdAt
|
|
2718
|
+
}
|
|
2719
|
+
]
|
|
2720
|
+
});
|
|
2721
|
+
} catch (err) {
|
|
2722
|
+
console.warn(
|
|
2723
|
+
`[apm] runEvents \u53EF\u89C6\u5316\u540C\u6B65\u8DF3\u8FC7 runId=${input.runId} seq=${row.seq}:`,
|
|
2724
|
+
err instanceof Error ? err.message : err
|
|
2725
|
+
);
|
|
2726
|
+
}
|
|
2746
2727
|
return row;
|
|
2747
2728
|
},
|
|
2748
2729
|
list: (input) => local.list(input),
|
|
@@ -2750,13 +2731,14 @@ function mirrorRunEventsForVisualization(cfg2, local) {
|
|
|
2750
2731
|
await local.delete(input);
|
|
2751
2732
|
const runIds = input.filter.runIds?.map((id) => id.trim()).filter(Boolean);
|
|
2752
2733
|
if (!runIds?.length) return;
|
|
2753
|
-
|
|
2754
|
-
|
|
2734
|
+
try {
|
|
2735
|
+
await api.cli.cursorStoreDeleteRunEvents({ runIds });
|
|
2736
|
+
} catch (err) {
|
|
2755
2737
|
console.warn(
|
|
2756
|
-
`[apm] runEvents \u53EF\u89C6\u5316\u6E05\u7406\
|
|
2738
|
+
`[apm] runEvents \u53EF\u89C6\u5316\u6E05\u7406\u8DF3\u8FC7:`,
|
|
2757
2739
|
err instanceof Error ? err.message : err
|
|
2758
2740
|
);
|
|
2759
|
-
}
|
|
2741
|
+
}
|
|
2760
2742
|
}
|
|
2761
2743
|
};
|
|
2762
2744
|
}
|