@optima-chat/browser-cli 0.23.0 → 0.24.0
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/index.js +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -833,8 +833,18 @@ function parseWaitTimeout(raw) {
|
|
|
833
833
|
return n;
|
|
834
834
|
}
|
|
835
835
|
function stillRunningMessage(task, waitedS, nowMs = Date.now()) {
|
|
836
|
-
const
|
|
837
|
-
|
|
836
|
+
const secondsSince = (iso) => {
|
|
837
|
+
const t = iso ? Date.parse(iso) : Number.NaN;
|
|
838
|
+
return Number.isFinite(t) ? Math.max(0, Math.round((nowMs - t) / 1e3)) : null;
|
|
839
|
+
};
|
|
840
|
+
const created = secondsSince(task.created_at);
|
|
841
|
+
let elapsed;
|
|
842
|
+
if (task.queue?.queued) {
|
|
843
|
+
elapsed = `queued, ${task.queue.ahead} task(s) of this user ahead` + (created !== null ? `, created ${created}s ago` : "");
|
|
844
|
+
} else {
|
|
845
|
+
const ran = secondsSince(task.queue?.started_at) ?? created;
|
|
846
|
+
elapsed = ran !== null ? `running for ${ran}s` : `waited ${waitedS}s`;
|
|
847
|
+
}
|
|
838
848
|
const step = task.total_steps ? `, step ${task.current_step}/${task.total_steps}` : "";
|
|
839
849
|
const waiting = waitingHumanLine(task);
|
|
840
850
|
return `Still running (${elapsed}${step}). Call again as a separate command: browser-cli script-task ${task.id} --wait` + (waiting ? ` --through-human
|