@milpa/comal 0.2.3 → 0.2.5
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/README.md +1 -1
- package/backend/contracts/remote-device-v1.json +470 -0
- package/package.json +2 -1
- package/src/cli.mjs +55 -10
- package/src/qr-scan.mjs +240 -0
- package/src/relay/broker.mjs +13 -0
- package/src/remote-control.mjs +227 -17
- package/src/remote-device-card.mjs +111 -0
- package/src/remote-device.mjs +97 -0
- package/src/remote-permissions.mjs +159 -0
- package/src/remote-speech.mjs +275 -0
- package/src/remote-stats.mjs +205 -0
- package/src/tui/discovery.mjs +9 -3
package/src/tui/discovery.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { graphemes, safeText } from './text.mjs';
|
|
|
6
6
|
|
|
7
7
|
const COMMANDS = [
|
|
8
8
|
['cloud', '[login|status|logout]', 'Connect your Comal account for Artifacts and Remote Control'],
|
|
9
|
-
['remote-control', '[start|status|stop|relay on|off]', 'Open this local session on the web'], ['rc', '[start|status|stop|relay on|off]', 'Remote Control shortcut'],
|
|
9
|
+
['remote-control', '[start|status|stop|relay on|off|device CODE|scan|forget|permissions on|off]', 'Open this local session on the web'], ['rc', '[start|status|stop|relay on|off|device CODE|scan|forget|permissions on|off]', 'Remote Control shortcut'],
|
|
10
10
|
['help', '', "Help and keyboard"], ['status', '', "Session, provider and budget"],
|
|
11
11
|
['tools', '', "Tools available at this time"], ['house', '', "Receipts and interrupted operations"],
|
|
12
12
|
['operations', '', "Contracts and effects of operations"], ['sessions', '', "Open the session selector"],
|
|
@@ -122,9 +122,15 @@ export function commandCatalog(context = {}) {
|
|
|
122
122
|
|
|
123
123
|
function argumentItems(command, args, context) {
|
|
124
124
|
const first = args[0] || '', position = args.length - 1;
|
|
125
|
-
if (
|
|
125
|
+
if (command === 'rc' || command === 'remote-control') {
|
|
126
|
+
const durations = () => named(['30m', '2h', '8h'], 'How long the arm lasts (30 min by default, 8 h at most)');
|
|
127
|
+
if (position === 1 && first === 'relay') return named(['on', 'off'], 'on [30m|2h|8h] arms in memory for this /rc session; off disarms');
|
|
128
|
+
if (position === 1 && first === 'device') return [...named(['scan'], 'Read the pairing QR with the camera (at most 30 s); you confirm the code'), ...named(['forget'], 'Unpair the M5Stack')];
|
|
129
|
+
if (position === 1 && first === 'permissions') return named(['on', 'off'], 'on [30m|2h|8h] lets the paired M5Stack allow once or deny; off disarms');
|
|
130
|
+
if (position === 2 && (first === 'relay' || first === 'permissions') && args[1] === 'on') return durations();
|
|
131
|
+
}
|
|
126
132
|
if (position === 0) {
|
|
127
|
-
if (command === 'rc' || command === 'remote-control')return [...named(['start','status','stop'],'Remote session projection; local tools and permissions'), ...named(['relay'], 'Answers to /relay cards from the browser (off by default)')];
|
|
133
|
+
if (command === 'rc' || command === 'remote-control')return [...named(['start','status','stop'],'Remote session projection; local tools and permissions'), ...named(['relay'], 'Answers to /relay cards from the browser (off by default)'), ...named(['device'], 'Pair an M5Stack: type its CODE, or scan its QR'), ...named(['permissions'], 'Let the paired M5Stack answer permission cards (off by default)')];
|
|
128
134
|
if (command === 'cloud') return named(['login','status','logout'],'Comal account; separate from the model provider');
|
|
129
135
|
if (command === 'permissions') return context.mode === BYPASS_PERMISSION_MODE ? [] : [...named(['default', 'plan', 'acceptEdits', 'auto'], t("Permissions mode; does not change the model")), ...named(['allow', 'ask', 'deny', 'remove'], t("Saved permission rule; deny wins"))];
|
|
130
136
|
if (command === 'autonomy') return context.mode === BYPASS_PERMISSION_MODE ? [] : named(languageInfo().language === 'es' ? ['observar', 'asistir', 'editar', 'autonomo'] : ['observe', 'assist', 'edit', 'autonomous'], t("Autonomy level; never enables the startup bypass"));
|