neurastream 0.2.17 → 0.2.18
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/README.md +1 -1
- package/package.json +1 -1
- package/src/adapters/omp/index.ts +7 -12
package/README.md
CHANGED
|
@@ -189,7 +189,7 @@ notify: posted (rate-limit)
|
|
|
189
189
|
RATE-LIMIT resume: new turn sent (waited until 08:12)
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
The wait is the `retry-after-ms=<ms>` or `retry-after: <seconds>` the error text names (omp appends the provider's header to the error message), else `default_wait_s` (300). A turn the resume started that ends on a limit again is the same episode at attempt 2: the wait doubles, no second post. Any turn that ends without a limit ends the episode and disarms the timer. Every wait is clamped to `max_wait_s` (3600) before `slack_s` (15) is added on top. Your own message
|
|
192
|
+
The wait is the `retry-after-ms=<ms>` or `retry-after: <seconds>` the error text names (omp appends the provider's header to the error message), else `default_wait_s` (300). A turn the resume started that ends on a limit again is the same episode at attempt 2: the wait doubles, no second post. Any turn that ends without a limit ends the episode and disarms the timer. Every wait is clamped to `max_wait_s` (3600) before `slack_s` (15) is added on top. Your own message takes over and cancels the resume (`RATE-LIMIT resume cancelled: owner message`) when it starts a turn; a slash command or a handled input such as a chat unlock leaves the resume armed. A rate-limited deferred hand-back (an `agent_end` while an async job is pending) arms the same timer instead of logging "no reply text". The words and the waits live in `config.yml` (`guards.rate_limit`, `docs/config.md`); turns that did not end on a rate limit are unaffected.
|
|
193
193
|
|
|
194
194
|
omp retries a 429 itself while the provider's wait fits its `retry.maxDelayMs` (300000 ms by default); only a longer wait ends the turn (`Retry failed after 1 attempts: Provider requested 731000ms wait, exceeds retry.maxDelayMs`), and that turn end is what neurastream waits out.
|
|
195
195
|
|
package/package.json
CHANGED
|
@@ -462,8 +462,9 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
|
|
|
462
462
|
let stopBlocked = false;
|
|
463
463
|
// Rate-limit wait-it-out (plan 20261025_0640): consecutive turn ends on a provider rate limit
|
|
464
464
|
// form one episode. The attempt doubles the wait, the owner chat is told once per episode, and
|
|
465
|
-
// ONE timer gives Main a new turn when the wait is over;
|
|
466
|
-
// over and cancels it.
|
|
465
|
+
// ONE timer gives Main a new turn when the wait is over; a new Main turn before expiry takes
|
|
466
|
+
// over and cancels it. Inputs that do not start a turn leave it armed. Any turn that ends
|
|
467
|
+
// without a limit resets the episode and disarms it.
|
|
467
468
|
let rateAttempt = 0;
|
|
468
469
|
let rateTimer: NodeJS.Timeout | null = null;
|
|
469
470
|
const rateClock = (ms: number): string => strftime(ms / 1000, "%H:%M");
|
|
@@ -619,6 +620,10 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
|
|
|
619
620
|
|
|
620
621
|
pi.on("before_agent_start", (event, ctx) => {
|
|
621
622
|
if (asCtx(ctx).kind !== "main") return;
|
|
623
|
+
if (rateTimer !== null) {
|
|
624
|
+
clearRateTimer();
|
|
625
|
+
adapterLog(cfg, "RATE-LIMIT resume cancelled: owner message");
|
|
626
|
+
}
|
|
622
627
|
const d = checkInject({ inject: asString(asRecord(event).prompt), agent: "main" }, cfg);
|
|
623
628
|
callsSinceStop = d.state?.callsSinceStop ?? callsSinceStop;
|
|
624
629
|
idleStops = d.state?.idleStops ?? idleStops;
|
|
@@ -1085,16 +1090,6 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
|
|
|
1085
1090
|
return null;
|
|
1086
1091
|
};
|
|
1087
1092
|
|
|
1088
|
-
// An owner message while a rate-limit resume is pending takes over: the resume timer is
|
|
1089
|
-
// cancelled (plan 20261025_0640). Registered before the chat-unlock input handler below, so it
|
|
1090
|
-
// sees every owner input even when the unlock short-circuits with { handled: true }.
|
|
1091
|
-
pi.on("input", (_event, ctx) => {
|
|
1092
|
-
if (!isMain(ctx)) return undefined;
|
|
1093
|
-
if (rateTimer === null) return undefined;
|
|
1094
|
-
clearRateTimer();
|
|
1095
|
-
adapterLog(cfg, "RATE-LIMIT resume cancelled: owner message");
|
|
1096
|
-
return undefined;
|
|
1097
|
-
});
|
|
1098
1093
|
// Chat unlock (guards.chat_unlock): the owner's whole message "unlock"/"unlock N"/"lock" moves
|
|
1099
1094
|
// the guard unlock file (src/core/queue/lib.ts chatUnlock). Only prompts the owner really typed
|
|
1100
1095
|
// count: the local terminal (input event, source "interactive") and collab guest prompts from
|