aegiscode 6.8.36 → 7.0.0
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 +39 -1
- package/package.json +1 -1
- package/src/app.js +74 -1
- package/src/chatflow.js +141 -1
- package/src/commands.js +172 -1
- package/src/engine.js +4 -2
- package/src/screens.js +118 -25
- package/vendor/client/aegis.js +22 -0
- package/vendor/client/byok-catalog.js +43 -8
- package/vendor/client/user-models.js +378 -0
- package/vendor/desktop/lib/local/autonomous.js +81 -0
- package/vendor/desktop/lib/local/engine.js +447 -14
- package/vendor/desktop/renderer/usage.js +68 -1
|
@@ -73,6 +73,83 @@ const MAX_ROUND_STOPS = 3;
|
|
|
73
73
|
*/
|
|
74
74
|
const WRITE_TOOLS = new Set(['writeFile', 'editFile']);
|
|
75
75
|
|
|
76
|
+
// ── Auto mode and the round horizon ─────────────────────────────────────────
|
|
77
|
+
//
|
|
78
|
+
// The two halves of "auto mode" the upstream engine (aegiscodex-dev) defines
|
|
79
|
+
// are independent, and a host that wires only one of them is *not* running auto
|
|
80
|
+
// mode — it is running "no approval cards", which is half the feature and all
|
|
81
|
+
// the friction:
|
|
82
|
+
//
|
|
83
|
+
// 1. no approval keystroke per mutating tool call;
|
|
84
|
+
// 2. a turn that hits its round horizon is EXTENDED silently a few times
|
|
85
|
+
// before a human is asked.
|
|
86
|
+
//
|
|
87
|
+
// (1) is the posture (the desktop's Tool-approvals switch, the CLI's
|
|
88
|
+
// /automode); (2) needs the arithmetic below, and the plugin's Electron host
|
|
89
|
+
// had none of it — with auto mode ON, every horizon hit still raised the
|
|
90
|
+
// blocking round card, which is precisely the question auto mode exists to stop
|
|
91
|
+
// asking ("12 rounds — keep going?" answered the same way every time).
|
|
92
|
+
//
|
|
93
|
+
// Ported verbatim from the engine's src/autonomous.js (DEFAULT_AUTO_CONTINUES,
|
|
94
|
+
// autoContinueLimit, autoRoundsDefault, autoContinuePlan) rather than vendored,
|
|
95
|
+
// because this repo hosts no build of that ESM module — but with the SAME
|
|
96
|
+
// numbers and the SAME env knobs, so a turn behaves identically in either
|
|
97
|
+
// client. cli/src/chatflow.js carries the third copy, which is what the CLI
|
|
98
|
+
// presenter uses to answer the ask.
|
|
99
|
+
|
|
100
|
+
/** Automatic continuations an attended turn may take while auto mode is on. */
|
|
101
|
+
const DEFAULT_AUTO_CONTINUES = 3;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The auto-continue allowance, honouring AEGIS_AUTO_CONTINUE_MAX.
|
|
105
|
+
*
|
|
106
|
+
* Bounded and pure, and a garbage value falls back to the default rather than
|
|
107
|
+
* to 0: an unparseable env var must not silently switch auto mode off, because
|
|
108
|
+
* the visible symptom of that ("why is it asking me again?") points nowhere
|
|
109
|
+
* near the environment.
|
|
110
|
+
*/
|
|
111
|
+
function autoContinueLimit(env = process.env) {
|
|
112
|
+
const n = Number.parseInt(env && env.AEGIS_AUTO_CONTINUE_MAX, 10);
|
|
113
|
+
return Number.isFinite(n) && n > 0 ? n : DEFAULT_AUTO_CONTINUES;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Values of AEGIS_AUTO_ROUNDS that mean "start in manual mode". Anything else —
|
|
118
|
+
* unset, empty, a typo like `flase` — leaves auto mode's default in place, so a
|
|
119
|
+
* misspelt opt-out cannot silently disable the mode the operator asked for.
|
|
120
|
+
* Same set, same reasoning, as the engine's AUTO_ROUNDS_OFF.
|
|
121
|
+
*/
|
|
122
|
+
const AUTO_ROUNDS_OFF = new Set(['0', 'false', 'off', 'no']);
|
|
123
|
+
|
|
124
|
+
/** False only when AEGIS_AUTO_ROUNDS explicitly says so. */
|
|
125
|
+
function autoRoundsDefault(env = process.env) {
|
|
126
|
+
const raw = env && env.AEGIS_AUTO_ROUNDS;
|
|
127
|
+
if (raw === undefined || raw === null) return true;
|
|
128
|
+
const val = String(raw).trim().toLowerCase();
|
|
129
|
+
if (!val) return true;
|
|
130
|
+
return !AUTO_ROUNDS_OFF.has(val);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Decide what one round-horizon ask becomes while auto mode is on.
|
|
135
|
+
*
|
|
136
|
+
* Pure, because this is budget arithmetic on a keystroke-less path: the caller
|
|
137
|
+
* only renders the answer and must not be trusted to keep the count. `used` is
|
|
138
|
+
* the running tally the caller holds and echoes back, so an ask that IS shown
|
|
139
|
+
* to the human resets it — the human was asked, so the next block of automatic
|
|
140
|
+
* continuations starts clean.
|
|
141
|
+
*
|
|
142
|
+
* { auto: true, used: n } → answer the ask "yes" without a dialog
|
|
143
|
+
* { auto: false, used: n } → show the real ask (allowance spent, or off)
|
|
144
|
+
*/
|
|
145
|
+
function autoContinuePlan({ on = false, used = 0, limit = DEFAULT_AUTO_CONTINUES } = {}) {
|
|
146
|
+
const cap = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : DEFAULT_AUTO_CONTINUES;
|
|
147
|
+
const spent = Number.isFinite(used) && used > 0 ? Math.floor(used) : 0;
|
|
148
|
+
if (!on) return { auto: false, used: spent, cap };
|
|
149
|
+
if (spent >= cap) return { auto: false, used: 0, cap };
|
|
150
|
+
return { auto: true, used: spent + 1, cap };
|
|
151
|
+
}
|
|
152
|
+
|
|
76
153
|
/** The path a file-writing tool call names, in either spelling the engine uses. */
|
|
77
154
|
function writtenPath(tool) {
|
|
78
155
|
const args = (tool && tool.args) || {};
|
|
@@ -906,6 +983,10 @@ module.exports = {
|
|
|
906
983
|
isAutonomousRequest,
|
|
907
984
|
maxRounds,
|
|
908
985
|
withRoundHorizon,
|
|
986
|
+
DEFAULT_AUTO_CONTINUES,
|
|
987
|
+
autoContinueLimit,
|
|
988
|
+
autoRoundsDefault,
|
|
989
|
+
autoContinuePlan,
|
|
909
990
|
resolveModel,
|
|
910
991
|
ignoredEnvModel,
|
|
911
992
|
resolveEffort,
|