@songsid/agend 2.1.2-beta.30 → 2.1.2-beta.32
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/daemon.d.ts +20 -0
- package/dist/daemon.js +35 -1
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +4 -0
- package/dist/fleet-manager.js +40 -3
- package/dist/fleet-manager.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.d.ts
CHANGED
|
@@ -94,6 +94,26 @@ export declare class AutoPauseController {
|
|
|
94
94
|
* `getBusyPattern()`, and that match vetoes ready regardless of what the ready
|
|
95
95
|
* pattern says.
|
|
96
96
|
*/
|
|
97
|
+
/**
|
|
98
|
+
* A shell command reduced to the part that is safe to show: the program, and a
|
|
99
|
+
* subcommand when there is one.
|
|
100
|
+
*
|
|
101
|
+
* curl -H "Bearer sk-ant-…" https://api.com → curl
|
|
102
|
+
* npm test --env=API_KEY=xxx → npm test
|
|
103
|
+
* git push origin main → git push
|
|
104
|
+
*
|
|
105
|
+
* Arguments are dropped wholesale rather than filtered, because there is no
|
|
106
|
+
* reliable way to tell a secret from an ordinary argument: tokens, bearer
|
|
107
|
+
* headers, connection strings and `--password=` values all look like text. The
|
|
108
|
+
* progress line is posted to a chat channel and, for a public one, so is
|
|
109
|
+
* anything in it — so the rule is "never the arguments", not "not the arguments
|
|
110
|
+
* that look dangerous".
|
|
111
|
+
*
|
|
112
|
+
* A second token is kept only when it is a bare word (`push`, `test`), which is
|
|
113
|
+
* what a subcommand looks like and what a flag, path, URL, assignment or quoted
|
|
114
|
+
* string does not. Everything after it goes, including `git push ORIGIN MAIN`.
|
|
115
|
+
*/
|
|
116
|
+
export declare function shellCommandLabel(command: string): string;
|
|
97
117
|
export declare class PaneStateMachine {
|
|
98
118
|
private readonly stuckTimeoutMs;
|
|
99
119
|
private readonly readyPattern;
|
package/dist/daemon.js
CHANGED
|
@@ -200,6 +200,39 @@ export class AutoPauseController {
|
|
|
200
200
|
* `getBusyPattern()`, and that match vetoes ready regardless of what the ready
|
|
201
201
|
* pattern says.
|
|
202
202
|
*/
|
|
203
|
+
/**
|
|
204
|
+
* A shell command reduced to the part that is safe to show: the program, and a
|
|
205
|
+
* subcommand when there is one.
|
|
206
|
+
*
|
|
207
|
+
* curl -H "Bearer sk-ant-…" https://api.com → curl
|
|
208
|
+
* npm test --env=API_KEY=xxx → npm test
|
|
209
|
+
* git push origin main → git push
|
|
210
|
+
*
|
|
211
|
+
* Arguments are dropped wholesale rather than filtered, because there is no
|
|
212
|
+
* reliable way to tell a secret from an ordinary argument: tokens, bearer
|
|
213
|
+
* headers, connection strings and `--password=` values all look like text. The
|
|
214
|
+
* progress line is posted to a chat channel and, for a public one, so is
|
|
215
|
+
* anything in it — so the rule is "never the arguments", not "not the arguments
|
|
216
|
+
* that look dangerous".
|
|
217
|
+
*
|
|
218
|
+
* A second token is kept only when it is a bare word (`push`, `test`), which is
|
|
219
|
+
* what a subcommand looks like and what a flag, path, URL, assignment or quoted
|
|
220
|
+
* string does not. Everything after it goes, including `git push ORIGIN MAIN`.
|
|
221
|
+
*/
|
|
222
|
+
export function shellCommandLabel(command) {
|
|
223
|
+
// First line only: heredocs and multi-line scripts carry the payload.
|
|
224
|
+
const tokens = (command.split("\n")[0] ?? "").trim().split(/\s+/).filter(Boolean);
|
|
225
|
+
// `FOO=bar cmd …` — leading assignments are env, and their values are exactly
|
|
226
|
+
// the kind of thing being protected here.
|
|
227
|
+
while (tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[0]))
|
|
228
|
+
tokens.shift();
|
|
229
|
+
const program = tokens[0];
|
|
230
|
+
if (!program)
|
|
231
|
+
return "";
|
|
232
|
+
const isBareWord = (t) => !!t && /^[A-Za-z][A-Za-z0-9_-]*$/.test(t);
|
|
233
|
+
const label = isBareWord(tokens[1]) ? `${program} ${tokens[1]}` : program;
|
|
234
|
+
return label.length > 40 ? `${label.slice(0, 39)}…` : label;
|
|
235
|
+
}
|
|
203
236
|
export class PaneStateMachine {
|
|
204
237
|
stuckTimeoutMs;
|
|
205
238
|
readyPattern;
|
|
@@ -1987,8 +2020,9 @@ export class Daemon extends EventEmitter {
|
|
|
1987
2020
|
return `Edit ${inp.file_path ?? ""}`;
|
|
1988
2021
|
if (name === "Write")
|
|
1989
2022
|
return `Write ${inp.file_path ?? ""}`;
|
|
2023
|
+
// Command name only — never the arguments. See shellCommandLabel.
|
|
1990
2024
|
if (name === "Bash")
|
|
1991
|
-
return `$ ${String(inp.command ?? "")
|
|
2025
|
+
return `$ ${shellCommandLabel(String(inp.command ?? ""))}`;
|
|
1992
2026
|
if (name === "Glob")
|
|
1993
2027
|
return `Glob ${inp.pattern ?? ""}`;
|
|
1994
2028
|
if (name === "Grep")
|