aegiscode 6.8.4 → 6.8.6
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 +1 -6
- package/scripts/predist.mjs +7 -0
- package/src/agents.js +1 -1
- package/src/app.js +2 -2
- package/src/autonomous.js +93 -3
- package/src/caps.js +1 -1
- package/src/chatflow.js +1 -1
- package/src/checkpoint.js +1 -1
- package/src/clipboard.js +1 -1
- package/src/commands.js +5 -5
- package/src/config.js +2 -2
- package/src/devrun.js +1 -1
- package/src/diff.js +1 -1
- package/src/entitlement.js +108 -0
- package/src/events.js +2 -2
- package/src/export.js +1 -1
- package/src/fuzzy.js +1 -1
- package/src/history.js +3 -3
- package/src/init.js +1 -1
- package/src/input.js +1 -1
- package/src/keys.js +1 -1
- package/src/markdown.js +2 -2
- package/src/overlays.js +2 -2
- package/src/panels.js +6 -6
- package/src/permissions.js +2 -2
- package/src/render.js +2 -2
- package/src/screen.js +4 -4
- package/src/screens.js +1 -1
- package/src/summarize.js +1 -1
- package/src/system.js +2 -2
- package/src/theme.js +6 -6
- package/src/tokens.js +2 -2
- package/src/update.js +1 -1
- package/vendor/client/aegis.js +146 -2
- package/vendor/client/credentials.js +4 -0
- package/vendor/desktop/lib/local/agents.js +1 -1
- package/vendor/desktop/lib/local/autonomous.js +70 -3
- package/vendor/desktop/lib/local/engine.js +19 -9
- package/vendor/desktop/lib/local/entitlement.js +487 -0
- package/vendor/desktop/lib/local/git-scope.js +1 -1
- package/vendor/desktop/lib/local/prompt.js +3 -3
- package/vendor/desktop/lib/local/queue.js +2 -2
- package/vendor/desktop/lib/local/shell.js +1 -1
- package/vendor/desktop/lib/local/tools.js +2 -2
- package/vendor/desktop/lib/local/turn-guard.js +1 -1
- package/vendor/desktop/lib/local/worktree-lock.js +1 -1
- package/vendor/desktop/lib/settings.js +36 -3
- package/vendor/desktop/renderer/usage.js +6 -6
- package/vendor/mcp/tools.js +9 -1
|
@@ -68,11 +68,11 @@ function usageTokens(usage) {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Rough token count for text the wire never measured — a direct port of the
|
|
71
|
-
* CLI's own estimator (
|
|
71
|
+
* CLI's own estimator (the upstream engine's estimateTokens), and the
|
|
72
72
|
* reason its session total is MONOTONIC.
|
|
73
73
|
*
|
|
74
74
|
* This is the whole difference being fixed. The CLI's `appendHistory`
|
|
75
|
-
* (
|
|
75
|
+
* (the upstream engine's history module) writes a `tokens` object for EVERY finished
|
|
76
76
|
* exchange: `{input, output, cacheRead, cacheWrite, real: true}` when the wire
|
|
77
77
|
* reported usage, and `{input: estimateTokens(prompt), output:
|
|
78
78
|
* estimateTokens(reply), real: false}` when it did not. `real` is a FLAG, not a
|
|
@@ -477,7 +477,7 @@ function usageBuckets(usage) {
|
|
|
477
477
|
* Cache hit rate for a usage record: the share of prompt tokens the provider
|
|
478
478
|
* actually served from its cache rather than billing at miss price.
|
|
479
479
|
*
|
|
480
|
-
* Ported from
|
|
480
|
+
* Ported from the upstream engine reference. It reads through `usageBuckets`
|
|
481
481
|
* rather than off the raw object, which is the one deliberate difference: the
|
|
482
482
|
* engine's copy is handed an already-normalised record, while this module is
|
|
483
483
|
* also handed WIRE usage (a provider's raw response body) and ledger rows. A
|
|
@@ -588,7 +588,7 @@ function turnAccounting(usage, model, opts = {}) {
|
|
|
588
588
|
const tokens = usageTokens(usage);
|
|
589
589
|
const u = usage && typeof usage === 'object' ? usage : {};
|
|
590
590
|
// The settled charge can arrive either on the response or folded into the
|
|
591
|
-
// usage object —
|
|
591
|
+
// usage object — the upstream engine does the latter
|
|
592
592
|
// (`{ ...result.usage, costUsd: result.costUsd }`), so both are accepted.
|
|
593
593
|
const settled = typeof opts.costUsd === 'number'
|
|
594
594
|
? opts.costUsd
|
|
@@ -703,7 +703,7 @@ function rollTurn(roll, usage, opts = {}) {
|
|
|
703
703
|
if (turn.tokens == null) {
|
|
704
704
|
// No reported usage. The CLI does not let such a turn vanish from the
|
|
705
705
|
// total: `appendHistory` estimates it from the text and marks it
|
|
706
|
-
// `real: false` (
|
|
706
|
+
// `real: false` (the upstream engine's history module), and
|
|
707
707
|
// `aggregateSessionUsage` then adds it like any other row. Folding the same
|
|
708
708
|
// estimate here is what makes the live roll and the rebuilt roll the same
|
|
709
709
|
// number, and what stops the total standing still on exactly the turns the
|
|
@@ -772,7 +772,7 @@ function rollMessages(messages) {
|
|
|
772
772
|
* The ledger row one finished dispatch must carry into the shared session
|
|
773
773
|
* store, so the rolling total can be REBUILT when the thread is reopened —
|
|
774
774
|
* the desktop's counterpart of the CLI's `appendHistory`
|
|
775
|
-
* (
|
|
775
|
+
* (the upstream engine's history module).
|
|
776
776
|
*
|
|
777
777
|
* One authority for the row, on purpose. The CLI writes a `tokens` object for
|
|
778
778
|
* EVERY exchange and skips none:
|
package/vendor/mcp/tools.js
CHANGED
|
@@ -37,6 +37,14 @@ function createTools(client) {
|
|
|
37
37
|
// other module state.
|
|
38
38
|
const aegis = client;
|
|
39
39
|
|
|
40
|
+
// Attribution for money prompts. A stub client (tests pass one) may not carry
|
|
41
|
+
// `promptUrl`, and a throw here would kill the tool body mid-message — so the
|
|
42
|
+
// guard degrades to an untagged link rather than to no link at all.
|
|
43
|
+
const promptUrl = (page, campaign) =>
|
|
44
|
+
typeof aegis.promptUrl === 'function'
|
|
45
|
+
? aegis.promptUrl(page, campaign)
|
|
46
|
+
: `https://aegiscloud.org/go/${page}`;
|
|
47
|
+
|
|
40
48
|
const TOOLS = {
|
|
41
49
|
aegis_status: {
|
|
42
50
|
description:
|
|
@@ -161,7 +169,7 @@ function createTools(client) {
|
|
|
161
169
|
if ((data.balance_eur || 0) <= 0) {
|
|
162
170
|
lines.push(
|
|
163
171
|
'',
|
|
164
|
-
|
|
172
|
+
`Balance is empty — top up at ${promptUrl('topup', 'topup_bank')}, or set your own ` +
|
|
165
173
|
'provider key with aegis_byok_set to use aegis_ask for free at cost.'
|
|
166
174
|
);
|
|
167
175
|
}
|