@chroxify/eunoe 1.3.0 → 1.3.1
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 +19 -12
- package/dist/core/index.js +285 -166
- package/dist/types/context/fold/strategies.d.ts +1 -1
- package/dist/types/context/fold/turns.d.ts +2 -0
- package/dist/types/context/recall/index.d.ts +3 -0
- package/dist/types/core/config.d.ts +1 -0
- package/dist/types/core/recall.d.ts +1 -0
- package/dist/types/core/rewrite.d.ts +3 -3
- package/dist/types/core/state.d.ts +3 -0
- package/dist/types/core/usage.d.ts +2 -1
- package/dist/types/core/window.d.ts +5 -2
- package/package.json +1 -1
- package/src/context/fold/strategies.ts +23 -15
- package/src/context/fold/turns.ts +12 -0
- package/src/context/recall/index.ts +6 -1
- package/src/core/compaction.ts +55 -30
- package/src/core/config.ts +1 -1
- package/src/core/fold.ts +19 -17
- package/src/core/forward.ts +4 -2
- package/src/core/recall.ts +27 -3
- package/src/core/rewrite.ts +19 -7
- package/src/core/state.ts +10 -0
- package/src/core/usage.ts +17 -8
- package/src/core/window.ts +40 -10
package/README.md
CHANGED
|
@@ -243,7 +243,10 @@ a small and very fast model, reorders the top 30 in about 300 ms, which
|
|
|
243
243
|
lifted the right excerpt from 88% to 95% of questions and beat every other
|
|
244
244
|
method and model that was tested. Without a key the BM25 order is used and
|
|
245
245
|
nothing else changes. The recall is computed once per message and pinned to
|
|
246
|
-
it, so it never disturbs the cache.
|
|
246
|
+
it, so it never disturbs the cache. Once that message is folded its recall is
|
|
247
|
+
dropped with it, and the recall on the messages still in context stays under
|
|
248
|
+
30K characters in total and under a quarter of the context (with a 6K floor),
|
|
249
|
+
so it never crowds out the conversation itself.
|
|
247
250
|
|
|
248
251
|
## How it plugs in
|
|
249
252
|
|
|
@@ -504,21 +507,22 @@ output stays byte-stable from one request to the next.
|
|
|
504
507
|
Every call returns a note: `action` (`pass`, `full` or `compact`),
|
|
505
508
|
`cutTurn`, `folded`, `omitted`, `pinned`, `estimate` in tokens, `fit` when
|
|
506
509
|
the request had to be trimmed to fit (`recut`, `bare` or `over`), and
|
|
507
|
-
`stuck` when even the cut leaves it over
|
|
510
|
+
`stuck` when even the cut leaves it over the limit. `stuck` gives the
|
|
508
511
|
tokens in each part (`fixed`, `head`, `folded`, `live`) so the host can
|
|
509
512
|
act: start a fresh conversation with a handoff, or fold at its own
|
|
510
|
-
boundary. While a thread is stuck,
|
|
511
|
-
instead of clearing a little more on
|
|
512
|
-
|
|
513
|
+
boundary. It clears as soon as a request fits. While a thread is stuck,
|
|
514
|
+
eunoe holds what it cleared still instead of clearing a little more on
|
|
515
|
+
every request, and clears again only when that makes the request fit or
|
|
516
|
+
brings it back under the window, so the cache keeps hitting.
|
|
513
517
|
|
|
514
518
|
### The whole proxy as one call
|
|
515
519
|
|
|
516
520
|
`createForwarder` is the proxy's request loop as a fetch handler: it
|
|
517
521
|
rewrites each `/v1/messages` request, forwards everything to the API,
|
|
518
522
|
streams the answer back, learns the thread's real token ratio from the
|
|
519
|
-
answer's `usage`, retries once
|
|
520
|
-
|
|
521
|
-
up from the Models API. `eunoe serve` is this call with a file-backed
|
|
523
|
+
answer's `usage`, retries once after a "prompt is too long" against the
|
|
524
|
+
limit the error names (and keeps that limit for the thread and model), retries a
|
|
525
|
+
stalled `count_tokens`, and looks the context window up from the Models API. `eunoe serve` is this call with a file-backed
|
|
522
526
|
store, Claude Code's session files as sources and a request log.
|
|
523
527
|
|
|
524
528
|
```ts
|
|
@@ -541,7 +545,7 @@ that calls the API itself gets the same calibration with
|
|
|
541
545
|
| `foldThread`, `pinTurns` | fold at your own boundary, keep chosen turns whole |
|
|
542
546
|
| `createForwarder` | the full proxy loop as a `(Request) => Promise<Response>` |
|
|
543
547
|
| `recordUsage`, `recordOverflow` | feed what the API said back into the thread's estimates |
|
|
544
|
-
| `createWindowLookup` | a model's context window from the Models API, cached |
|
|
548
|
+
| `createWindowLookup` | a model's context window from the Models API, cached, with a per-family fallback |
|
|
545
549
|
| `memoryStore`, `threadKeyOf` | in-memory state, and the key a thread is saved under |
|
|
546
550
|
| `listSubagentRecall` | recall over what your own subagents printed |
|
|
547
551
|
| `renderTranscriptFiles`, `transcriptGuide` | the searchable per-turn transcript from your own messages, and the text that points the agent at it |
|
|
@@ -587,9 +591,12 @@ at each step and keeps its plan pinned, and a
|
|
|
587
591
|
finds the deploy output, but ask about "that thing from before" and it
|
|
588
592
|
finds nothing, leaving the agent to search the transcript itself. Jev
|
|
589
593
|
narrows this gap without closing it.
|
|
590
|
-
- **
|
|
591
|
-
|
|
592
|
-
|
|
594
|
+
- **The window can be a guess.** The context window size comes from the
|
|
595
|
+
Models API for each model. When that lookup fails or takes over 1.5 s,
|
|
596
|
+
eunoe assumes the model family's window (1M for Claude 5 models, Opus
|
|
597
|
+
4.8 and `[1m]` ids, 200K for other Claude models) and asks again ten
|
|
598
|
+
minutes later. A guess that is too big is caught by the "prompt is too
|
|
599
|
+
long" retry, which then keeps the real limit for that thread and model.
|
|
593
600
|
|
|
594
601
|
## Credits
|
|
595
602
|
|