aegisone 1.0.6 → 1.0.9
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/bin/aegis.js +5 -0
- package/install.ps1 +5 -0
- package/install.sh +5 -0
- package/package.json +1 -1
- package/scripts/bump.mjs +5 -0
- package/scripts/bundle.js +5 -0
- package/scripts/predist.mjs +9 -0
- package/src/child.js +5 -0
- package/src/dispatch.js +5 -0
- package/src/doctor.js +5 -0
- package/src/host.js +5 -0
- package/src/permissions.js +5 -0
- package/src/probes.js +5 -0
- package/src/release.js +19 -5
- package/vendor/cli/README.md +39 -1
- package/vendor/cli/bin/aegiscode.js +137 -0
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/scripts/check.mjs +5 -0
- package/vendor/cli/scripts/demo.mjs +5 -0
- package/vendor/cli/scripts/predist.mjs +29 -2
- package/vendor/cli/scripts/runtests.mjs +5 -0
- package/vendor/cli/scripts/seal-gate.mjs +76 -0
- package/vendor/cli/src/agents.js +5 -0
- package/vendor/cli/src/app.js +79 -1
- package/vendor/cli/src/art.js +5 -0
- package/vendor/cli/src/autonomous.js +23 -0
- package/vendor/cli/src/caps.js +5 -0
- package/vendor/cli/src/chatflow.js +245 -32
- package/vendor/cli/src/checkpoint.js +5 -0
- package/vendor/cli/src/clipboard.js +5 -0
- package/vendor/cli/src/cloudsync.js +5 -0
- package/vendor/cli/src/commands.js +487 -4
- package/vendor/cli/src/config.js +5 -0
- package/vendor/cli/src/credentials.js +5 -0
- package/vendor/cli/src/deps.js +5 -0
- package/vendor/cli/src/devrun.js +5 -0
- package/vendor/cli/src/diff.js +5 -0
- package/vendor/cli/src/diffview.js +5 -0
- package/vendor/cli/src/engine.js +9 -2
- package/vendor/cli/src/entitlement.js +5 -0
- package/vendor/cli/src/events.js +15 -0
- package/vendor/cli/src/export.js +5 -0
- package/vendor/cli/src/fingerprint.js +5 -0
- package/vendor/cli/src/format.js +5 -0
- package/vendor/cli/src/fuzzy.js +5 -0
- package/vendor/cli/src/gate.js +12 -0
- package/vendor/cli/src/history.js +5 -0
- package/vendor/cli/src/init.js +5 -0
- package/vendor/cli/src/input.js +5 -0
- package/vendor/cli/src/keys.js +29 -2
- package/vendor/cli/src/limits.js +192 -0
- package/vendor/cli/src/markdown.js +5 -0
- package/vendor/cli/src/mcp.js +13 -0
- package/vendor/cli/src/models.js +5 -0
- package/vendor/cli/src/naming.js +5 -0
- package/vendor/cli/src/overlays.js +7 -2
- package/vendor/cli/src/panels.js +5 -0
- package/vendor/cli/src/permissions.js +56 -1
- package/vendor/cli/src/ping.js +5 -0
- package/vendor/cli/src/presence.js +5 -0
- package/vendor/cli/src/provenance.js +238 -0
- package/vendor/cli/src/provenance.lock.json +36 -0
- package/vendor/cli/src/render.js +5 -0
- package/vendor/cli/src/screen.js +5 -0
- package/vendor/cli/src/screens.js +166 -62
- package/vendor/cli/src/secret.js +5 -0
- package/vendor/cli/src/securefs.js +5 -0
- package/vendor/cli/src/settings.js +5 -0
- package/vendor/cli/src/shared.js +5 -0
- package/vendor/cli/src/sharedpaths.js +5 -0
- package/vendor/cli/src/signup.js +5 -0
- package/vendor/cli/src/summarize.js +5 -0
- package/vendor/cli/src/sysdiag.js +582 -0
- package/vendor/cli/src/system.js +5 -0
- package/vendor/cli/src/theme.js +5 -0
- package/vendor/cli/src/title.js +5 -0
- package/vendor/cli/src/todos.js +5 -0
- package/vendor/cli/src/tokens.js +5 -0
- package/vendor/cli/src/topup.js +5 -0
- package/vendor/cli/src/update.js +5 -0
- package/vendor/cli/vendor/client/aegis.js +27 -0
- package/vendor/cli/vendor/client/attest.js +5 -0
- package/vendor/cli/vendor/client/authorship-key.js +5 -0
- package/vendor/cli/vendor/client/auto-provision.js +5 -0
- package/vendor/cli/vendor/client/brain-catalog.js +5 -0
- package/vendor/cli/vendor/client/byok-catalog.js +48 -8
- package/vendor/cli/vendor/client/credentials.js +5 -0
- package/vendor/cli/vendor/client/device-fingerprint.js +5 -0
- package/vendor/cli/vendor/client/env-file.js +5 -0
- package/vendor/cli/vendor/client/fingerprint.js +5 -0
- package/vendor/cli/vendor/client/foreign-memory.js +5 -0
- package/vendor/cli/vendor/client/hooks.js +5 -0
- package/vendor/cli/vendor/client/model-discovery.js +332 -0
- package/vendor/cli/vendor/client/platform.js +5 -0
- package/vendor/cli/vendor/client/prefs.js +5 -0
- package/vendor/cli/vendor/client/presence-constants.js +5 -0
- package/vendor/cli/vendor/client/presence.js +5 -0
- package/vendor/cli/vendor/client/record-vault.js +5 -0
- package/vendor/cli/vendor/client/session-store.js +5 -0
- package/vendor/cli/vendor/client/topup.js +5 -0
- package/vendor/cli/vendor/client/touch.js +5 -0
- package/vendor/cli/vendor/client/update.js +5 -0
- package/vendor/cli/vendor/client/user-models.js +383 -0
- package/vendor/cli/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/cli/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +86 -0
- package/vendor/cli/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +576 -14
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/cli/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/cli/vendor/desktop/lib/settings.js +5 -0
- package/vendor/cli/vendor/desktop/renderer/usage.js +73 -1
- package/vendor/cli/vendor/mcp/server.js +5 -0
- package/vendor/cli/vendor/mcp/tools.js +5 -0
- package/vendor/cli/vendor/tools/agent-gate.mjs +23 -0
- package/vendor/desktop/README.md +11 -0
- package/vendor/desktop/bin/aegis.js +5 -0
- package/vendor/desktop/lib/auto.js +5 -0
- package/vendor/desktop/lib/avatar/companion.js +5 -0
- package/vendor/desktop/lib/avatar/cosmetics.js +5 -0
- package/vendor/desktop/lib/avatar/events.js +5 -0
- package/vendor/desktop/lib/avatar/holder-turn.js +5 -0
- package/vendor/desktop/lib/avatar/holders.js +5 -0
- package/vendor/desktop/lib/avatar/identity.js +5 -0
- package/vendor/desktop/lib/avatar/level.js +5 -0
- package/vendor/desktop/lib/avatar/mirror.js +5 -0
- package/vendor/desktop/lib/avatar/persona.js +5 -0
- package/vendor/desktop/lib/avatar/profile.js +5 -0
- package/vendor/desktop/lib/avatar/register.js +5 -0
- package/vendor/desktop/lib/avatar/store.js +5 -0
- package/vendor/desktop/lib/avatar/tiers.js +5 -0
- package/vendor/desktop/lib/avatar/transfer.js +5 -0
- package/vendor/desktop/lib/avatar/turn.js +5 -0
- package/vendor/desktop/lib/avatar/voice.js +5 -0
- package/vendor/desktop/lib/avatar/xp.js +5 -0
- package/vendor/desktop/lib/deep-link.js +40 -1
- package/vendor/desktop/lib/fingerprint.js +5 -0
- package/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/desktop/lib/local/autonomous.js +86 -0
- package/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/desktop/lib/local/engine.js +576 -14
- package/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/desktop/lib/local/telemetry.js +5 -0
- package/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/desktop/lib/provider-key-mirror.js +5 -0
- package/vendor/desktop/lib/quick-launcher.js +5 -0
- package/vendor/desktop/lib/settings.js +5 -0
- package/vendor/desktop/lib/sync/memory-queue.js +5 -0
- package/vendor/desktop/lib/sync/persist-gate.js +5 -0
- package/vendor/desktop/lib/sync/sessions.js +5 -0
- package/vendor/desktop/lib/window-state.js +5 -0
- package/vendor/desktop/main.js +293 -6
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +32 -0
- package/vendor/desktop/renderer/app.js +506 -12
- package/vendor/desktop/renderer/avatar/assemble.js +5 -0
- package/vendor/desktop/renderer/avatar/avatar.css +7 -0
- package/vendor/desktop/renderer/avatar/avatar.js +5 -0
- package/vendor/desktop/renderer/avatar/cards.js +5 -0
- package/vendor/desktop/renderer/avatar/hud.js +5 -0
- package/vendor/desktop/renderer/avatar/machine.js +5 -0
- package/vendor/desktop/renderer/avatar/pane.js +5 -0
- package/vendor/desktop/renderer/avatar/parts.js +5 -0
- package/vendor/desktop/renderer/budget.js +5 -0
- package/vendor/desktop/renderer/diff.js +5 -0
- package/vendor/desktop/renderer/diffview.js +5 -0
- package/vendor/desktop/renderer/fingerprint.css +7 -0
- package/vendor/desktop/renderer/fingerprint.js +5 -0
- package/vendor/desktop/renderer/fonts/fonts.css +7 -0
- package/vendor/desktop/renderer/index.html +9 -2
- package/vendor/desktop/renderer/markdown.js +5 -0
- package/vendor/desktop/renderer/quick.css +7 -0
- package/vendor/desktop/renderer/quick.html +7 -0
- package/vendor/desktop/renderer/quick.js +5 -0
- package/vendor/desktop/renderer/stream-policy.js +5 -0
- package/vendor/desktop/renderer/style.css +39 -0
- package/vendor/desktop/renderer/transcript-view.js +5 -0
- package/vendor/desktop/renderer/usage.js +73 -1
- package/vendor/desktop/vendor/aegis.js +27 -0
- package/vendor/desktop/vendor/agent-gate.mjs +23 -0
- package/vendor/desktop/vendor/attest.js +5 -0
- package/vendor/desktop/vendor/authorship-key.js +5 -0
- package/vendor/desktop/vendor/auto-provision.js +5 -0
- package/vendor/desktop/vendor/brain-catalog.js +5 -0
- package/vendor/desktop/vendor/byok-catalog.js +48 -8
- package/vendor/desktop/vendor/credentials.js +5 -0
- package/vendor/desktop/vendor/device-fingerprint.js +5 -0
- package/vendor/desktop/vendor/env-file.js +5 -0
- package/vendor/desktop/vendor/fingerprint.js +5 -0
- package/vendor/desktop/vendor/foreign-memory.js +5 -0
- package/vendor/desktop/vendor/hooks.js +5 -0
- package/vendor/desktop/vendor/model-discovery.js +332 -0
- package/vendor/desktop/vendor/platform.js +5 -0
- package/vendor/desktop/vendor/prefs.js +5 -0
- package/vendor/desktop/vendor/presence-constants.js +5 -0
- package/vendor/desktop/vendor/presence.js +5 -0
- package/vendor/desktop/vendor/record-vault.js +5 -0
- package/vendor/desktop/vendor/session-store.js +5 -0
- package/vendor/desktop/vendor/topup.js +5 -0
- package/vendor/desktop/vendor/touch.js +5 -0
- package/vendor/desktop/vendor/update.js +5 -0
- package/vendor/desktop/vendor/user-models.js +383 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -14,6 +19,36 @@
|
|
|
14
19
|
const PROTOCOL = 'aegis';
|
|
15
20
|
const SCHEME_PREFIX = `${PROTOCOL}://`;
|
|
16
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Ceilings on the two values a *remote* caller controls.
|
|
24
|
+
*
|
|
25
|
+
* Any web page or any other app on the machine can hand the OS an `aegis://`
|
|
26
|
+
* URL, so both fields are attacker-chosen input on a channel nobody authenticates
|
|
27
|
+
* (there is no "is this link from the user?" check, and there cannot be one for
|
|
28
|
+
* a custom scheme). Bounding them keeps a hostile link from parking megabytes of
|
|
29
|
+
* text in the composer, from filling the window with a wall of pre-filled prompt,
|
|
30
|
+
* or from using the deep link as a bulk data channel into a session that can run
|
|
31
|
+
* tools. The renderer pre-fills rather than auto-sends (renderer/app.js
|
|
32
|
+
* handleDeepLink), so the cost is bounded, but a pre-filled prompt is still the
|
|
33
|
+
* most direct route from "a page I visited" to "text the user is invited to send
|
|
34
|
+
* to a model with tools on".
|
|
35
|
+
*
|
|
36
|
+
* These are generous on purpose: a real hand-written link is a sentence or two.
|
|
37
|
+
*/
|
|
38
|
+
const MAX_PROMPT_LENGTH = 2000;
|
|
39
|
+
/** Session ids are uuids (36 chars); the slack is for a future format, not a payload. */
|
|
40
|
+
const MAX_SESSION_ID_LENGTH = 128;
|
|
41
|
+
/**
|
|
42
|
+
* …and the charset is pinned too, because this id does not stay a string: the
|
|
43
|
+
* renderer's `open` handler hands it to openSession(), which loads the session
|
|
44
|
+
* by name. A hostile link could otherwise offer `../../…` or an absolute path
|
|
45
|
+
* and have the *renderer* ask main to open whatever that resolves to. Ids this
|
|
46
|
+
* app mints are `[0-9a-f-]`; anything outside a conservative id alphabet is not
|
|
47
|
+
* one of ours, so it is rejected rather than escaped or repaired.
|
|
48
|
+
*/
|
|
49
|
+
const SESSION_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
50
|
+
|
|
51
|
+
|
|
17
52
|
/** True for any string that looks like our protocol, cheap enough to filter
|
|
18
53
|
* argv with before the full URL parse (which throws on most argv entries —
|
|
19
54
|
* flags, file paths — so callers should not run it against every arg). */
|
|
@@ -44,11 +79,15 @@ function parseDeepLinkUrl(url) {
|
|
|
44
79
|
if (action === 'open') {
|
|
45
80
|
const sessionId = parsed.searchParams.get('session');
|
|
46
81
|
if (!sessionId) return null;
|
|
82
|
+
if (sessionId.length > MAX_SESSION_ID_LENGTH) return null;
|
|
83
|
+
if (!SESSION_ID_PATTERN.test(sessionId)) return null;
|
|
47
84
|
return { action: 'open', sessionId };
|
|
48
85
|
}
|
|
49
86
|
|
|
50
87
|
if (action === 'new') {
|
|
51
|
-
|
|
88
|
+
const prompt = parsed.searchParams.get('prompt') || '';
|
|
89
|
+
if (prompt.length > MAX_PROMPT_LENGTH) return null;
|
|
90
|
+
return { action: 'new', prompt };
|
|
52
91
|
}
|
|
53
92
|
|
|
54
93
|
return null;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
2
7
|
/**
|
|
3
8
|
* aegis-seal.mjs — codec for ÆL/1 (AEGIS Encoded Language)
|
|
4
9
|
*
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -73,6 +78,83 @@ const MAX_ROUND_STOPS = 3;
|
|
|
73
78
|
*/
|
|
74
79
|
const WRITE_TOOLS = new Set(['writeFile', 'editFile']);
|
|
75
80
|
|
|
81
|
+
// ── Auto mode and the round horizon ─────────────────────────────────────────
|
|
82
|
+
//
|
|
83
|
+
// The two halves of "auto mode" the upstream engine (aegiscodex-dev) defines
|
|
84
|
+
// are independent, and a host that wires only one of them is *not* running auto
|
|
85
|
+
// mode — it is running "no approval cards", which is half the feature and all
|
|
86
|
+
// the friction:
|
|
87
|
+
//
|
|
88
|
+
// 1. no approval keystroke per mutating tool call;
|
|
89
|
+
// 2. a turn that hits its round horizon is EXTENDED silently a few times
|
|
90
|
+
// before a human is asked.
|
|
91
|
+
//
|
|
92
|
+
// (1) is the posture (the desktop's Tool-approvals switch, the CLI's
|
|
93
|
+
// /automode); (2) needs the arithmetic below, and the plugin's Electron host
|
|
94
|
+
// had none of it — with auto mode ON, every horizon hit still raised the
|
|
95
|
+
// blocking round card, which is precisely the question auto mode exists to stop
|
|
96
|
+
// asking ("12 rounds — keep going?" answered the same way every time).
|
|
97
|
+
//
|
|
98
|
+
// Ported verbatim from the engine's src/autonomous.js (DEFAULT_AUTO_CONTINUES,
|
|
99
|
+
// autoContinueLimit, autoRoundsDefault, autoContinuePlan) rather than vendored,
|
|
100
|
+
// because this repo hosts no build of that ESM module — but with the SAME
|
|
101
|
+
// numbers and the SAME env knobs, so a turn behaves identically in either
|
|
102
|
+
// client. cli/src/chatflow.js carries the third copy, which is what the CLI
|
|
103
|
+
// presenter uses to answer the ask.
|
|
104
|
+
|
|
105
|
+
/** Automatic continuations an attended turn may take while auto mode is on. */
|
|
106
|
+
const DEFAULT_AUTO_CONTINUES = 3;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The auto-continue allowance, honouring AEGIS_AUTO_CONTINUE_MAX.
|
|
110
|
+
*
|
|
111
|
+
* Bounded and pure, and a garbage value falls back to the default rather than
|
|
112
|
+
* to 0: an unparseable env var must not silently switch auto mode off, because
|
|
113
|
+
* the visible symptom of that ("why is it asking me again?") points nowhere
|
|
114
|
+
* near the environment.
|
|
115
|
+
*/
|
|
116
|
+
function autoContinueLimit(env = process.env) {
|
|
117
|
+
const n = Number.parseInt(env && env.AEGIS_AUTO_CONTINUE_MAX, 10);
|
|
118
|
+
return Number.isFinite(n) && n > 0 ? n : DEFAULT_AUTO_CONTINUES;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Values of AEGIS_AUTO_ROUNDS that mean "start in manual mode". Anything else —
|
|
123
|
+
* unset, empty, a typo like `flase` — leaves auto mode's default in place, so a
|
|
124
|
+
* misspelt opt-out cannot silently disable the mode the operator asked for.
|
|
125
|
+
* Same set, same reasoning, as the engine's AUTO_ROUNDS_OFF.
|
|
126
|
+
*/
|
|
127
|
+
const AUTO_ROUNDS_OFF = new Set(['0', 'false', 'off', 'no']);
|
|
128
|
+
|
|
129
|
+
/** False only when AEGIS_AUTO_ROUNDS explicitly says so. */
|
|
130
|
+
function autoRoundsDefault(env = process.env) {
|
|
131
|
+
const raw = env && env.AEGIS_AUTO_ROUNDS;
|
|
132
|
+
if (raw === undefined || raw === null) return true;
|
|
133
|
+
const val = String(raw).trim().toLowerCase();
|
|
134
|
+
if (!val) return true;
|
|
135
|
+
return !AUTO_ROUNDS_OFF.has(val);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Decide what one round-horizon ask becomes while auto mode is on.
|
|
140
|
+
*
|
|
141
|
+
* Pure, because this is budget arithmetic on a keystroke-less path: the caller
|
|
142
|
+
* only renders the answer and must not be trusted to keep the count. `used` is
|
|
143
|
+
* the running tally the caller holds and echoes back, so an ask that IS shown
|
|
144
|
+
* to the human resets it — the human was asked, so the next block of automatic
|
|
145
|
+
* continuations starts clean.
|
|
146
|
+
*
|
|
147
|
+
* { auto: true, used: n } → answer the ask "yes" without a dialog
|
|
148
|
+
* { auto: false, used: n } → show the real ask (allowance spent, or off)
|
|
149
|
+
*/
|
|
150
|
+
function autoContinuePlan({ on = false, used = 0, limit = DEFAULT_AUTO_CONTINUES } = {}) {
|
|
151
|
+
const cap = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : DEFAULT_AUTO_CONTINUES;
|
|
152
|
+
const spent = Number.isFinite(used) && used > 0 ? Math.floor(used) : 0;
|
|
153
|
+
if (!on) return { auto: false, used: spent, cap };
|
|
154
|
+
if (spent >= cap) return { auto: false, used: 0, cap };
|
|
155
|
+
return { auto: true, used: spent + 1, cap };
|
|
156
|
+
}
|
|
157
|
+
|
|
76
158
|
/** The path a file-writing tool call names, in either spelling the engine uses. */
|
|
77
159
|
function writtenPath(tool) {
|
|
78
160
|
const args = (tool && tool.args) || {};
|
|
@@ -906,6 +988,10 @@ module.exports = {
|
|
|
906
988
|
isAutonomousRequest,
|
|
907
989
|
maxRounds,
|
|
908
990
|
withRoundHorizon,
|
|
991
|
+
DEFAULT_AUTO_CONTINUES,
|
|
992
|
+
autoContinueLimit,
|
|
993
|
+
autoRoundsDefault,
|
|
994
|
+
autoContinuePlan,
|
|
909
995
|
resolveModel,
|
|
910
996
|
ignoredEnvModel,
|
|
911
997
|
resolveEffort,
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|