openvibers/openvibe.actor Commits
Actor: the Console links each online computer's live screen on OpenVibe.Bot (#76)
Changes
@@@ -81,3 +81,4 @@.cn-command-row { justify-content: space-between; }.cn-command textarea { min-height: 5.4rem; }}++.cn-list .cn-link { font-size: 13px; color: var(--accent, #60a5fa); }@@@ -97,7 +97,8 @@ function createConsolePages(ctx, { robots = null, computers = null } = {}) {: !result.value.computers.length ? html`<p class="cn-empty">No computer is open to your agent. Add one on <a href="${pages}/machines">openvibe.bot/machines</a> with <code>--computer ask</code>, then turn on “Let my agent use this computer”.</p>`: html`<ul class="cn-list">${result.value.computers.map((c) => html`<li><span class="cn-dot${c.online ? ' on' : ''}" aria-hidden="true"></span><b>${c.name || c.id}</b><span class="cn-meta">${c.online ? 'Online' : 'Offline'} · ${LEVEL_TEXT[c.level] || 'On'}${c.can.length ? html` · ${c.can.join(', ')}` : ''}</span>--${c.waiting_for_approval ? html`<span class="pill pill-running">${String(c.waiting_for_approval)} waiting on the machine</span>` : ''}</li>`)}</ul>`;++${c.waiting_for_approval ? html`<span class="pill pill-running">${String(c.waiting_for_approval)} waiting on the machine</span>` : ''}++${c.online && c.can.includes('screen') ? html`<a class="cn-link" href="${pages}/machines/${encodeURIComponent(c.id)}/screen">Watch the screen</a>` : ''}</li>`)}</ul>`;return html`<section class="cn-card" aria-labelledby="cn-computers"><h2 id="cn-computers">Your computers</h2>${body}<p class="cn-more"><a href="${pages}/machines">Machines on OpenVibe.Bot</a></p></section>`;}@@@ -20,7 +20,8 @@ const approvals = require('../server/agents/approvals');mine: async (subject) => {asked.push(['computers', subject]);if (botMode === 'fail') return { error: 'Bot answered 503 for your computers' };-- return { computers: [{ id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9', name: 'desk-pc', online: true, level: 'ask', can: ['terminal', 'files'], folders: ['/home/ada'], waiting_for_approval: 2 }] };++ return { computers: [{ id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9', name: 'desk-pc', online: true, level: 'ask', can: ['terminal', 'files', 'screen'], folders: ['/home/ada'], waiting_for_approval: 2 },++ { id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZA', name: 'old-laptop', online: false, level: 'observe', can: ['files', 'screen'], folders: [] }] };},},robots: {@@@ -71,7 +72,9 @@ const approvals = require('../server/agents/approvals');assert.match(h, /2 on your computers/);assert.match(h, /cn-count">3</, 'one approval here and two on the machine');assert.match(h, /Morning briefing/);-- assert.match(h, /desk-pc[\s\S]*Ask first · terminal, files/);++ assert.match(h, /desk-pc[\s\S]*Ask first · terminal, files, screen/);++ assert.match(h, /href="https:\/\/[^"]+\/machines\/dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9\/screen">Watch the screen</, 'an online computer with a screen links its live screen on Bot');++ assert.ok(!h.includes('dev_01M4W5JBFDG2TJ8C4FRDMCWBZA/screen'), 'never for one that is offline');assert.match(h, /Desk rover[\s\S]*battery 80%/);assert.match(h, /openvibe\.services\/projects/);assert.match(h, /Last 7 days: <b>\$0\.0012<\/b>, 2 tasks/, 'the week: what the two tasks spent today');
@@ -81,3 +81,4 @@
@@ -81,3 +81,4 @@
.cn-command-row { justify-content: space-between; }
.cn-command-row { justify-content: space-between; }
.cn-command textarea { min-height: 5.4rem; }
.cn-command textarea { min-height: 5.4rem; }
}
}
+.cn-list .cn-link { font-size: 13px; color: var(--accent, #60a5fa); }
@@ -97,7 +97,8 @@ function createConsolePages(ctx, { robots = null, computers = null } = {}) {
@@ -97,7 +97,8 @@ function createConsolePages(ctx, { robots = null, computers = null } = {}) {
: !result.value.computers.length ? html`<p class="cn-empty">No computer is open to your agent. Add one on <a href="${pages}/machines">openvibe.bot/machines</a> with <code>--computer ask</code>, then turn on “Let my agent use this computer”.</p>`
: !result.value.computers.length ? html`<p class="cn-empty">No computer is open to your agent. Add one on <a href="${pages}/machines">openvibe.bot/machines</a> with <code>--computer ask</code>, then turn on “Let my agent use this computer”.</p>`
: html`<ul class="cn-list">${result.value.computers.map((c) => html`<li><span class="cn-dot${c.online ? ' on' : ''}" aria-hidden="true"></span><b>${c.name || c.id}</b>
: html`<ul class="cn-list">${result.value.computers.map((c) => html`<li><span class="cn-dot${c.online ? ' on' : ''}" aria-hidden="true"></span><b>${c.name || c.id}</b>
<span class="cn-meta">${c.online ? 'Online' : 'Offline'} · ${LEVEL_TEXT[c.level] || 'On'}${c.can.length ? html` · ${c.can.join(', ')}` : ''}</span>
<span class="cn-meta">${c.online ? 'Online' : 'Offline'} · ${LEVEL_TEXT[c.level] || 'On'}${c.can.length ? html` · ${c.can.join(', ')}` : ''}</span>
-${c.waiting_for_approval ? html`<span class="pill pill-running">${String(c.waiting_for_approval)} waiting on the machine</span>` : ''}</li>`)}</ul>`;
+${c.waiting_for_approval ? html`<span class="pill pill-running">${String(c.waiting_for_approval)} waiting on the machine</span>` : ''}
+${c.online && c.can.includes('screen') ? html`<a class="cn-link" href="${pages}/machines/${encodeURIComponent(c.id)}/screen">Watch the screen</a>` : ''}</li>`)}</ul>`;
return html`<section class="cn-card" aria-labelledby="cn-computers"><h2 id="cn-computers">Your computers</h2>${body}
return html`<section class="cn-card" aria-labelledby="cn-computers"><h2 id="cn-computers">Your computers</h2>${body}
<p class="cn-more"><a href="${pages}/machines">Machines on OpenVibe.Bot</a></p></section>`;
<p class="cn-more"><a href="${pages}/machines">Machines on OpenVibe.Bot</a></p></section>`;
}
}
@@ -20,7 +20,8 @@ const approvals = require('../server/agents/approvals');
@@ -20,7 +20,8 @@ const approvals = require('../server/agents/approvals');
mine: async (subject) => {
mine: async (subject) => {
asked.push(['computers', subject]);
asked.push(['computers', subject]);
if (botMode === 'fail') return { error: 'Bot answered 503 for your computers' };
if (botMode === 'fail') return { error: 'Bot answered 503 for your computers' };
- return { computers: [{ id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9', name: 'desk-pc', online: true, level: 'ask', can: ['terminal', 'files'], folders: ['/home/ada'], waiting_for_approval: 2 }] };
+ return { computers: [{ id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9', name: 'desk-pc', online: true, level: 'ask', can: ['terminal', 'files', 'screen'], folders: ['/home/ada'], waiting_for_approval: 2 },
+ { id: 'dev_01M4W5JBFDG2TJ8C4FRDMCWBZA', name: 'old-laptop', online: false, level: 'observe', can: ['files', 'screen'], folders: [] }] };
},
},
},
},
robots: {
robots: {
@@ -71,7 +72,9 @@ const approvals = require('../server/agents/approvals');
@@ -71,7 +72,9 @@ const approvals = require('../server/agents/approvals');
assert.match(h, /2 on your computers/);
assert.match(h, /2 on your computers/);
assert.match(h, /cn-count">3</, 'one approval here and two on the machine');
assert.match(h, /cn-count">3</, 'one approval here and two on the machine');
assert.match(h, /Morning briefing/);
assert.match(h, /Morning briefing/);
- assert.match(h, /desk-pc[\s\S]*Ask first · terminal, files/);
+ assert.match(h, /desk-pc[\s\S]*Ask first · terminal, files, screen/);
+ assert.match(h, /href="https:\/\/[^"]+\/machines\/dev_01M4W5JBFDG2TJ8C4FRDMCWBZ9\/screen">Watch the screen</, 'an online computer with a screen links its live screen on Bot');
+ assert.ok(!h.includes('dev_01M4W5JBFDG2TJ8C4FRDMCWBZA/screen'), 'never for one that is offline');
assert.match(h, /Desk rover[\s\S]*battery 80%/);
assert.match(h, /Desk rover[\s\S]*battery 80%/);
assert.match(h, /openvibe\.services\/projects/);
assert.match(h, /openvibe\.services\/projects/);
assert.match(h, /Last 7 days: <b>\$0\.0012<\/b>, 2 tasks/, 'the week: what the two tasks spent today');
assert.match(h, /Last 7 days: <b>\$0\.0012<\/b>, 2 tasks/, 'the week: what the two tasks spent today');