openvibers/openvibe.codes Commits

Pass Live's current agent step to the Dock (#407)

OP OpenVibers committed 2 days ago · c43a7bc968 · 4 files, +11 −6

* Pass Live's current agent step to the Dock

* Merge remote-tracking branch 'origin/main' into feat/agents-everywhere-step-codes-1111b

* Merge remote-tracking branch 'origin/main' into feat/agents-everywhere-step-codes-1111b

* Serve Dock current step from Shared 4.209.0

Changes

ddiff --git a/package-lock.json b/package-lock.json
iindex ef3686c..922a626 100644
---- a/package-lock.json
++++ b/package-lock.json
@@@ -17,7 +17,7 @@
"iovalkey": "^0.4.0",
"openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.406.0",
"openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.147.0",
-- "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.206.0",
++ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.209.0",
"pg": "^8.23.0",
"yaml": "^2.9.1"
},
@@@ -1275,9 +1275,9 @@
}
},
"node_modules/openvibe-shared": {
-- "version": "4.206.0",
-- "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.206.0",
-- "integrity": "sha512-mvkdGKmdYXDDV380k0DvdSVmBkg5tjYrw1La9BwNwp87NnR3mNlUCDDgAZTbyP1KyVGuK/zLodiM7bNV61zXfg==",
++ "version": "4.209.0",
++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.209.0",
++ "integrity": "sha512-gtsRDo9r2t/7AHQQEViVVByWRmT+16bCzIC2LSuFnfdoM+P5IrtesQc60xjoRR5umrzoSNEEQlVFE4WdNpc0bg==",
"license": "MIT",
"dependencies": {
"clean-css": "^5.3.3",
ddiff --git a/package.json b/package.json
iindex cb92281..8d67e2a 100644
---- a/package.json
++++ b/package.json
@@@ -32,7 +32,7 @@
"iovalkey": "^0.4.0",
"openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.406.0",
"openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.147.0",
-- "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.206.0",
++ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.209.0",
"pg": "^8.23.0",
"yaml": "^2.9.1"
},
ddiff --git a/server/http/agent-view.js b/server/http/agent-view.js
iindex 8f805fe..bc50a5d 100644
---- a/server/http/agent-view.js
++++ b/server/http/agent-view.js
@@@ -98,6 +98,10 @@ function createAgentView({ config, sso, actorLimits, fetchImpl = (...a) => fetch
state: row.state,
title: row.title,
task: row.task && typeof row.task === 'object' ? row.task : null,
++ // Live's S2 list already includes the newest step. Older Live deployments omit it.
++ current_step: row.current_step && typeof row.current_step.title === 'string'
++ ? { title: row.current_step.title.slice(0, 120), status: ['started', 'passed', 'failed', 'skipped'].includes(row.current_step.status) ? row.current_step.status : 'started' }
++ : null,
curtain: { up: !!(row.curtain && row.curtain.up) },
viewers: Number(row.viewers) || 0,
worked_seconds: Number(row.worked_seconds) || 0,
ddiff --git a/test/agent-view.test.js b/test/agent-view.test.js
iindex ab298ea..6b64f13 100644
---- a/test/agent-view.test.js
++++ b/test/agent-view.test.js
@@@ -75,7 +75,7 @@ const STREAM = (o = {}) => ({
});
await check('the live stream comes with the embed, its ticket minted here, and the person\'s own token to Live', async () => {
-- live.streams = [STREAM({ state: 'ended', last_frame_url: 'https://openvibe.live/x' }), STREAM()];
++ live.streams = [STREAM({ state: 'ended', last_frame_url: 'https://openvibe.live/x' }), STREAM({ current_step: { title: 'Run the checkout tests', status: 'started' } })];
live.authorizations.length = 0; // this check's calls only (a token's iat is the second it was minted)
const token = t.network.userToken(ada);
const res = await t.get('/api/v1/me/agent-view', { bearer: token });
@@@ -85,6 +85,7 @@ const STREAM = (o = {}) => ({
assert.strictEqual(a.state, 'live');
assert.strictEqual(a.title, 'Fix the flaky upload test');
assert.deepStrictEqual(a.task, STREAM().task);
++ assert.deepStrictEqual(a.current_step, { title: 'Run the checkout tests', status: 'started' });
assert.deepStrictEqual([a.viewers, a.worked_seconds], [2, 720]);
assert.strictEqual(a.embed_url, `https://openvibe.live/embed/agent/${LIVE_ID}?vt=wvt_the_view_ticket`);
assert.strictEqual(a.page_url, `https://openvibe.live/@ada/agents/${LIVE_ID}`);