@integrity-labs/agt-cli 0.28.673 → 0.28.674

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/bin/agt.js CHANGED
@@ -40,10 +40,10 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-RSERKOS7.js";
43
+ } from "../chunk-ZD72DPZT.js";
44
44
  import {
45
45
  readDirectChatSessionState
46
- } from "../chunk-YAVWYI5S.js";
46
+ } from "../chunk-7Y54PSMR.js";
47
47
  import {
48
48
  AnchorSessionClient,
49
49
  CHANNEL_REGISTRY,
@@ -73,7 +73,7 @@ import {
73
73
  requiredMcpWildcard,
74
74
  resolveChannels,
75
75
  serializeManifestForSlackCli
76
- } from "../chunk-YOID6KOQ.js";
76
+ } from "../chunk-AJNES24H.js";
77
77
  import "../chunk-XWVM4KPK.js";
78
78
 
79
79
  // src/bin/agt.ts
@@ -4909,7 +4909,7 @@ import { execFileSync, execSync } from "child_process";
4909
4909
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4910
4910
  import chalk18 from "chalk";
4911
4911
  import ora16 from "ora";
4912
- var cliVersion = true ? "0.28.673" : "dev";
4912
+ var cliVersion = true ? "0.28.674" : "dev";
4913
4913
  async function fetchLatestVersion() {
4914
4914
  const host2 = getHost();
4915
4915
  if (!host2) return null;
@@ -6089,7 +6089,7 @@ function handleError(err) {
6089
6089
  }
6090
6090
 
6091
6091
  // src/bin/agt.ts
6092
- var cliVersion2 = true ? "0.28.673" : "dev";
6092
+ var cliVersion2 = true ? "0.28.674" : "dev";
6093
6093
  var program = new Command();
6094
6094
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
6095
6095
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -2,6 +2,7 @@ import {
2
2
  INTEGRATION_REGISTRY,
3
3
  OAUTH_PROVIDERS,
4
4
  PLATFORM_STORAGE_RULE,
5
+ SECRET_PATTERNS,
5
6
  claudeModelAlias,
6
7
  getOrCreateDailySession,
7
8
  isClaudeFastMode,
@@ -16,7 +17,7 @@ import {
16
17
  rotateDailySession,
17
18
  sessionFileExists,
18
19
  todayLocalIso
19
- } from "./chunk-YOID6KOQ.js";
20
+ } from "./chunk-AJNES24H.js";
20
21
  import {
21
22
  reapOrphanChannelMcps
22
23
  } from "./chunk-XWVM4KPK.js";
@@ -187,6 +188,52 @@ function agentRuntimeKey(codeName, homeDir) {
187
188
  return codeName;
188
189
  }
189
190
 
191
+ // src/lib/pane-log-redactor.ts
192
+ function buildRedactorProgram(patterns = SECRET_PATTERNS) {
193
+ const subs = patterns.map((p) => ` $buf =~ s/${p.re.source}/<redacted:${p.label}>/g;`).join("\n");
194
+ return [
195
+ "#!/usr/bin/perl",
196
+ "# ENG-9353 pane.log secret redactor \u2014 GENERATED by pane-log-redactor.ts from",
197
+ "# @augmented/core's SECRET_PATTERNS. Do not edit here; change the canonical",
198
+ "# list and respawn. Streams stdin to stdout in raw 64KB blocks so pane.log",
199
+ "# mtime stays as fresh as the `cat` it replaces.",
200
+ "use strict; use warnings;",
201
+ "use Errno qw(EINTR);",
202
+ "$| = 1;",
203
+ "binmode(STDIN); binmode(STDOUT);",
204
+ "my $buf;",
205
+ // Retry interrupted syscalls, exactly as the `cat` this replaces does. A
206
+ // signal during the blocking sysread makes it return undef with $! == EINTR;
207
+ // perl does NOT auto-restart, so `undef > 0` would end the loop, the sink
208
+ // would exit, and pane capture (with the mtime idle signal) would stop for
209
+ // the rest of the session. Same for a partial/interrupted syswrite.
210
+ "OUTER: while (1) {",
211
+ " my $n = sysread(STDIN, $buf, 65536);",
212
+ " if (!defined $n) { next OUTER if $! == EINTR; last OUTER; }",
213
+ " last OUTER if $n == 0;",
214
+ subs,
215
+ " my $off = 0;",
216
+ " while ($off < length($buf)) {",
217
+ " my $w = syswrite(STDOUT, $buf, length($buf) - $off, $off);",
218
+ " unless (defined $w) { next if $! == EINTR; last OUTER; }",
219
+ " $off += $w;",
220
+ " }",
221
+ "}",
222
+ ""
223
+ ].join("\n");
224
+ }
225
+ function buildPaneSinkCommand(opts) {
226
+ const log2 = shellSingleQuote(opts.logPath);
227
+ if (!opts.hasPerl) {
228
+ return `cat >> ${log2}`;
229
+ }
230
+ const script = shellSingleQuote(opts.scriptPath);
231
+ return `perl ${script} >> ${log2}`;
232
+ }
233
+ function shellSingleQuote(value) {
234
+ return `'${value.replace(/'/g, `'\\''`)}'`;
235
+ }
236
+
190
237
  // src/lib/opencode-session.ts
191
238
  import { spawn, execSync } from "child_process";
192
239
  import { createServer } from "net";
@@ -3303,6 +3350,44 @@ var PANE_TAIL_LINES = 20;
3303
3350
  function paneLogPath(codeName) {
3304
3351
  return join6(PANE_LOG_DIR, codeName, "pane.log");
3305
3352
  }
3353
+ var PANE_REDACTOR_SCRIPT = join6(PANE_LOG_DIR, "pane-log-redactor.pl");
3354
+ var paneRedactorPerlAvailable = null;
3355
+ function paneSinkCommand(logPath, log2) {
3356
+ if (paneRedactorPerlAvailable === null) {
3357
+ try {
3358
+ execSync2("command -v perl", { stdio: "ignore" });
3359
+ paneRedactorPerlAvailable = true;
3360
+ } catch {
3361
+ paneRedactorPerlAvailable = false;
3362
+ log2("[persistent-session] perl not found \u2014 pane.log secret redaction disabled, falling back to cat");
3363
+ }
3364
+ }
3365
+ if (paneRedactorPerlAvailable) {
3366
+ try {
3367
+ mkdirSync4(dirname4(PANE_REDACTOR_SCRIPT), { recursive: true });
3368
+ const tmp = `${PANE_REDACTOR_SCRIPT}.${randomUUID()}.tmp`;
3369
+ try {
3370
+ writeFileSync4(tmp, buildRedactorProgram(), { encoding: "utf-8", mode: 448 });
3371
+ chmodSync3(tmp, 448);
3372
+ renameSync(tmp, PANE_REDACTOR_SCRIPT);
3373
+ } catch (e) {
3374
+ try {
3375
+ rmSync3(tmp, { force: true });
3376
+ } catch {
3377
+ }
3378
+ throw e;
3379
+ }
3380
+ } catch (err) {
3381
+ log2(`[persistent-session] pane.log redactor install failed, using cat: ${err.message}`);
3382
+ return buildPaneSinkCommand({ logPath, hasPerl: false, scriptPath: PANE_REDACTOR_SCRIPT });
3383
+ }
3384
+ }
3385
+ return buildPaneSinkCommand({
3386
+ logPath,
3387
+ hasPerl: paneRedactorPerlAvailable === true,
3388
+ scriptPath: PANE_REDACTOR_SCRIPT
3389
+ });
3390
+ }
3306
3391
  function setupPaneLog2(tmuxSession, codeName, log2) {
3307
3392
  const logPath = paneLogPath(codeName);
3308
3393
  try {
@@ -3315,7 +3400,7 @@ function setupPaneLog2(tmuxSession, codeName, log2) {
3315
3400
  "utf-8"
3316
3401
  );
3317
3402
  execSync2(
3318
- `tmux pipe-pane -o -t ${tmuxSession} 'cat >> ${logPath.replace(/'/g, `'\\''`)}'`,
3403
+ `tmux pipe-pane -o -t '${tmuxSession.replace(/'/g, `'\\''`)}' '${paneSinkCommand(logPath, log2).replace(/'/g, `'\\''`)}'`,
3319
3404
  { stdio: "ignore" }
3320
3405
  );
3321
3406
  } catch (err) {
@@ -4446,4 +4531,4 @@ export {
4446
4531
  stopAllSessionsAndWait,
4447
4532
  getProjectDir
4448
4533
  };
4449
- //# sourceMappingURL=chunk-YAVWYI5S.js.map
4534
+ //# sourceMappingURL=chunk-7Y54PSMR.js.map