agent-yes 1.196.3 → 1.197.0

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.
Files changed (42) hide show
  1. package/default.config.yaml +51 -12
  2. package/dist/{SUPPORTED_CLIS-D3knhJ6_.js → SUPPORTED_CLIS-BY83eM58.js} +2 -2
  3. package/dist/SUPPORTED_CLIS-D4Z--hGm.js +9 -0
  4. package/dist/{agent-yes.config-ugPYTPOd.js → agent-yes.config-whqkqq9P.js} +2 -2
  5. package/dist/{agentShare-M6FE9AsI.js → agentShare-DWioPObE.js} +8 -7
  6. package/dist/cli.js +8 -8
  7. package/dist/{configShared-0MnIQ652.js → configShared-aKTg-sa5.js} +1 -1
  8. package/dist/{e2e-BeKjLhmO.js → e2e-jb0Hp43q.js} +1 -1
  9. package/dist/{expose-B3AGhVhM.js → expose-k9l6ZJDA.js} +1 -1
  10. package/dist/{forkNested-C1kKsXi5.js → forkNested-DOyDAHnC.js} +1 -1
  11. package/dist/index.js +3 -2
  12. package/dist/messageLog-CxrKJj77.js +94 -0
  13. package/dist/{nodeRuntime-DZRjxpNp.js → nodeRuntime-CwNJuwH5.js} +1 -1
  14. package/dist/{notifyDaemon-DgxP6GAn.js → notifyDaemon-CRf_27kE.js} +7 -6
  15. package/dist/{openBrowser-DQVkxCyj.js → openBrowser-CSj21pZE.js} +1 -1
  16. package/dist/{reaper-CWF2_ATd.js → reaper-BUHCyxdF.js} +1 -1
  17. package/dist/{reaper-jfSmog15.js → reaper-CJSu8UVZ.js} +1 -1
  18. package/dist/{remotes-CW-yxSgW.js → remotes-CXqYR0p8.js} +3 -3
  19. package/dist/{remotes-oSmwSYaV.js → remotes-Cim0dBU7.js} +3 -3
  20. package/dist/{rustBinary-C9q17obe.js → rustBinary-5HCt7_0b.js} +2 -2
  21. package/dist/{schedule-SisMmURQ.js → schedule-CjBcOy-b.js} +7 -6
  22. package/dist/{serve-BOrkFR6H.js → serve-C3E8uicL.js} +26 -25
  23. package/dist/{setup-CFbckIlf.js → setup-C4SKqGy1.js} +3 -3
  24. package/dist/{share-29YbzpbU.js → share-BfIU8t_h.js} +2 -2
  25. package/dist/{share-nvqy64A2.js → share-Ciw1mWVN.js} +2 -2
  26. package/dist/{spawnGate-CWbdnJ5K.js → spawnGate-BkjeS4tg.js} +1 -1
  27. package/dist/{spawnGate-DRWa_Fzj.js → spawnGate-CXjEz6Pf.js} +2 -2
  28. package/dist/{subcommands-CMX-dej0.js → subcommands-B7UxIJRw.js} +17 -103
  29. package/dist/{subcommands-DSbYPDt5.js → subcommands-DzWBZ6HE.js} +6 -5
  30. package/dist/{tray-BKTZ5gIf.js → tray-BSFi35Qg.js} +1 -1
  31. package/dist/{ts-Bqa5HjY3.js → ts-B64pNQlI.js} +84 -7
  32. package/dist/{versionChecker-ZIgviJ62.js → versionChecker-DKiSuTSp.js} +2 -2
  33. package/dist/{webrtcLink-BG0Xc4-W.js → webrtcLink-B7REGtK2.js} +2 -2
  34. package/dist/{webrtcRemote-BmuVKcrx.js → webrtcRemote-CvIEfWX8.js} +3 -3
  35. package/dist/{workspaceConfig-_GtAZtsi.js → workspaceConfig-CjaRvTjf.js} +1 -1
  36. package/package.json +1 -1
  37. package/ts/autoRetry.spec.ts +90 -1
  38. package/ts/autoRetry.ts +76 -0
  39. package/ts/index.ts +37 -4
  40. package/ts/messageLog.ts +3 -2
  41. package/ts/subcommands.ts +9 -5
  42. package/dist/SUPPORTED_CLIS-L3rJRumq.js +0 -8
package/ts/index.ts CHANGED
@@ -21,9 +21,14 @@ import { sendEnter, sendMessage } from "./core/messaging.ts";
21
21
  import {
22
22
  AUTO_RETRY_GIVE_UP_MS,
23
23
  AUTO_RETRY_MIN_IDLE_MS,
24
+ AUTO_RETRY_REASON_FALLBACK,
24
25
  autoRetryBackoffMs,
26
+ buildAutoRetryMessage,
27
+ classifyAutoRetryReason,
28
+ formatDurationSecs,
25
29
  shouldFireRetry,
26
30
  } from "./autoRetry.ts";
31
+ import { recordInbox } from "./messageLog.ts";
27
32
  import {
28
33
  initializeLogPaths,
29
34
  setupDebugLogging,
@@ -794,6 +799,9 @@ export default async function agentYes({
794
799
  let retryStartedAt: number | null = null;
795
800
  let retryNextAt: number | null = null;
796
801
  let autoRetryScreen = "";
802
+ // Paraphrased reason captured when the error banner was matched — folded
803
+ // into the typed retry message so the agent knows why it is being nudged.
804
+ let retryReason: string | null = null;
797
805
  const heartbeatInterval = setInterval(async () => {
798
806
  try {
799
807
  const rendered = removeControlCharacters(xtermProxy.tail(12));
@@ -822,15 +830,36 @@ export default async function agentYes({
822
830
  retryNextAt = now + 500; // busy / not at prompt / still active — re-check shortly
823
831
  } else {
824
832
  retryStreak += 1;
825
- logger.warn(`[${cli}-yes] auto-retry: typing 'retry' (attempt ${retryStreak})`);
826
- // Write "retry" + Enter atomically (mirrors rs do_send_retry); using
833
+ const nextBackoffMs = autoRetryBackoffMs(retryStreak);
834
+ const reason = retryReason ?? AUTO_RETRY_REASON_FALLBACK;
835
+ const sinceFirstSecs = retryStartedAt === null ? 0 : (now - retryStartedAt) / 1000;
836
+ const line = buildAutoRetryMessage(
837
+ retryStreak,
838
+ reason,
839
+ sinceFirstSecs,
840
+ nextBackoffMs / 1000,
841
+ );
842
+ logger.warn(
843
+ `[${cli}-yes] auto-retry: typing retry nudge (attempt ${retryStreak}, reason: ${reason})`,
844
+ );
845
+ // Write the nudge + Enter atomically (mirrors rs do_send_retry); using
827
846
  // sendMessage would split text/Enter across the fast heartbeat ticks.
828
- ctx.messageContext.shell.write("retry\r");
847
+ ctx.messageContext.shell.write(line + "\r");
829
848
  ctx.idleWaiter.ping();
849
+ // Structured trace for `ay msgs` / the console (mirrors the Rust
850
+ // runtime's record_auto_retry_inbox) — best-effort, never blocks.
851
+ void recordInbox({
852
+ at: now,
853
+ from: null,
854
+ to: { pid: process.pid, cli, cwd: workingDir },
855
+ kind: "auto-retry",
856
+ body: `${reason} (attempt ${retryStreak}, next backoff ${formatDurationSecs(nextBackoffMs / 1000)})`,
857
+ wrapped: false,
858
+ });
830
859
  // Self-schedule the next retry with escalated backoff. (Leaving nextAt
831
860
  // null and re-arming from the stdout pipeline would tight-loop while the
832
861
  // error banner stays on screen.) Reset on recovery cancels this.
833
- retryNextAt = now + autoRetryBackoffMs(retryStreak);
862
+ retryNextAt = now + nextBackoffMs;
834
863
  }
835
864
  }
836
865
  }
@@ -1185,6 +1214,10 @@ export default async function agentYes({
1185
1214
  const errVisible = conf.autoRetry.some((rx: RegExp) => rx.test(rendered));
1186
1215
  const readyVisible = conf.ready?.some((rx: RegExp) => rx.test(rendered)) ?? false;
1187
1216
  if (errVisible && readyVisible) {
1217
+ // Remember WHY (paraphrased — see classifyAutoRetryReason) so
1218
+ // the typed message can explain itself. Refresh on every match:
1219
+ // the banner may change across attempts (e.g. overload → 5xx).
1220
+ retryReason = classifyAutoRetryReason(rendered);
1188
1221
  if (retryNextAt === null) {
1189
1222
  if (retryStartedAt === null) retryStartedAt = Date.now();
1190
1223
  const delayMs = autoRetryBackoffMs(retryStreak);
package/ts/messageLog.ts CHANGED
@@ -39,8 +39,9 @@ export interface MessageRecord {
39
39
  to: MailParty;
40
40
  /** What kind of stdin write this was. Omitted for a normal `ay send` text
41
41
  * message; "key" for raw keystrokes (`ay key`), "select" for a menu pick
42
- * (`ay select`). For key/select the `body` holds the key names / choice. */
43
- kind?: "key" | "select";
42
+ * (`ay select`), "auto-retry" for the wrapper's own recoverable-error nudge
43
+ * (from is null; `body` holds the paraphrased reason + backoff state). */
44
+ kind?: "key" | "select" | "auto-retry";
44
45
  /** The message body (without the `[ay-msg …]` wrapper), or — for a key/select
45
46
  * record — the keystroke names / chosen option. */
46
47
  body: string;
package/ts/subcommands.ts CHANGED
@@ -211,7 +211,7 @@ export interface MessageEdge {
211
211
  by: number;
212
212
  target: number;
213
213
  at: number;
214
- kind?: "key" | "select";
214
+ kind?: "key" | "select" | "auto-retry";
215
215
  }
216
216
 
217
217
  /**
@@ -3279,10 +3279,14 @@ async function cmdMsgs(rest: string[]): Promise<number> {
3279
3279
 
3280
3280
  for (const { dir, rec } of shown) {
3281
3281
  const when = new Date(rec.at).toLocaleTimeString();
3282
- const peer =
3283
- dir === "out"
3284
- ? `→ ${rec.to.cli} #${rec.to.pid}`
3285
- : `← ${rec.from ? `${rec.from.cli} #${rec.from.pid}` : "human"}`;
3282
+ // auto-retry nudges are written by the agent's own wrapper (from is null
3283
+ // there too) — label them as agent-yes, not a human send.
3284
+ const fromLabel = rec.from
3285
+ ? `${rec.from.cli} #${rec.from.pid}`
3286
+ : rec.kind === "auto-retry"
3287
+ ? "agent-yes"
3288
+ : "human";
3289
+ const peer = dir === "out" ? `→ ${rec.to.cli} #${rec.to.pid}` : `← ${fromLabel}`;
3286
3290
  const via = rec.remote ? ` (via ${rec.remote})` : "";
3287
3291
  const flag = rec.confirmed === false ? " (unconfirmed)" : "";
3288
3292
  const tag = rec.kind ? `[${rec.kind}] ` : "";
@@ -1,8 +0,0 @@
1
- import "./ts-Bqa5HjY3.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-ZIgviJ62.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D3knhJ6_.js";
7
-
8
- export { SUPPORTED_CLIS };