aegisone 1.0.16 → 1.0.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 +2 -2
- package/package.json +3 -3
- package/vendor/cli/README.md +3 -3
- package/vendor/cli/package.json +2 -2
- package/vendor/cli/src/app.js +67 -9
- package/vendor/cli/src/autonomous.js +11 -2
- package/vendor/cli/src/chatflow.js +75 -6
- package/vendor/cli/src/commands.js +220 -66
- package/vendor/cli/src/engine.js +27 -1
- package/vendor/cli/src/limits.js +1 -1
- package/vendor/cli/src/overlays.js +44 -0
- package/vendor/cli/src/provenance.lock.json +2 -2
- package/vendor/cli/src/render.js +9 -1
- package/vendor/cli/vendor/client/aegis.js +6 -0
- package/vendor/cli/vendor/client/user-models.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +48 -8
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +119 -2
- package/vendor/cli/vendor/desktop/lib/local/engine.js +116 -5
- package/vendor/cli/vendor/desktop/renderer/usage.js +25 -6
- package/vendor/desktop/README.md +1 -1
- package/vendor/desktop/lib/local/autonomous.js +48 -8
- package/vendor/desktop/lib/local/claude-pro.js +119 -2
- package/vendor/desktop/lib/local/engine.js +116 -5
- package/vendor/desktop/lib/provider-key-mirror.js +114 -1
- package/vendor/desktop/main.js +58 -1
- package/vendor/desktop/package.json +7 -4
- package/vendor/desktop/renderer/app.js +64 -5
- package/vendor/desktop/renderer/index.html +1 -7
- package/vendor/desktop/renderer/usage.js +25 -6
- package/vendor/desktop/vendor/aegis.js +6 -0
- package/vendor/desktop/vendor/user-models.js +1 -1
|
@@ -572,6 +572,11 @@ function renderRollMeter(sessionId, live) {
|
|
|
572
572
|
// model the meter sat on one number for the whole (longest, priciest)
|
|
573
573
|
// phase of the turn and looked dead while the AI was demonstrably working.
|
|
574
574
|
reasoning: live.reasoning,
|
|
575
|
+
// …and the provider-measured thinking tokens, which on a subscription
|
|
576
|
+
// turn are the whole of the deliberation (its text is withheld). The
|
|
577
|
+
// preview must carry the same quantity the bubble's own figure shows, or
|
|
578
|
+
// the two live meters disagree — which this file forbids.
|
|
579
|
+
measuredReasoningTokens: live.measuredReasoningTokens,
|
|
575
580
|
});
|
|
576
581
|
}
|
|
577
582
|
const line = roll ? fmtRoll(roll) : '';
|
|
@@ -611,6 +616,15 @@ function renderRollMeter(sessionId, live) {
|
|
|
611
616
|
function liveTokenFig(live) {
|
|
612
617
|
const reply = typeof live.reply === 'string' ? live.reply : '';
|
|
613
618
|
const reasoning = typeof live.reasoning === 'string' ? live.reasoning : '';
|
|
619
|
+
// Thinking tokens the PROVIDER measured — the only live signal on a
|
|
620
|
+
// subscription turn, which withholds the deliberation text entirely (every
|
|
621
|
+
// real `thinking_delta` carries `thinking: ""` while `estimated_tokens`
|
|
622
|
+
// advances). Part of the billed output, so it belongs in this figure exactly
|
|
623
|
+
// as the `reasoning` text does, and it is already a token count.
|
|
624
|
+
const measured =
|
|
625
|
+
typeof live.measuredReasoningTokens === 'number' && live.measuredReasoningTokens > 0
|
|
626
|
+
? live.measuredReasoningTokens
|
|
627
|
+
: 0;
|
|
614
628
|
// A turn in flight that has produced nothing YET. Its figure is zero, and
|
|
615
629
|
// zero is what the other measured surface shows at this moment: the CLI's
|
|
616
630
|
// spinner tail counts the answer's deltas and the thinking trace's, so it too
|
|
@@ -632,7 +646,12 @@ function liveTokenFig(live) {
|
|
|
632
646
|
// a threshold. Safe because the caller only passes `live` for a turn still
|
|
633
647
|
// running: this is a statement about that turn, not a fabricated measurement
|
|
634
648
|
// of a finished one.
|
|
635
|
-
|
|
649
|
+
// The measured thinking count alone is enough to have a figure. Without this
|
|
650
|
+
// term a subscription turn — empty `reply`, empty `reasoning` text, but
|
|
651
|
+
// thousands of billed thinking tokens — took the `↓0 tokens` branch below for
|
|
652
|
+
// its whole thinking phase, which is the bug this function's `measured`
|
|
653
|
+
// addend exists to close.
|
|
654
|
+
if (!reply && !reasoning && !measured) return '↓0 tokens';
|
|
636
655
|
let output = 0;
|
|
637
656
|
try {
|
|
638
657
|
const est = estimatedBuckets(live.prompt, reply, reasoning);
|
|
@@ -660,8 +679,19 @@ function liveTokenFig(live) {
|
|
|
660
679
|
}
|
|
661
680
|
output = Math.ceil(cells / 4);
|
|
662
681
|
}
|
|
682
|
+
// Summed, not substituted: `measured` is the provider's count of deliberation
|
|
683
|
+
// that never entered `reply`/`reasoning` as text, so the two are disjoint and
|
|
684
|
+
// both are billed output. Adding it here is also what keeps the figure moving
|
|
685
|
+
// through the thinking phase and then continuing to climb as the answer
|
|
686
|
+
// streams, rather than dropping back to the answer-only estimate.
|
|
687
|
+
output += measured;
|
|
663
688
|
if (!output) return '';
|
|
664
|
-
|
|
689
|
+
// `measured` is Anthropic's own `estimated_tokens` running count, which the
|
|
690
|
+
// stream parser's own measurements show landing under the real billed
|
|
691
|
+
// thinking-token figure (1900 vs 1943, 1800 vs 1832, 250 vs 339) — so once
|
|
692
|
+
// it has contributed, the figure is a floor, not the true count, until the
|
|
693
|
+
// turn's real `usage` lands.
|
|
694
|
+
return `↓${measured > 0 ? '≥' : ''}${Math.round(output)} tokens`;
|
|
665
695
|
}
|
|
666
696
|
|
|
667
697
|
/**
|
|
@@ -4984,6 +5014,10 @@ async function send() {
|
|
|
4984
5014
|
|
|
4985
5015
|
let streamedText = '';
|
|
4986
5016
|
let reasoningText = '';
|
|
5017
|
+
// Thinking tokens the provider MEASURED (subscription turns report progress
|
|
5018
|
+
// in these while withholding the text). Added verbatim to the live figure,
|
|
5019
|
+
// never divided by 4 the way the text channels are.
|
|
5020
|
+
let measuredReasoningTokens = 0;
|
|
4987
5021
|
const toolLog = [];
|
|
4988
5022
|
// How much of the stream the live meter last measured. Per-turn by
|
|
4989
5023
|
// construction (declared here, not at module scope), so a new turn starts its
|
|
@@ -5019,14 +5053,39 @@ async function send() {
|
|
|
5019
5053
|
// stream and this runs inside the painter: ungated it is linear per frame,
|
|
5020
5054
|
// i.e. quadratic over the turn, on the thread the reader is scrolling.
|
|
5021
5055
|
const streamChars = streamedText.length + reasoningText.length;
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5056
|
+
// The provider's thinking tokens are progress too, and on a subscription
|
|
5057
|
+
// turn they are the ONLY progress: no text arrives at all during the
|
|
5058
|
+
// thinking phase, so a char-only gate saw `grown <= 0` and refused to
|
|
5059
|
+
// repaint, leaving the bubble frozen on `↓0 tokens` however many tokens were
|
|
5060
|
+
// billed. Counted at the same 4 chars:1 token ratio the other live surfaces
|
|
5061
|
+
// use, purely so this gate sees growth; the figure itself is rendered from
|
|
5062
|
+
// the token count, never this char-equivalent.
|
|
5063
|
+
const progress = streamChars + measuredReasoningTokens * 4;
|
|
5064
|
+
if (liveMeterDue(meterChars, progress)) {
|
|
5065
|
+
meterChars = progress;
|
|
5066
|
+
renderRollMeter(sessionId, {
|
|
5067
|
+
prompt,
|
|
5068
|
+
reply: streamedText,
|
|
5069
|
+
reasoning: reasoningText,
|
|
5070
|
+
measuredReasoningTokens,
|
|
5071
|
+
});
|
|
5025
5072
|
}
|
|
5026
5073
|
stickToBottom();
|
|
5027
5074
|
});
|
|
5028
5075
|
|
|
5029
5076
|
const onDelta = (chunk) => {
|
|
5077
|
+
// Provider-MEASURED thinking progress, in tokens. On a subscription turn
|
|
5078
|
+
// the deliberation text is withheld (`thinking_delta.thinking` is the empty
|
|
5079
|
+
// string), so the `reasoning` text branch below never fires and the live
|
|
5080
|
+
// meter sat on `↓0 tokens` through the whole thinking phase — the longest,
|
|
5081
|
+
// priciest part of the turn — while thousands of thinking tokens were
|
|
5082
|
+
// billed. Already a token count, so it is added rather than divided by 4
|
|
5083
|
+
// like the text channels.
|
|
5084
|
+
if (chunk && typeof chunk.thinkingTokens === 'number' && chunk.thinkingTokens > 0) {
|
|
5085
|
+
measuredReasoningTokens += chunk.thinkingTokens;
|
|
5086
|
+
paintStream();
|
|
5087
|
+
return;
|
|
5088
|
+
}
|
|
5030
5089
|
// Extended-reasoning trace from a pooled brain turn: the fan-out's worker
|
|
5031
5090
|
// findings, streamed before the synthesis pass writes the answer. Shown so
|
|
5032
5091
|
// "work autonomously" doesn't look idle for the whole worker phase.
|
|
@@ -565,13 +565,7 @@
|
|
|
565
565
|
<button type="button" class="wc-link" id="welcome-byok">
|
|
566
566
|
Bring your own key →
|
|
567
567
|
</button>
|
|
568
|
-
<span class="wc-note" id="welcome-byok-note">
|
|
569
|
-
The free path, and it stays free: exec, write and edit run on
|
|
570
|
-
your machine, your repos, sessions and keys live on this disk,
|
|
571
|
-
and a local model server needs no account at all. A provider
|
|
572
|
-
key relayed through AEGIS is still a cloud turn, so it bills a
|
|
573
|
-
small handling fee — nothing that runs on this machine does.
|
|
574
|
-
</span>
|
|
568
|
+
<span class="wc-note" id="welcome-byok-note"></span>
|
|
575
569
|
<button type="button" class="wc-skip" id="welcome-dismiss">
|
|
576
570
|
Don't show this again
|
|
577
571
|
</button>
|
|
@@ -828,16 +828,35 @@ function rollTurn(roll, usage, opts = {}) {
|
|
|
828
828
|
// number, and what stops the total standing still on exactly the turns the
|
|
829
829
|
// pool declined to report on — the symptom this fallback exists to remove.
|
|
830
830
|
const est = estimatedBuckets(opts.prompt, opts.reply, opts.reasoning);
|
|
831
|
+
// Thinking tokens the provider MEASURED, not estimated. On a subscription
|
|
832
|
+
// turn the deliberation text is withheld entirely (every real
|
|
833
|
+
// `thinking_delta` carries `thinking: ""`), so `estimatedBuckets` above
|
|
834
|
+
// cannot see the longest, priciest part of the turn and the live preview
|
|
835
|
+
// read 0 for the whole thinking phase. Added verbatim — it is already a
|
|
836
|
+
// token count, and it is billed output exactly as the reply is.
|
|
837
|
+
const measured =
|
|
838
|
+
typeof opts.measuredReasoningTokens === 'number' && opts.measuredReasoningTokens > 0
|
|
839
|
+
? opts.measuredReasoningTokens
|
|
840
|
+
: 0;
|
|
831
841
|
if (!est) {
|
|
832
|
-
//
|
|
833
|
-
//
|
|
834
|
-
//
|
|
835
|
-
|
|
842
|
+
// A subscription turn with nothing written yet but thinking under way is
|
|
843
|
+
// NOT the `unknown` case: the provider measured it, so a zero would be a
|
|
844
|
+
// fabricated reading rather than an absent one.
|
|
845
|
+
if (!measured) {
|
|
846
|
+
// Nothing reported AND no text to estimate from. The single case that
|
|
847
|
+
// stays uncounted: `unknown` names the gap, where a fabricated zero
|
|
848
|
+
// would read as a measurement.
|
|
849
|
+
next.unknown += 1;
|
|
850
|
+
return next;
|
|
851
|
+
}
|
|
852
|
+
next.tokens += measured;
|
|
853
|
+
next.output += measured;
|
|
854
|
+
next.estimated += 1;
|
|
836
855
|
return next;
|
|
837
856
|
}
|
|
838
|
-
next.tokens += est.input + est.output;
|
|
857
|
+
next.tokens += est.input + est.output + measured;
|
|
839
858
|
next.input += est.input;
|
|
840
|
-
next.output += est.output;
|
|
859
|
+
next.output += est.output + measured;
|
|
841
860
|
next.estimated += 1;
|
|
842
861
|
return next;
|
|
843
862
|
}
|
|
@@ -1133,6 +1133,7 @@ function createClient(opts = {}) {
|
|
|
1133
1133
|
onStream,
|
|
1134
1134
|
signal,
|
|
1135
1135
|
providerKey,
|
|
1136
|
+
baseURL,
|
|
1136
1137
|
} = {}) {
|
|
1137
1138
|
const key = providerKey !== undefined ? providerKey : opts.providerKey;
|
|
1138
1139
|
// Same rule as the pooled path above: omit `max_tokens` entirely when the
|
|
@@ -1169,6 +1170,11 @@ function createClient(opts = {}) {
|
|
|
1169
1170
|
// `tools: []` differently from the field's plain absence.
|
|
1170
1171
|
...(Array.isArray(tools) && tools.length ? { tools } : {}),
|
|
1171
1172
|
...(toolChoice ? { tool_choice: toolChoice } : {}),
|
|
1173
|
+
// Read server-side ONLY for provider "custom" (aegis1 app.py
|
|
1174
|
+
// byok_chat_completions) — every other provider's upstream host is a
|
|
1175
|
+
// constant the server already knows, so sending this for them is a
|
|
1176
|
+
// no-op rather than a behaviour change.
|
|
1177
|
+
...(baseURL ? { base_url: baseURL } : {}),
|
|
1172
1178
|
};
|
|
1173
1179
|
if (model) body.model = model;
|
|
1174
1180
|
const headers = {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
* ── what a user does now ───────────────────────────────────────────────────
|
|
29
29
|
*
|
|
30
|
-
* CLI `/model-add <provider> <model-id>` (and `/model-rm …`)
|
|
30
|
+
* CLI `/model-add <provider> [api-key] <model-id>` (and `/model-rm …`)
|
|
31
31
|
* Desktop Settings → "Add a model" → provider + id
|
|
32
32
|
* Either hand-edit `$AEGISCODE_HOME/models.json` (default `~/.aegiscode`)
|
|
33
33
|
*
|