@agimon-ai/po-workflow 0.0.0-alpha.60 → 0.0.0-alpha.62
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.
|
@@ -748,6 +748,20 @@ function requestLaunch(send, sessionId, line, workflowPath) {
|
|
|
748
748
|
}
|
|
749
749
|
}));
|
|
750
750
|
}
|
|
751
|
+
const HOST_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
|
|
752
|
+
/**
|
|
753
|
+
* The phone keys a session `<hostId>/<id>` while the hub names a run's owner by its bare id;
|
|
754
|
+
* the owner joins the viewing session's host so ownership checks and navigation line up.
|
|
755
|
+
*/
|
|
756
|
+
function onSessionHost(run, sessionId) {
|
|
757
|
+
const separator = sessionId.indexOf("/");
|
|
758
|
+
const host = sessionId.slice(0, Math.max(0, separator));
|
|
759
|
+
if (run.ownerSessionId === void 0 || !HOST_ID.test(host) || run.ownerSessionId.startsWith(`${host}/`)) return run;
|
|
760
|
+
return {
|
|
761
|
+
...run,
|
|
762
|
+
ownerSessionId: `${host}/${run.ownerSessionId}`
|
|
763
|
+
};
|
|
764
|
+
}
|
|
751
765
|
/** The plugin's session data channel: 'workflow_runs' payloads into the store. */
|
|
752
766
|
const workflowRunsChannel = workflows.channel({
|
|
753
767
|
channel: WORKFLOW_RUNS_TYPE,
|
|
@@ -755,7 +769,8 @@ const workflowRunsChannel = workflows.channel({
|
|
|
755
769
|
if (!isRecord(input) || !Array.isArray(input.runs)) return null;
|
|
756
770
|
return { runs: input.runs.filter(isRecord) };
|
|
757
771
|
},
|
|
758
|
-
reduce: (current,
|
|
772
|
+
reduce: (current, payload, sessionId) => {
|
|
773
|
+
const runs = payload.runs.map((run) => onSessionHost(run, sessionId));
|
|
759
774
|
const pending = current.pendingLaunch;
|
|
760
775
|
if (pending === void 0) return {
|
|
761
776
|
...current,
|