@skydiveai/pi-extensions 0.1.254-beta.65 → 0.1.254-beta.67
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/index.mjs +31 -9
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4585,26 +4585,48 @@ function isEchoNoop(command) {
|
|
|
4585
4585
|
return arg.length <= ECHO_ARG_MAX_LEN && !ECHO_ARG_METACHARS.test(arg);
|
|
4586
4586
|
}
|
|
4587
4587
|
/**
|
|
4588
|
-
*
|
|
4589
|
-
*
|
|
4590
|
-
*
|
|
4591
|
-
*
|
|
4592
|
-
*
|
|
4588
|
+
* A `platform channel suppress-reply` invocation. Calling it once per
|
|
4589
|
+
* response scope is the documented way to hold silence; the server already
|
|
4590
|
+
* returns an advisory on the second call in the same scope. Anything past
|
|
4591
|
+
* that is a loop: 2026-10-13, one agent run fired it 3,098 times over two
|
|
4592
|
+
* hours (with the advisory text coming back every time) and burned a
|
|
4593
|
+
* customer's whole credit before the billing gate stopped it.
|
|
4593
4594
|
*/
|
|
4594
|
-
|
|
4595
|
+
const SUPPRESS_REPLY_RE = /^platform channel suppress-reply(?:\s+[^\n;&|`$]*)?$/;
|
|
4596
|
+
/**
|
|
4597
|
+
* True when one `;`/`&&`/newline-separated segment is a `platform channel
|
|
4598
|
+
* suppress-reply` invocation with its own arguments only: nothing chained
|
|
4599
|
+
* after it, no shell metacharacters. `platform channel suppress-reply ; git
|
|
4600
|
+
* push` does not match (the real command after the `;` must reset the
|
|
4601
|
+
* streak on its own).
|
|
4602
|
+
*/
|
|
4603
|
+
function isSuppressReplyCall(segment) {
|
|
4604
|
+
return SUPPRESS_REPLY_RE.test(segment.trim());
|
|
4605
|
+
}
|
|
4606
|
+
/**
|
|
4607
|
+
* True when the whole command contributes to a silence-holding streak: every
|
|
4608
|
+
* `;`/`&&`/newline-separated segment is a bare no-op or an exact
|
|
4609
|
+
* `platform channel suppress-reply` call. A real command chained onto a
|
|
4610
|
+
* suppress-reply (`platform channel suppress-reply ; git push`, or a
|
|
4611
|
+
* suppress-reply on the next line of a multi-line command) is real work and
|
|
4612
|
+
* resets the streak; the mirrored order (`true ; platform channel
|
|
4613
|
+
* suppress-reply`) still counts, so alternating segment order cannot dodge
|
|
4614
|
+
* the guard.
|
|
4615
|
+
*/
|
|
4616
|
+
function isSilenceCommand(command) {
|
|
4595
4617
|
const trimmed = command.trim();
|
|
4596
4618
|
if (trimmed.length === 0) return false;
|
|
4597
|
-
return trimmed.split(/;|&&|\n/).every(segmentIsNoop);
|
|
4619
|
+
return trimmed.split(/;|&&|\n/).every((s) => segmentIsNoop(s) || isSuppressReplyCall(s));
|
|
4598
4620
|
}
|
|
4599
4621
|
function noopBlockReason(streak, aborted) {
|
|
4600
|
-
const stop = "No-op loop: a bare `true`/`:` or a pure `echo` does nothing
|
|
4622
|
+
const stop = "No-op loop: a bare `true`/`:` or a pure `echo` does nothing, and `platform channel suppress-reply` only works once per response scope; repeating either just costs a model round trip. If you are holding silence (e.g. right after `platform channel suppress-reply`) or waiting on something, the right move is to END THE TURN: emitting nothing IS the silence, and it costs zero commands. If a real process needs the wait, use `bg_run` or schedule a wake (`platform automation create --at <time>`).";
|
|
4601
4623
|
const escalate = aborted ? ` This run has now fired ${streak} consecutive no-ops; the harness is aborting it.` : ` ${Math.max(25 - streak, 0)} more before the harness aborts the run.`;
|
|
4602
4624
|
const bypass = ` If this specific command genuinely needs to run, append \` # ${BYPASS_HINT$1}\`.`;
|
|
4603
4625
|
return stop + escalate + bypass;
|
|
4604
4626
|
}
|
|
4605
4627
|
/** Count one bash command against the streak; returns the new streak. */
|
|
4606
4628
|
function recordNoopCommand(state, command) {
|
|
4607
|
-
if (!
|
|
4629
|
+
if (!isSilenceCommand(command) || hasBypassMarker$1(command)) {
|
|
4608
4630
|
state.streak = 0;
|
|
4609
4631
|
return 0;
|
|
4610
4632
|
}
|