@termhub/agent 0.5.1 → 0.5.2
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/dist/cli.js +9 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -60,7 +60,12 @@ var def = (params, result, timeoutMs = DEFAULT_TIMEOUT) => ({ params, result, ti
|
|
|
60
60
|
var RPC = {
|
|
61
61
|
"tmux.list": def(z.object({}), z.object({ sessions: z.array(sessionName) })),
|
|
62
62
|
"tmux.kill": def(z.object({ session: sessionName }), z.object({ killed: z.boolean() })),
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* `escapes`: keep the SGR attributes (`capture-pane -e`) so the server can tell dimmed text from typed
|
|
65
|
+
* text (since agent 0.5.2). An older agent strips the unknown param and answers plain text with no
|
|
66
|
+
* `escapes` in the result — which is how the server knows.
|
|
67
|
+
*/
|
|
68
|
+
"tmux.capture": def(z.object({ session: sessionName, lines: z.number().int().min(1).max(5e3), escapes: z.boolean().optional() }), z.object({ text: z.string(), escapes: z.boolean().optional() })),
|
|
64
69
|
/** Idempotent: creates the detached session in `cwd` when it is missing. `created` says whether it had to. */
|
|
65
70
|
"tmux.ensure": def(z.object({ session: sessionName, cwd: machinePath }), z.object({ created: z.boolean() }), 1e4),
|
|
66
71
|
/**
|
|
@@ -2020,11 +2025,11 @@ async function kill(params) {
|
|
|
2020
2025
|
return { killed: r.code === 0 };
|
|
2021
2026
|
}
|
|
2022
2027
|
async function capture(params) {
|
|
2023
|
-
const r = await run(tmuxPath(), ["capture-pane", "-p", "-S", `-${params.lines}`, "-t", `=${params.session}:`]);
|
|
2028
|
+
const r = await run(tmuxPath(), ["capture-pane", "-p", ...params.escapes ? ["-e"] : [], "-S", `-${params.lines}`, "-t", `=${params.session}:`]);
|
|
2024
2029
|
const failure = processFailure2(r);
|
|
2025
2030
|
if (failure) throw failure;
|
|
2026
2031
|
if (r.code !== 0) throw new RpcFailure("notfound", "session not found");
|
|
2027
|
-
return { text: r.stdout };
|
|
2032
|
+
return params.escapes ? { text: r.stdout, escapes: true } : { text: r.stdout };
|
|
2028
2033
|
}
|
|
2029
2034
|
var pane = (session) => `=${session}:`;
|
|
2030
2035
|
var why = (stderr, fallback) => stderr.trim().split("\n")[0] || fallback;
|
|
@@ -2312,7 +2317,7 @@ async function status3() {
|
|
|
2312
2317
|
}
|
|
2313
2318
|
|
|
2314
2319
|
// src/version.ts
|
|
2315
|
-
var AGENT_VERSION = "0.5.
|
|
2320
|
+
var AGENT_VERSION = "0.5.2";
|
|
2316
2321
|
|
|
2317
2322
|
// src/rpc/update.ts
|
|
2318
2323
|
var PACKAGE = "@termhub/agent";
|
package/package.json
CHANGED