@volter/supercode-teams 0.2.71 → 0.2.72
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 -0
- package/bin/teams.mjs +18 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,6 +82,7 @@ supercode teams machine start # local door only
|
|
|
82
82
|
supercode open --new bash --detach # a pane; prints its contextKey
|
|
83
83
|
supercode open <ctx> # attach; ctrl-] detaches
|
|
84
84
|
supercode teams input <ctx> "make test"
|
|
85
|
+
supercode teams input <ctx> --key Escape # keys by tmux name: C-c, "Down Enter", …
|
|
85
86
|
supercode teams title set <ctx> "rate-limit rescue" # also names the owned tmux window
|
|
86
87
|
supercode teams suspend <ctx> # remote input refused; observe keeps streaming
|
|
87
88
|
supercode teams resume <ctx> --input "carry on" # the input that hands the pane back
|
package/bin/teams.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// machine status the running daemon, if any
|
|
11
11
|
// describe the host-key-signed statement
|
|
12
12
|
// panes ls | capture <pane> | close <pane>
|
|
13
|
-
// input <pane> <text> [--no-enter]
|
|
13
|
+
// input <pane> <text> [--no-enter] | input <pane> --key NAMES text, or keys by tmux name (Escape, C-c, Down …)
|
|
14
14
|
// suspend <pane> [--interrupt] | resume <pane> [--input text] refuse/allow remote input on a pane
|
|
15
15
|
// files ls|get|put|stat|search <path> [--out f] [--in f] [--query q]
|
|
16
16
|
// ports ls | resolve <pane> port <pane>/<n> [--listen host:port]
|
|
@@ -45,7 +45,7 @@ import { NODE_PROTOCOL } from '@volter/teams/channel';
|
|
|
45
45
|
|
|
46
46
|
const MACHINE_VERBS = new Set(['machine', 'describe', 'panes', 'input', 'suspend', 'resume', 'files', 'ports', 'port', 'browser', 'stream', 'jobs', 'workspace', 'title', 'attention', 'watch', 'rpc', 'log', 'mail']);
|
|
47
47
|
// Every flag a machine verb reads; any other is refused rather than silently ignored.
|
|
48
|
-
const KNOWN_FLAGS = new Set(['home', 'machine', 'context', 'floor', 'supercode', 'tmux-socket', 'verbose', 'lines', 'input', 'name', 'for', 'urgency', 'reason', 'interrupt', 'query', 'out', 'in', 'interval', 'no-enter', 'when-composer-empty', 'listen', 'list', 'from', 'to', 'path', 'to-path']);
|
|
48
|
+
const KNOWN_FLAGS = new Set(['home', 'machine', 'context', 'floor', 'supercode', 'tmux-socket', 'verbose', 'lines', 'input', 'name', 'for', 'urgency', 'reason', 'interrupt', 'query', 'out', 'in', 'interval', 'no-enter', 'when-composer-empty', 'key', 'listen', 'list', 'from', 'to', 'path', 'to-path']);
|
|
49
49
|
|
|
50
50
|
const argv = process.argv.slice(2);
|
|
51
51
|
const flags = {};
|
|
@@ -90,6 +90,18 @@ const out = (value) => process.stdout.write((typeof value === 'string' ? value :
|
|
|
90
90
|
const die = (message, code = 2) => { process.stderr.write(`supercode teams: ${message}\n`); process.exit(code); };
|
|
91
91
|
if (!workspaceVerb) for (const flag of Object.keys(flags)) if (!KNOWN_FLAGS.has(flag)) die(`unknown flag: --${flag}`);
|
|
92
92
|
|
|
93
|
+
/** Named keys (tmux's names) as the bytes a terminal sends for them: `panes.input` delivers
|
|
94
|
+
* text without a trailing newline as a keystream, which every terminal host turns back into keys. */
|
|
95
|
+
const KEY_BYTES = { Escape: '\u001b', Enter: '\r', Tab: '\t', BTab: '\u001b[Z', BSpace: '\u007f', Space: ' ', Up: '\u001b[A', Down: '\u001b[B', Right: '\u001b[C', Left: '\u001b[D', Home: '\u001b[H', End: '\u001b[F', PPage: '\u001b[5~', NPage: '\u001b[6~', DC: '\u001b[3~' };
|
|
96
|
+
function keyBytes(names) {
|
|
97
|
+
return names.split(/[\s,]+/u).filter(Boolean).map((name) => {
|
|
98
|
+
const control = /^C-([a-z])$/iu.exec(name);
|
|
99
|
+
if (control) return String.fromCharCode(control[1].toLowerCase().charCodeAt(0) - 96);
|
|
100
|
+
if (!Object.hasOwn(KEY_BYTES, name)) die(`unknown key ${name}: one of ${Object.keys(KEY_BYTES).join(', ')}, C-a … C-z`);
|
|
101
|
+
return KEY_BYTES[name];
|
|
102
|
+
}).join('');
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
async function machineChannel() {
|
|
94
106
|
return openMachine({ machine: flags.machine ? String(flags.machine) : null, context: flags.context ? String(flags.context) : null, home });
|
|
95
107
|
}
|
|
@@ -198,6 +210,10 @@ async function main() {
|
|
|
198
210
|
// `input <pane> <text>`: one delivery through the host's own sendInput; gated like control.
|
|
199
211
|
// `--when-composer-empty`: a user's own turn, typed only into an empty composer
|
|
200
212
|
// (answers `delivered: false` with the reason when it holds a draft).
|
|
213
|
+
if (flags.key !== undefined) {
|
|
214
|
+
if (flags.key === true || rest.length) die('input <pane> --key NAMES: keys by tmux name, space- or comma-separated (Escape, Enter, Tab, BTab, BSpace, Space, Up, Down, Left, Right, Home, End, PPage, NPage, DC, C-a … C-z)');
|
|
215
|
+
return withNode(async (rpc) => out(await rpc.call('panes.input', { pane: sub, text: keyBytes(String(flags.key)), submit: false })));
|
|
216
|
+
}
|
|
201
217
|
if (flags['when-composer-empty']) return withNode(async (rpc) => out(await rpc.call('panes.turn', { pane: sub, text: rest.join(' ') })));
|
|
202
218
|
return withNode(async (rpc) => out(await rpc.call('panes.input', { pane: sub, text: rest.join(' '), submit: !flags['no-enter'] })));
|
|
203
219
|
case 'port': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|